@g1cloud/entity-modeler-next 5.0.0-alpha.2 → 5.0.0-alpha.3
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/README.md +31 -17
- package/dist/core/migrateLegacyMoney.d.ts +8 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +9346 -9157
- package/dist/entity-modeler.umd.cjs +15 -15
- package/dist/index.d.ts +1 -0
- package/dist/view/EntityBasicsSection.vue.d.ts +8 -1
- package/dist/view/EntityIndexSection.vue.d.ts +7 -1
- package/dist/view/EntityOperationsSection.vue.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`).trim()}function Je(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $e(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Hl(e){return`<text ${[`x="${$e(e.x)}"`,`y="${$e(e.y)}"`,`fill="${Je(e.fill)}"`,`font-size="${$e(e.fontSize)}"`,e.fontFamily?`font-family="${Je(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Je(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Je(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Je(e.text)}</text>`}function Mu(e){return`<line x1="${$e(e.x1)}" y1="${$e(e.y)}" x2="${$e(e.x2)}" y2="${$e(e.y)}" stroke="${Je(e.stroke)}" stroke-width="${$e(e.strokeWidth??1)}" />`}function Bu(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 Du(e,t,o,i,a){return[`M${$e(e+a.tl)},${$e(t)}`,`L${$e(e+o-a.tr)},${$e(t)}`,a.tr?`Q${$e(e+o)},${$e(t)} ${$e(e+o)},${$e(t+a.tr)}`:"",`L${$e(e+o)},${$e(t+i-a.br)}`,a.br?`Q${$e(e+o)},${$e(t+i)} ${$e(e+o-a.br)},${$e(t+i)}`:"",`L${$e(e+a.bl)},${$e(t+i)}`,a.bl?`Q${$e(e)},${$e(t+i)} ${$e(e)},${$e(t+i-a.bl)}`:"",`L${$e(e)},${$e(t+a.tl)}`,a.tl?`Q${$e(e)},${$e(t)} ${$e(e+a.tl)},${$e(t)}`:"","Z"].filter(Boolean).join(" ")}function ta(e){const t=Bu(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${Je(e.fill)}"`,`stroke="${Je(e.stroke)}"`,`stroke-width="${$e(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Je(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${$e(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Du(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${$e(e.x)}" y="${$e(e.y)}" width="${$e(e.w)}" height="${$e(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Mu(r));for(const r of e.texts)l.push(Hl(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Ou(e){const o=[`<path ${[`d="${Je(e.d)}"`,'fill="none"',`stroke="${Je(e.stroke)}"`,`stroke-width="${$e(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Je(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Hl(i));return`<g>${o.join("")}</g>`}function Fl(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${$e(t)}" y="${$e(o)}" width="${$e(i)}" height="${$e(a)}" fill="${Je(e.background)}" />`);for(const r of e.groups)l.push(ta(r));for(const r of e.edges)l.push(Ou(r));for(const r of e.entities)l.push(ta(r));for(const r of e.notes)l.push(ta(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${$e(t)} ${$e(o)} ${$e(i)} ${$e(a)}" width="${$e(i)}" height="${$e(a)}">`+l.join("")+"</svg>"}const Lu=["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"],Pu=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"]),zu=Lu.filter(e=>!Pu.has(e)),Uu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function na(e){return Uu[e]??e}const Hu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]);function Gl(e,t=zu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ht="CustomType",Ro="GroupCodeEnum",Yl="String",Wl=[{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:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{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:Ro,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ht,label:"CustomType"}],Fu=new Map(Wl.map(e=>[e.value,e.label]));function Dn(e){return Fu.get(e)??e}const Gu=new Set([Ro,"CustomMoneyType"]),Yu=Wl.filter(e=>!Gu.has(e.value)).map(e=>e.value===Ht?{...e,label:"CustomType (사용자정의)"}:e);function ql(e,t=[]){const o=t.map(a=>{var r,s;const l=((r=a.label)==null?void 0:r.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:l?`${a.type} (${l})`:a.type}}),i=[...Yu,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Dn(e)},...i]:i}function Wu(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Kl(e,t){var a;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.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!=="EXACTLY_ONE_INSTANCE")return((a=i.jpa)==null?void 0:a.collectionType)??"LIST"}function oa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${Dn(t.type)}>`:Wu(t)?Dn(t.type):e==="CLASS"?t.type===Ht&&t.customType||Dn(t.type):na(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function On(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Vo(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const ia=63;function Ao(e){if(!e)return null;const t=e.length;return t<=ia?null:`물리명이 ${ia}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Xl(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 Ln(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function qu(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=l.get(f)??o;if(p===o)d(f);else if(p===i){const m=r.slice(r.indexOf(f)),h=[...m].sort().join(" ");c.has(h)||(c.add(h),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function aa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function jl(e,t){var l,r,s;const o=[];for(const c of aa(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(m=>m.attrType!=="DIVIDER");if(ct(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(m=>m.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),ct((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const m of d.filter(h=>h.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${m.name}"`});for(const m of d.filter(h=>h.identifier&&h.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${m.name}"`});for(const m of d)if(!m.identifier)for(const h of m.dbAttrs)!h.autoIncrement&&ct(h.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`채번(${h.autoIncrement?"auto increment":`시퀀스 "${h.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${m.name}"에 설정되어 있습니다`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const m of aa(d,h=>h.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${m.name}"`});for(const m of d)ct(m.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(m=>m.dbAttrs).filter(m=>m.sharedColumnRef==null);for(const m of aa(u,h=>h.physicalName))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${m.physicalName}"`});for(const m of u){const h=Ao(m.physicalName);h&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:h}),t!=null&&t.reservedWords&&!ct(m.physicalName)&&t.reservedWords.has(m.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${m.physicalName}"`}),t!=null&&t.selectableDataTypes&&!ct(m.dataType)&&!t.selectableDataTypes.has(m.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${m.dataType}"`}),!ct(m.dataType)&&Hu.has(m.dataType)&&!m.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`${m.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const m=On(d.flatMap(h=>h.dbAttrs));for(const h of d){if(h.attrType!=="EMBED_PREDEF")continue;const g=t.embeddableCatalog.find(N=>N.type===h.type);g&&h.dbAttrs.forEach((N,b)=>{if(N.sharedColumnRef==null)return;const E=g.fields[b],y=m.get(N.sharedColumnRef);if(!E||!y)return;(y.dataType!==E.dataType||(y.length??null)!==(E.length??null)||(y.scale??null)!==(E.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:N.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${Xl(y)})이 ${E.name??"컬럼"} 정의(${Xl(E)})와 다릅니다`})})}}for(const m of d){const h=m.dbAttrs[0];if(!(h!=null&&h.multiValue))continue;m.type===Ro&&h.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${m.type||"타입 미지정"} / ${h.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const f=(s=c.table)==null?void 0:s.physicalName,p=Ao(f);p&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:p}),t!=null&&t.reservedWords&&!ct(f)&&t.reservedWords.has(f.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${f}"`});for(const m of c.indexes??[]){const h=Ao(m.name);h&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:h}),t!=null&&t.reservedWords&&!ct(m.name)&&t.reservedWords.has(m.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${m.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){Ln(c.end1.multiplicity)&&Ln(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],p=f.includes("ALL"),m=f.includes("REMOVE");p&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||p)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${p?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Ln(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&Ln(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Ln(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of qu(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!ct(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function la(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function mn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>mn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!mn(e[i],t[i]))return!1;return!0}return!1}function Ft(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||mn(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function Gt(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),l=[],r=[],s=[];for(const[d,u]of a){const f=i.get(d);f?s.push({cur:f,tgt:u}):l.push(u)}for(const[d,u]of i)a.has(d)||r.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return l.sort(c),r.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:l,removed:r,common:s}}function Ku(e,t){const o=new Set(e),i=new Set(t),a=t.filter(r=>!o.has(r)).sort(),l=e.filter(r=>!i.has(r)).sort();return{added:a,removed:l}}const Xu=new Set(["attributes","operations","indexes","rev"]),ju=new Set(["end1","end2","rev"]),Zu=new Set(["memberEntityRefs","rev"]),Zl=new Set(["modelId"]),Ju=new Set(["modelId","columns"]),Qu=new Set([]);function ef(e,t,o,i){const a=Gt(t.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=Ft(s,c,Zl);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Gt(t.operations??[],o.operations??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of l.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){const d=Ft(s,c,Zl);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Gt(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of r.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){if(!mn(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=Ft(s,c,Ju);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function tf(e,t,o){const i=Gt(e.entities??[],t.entities??[],r=>r.modelId);for(const r of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:r.modelId});for(const r of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:r.modelId,value:la(r)});for(const{cur:r,tgt:s}of i.common){const c=Ft(r,s,Xu);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),ef(r.modelId,r,s,o)}const a=Gt(e.associations??[],t.associations??[],r=>r.modelId);for(const r of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:r.modelId});for(const r of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:r.modelId,value:la(r)});for(const{cur:r,tgt:s}of a.common){const c=Ft(r,s,ju);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Ft(r[d]??{},s[d]??{},Qu);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Gt(e.groups??[],t.groups??[],r=>r.modelId);for(const r of l.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:r.modelId});for(const r of l.added)o.push({kind:"group.add",casUnit:"logical",groupRef:r.modelId,value:la(r)});for(const{cur:r,tgt:s}of l.common){const c=Ft(r,s,Zu);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Ku(r.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u})}}function To(e,t,o,i,a,l,r){const s=Gt(e,t,o);for(const c of s.removed)r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0});for(const c of s.added)r.push({kind:i,casUnit:"layout",[l]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)mn(c,d)||(r.push({kind:a,casUnit:"layout",[l]:o(c),value:void 0}),r.push({kind:i,casUnit:"layout",[l]:o(d),value:d}))}function nf(e,t,o){To(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),To(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),To(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),To(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function of(e,t){const o=[];return tf(e.logical,t.logical,o),nf(e.layout,t.layout,o),o}function af(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 lf={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 rf{constructor(t){Oe(this,"out",[]);Oe(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Pn(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Pn(t),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({...Pn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...Pn(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Pn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Pn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function dt(e,t,o,i){if(o==null||typeof o!="object")return;const a=lf[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Yt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ra(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Rt(e,t){var l,r,s,c,d,u,f,p;const o=af(t),i=new rf(t.field),a=[...e].sort((m,h)=>m.seq-h.seq);for(const m of a)for(const h of m.ops)switch(o){case"entity":if(h.entityRef!==t.entityRef)break;h.kind==="entity.add"?dt(i,m,h.value,"entity"):h.kind==="entity.update"?Yt(i,m,h.patch):h.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=ra((l=h.value)==null?void 0:l.attributes,t.attributeRef);g&&dt(i,m,g,"attribute")}else h.kind==="attribute.add"&&((r=h.value)==null?void 0:r.modelId)===t.attributeRef?dt(i,m,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===t.attributeRef?Yt(i,m,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===t.attributeRef||h.kind==="entity.remove")&&i.remove(m);break;case"operation":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=ra((s=h.value)==null?void 0:s.operations,t.operationRef);g&&dt(i,m,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===t.operationRef?dt(i,m,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===t.operationRef?Yt(i,m,h.patch):(h.kind==="operation.remove"&&h.operationRef===t.operationRef||h.kind==="entity.remove")&&i.remove(m);break;case"index":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=ra((d=h.value)==null?void 0:d.indexes,t.indexRef);g&&dt(i,m,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===t.indexRef?dt(i,m,h.value,"index"):h.kind==="index.update"&&h.indexRef===t.indexRef?Yt(i,m,h.patch):(h.kind==="index.remove"&&h.indexRef===t.indexRef||h.kind==="entity.remove")&&i.remove(m);break;case"association":if(h.associationRef!==t.associationRef)break;h.kind==="association.add"?dt(i,m,h.value,"association"):h.kind==="association.update"?Yt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(h.associationRef!==t.associationRef)break;if(h.kind==="association.add"){const g=(f=h.value)==null?void 0:f[t.end];dt(i,m,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===t.end?Yt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"group":if(h.groupRef!==t.groupRef)break;if(h.kind==="group.add"){dt(i,m,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const N of g)i.member(m,N,!1)}else h.kind==="group.update"?Yt(i,m,h.patch):h.kind==="group.remove"?i.remove(m):h.kind==="group.addMember"&&h.entityRef!=null?i.member(m,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(m,h.entityRef,!0);break}return i.result()}function sf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function pn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function cf(e,t){const o=new Set,i=new Set,a=new Set;for(const l of e)for(const r of l.ops){const s=r;if(r.kind==="entity.add"&&s.entityRef===t){const c=s.value;pn(c==null?void 0:c.attributes,o),pn(c==null?void 0:c.operations,i),pn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?pn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?pn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?pn([s.value],a):(r.kind==="index.update"||r.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function Mo(e,t){return e.map(o=>({...o,subject:t}))}function Jl(e,t){const o=e.filter(s=>s.ops.some(c=>sf(c,t))),{attributes:i,operations:a,indexes:l}=cf(o,t),r=[...Mo(Rt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Mo(Rt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Mo(Rt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Mo(Rt(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return r.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 Ql(e){return`${e.kind}:${e.ref}:${e.end??""}`}function df(e){var i,a,l;const t=new Set,o=(r,s)=>{typeof s=="string"&&t.add(`${r}:${s}:`)};for(const r of e)for(const s of r.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(l=c.value)==null?void 0:l.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function uf(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const l of a.ops){const r=l,s=l.kind;if(s.startsWith("entity."))typeof r.entityRef=="string"&&t.add(r.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=r.containerRef??r.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof r.associationRef=="string"&&o.add(r.associationRef):s.startsWith("group.")&&typeof r.groupRef=="string"&&i.add(r.groupRef)}return{entities:t,associations:o,groups:i}}function ff(e){const{entities:t,associations:o,groups:i}=uf(e),a=[];for(const l of t)for(const r of Jl(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Rt(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Rt(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Rt(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function er(e){const t=ff(e),o=df(e),i=new Map;for(const r of t){const s=Ql(r.subject),c=i.get(s);(c===void 0||r.seq<c)&&i.set(s,r.seq)}const a=new Map;for(const r of t){let s=a.get(r.seq);s||(s={meta:r,subjects:new Map},a.set(r.seq,s));const c=Ql(r.subject);let d=s.subjects.get(c);if(!d){const u=r.removed?"remove":i.get(c)===r.seq&&o.has(c)?"add":"update";d={subject:r.subject,verb:u,fields:[]},s.subjects.set(c,d)}r.removed?d.verb="remove":d.fields.push({field:r.field,value:r.value,...r.oldValue!==void 0?{oldValue:r.oldValue}:{}})}const l=[];for(const[r,s]of a){const c=s.meta;l.push({seq:r,...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 l.sort((r,s)=>s.seq-r.seq)}function Ce(){return crypto.randomUUID()}class sa{constructor(t){Oe(this,"undoStack",[]);Oe(this,"redoStack",[]);Oe(this,"savePoint",null);Oe(this,"listeners",new Set);Oe(this,"commandListeners",new Set);Oe(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"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.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function tr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Fe(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function ot(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Be(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function _t(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function ca(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=tr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Fe(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function da(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=tr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Fe(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:l>=0?{item:i.layout.entityLayouts[l],index:l}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(p=>p.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}l>=0&&i.layout.entityLayouts.splice(l,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,l)=>a.index-l.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,l)=>a.index-l.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const l=i.logical.groups.find(r=>r.modelId===a.groupId);l==null||l.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const l of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:l.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:l.item.modelId,value:l.item});for(const l of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:l.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:l.item.associationRef,value:l.item,incidental:!0});for(const l of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:l.groupId,groupRef:l.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function nr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Be(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Be(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function or(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Be(i,e);o=a.name,a.name=t},invert(i){Be(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function hn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Fe(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.location},l.location={...t}},invert(i){const a=Fe(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(t)],invert:[i(o)]}}}}function ir(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Fe(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a].geo;o={...l.size},l.size={...t}},invert(i){const a=Fe(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(t)],invert:[i(o)]}}}}function zn(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function ar(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Fe(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=zn(l.style,t)},invert(i){const a=Fe(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Fe(i,e),l=a>=0?i.layout.entityLayouts[a].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(l)],invert:[r(o)]}}}}function lr(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Fe(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.collapsed,l.collapsed=t},invert(i){const a=Fe(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(t)],invert:[i(o)]}}}}function ua(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=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=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((l,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:l.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:a}}}}function Bo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Fe(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=zn(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Fe(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Fe(a,e),r=l>=0?a.layout.entityLayouts[l].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function fa(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function rr(e,t){const o={},i=a=>{const l=a.logical.groups.find(r=>r.modelId===e);if(!l)throw new Error(`그룹 없음: ${e}`);return l};return{label:"그룹 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function ma(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e);t={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){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function sr(e,t){let o=!1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에 편입",apply(a){const l=i(a);l&&!l.memberEntityRefs.includes(t)&&(l.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const l=i(a),r=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1;r>=0&&l.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function Do(e,t){let o=-1;const i=a=>a.logical.groups.find(l=>l.modelId===e);return{label:"그룹에서 제외",apply(a){const l=i(a);o=(l==null?void 0:l.memberEntityRefs.indexOf(t))??-1,o>=0&&l.memberEntityRefs.splice(o,1)},invert(a){var l;o<0||(l=i(a))==null||l.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function cr(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.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(t)],invert:[i(o)]}}}}function dr(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(l=>l.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(t)],invert:[i(o)]}}}}function ur(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=zn(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e),l=r=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function vt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Be(o,e).attributes.push(t)},invert(o){const i=Be(o,e),a=i.attributes.findIndex(l=>l.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function Wt(e,t,o){const i={},a=l=>{const r=Be(l,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function Vt(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Be(i,e),l=a.attributes.findIndex(r=>r.modelId===t);if(l<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[l],index:l},a.attributes.splice(l,1)},invert(i){o&&Be(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function pa(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Be(a,e);i=l.attributes.map(f=>({...f}));const r=new Set(t),s=l.attributes.filter(f=>r.has(f.modelId)),c=l.attributes.filter(f=>!r.has(f.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];l.attributes.splice(0,l.attributes.length,...u),l.attributes.forEach((f,p)=>f.order=p)},invert(a){i&&Be(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Be(a,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function fr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Be(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Be(i,e),l=((r=a.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;l>=0&&a.operations.splice(l,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:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function mr(e,t,o){const i={},a=l=>{var s;const r=(s=Be(l,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function pr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Be(i,e),l=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(l<0)throw new Error(`메서드 없음: ${t}`);const r=a.operations.length===1;o={item:a.operations[l],index:l,wasSole:r},a.operations.splice(l,1),r&&(a.operations=void 0)},invert(i){if(!o)return;const a=Be(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:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function hr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Be(a,e),r=l.operations??[];i=r.map(p=>({...p}));const s=new Set(t),c=r.filter(p=>s.has(p.modelId)),d=r.filter(p=>!s.has(p.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((p,m)=>p.order=m),l.operations=r},invert(a){if(!i)return;const l=Be(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Be(a,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:l}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function yr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Fe(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=zn(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Fe(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Fe(a,e),r=l>=0?a.layout.entityLayouts[l].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function ha(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(l=>l.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:t,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 ya(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(l=>l.associationRef===e);t={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){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Oo(e,t){const o={},i=a=>{const l=a.logical.associations.find(r=>r.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l};return{label:"관계 수정",apply(a){const l=i(a);for(const r of Object.keys(t))o[r]=l[r];Object.assign(l,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function yn(e,t,o){const i={},a=l=>{const r=l.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function gr(e,t){return{label:"인덱스 추가",apply(o){const i=Be(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Be(o,e),a=((l=i.indexes)==null?void 0:l.findIndex(r=>r.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function br(e,t,o){const i={},a=l=>{var s;const r=(s=Be(l,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(l){const r=a(l);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(l){Object.assign(a(l),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function _r(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Be(i,e),l=((r=a.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(l<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[l],index:l},a.indexes.splice(l,1)},invert(i){o&&Be(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const ut=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Un=(e,t)=>{var o;return((o=ot(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function vr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=ot(a,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...l.waypoints[t]},l.waypoints.splice(t,1,{...o})},invert(a){const l=ot(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=Un(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[ut(e,l)],invert:[ut(e,r)]}}}}function wr(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=ot(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=ot(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Un(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[ut(e,a)],invert:[ut(e,l)]}}}}function Er(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=ot(a,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);i=l.waypoints.map(r=>({...r})),l.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(a){const l=ot(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[ut(e,Un(a,e))],invert:[ut(e,i??[])]}}}}function kr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=ot(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=ot(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[ut(e,Un(o,e))],invert:[ut(e,t??[])]}}}}function Nr(e,t,o){return{label:"waypoint 추가",apply(i){const a=ot(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=ot(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Un(i,e),l=a.slice();return l.splice(t,1),{forward:[ut(e,a)],invert:[ut(e,l)]}}}}function xr(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.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 ga(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Hn(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(l=>l.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(t)],invert:[i(o)]}}}}function $r(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(l=>l.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(t)],invert:[i(o)]}}}}function Sr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Ir(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(l=>l.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=zn(a.style,t)},invert(i){const a=i.layout.notes.find(l=>l.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(r=>r.modelId===e),l=r=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:r}});return{forward:[l(a==null?void 0:a.style)],invert:[l(o)]}}}}function Cr(e,t){let o=!1,i=!1;const a=l=>l.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(l){const r=a(l);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(l){if(!o)return;const r=a(l);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function Rr(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var r;const l=i(a);o=((r=l==null?void 0:l.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&l.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const l=i(a);l&&(l.memberNoteRefs||(l.memberNoteRefs=[]),l.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const At=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Lo=(e,t,o)=>{var i;return((i=_t(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Vr(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const l=a.layout.notes.find(r=>r.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);if(l.connections||(l.connections=[],i=!0),l.connections.some(r=>r.targetRef===t)){o=!1;return}l.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const l=a.layout.notes.find(s=>s.modelId===e);if(!(l!=null&&l.connections))return;const r=l.connections.findIndex(s=>s.targetRef===t);r>=0&&l.connections.splice(r,1),i&&delete l.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function Ar(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const a=i.layout.notes.find(s=>s.modelId===e),l=((r=a==null?void 0:a.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||l<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[l],index:l},a.connections.splice(l,1)},invert(i){if(!o)return;const a=i.layout.notes.find(l=>l.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:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function Tr(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=_t(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=_t(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Lo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[At(e,t,r)],invert:[At(e,t,s)]}}}}function Mr(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=_t(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=_t(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Lo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[At(e,t,l)],invert:[At(e,t,r)]}}}}function Br(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=_t(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=_t(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Lo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[At(e,t,l)],invert:[At(e,t,r)]}}}}function Dr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=_t(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=_t(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[At(e,t,Lo(i,e,t))],invert:[At(e,t,o??[])]}}}}function De(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(l=>{if(!l.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${l.label}`);return l.emitOps(i)});return{forward:a.flatMap(l=>l.forward),invert:a.slice().reverse().flatMap(l=>l.invert)}}}}const mf=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:ha,addAttribute:vt,addEntity:ca,addEntityToGroup:sr,addGroup:fa,addIndex:gr,addNote:xr,addNoteConnection:Vr,addNoteConnectionWaypoint:Mr,addNoteToGroup:Cr,addOperation:fr,addWaypoint:Nr,clearNoteConnectionWaypoints:Dr,clearWaypoints:kr,composite:De,moveEntity:hn,moveGroup:cr,moveNote:Hn,moveNoteConnectionWaypoint:Tr,moveWaypoint:vr,removeAssociation:ya,removeAttribute:Vt,removeEntity:da,removeEntityFromGroup:Do,removeGroup:ma,removeIndex:_r,removeNote:ga,removeNoteConnection:Ar,removeNoteConnectionWaypoint:Br,removeNoteFromGroup:Rr,removeOperation:pr,removeWaypoint:wr,renameEntity:or,reorderAttributes:pa,reorderOperations:hr,resizeEntity:ir,resizeGroup:dr,resizeNote:$r,setAllEntitiesCollapsed:ua,setAttributeSwatch:Bo,setEntityCollapsed:lr,setEntitySwatch:ar,setGroupSwatch:ur,setNoteMemo:Sr,setNoteSwatch:Ir,setOperationSwatch:yr,translateWaypoints:Er,updateAssociation:Oo,updateAssociationEnd:yn,updateAttribute:Wt,updateEntity:nr,updateGroup:rr,updateIndex:br,updateOperation:mr},Symbol.toStringTag,{value:"Module"}));class Or{constructor(){Oe(this,"revs",new Map);Oe(this,"layoutVersion",0);Oe(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class Lr{constructor(t){Oe(this,"cache",new Or);Oe(this,"newClientOpId");Oe(this,"debounceMs");Oe(this,"emissions",new WeakMap);Oe(this,"open",null);Oe(this,"debounceHandle",null);Oe(this,"queue",[]);Oe(this,"sending",!1);Oe(this,"_frozen",!1);Oe(this,"stack",null);Oe(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Ce,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,l)=>this.handle(i,a,l));return()=>{o(),this.stack===t&&(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(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let a;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const l=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=l,this.emissions.set(t,{forward:l,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:l,inv:a.invert},this.startDebounce();return}l.length&&this.enqueue(this.buildBatch(l))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((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(t){const o={},i=new Set;let a=!1,l=!1;for(const r of t)if(r.casUnit==="logical")if(a=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(l=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return l&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(l){this.sending=!1,(a=(i=this.opts).onError)==null||a.call(i,l),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const Pr=["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","group.add"];function pf(e,t){const o=()=>e.entities.filter(l=>{var r;return((r=l.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(l=>l.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function hf(e,t){const o=()=>e.attributes.filter(l=>l.name===t.ref),i=()=>e.attributes.filter(l=>l.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function zr(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function qe(e,t){const o=pf(e,t);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 yf(e,t){const o=hf(e,t);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 gf(e,t){const o=()=>e.attributes.flatMap(l=>l.dbAttrs).filter(l=>l.physicalName===t.ref),i=()=>e.attributes.filter(l=>l.name===t.ref).flatMap(l=>l.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function bf(e,t){const o=gf(e,t);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 _f(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function vf(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function wf(e,t){const o=_f(e,t);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 Ef(e,t){const o=vf(e,t);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 Ur(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...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 Hr(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Fr(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=bf(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}r.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:l(),name:t.name,unique:t.unique??!1,columns:r,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function kf(e,t,o={}){const i=o.mkId??Ce,a=[],l=[],r=new Map,s=new Map,c=new Set;for(const d of t)d.kind==="entity.add"&&(c.add(d.spec.name),d.spec.physicalName&&c.add(d.spec.physicalName));return t.forEach((d,u)=>{var f;switch(d.kind){case"entity.add":{const p=i(),m={modelId:p,name:d.spec.name,stereotype:d.spec.stereotype??"JPA_ENTITY",attributes:[],...d.spec.physicalName?{table:{physicalName:d.spec.physicalName}}:{}},h={ref:d.spec.name};let g=!1;for(const[E,y]of(d.spec.attributes??[]).entries()){if(y.type==="GroupCodeEnum"&&!y.groupCode){l.push({code:"groupcode-required",opIndex:u,entity:h,handle:{ref:y.name}}),g=!0;continue}m.attributes.push(Ur(y,E,i))}const N=(d.spec.operations??[]).map((E,y)=>Hr(E,y,i));N.length&&(m.operations=N);const b=[];for(const E of d.spec.indexes??[]){const y=Fr(m,E,u,h,l,i);y?b.push(y):g=!0}if(b.length&&(m.indexes=b),g)break;a.push({kind:"entity.add",casUnit:"logical",entityRef:p,value:m});break}case"entity.update":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}a.push({kind:"entity.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,patch:d.patch});break}case"entity.remove":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}a.push({kind:"entity.remove",casUnit:"logical",entityRef:p.value.modelId});break}case"attribute.add":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}if(d.spec.type==="GroupCodeEnum"&&!d.spec.groupCode){l.push({code:"groupcode-required",opIndex:u,entity:d.entity,handle:{ref:d.spec.name}});break}const m=r.get(p.value.modelId)??p.value.attributes.length;r.set(p.value.modelId,m+1);const h=Ur(d.spec,m,i);a.push({kind:"attribute.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,value:h});break}case"attribute.update":case"attribute.remove":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}const m=yf(p.value,d.attribute);if(!m.ok){l.push(m.reason==="not-found"?{code:"attribute-not-found",opIndex:u,entity:d.entity,handle:d.attribute}:{code:"attribute-ambiguous",opIndex:u,entity:d.entity,handle:d.attribute,matches:m.matches});break}d.kind==="attribute.update"?a.push({kind:"attribute.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,attributeRef:m.value.modelId,patch:d.patch}):a.push({kind:"attribute.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,attributeRef:m.value.modelId});break}case"association.add":{const p=qe(e,d.spec.from),m=qe(e,d.spec.to);if(p.ok||l.push(Ke(p.reason,u,d.spec.from,p.matches,c)),m.ok||l.push(Ke(m.reason,u,d.spec.to,m.matches,c)),!p.ok||!m.ok)break;if(d.spec.identifying&&p.value.modelId===m.value.modelId){l.push({code:"self-identifying",opIndex:u,handle:{from:d.spec.from,to:d.spec.to}});break}const h=i(),g={modelId:h,...d.spec.identifying!=null?{identifying:d.spec.identifying}:{},end1:{entityRef:p.value.modelId,multiplicity:d.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:m.value.modelId,multiplicity:d.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:d.spec.composition??!1}};a.push({kind:"association.add",casUnit:"logical",associationRef:h,value:g});break}case"association.remove":{const p=qe(e,d.association.from),m=qe(e,d.association.to);if(p.ok||l.push(Ke(p.reason,u,d.association.from,p.matches,c)),m.ok||l.push(Ke(m.reason,u,d.association.to,m.matches,c)),!p.ok||!m.ok)break;const h=zr(e,p.value.modelId,m.value.modelId);if(h.length!==1){l.push(h.length===0?{code:"association-not-found",opIndex:u,handle:d.association}:{code:"association-ambiguous",opIndex:u,handle:d.association,matches:h.map(g=>g.modelId)});break}a.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const p=Gr(e,d.association,u,l,c);if(!p)break;a.push({kind:"association.update",casUnit:"logical",containerRef:p.modelId,associationRef:p.modelId,patch:d.patch});break}case"associationEnd.update":{const p=Gr(e,d.association,u,l,c);if(!p)break;const m=d.end==="from"?"end1":"end2";a.push({kind:"associationEnd.update",casUnit:"logical",containerRef:p.modelId,associationRef:p.modelId,end:m,patch:d.patch});break}case"index.add":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}const m=Fr(p.value,d.spec,u,d.entity,l,i);if(!m)break;a.push({kind:"index.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.modelId,value:m});break}case"index.update":case"index.remove":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}const m=wf(p.value,d.index);if(!m.ok){l.push(m.reason==="not-found"?{code:"index-not-found",opIndex:u,entity:d.entity,handle:d.index}:{code:"index-ambiguous",opIndex:u,entity:d.entity,handle:d.index,matches:m.matches});break}if(d.kind==="index.update"){if("columns"in d.patch){l.push({code:"index-columns-patch-unsupported",opIndex:u,entity:d.entity,handle:d.index});break}a.push({kind:"index.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.value.modelId,patch:d.patch})}else a.push({kind:"index.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.value.modelId});break}case"operation.add":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}const m=s.get(p.value.modelId)??((f=p.value.operations)==null?void 0:f.length)??0;s.set(p.value.modelId,m+1);const h=Hr(d.spec,m,i);a.push({kind:"operation.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const p=qe(e,d.entity);if(!p.ok){l.push(Ke(p.reason,u,d.entity,p.matches,c));break}const m=Ef(p.value,d.operation);if(!m.ok){l.push(m.reason==="not-found"?{code:"operation-not-found",opIndex:u,entity:d.entity,handle:d.operation}:{code:"operation-ambiguous",opIndex:u,entity:d.entity,handle:d.operation,matches:m.matches});break}d.kind==="operation.update"?a.push({kind:"operation.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:m.value.modelId,patch:d.patch}):a.push({kind:"operation.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:m.value.modelId});break}case"group.add":{const p=[];let m=!1;for(const N of d.spec.members){const b=qe(e,N);if(!b.ok){l.push(Ke(b.reason,u,N,b.matches,c)),m=!0;continue}p.push(b.value.modelId)}if(m)break;const h=i(),g={modelId:h,excludeDDLGeneration:d.spec.excludeDDLGeneration??!1,memberEntityRefs:p,...d.spec.name?{name:d.spec.name}:{},...d.spec.packageName?{packageName:d.spec.packageName}:{},...d.spec.description?{description:d.spec.description}:{}};a.push({kind:"group.add",casUnit:"logical",groupRef:h,value:g});break}}}),l.length?{ok:!1,errors:l}:{ok:!0,ops:a}}function Ke(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function Gr(e,t,o,i,a){const l=qe(e,t.from),r=qe(e,t.to);if(l.ok||i.push(Ke(l.reason,o,t.from,l.matches,a)),r.ok||i.push(Ke(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=zr(e,l.value.modelId,r.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const Yr={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Nf={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},xf={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."},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},Po={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},$f={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부)."},identifier:{type:"boolean"},notNull:{type:"boolean"},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:{...Po,description:"속성 설명(다국어)."},columnLogicalName:{...Po,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."}},required:["name","type"],additionalProperties:!1},Wr={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Sf={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Wr,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Wr,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},If={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Yr,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},Cf={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Po,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Rf={type:"object",properties:{name:{...Po,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},Vf={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function Ge(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Af={"entity.add":Ge("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":Ge("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":Ge("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":Ge("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":Ge("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":Ge("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":Ge("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":Ge("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":Ge("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":Ge("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":Ge("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":Ge("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":Ge("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":Ge("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":Ge("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":Ge("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":Ge("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},qr={anyOf:Pr.map(e=>Af[e])},Tf={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Yr,assocHandle:Nf,entitySpec:xf,attrSpec:$f,assocSpec:Sf,indexSpec:If,operationSpec:Cf,groupSpec:Rf,patch:Vf,symbolicOp:qr}};function Mf(e,t,o,i={}){const a=i.mkClientOpId??Ce,l=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&l.add(s.containerRef);const r={};if(l.size){r.revs={};for(const s of l)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:a()}}const Kr={location:{x:0,y:0},size:{width:220,height:140}};function Xr(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 Bf=/^[-=_*~\s]{3,}$/;function Df(e){return e.attrType&&e.attrType!=="NORMAL"||!Bf.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Of(e,t){return e.attrType==="DIVIDER"||Df(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Xr)}}function Lf(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:l,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:l?{ko:l}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Pf(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function zf(e){var t,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(Of),operations:(t=e.operations)==null?void 0:t.map(Lf),indexes:(o=e.indexes)==null?void 0:o.map(Pf),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Uf(e){const t={};for(const i of e.attributes)i.style&&(t[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??{...Kr},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function jr(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 ba(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:jr(e)}}function Hf(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:ba(e.end1),end2:ba(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:t,layout:o}}function Zr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Jr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Qr(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function es(e,t){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_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Xr)}}function Ff(e,t,o){var N,b;const i=Zr(e.end1.attribute),a=Zr(e.end2.attribute);if(i===a)return Hf(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(b=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((E,y)=>Math.max(E,y.order),-1)+1:s.order??0,p={...es(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=(E,y)=>({entityRef:E.endModel.refId,multiplicity:E.multiplicity,navigable:E.navigable,composition:E.composition,attributeRef:y?d:p.modelId,legacyNavRaw:y?void 0:E.attribute,jpa:jr(E)}),h={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h.end1.attributeRef,targetColumnRef:h.end2.attributeRef,style:e.style};return{assoc:h,layout:g}}function Gf(e,t){const o=e.targetModelId?t.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 Yf(e,t,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((g,N)=>Math.max(g,N.order),-1)+1:r.order??0,d={...es(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>Gf(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...ba(g),legacyEmbedRaw:g.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Wf(e,t){var i,a,l,r;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(r=(l=s.end2)==null?void 0:l.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function ts(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:l,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=Wf(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:l,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function qf(e){return(e.schemaVersion??1)>=2&&"logical"in e?Kf(e):Xf(e)}function Kf(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Xf(e){var b,E;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,C)=>{o.push(zf(y));const Z=Uf(y);Z.geo={location:{x:Z.geo.location.x+C.x,y:Z.geo.location.y+C.y},size:Z.geo.size},i.push(Z);for(const q of y.ownedAssociations??[])c.push(q)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const C=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:C.map(q=>q.modelId)});const Z=((b=y.geo)==null?void 0:b.location)??u;if(y.geo){const q=(y.notes??[]).map(te=>te.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,memberNoteRefs:q.length?q:void 0})}for(const q of C)d(q,Z);for(const q of y.notes??[])f.push(ts(q,Z))}const p=new Map(o.map(y=>[y.modelId,y])),m=new Map,h=new Map;for(const y of o)for(const C of y.attributes)for(const Z of C.dbAttrs)m.set(Z.modelId,C.modelId),h.set(Z.modelId,Z);for(const y of c)for(const C of[y.end1,y.end2]){const Z=C.attribute;if(Z&&(((E=Z.dbAttrs)==null?void 0:E.length)??0)>0)for(const q of Z.dbAttrs)q.modelId&&m.set(q.modelId,Z.modelId)}for(const y of c){const C=Jr(y.end1.attribute),Z=Jr(y.end2.attribute),q=Qr(y.end1)||Qr(y.end2),{assoc:te,layout:P}=C!==Z||q?Yf(y,p,h):Ff(y,p,m);a.push(te),l.push(P)}const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>ts(y)),...f]}},N={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:N}}function ns(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 jf(e,t){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,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(ns),style:t}}function Zf(e,t){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:t}}function Jf(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Tt(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function Qf(e,t){const o=t==null?void 0:t.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 l;return{...ns(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function em(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function tm(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function nm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function om(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:nm(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function im(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var h;return((h=m.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.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((f,p)=>om(f,r[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:Tt(e.end1,c?s:u),end2:Tt(e.end2,c?u:s)}}function am(e,t,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:Tt(e.end1,e.end1.legacyEmbedRaw),end2:Tt(e.end2,e.end2.legacyEmbedRaw)};const a=im(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(h=>h.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(h=>h.modelId===s.attributeRef),f=t.logical.entities.find(h=>h.modelId===c.entityRef),p=u?Qf(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Tt(e.end1,l?m:p),end2:Tt(e.end2,r?m:p)}}return{...i,end1:Tt(e.end1),end2:Tt(e.end2)}}function os(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(p=>p.entityRef===e.modelId),r=t.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>t.layout.associationLayouts.find(m=>m.associationRef===p),c=(l==null?void 0:l.geo)??{...Kr},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 m;return jf(p,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var m;return Zf(p,(m=l==null?void 0:l.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>am(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Jf),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed}}function lm(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),l=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>is(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>os(c,t,o,i,r)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style}}function is(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function rm(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=em(e),l=tm(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>os(s,e,a,l)),groups:e.logical.groups.map(s=>lm(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>is(s))}}function sm(e,t={}){var a,l,r;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((l=t.revSeed)==null?void 0:l.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:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function Fn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function wt(e){return typeof e=="function"?e():n.unref(e)}const cm=typeof window<"u"&&typeof document<"u",dm=e=>typeof e<"u",um=Object.prototype.toString,fm=e=>um.call(e)==="[object Object]",mm=()=>{};function pm(e,t){function o(...i){return new Promise((a,l)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(l)})}return o}const as=e=>e();function hm(e=as){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...l)=>{t.value&&e(...l)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function ls(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function ym(e,t,o={}){const{eventFilter:i=as,...a}=o;return n.watch(e,pm(i,t),a)}function gn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=hm(i);return{stop:ym(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function gm(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var l;if((l=wt(t.replaceRef))!=null?l:!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 _a(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:h,throwOnTimeout:g}={}){let N=null;const E=[new Promise(y=>{N=n.watch(e,C=>{f(C)!==t&&(N==null||N(),y(C))},{flush:p,deep:m,immediate:!0})})];return h!=null&&E.push(ls(h,g).then(()=>wt(e)).finally(()=>N==null?void 0:N())),Promise.race(E)}function i(f,p){if(!n.isRef(f))return o(C=>C===f,p);const{flush:m="sync",deep:h=!1,timeout:g,throwOnTimeout:N}=p??{};let b=null;const y=[new Promise(C=>{b=n.watch([e,f],([Z,q])=>{t!==(Z===q)&&(b==null||b(),C(Z))},{flush:m,deep:h,immediate:!0})})];return g!=null&&y.push(ls(g,N).then(()=>wt(e)).finally(()=>(b==null||b(),wt(e)))),Promise.race(y)}function a(f){return o(p=>!!p,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,p){return o(m=>{const h=Array.from(m);return h.includes(f)||h.includes(wt(f))},p)}function d(f){return u(1,f)}function u(f=1,p){let m=-1;return o(()=>(m+=1,m>=f),p)}return Array.isArray(wt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return _a(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return _a(e,!t)}}}function va(e){return _a(e)}function bm(e){var t;const o=wt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const rs=cm?window:void 0;function ss(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=rs):[t,o,i,a]=e,!t)return mm;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,p,m)=>(u.addEventListener(f,p,m),()=>u.removeEventListener(f,p,m)),c=n.watch(()=>[bm(t),wt(a)],([u,f])=>{if(r(),!u)return;const p=fm(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(h=>s(u,m,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Fn(d),d}function _m(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function cs(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=rs,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=_m(t);return ss(a,l,u=>{u.repeat&&wt(s)||c(u)&&o(u)},r)}function vm(e){return JSON.parse(JSON.stringify(e))}function wa(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),h=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const N=y=>s?typeof s=="function"?s(y):vm(y):y,b=()=>dm(e[t])?N(e[t]):f,E=y=>{p?p(y)&&h(g,y):h(g,y)};if(c){const y=b(),C=n.ref(y);let Z=!1;return n.watch(()=>e[t],q=>{Z||(Z=!0,C.value=N(q),n.nextTick(()=>Z=!1))}),n.watch(C,q=>{!Z&&(q!==e[t]||u)&&E(q)},{deep:u}),C}else return n.computed({get(){return b()},set(y){E(y)}})}var wm={value:()=>{}};function zo(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Uo(o)}function Uo(e){this._=e}function Em(e,t){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&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Uo.prototype=zo.prototype={constructor:Uo,on:function(e,t){var o=this._,i=Em(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=km(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=ds(o[a],e.name,t);else if(t==null)for(a in o)o[a]=ds(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Uo(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function km(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function ds(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wm,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ea="http://www.w3.org/1999/xhtml";const us={svg:"http://www.w3.org/2000/svg",xhtml:Ea,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ho(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),us.hasOwnProperty(t)?{space:us[t],local:e}:e}function Nm(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ea&&t.documentElement.namespaceURI===Ea?t.createElement(e):t.createElementNS(o,e)}}function xm(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=Ho(e);return(t.local?xm:Nm)(t)}function $m(){}function ka(e){return e==null?$m:function(){return this.querySelector(e)}}function Sm(e){typeof e!="function"&&(e=ka(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Qe(i,this._parents)}function Im(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Cm(){return[]}function ms(e){return e==null?Cm:function(){return this.querySelectorAll(e)}}function Rm(e){return function(){return Im(e.apply(this,arguments))}}function Vm(e){typeof e=="function"?e=Rm(e):e=ms(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new Qe(i,a)}function ps(e){return function(){return this.matches(e)}}function hs(e){return function(t){return t.matches(e)}}var Am=Array.prototype.find;function Tm(e){return function(){return Am.call(this.children,e)}}function Mm(){return this.firstElementChild}function Bm(e){return this.select(e==null?Mm:Tm(typeof e=="function"?e:hs(e)))}var Dm=Array.prototype.filter;function Om(){return Array.from(this.children)}function Lm(e){return function(){return Dm.call(this.children,e)}}function Pm(e){return this.selectAll(e==null?Om:Lm(typeof e=="function"?e:hs(e)))}function zm(e){typeof e!="function"&&(e=ps(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Qe(i,this._parents)}function ys(e){return new Array(e.length)}function Um(){return new Qe(this._enter||this._groups.map(ys),this._parents)}function Fo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Fo.prototype={constructor:Fo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Hm(e){return function(){return e}}function Fm(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Fo(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Gm(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Fo(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Ym(e){return e.__data__}function Wm(e,t){if(!arguments.length)return Array.from(this,Ym);var o=t?Gm:Fm,i=this._parents,a=this._groups;typeof e!="function"&&(e=Hm(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],p=f.length,m=qm(e.call(u,u&&u.__data__,d,i)),h=m.length,g=s[d]=new Array(h),N=r[d]=new Array(h),b=c[d]=new Array(p);o(u,f,g,N,b,m,t);for(var E=0,y=0,C,Z;E<h;++E)if(C=g[E]){for(E>=y&&(y=E+1);!(Z=N[y])&&++y<h;);C._next=Z||null}}return r=new Qe(r,i),r._enter=s,r._exit=c,r}function qm(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Km(){return new Qe(this._exit||this._groups.map(ys),this._parents)}function Xm(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function jm(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new Qe(s,this._parents)}function Zm(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function Jm(e){e||(e=Qm);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new Qe(a,this._parents).order()}function Qm(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ep(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tp(){return Array.from(this)}function np(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function op(){let e=0;for(const t of this)++e;return e}function ip(){return!this.node()}function ap(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function lp(e){return function(){this.removeAttribute(e)}}function rp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sp(e,t){return function(){this.setAttribute(e,t)}}function cp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function up(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function fp(e,t){var o=Ho(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?rp:lp:typeof t=="function"?o.local?up:dp:o.local?cp:sp)(o,t))}function gs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mp(e){return function(){this.style.removeProperty(e)}}function pp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function hp(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function yp(e,t,o){return arguments.length>1?this.each((t==null?mp:typeof t=="function"?hp:pp)(e,t,o??"")):bn(this.node(),e)}function bn(e,t){return e.style.getPropertyValue(t)||gs(e).getComputedStyle(e,null).getPropertyValue(t)}function gp(e){return function(){delete this[e]}}function bp(e,t){return function(){this[e]=t}}function _p(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function vp(e,t){return arguments.length>1?this.each((t==null?gp:typeof t=="function"?_p:bp)(e,t)):this.node()[e]}function bs(e){return e.trim().split(/^|\s+/)}function Na(e){return e.classList||new _s(e)}function _s(e){this._node=e,this._names=bs(e.getAttribute("class")||"")}_s.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function vs(e,t){for(var o=Na(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function ws(e,t){for(var o=Na(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wp(e){return function(){vs(this,e)}}function Ep(e){return function(){ws(this,e)}}function kp(e,t){return function(){(t.apply(this,arguments)?vs:ws)(this,e)}}function Np(e,t){var o=bs(e+"");if(arguments.length<2){for(var i=Na(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?kp:t?wp:Ep)(o,t))}function xp(){this.textContent=""}function $p(e){return function(){this.textContent=e}}function Sp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ip(e){return arguments.length?this.each(e==null?xp:(typeof e=="function"?Sp:$p)(e)):this.node().textContent}function Cp(){this.innerHTML=""}function Rp(e){return function(){this.innerHTML=e}}function Vp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ap(e){return arguments.length?this.each(e==null?Cp:(typeof e=="function"?Vp:Rp)(e)):this.node().innerHTML}function Tp(){this.nextSibling&&this.parentNode.appendChild(this)}function Mp(){return this.each(Tp)}function Bp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dp(){return this.each(Bp)}function Op(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lp(){return null}function Pp(e,t){var o=typeof e=="function"?e:fs(e),i=t==null?Lp:typeof t=="function"?t:ka(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function zp(){var e=this.parentNode;e&&e.removeChild(this)}function Up(){return this.each(zp)}function Hp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gp(e){return this.select(e?Fp:Hp)}function Yp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wp(e){return function(t){e.call(this,t,this.__data__)}}function qp(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function Kp(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function Xp(e,t,o){return function(){var i=this.__on,a,l=Wp(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function jp(e,t,o){var i=qp(e+""),a,l=i.length,r;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<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?Xp:Kp,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Es(e,t,o){var i=gs(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Zp(e,t){return function(){return Es(this,e,t)}}function Jp(e,t){return function(){return Es(this,e,t.apply(this,arguments))}}function Qp(e,t){return this.each((typeof t=="function"?Jp:Zp)(e,t))}function*eh(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var ks=[null];function Qe(e,t){this._groups=e,this._parents=t}function Gn(){return new Qe([[document.documentElement]],ks)}function th(){return this}Qe.prototype=Gn.prototype={constructor:Qe,select:Sm,selectAll:Vm,selectChild:Bm,selectChildren:Pm,filter:zm,data:Wm,enter:Um,exit:Km,join:Xm,merge:jm,selection:th,order:Zm,sort:Jm,call:ep,nodes:tp,node:np,size:op,empty:ip,each:ap,attr:fp,style:yp,property:vp,classed:Np,text:Ip,html:Ap,raise:Mp,lower:Dp,append:Op,insert:Pp,remove:Up,clone:Gp,datum:Yp,on:jp,dispatch:Qp,[Symbol.iterator]:eh};function it(e){return typeof e=="string"?new Qe([[document.querySelector(e)]],[document.documentElement]):new Qe([[e]],ks)}function nh(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=nh(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const oh={passive:!1},Yn={capture:!0,passive:!1};function xa(e){e.stopImmediatePropagation()}function _n(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,o=it(e).on("dragstart.drag",_n,Yn);"onselectstart"in t?o.on("selectstart.drag",_n,Yn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xs(e,t){var o=e.document.documentElement,i=it(e).on("dragstart.drag",null);t&&(i.on("click.drag",_n,Yn),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 Go=e=>()=>e;function $a(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:l,x:r,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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:l,enumerable:!0,configurable:!0},x:{value:r,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}})}$a.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ih(e){return!e.ctrlKey&&!e.button}function ah(){return this.parentNode}function lh(e,t){return t??{x:e.x,y:e.y}}function rh(){return navigator.maxTouchPoints||"ontouchstart"in this}function sh(){var e=ih,t=ah,o=lh,i=rh,a={},l=zo("start","drag","end"),r=0,s,c,d,u,f=0;function p(C){C.on("mousedown.drag",m).filter(i).on("touchstart.drag",N).on("touchmove.drag",b,oh).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(C,Z){if(!(u||!e.call(this,C,Z))){var q=y(this,t.call(this,C,Z),C,Z,"mouse");q&&(it(C.view).on("mousemove.drag",h,Yn).on("mouseup.drag",g,Yn),Ns(C.view),xa(C),d=!1,s=C.clientX,c=C.clientY,q("start",C))}}function h(C){if(_n(C),!d){var Z=C.clientX-s,q=C.clientY-c;d=Z*Z+q*q>f}a.mouse("drag",C)}function g(C){it(C.view).on("mousemove.drag mouseup.drag",null),xs(C.view,d),_n(C),a.mouse("end",C)}function N(C,Z){if(e.call(this,C,Z)){var q=C.changedTouches,te=t.call(this,C,Z),P=q.length,oe,z;for(oe=0;oe<P;++oe)(z=y(this,te,C,Z,q[oe].identifier,q[oe]))&&(xa(C),z("start",C,q[oe]))}}function b(C){var Z=C.changedTouches,q=Z.length,te,P;for(te=0;te<q;++te)(P=a[Z[te].identifier])&&(_n(C),P("drag",C,Z[te]))}function E(C){var Z=C.changedTouches,q=Z.length,te,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),te=0;te<q;++te)(P=a[Z[te].identifier])&&(xa(C),P("end",C,Z[te]))}function y(C,Z,q,te,P,oe){var z=l.copy(),J=ft(oe||q,Z),W,ge,_;if((_=o.call(C,new $a("beforestart",{sourceEvent:q,target:p,identifier:P,active:r,x:J[0],y:J[1],dx:0,dy:0,dispatch:z}),te))!=null)return W=_.x-J[0]||0,ge=_.y-J[1]||0,function w(k,K,V){var H=J,U;switch(k){case"start":a[P]=w,U=r++;break;case"end":delete a[P],--r;case"drag":J=ft(V||K,Z),U=r;break}z.call(k,C,new $a(k,{sourceEvent:K,subject:_,target:p,identifier:P,active:U,x:J[0]+W,y:J[1]+ge,dx:J[0]-H[0],dy:J[1]-H[1],dispatch:z}),te)}}return p.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Go(!!C),p):e},p.container=function(C){return arguments.length?(t=typeof C=="function"?C:Go(C),p):t},p.subject=function(C){return arguments.length?(o=typeof C=="function"?C:Go(C),p):o},p.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:Go(!!C),p):i},p.on=function(){var C=l.on.apply(l,arguments);return C===l?p:C},p.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,p):Math.sqrt(f)},p}function Sa(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function $s(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Wn(){}var qn=.7,Yo=1/qn,vn="\\s*([+-]?\\d+)\\s*",Kn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ch=/^#([0-9a-f]{3,8})$/,dh=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),uh=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),fh=new RegExp(`^rgba\\(${vn},${vn},${vn},${Kn}\\)$`),mh=new RegExp(`^rgba\\(${mt},${mt},${mt},${Kn}\\)$`),ph=new RegExp(`^hsl\\(${Kn},${mt},${mt}\\)$`),hh=new RegExp(`^hsla\\(${Kn},${mt},${mt},${Kn}\\)$`),Ss={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};Sa(Wn,qt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Is,formatHex:Is,formatHex8:yh,formatHsl:gh,formatRgb:Cs,toString:Cs});function Is(){return this.rgb().formatHex()}function yh(){return this.rgb().formatHex8()}function gh(){return Ms(this).formatHsl()}function Cs(){return this.rgb().formatRgb()}function qt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=ch.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Rs(t):o===3?new je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Wo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Wo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dh.exec(e))?new je(t[1],t[2],t[3],1):(t=uh.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=fh.exec(e))?Wo(t[1],t[2],t[3],t[4]):(t=mh.exec(e))?Wo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ph.exec(e))?Ts(t[1],t[2]/100,t[3]/100,1):(t=hh.exec(e))?Ts(t[1],t[2]/100,t[3]/100,t[4]):Ss.hasOwnProperty(e)?Rs(Ss[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function Rs(e){return new je(e>>16&255,e>>8&255,e&255,1)}function Wo(e,t,o,i){return i<=0&&(e=t=o=NaN),new je(e,t,o,i)}function bh(e){return e instanceof Wn||(e=qt(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function Ia(e,t,o,i){return arguments.length===1?bh(e):new je(e,t,o,i??1)}function je(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Sa(je,Ia,$s(Wn,{brighter(e){return e=e==null?Yo:Math.pow(Yo,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?qn:Math.pow(qn,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(Kt(this.r),Kt(this.g),Kt(this.b),qo(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:Vs,formatHex:Vs,formatHex8:_h,formatRgb:As,toString:As}));function Vs(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}`}function _h(){return`#${Xt(this.r)}${Xt(this.g)}${Xt(this.b)}${Xt((isNaN(this.opacity)?1:this.opacity)*255)}`}function As(){const e=qo(this.opacity);return`${e===1?"rgb(":"rgba("}${Kt(this.r)}, ${Kt(this.g)}, ${Kt(this.b)}${e===1?")":`, ${e})`}`}function qo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xt(e){return e=Kt(e),(e<16?"0":"")+e.toString(16)}function Ts(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new at(e,t,o,i)}function Ms(e){if(e instanceof at)return new at(e.h,e.s,e.l,e.opacity);if(e instanceof Wn||(e=qt(e)),!e)return new at;if(e instanceof at)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new at(r,s,c,e.opacity)}function vh(e,t,o,i){return arguments.length===1?Ms(e):new at(e,t,o,i??1)}function at(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Sa(at,vh,$s(Wn,{brighter(e){return e=e==null?Yo:Math.pow(Yo,e),new at(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?qn:Math.pow(qn,e),new at(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new je(Ca(e>=240?e-240:e+120,a,i),Ca(e,a,i),Ca(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new at(Bs(this.h),Ko(this.s),Ko(this.l),qo(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=qo(this.opacity);return`${e===1?"hsl(":"hsla("}${Bs(this.h)}, ${Ko(this.s)*100}%, ${Ko(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bs(e){return e=(e||0)%360,e<0?e+360:e}function Ko(e){return Math.max(0,Math.min(1,e||0))}function Ca(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Ra=e=>()=>e;function wh(e,t){return function(o){return e+o*t}}function Eh(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function kh(e){return(e=+e)==1?Ds:function(t,o){return o-t?Eh(t,o,e):Ra(isNaN(t)?o:t)}}function Ds(e,t){var o=t-e;return o?wh(e,o):Ra(isNaN(e)?t:e)}const Xo=(function e(t){var o=kh(t);function i(a,l){var r=o((a=Ia(a)).r,(l=Ia(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Ds(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Nh(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(l){for(a=0;a<o;++a)i[a]=e[a]*(1-l)+t[a]*l;return i}}function xh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $h(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),l=new Array(o),r;for(r=0;r<i;++r)a[r]=Xn(e[r],t[r]);for(;r<o;++r)l[r]=t[r];return function(s){for(r=0;r<i;++r)l[r]=a[r](s);return l}}function Sh(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function pt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ih(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=Xn(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var Va=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Aa=new RegExp(Va.source,"g");function Ch(e){return function(){return e}}function Rh(e){return function(t){return e(t)+""}}function Os(e,t){var o=Va.lastIndex=Aa.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Va.exec(e))&&(a=Aa.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:pt(i,a)})),o=Aa.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Rh(c[0].x):Ch(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}function Xn(e,t){var o=typeof t,i;return t==null||o==="boolean"?Ra(t):(o==="number"?pt:o==="string"?(i=qt(t))?(t=i,Xo):Os:t instanceof qt?Xo:t instanceof Date?Sh:xh(t)?Nh:Array.isArray(t)?$h:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ih:pt)(e,t)}var Ls=180/Math.PI,Ta={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ps(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*Ls,skewX:Math.atan(c)*Ls,scaleX:r,scaleY:s}}var jo;function Vh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ta:Ps(t.a,t.b,t.c,t.d,t.e,t.f)}function Ah(e){return e==null||(jo||(jo=document.createElementNS("http://www.w3.org/2000/svg","g")),jo.setAttribute("transform",e),!(e=jo.transform.baseVal.consolidate()))?Ta:(e=e.matrix,Ps(e.a,e.b,e.c,e.d,e.e,e.f))}function zs(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:pt(d,f)},{i:g-2,x:pt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(a(f)+"rotate(",null,i)-2,x:pt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(a(f)+"skewX(",null,i)-2,x:pt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var g=m.push(a(m)+"scale(",null,",",null,")");h.push({i:g-4,x:pt(d,f)},{i:g-2,x:pt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,g=p.length,N;++h<g;)f[(N=p[h]).i]=N.x(m);return f.join("")}}}var Th=zs(Vh,"px, ","px)","deg)"),Mh=zs(Ah,", ",")",")"),Bh=1e-12;function Us(e){return((e=Math.exp(e))+1/e)/2}function Dh(e){return((e=Math.exp(e))-1/e)/2}function Oh(e){return((e=Math.exp(2*e))-1)/(e+1)}const Zo=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,g=m*m+h*h,N,b;if(g<Bh)b=Math.log(p/d)/t,N=function(te){return[s+te*m,c+te*h,d*Math.exp(t*te*b)]};else{var E=Math.sqrt(g),y=(p*p-d*d+i*g)/(2*d*o*E),C=(p*p-d*d-i*g)/(2*p*o*E),Z=Math.log(Math.sqrt(y*y+1)-y),q=Math.log(Math.sqrt(C*C+1)-C);b=(q-Z)/t,N=function(te){var P=te*b,oe=Us(Z),z=d/(o*E)*(oe*Oh(t*P+Z)-Dh(Z));return[s+z*m,c+z*h,d*oe/Us(t*P+Z)]}}return N.duration=b*1e3*t/Math.SQRT2,N}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var wn=0,jn=0,Zn=0,Hs=1e3,Jo,Jn,Qo=0,jt=0,ei=0,Qn=typeof performance=="object"&&performance.now?performance:Date,Fs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ma(){return jt||(Fs(Lh),jt=Qn.now()+ei)}function Lh(){jt=0}function ti(){this._call=this._time=this._next=null}ti.prototype=Gs.prototype={constructor:ti,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ma():+o)+(t==null?0:+t),!this._next&&Jn!==this&&(Jn?Jn._next=this:Jo=this,Jn=this),this._call=e,this._time=o,Ba()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ba())}};function Gs(e,t,o){var i=new ti;return i.restart(e,t,o),i}function Ph(){Ma(),++wn;for(var e=Jo,t;e;)(t=jt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wn}function Ys(){jt=(Qo=Qn.now())+ei,wn=jn=0;try{Ph()}finally{wn=0,Uh(),jt=0}}function zh(){var e=Qn.now(),t=e-Qo;t>Hs&&(ei-=t,Qo=e)}function Uh(){for(var e,t=Jo,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Jo=o);Jn=e,Ba(i)}function Ba(e){if(!wn){jn&&(jn=clearTimeout(jn));var t=e-jt;t>24?(e<1/0&&(jn=setTimeout(Ys,e-Qn.now()-ei)),Zn&&(Zn=clearInterval(Zn))):(Zn||(Qo=Qn.now(),Zn=setInterval(zh,Hs)),wn=1,Fs(Ys))}}function Ws(e,t,o){var i=new ti;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Hh=zo("start","end","cancel","interrupt"),Fh=[],qs=0,Ks=1,Da=2,ni=3,Xs=4,Oa=5,oi=6;function ii(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Gh(e,o,{name:t,index:i,group:a,on:Hh,tween:Fh,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:qs})}function La(e,t){var o=lt(e,t);if(o.state>qs)throw new Error("too late; already scheduled");return o}function ht(e,t){var o=lt(e,t);if(o.state>ni)throw new Error("too late; already running");return o}function lt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Gh(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Gs(l,0,o.time);function l(d){o.state=Ks,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==Ks)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ni)return Ws(r);m.state===Xs?(m.state=oi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=oi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Ws(function(){o.state===ni&&(o.state=Xs,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Da,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Da){for(o.state=ni,a=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Oa,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Oa&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=oi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ai(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Da&&i.state<Oa,i.state=oi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Yh(e){return this.each(function(){ai(this,e)})}function Wh(e,t){var o,i;return function(){var a=ht(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function qh(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=ht(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function Kh(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=lt(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?Wh:qh)(o,e,t))}function Pa(e,t,o){var i=e._id;return e.each(function(){var a=ht(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return lt(a,i).value[t]}}function js(e,t){var o;return(typeof t=="number"?pt:t instanceof qt?Xo:(o=qt(t))?(t=o,Xo):Os)(e,t)}function Xh(e){return function(){this.removeAttribute(e)}}function jh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zh(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function Jh(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function Qh(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function ey(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function ty(e,t){var o=Ho(e),i=o==="transform"?Mh:js;return this.attrTween(e,typeof t=="function"?(o.local?ey:Qh)(o,i,Pa(this,"attr."+e,t)):t==null?(o.local?jh:Xh)(o):(o.local?Jh:Zh)(o,i,t))}function ny(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function oy(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function iy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&oy(e,l)),o}return a._value=t,a}function ay(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ny(e,l)),o}return a._value=t,a}function ly(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Ho(e);return this.tween(o,(i.local?iy:ay)(i,t))}function ry(e,t){return function(){La(this,e).delay=+t.apply(this,arguments)}}function sy(e,t){return t=+t,function(){La(this,e).delay=t}}function cy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ry:sy)(t,e)):lt(this.node(),t).delay}function dy(e,t){return function(){ht(this,e).duration=+t.apply(this,arguments)}}function uy(e,t){return t=+t,function(){ht(this,e).duration=t}}function fy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dy:uy)(t,e)):lt(this.node(),t).duration}function my(e,t){if(typeof t!="function")throw new Error;return function(){ht(this,e).ease=t}}function py(e){var t=this._id;return arguments.length?this.each(my(t,e)):lt(this.node(),t).ease}function hy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ht(this,e).ease=o}}function yy(e){if(typeof e!="function")throw new Error;return this.each(hy(this._id,e))}function gy(e){typeof e!="function"&&(e=ps(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Et(i,this._parents,this._name,this._id)}function by(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new Et(r,this._parents,this._name,this._id)}function _y(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function vy(e,t,o){var i,a,l=_y(t)?La:ht;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function wy(e,t){var o=this._id;return arguments.length<2?lt(this.node(),o).on.on(e):this.each(vy(o,e,t))}function Ey(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function ky(){return this.on("end.remove",Ey(this._id))}function Ny(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ka(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,ii(d[p],t,o,p,d,lt(u,o)));return new Et(l,this._parents,t,o)}function xy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ms(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=lt(u,o),g=0,N=p.length;g<N;++g)(m=p[g])&&ii(m,t,o,g,p,h);l.push(p),r.push(u)}return new Et(l,r,t,o)}var $y=Gn.prototype.constructor;function Sy(){return new $y(this._groups,this._parents)}function Iy(e,t){var o,i,a;return function(){var l=bn(this,e),r=(this.style.removeProperty(e),bn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Zs(e){return function(){this.style.removeProperty(e)}}function Cy(e,t,o){var i,a=o+"",l;return function(){var r=bn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Ry(e,t,o){var i,a,l;return function(){var r=bn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),bn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Vy(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=ht(this,e),d=c.on,u=c.value[l]==null?s||(s=Zs(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Ay(e,t,o){var i=(e+="")=="transform"?Th:js;return t==null?this.styleTween(e,Iy(e,i)).on("end.style."+e,Zs(e)):typeof t=="function"?this.styleTween(e,Ry(e,i,Pa(this,"style."+e,t))).each(Vy(this._id,e)):this.styleTween(e,Cy(e,i,t),o).on("end.style."+e,null)}function Ty(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function My(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Ty(e,r,o)),i}return l._value=t,l}function By(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,My(e,t,o??""))}function Dy(e){return function(){this.textContent=e}}function Oy(e){return function(){var t=e(this);this.textContent=t??""}}function Ly(e){return this.tween("text",typeof e=="function"?Oy(Pa(this,"text",e)):Dy(e==null?"":e+""))}function Py(e){return function(t){this.textContent=e.call(this,t)}}function zy(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Py(a)),t}return i._value=e,i}function Uy(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zy(e))}function Hy(){for(var e=this._name,t=this._id,o=Js(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=lt(c,t);ii(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Et(i,this._parents,e,o)}function Fy(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=ht(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var Gy=0;function Et(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Js(){return++Gy}var kt=Gn.prototype;Et.prototype={constructor:Et,select:Ny,selectAll:xy,selectChild:kt.selectChild,selectChildren:kt.selectChildren,filter:gy,merge:by,selection:Sy,transition:Hy,call:kt.call,nodes:kt.nodes,node:kt.node,size:kt.size,empty:kt.empty,each:kt.each,on:wy,attr:ty,attrTween:ly,style:Ay,styleTween:By,text:Ly,textTween:Uy,remove:ky,tween:Kh,delay:cy,duration:fy,ease:py,easeVarying:yy,end:Fy,[Symbol.iterator]:kt[Symbol.iterator]};function Yy(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Wy={time:null,delay:0,duration:250,ease:Yy};function qy(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Ky(e){var t,o;e instanceof Et?(t=e._id,e=e._name):(t=Js(),(o=Wy).time=Ma(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&ii(c,e,t,d,r,o||qy(c,t));return new Et(i,this._parents,e,t)}Gn.prototype.interrupt=Yh,Gn.prototype.transition=Ky;const li=e=>()=>e;function Xy(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Nt(e,t,o){this.k=e,this.x=t,this.y=o}Nt.prototype={constructor:Nt,scale:function(e){return e===1?this:new Nt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Nt(this.k,this.x+this.k*e,this.y+this.k*t)},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 En=new Nt(1,0,0);Nt.prototype;function za(e){e.stopImmediatePropagation()}function eo(e){e.preventDefault(),e.stopImmediatePropagation()}function jy(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zy(){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 Qs(){return this.__zoom||En}function Jy(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Qy(){return navigator.maxTouchPoints||"ontouchstart"in this}function eg(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function tg(){var e=jy,t=Zy,o=eg,i=Jy,a=Qy,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Zo,d=zo("start","zoom","end"),u,f,p,m=500,h=150,g=0,N=10;function b(_){_.property("__zoom",Qs).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",oe).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",J).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",ge).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(_,w,k,K){var V=_.selection?_.selection():_;V.property("__zoom",Qs),_!==V?Z(_,w,k,K):V.interrupt().each(function(){q(this,arguments).event(K).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},b.scaleBy=function(_,w,k,K){b.scaleTo(_,function(){var V=this.__zoom.k,H=typeof w=="function"?w.apply(this,arguments):w;return V*H},k,K)},b.scaleTo=function(_,w,k,K){b.transform(_,function(){var V=t.apply(this,arguments),H=this.__zoom,U=k==null?C(V):typeof k=="function"?k.apply(this,arguments):k,ce=H.invert(U),he=typeof w=="function"?w.apply(this,arguments):w;return o(y(E(H,he),U,ce),V,r)},k,K)},b.translateBy=function(_,w,k,K){b.transform(_,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),r)},null,K)},b.translateTo=function(_,w,k,K,V){b.transform(_,function(){var H=t.apply(this,arguments),U=this.__zoom,ce=K==null?C(H):typeof K=="function"?K.apply(this,arguments):K;return o(En.translate(ce[0],ce[1]).scale(U.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof k=="function"?-k.apply(this,arguments):-k),H,r)},K,V)};function E(_,w){return w=Math.max(l[0],Math.min(l[1],w)),w===_.k?_:new Nt(w,_.x,_.y)}function y(_,w,k){var K=w[0]-k[0]*_.k,V=w[1]-k[1]*_.k;return K===_.x&&V===_.y?_:new Nt(_.k,K,V)}function C(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function Z(_,w,k,K){_.on("start.zoom",function(){q(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){q(this,arguments).event(K).end()}).tween("zoom",function(){var V=this,H=arguments,U=q(V,H).event(K),ce=t.apply(V,H),he=k==null?C(ce):typeof k=="function"?k.apply(V,H):k,me=Math.max(ce[1][0]-ce[0][0],ce[1][1]-ce[0][1]),be=V.__zoom,ue=typeof w=="function"?w.apply(V,H):w,X=c(be.invert(he).concat(me/be.k),ue.invert(he).concat(me/ue.k));return function(F){if(F===1)F=ue;else{var le=X(F),ve=me/le[2];F=new Nt(ve,he[0]-le[0]*ve,he[1]-le[1]*ve)}U.zoom(null,F)}})}function q(_,w,k){return!k&&_.__zooming||new te(_,w)}function te(_,w){this.that=_,this.args=w,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,w),this.taps=0}te.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,w){return this.mouse&&_!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&_!=="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(_){var w=it(this.that).datum();d.call(_,this.that,new Xy(_,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),w)}};function P(_,...w){if(!e.apply(this,arguments))return;var k=q(this,w).event(_),K=this.__zoom,V=Math.max(l[0],Math.min(l[1],K.k*Math.pow(2,i.apply(this,arguments)))),H=ft(_);if(k.wheel)(k.mouse[0][0]!==H[0]||k.mouse[0][1]!==H[1])&&(k.mouse[1]=K.invert(k.mouse[0]=H)),clearTimeout(k.wheel);else{if(K.k===V)return;k.mouse=[H,K.invert(H)],ai(this),k.start()}eo(_),k.wheel=setTimeout(U,h),k.zoom("mouse",o(y(E(K,V),k.mouse[0],k.mouse[1]),k.extent,r));function U(){k.wheel=null,k.end()}}function oe(_,...w){if(p||!e.apply(this,arguments))return;var k=_.currentTarget,K=q(this,w,!0).event(_),V=it(_.view).on("mousemove.zoom",he,!0).on("mouseup.zoom",me,!0),H=ft(_,k),U=_.clientX,ce=_.clientY;Ns(_.view),za(_),K.mouse=[H,this.__zoom.invert(H)],ai(this),K.start();function he(be){if(eo(be),!K.moved){var ue=be.clientX-U,X=be.clientY-ce;K.moved=ue*ue+X*X>g}K.event(be).zoom("mouse",o(y(K.that.__zoom,K.mouse[0]=ft(be,k),K.mouse[1]),K.extent,r))}function me(be){V.on("mousemove.zoom mouseup.zoom",null),xs(be.view,K.moved),eo(be),K.event(be).end()}}function z(_,...w){if(e.apply(this,arguments)){var k=this.__zoom,K=ft(_.changedTouches?_.changedTouches[0]:_,this),V=k.invert(K),H=k.k*(_.shiftKey?.5:2),U=o(y(E(k,H),K,V),t.apply(this,w),r);eo(_),s>0?it(this).transition().duration(s).call(Z,U,K,_):it(this).call(b.transform,U,K,_)}}function J(_,...w){if(e.apply(this,arguments)){var k=_.touches,K=k.length,V=q(this,w,_.changedTouches.length===K).event(_),H,U,ce,he;for(za(_),U=0;U<K;++U)ce=k[U],he=ft(ce,this),he=[he,this.__zoom.invert(he),ce.identifier],V.touch0?!V.touch1&&V.touch0[2]!==he[2]&&(V.touch1=he,V.taps=0):(V.touch0=he,H=!0,V.taps=1+!!u);u&&(u=clearTimeout(u)),H&&(V.taps<2&&(f=he[0],u=setTimeout(function(){u=null},m)),ai(this),V.start())}}function W(_,...w){if(this.__zooming){var k=q(this,w).event(_),K=_.changedTouches,V=K.length,H,U,ce,he;for(eo(_),H=0;H<V;++H)U=K[H],ce=ft(U,this),k.touch0&&k.touch0[2]===U.identifier?k.touch0[0]=ce:k.touch1&&k.touch1[2]===U.identifier&&(k.touch1[0]=ce);if(U=k.that.__zoom,k.touch1){var me=k.touch0[0],be=k.touch0[1],ue=k.touch1[0],X=k.touch1[1],F=(F=ue[0]-me[0])*F+(F=ue[1]-me[1])*F,le=(le=X[0]-be[0])*le+(le=X[1]-be[1])*le;U=E(U,Math.sqrt(F/le)),ce=[(me[0]+ue[0])/2,(me[1]+ue[1])/2],he=[(be[0]+X[0])/2,(be[1]+X[1])/2]}else if(k.touch0)ce=k.touch0[0],he=k.touch0[1];else return;k.zoom("touch",o(y(U,ce,he),k.extent,r))}}function ge(_,...w){if(this.__zooming){var k=q(this,w).event(_),K=_.changedTouches,V=K.length,H,U;for(za(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),H=0;H<V;++H)U=K[H],k.touch0&&k.touch0[2]===U.identifier?delete k.touch0:k.touch1&&k.touch1[2]===U.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(U=ft(U,this),Math.hypot(f[0]-U[0],f[1]-U[1])<N)){var ce=it(this).on("dblclick.zoom");ce&&ce.apply(this,arguments)}}}return b.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:li(+_),b):i},b.filter=function(_){return arguments.length?(e=typeof _=="function"?_:li(!!_),b):e},b.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:li(!!_),b):a},b.extent=function(_){return arguments.length?(t=typeof _=="function"?_:li([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),b):t},b.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],b):[l[0],l[1]]},b.translateExtent=function(_){return arguments.length?(r[0][0]=+_[0][0],r[1][0]=+_[1][0],r[0][1]=+_[0][1],r[1][1]=+_[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(_){return arguments.length?(o=_,b):o},b.duration=function(_){return arguments.length?(s=+_,b):s},b.interpolate=function(_){return arguments.length?(c=_,b):c},b.on=function(){var _=d.on.apply(d,arguments);return _===d?b:_},b.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,b):Math.sqrt(g)},b.tapDistance=function(_){return arguments.length?(N=+_,b):N},b}var Ne=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ne||{}),Ua=(e=>(e.Partial="partial",e.Full="full",e))(Ua||{}),Zt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Zt||{}),xt=(e=>(e.Strict="strict",e.Loose="loose",e))(xt||{}),Ha=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ha||{}),to=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(to||{}),ec=(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))(ec||{});const ng=["INPUT","SELECT","TEXTAREA"],og=typeof document<"u"?document:null;function Fa(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,l=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return ng.includes(i==null?void 0:i.nodeName)||a||!!l}function ig(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function tc(e,t,o,i){const a=t.replace("+",`
|
|
1
|
+
(function(Ee,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ee=typeof globalThis<"u"?globalThis:Ee||self,n(Ee.EntityModeler={},Ee.Vue,Ee.OpenBlueseaCore))})(this,(function(Ee,n,ae){"use strict";var HS=Object.defineProperty;var FS=(Ee,n,ae)=>n in Ee?HS(Ee,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Ee[n]=ae;var Le=(Ee,n,ae)=>FS(Ee,typeof n!="symbol"?n+"":n,ae);const Cu={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Ru(e,t){const o=e%t.perRow,i=Math.floor(e/t.perRow);return{location:{x:t.startX+o*t.columnGap,y:t.startY+i*t.rowGap},size:{...t.defaultSize}}}function Da(e,t,o={}){const i={...Cu,...o},l=new Map(e.entities.map(y=>[y.modelId,y])),a=new Map(e.associations.map(y=>[y.modelId,y])),r=new Map(t.entityLayouts.map(y=>[y.entityRef,y])),s=new Map(t.associationLayouts.map(y=>[y.associationRef,y])),d=t.entityLayouts.map(y=>y.entityRef).filter(y=>!l.has(y)),c=t.associationLayouts.map(y=>y.associationRef).filter(y=>!a.has(y)),u=new Map;for(const y of e.groups)for(const x of y.memberEntityRefs)u.set(x,y.modelId);const f=new Map;for(const y of t.groupLayouts)for(const x of y.memberNoteRefs??[])f.set(x,y.groupRef);let p=0;const m=e.entities.map(y=>{const x=u.get(y.modelId),J=r.get(y.modelId);if(J){const j={location:{x:J.geo.location.x,y:J.geo.location.y},size:{width:J.geo.size.width,height:J.geo.size.height}};return{entity:y,geo:j,collapsed:J.collapsed??!1,groupRef:x,style:J.style,attributeStyles:J.attributeStyles,operationStyles:J.operationStyles}}const G=Ru(p++,i);return{entity:y,geo:G,collapsed:!1,groupRef:x}}),h=new Map(t.groupLayouts.map(y=>[y.groupRef,y])),g=e.groups.map(y=>{const x=h.get(y.modelId),J=x?{location:{x:x.geo.location.x,y:x.geo.location.y},size:{width:x.geo.size.width,height:x.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:y,geo:J,style:x==null?void 0:x.style}}),w=e.associations.map(y=>{const x=s.get(y.modelId);return{association:y,waypoints:(x==null?void 0:x.waypoints)??[],sourceColumnRef:x==null?void 0:x.sourceColumnRef,targetColumnRef:x==null?void 0:x.targetColumnRef}}),b=t.notes.map(y=>({note:{...y,geo:{location:{x:y.geo.location.x,y:y.geo.location.y},size:{width:y.geo.size.width,height:y.geo.size.height}}},groupRef:f.get(y.modelId)})),S=[];for(const y of t.notes)for(const x of y.connections??[])l.has(x.targetRef)&&S.push({noteRef:y.modelId,targetRef:x.targetRef,waypoints:x.waypoints.map(J=>({x:J.x,y:J.y}))});return{entities:m,associations:w,groups:g,notes:b,noteConnections:S,prunedEntityRefs:d,prunedAssociationRefs:c}}function Dn(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 mn=.5;function Oa(e,t,o,i,l,a){const r=Dn(t),s=Dn(l),d={x:e.x+r.x*a,y:e.y+r.y*a},c={x:i.x+s.x*a,y:i.y+s.y*a},u=[d,...o,c],f=[];let p=e;const m=(w,b)=>{(Math.abs(w.x-p.x)>=mn||Math.abs(w.y-p.y)>=mn)&&(f.push({a:p,b:w,seg:b}),p=w)};m(d,0);let h=r.x!==0,g=d;for(let w=1;w<u.length;w++){const b=u[w],S=w<=o.length?w-1:o.length,y=Math.abs(b.x-g.x)<mn,x=Math.abs(b.y-g.y)<mn;y&&x||(y?(m(b,S),h=!1):x?(m(b,S),h=!0):h?(m({x:g.x,y:b.y},S),m(b,S),h=!0):(m({x:b.x,y:g.y},S),m(b,S),h=!1),g=b)}return m(i,o.length),f}function Zi(e,t,o,i,l,a=20){const r=Oa(e,t,o,i,l,a);let s=`M ${Ke(e.x)},${Ke(e.y)}`;for(const d of r)s+=` L ${Ke(d.b.x)},${Ke(d.b.y)}`;return s}const Vu=14;function Ji(e,t,o,i,l,a=20){return Oa(e,t,o,i,l,a).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=Vu).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function Ke(e){return Math.round(e*100)/100}const Au=36;function La(e,t,o=Au){const i=Math.max(e.x,t.x)+o;return`M ${Ke(e.x)},${Ke(e.y)} L ${Ke(i)},${Ke(e.y)} L ${Ke(i)},${Ke(t.y)} L ${Ke(t.x)},${Ke(t.y)}`}function Qi(e,t,o){const i=[e,...t,o];let l=`M ${Ke(i[0].x)},${Ke(i[0].y)}`;for(let a=1;a<i.length;a++)l+=` L ${Ke(i[a].x)},${Ke(i[a].y)}`;return l}function Tu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function el(e,t){const o=Tu(e),i=e.width/2,l=e.height/2,a=t.x-o.x,r=t.y-o.y;if(Math.abs(a)<mn&&Math.abs(r)<mn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=a!==0?i/Math.abs(a):1/0,d=r!==0?l/Math.abs(r):1/0,c=Math.min(s,d),u={x:o.x+a*c,y:o.y+r*c},f=s<=d?a>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function tl(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function nl(e,t,o){const i=[e,...t,o],l=[];for(let a=1;a<i.length;a++){const r=i[a-1],s=i[a];l.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return l}const Bu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Pa(e,t,o={}){const i={...Bu,...o},l=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),a=[];let r=0;for(const u of e.groups){const f=l.get(u.modelId),p=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const h=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,w)=>{const b=w%h,S=Math.floor(w/h);a.push({id:g,location:{x:p.x+i.pad+b*i.cellWidth,y:p.y+i.pad+i.headerHeight+S*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),d=e.entities.filter(u=>!s.has(u.modelId)),c=r>0?r+40:i.pad;return d.forEach((u,f)=>{const p=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);a.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:c+m*i.cellHeight}})}),a}const za={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Ua(e,t={}){const o={...za,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Mu(e,t={}){const o={...za,...t},i=Math.max(1,o.cols),l=new Array(i).fill(o.baseY);return e.map((a,r)=>{const s=r%i,d=Ua(a.attributeCount,o),c=o.baseX+s*(o.boxWidth+o.gap),u=l[s];return l[s]=u+d+o.gap,{id:a.id,location:{x:c,y:u},size:{width:o.boxWidth,height:d}}})}function Vo(e,t,o,i){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||"(논리명)";default:return i?`${o||"(논리명)"} · ${i}`:o||"(논리명)"}}function Ha(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 Fa(e){var a,r,s;const t=new Map(e.entities.map(d=>[d.modelId,d.name])),o=new Map;for(const d of e.entities)for(const c of d.attributes)o.set(c.modelId,c.name);const i=new Map;for(const d of e.groups)for(const c of d.memberEntityRefs)i.set(c,d.packageName||(((a=d.name)==null?void 0:a.ko)??d.modelId));const l=[];for(const d of e.entities){const c=(r=d.table)!=null&&r.physicalName?` (${d.table.physicalName})`:"",u=i.get(d.modelId);l.push(`## ${d.name}${c} «${d.stereotype}»${u?` [${u}]`:""}`);const f=[...d.attributes].sort((m,h)=>m.order-h.order);for(const m of f){if(m.attrType==="DIVIDER"){l.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const h=m.dbAttrs[0],g=h!=null&&h.length?`(${h.length}${h.scale!=null?`,${h.scale}`:""})`:"",w=h?` → ${h.physicalName} ${h.dataType}${g}`:"",b=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",h!=null&&h.unique?"UNIQUE":"",h!=null&&h.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);l.push(` - ${m.name}: ${m.type}${w}${b.length?` {${b.join(", ")}}`:""}`)}for(const m of d.indexes??[]){const h=m.columns.map(g=>`${o.get(g.columnRef)??g.columnRef}${g.descending?" DESC":""}`).join(", ");l.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${h}`)}const p=[...d.operations??[]].sort((m,h)=>m.order-h.order);for(const m of p){const h=m.visibility?` {${m.visibility}}`:"",g=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";l.push(` method ${m.name}()${h}${g}`)}l.push("")}if(e.associations.length){l.push("# 관계");for(const d of e.associations){const c=t.get(d.end1.entityRef)??d.end1.entityRef,u=t.get(d.end2.entityRef)??d.end2.entityRef,f=d.end2.composition||d.end1.composition?" (composition)":"";l.push(` ${c} ${Ha(d.end1.multiplicity)} —— ${Ha(d.end2.multiplicity)} ${u}${f}`)}}return l.join(`
|
|
2
|
+
`).trim()}function et(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Se(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ga(e){return`<text ${[`x="${Se(e.x)}"`,`y="${Se(e.y)}"`,`fill="${et(e.fill)}"`,`font-size="${Se(e.fontSize)}"`,e.fontFamily?`font-family="${et(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${et(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${et(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${et(e.text)}</text>`}function Du(e){return`<line x1="${Se(e.x1)}" y1="${Se(e.y)}" x2="${Se(e.x2)}" y2="${Se(e.y)}" stroke="${et(e.stroke)}" stroke-width="${Se(e.strokeWidth??1)}" />`}function Ou(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 Lu(e,t,o,i,l){return[`M${Se(e+l.tl)},${Se(t)}`,`L${Se(e+o-l.tr)},${Se(t)}`,l.tr?`Q${Se(e+o)},${Se(t)} ${Se(e+o)},${Se(t+l.tr)}`:"",`L${Se(e+o)},${Se(t+i-l.br)}`,l.br?`Q${Se(e+o)},${Se(t+i)} ${Se(e+o-l.br)},${Se(t+i)}`:"",`L${Se(e+l.bl)},${Se(t+i)}`,l.bl?`Q${Se(e)},${Se(t+i)} ${Se(e)},${Se(t+i-l.bl)}`:"",`L${Se(e)},${Se(t+l.tl)}`,l.tl?`Q${Se(e)},${Se(t)} ${Se(e+l.tl)},${Se(t)}`:"","Z"].filter(Boolean).join(" ")}function ol(e){const t=Ou(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${et(e.fill)}"`,`stroke="${et(e.stroke)}"`,`stroke-width="${Se(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${et(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Se(e.opacity)}"`:""].filter(Boolean),a=[o?`<path d="${Lu(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Se(e.x)}" y="${Se(e.y)}" width="${Se(e.w)}" height="${Se(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])a.push(Du(r));for(const r of e.texts)a.push(Ga(r));for(const r of e.icons??[])a.push(r);return`<g>${a.join("")}</g>`}function Pu(e){const o=[`<path ${[`d="${et(e.d)}"`,'fill="none"',`stroke="${et(e.stroke)}"`,`stroke-width="${Se(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${et(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Ga(i));return`<g>${o.join("")}</g>`}function Ya(e){const{x:t,y:o,w:i,h:l}=e.viewBox,a=[];e.background&&a.push(`<rect x="${Se(t)}" y="${Se(o)}" width="${Se(i)}" height="${Se(l)}" fill="${et(e.background)}" />`);for(const r of e.groups)a.push(ol(r));for(const r of e.edges)a.push(Pu(r));for(const r of e.entities)a.push(ol(r));for(const r of e.notes)a.push(ol(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Se(t)} ${Se(o)} ${Se(i)} ${Se(l)}" width="${Se(i)}" height="${Se(l)}">`+a.join("")+"</svg>"}const zu=["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"],Uu=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"]),Hu=zu.filter(e=>!Uu.has(e)),Fu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function il(e){return Fu[e]??e}const Gu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]);function Wa(e,t=Hu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ft="CustomType",Ao="GroupCodeEnum",qa="String",Ka=[{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:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{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:Ao,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ft,label:"CustomType"}],Yu=new Map(Ka.map(e=>[e.value,e.label]));function On(e){return Yu.get(e)??e}const Wu=new Set([Ao,"CustomMoneyType"]),qu=Ka.filter(e=>!Wu.has(e.value)).map(e=>e.value===Ft?{...e,label:"CustomType (사용자정의)"}:e);function Xa(e,t=[]){const o=t.map(l=>{var r,s;const a=((r=l.label)==null?void 0:r.ko)??((s=l.label)==null?void 0:s.en);return{value:l.type,label:a?`${l.type} (${a})`:l.type}}),i=[...qu,...o];return e&&!i.some(l=>l.value===e)?[{value:e,label:On(e)},...i]:i}function Ku(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function ja(e,t){var l;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(a=>a.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((l=i.jpa)==null?void 0:l.collectionType)??"LIST"}function ll(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${On(t.type)}>`:Ku(t)?On(t.type):e==="CLASS"?t.type===Ft&&t.customType||On(t.type):il(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Ln(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function To(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const al=63;function Bo(e){if(!e)return null;const t=e.length;return t<=al?null:`물리명이 ${al}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Za(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function ot(e){return!e||e.trim()===""}function Pn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Xu(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,l=2,a=new Map,r=[],s=[],d=new Set,c=u=>{a.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=a.get(f)??o;if(p===o)c(f);else if(p===i){const m=r.slice(r.indexOf(f)),h=[...m].sort().join(" ");d.has(h)||(d.add(h),s.push(m))}}r.pop(),a.set(u,l)};for(const u of e.entities)(a.get(u.modelId)??o)===o&&c(u.modelId);return s}function rl(e,t){const o=new Map;for(const i of e){const l=t(i);l==null||l===""||o.set(l,(o.get(l)??0)+1)}return e.filter(i=>{const l=t(i);return l!=null&&l!==""&&(o.get(l)??0)>1})}function Ja(e,t){var a,r,s,d;const o=[];for(const c of rl(e.entities,u=>u.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const u=c.attributes.filter(h=>h.attrType!=="DIVIDER");if(ot(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(u.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),ot((a=c.table)==null?void 0:a.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const h of u.filter(g=>g.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of u.filter(g=>g.identifier&&g.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of u)if(!h.identifier)for(const g of h.dbAttrs)!g.autoIncrement&&ot(g.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`채번(${g.autoIncrement?"auto increment":`시퀀스 "${g.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});!c.abstractClass&&u.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&u.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${u.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of rl(u,g=>g.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of u)ot(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const f=u.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null);for(const h of rl(f,g=>g.physicalName))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${h.physicalName}"`});for(const h of f){const g=Bo(h.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!ot(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!ot(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!ot(h.dataType)&&Gu.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Ln(u.flatMap(g=>g.dbAttrs));for(const g of u){if(g.attrType!=="EMBED_PREDEF")continue;const w=t.embeddableCatalog.find(b=>b.type===g.type);w&&g.dbAttrs.forEach((b,S)=>{if(b.sharedColumnRef==null)return;const y=w.fields[S],x=h.get(b.sharedColumnRef);if(!y||!x)return;(x.dataType!==y.dataType||(x.length??null)!==(y.length??null)||(x.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${Za(x)})이 ${y.name??"컬럼"} 정의(${Za(y)})와 다릅니다`})})}}for(const h of u){const g=h.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;h.type===Ao&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}for(const h of u){if(h.attrType!=="EMBED_PREDEF"||!h.dbAttrs.some(b=>!ot(b.physicalName)||b.sharedColumnRef!=null))continue;const w=(s=t==null?void 0:t.embeddableCatalog)==null?void 0:s.find(b=>b.type===h.type);h.dbAttrs.forEach((b,S)=>{var x;if(b.sharedColumnRef!=null||!ot(b.physicalName))return;const y=((x=w==null?void 0:w.fields[S])==null?void 0:x.name)??`슬롯 ${S+1}`;o.push({ruleId:"CHK-TYPE-5",severity:"warning",targetKind:"column",targetRef:b.modelId,contextRef:c.modelId,message:`임베더블 "${h.name}"의 서브컬럼 "${y}" 매핑이 미완성입니다 — 전용 컬럼(OWN) 물리명을 지정하거나 기존 컬럼 공유(SHARED_REF)를 선택하세요`})})}const p=(d=c.table)==null?void 0:d.physicalName,m=Bo(p);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!ot(p)&&t.reservedWords.has(p.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${p}"`});for(const h of c.indexes??[]){const g=Bo(h.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!ot(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`})}}const i=new Map;for(const c of e.entities)for(const u of c.attributes)u.attrType==="EMBED_OWN"&&u.embedded&&i.set(u.embedded.associationRef,u);for(const c of e.associations){Pn(c.end1.multiplicity)&&Pn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const u of["end1","end2"]){const f=c[u].jpa;if(!f)continue;const p=f.cascadeTypes??[],m=p.includes("ALL"),h=p.includes("REMOVE");m&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${u}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),f.orphanRemoval&&(h||m)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${u}: orphanRemoval이 cascade ${m?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Pn(c[u].multiplicity)&&f.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${u}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),f.orphanRemoval&&Pn(c[u==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${u}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Pn(c[u].multiplicity)&&(f.collectionType||f.collectionTable||f.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${u}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),f.collectionType==="SET"&&f.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${u}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const l=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of Xu(e)){const u=[...c,c[0]].map(f=>l.get(f)??f).join(" → ");for(const f of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:f,message:`식별 관계 사이클입니다 (PK 무한 의존): ${u}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const f of e.associations)c.add(f.end1.entityRef),c.add(f.end2.entityRef);const u=new Map(e.entities.map(f=>[f.name,f.modelId]));for(const f of e.entities){for(const p of f.attributes)p.embedded&&(c.add(f.modelId),c.add(p.embedded.embeddableRef));if(!ot(f.superClass)){c.add(f.modelId);const p=u.get(f.superClass);p&&c.add(p)}}for(const f of e.entities)c.has(f.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:f.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Ve(){return crypto.randomUUID()}const ju="CustomMoneyType",Zu="Money";function Ju(e){return!(e.type!==ju||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Qu(e){const t=e.dbAttrs[0]??{modelId:Ve(),physicalName:"",dataType:""},o={modelId:Ve(),physicalName:"",dataType:""},{customType:i,...l}=e;return{...l,type:Zu,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function ef(e){let t=!1;const o=e.entities.map(i=>{let l=!1;const a=i.attributes.map(r=>Ju(r)?(l=!0,t=!0,Qu(r)):r);return l?{...i,attributes:a}:i});return t?{...e,entities:o}:e}function sl(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function pn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>pn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!pn(e[i],t[i]))return!1;return!0}return!1}function Gt(e,t,o){const i={},l=new Set([...Object.keys(e),...Object.keys(t)]);for(const a of l)o.has(a)||pn(e[a],t[a])||(i[a]=t[a]===void 0?null:t[a]);return Object.keys(i).length?i:null}function Yt(e,t,o){const i=new Map(e.map(c=>[o(c),c])),l=new Map(t.map(c=>[o(c),c])),a=[],r=[],s=[];for(const[c,u]of l){const f=i.get(c);f?s.push({cur:f,tgt:u}):a.push(u)}for(const[c,u]of i)l.has(c)||r.push(u);const d=(c,u)=>o(c)<o(u)?-1:o(c)>o(u)?1:0;return a.sort(d),r.sort(d),s.sort((c,u)=>d(c.tgt,u.tgt)),{added:a,removed:r,common:s}}function tf(e,t){const o=new Set(e),i=new Set(t),l=t.filter(r=>!o.has(r)).sort(),a=e.filter(r=>!i.has(r)).sort();return{added:l,removed:a}}const nf=new Set(["attributes","operations","indexes","rev"]),of=new Set(["end1","end2","rev"]),lf=new Set(["memberEntityRefs","rev"]),Qa=new Set(["modelId"]),af=new Set(["modelId","columns"]),rf=new Set([]);function sf(e,t,o,i){const l=Yt(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of l.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:d}of l.common){const c=Gt(s,d,Qa);c&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:c})}const a=Yt(t.operations??[],o.operations??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of a.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:d}of a.common){const c=Gt(s,d,Qa);c&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:c})}const r=Yt(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of r.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:d}of r.common){if(!pn(s.columns,d.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:d});continue}const c=Gt(s,d,af);c&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:c})}}function cf(e,t,o){const i=Yt(e.entities??[],t.entities??[],r=>r.modelId);for(const r of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:r.modelId});for(const r of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:r.modelId,value:sl(r)});for(const{cur:r,tgt:s}of i.common){const d=Gt(r,s,nf);d&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:d}),sf(r.modelId,r,s,o)}const l=Yt(e.associations??[],t.associations??[],r=>r.modelId);for(const r of l.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:r.modelId});for(const r of l.added)o.push({kind:"association.add",casUnit:"logical",associationRef:r.modelId,value:sl(r)});for(const{cur:r,tgt:s}of l.common){const d=Gt(r,s,of);d&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:d});for(const c of["end1","end2"]){const u=Gt(r[c]??{},s[c]??{},rf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:c,patch:u})}}const a=Yt(e.groups??[],t.groups??[],r=>r.modelId);for(const r of a.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:r.modelId});for(const r of a.added)o.push({kind:"group.add",casUnit:"logical",groupRef:r.modelId,value:sl(r)});for(const{cur:r,tgt:s}of a.common){const d=Gt(r,s,lf);d&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:d});const c=tf(r.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of c.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u});for(const u of c.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,entityRef:u})}}function Mo(e,t,o,i,l,a,r){const s=Yt(e,t,o);for(const d of s.removed)r.push({kind:l,casUnit:"layout",[a]:o(d),value:void 0});for(const d of s.added)r.push({kind:i,casUnit:"layout",[a]:o(d),value:d});for(const{cur:d,tgt:c}of s.common)pn(d,c)||(r.push({kind:l,casUnit:"layout",[a]:o(d),value:void 0}),r.push({kind:i,casUnit:"layout",[a]:o(c),value:c}))}function df(e,t,o){Mo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Mo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Mo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Mo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function uf(e,t){const o=[];return cf(e.logical,t.logical,o),df(e.layout,t.layout,o),o}function ff(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 mf={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 pf{constructor(t){Le(this,"out",[]);Le(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const l=this.last.get(o);this.out.push({...zn(t),field:o,value:i,...this.last.has(o)?{oldValue:l}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...zn(t),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 l of i){if(!this.last.has(l)){this.out.push({...zn(t),field:l,value:void 0,removed:!0});continue}this.out.push({...zn(t),field:l,value:void 0,removed:!0,oldValue:this.last.get(l)}),this.last.delete(l)}}member(t,o,i){const l="memberEntityRefs";this.fieldFilter!=null&&l!==this.fieldFilter||this.out.push({...zn(t),field:l,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function zn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function dt(e,t,o,i){if(o==null||typeof o!="object")return;const l=mf[i];for(const[a,r]of Object.entries(o))l.has(a)||e.set(t,a,r)}function Wt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,l]of Object.entries(o))e.set(t,i,l)}function cl(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Vt(e,t){var a,r,s,d,c,u,f,p;const o=ff(t),i=new pf(t.field),l=[...e].sort((m,h)=>m.seq-h.seq);for(const m of l)for(const h of m.ops)switch(o){case"entity":if(h.entityRef!==t.entityRef)break;h.kind==="entity.add"?dt(i,m,h.value,"entity"):h.kind==="entity.update"?Wt(i,m,h.patch):h.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=cl((a=h.value)==null?void 0:a.attributes,t.attributeRef);g&&dt(i,m,g,"attribute")}else h.kind==="attribute.add"&&((r=h.value)==null?void 0:r.modelId)===t.attributeRef?dt(i,m,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===t.attributeRef?Wt(i,m,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===t.attributeRef||h.kind==="entity.remove")&&i.remove(m);break;case"operation":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=cl((s=h.value)==null?void 0:s.operations,t.operationRef);g&&dt(i,m,g,"operation")}else h.kind==="operation.add"&&((d=h.value)==null?void 0:d.modelId)===t.operationRef?dt(i,m,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===t.operationRef?Wt(i,m,h.patch):(h.kind==="operation.remove"&&h.operationRef===t.operationRef||h.kind==="entity.remove")&&i.remove(m);break;case"index":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const g=cl((c=h.value)==null?void 0:c.indexes,t.indexRef);g&&dt(i,m,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===t.indexRef?dt(i,m,h.value,"index"):h.kind==="index.update"&&h.indexRef===t.indexRef?Wt(i,m,h.patch):(h.kind==="index.remove"&&h.indexRef===t.indexRef||h.kind==="entity.remove")&&i.remove(m);break;case"association":if(h.associationRef!==t.associationRef)break;h.kind==="association.add"?dt(i,m,h.value,"association"):h.kind==="association.update"?Wt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(h.associationRef!==t.associationRef)break;if(h.kind==="association.add"){const g=(f=h.value)==null?void 0:f[t.end];dt(i,m,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===t.end?Wt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"group":if(h.groupRef!==t.groupRef)break;if(h.kind==="group.add"){dt(i,m,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const w of g)i.member(m,w,!1)}else h.kind==="group.update"?Wt(i,m,h.patch):h.kind==="group.remove"?i.remove(m):h.kind==="group.addMember"&&h.entityRef!=null?i.member(m,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(m,h.entityRef,!0);break}return i.result()}function hf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function hn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function yf(e,t){const o=new Set,i=new Set,l=new Set;for(const a of e)for(const r of a.ops){const s=r;if(r.kind==="entity.add"&&s.entityRef===t){const d=s.value;hn(d==null?void 0:d.attributes,o),hn(d==null?void 0:d.operations,i),hn(d==null?void 0:d.indexes,l);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?hn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?hn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?hn([s.value],l):(r.kind==="index.update"||r.kind==="index.remove")&&typeof s.indexRef=="string"&&l.add(s.indexRef))}return{attributes:o,operations:i,indexes:l}}function Do(e,t){return e.map(o=>({...o,subject:t}))}function er(e,t){const o=e.filter(s=>s.ops.some(d=>hf(d,t))),{attributes:i,operations:l,indexes:a}=yf(o,t),r=[...Do(Vt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Do(Vt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of l)r.push(...Do(Vt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of a)r.push(...Do(Vt(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return r.map((s,d)=>({e:s,i:d})).sort((s,d)=>s.e.seq-d.e.seq||s.i-d.i).map(({e:s})=>s)}function tr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function gf(e){var i,l,a;const t=new Set,o=(r,s)=>{typeof s=="string"&&t.add(`${r}:${s}:`)};for(const r of e)for(const s of r.ops){const d=s;switch(s.kind){case"entity.add":{o("entity",d.entityRef);const c=d.value;for(const u of Array.isArray(c==null?void 0:c.attributes)?c.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(c==null?void 0:c.operations)?c.operations:[])o("operation",u.modelId);for(const u of Array.isArray(c==null?void 0:c.indexes)?c.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=d.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(l=d.value)==null?void 0:l.modelId);break;case"index.add":o("index",(a=d.value)==null?void 0:a.modelId);break;case"association.add":o("association",d.associationRef);break;case"group.add":o("group",d.groupRef);break}}return t}function bf(e){const t=new Set,o=new Set,i=new Set;for(const l of e)for(const a of l.ops){const r=a,s=a.kind;if(s.startsWith("entity."))typeof r.entityRef=="string"&&t.add(r.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const d=r.containerRef??r.entityRef;typeof d=="string"&&t.add(d)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof r.associationRef=="string"&&o.add(r.associationRef):s.startsWith("group.")&&typeof r.groupRef=="string"&&i.add(r.groupRef)}return{entities:t,associations:o,groups:i}}function _f(e){const{entities:t,associations:o,groups:i}=bf(e),l=[];for(const a of t)for(const r of er(e,a))l.push({...r,subject:{...r.subject,entityRef:a}});for(const a of o){for(const r of Vt(e,{associationRef:a}))l.push({...r,subject:{kind:"association",ref:a}});for(const r of["end1","end2"])for(const s of Vt(e,{associationRef:a,end:r}))l.push({...s,subject:{kind:"associationEnd",ref:a,end:r}})}for(const a of i)for(const r of Vt(e,{groupRef:a}))l.push({...r,subject:{kind:"group",ref:a}});return l}function nr(e){const t=_f(e),o=gf(e),i=new Map;for(const r of t){const s=tr(r.subject),d=i.get(s);(d===void 0||r.seq<d)&&i.set(s,r.seq)}const l=new Map;for(const r of t){let s=l.get(r.seq);s||(s={meta:r,subjects:new Map},l.set(r.seq,s));const d=tr(r.subject);let c=s.subjects.get(d);if(!c){const u=r.removed?"remove":i.get(d)===r.seq&&o.has(d)?"add":"update";c={subject:r.subject,verb:u,fields:[]},s.subjects.set(d,c)}r.removed?c.verb="remove":c.fields.push({field:r.field,value:r.value,...r.oldValue!==void 0?{oldValue:r.oldValue}:{}})}const a=[];for(const[r,s]of l){const d=s.meta;a.push({seq:r,...d.ts!==void 0?{ts:d.ts}:{},...d.origin!==void 0?{origin:d.origin}:{},...d.author!==void 0?{author:d.author}:{},...d.kind!==void 0?{kind:d.kind}:{},...d.restoredFromSeq!==void 0?{restoredFromSeq:d.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return a.sort((r,s)=>s.seq-r.seq)}class dl{constructor(t){Le(this,"undoStack",[]);Le(this,"redoStack",[]);Le(this,"savePoint",null);Le(this,"listeners",new Set);Le(this,"commandListeners",new Set);Le(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"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.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const l of this.commandListeners)l(t,o,i)}}function or(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function We(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function it(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Me(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function wt(e,t,o){var i,l;return(l=(i=e.layout.notes.find(a=>a.modelId===t))==null?void 0:i.connections)==null?void 0:l.find(a=>a.targetRef===o)}function ul(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=or(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const l=We(o,e.modelId);l>=0&&o.layout.entityLayouts.splice(l,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function fl(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const l=or(i,e);if(l<0)throw new Error(`엔티티 없음: ${e}`);const a=We(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),d=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&d.push({item:u,index:f})});const c=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&c.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[l],index:l},entityLayout:a>=0?{item:i.layout.entityLayouts[a],index:a}:void 0,assocs:r,assocLayouts:d,groupMemberships:c},[...d].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of c){const f=i.logical.groups.find(p=>p.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}a>=0&&i.layout.entityLayouts.splice(a,1),i.logical.entities.splice(l,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((l,a)=>l.index-a.index).forEach(l=>i.logical.associations.splice(l.index,0,l.item)),[...t.assocLayouts].sort((l,a)=>l.index-a.index).forEach(l=>i.layout.associationLayouts.splice(l.index,0,l.item));for(const l of t.groupMemberships){const a=i.logical.groups.find(r=>r.modelId===l.groupId);a==null||a.memberEntityRefs.splice(l.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],l=[];for(const a of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:a.item.modelId}),l.push({kind:"association.add",casUnit:"logical",associationRef:a.item.modelId,value:a.item});for(const a of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:a.item.associationRef,incidental:!0}),l.push({kind:"associationLayout.add",casUnit:"layout",associationRef:a.item.associationRef,value:a.item,incidental:!0});for(const a of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e}),l.push({kind:"group.addMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),l.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),l.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:l.reverse()}}}}function ir(e,t){const o={};return{label:"엔티티 수정",apply(i){const l=Me(i,e);for(const a of Object.keys(t))o[a]=l[a];Object.assign(l,t)},invert(i){Object.assign(Me(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function lr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const l=Me(i,e);o=l.name,l.name=t},invert(i){Me(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function yn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const l=We(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.location},a.location={...t}},invert(i){const l=We(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.location=o)},emitOps(){const i=l=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function ar(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const l=We(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.size},a.size={...t}},invert(i){const l=We(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.size=o)},emitOps(){const i=l=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Un(e,t){const o={...(e==null?void 0:e.properties)??{}};return t?o.swatch=t:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function rr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const l=We(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.style,a.style=Un(a.style,t)},invert(i){const l=We(i,e);l>=0&&(i.layout.entityLayouts[l].style=o)},emitOps(i){const l=We(i,e),a=l>=0?i.layout.entityLayouts[l].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(a)],invert:[r(o)]}}}}function sr(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const l=We(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.collapsed,a.collapsed=t},invert(i){const l=We(i,e);l>=0&&(i.layout.entityLayouts[l].collapsed=o)},emitOps(){const i=l=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:l}});return{forward:[i(t)],invert:[i(o)]}}}}function ml(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,l)=>{i.collapsed=t[l]})},emitOps(o){const i=[],l=[];return o.layout.entityLayouts.forEach((a,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:e}}),l.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:l}}}}function Oo(e,t,o){let i;return{label:"속성 색상 변경",apply(l){const a=We(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.attributeStyles;const s={...r.attributeStyles},d=Un(s[t],o);d?s[t]=d:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(l){const a=We(l,e);a>=0&&(l.layout.entityLayouts[a].attributeStyles=i)},emitOps(l){const a=We(l,e),r=a>=0?l.layout.entityLayouts[a].attributeStyles:void 0,s=d=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:d}});return{forward:[s(r)],invert:[s(i)]}}}}function pl(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e.modelId);l>=0&&o.layout.groupLayouts.splice(l,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function cr(e,t){const o={},i=l=>{const a=l.logical.groups.find(r=>r.modelId===e);if(!a)throw new Error(`그룹 없음: ${e}`);return a};return{label:"그룹 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function hl(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:l>=0?{item:o.layout.groupLayouts[l],index:l}:void 0},l>=0&&o.layout.groupLayouts.splice(l,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function dr(e,t){let o=!1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에 편입",apply(l){const a=i(l);a&&!a.memberEntityRefs.includes(t)&&(a.memberEntityRefs.push(t),o=!0)},invert(l){if(!o)return;const a=i(l),r=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1;r>=0&&a.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function Lo(e,t){let o=-1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에서 제외",apply(l){const a=i(l);o=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1,o>=0&&a.memberEntityRefs.splice(o,1)},invert(l){var a;o<0||(a=i(l))==null||a.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function ur(e,t){let o=null;return{label:"그룹 이동",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function fr(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function mr(e,t){let o;return{label:"그룹 색상 변경",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o=l.style,l.style=Un(l.style,t)},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&(l.style=o)},emitOps(i){const l=i.layout.groupLayouts.find(r=>r.groupRef===e),a=r=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:r}});return{forward:[a(l==null?void 0:l.style)],invert:[a(o)]}}}}function vt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Me(o,e).attributes.push(t)},invert(o){const i=Me(o,e),l=i.attributes.findIndex(a=>a.modelId===t.modelId);l>=0&&i.attributes.splice(l,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function qt(e,t,o){const i={},l=a=>{const r=Me(a,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function At(e,t){let o=null;return{label:"속성 삭제",apply(i){const l=Me(i,e),a=l.attributes.findIndex(r=>r.modelId===t);if(a<0)throw new Error(`속성 없음: ${t}`);o={item:l.attributes[a],index:a},l.attributes.splice(a,1)},invert(i){o&&Me(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function yl(e,t,o){let i=null;return{label:"속성 재정렬",apply(l){const a=Me(l,e);i=a.attributes.map(f=>({...f}));const r=new Set(t),s=a.attributes.filter(f=>r.has(f.modelId)),d=a.attributes.filter(f=>!r.has(f.modelId)),c=Math.max(0,Math.min(o,d.length)),u=[...d.slice(0,c),...s,...d.slice(c)];a.attributes.splice(0,a.attributes.length,...u),a.attributes.forEach((f,p)=>f.order=p)},invert(l){i&&Me(l,e).attributes.splice(0,1/0,...i)},emitOps(l){const a=Me(l,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function pr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const l=Me(i,e);l.operations||(l.operations=[],o=!0),l.operations.push(t)},invert(i){var r;const l=Me(i,e),a=((r=l.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;a>=0&&l.operations.splice(a,1),o&&l.operations&&l.operations.length===0&&(l.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function hr(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).operations)==null?void 0:s.find(d=>d.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function yr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const l=Me(i,e),a=((s=l.operations)==null?void 0:s.findIndex(d=>d.modelId===t))??-1;if(a<0)throw new Error(`메서드 없음: ${t}`);const r=l.operations.length===1;o={item:l.operations[a],index:a,wasSole:r},l.operations.splice(a,1),r&&(l.operations=void 0)},invert(i){if(!o)return;const l=Me(i,e);l.operations||(l.operations=[]),l.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function gr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(l){const a=Me(l,e),r=a.operations??[];i=r.map(p=>({...p}));const s=new Set(t),d=r.filter(p=>s.has(p.modelId)),c=r.filter(p=>!s.has(p.modelId)),u=Math.max(0,Math.min(o,c.length)),f=[...c.slice(0,u),...d,...c.slice(u)];r.splice(0,r.length,...f),r.forEach((p,m)=>p.order=m),a.operations=r},invert(l){if(!i)return;const a=Me(l,e);a.operations&&a.operations.splice(0,1/0,...i)},emitOps(l){const a=(Me(l,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function br(e,t,o){let i;return{label:"메서드 색상 변경",apply(l){const a=We(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.operationStyles;const s={...r.operationStyles},d=Un(s[t],o);d?s[t]=d:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(l){const a=We(l,e);a>=0&&(l.layout.entityLayouts[a].operationStyles=i)},emitOps(l){const a=We(l,e),r=a>=0?l.layout.entityLayouts[a].operationStyles:void 0,s=d=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:d}});return{forward:[s(r)],invert:[s(i)]}}}}function gl(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e.modelId);l>=0&&o.layout.associationLayouts.splice(l,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,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 bl(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:l>=0?{item:o.layout.associationLayouts[l],index:l}:void 0},l>=0&&o.layout.associationLayouts.splice(l,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Po(e,t){const o={},i=l=>{const a=l.logical.associations.find(r=>r.modelId===e);if(!a)throw new Error(`관계 없음: ${e}`);return a};return{label:"관계 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function gn(e,t,o){const i={},l=a=>{const r=a.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function _r(e,t){return{label:"인덱스 추가",apply(o){const i=Me(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var a;const i=Me(o,e),l=((a=i.indexes)==null?void 0:a.findIndex(r=>r.modelId===t.modelId))??-1;l>=0&&i.indexes.splice(l,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function wr(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).indexes)==null?void 0:s.find(d=>d.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function vr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const l=Me(i,e),a=((r=l.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(a<0)throw new Error(`인덱스 없음: ${t}`);o={item:l.indexes[a],index:a},l.indexes.splice(a,1)},invert(i){o&&Me(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const ut=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Hn=(e,t)=>{var o;return((o=it(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Er(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(l){const a=it(l,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...a.waypoints[t]},a.waypoints.splice(t,1,{...o})},invert(l){const a=it(l,e);a&&i&&a.waypoints.splice(t,1,i)},emitOps(l){const a=Hn(l,e),r=a.map((s,d)=>d===t&&i?{...i}:s);return{forward:[ut(e,a)],invert:[ut(e,r)]}}}}function kr(e,t){let o=null;return{label:"waypoint 제거",apply(i){const l=it(i,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...l.waypoints[t]},l.waypoints.splice(t,1)},invert(i){const l=it(i,e);l&&o&&l.waypoints.splice(t,0,o)},emitOps(i){const l=Hn(i,e),a=l.slice();return o&&a.splice(t,0,{...o}),{forward:[ut(e,l)],invert:[ut(e,a)]}}}}function Nr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(l){const a=it(l,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);i=a.waypoints.map(r=>({...r})),a.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(l){const a=it(l,e);a&&i&&(a.waypoints=i)},emitOps(l){return{forward:[ut(e,Hn(l,e))],invert:[ut(e,i??[])]}}}}function $r(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=it(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(l=>({...l})),i.waypoints=[]},invert(o){const i=it(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[ut(e,Hn(o,e))],invert:[ut(e,t??[])]}}}}function xr(e,t,o){return{label:"waypoint 추가",apply(i){const l=it(i,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);l.waypoints.splice(t,0,{...o})},invert(i){const l=it(i,e);l==null||l.waypoints.splice(t,1)},emitOps(i){const l=Hn(i,e),a=l.slice();return a.splice(t,1),{forward:[ut(e,l)],invert:[ut(e,a)]}}}}function Sr(e){return{label:"노트 추가",apply(t){t.layout.notes.push(e)},invert(t){const o=t.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&t.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 _l(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Fn(e,t){let o=null;return{label:"노트 이동",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Ir(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Cr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o=l.memo,l.memo=t},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&(l.memo=o)},emitOps(){const i=l=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:l}});return{forward:[i(t)],invert:[i(o)]}}}}function Rr(e,t){let o;return{label:"노트 색상 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o=l.style,l.style=Un(l.style,t)},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&(l.style=o)},emitOps(i){const l=i.layout.notes.find(r=>r.modelId===e),a=r=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:r}});return{forward:[a(l==null?void 0:l.style)],invert:[a(o)]}}}}function Vr(e,t){let o=!1,i=!1;const l=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(a){const r=l(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(a){if(!o)return;const r=l(a);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function Ar(e,t){let o=-1;const i=l=>l.layout.groupLayouts.find(a=>a.groupRef===e);return{label:"그룹에서 노트 제외",apply(l){var r;const a=i(l);o=((r=a==null?void 0:a.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&a.memberNoteRefs.splice(o,1)},invert(l){if(o<0)return;const a=i(l);a&&(a.memberNoteRefs||(a.memberNoteRefs=[]),a.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const Tt=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),zo=(e,t,o)=>{var i;return((i=wt(e,t,o))==null?void 0:i.waypoints.map(l=>({...l})))??[]};function Tr(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(l){const a=l.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);if(a.connections||(a.connections=[],i=!0),a.connections.some(r=>r.targetRef===t)){o=!1;return}a.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(l){if(!o)return;const a=l.layout.notes.find(s=>s.modelId===e);if(!(a!=null&&a.connections))return;const r=a.connections.findIndex(s=>s.targetRef===t);r>=0&&a.connections.splice(r,1),i&&delete a.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function Br(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const l=i.layout.notes.find(s=>s.modelId===e),a=((r=l==null?void 0:l.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(l!=null&&l.connections)||a<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:l.connections[a],index:a},l.connections.splice(a,1)},invert(i){if(!o)return;const l=i.layout.notes.find(a=>a.modelId===e);l!=null&&l.connections&&l.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function Mr(e,t,o,i){let l=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(a){const r=wt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);l={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(a){const r=wt(a,e,t);r&&l&&r.waypoints.splice(o,1,l)},emitOps(a){const r=zo(a,e,t),s=r.map((d,c)=>c===o&&l?{...l}:d);return{forward:[Tt(e,t,r)],invert:[Tt(e,t,s)]}}}}function Dr(e,t,o,i){return{label:"waypoint 추가",apply(l){const a=wt(l,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);a.waypoints.splice(o,0,{...i})},invert(l){const a=wt(l,e,t);a==null||a.waypoints.splice(o,1)},emitOps(l){const a=zo(l,e,t),r=a.slice();return r.splice(o,1),{forward:[Tt(e,t,a)],invert:[Tt(e,t,r)]}}}}function Or(e,t,o){let i=null;return{label:"waypoint 제거",apply(l){const a=wt(l,e,t);if(!a||!a.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...a.waypoints[o]},a.waypoints.splice(o,1)},invert(l){const a=wt(l,e,t);a&&i&&a.waypoints.splice(o,0,i)},emitOps(l){const a=zo(l,e,t),r=a.slice();return i&&r.splice(o,0,{...i}),{forward:[Tt(e,t,a)],invert:[Tt(e,t,r)]}}}}function Lr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const l=wt(i,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);o=l.waypoints.map(a=>({...a})),l.waypoints=[]},invert(i){const l=wt(i,e,t);l&&o&&(l.waypoints=o)},emitOps(i){return{forward:[Tt(e,t,zo(i,e,t))],invert:[Tt(e,t,o??[])]}}}}function De(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const l of t)l.apply(i)},invert(i){for(let l=t.length-1;l>=0;l--)t[l].invert(i)},emitOps(i){const l=t.map(a=>{if(!a.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${a.label}`);return a.emitOps(i)});return{forward:l.flatMap(a=>a.forward),invert:l.slice().reverse().flatMap(a=>a.invert)}}}}const wf=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:gl,addAttribute:vt,addEntity:ul,addEntityToGroup:dr,addGroup:pl,addIndex:_r,addNote:Sr,addNoteConnection:Tr,addNoteConnectionWaypoint:Dr,addNoteToGroup:Vr,addOperation:pr,addWaypoint:xr,clearNoteConnectionWaypoints:Lr,clearWaypoints:$r,composite:De,moveEntity:yn,moveGroup:ur,moveNote:Fn,moveNoteConnectionWaypoint:Mr,moveWaypoint:Er,removeAssociation:bl,removeAttribute:At,removeEntity:fl,removeEntityFromGroup:Lo,removeGroup:hl,removeIndex:vr,removeNote:_l,removeNoteConnection:Br,removeNoteConnectionWaypoint:Or,removeNoteFromGroup:Ar,removeOperation:yr,removeWaypoint:kr,renameEntity:lr,reorderAttributes:yl,reorderOperations:gr,resizeEntity:ar,resizeGroup:fr,resizeNote:Ir,setAllEntitiesCollapsed:ml,setAttributeSwatch:Oo,setEntityCollapsed:sr,setEntitySwatch:rr,setGroupSwatch:mr,setNoteMemo:Cr,setNoteSwatch:Rr,setOperationSwatch:br,translateWaypoints:Nr,updateAssociation:Po,updateAssociationEnd:gn,updateAttribute:qt,updateEntity:ir,updateGroup:cr,updateIndex:wr,updateOperation:hr},Symbol.toStringTag,{value:"Module"}));class Pr{constructor(){Le(this,"revs",new Map);Le(this,"layoutVersion",0);Le(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class zr{constructor(t){Le(this,"cache",new Pr);Le(this,"newClientOpId");Le(this,"debounceMs");Le(this,"emissions",new WeakMap);Le(this,"open",null);Le(this,"debounceHandle",null);Le(this,"queue",[]);Le(this,"sending",!1);Le(this,"_frozen",!1);Le(this,"stack",null);Le(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Ve,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,l,a)=>this.handle(i,l,a));return()=>{o(),this.stack===t&&(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(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let l;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);l=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);l=s}const a=o==="undo"?l.invert:l.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=a,this.emissions.set(t,{forward:a,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,l),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:a,inv:l.invert},this.startDebounce();return}a.length&&this.enqueue(this.buildBatch(a))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((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(t){const o={},i=new Set;let l=!1,a=!1;for(const r of t)if(r.casUnit==="logical")if(l=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(a=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return a&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),l&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,l;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(a){this.sending=!1,(l=(i=this.opts).onError)==null||l.call(i,a),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const Ur=["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","group.add"];function vf(e,t){const o=()=>e.entities.filter(a=>{var r;return((r=a.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(a=>a.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const l=o();return l.length?l:i()}function Ef(e,t){const o=()=>e.attributes.filter(a=>a.name===t.ref),i=()=>e.attributes.filter(a=>a.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const l=o();return l.length?l:i()}function Hr(e,t,o){return e.associations.filter(i=>{const l=[i.end1.entityRef,i.end2.entityRef];return l.includes(t)&&l.includes(o)})}function je(e,t){const o=vf(e,t);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 kf(e,t){const o=Ef(e,t);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 Nf(e,t){const o=()=>e.attributes.flatMap(a=>a.dbAttrs).filter(a=>a.physicalName===t.ref),i=()=>e.attributes.filter(a=>a.name===t.ref).flatMap(a=>a.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const l=o();return l.length?l:i()}function $f(e,t){const o=Nf(e,t);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 xf(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Sf(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function If(e,t){const o=xf(e,t);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 Cf(e,t){const o=Sf(e,t);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 Fr(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...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 Gr(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Yr(e,t,o,i,l,a){const r=[];let s=!1;for(const d of t.columns){const c=$f(e,d.column);if(!c.ok){l.push(c.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:d.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:d.column,matches:c.matches}),s=!0;continue}r.push({columnRef:c.value.modelId,descending:d.descending??!1})}return s?null:{modelId:a(),name:t.name,unique:t.unique??!1,columns:r,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function Rf(e,t,o={}){const i=o.mkId??Ve,l=[],a=[],r=new Map,s=new Map,d=new Set;for(const c of t)c.kind==="entity.add"&&(d.add(c.spec.name),c.spec.physicalName&&d.add(c.spec.physicalName));return t.forEach((c,u)=>{var f;switch(c.kind){case"entity.add":{const p=i(),m={modelId:p,name:c.spec.name,stereotype:c.spec.stereotype??"JPA_ENTITY",attributes:[],...c.spec.physicalName?{table:{physicalName:c.spec.physicalName}}:{}},h={ref:c.spec.name};let g=!1;for(const[S,y]of(c.spec.attributes??[]).entries()){if(y.type==="GroupCodeEnum"&&!y.groupCode){a.push({code:"groupcode-required",opIndex:u,entity:h,handle:{ref:y.name}}),g=!0;continue}m.attributes.push(Fr(y,S,i))}const w=(c.spec.operations??[]).map((S,y)=>Gr(S,y,i));w.length&&(m.operations=w);const b=[];for(const S of c.spec.indexes??[]){const y=Yr(m,S,u,h,a,i);y?b.push(y):g=!0}if(b.length&&(m.indexes=b),g)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:p,value:m});break}case"entity.update":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,patch:c.patch});break}case"entity.remove":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:p.value.modelId});break}case"attribute.add":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}if(c.spec.type==="GroupCodeEnum"&&!c.spec.groupCode){a.push({code:"groupcode-required",opIndex:u,entity:c.entity,handle:{ref:c.spec.name}});break}const m=r.get(p.value.modelId)??p.value.attributes.length;r.set(p.value.modelId,m+1);const h=Fr(c.spec,m,i);l.push({kind:"attribute.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,value:h});break}case"attribute.update":case"attribute.remove":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}const m=kf(p.value,c.attribute);if(!m.ok){a.push(m.reason==="not-found"?{code:"attribute-not-found",opIndex:u,entity:c.entity,handle:c.attribute}:{code:"attribute-ambiguous",opIndex:u,entity:c.entity,handle:c.attribute,matches:m.matches});break}c.kind==="attribute.update"?l.push({kind:"attribute.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,attributeRef:m.value.modelId,patch:c.patch}):l.push({kind:"attribute.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,attributeRef:m.value.modelId});break}case"association.add":{const p=je(e,c.spec.from),m=je(e,c.spec.to);if(p.ok||a.push(Ze(p.reason,u,c.spec.from,p.matches,d)),m.ok||a.push(Ze(m.reason,u,c.spec.to,m.matches,d)),!p.ok||!m.ok)break;if(c.spec.identifying&&p.value.modelId===m.value.modelId){a.push({code:"self-identifying",opIndex:u,handle:{from:c.spec.from,to:c.spec.to}});break}const h=i(),g={modelId:h,...c.spec.identifying!=null?{identifying:c.spec.identifying}:{},end1:{entityRef:p.value.modelId,multiplicity:c.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:m.value.modelId,multiplicity:c.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:c.spec.composition??!1}};l.push({kind:"association.add",casUnit:"logical",associationRef:h,value:g});break}case"association.remove":{const p=je(e,c.association.from),m=je(e,c.association.to);if(p.ok||a.push(Ze(p.reason,u,c.association.from,p.matches,d)),m.ok||a.push(Ze(m.reason,u,c.association.to,m.matches,d)),!p.ok||!m.ok)break;const h=Hr(e,p.value.modelId,m.value.modelId);if(h.length!==1){a.push(h.length===0?{code:"association-not-found",opIndex:u,handle:c.association}:{code:"association-ambiguous",opIndex:u,handle:c.association,matches:h.map(g=>g.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const p=Wr(e,c.association,u,a,d);if(!p)break;l.push({kind:"association.update",casUnit:"logical",containerRef:p.modelId,associationRef:p.modelId,patch:c.patch});break}case"associationEnd.update":{const p=Wr(e,c.association,u,a,d);if(!p)break;const m=c.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:p.modelId,associationRef:p.modelId,end:m,patch:c.patch});break}case"index.add":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}const m=Yr(p.value,c.spec,u,c.entity,a,i);if(!m)break;l.push({kind:"index.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.modelId,value:m});break}case"index.update":case"index.remove":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}const m=If(p.value,c.index);if(!m.ok){a.push(m.reason==="not-found"?{code:"index-not-found",opIndex:u,entity:c.entity,handle:c.index}:{code:"index-ambiguous",opIndex:u,entity:c.entity,handle:c.index,matches:m.matches});break}if(c.kind==="index.update"){if("columns"in c.patch){a.push({code:"index-columns-patch-unsupported",opIndex:u,entity:c.entity,handle:c.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.value.modelId,patch:c.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,indexRef:m.value.modelId});break}case"operation.add":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}const m=s.get(p.value.modelId)??((f=p.value.operations)==null?void 0:f.length)??0;s.set(p.value.modelId,m+1);const h=Gr(c.spec,m,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const p=je(e,c.entity);if(!p.ok){a.push(Ze(p.reason,u,c.entity,p.matches,d));break}const m=Cf(p.value,c.operation);if(!m.ok){a.push(m.reason==="not-found"?{code:"operation-not-found",opIndex:u,entity:c.entity,handle:c.operation}:{code:"operation-ambiguous",opIndex:u,entity:c.entity,handle:c.operation,matches:m.matches});break}c.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:m.value.modelId,patch:c.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:p.value.modelId,entityRef:p.value.modelId,operationRef:m.value.modelId});break}case"group.add":{const p=[];let m=!1;for(const w of c.spec.members){const b=je(e,w);if(!b.ok){a.push(Ze(b.reason,u,w,b.matches,d)),m=!0;continue}p.push(b.value.modelId)}if(m)break;const h=i(),g={modelId:h,excludeDDLGeneration:c.spec.excludeDDLGeneration??!1,memberEntityRefs:p,...c.spec.name?{name:c.spec.name}:{},...c.spec.packageName?{packageName:c.spec.packageName}:{},...c.spec.description?{description:c.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:h,value:g});break}}}),a.length?{ok:!1,errors:a}:{ok:!0,ops:l}}function Ze(e,t,o,i,l){return e==="not-found"&&(l!=null&&l.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function Wr(e,t,o,i,l){const a=je(e,t.from),r=je(e,t.to);if(a.ok||i.push(Ze(a.reason,o,t.from,a.matches,l)),r.ok||i.push(Ze(r.reason,o,t.to,r.matches,l)),!a.ok||!r.ok)return null;const s=Hr(e,a.value.modelId,r.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(d=>d.modelId)}),null):s[0]}const qr={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Vf={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Af={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."},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},Uo={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Tf={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부)."},identifier:{type:"boolean"},notNull:{type:"boolean"},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:{...Uo,description:"속성 설명(다국어)."},columnLogicalName:{...Uo,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."}},required:["name","type"],additionalProperties:!1},Kr={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Bf={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Kr,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Kr,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},Mf={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...qr,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},Df={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Uo,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Of={type:"object",properties:{name:{...Uo,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},Lf={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function qe(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Pf={"entity.add":qe("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":qe("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":qe("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":qe("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":qe("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":qe("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":qe("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":qe("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":qe("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":qe("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":qe("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":qe("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":qe("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":qe("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":qe("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":qe("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":qe("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Xr={anyOf:Ur.map(e=>Pf[e])},zf={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:qr,assocHandle:Vf,entitySpec:Af,attrSpec:Tf,assocSpec:Bf,indexSpec:Mf,operationSpec:Df,groupSpec:Of,patch:Lf,symbolicOp:Xr}};function Uf(e,t,o,i={}){const l=i.mkClientOpId??Ve,a=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&a.add(s.containerRef);const r={};if(a.size){r.revs={};for(const s of a)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:l()}}const jr={location:{x:0,y:0},size:{width:220,height:140}};function Zr(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 Hf=/^[-=_*~\s]{3,}$/;function Ff(e){return e.attrType&&e.attrType!=="NORMAL"||!Hf.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Gf(e,t){return e.attrType==="DIVIDER"||Ff(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Zr)}}function Yf(e){const{modelId:t,name:o,visibility:i,sourceCode:l,description:a,order:r,personalInfoAttributeType:s,style:d,...c}=e;return{modelId:t,name:o,visibility:i,sourceCode:l,description:a?{ko:a}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(c).length?c:void 0}}function Wf(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(t=>({columnRef:t.targetColumn.refId,descending:t.descending}))}}function qf(e){var t,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(Gf),operations:(t=e.operations)==null?void 0:t.map(Yf),indexes:(o=e.indexes)==null?void 0:o.map(Wf),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Kf(e){const t={};for(const i of e.attributes)i.style&&(t[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??{...jr},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function Jr(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 wl(e){var t;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(t=e.attribute)==null?void 0:t.modelId,jpa:Jr(e)}}function Xf(e){var i,l;const t={modelId:e.modelId,description:e.description,end1:wl(e.end1),end2:wl(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(l=e.end2.attribute)==null?void 0:l.modelId,style:e.style};return{assoc:t,layout:o}}function Qr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function es(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ts(e){var o;const t=e.attribute;return(t==null?void 0:t.attrType)==="EMBED_OWN"&&(((o=t.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function ns(e,t){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_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Zr)}}function jf(e,t,o){var w,b;const i=Qr(e.end1.attribute),l=Qr(e.end2.attribute);if(i===l)return Xf(e);const a=i?e.end1:e.end2,r=i?e.end2:e.end1,s=a.attribute,d=(b=(w=s.dbAttrs)==null?void 0:w[0])==null?void 0:b.targetModelId,c=d?o.get(d):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((S,y)=>Math.max(S,y.order),-1)+1:s.order??0,p={...ns(s,f),attrType:"RELATION_OWN",derivedFrom:c?{associationRef:e.modelId,sourceAttributeRef:c}:void 0};u&&u.attributes.push(p);const m=(S,y)=>({entityRef:S.endModel.refId,multiplicity:S.multiplicity,navigable:S.navigable,composition:S.composition,attributeRef:y?c:p.modelId,legacyNavRaw:y?void 0:S.attribute,jpa:Jr(S)}),h={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,l)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h.end1.attributeRef,targetColumnRef:h.end2.attributeRef,style:e.style};return{assoc:h,layout:g}}function Zf(e,t){const o=e.targetModelId?t.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 Jf(e,t,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",l=i?e.end1:e.end2,a=i?e.end2:e.end1,r=l.attribute,s=t.get(a.endModel.refId),d=s?s.attributes.reduce((g,w)=>Math.max(g,w.order),-1)+1:r.order??0,c={...ns(r,d),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>Zf(g,o)),embedded:{associationRef:e.modelId,embeddableRef:l.endModel.refId}};s&&s.attributes.push(c);const u=g=>({...wl(g),legacyEmbedRaw:g.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?c.modelId:void 0,targetColumnRef:p?void 0:c.modelId,style:e.style};return{assoc:f,layout:m}}function Qf(e,t){var i,l,a,r;const o=[];for(const s of t){const d=(l=(i=s.end1)==null?void 0:i.endModel)==null?void 0:l.refId,c=(r=(a=s.end2)==null?void 0:a.endModel)==null?void 0:r.refId,u=d===e?c:d;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function os(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:l,style:a,connections:r,ownedConnections:s,...d}=e;let c=r;if(!c&&Array.isArray(s)){const u=Qf(o,s);u.length&&(c=u)}return{modelId:o,memo:i,geo:{location:{x:l.location.x+t.x,y:l.location.y+t.y},size:l.size},style:a,connections:c,legacyRaw:Object.keys(d).length?d:void 0}}function em(e){return(e.schemaVersion??1)>=2&&"logical"in e?tm(e):nm(e)}function tm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},l=e.logical.entities.map(i),a=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...d}=e.layout,c={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:l,associations:a,groups:r},layout:{...d,diagramId:d.diagramId??t,logicalModelRef:d.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:c,meta:u}}function nm(e){var b,S;const t=e.id??"",o=[],i=[],l=[],a=[],r=[],s=[],d=[],c=(y,x)=>{o.push(qf(y));const J=Kf(y);J.geo={location:{x:J.geo.location.x+x.x,y:J.geo.location.y+x.y},size:J.geo.size},i.push(J);for(const G of y.ownedAssociations??[])d.push(G)},u={x:0,y:0};for(const y of e.entities??[])c(y,u);const f=[];for(const y of e.groups??[]){const x=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:x.map(G=>G.modelId)});const J=((b=y.geo)==null?void 0:b.location)??u;if(y.geo){const G=(y.notes??[]).map(j=>j.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,memberNoteRefs:G.length?G:void 0})}for(const G of x)c(G,J);for(const G of y.notes??[])f.push(os(G,J))}const p=new Map(o.map(y=>[y.modelId,y])),m=new Map,h=new Map;for(const y of o)for(const x of y.attributes)for(const J of x.dbAttrs)m.set(J.modelId,x.modelId),h.set(J.modelId,J);for(const y of d)for(const x of[y.end1,y.end2]){const J=x.attribute;if(J&&(((S=J.dbAttrs)==null?void 0:S.length)??0)>0)for(const G of J.dbAttrs)G.modelId&&m.set(G.modelId,J.modelId)}for(const y of d){const x=es(y.end1.attribute),J=es(y.end2.attribute),G=ts(y.end1)||ts(y.end2),{assoc:j,layout:U}=x!==J||G?Jf(y,p,h):jf(y,p,m);l.push(j),a.push(U)}const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:l,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:a,groupLayouts:s,notes:[...(e.notes??[]).map(y=>os(y)),...f]}},w={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:w}}function is(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 om(e,t){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,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(is),style:t}}function im(e,t){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:t}}function lm(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(t=>({targetColumn:{refId:t.columnRef},descending:t.descending}))}}function Bt(e,t){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:t??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function am(e,t){const o=t==null?void 0:t.attributes.find(i=>{var l;return i.modelId===((l=e.derivedFrom)==null?void 0:l.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,l)=>{var a;return{...is(i),targetModelId:(a=o==null?void 0:o.dbAttrs[l])==null?void 0:a.modelId}})}}function rm(e){const t=new Set;for(const o of e.logical.associations){const i=o.end1.legacyNavRaw?o.end1:o.end2.legacyNavRaw?o.end2:void 0;i!=null&&i.attributeRef&&t.add(i.attributeRef)}return t}function sm(e){const t=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&t.add(i.modelId);return t}function cm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function dm(e,t){const o=(i,l)=>i===l?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:cm(e.logicalName,t==null?void 0:t.logicalName)?void 0:e.logicalName,dataType:e.dataType===((t==null?void 0:t.dataType)??"")?"":e.dataType,length:o(e.length,t==null?void 0:t.length),scale:o(e.scale,t==null?void 0:t.scale),unique:o(e.unique,t==null?void 0:t.unique),autoIncrement:o(e.autoIncrement,t==null?void 0:t.autoIncrement),updatable:o(e.updatable,t==null?void 0:t.updatable),insertable:o(e.insertable,t==null?void 0:t.insertable)}}function um(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var h;return((h=m.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const l=i.embedded.embeddableRef,a=t.logical.entities.find(f=>f.modelId===l);if(!a)return;const r=a.attributes.flatMap(f=>f.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((f,p)=>dm(f,r[p]))},d=e.end1.entityRef===l,c=d?e.end2:e.end1,u=c.attributeRef?{modelId:c.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Bt(e.end1,d?s:u),end2:Bt(e.end2,d?u:s)}}function fm(e,t,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:Bt(e.end1,e.end1.legacyEmbedRaw),end2:Bt(e.end2,e.end2.legacyEmbedRaw)};const l=um(e,t,i);if(l)return l;const a=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(a!==r){const s=a?e.end1:e.end2,d=a?e.end2:e.end1,c=t.logical.entities.find(h=>h.modelId===s.entityRef),u=c==null?void 0:c.attributes.find(h=>h.modelId===s.attributeRef),f=t.logical.entities.find(h=>h.modelId===d.entityRef),p=u?am(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Bt(e.end1,a?m:p),end2:Bt(e.end2,r?m:p)}}return{...i,end1:Bt(e.end1),end2:Bt(e.end2)}}function ls(e,t,o,i,l={x:0,y:0}){var u,f;const a=t.layout.entityLayouts.find(p=>p.entityRef===e.modelId),r=t.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>t.layout.associationLayouts.find(m=>m.associationRef===p),d=(a==null?void 0:a.geo)??{...jr},c={location:{x:d.location.x-l.x,y:d.location.y-l.y},size:d.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 m;return om(p,(m=a==null?void 0:a.attributeStyles)==null?void 0:m[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var m;return im(p,(m=a==null?void 0:a.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>fm(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(lm),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:c,style:a==null?void 0:a.style,collapsed:a==null?void 0:a.collapsed}}function mm(e,t,o,i){const l=t.layout.groupLayouts.find(d=>d.groupRef===e.modelId),a=e.memberEntityRefs.map(d=>t.logical.entities.find(c=>c.modelId===d)).filter(d=>!!d),r=(l==null?void 0:l.geo.location)??{x:0,y:0},s=((l==null?void 0:l.memberNoteRefs)??[]).map(d=>t.layout.notes.find(c=>c.modelId===d)).filter(d=>!!d).map(d=>as(d,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:a.map(d=>ls(d,t,o,i,r)),notes:s.length?s:void 0,geo:l==null?void 0:l.geo,style:l==null?void 0:l.style}}function as(e,t={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-t.x,y:e.geo.location.y-t.y},size:e.geo.size},style:e.style,connections:e.connections}}function pm(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),l=rm(e),a=sm(e),r=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:t.id,diagramVersion:t.diagramVersion,version:t.version,size:t.size??e.layout.canvasSize,packageName:t.packageName??e.logical.packageName,entities:i.map(s=>ls(s,e,l,a)),groups:e.logical.groups.map(s=>mm(s,e,l,a)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>as(s))}}function hm(e,t={}){var l,a,r;const o=((l=t.revSeed)==null?void 0:l.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((a=t.revSeed)==null?void 0:a.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:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function Gn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Et(e){return typeof e=="function"?e():n.unref(e)}const ym=typeof window<"u"&&typeof document<"u",gm=e=>typeof e<"u",bm=Object.prototype.toString,_m=e=>bm.call(e)==="[object Object]",wm=()=>{};function vm(e,t){function o(...i){return new Promise((l,a)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(l).catch(a)})}return o}const rs=e=>e();function Em(e=rs){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const l=(...a)=>{t.value&&e(...a)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:l}}function ss(e,t=!1,o="Timeout"){return new Promise((i,l)=>{setTimeout(t?()=>l(o):i,e)})}function km(e,t,o={}){const{eventFilter:i=rs,...l}=o;return n.watch(e,vm(i,t),l)}function bn(e,t,o={}){const{eventFilter:i,...l}=o,{eventFilter:a,pause:r,resume:s,isActive:d}=Em(i);return{stop:km(e,t,{...l,eventFilter:a}),pause:r,resume:s,isActive:d}}function Nm(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(l){var a;if((a=Et(t.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=l,e.value=s}else{const s={...e.value,[i]:l};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=l}}));return o}function vl(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:h,throwOnTimeout:g}={}){let w=null;const S=[new Promise(y=>{w=n.watch(e,x=>{f(x)!==t&&(w==null||w(),y(x))},{flush:p,deep:m,immediate:!0})})];return h!=null&&S.push(ss(h,g).then(()=>Et(e)).finally(()=>w==null?void 0:w())),Promise.race(S)}function i(f,p){if(!n.isRef(f))return o(x=>x===f,p);const{flush:m="sync",deep:h=!1,timeout:g,throwOnTimeout:w}=p??{};let b=null;const y=[new Promise(x=>{b=n.watch([e,f],([J,G])=>{t!==(J===G)&&(b==null||b(),x(J))},{flush:m,deep:h,immediate:!0})})];return g!=null&&y.push(ss(g,w).then(()=>Et(e)).finally(()=>(b==null||b(),Et(e)))),Promise.race(y)}function l(f){return o(p=>!!p,f)}function a(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function d(f,p){return o(m=>{const h=Array.from(m);return h.includes(f)||h.includes(Et(f))},p)}function c(f){return u(1,f)}function u(f=1,p){let m=-1;return o(()=>(m+=1,m>=f),p)}return Array.isArray(Et(e))?{toMatch:o,toContains:d,changed:c,changedTimes:u,get not(){return vl(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:l,toBeNull:a,toBeNaN:s,toBeUndefined:r,changed:c,changedTimes:u,get not(){return vl(e,!t)}}}function El(e){return vl(e)}function $m(e){var t;const o=Et(e);return(t=o==null?void 0:o.$el)!=null?t:o}const cs=ym?window:void 0;function ds(...e){let t,o,i,l;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,l]=e,t=cs):[t,o,i,l]=e,!t)return wm;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const a=[],r=()=>{a.forEach(u=>u()),a.length=0},s=(u,f,p,m)=>(u.addEventListener(f,p,m),()=>u.removeEventListener(f,p,m)),d=n.watch(()=>[$m(t),Et(l)],([u,f])=>{if(r(),!u)return;const p=_m(f)?{...f}:f;a.push(...o.flatMap(m=>i.map(h=>s(u,m,h,p))))},{immediate:!0,flush:"post"}),c=()=>{d(),r()};return Gn(c),c}function xm(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function us(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:l=cs,eventName:a="keydown",passive:r=!1,dedupe:s=!1}=i,d=xm(t);return ds(l,a,u=>{u.repeat&&Et(s)||d(u)&&o(u)},r)}function Sm(e){return JSON.parse(JSON.stringify(e))}function kl(e,t,o,i={}){var l,a,r;const{clone:s=!1,passive:d=!1,eventName:c,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),h=o||(m==null?void 0:m.emit)||((l=m==null?void 0:m.$emit)==null?void 0:l.bind(m))||((r=(a=m==null?void 0:m.proxy)==null?void 0:a.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let g=c;t||(t="modelValue"),g=g||`update:${t.toString()}`;const w=y=>s?typeof s=="function"?s(y):Sm(y):y,b=()=>gm(e[t])?w(e[t]):f,S=y=>{p?p(y)&&h(g,y):h(g,y)};if(d){const y=b(),x=n.ref(y);let J=!1;return n.watch(()=>e[t],G=>{J||(J=!0,x.value=w(G),n.nextTick(()=>J=!1))}),n.watch(x,G=>{!J&&(G!==e[t]||u)&&S(G)},{deep:u}),x}else return n.computed({get(){return b()},set(y){S(y)}})}var Im={value:()=>{}};function Ho(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Fo(o)}function Fo(e){this._=e}function Cm(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Fo.prototype=Ho.prototype={constructor:Fo,on:function(e,t){var o=this._,i=Cm(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=Rm(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=fs(o[l],e.name,t);else if(t==null)for(l in o)o[l]=fs(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Fo(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function Rm(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function fs(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=Im,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Nl="http://www.w3.org/1999/xhtml";const ms={svg:"http://www.w3.org/2000/svg",xhtml:Nl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Go(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ms.hasOwnProperty(t)?{space:ms[t],local:e}:e}function Vm(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Nl&&t.documentElement.namespaceURI===Nl?t.createElement(e):t.createElementNS(o,e)}}function Am(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ps(e){var t=Go(e);return(t.local?Am:Vm)(t)}function Tm(){}function $l(e){return e==null?Tm:function(){return this.querySelector(e)}}function Bm(e){typeof e!="function"&&(e=$l(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),d,c,u=0;u<r;++u)(d=a[u])&&(c=e.call(d,d.__data__,u,a))&&("__data__"in d&&(c.__data__=d.__data__),s[u]=c);return new tt(i,this._parents)}function Mm(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Dm(){return[]}function hs(e){return e==null?Dm:function(){return this.querySelectorAll(e)}}function Om(e){return function(){return Mm(e.apply(this,arguments))}}function Lm(e){typeof e=="function"?e=Om(e):e=hs(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,d,c=0;c<s;++c)(d=r[c])&&(i.push(e.call(d,d.__data__,c,r)),l.push(d));return new tt(i,l)}function ys(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var Pm=Array.prototype.find;function zm(e){return function(){return Pm.call(this.children,e)}}function Um(){return this.firstElementChild}function Hm(e){return this.select(e==null?Um:zm(typeof e=="function"?e:gs(e)))}var Fm=Array.prototype.filter;function Gm(){return Array.from(this.children)}function Ym(e){return function(){return Fm.call(this.children,e)}}function Wm(e){return this.selectAll(e==null?Gm:Ym(typeof e=="function"?e:gs(e)))}function qm(e){typeof e!="function"&&(e=ys(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],d,c=0;c<r;++c)(d=a[c])&&e.call(d,d.__data__,c,a)&&s.push(d);return new tt(i,this._parents)}function bs(e){return new Array(e.length)}function Km(){return new tt(this._enter||this._groups.map(bs),this._parents)}function Yo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yo.prototype={constructor:Yo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Xm(e){return function(){return e}}function jm(e,t,o,i,l,a){for(var r=0,s,d=t.length,c=a.length;r<c;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new Yo(e,a[r]);for(;r<d;++r)(s=t[r])&&(l[r]=s)}function Zm(e,t,o,i,l,a,r){var s,d,c=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(d=t[s])&&(p[s]=m=r.call(d,d.__data__,s,t)+"",c.has(m)?l[s]=d:c.set(m,d));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(d=c.get(m))?(i[s]=d,d.__data__=a[s],c.delete(m)):o[s]=new Yo(e,a[s]);for(s=0;s<u;++s)(d=t[s])&&c.get(p[s])===d&&(l[s]=d)}function Jm(e){return e.__data__}function Qm(e,t){if(!arguments.length)return Array.from(this,Jm);var o=t?Zm:jm,i=this._parents,l=this._groups;typeof e!="function"&&(e=Xm(e));for(var a=l.length,r=new Array(a),s=new Array(a),d=new Array(a),c=0;c<a;++c){var u=i[c],f=l[c],p=f.length,m=ep(e.call(u,u&&u.__data__,c,i)),h=m.length,g=s[c]=new Array(h),w=r[c]=new Array(h),b=d[c]=new Array(p);o(u,f,g,w,b,m,t);for(var S=0,y=0,x,J;S<h;++S)if(x=g[S]){for(S>=y&&(y=S+1);!(J=w[y])&&++y<h;);x._next=J||null}}return r=new tt(r,i),r._enter=s,r._exit=d,r}function ep(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tp(){return new tt(this._exit||this._groups.map(bs),this._parents)}function np(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function op(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),d=0;d<r;++d)for(var c=o[d],u=i[d],f=c.length,p=s[d]=new Array(f),m,h=0;h<f;++h)(m=c[h]||u[h])&&(p[h]=m);for(;d<l;++d)s[d]=o[d];return new tt(s,this._parents)}function ip(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function lp(e){e||(e=ap);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,d=l[a]=new Array(s),c,u=0;u<s;++u)(c=r[u])&&(d[u]=c);d.sort(t)}return new tt(l,this._parents).order()}function ap(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sp(){return Array.from(this)}function cp(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function dp(){let e=0;for(const t of this)++e;return e}function up(){return!this.node()}function fp(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function mp(e){return function(){this.removeAttribute(e)}}function pp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hp(e,t){return function(){this.setAttribute(e,t)}}function yp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function bp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function _p(e,t){var o=Go(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?pp:mp:typeof t=="function"?o.local?bp:gp:o.local?yp:hp)(o,t))}function _s(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function wp(e){return function(){this.style.removeProperty(e)}}function vp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Ep(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function kp(e,t,o){return arguments.length>1?this.each((t==null?wp:typeof t=="function"?Ep:vp)(e,t,o??"")):_n(this.node(),e)}function _n(e,t){return e.style.getPropertyValue(t)||_s(e).getComputedStyle(e,null).getPropertyValue(t)}function Np(e){return function(){delete this[e]}}function $p(e,t){return function(){this[e]=t}}function xp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Sp(e,t){return arguments.length>1?this.each((t==null?Np:typeof t=="function"?xp:$p)(e,t)):this.node()[e]}function ws(e){return e.trim().split(/^|\s+/)}function xl(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=ws(e.getAttribute("class")||"")}vs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Es(e,t){for(var o=xl(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function ks(e,t){for(var o=xl(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function Ip(e){return function(){Es(this,e)}}function Cp(e){return function(){ks(this,e)}}function Rp(e,t){return function(){(t.apply(this,arguments)?Es:ks)(this,e)}}function Vp(e,t){var o=ws(e+"");if(arguments.length<2){for(var i=xl(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?Rp:t?Ip:Cp)(o,t))}function Ap(){this.textContent=""}function Tp(e){return function(){this.textContent=e}}function Bp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Mp(e){return arguments.length?this.each(e==null?Ap:(typeof e=="function"?Bp:Tp)(e)):this.node().textContent}function Dp(){this.innerHTML=""}function Op(e){return function(){this.innerHTML=e}}function Lp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pp(e){return arguments.length?this.each(e==null?Dp:(typeof e=="function"?Lp:Op)(e)):this.node().innerHTML}function zp(){this.nextSibling&&this.parentNode.appendChild(this)}function Up(){return this.each(zp)}function Hp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fp(){return this.each(Hp)}function Gp(e){var t=typeof e=="function"?e:ps(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Yp(){return null}function Wp(e,t){var o=typeof e=="function"?e:ps(e),i=t==null?Yp:typeof t=="function"?t:$l(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function qp(){var e=this.parentNode;e&&e.removeChild(this)}function Kp(){return this.each(qp)}function Xp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Zp(e){return this.select(e?jp:Xp)}function Jp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qp(e){return function(t){e.call(this,t,this.__data__)}}function eh(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function th(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function nh(e,t,o){return function(){var i=this.__on,l,a=Qp(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function oh(e,t,o){var i=eh(e+""),l,a=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var d=0,c=s.length,u;d<c;++d)for(l=0,u=s[d];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?nh:th,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function Ns(e,t,o){var i=_s(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function ih(e,t){return function(){return Ns(this,e,t)}}function lh(e,t){return function(){return Ns(this,e,t.apply(this,arguments))}}function ah(e,t){return this.each((typeof t=="function"?lh:ih)(e,t))}function*rh(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var $s=[null];function tt(e,t){this._groups=e,this._parents=t}function Yn(){return new tt([[document.documentElement]],$s)}function sh(){return this}tt.prototype=Yn.prototype={constructor:tt,select:Bm,selectAll:Lm,selectChild:Hm,selectChildren:Wm,filter:qm,data:Qm,enter:Km,exit:tp,join:np,merge:op,selection:sh,order:ip,sort:lp,call:rp,nodes:sp,node:cp,size:dp,empty:up,each:fp,attr:_p,style:kp,property:Sp,classed:Vp,text:Mp,html:Pp,raise:Up,lower:Fp,append:Gp,insert:Wp,remove:Kp,clone:Zp,datum:Jp,on:oh,dispatch:ah,[Symbol.iterator]:rh};function lt(e){return typeof e=="string"?new tt([[document.querySelector(e)]],[document.documentElement]):new tt([[e]],$s)}function ch(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=ch(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const dh={passive:!1},Wn={capture:!0,passive:!1};function Sl(e){e.stopImmediatePropagation()}function wn(e){e.preventDefault(),e.stopImmediatePropagation()}function xs(e){var t=e.document.documentElement,o=lt(e).on("dragstart.drag",wn,Wn);"onselectstart"in t?o.on("selectstart.drag",wn,Wn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ss(e,t){var o=e.document.documentElement,i=lt(e).on("dragstart.drag",null);t&&(i.on("click.drag",wn,Wn),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 Wo=e=>()=>e;function Il(e,{sourceEvent:t,subject:o,target:i,identifier:l,active:a,x:r,y:s,dx:d,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Il.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uh(e){return!e.ctrlKey&&!e.button}function fh(){return this.parentNode}function mh(e,t){return t??{x:e.x,y:e.y}}function ph(){return navigator.maxTouchPoints||"ontouchstart"in this}function hh(){var e=uh,t=fh,o=mh,i=ph,l={},a=Ho("start","drag","end"),r=0,s,d,c,u,f=0;function p(x){x.on("mousedown.drag",m).filter(i).on("touchstart.drag",w).on("touchmove.drag",b,dh).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,J){if(!(u||!e.call(this,x,J))){var G=y(this,t.call(this,x,J),x,J,"mouse");G&&(lt(x.view).on("mousemove.drag",h,Wn).on("mouseup.drag",g,Wn),xs(x.view),Sl(x),c=!1,s=x.clientX,d=x.clientY,G("start",x))}}function h(x){if(wn(x),!c){var J=x.clientX-s,G=x.clientY-d;c=J*J+G*G>f}l.mouse("drag",x)}function g(x){lt(x.view).on("mousemove.drag mouseup.drag",null),Ss(x.view,c),wn(x),l.mouse("end",x)}function w(x,J){if(e.call(this,x,J)){var G=x.changedTouches,j=t.call(this,x,J),U=G.length,Q,te;for(Q=0;Q<U;++Q)(te=y(this,j,x,J,G[Q].identifier,G[Q]))&&(Sl(x),te("start",x,G[Q]))}}function b(x){var J=x.changedTouches,G=J.length,j,U;for(j=0;j<G;++j)(U=l[J[j].identifier])&&(wn(x),U("drag",x,J[j]))}function S(x){var J=x.changedTouches,G=J.length,j,U;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),j=0;j<G;++j)(U=l[J[j].identifier])&&(Sl(x),U("end",x,J[j]))}function y(x,J,G,j,U,Q){var te=a.copy(),de=ft(Q||G,J),P,le,_;if((_=o.call(x,new Il("beforestart",{sourceEvent:G,target:p,identifier:U,active:r,x:de[0],y:de[1],dx:0,dy:0,dispatch:te}),j))!=null)return P=_.x-de[0]||0,le=_.y-de[1]||0,function R(k,z,W){var K=de,T;switch(k){case"start":l[U]=R,T=r++;break;case"end":delete l[U],--r;case"drag":de=ft(W||z,J),T=r;break}te.call(k,x,new Il(k,{sourceEvent:z,subject:_,target:p,identifier:U,active:T,x:de[0]+P,y:de[1]+le,dx:de[0]-K[0],dy:de[1]-K[1],dispatch:te}),j)}}return p.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Wo(!!x),p):e},p.container=function(x){return arguments.length?(t=typeof x=="function"?x:Wo(x),p):t},p.subject=function(x){return arguments.length?(o=typeof x=="function"?x:Wo(x),p):o},p.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:Wo(!!x),p):i},p.on=function(){var x=a.on.apply(a,arguments);return x===a?p:x},p.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,p):Math.sqrt(f)},p}function Cl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Is(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function qn(){}var Kn=.7,qo=1/Kn,vn="\\s*([+-]?\\d+)\\s*",Xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yh=/^#([0-9a-f]{3,8})$/,gh=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),bh=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),_h=new RegExp(`^rgba\\(${vn},${vn},${vn},${Xn}\\)$`),wh=new RegExp(`^rgba\\(${mt},${mt},${mt},${Xn}\\)$`),vh=new RegExp(`^hsl\\(${Xn},${mt},${mt}\\)$`),Eh=new RegExp(`^hsla\\(${Xn},${mt},${mt},${Xn}\\)$`),Cs={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};Cl(qn,Kt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rs,formatHex:Rs,formatHex8:kh,formatHsl:Nh,formatRgb:Vs,toString:Vs});function Rs(){return this.rgb().formatHex()}function kh(){return this.rgb().formatHex8()}function Nh(){return Ds(this).formatHsl()}function Vs(){return this.rgb().formatRgb()}function Kt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=yh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?As(t):o===3?new Je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Ko(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Ko(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=gh.exec(e))?new Je(t[1],t[2],t[3],1):(t=bh.exec(e))?new Je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=_h.exec(e))?Ko(t[1],t[2],t[3],t[4]):(t=wh.exec(e))?Ko(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=vh.exec(e))?Ms(t[1],t[2]/100,t[3]/100,1):(t=Eh.exec(e))?Ms(t[1],t[2]/100,t[3]/100,t[4]):Cs.hasOwnProperty(e)?As(Cs[e]):e==="transparent"?new Je(NaN,NaN,NaN,0):null}function As(e){return new Je(e>>16&255,e>>8&255,e&255,1)}function Ko(e,t,o,i){return i<=0&&(e=t=o=NaN),new Je(e,t,o,i)}function $h(e){return e instanceof qn||(e=Kt(e)),e?(e=e.rgb(),new Je(e.r,e.g,e.b,e.opacity)):new Je}function Rl(e,t,o,i){return arguments.length===1?$h(e):new Je(e,t,o,i??1)}function Je(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Cl(Je,Rl,Is(qn,{brighter(e){return e=e==null?qo:Math.pow(qo,e),new Je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Kn:Math.pow(Kn,e),new Je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Je(Xt(this.r),Xt(this.g),Xt(this.b),Xo(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:Ts,formatHex:Ts,formatHex8:xh,formatRgb:Bs,toString:Bs}));function Ts(){return`#${jt(this.r)}${jt(this.g)}${jt(this.b)}`}function xh(){return`#${jt(this.r)}${jt(this.g)}${jt(this.b)}${jt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bs(){const e=Xo(this.opacity);return`${e===1?"rgb(":"rgba("}${Xt(this.r)}, ${Xt(this.g)}, ${Xt(this.b)}${e===1?")":`, ${e})`}`}function Xo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jt(e){return e=Xt(e),(e<16?"0":"")+e.toString(16)}function Ms(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new at(e,t,o,i)}function Ds(e){if(e instanceof at)return new at(e.h,e.s,e.l,e.opacity);if(e instanceof qn||(e=Kt(e)),!e)return new at;if(e instanceof at)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,d=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=d<.5?a+l:2-a-l,r*=60):s=d>0&&d<1?0:r,new at(r,s,d,e.opacity)}function Sh(e,t,o,i){return arguments.length===1?Ds(e):new at(e,t,o,i??1)}function at(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Cl(at,Sh,Is(qn,{brighter(e){return e=e==null?qo:Math.pow(qo,e),new at(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Kn:Math.pow(Kn,e),new at(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new Je(Vl(e>=240?e-240:e+120,l,i),Vl(e,l,i),Vl(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new at(Os(this.h),jo(this.s),jo(this.l),Xo(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=Xo(this.opacity);return`${e===1?"hsl(":"hsla("}${Os(this.h)}, ${jo(this.s)*100}%, ${jo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Os(e){return e=(e||0)%360,e<0?e+360:e}function jo(e){return Math.max(0,Math.min(1,e||0))}function Vl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Al=e=>()=>e;function Ih(e,t){return function(o){return e+o*t}}function Ch(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function Rh(e){return(e=+e)==1?Ls:function(t,o){return o-t?Ch(t,o,e):Al(isNaN(t)?o:t)}}function Ls(e,t){var o=t-e;return o?Ih(e,o):Al(isNaN(e)?t:e)}const Zo=(function e(t){var o=Rh(t);function i(l,a){var r=o((l=Rl(l)).r,(a=Rl(a)).r),s=o(l.g,a.g),d=o(l.b,a.b),c=Ls(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=d(u),l.opacity=c(u),l+""}}return i.gamma=e,i})(1);function Vh(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),l;return function(a){for(l=0;l<o;++l)i[l]=e[l]*(1-a)+t[l]*a;return i}}function Ah(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Th(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,l=new Array(i),a=new Array(o),r;for(r=0;r<i;++r)l[r]=jn(e[r],t[r]);for(;r<o;++r)a[r]=t[r];return function(s){for(r=0;r<i;++r)a[r]=l[r](s);return a}}function Bh(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function pt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Mh(e,t){var o={},i={},l;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(l in t)l in e?o[l]=jn(e[l],t[l]):i[l]=t[l];return function(a){for(l in o)i[l]=o[l](a);return i}}var Tl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bl=new RegExp(Tl.source,"g");function Dh(e){return function(){return e}}function Oh(e){return function(t){return e(t)+""}}function Ps(e,t){var o=Tl.lastIndex=Bl.lastIndex=0,i,l,a,r=-1,s=[],d=[];for(e=e+"",t=t+"";(i=Tl.exec(e))&&(l=Bl.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,d.push({i:r,x:pt(i,l)})),o=Bl.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?d[0]?Oh(d[0].x):Dh(t):(t=d.length,function(c){for(var u=0,f;u<t;++u)s[(f=d[u]).i]=f.x(c);return s.join("")})}function jn(e,t){var o=typeof t,i;return t==null||o==="boolean"?Al(t):(o==="number"?pt:o==="string"?(i=Kt(t))?(t=i,Zo):Ps:t instanceof Kt?Zo:t instanceof Date?Bh:Ah(t)?Vh:Array.isArray(t)?Th:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Mh:pt)(e,t)}var zs=180/Math.PI,Ml={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Us(e,t,o,i,l,a){var r,s,d;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(d=e*o+t*i)&&(o-=e*d,i-=t*d),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,d/=s),e*i<t*o&&(e=-e,t=-t,d=-d,r=-r),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*zs,skewX:Math.atan(d)*zs,scaleX:r,scaleY:s}}var Jo;function Lh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ml:Us(t.a,t.b,t.c,t.d,t.e,t.f)}function Ph(e){return e==null||(Jo||(Jo=document.createElementNS("http://www.w3.org/2000/svg","g")),Jo.setAttribute("transform",e),!(e=Jo.transform.baseVal.consolidate()))?Ml:(e=e.matrix,Us(e.a,e.b,e.c,e.d,e.e,e.f))}function Hs(e,t,o,i){function l(c){return c.length?c.pop()+" ":""}function a(c,u,f,p,m,h){if(c!==f||u!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:pt(c,f)},{i:g-2,x:pt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(c,u,f,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:pt(c,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(c,u,f,p){c!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:pt(c,u)}):u&&f.push(l(f)+"skewX("+u+i)}function d(c,u,f,p,m,h){if(c!==f||u!==p){var g=m.push(l(m)+"scale(",null,",",null,")");h.push({i:g-4,x:pt(c,f)},{i:g-2,x:pt(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(c,u){var f=[],p=[];return c=e(c),u=e(u),a(c.translateX,c.translateY,u.translateX,u.translateY,f,p),r(c.rotate,u.rotate,f,p),s(c.skewX,u.skewX,f,p),d(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,p),c=u=null,function(m){for(var h=-1,g=p.length,w;++h<g;)f[(w=p[h]).i]=w.x(m);return f.join("")}}}var zh=Hs(Lh,"px, ","px)","deg)"),Uh=Hs(Ph,", ",")",")"),Hh=1e-12;function Fs(e){return((e=Math.exp(e))+1/e)/2}function Fh(e){return((e=Math.exp(e))-1/e)/2}function Gh(e){return((e=Math.exp(2*e))-1)/(e+1)}const Qo=(function e(t,o,i){function l(a,r){var s=a[0],d=a[1],c=a[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-d,g=m*m+h*h,w,b;if(g<Hh)b=Math.log(p/c)/t,w=function(j){return[s+j*m,d+j*h,c*Math.exp(t*j*b)]};else{var S=Math.sqrt(g),y=(p*p-c*c+i*g)/(2*c*o*S),x=(p*p-c*c-i*g)/(2*p*o*S),J=Math.log(Math.sqrt(y*y+1)-y),G=Math.log(Math.sqrt(x*x+1)-x);b=(G-J)/t,w=function(j){var U=j*b,Q=Fs(J),te=c/(o*S)*(Q*Gh(t*U+J)-Fh(J));return[s+te*m,d+te*h,c*Q/Fs(t*U+J)]}}return w.duration=b*1e3*t/Math.SQRT2,w}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,d=s*s;return e(r,s,d)},l})(Math.SQRT2,2,4);var En=0,Zn=0,Jn=0,Gs=1e3,ei,Qn,ti=0,Zt=0,ni=0,eo=typeof performance=="object"&&performance.now?performance:Date,Ys=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Dl(){return Zt||(Ys(Yh),Zt=eo.now()+ni)}function Yh(){Zt=0}function oi(){this._call=this._time=this._next=null}oi.prototype=Ws.prototype={constructor:oi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Dl():+o)+(t==null?0:+t),!this._next&&Qn!==this&&(Qn?Qn._next=this:ei=this,Qn=this),this._call=e,this._time=o,Ol()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ol())}};function Ws(e,t,o){var i=new oi;return i.restart(e,t,o),i}function Wh(){Dl(),++En;for(var e=ei,t;e;)(t=Zt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--En}function qs(){Zt=(ti=eo.now())+ni,En=Zn=0;try{Wh()}finally{En=0,Kh(),Zt=0}}function qh(){var e=eo.now(),t=e-ti;t>Gs&&(ni-=t,ti=e)}function Kh(){for(var e,t=ei,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:ei=o);Qn=e,Ol(i)}function Ol(e){if(!En){Zn&&(Zn=clearTimeout(Zn));var t=e-Zt;t>24?(e<1/0&&(Zn=setTimeout(qs,e-eo.now()-ni)),Jn&&(Jn=clearInterval(Jn))):(Jn||(ti=eo.now(),Jn=setInterval(qh,Gs)),En=1,Ys(qs))}}function Ks(e,t,o){var i=new oi;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var Xh=Ho("start","end","cancel","interrupt"),jh=[],Xs=0,js=1,Ll=2,ii=3,Zs=4,Pl=5,li=6;function ai(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Zh(e,o,{name:t,index:i,group:l,on:Xh,tween:jh,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Xs})}function zl(e,t){var o=rt(e,t);if(o.state>Xs)throw new Error("too late; already scheduled");return o}function ht(e,t){var o=rt(e,t);if(o.state>ii)throw new Error("too late; already running");return o}function rt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Zh(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=Ws(a,0,o.time);function a(c){o.state=js,o.timer.restart(r,o.delay,o.time),o.delay<=c&&r(c-o.delay)}function r(c){var u,f,p,m;if(o.state!==js)return d();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ii)return Ks(r);m.state===Zs?(m.state=li,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=li,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Ks(function(){o.state===ii&&(o.state=Zs,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=Ll,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ll){for(o.state=ii,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(c){for(var u=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(d),o.state=Pl,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===Pl&&(o.on.call("end",e,e.__data__,o.index,o.group),d())}function d(){o.state=li,o.timer.stop(),delete i[t];for(var c in i)return;delete e.__transition}}function ri(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>Ll&&i.state<Pl,i.state=li,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function Jh(e){return this.each(function(){ri(this,e)})}function Qh(e,t){var o,i;return function(){var l=ht(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function ey(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=ht(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},d=0,c=l.length;d<c;++d)if(l[d].name===t){l[d]=s;break}d===c&&l.push(s)}a.tween=l}}function ty(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=rt(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?Qh:ey)(o,e,t))}function Ul(e,t,o){var i=e._id;return e.each(function(){var l=ht(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return rt(l,i).value[t]}}function Js(e,t){var o;return(typeof t=="number"?pt:t instanceof Kt?Zo:(o=Kt(t))?(t=o,Zo):Ps)(e,t)}function ny(e){return function(){this.removeAttribute(e)}}function oy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iy(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function ly(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function ay(e,t,o){var i,l,a;return function(){var r,s=o(this),d;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),d=s+"",r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s)))}}function ry(e,t,o){var i,l,a;return function(){var r,s=o(this),d;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),d=s+"",r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s)))}}function sy(e,t){var o=Go(e),i=o==="transform"?Uh:Js;return this.attrTween(e,typeof t=="function"?(o.local?ry:ay)(o,i,Ul(this,"attr."+e,t)):t==null?(o.local?oy:ny)(o):(o.local?ly:iy)(o,i,t))}function cy(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function dy(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function uy(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&dy(e,a)),o}return l._value=t,l}function fy(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&cy(e,a)),o}return l._value=t,l}function my(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Go(e);return this.tween(o,(i.local?uy:fy)(i,t))}function py(e,t){return function(){zl(this,e).delay=+t.apply(this,arguments)}}function hy(e,t){return t=+t,function(){zl(this,e).delay=t}}function yy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?py:hy)(t,e)):rt(this.node(),t).delay}function gy(e,t){return function(){ht(this,e).duration=+t.apply(this,arguments)}}function by(e,t){return t=+t,function(){ht(this,e).duration=t}}function _y(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gy:by)(t,e)):rt(this.node(),t).duration}function wy(e,t){if(typeof t!="function")throw new Error;return function(){ht(this,e).ease=t}}function vy(e){var t=this._id;return arguments.length?this.each(wy(t,e)):rt(this.node(),t).ease}function Ey(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ht(this,e).ease=o}}function ky(e){if(typeof e!="function")throw new Error;return this.each(Ey(this._id,e))}function Ny(e){typeof e!="function"&&(e=ys(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],d,c=0;c<r;++c)(d=a[c])&&e.call(d,d.__data__,c,a)&&s.push(d);return new kt(i,this._parents,this._name,this._id)}function $y(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var d=t[s],c=o[s],u=d.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=d[m]||c[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new kt(r,this._parents,this._name,this._id)}function xy(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function Sy(e,t,o){var i,l,a=xy(t)?zl:ht;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function Iy(e,t){var o=this._id;return arguments.length<2?rt(this.node(),o).on.on(e):this.each(Sy(o,e,t))}function Cy(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ry(){return this.on("end.remove",Cy(this._id))}function Vy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=$l(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],d=s.length,c=a[r]=new Array(d),u,f,p=0;p<d;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),c[p]=f,ai(c[p],t,o,p,c,rt(u,o)));return new kt(a,this._parents,t,o)}function Ay(e){var t=this._name,o=this._id;typeof e!="function"&&(e=hs(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var d=i[s],c=d.length,u,f=0;f<c;++f)if(u=d[f]){for(var p=e.call(u,u.__data__,f,d),m,h=rt(u,o),g=0,w=p.length;g<w;++g)(m=p[g])&&ai(m,t,o,g,p,h);a.push(p),r.push(u)}return new kt(a,r,t,o)}var Ty=Yn.prototype.constructor;function By(){return new Ty(this._groups,this._parents)}function My(e,t){var o,i,l;return function(){var a=_n(this,e),r=(this.style.removeProperty(e),_n(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function Qs(e){return function(){this.style.removeProperty(e)}}function Dy(e,t,o){var i,l=o+"",a;return function(){var r=_n(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function Oy(e,t,o){var i,l,a;return function(){var r=_n(this,e),s=o(this),d=s+"";return s==null&&(d=s=(this.style.removeProperty(e),_n(this,e))),r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s))}}function Ly(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var d=ht(this,e),c=d.on,u=d.value[a]==null?s||(s=Qs(t)):void 0;(c!==o||l!==u)&&(i=(o=c).copy()).on(r,l=u),d.on=i}}function Py(e,t,o){var i=(e+="")=="transform"?zh:Js;return t==null?this.styleTween(e,My(e,i)).on("end.style."+e,Qs(e)):typeof t=="function"?this.styleTween(e,Oy(e,i,Ul(this,"style."+e,t))).each(Ly(this._id,e)):this.styleTween(e,Dy(e,i,t),o).on("end.style."+e,null)}function zy(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Uy(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&zy(e,r,o)),i}return a._value=t,a}function Hy(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Uy(e,t,o??""))}function Fy(e){return function(){this.textContent=e}}function Gy(e){return function(){var t=e(this);this.textContent=t??""}}function Yy(e){return this.tween("text",typeof e=="function"?Gy(Ul(this,"text",e)):Fy(e==null?"":e+""))}function Wy(e){return function(t){this.textContent=e.call(this,t)}}function qy(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&Wy(l)),t}return i._value=e,i}function Ky(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,qy(e))}function Xy(){for(var e=this._name,t=this._id,o=ec(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,d,c=0;c<s;++c)if(d=r[c]){var u=rt(d,t);ai(d,e,o,c,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new kt(i,this._parents,e,o)}function jy(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},d={value:function(){--l===0&&a()}};o.each(function(){var c=ht(this,i),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(d)),c.on=t}),l===0&&a()})}var Zy=0;function kt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ec(){return++Zy}var Nt=Yn.prototype;kt.prototype={constructor:kt,select:Vy,selectAll:Ay,selectChild:Nt.selectChild,selectChildren:Nt.selectChildren,filter:Ny,merge:$y,selection:By,transition:Xy,call:Nt.call,nodes:Nt.nodes,node:Nt.node,size:Nt.size,empty:Nt.empty,each:Nt.each,on:Iy,attr:sy,attrTween:my,style:Py,styleTween:Hy,text:Yy,textTween:Ky,remove:Ry,tween:ty,delay:yy,duration:_y,ease:vy,easeVarying:ky,end:jy,[Symbol.iterator]:Nt[Symbol.iterator]};function Jy(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Qy={time:null,delay:0,duration:250,ease:Jy};function eg(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function tg(e){var t,o;e instanceof kt?(t=e._id,e=e._name):(t=ec(),(o=Qy).time=Dl(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,d,c=0;c<s;++c)(d=r[c])&&ai(d,e,t,c,r,o||eg(d,t));return new kt(i,this._parents,e,t)}Yn.prototype.interrupt=Jh,Yn.prototype.transition=tg;const si=e=>()=>e;function ng(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function $t(e,t,o){this.k=e,this.x=t,this.y=o}$t.prototype={constructor:$t,scale:function(e){return e===1?this:new $t(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $t(this.k,this.x+this.k*e,this.y+this.k*t)},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 kn=new $t(1,0,0);$t.prototype;function Hl(e){e.stopImmediatePropagation()}function to(e){e.preventDefault(),e.stopImmediatePropagation()}function og(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ig(){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 tc(){return this.__zoom||kn}function lg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ag(){return navigator.maxTouchPoints||"ontouchstart"in this}function rg(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function sg(){var e=og,t=ig,o=rg,i=lg,l=ag,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,d=Qo,c=Ho("start","zoom","end"),u,f,p,m=500,h=150,g=0,w=10;function b(_){_.property("__zoom",tc).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",Q).on("dblclick.zoom",te).filter(l).on("touchstart.zoom",de).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",le).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(_,R,k,z){var W=_.selection?_.selection():_;W.property("__zoom",tc),_!==W?J(_,R,k,z):W.interrupt().each(function(){G(this,arguments).event(z).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(_,R,k,z){b.scaleTo(_,function(){var W=this.__zoom.k,K=typeof R=="function"?R.apply(this,arguments):R;return W*K},k,z)},b.scaleTo=function(_,R,k,z){b.transform(_,function(){var W=t.apply(this,arguments),K=this.__zoom,T=k==null?x(W):typeof k=="function"?k.apply(this,arguments):k,oe=K.invert(T),ce=typeof R=="function"?R.apply(this,arguments):R;return o(y(S(K,ce),T,oe),W,r)},k,z)},b.translateBy=function(_,R,k,z){b.transform(_,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),r)},null,z)},b.translateTo=function(_,R,k,z,W){b.transform(_,function(){var K=t.apply(this,arguments),T=this.__zoom,oe=z==null?x(K):typeof z=="function"?z.apply(this,arguments):z;return o(kn.translate(oe[0],oe[1]).scale(T.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof k=="function"?-k.apply(this,arguments):-k),K,r)},z,W)};function S(_,R){return R=Math.max(a[0],Math.min(a[1],R)),R===_.k?_:new $t(R,_.x,_.y)}function y(_,R,k){var z=R[0]-k[0]*_.k,W=R[1]-k[1]*_.k;return z===_.x&&W===_.y?_:new $t(_.k,z,W)}function x(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function J(_,R,k,z){_.on("start.zoom",function(){G(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event(z).end()}).tween("zoom",function(){var W=this,K=arguments,T=G(W,K).event(z),oe=t.apply(W,K),ce=k==null?x(oe):typeof k=="function"?k.apply(W,K):k,me=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),ge=W.__zoom,se=typeof R=="function"?R.apply(W,K):R,fe=d(ge.invert(ce).concat(me/ge.k),se.invert(ce).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var Ne=fe(ye),ve=me/Ne[2];ye=new $t(ve,ce[0]-Ne[0]*ve,ce[1]-Ne[1]*ve)}T.zoom(null,ye)}})}function G(_,R,k){return!k&&_.__zooming||new j(_,R)}function j(_,R){this.that=_,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,R),this.taps=0}j.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,R){return this.mouse&&_!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var R=lt(this.that).datum();c.call(_,this.that,new ng(_,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),R)}};function U(_,...R){if(!e.apply(this,arguments))return;var k=G(this,R).event(_),z=this.__zoom,W=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,i.apply(this,arguments)))),K=ft(_);if(k.wheel)(k.mouse[0][0]!==K[0]||k.mouse[0][1]!==K[1])&&(k.mouse[1]=z.invert(k.mouse[0]=K)),clearTimeout(k.wheel);else{if(z.k===W)return;k.mouse=[K,z.invert(K)],ri(this),k.start()}to(_),k.wheel=setTimeout(T,h),k.zoom("mouse",o(y(S(z,W),k.mouse[0],k.mouse[1]),k.extent,r));function T(){k.wheel=null,k.end()}}function Q(_,...R){if(p||!e.apply(this,arguments))return;var k=_.currentTarget,z=G(this,R,!0).event(_),W=lt(_.view).on("mousemove.zoom",ce,!0).on("mouseup.zoom",me,!0),K=ft(_,k),T=_.clientX,oe=_.clientY;xs(_.view),Hl(_),z.mouse=[K,this.__zoom.invert(K)],ri(this),z.start();function ce(ge){if(to(ge),!z.moved){var se=ge.clientX-T,fe=ge.clientY-oe;z.moved=se*se+fe*fe>g}z.event(ge).zoom("mouse",o(y(z.that.__zoom,z.mouse[0]=ft(ge,k),z.mouse[1]),z.extent,r))}function me(ge){W.on("mousemove.zoom mouseup.zoom",null),Ss(ge.view,z.moved),to(ge),z.event(ge).end()}}function te(_,...R){if(e.apply(this,arguments)){var k=this.__zoom,z=ft(_.changedTouches?_.changedTouches[0]:_,this),W=k.invert(z),K=k.k*(_.shiftKey?.5:2),T=o(y(S(k,K),z,W),t.apply(this,R),r);to(_),s>0?lt(this).transition().duration(s).call(J,T,z,_):lt(this).call(b.transform,T,z,_)}}function de(_,...R){if(e.apply(this,arguments)){var k=_.touches,z=k.length,W=G(this,R,_.changedTouches.length===z).event(_),K,T,oe,ce;for(Hl(_),T=0;T<z;++T)oe=k[T],ce=ft(oe,this),ce=[ce,this.__zoom.invert(ce),oe.identifier],W.touch0?!W.touch1&&W.touch0[2]!==ce[2]&&(W.touch1=ce,W.taps=0):(W.touch0=ce,K=!0,W.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(W.taps<2&&(f=ce[0],u=setTimeout(function(){u=null},m)),ri(this),W.start())}}function P(_,...R){if(this.__zooming){var k=G(this,R).event(_),z=_.changedTouches,W=z.length,K,T,oe,ce;for(to(_),K=0;K<W;++K)T=z[K],oe=ft(T,this),k.touch0&&k.touch0[2]===T.identifier?k.touch0[0]=oe:k.touch1&&k.touch1[2]===T.identifier&&(k.touch1[0]=oe);if(T=k.that.__zoom,k.touch1){var me=k.touch0[0],ge=k.touch0[1],se=k.touch1[0],fe=k.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,Ne=(Ne=fe[0]-ge[0])*Ne+(Ne=fe[1]-ge[1])*Ne;T=S(T,Math.sqrt(ye/Ne)),oe=[(me[0]+se[0])/2,(me[1]+se[1])/2],ce=[(ge[0]+fe[0])/2,(ge[1]+fe[1])/2]}else if(k.touch0)oe=k.touch0[0],ce=k.touch0[1];else return;k.zoom("touch",o(y(T,oe,ce),k.extent,r))}}function le(_,...R){if(this.__zooming){var k=G(this,R).event(_),z=_.changedTouches,W=z.length,K,T;for(Hl(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),K=0;K<W;++K)T=z[K],k.touch0&&k.touch0[2]===T.identifier?delete k.touch0:k.touch1&&k.touch1[2]===T.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(T=ft(T,this),Math.hypot(f[0]-T[0],f[1]-T[1])<w)){var oe=lt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:si(+_),b):i},b.filter=function(_){return arguments.length?(e=typeof _=="function"?_:si(!!_),b):e},b.touchable=function(_){return arguments.length?(l=typeof _=="function"?_:si(!!_),b):l},b.extent=function(_){return arguments.length?(t=typeof _=="function"?_:si([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),b):t},b.scaleExtent=function(_){return arguments.length?(a[0]=+_[0],a[1]=+_[1],b):[a[0],a[1]]},b.translateExtent=function(_){return arguments.length?(r[0][0]=+_[0][0],r[1][0]=+_[1][0],r[0][1]=+_[0][1],r[1][1]=+_[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(_){return arguments.length?(o=_,b):o},b.duration=function(_){return arguments.length?(s=+_,b):s},b.interpolate=function(_){return arguments.length?(d=_,b):d},b.on=function(){var _=c.on.apply(c,arguments);return _===c?b:_},b.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,b):Math.sqrt(g)},b.tapDistance=function(_){return arguments.length?(w=+_,b):w},b}var ke=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ke||{}),Fl=(e=>(e.Partial="partial",e.Full="full",e))(Fl||{}),Jt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Jt||{}),xt=(e=>(e.Strict="strict",e.Loose="loose",e))(xt||{}),Gl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Gl||{}),no=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(no||{}),nc=(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))(nc||{});const cg=["INPUT","SELECT","TEXTAREA"],dg=typeof document<"u"?document:null;function Yl(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,l=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,a=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return cg.includes(i==null?void 0:i.nodeName)||l||!!a}function ug(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function oc(e,t,o,i){const l=t.replace("+",`
|
|
3
3
|
`).replace(`
|
|
4
4
|
|
|
5
5
|
`,`
|
|
6
6
|
+`).split(`
|
|
7
|
-
`).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function ag(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=lg(o.code,e);return Array.isArray(e)?e.some(a=>tc(o[i],a,t,o.type==="keyup")):tc(o[i],e,t,o.type==="keyup")}}function lg(e,t){return t.includes(e)?"code":"key"}function no(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??og),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const l=new Set;let r=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),r=c(d)},{immediate:!0}),ss(["blur","contextmenu"],s),cs((...d)=>r(...d),d=>{var u,f;const p=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=ig(d),(!a||a&&!p)&&Fa(d))return;const g=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,N=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!m&&(a||!N)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),cs((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Fa(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,l.clear(),i.value=n.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"?ag(d,l):d}return i}const nc="vue-flow__node-desc",oc="vue-flow__edge-desc",rg="vue-flow__aria-live",ic=["Enter"," ","Escape"],kn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function ri(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function si(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function ci(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Jt(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function ac(e,t){return{x:Jt(e.x,t[0][0],t[1][0]),y:Jt(e.y,t[0][1],t[1][1])}}function lc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Mt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Qt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Mt(e)}function oo(e){return Qt(e)&&"computedPosition"in e}function di(e){return!Number.isNaN(e)&&Number.isFinite(e)}function sg(e){return di(e.width)&&di(e.height)&&di(e.x)&&di(e.y)}function cg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.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:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function rc(e,t,o){var i,a;const l={id:e.id.toString(),type:e.type??(t==null?void 0:t.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:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function sc(e,t,o,i){const a=typeof e=="string"?e:e.id,l=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===a&&l.add(s[i]);return t.filter(s=>l.has(s.id))}function dg(...e){if(e.length===3){const[l,r,s]=e;return sc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Mt(l)&&l.source===i).map(l=>o.find(r=>Qt(r)&&r.id===l.target))}function ug(...e){if(e.length===3){const[l,r,s]=e;return sc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Mt(l)&&l.target===i).map(l=>o.find(r=>Qt(r)&&r.id===l.source))}function cc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function fg(e,t){return t.some(o=>Mt(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 io({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function ao({x:e,y:t},{x:o,y:i,zoom:a},l=!1,r=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return l?fi(s,r):s}function dc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function ui({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function uc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function mg(e,t){return uc(dc(ui(e),ui(t)))}function Ga(e){let t={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];t=dc(t,ui({...i.computedPosition,...i.dimensions}))}return uc(t)}function fc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...ao(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const m=si(l,ri(s)),h=f===null||p===null,g=i&&m>0,N=(f??0)*(p??0);(h||g||m>=N||s.dragging)&&r.push(s)}return r}function en(e,t){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 t.filter(i=>o.has(i.source)||o.has(i.target))}function Nn(e,t){if(typeof e=="number")return Math.floor((t-t/(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(t*o*.01)}return so(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function pg(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Nn(e,o),a=Nn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Nn(e.top??e.y??0,o),a=Nn(e.bottom??e.y??0,o),l=Nn(e.left??e.x??0,t),r=Nn(e.right??e.x??0,t);return{top:i,right:r,bottom:a,left:l,x:l+r,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function hg(e,t,o,i,a,l){const{x:r,y:s}=io(e,{x:t,y:o,zoom:i}),{x:c,y:d}=io({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,f=l-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function mc(e,t,o,i,a,l=.1){const r=pg(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=Jt(d,i,a),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,h=o/2-p*u,g=hg(e,m,h,u,t,o),N={left:Math.min(g.left-r.left,0),top:Math.min(g.top-r.top,0),right:Math.min(g.right-r.right,0),bottom:Math.min(g.bottom-r.bottom,0)};return{x:m-N.left+N.right,y:h-N.top+N.bottom,zoom:u}}function yg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function pc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:pc(o,t):!1}function lo(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Ya(e){const t=e.ctrlKey&&ro()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function hc(e,t,o){return e<t?Jt(Math.abs(e-t),1,t)/t:e>o?-Jt(Math.abs(e-o),1,t)/t:0}function yc(e,t,o=15,i=40){const a=hc(e.x,i,t.width-i)*o,l=hc(e.y,i,t.height-i)*o;return[a,l]}function Wa(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+i}px`}else a.height+=i;if(e.position.x<0){const l=Math.abs(e.position.x);if(t.position.x=t.position.x-l,typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+l}px`}else a.width+=l;e.position.x=0}if(e.position.y<0){const l=Math.abs(e.position.y);if(t.position.y=t.position.y-l,typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+l}px`}else a.height+=l;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=l=>{const r=t.style;return{...r(l),...a}}:t.style={...t.style,...a}}}}function gc(e,t){var o,i;const a=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of a)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const l=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(oo(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&oo(c)&&Wa(r,c)}break;case"dimensions":if(oo(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.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"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const c=t[l.indexOf(r.parentNode)];c&&oo(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Wa(r,c):n.nextTick(()=>{Wa(r,c)}))}break}return t}function Bt(e,t){return{id:e,type:"select",selected:t}}function bc(e){return{item:e,type:"add"}}function _c(e){return{id:e,type:"remove"}}function vc(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Dt(e,t=new Set,o=!1){const i=[];for(const[a,l]of e){const r=t.has(a);!(l.selected===void 0&&!r)&&l.selected!==r&&(o&&(l.selected=r),i.push(Bt(l.id,r)))}return i}const wc=()=>{};function Ee(e){const t=new Set;let o=wc,i=()=>!1;const a=()=>t.size>0||i(),l=p=>{o=p},r=()=>{o=wc},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return Fn(m),{off:m}},off:d,trigger:p=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(h=>h(p)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Ec(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function gg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!pc(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&r.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-((l=c.computedPosition)==null?void 0:l.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(r.values())}function qa({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const l=o(a.id);l&&i.push(l)}return[e?i.find(a=>a.id===e):i[0],i]}function kc(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 bg(e,t,o){const[i,a,l,r]=typeof e!="string"?kc(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+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-l]]:!1}function _g(e,t,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 l=bg(a,e,i);l&&(a=l)}else t(new Ue(Pe.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const l=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+l,a[0][1]+r],[a[1][0]+l,a[1][1]+r]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[l,r,s,c]=kc(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+l],[a.range[1][0]+d-r,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function vg({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Ka(e,t,o,i,a){const l=vg(e.dimensions,_g(e,o,i,a)),r=ac(t,l);return{position:{x:r.x-((a==null?void 0:a.computedPosition.x)||0),y:r.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:r}}function xn(e,t,o=Ne.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,l=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Ng(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Ne.Top:return{x:a+r/2,y:l};case Ne.Right:return{x:a+r,y:l+s/2};case Ne.Bottom:return{x:a+r/2,y:l+s};case Ne.Left:return{x:a,y:l+s/2}}}function Nc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function wg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=ui({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=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(f*p)>0}function Eg(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const l=t(e.source),r=t(e.target);return!l||!r?0:(o&&(a=i?e.zIndex:Math.max(l.computedPosition.z||0,r.computedPosition.z||0)),a)}var Pe=(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))(Pe||{});const xc={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
|
|
7
|
+
`).map(r=>r.trim().toLowerCase());if(l.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const a=l.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===l[s]);return i&&o.delete(e.toLowerCase()),a}function fg(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=mg(o.code,e);return Array.isArray(e)?e.some(l=>oc(o[i],l,t,o.type==="keyup")):oc(o[i],e,t,o.type==="keyup")}}function mg(e,t){return t.includes(e)?"code":"key"}function oo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??dg),i=n.shallowRef(n.toValue(e)===!0);let l=!1;const a=new Set;let r=d(n.toValue(e));n.watch(()=>n.toValue(e),(c,u)=>{typeof u=="boolean"&&typeof c!="boolean"&&s(),r=d(c)},{immediate:!0}),ds(["blur","contextmenu"],s),us((...c)=>r(...c),c=>{var u,f;const p=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(l=ug(c),(!l||l&&!p)&&Yl(c))return;const g=((f=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:f[0])||c.target,w=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!m&&(l||!w)&&c.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),us((...c)=>r(...c),c=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!l||l&&!u)&&Yl(c))return;l=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){l=!1,a.clear(),i.value=n.toValue(e)===!0}function d(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?fg(c,a):c}return i}const ic="vue-flow__node-desc",lc="vue-flow__edge-desc",pg="vue-flow__aria-live",ac=["Enter"," ","Escape"],Nn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function ci(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function di(e,t){const o=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(o*i)}function ui(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Qt(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function rc(e,t){return{x:Qt(e.x,t[0][0],t[1][0]),y:Qt(e.y,t[0][1],t[1][1])}}function sc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Mt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function en(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Mt(e)}function io(e){return en(e)&&"computedPosition"in e}function fi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function hg(e){return fi(e.width)&&fi(e.height)&&fi(e.x)&&fi(e.y)}function yg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.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:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function cc(e,t,o){var i,l;const a={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(l=e.targetHandle)==null?void 0:l.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:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??a,e,{id:e.id.toString()})}function dc(e,t,o,i){const l=typeof e=="string"?e:e.id,a=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===l&&a.add(s[i]);return t.filter(s=>a.has(s.id))}function gg(...e){if(e.length===3){const[a,r,s]=e;return dc(a,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Mt(a)&&a.source===i).map(a=>o.find(r=>en(r)&&r.id===a.target))}function bg(...e){if(e.length===3){const[a,r,s]=e;return dc(a,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Mt(a)&&a.target===i).map(a=>o.find(r=>en(r)&&r.id===a.source))}function uc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function _g(e,t){return t.some(o=>Mt(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 lo({x:e,y:t},{x:o,y:i,zoom:l}){return{x:e*l+o,y:t*l+i}}function ao({x:e,y:t},{x:o,y:i,zoom:l},a=!1,r=[1,1]){const s={x:(e-o)/l,y:(t-i)/l};return a?pi(s,r):s}function fc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function mi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function mc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function wg(e,t){return mc(fc(mi(e),mi(t)))}function Wl(e){let t={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];t=fc(t,mi({...i.computedPosition,...i.dimensions}))}return mc(t)}function pc(e,t,o={x:0,y:0,zoom:1},i=!1,l=!1){const a={...ao(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:d,selectable:c=!0,hidden:u=!1}=s,f=d.width??s.width??null,p=d.height??s.height??null;if(l&&!c||u)continue;const m=di(a,ci(s)),h=f===null||p===null,g=i&&m>0,w=(f??0)*(p??0);(h||g||m>=w||s.dragging)&&r.push(s)}return r}function tn(e,t){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 t.filter(i=>o.has(i.source)||o.has(i.target))}function $n(e,t){if(typeof e=="number")return Math.floor((t-t/(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(t*o*.01)}return co(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vg(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=$n(e,o),l=$n(e,t);return{top:i,right:l,bottom:i,left:l,x:l*2,y:i*2}}if(typeof e=="object"){const i=$n(e.top??e.y??0,o),l=$n(e.bottom??e.y??0,o),a=$n(e.left??e.x??0,t),r=$n(e.right??e.x??0,t);return{top:i,right:r,bottom:l,left:a,x:a+r,y:i+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Eg(e,t,o,i,l,a){const{x:r,y:s}=lo(e,{x:t,y:o,zoom:i}),{x:d,y:c}=lo({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=l-d,f=a-c;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function hc(e,t,o,i,l,a=.1){const r=vg(a,t,o),s=(t-r.x)/e.width,d=(o-r.y)/e.height,c=Math.min(s,d),u=Qt(c,i,l),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,h=o/2-p*u,g=Eg(e,m,h,u,t,o),w={left:Math.min(g.left-r.left,0),top:Math.min(g.top-r.top,0),right:Math.min(g.right-r.right,0),bottom:Math.min(g.bottom-r.bottom,0)};return{x:m-w.left+w.right,y:h-w.top+w.bottom,zoom:u}}function kg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function yc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:yc(o,t):!1}function ro(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function ql(e){const t=e.ctrlKey&&so()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function gc(e,t,o){return e<t?Qt(Math.abs(e-t),1,t)/t:e>o?-Qt(Math.abs(e-o),1,t)/t:0}function bc(e,t,o=15,i=40){const l=gc(e.x,i,t.width-i)*o,a=gc(e.y,i,t.height-i)*o;return[l,a]}function Kl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let l={};if(typeof t.style=="function"?l={...t.style(t)}:t.style&&(l={...t.style}),l.width=l.width??`${t.dimensions.width}px`,l.height=l.height??`${t.dimensions.height}px`,o>0)if(typeof l.width=="string"){const a=Number(l.width.replace("px",""));l.width=`${a+o}px`}else l.width+=o;if(i>0)if(typeof l.height=="string"){const a=Number(l.height.replace("px",""));l.height=`${a+i}px`}else l.height+=i;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof l.width=="string"){const r=Number(l.width.replace("px",""));l.width=`${r+a}px`}else l.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof l.height=="string"){const r=Number(l.height.replace("px",""));l.height=`${r+a}px`}else l.height+=a;e.position.y=0}t.dimensions.width=Number(l.width.toString().replace("px","")),t.dimensions.height=Number(l.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const r=t.style;return{...r(a),...l}}:t.style={...t.style,...l}}}}function _c(e,t){var o,i;const l=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of l)if(r.type==="add")t.findIndex(d=>d.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(d=>d.id===r.id);s!==-1&&t.splice(s,1)}const a=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(io(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const d=t[a.indexOf(r.parentNode)];d&&io(d)&&Kl(r,d)}break;case"dimensions":if(io(r)&&(typeof s.dimensions<"u"&&(r.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(r.style={...r.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"&&(r.resizing=s.resizing),r.expandParent&&r.parentNode)){const d=t[a.indexOf(r.parentNode)];d&&io(d)&&(!!d.dimensions.width&&!!d.dimensions.height?Kl(r,d):n.nextTick(()=>{Kl(r,d)}))}break}return t}function Dt(e,t){return{id:e,type:"select",selected:t}}function wc(e){return{item:e,type:"add"}}function vc(e){return{id:e,type:"remove"}}function Ec(e,t,o,i,l){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:l||null,type:"remove"}}function Ot(e,t=new Set,o=!1){const i=[];for(const[l,a]of e){const r=t.has(l);!(a.selected===void 0&&!r)&&a.selected!==r&&(o&&(a.selected=r),i.push(Dt(a.id,r)))}return i}const kc=()=>{};function we(e){const t=new Set;let o=kc,i=()=>!1;const l=()=>t.size>0||i(),a=p=>{o=p},r=()=>{o=kc},s=p=>{i=p},d=()=>{i=()=>!1},c=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>c(p);return Gn(m),{off:m}},off:c,trigger:p=>{const m=[o];return l()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(h=>h(p)))},hasListeners:l,listeners:t,setEmitter:a,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:d}}function Nc(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function Ng(e,t,o,i){var l,a;const r=new Map;for(const[s,d]of e)(d.selected||d.id===i)&&(!d.parentNode||!yc(d,e))&&(d.draggable||t&&typeof d.draggable>"u")&&e.get(s)&&r.set(s,{id:d.id,position:d.position||{x:0,y:0},distance:{x:o.x-((l=d.computedPosition)==null?void 0:l.x)||0,y:o.y-((a=d.computedPosition)==null?void 0:a.y)||0},from:{x:d.computedPosition.x,y:d.computedPosition.y},extent:d.extent,parentNode:d.parentNode,dimensions:{...d.dimensions},expandParent:d.expandParent});return Array.from(r.values())}function Xl({id:e,dragItems:t,findNode:o}){const i=[];for(const l of t){const a=o(l.id);a&&i.push(a)}return[e?i.find(l=>l.id===e):i[0],i]}function $c(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 $g(e,t,o){const[i,l,a,r]=typeof e!="string"?$c(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+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-l,o.computedPosition.y+o.dimensions.height-a]]:!1}function xg(e,t,o,i){let l=e.extent||o;if((l==="parent"||!Array.isArray(l)&&(l==null?void 0:l.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const a=$g(l,e,i);a&&(l=a)}else t(new Fe(Ue.NODE_EXTENT_INVALID,e.id)),l=o;else if(Array.isArray(l)){const a=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;l=[[l[0][0]+a,l[0][1]+r],[l[1][0]+a,l[1][1]+r]]}else if(l!=="parent"&&(l!=null&&l.range)&&Array.isArray(l.range)){const[a,r,s,d]=$c(l.padding),c=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;l=[[l.range[0][0]+c+d,l.range[0][1]+u+a],[l.range[1][0]+c-r,l.range[1][1]+u-s]]}return l==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:l}function Sg({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function jl(e,t,o,i,l){const a=Sg(e.dimensions,xg(e,o,i,l)),r=rc(t,a);return{position:{x:r.x-((l==null?void 0:l.computedPosition.x)||0),y:r.y-((l==null?void 0:l.computedPosition.y)||0)},computedPosition:r}}function xn(e,t,o=ke.Left,i=!1){const l=((t==null?void 0:t.x)??0)+e.computedPosition.x,a=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Vg(e);if(i)return{x:l+r/2,y:a+s/2};switch((t==null?void 0:t.position)??o){case ke.Top:return{x:l+r/2,y:a};case ke.Right:return{x:l+r,y:a+s/2};case ke.Bottom:return{x:l+r/2,y:a+s};case ke.Left:return{x:l,y:a+s/2}}}function xc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Ig({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:l,targetHeight:a,width:r,height:s,viewport:d}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+l),y2:Math.max(e.y+i,t.y+a)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=mi({x:(0-d.x)/d.zoom,y:(0-d.y)/d.zoom,width:r/d.zoom,height:s/d.zoom}),f=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),p=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(f*p)>0}function Cg(e,t,o=!1){const i=typeof e.zIndex=="number";let l=i?e.zIndex:0;const a=t(e.source),r=t(e.target);return!a||!r?0:(o&&(l=i?e.zIndex:Math.max(a.computedPosition.z||0,r.computedPosition.z||0)),l)}var Ue=(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))(Ue||{});const Sc={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
|
|
8
8
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
9
9
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
10
10
|
Node: ${e}
|
|
@@ -24,18 +24,18 @@ Edge: ${e}
|
|
|
24
24
|
Source: ${t}
|
|
25
25
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
26
26
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
27
|
-
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 Ue extends Error{constructor(t,...o){var i;super((i=xc[t])==null?void 0:i.call(xc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Xa(e){return"clientX"in e}function kg(e){return"sourceEvent"in e}function yt(e,t){const o=Xa(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-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const ro=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ng(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function fi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const xg=()=>!0;function ja(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function $g(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const l of t.values())si(a,ri(l))>0&&i.push(l);return i}const Sg=250;function Ig(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=$g(e,o,t+Sg);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((l=d.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:p,y:m}=xn(d,f,f.position,!0),h=Math.sqrt((p-e.x)**2+(m-e.y)**2);h>t||(h<s?(r=[{...f,x:p,y:m}],s=h):h===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function $c(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=xg},u,f,p,m){const h=l==="target",g=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:N,y:b}=yt(e),E=r.elementFromPoint(N,b),y=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:g,C={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const Z=Sc(void 0,y),q=y.getAttribute("data-nodeid"),te=y.getAttribute("data-handleid"),P=y.classList.contains("connectable"),oe=y.classList.contains("connectableend");if(!q||!Z)return C;const z={source:h?q:i,sourceHandle:h?te:a,target:h?i:q,targetHandle:h?a:te};C.connection=z;const W=P&&oe&&(o===xt.Strict?h&&Z==="source"||!h&&Z==="target":q!==i||te!==a);C.isValid=W&&d(z,{nodes:f,edges:u,sourceNode:p(z.source),targetNode:p(z.target)}),C.toHandle=Ic(q,Z,te,m,o,!0)}return C}function Sc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cg(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Rg(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Ic(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===xt.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...xn(d,f,f.position,!0)}:f}const Za={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top},Vg=["production","prod"];function so(e,...t){Cc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Cc(){return!Vg.includes(process.env.NODE_ENV||"")}function Rc(e,t,o,i,a){const l=t.querySelectorAll(`.vue-flow__handle.${e}`);return l!=null&&l.length?Array.from(l).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:a,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...ci(r)}}):null}function Ja(e,t,o,i,a,l=!1,r){a.value=!1,e.selected?(l||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function ze(e){return typeof n.unref(e)<"u"}function Ag(e,t,o,i){if(!e||!e.source||!e.target)return o(new Ue(Pe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Mt(e)?a=e:a={...e,id:cc(e)},a=rc(a,void 0,i),fg(a,t)?!1:a}function Tg(e,t,o,i,a){if(!t.source||!t.target)return a(new Ue(Pe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Ue(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?cc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Vc(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!Qt(r)){o(new Ue(Pe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=cg(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),a[l]=s}for(const l of a){const r=t(l.parentNode)||a.find(s=>s.id===l.parentNode);l.parentNode&&!r&&o(new Ue(Pe.NODE_MISSING_PARENT,l.id,l.parentNode)),(l.parentNode||i[l.id])&&(i[l.id]&&(l.isParent=!0),r&&(r.isParent=!0))}return a}function Ac(e,t,o,i,a,l){let r=a;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${a}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),l){r=`${a}-${e}-${l}`;const d=i.get(r)||new Map;i.set(r,d.set(o,t))}}function Qa(e,t,o){e.clear();for(const i of o){const{source:a,target:l,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:l,sourceHandle:r,targetHandle:s},d=`${a}-${r}--${l}-${s}`,u=`${l}-${s}--${a}-${r}`;Ac("source",c,u,e,a,r),Ac("target",c,d,e,l,s)}}function Tc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function el(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Mt(d)?d:Ag(d,s,a,l);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){a(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Ue(Pe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new Ue(Pe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){a(new Ue(Pe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...rc(u,m,l),sourceNode:f,targetNode:p})}return c}const Mc=Symbol("vueFlow"),Bc=Symbol("nodeId"),Dc=Symbol("nodeRef"),Mg=Symbol("edgeId"),Bg=Symbol("edgeRef"),mi=Symbol("slots");function Oc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:N,removeSelectedElements:b,addSelectedNodes:E,updateNodePositions:y,emits:C}=Ve(),{onStart:Z,onDrag:q,onStop:te,onClick:P,el:oe,disabled:z,id:J,selectable:W,dragHandle:ge}=e,_=n.shallowRef(!1);let w=[],k,K=null,V={x:void 0,y:void 0},H={x:0,y:0},U=null,ce=!1,he=!1,me=0,be=!1;const ue=Lg(),X=({x:ye,y:ee})=>{V={x:ye,y:ee};let O=!1;if(w=w.map(B=>{const Y={x:ye-B.distance.x,y:ee-B.distance.y},{computedPosition:ie}=Ka(B,o.value?fi(Y,i.value):Y,C.error,r.value,B.parentNode?m(B.parentNode):void 0);return O=O||B.position.x!==ie.x||B.position.y!==ie.y,B.position=ie,B}),he=he||O,!!O&&(y(w,!0,!0),_.value=!0,U)){const[B,Y]=qa({id:J,dragItems:w,findNode:m});q({event:U,node:B,nodes:Y})}},F=()=>{if(!K)return;const[ye,ee]=yc(H,K,u.value);if(ye!==0||ee!==0){const O={x:(V.x??0)-ye/c.value.zoom,y:(V.y??0)-ee/c.value.zoom};p({x:ye,y:ee})&&X(O)}me=requestAnimationFrame(F)},le=(ye,ee)=>{ce=!0;const O=m(J);!N.value&&!h.value&&O&&(O.selected||b()),O&&n.toValue(W)&&N.value&&Ja(O,h.value,E,b,g,!1,ee);const B=ue(ye.sourceEvent);if(V=B,w=gg(l.value,f.value,B,J),w.length){const[Y,ie]=qa({id:J,dragItems:w,findNode:m});Z({event:ye.sourceEvent,node:Y,nodes:ie})}},ve=(ye,ee)=>{var O;ye.sourceEvent.type==="touchmove"&&ye.sourceEvent.touches.length>1||(he=!1,s.value===0&&le(ye,ee),V=ue(ye.sourceEvent),K=((O=t.value)==null?void 0:O.getBoundingClientRect())||null,H=yt(ye.sourceEvent,K))},we=(ye,ee)=>{const O=ue(ye.sourceEvent);if(!be&&ce&&d.value&&(be=!0,F()),!ce){const B=O.xSnapped-(V.x??0),Y=O.ySnapped-(V.y??0);Math.sqrt(B*B+Y*Y)>s.value&&le(ye,ee)}(V.x!==O.xSnapped||V.y!==O.ySnapped)&&w.length&&ce&&(U=ye.sourceEvent,H=yt(ye.sourceEvent,K),X(O))},pe=ye=>{let ee=!1;if(!ce&&!_.value&&!h.value){const O=ye.sourceEvent,B=ue(O),Y=B.xSnapped-(V.x??0),ie=B.ySnapped-(V.y??0),ne=Math.sqrt(Y*Y+ie*ie);ne!==0&&ne<=s.value&&(P==null||P(O),ee=!0)}if(w.length&&!ee){he&&(y(w,!1,!1),he=!1);const[O,B]=qa({id:J,dragItems:w,findNode:m});te({event:ye.sourceEvent,node:O,nodes:B})}w=[],_.value=!1,be=!1,ce=!1,V={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(z),oe],([ye,ee],O,B)=>{if(ee){const Y=it(ee);ye||(k=sh().on("start",ie=>ve(ie,ee)).on("drag",ie=>we(ie,ee)).on("end",ie=>pe(ie)).filter(ie=>{const ne=ie.target,v=n.toValue(ge);return!ie.button&&(!a.value||!Ec(ne,`.${a.value}`,ee)&&(!v||Ec(ne,v,ee)))}),Y.call(k)),B(()=>{Y.on(".drag",null),k&&(k.on("start",null),k.on("drag",null),k.on("end",null))})}}),_}function Dg(){return{doubleClick:Ee(),click:Ee(),mouseEnter:Ee(),mouseMove:Ee(),mouseLeave:Ee(),contextMenu:Ee(),updateStart:Ee(),update:Ee(),updateEnd:Ee()}}function Og(e,t){const o=Dg();return o.doubleClick.on(i=>{var a,l;t.edgeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.edgeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.edgeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.edgeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.edgeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.edgeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.updateStart.on(i=>{var a,l;t.edgeUpdateStart(i),(l=(a=e.events)==null?void 0:a.updateStart)==null||l.call(a,i)}),o.update.on(i=>{var a,l;t.edgeUpdate(i),(l=(a=e.events)==null?void 0:a.update)==null||l.call(a,i)}),o.updateEnd.on(i=>{var a,l;t.edgeUpdateEnd(i),(l=(a=e.events)==null?void 0:a.updateEnd)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function Lg(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Ve();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=kg(a)?a.sourceEvent:a,{x:c,y:d}=yt(s,r),u=ao({x:c,y:d},e.value),{x:f,y:p}=o.value?fi(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function pi(){return!0}function Lc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:g,findNode:N,panBy:b,startConnection:E,updateConnection:y,endConnection:C,emits:Z,viewport:q,edges:te,nodes:P,isValidConnection:oe,nodeLookup:z}=Ve();let J=null,W=!1,ge=null;function _(k){var K;const V=n.toValue(o)==="target",H=Xa(k),U=lc(k.target),ce=k.currentTarget;if(ce&&(H&&k.button===0||!H)){let he=function(x){O=yt(x,pe),X=Ig(ao(O,q.value,!1,[1,1]),u.value,z.value,ie),B||(Y(),B=!0);const T=$c(x,{handle:X,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:V?"target":"source",isValidConnection:ue,doc:U,lib:"vue",flowId:s,nodeLookup:z.value},te.value,P.value,N,z.value);ge=T.handleDomNode,J=T.connection,W=Rg(!!X,T.isValid);const R={...G,isValid:W,to:T.toHandle&&W?io({x:T.toHandle.x,y:T.toHandle.y},q.value):O,toHandle:T.toHandle,toPosition:W&&T.toHandle?T.toHandle.position:Za[ie.position],toNode:T.toHandle?z.value.get(T.toHandle.nodeId):null};if(W&&X&&(G!=null&&G.toHandle)&&R.toHandle&&G.toHandle.type===R.toHandle.type&&G.toHandle.nodeId===R.toHandle.nodeId&&G.toHandle.id===R.toHandle.id&&G.to.x===R.to.x&&G.to.y===R.to.y)return;const re=X??T.toHandle;if(y(re&&W?io({x:re.x,y:re.y},q.value):O,re,Cg(!!re,W)),G=R,!X&&!W&&!ge)return ja(ee);J&&J.source!==J.target&&ge&&(ja(ee),ee=ge,ge.classList.add("connecting","vue-flow__handle-connecting"),ge.classList.toggle("valid",!!W),ge.classList.toggle("vue-flow__handle-valid",!!W))},me=function(x){"touches"in x&&x.touches.length>0||((X||ge)&&J&&W&&(l?l(x,J):Z.connect(J)),Z.connectEnd(x),a&&(r==null||r(x)),ja(ee),cancelAnimationFrame(F),C(x),B=!1,W=!1,J=null,ge=null,U.removeEventListener("mousemove",he),U.removeEventListener("mouseup",me),U.removeEventListener("touchmove",he),U.removeEventListener("touchend",me))};const be=N(n.toValue(t));let ue=n.toValue(i)||oe.value||pi;!ue&&be&&(ue=(V?be.isValidSourcePos:be.isValidTargetPos)||pi);let X,F=0;const{x:le,y:ve}=yt(k),we=Sc(n.toValue(a),ce),pe=(K=c.value)==null?void 0:K.getBoundingClientRect();if(!pe||!we)return;const ye=Ic(n.toValue(t),we,n.toValue(e),z.value,d.value);if(!ye)return;let ee,O=yt(k,pe),B=!1;const Y=()=>{if(!h.value)return;const[x,T]=yc(O,pe,g.value);b({x,y:T}),F=requestAnimationFrame(Y)},ie={...ye,nodeId:n.toValue(t),type:we,position:ye.position},ne=z.value.get(n.toValue(t)),S={inProgress:!0,isValid:null,from:xn(ne,ie,Ne.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:ne,to:O,toHandle:null,toPosition:Za[ie.position],toNode:null};E({nodeId:n.toValue(t),id:n.toValue(e),type:we,position:(ce==null?void 0:ce.getAttribute("data-handlepos"))||Ne.Top,...O},{x:le-pe.left,y:ve-pe.top}),Z.connectStart({event:k,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:we});let G=S;U.addEventListener("mousemove",he),U.addEventListener("mouseup",me),U.addEventListener("touchmove",he),U.addEventListener("touchend",me)}}function w(k){var K,V;if(!f.value)return;const H=n.toValue(o)==="target";if(!p.value){Z.clickConnectStart({event:k,nodeId:n.toValue(t),handleId:n.toValue(e)}),E({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Ne.Top,...yt(k)},void 0,!0);return}let U=n.toValue(i)||oe.value||pi;const ce=N(n.toValue(t));if(!U&&ce&&(U=(H?ce.isValidSourcePos:ce.isValidTargetPos)||pi),ce&&(typeof ce.connectable>"u"?m.value:ce.connectable)===!1)return;const he=lc(k.target),me=$c(k,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Ne.Top,...yt(k)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:U,doc:he,lib:"vue",flowId:s,nodeLookup:z.value},te.value,P.value,N,z.value),be=((K=me.connection)==null?void 0:K.source)===((V=me.connection)==null?void 0:V.target);me.isValid&&me.connection&&!be&&Z.connect(me.connection),Z.clickConnectEnd(k),C(k,!0)}return{handlePointerDown:_,handleClick:w}}function Pg(){return n.inject(Bc,"")}function Pc(e){const t=e??Pg()??"",o=n.inject(Dc,n.ref(null)),{findNode:i,edges:a,emits:l}=Ve(),r=i(t);return r||l.error(new Ue(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>en([r],a.value))}}function zg(){return{doubleClick:Ee(),click:Ee(),mouseEnter:Ee(),mouseMove:Ee(),mouseLeave:Ee(),contextMenu:Ee(),dragStart:Ee(),drag:Ee(),dragStop:Ee()}}function Ug(e,t){const o=zg();return o.doubleClick.on(i=>{var a,l;t.nodeDoubleClick(i),(l=(a=e.events)==null?void 0:a.doubleClick)==null||l.call(a,i)}),o.click.on(i=>{var a,l;t.nodeClick(i),(l=(a=e.events)==null?void 0:a.click)==null||l.call(a,i)}),o.mouseEnter.on(i=>{var a,l;t.nodeMouseEnter(i),(l=(a=e.events)==null?void 0:a.mouseEnter)==null||l.call(a,i)}),o.mouseMove.on(i=>{var a,l;t.nodeMouseMove(i),(l=(a=e.events)==null?void 0:a.mouseMove)==null||l.call(a,i)}),o.mouseLeave.on(i=>{var a,l;t.nodeMouseLeave(i),(l=(a=e.events)==null?void 0:a.mouseLeave)==null||l.call(a,i)}),o.contextMenu.on(i=>{var a,l;t.nodeContextMenu(i),(l=(a=e.events)==null?void 0:a.contextMenu)==null||l.call(a,i)}),o.dragStart.on(i=>{var a,l;t.nodeDragStart(i),(l=(a=e.events)==null?void 0:a.dragStart)==null||l.call(a,i)}),o.drag.on(i=>{var a,l;t.nodeDrag(i),(l=(a=e.events)==null?void 0:a.drag)==null||l.call(a,i)}),o.dragStop.on(i=>{var a,l;t.nodeDragStop(i),(l=(a=e.events)==null?void 0:a.dragStop)==null||l.call(a,i)}),Object.entries(o).reduce((i,[a,l])=>(i.emit[a]=l.trigger,i.on[a]=l.on,i),{emit:{},on:{}})}function zc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Ve();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,p=d?4:1,m=c.x*u*p,h=c.y*f*p,g=[];for(const N of e.value)if(N.draggable||r&&typeof N.draggable>"u"){const b={x:N.computedPosition.x+m,y:N.computedPosition.y+h},{position:E}=Ka(N,b,s.error,t.value,N.parentNode?i(N.parentNode):void 0);g.push({id:N.id,position:E,from:N.position,distance:{x:c.x,y:c.y},dimensions:N.dimensions})}o(g,!0,!1)}}const hi=.1,Hg=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Ot(){return so("Viewport not initialized yet."),Promise.resolve(!1)}const Fg={zoomIn:Ot,zoomOut:Ot,zoomTo:Ot,fitView:Ot,setCenter:Ot,fitBounds:Ot,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ot,setTransform:Ot,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Gg(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Xn:Zo).scaleBy(tl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)})}function o(i,a,l,r){return new Promise(s=>{var c;const{x:d,y:u}=ac({x:-i,y:-a},e.translateExtent),f=En.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?Xn:Zo).transform(tl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,l)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?Xn:Zo).scaleTo(tl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{r(!0)}),a):r(!1)}),setViewport:(a,l)=>o(a.x,a.y,a.zoom,l),setTransform:(a,l)=>o(a.x,a.y,a.zoom,l),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:hi,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Ga(s),{x:d,y:u,zoom:f}=mc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??hi);return o(d,u,f,a)},setCenter:(a,l,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-l*s;return o(c,d,s,r)},fitBounds:(a,l={padding:hi})=>{const{x:r,y:s,zoom:c}=mc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??hi);return o(r,s,c,l)},project:a=>ao(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-l,y:a.y-r};return ao(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:l,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+l,y:a.y+r};return io(s,e.viewport)}return{x:0,y:0}}}:Fg)}function tl(e,t=0,o=Hg,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function Yg(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,N,b=!!(o.nodes.value.length||o.edges.value.length);g=gn([e.modelValue,()=>{var E,y;return(y=(E=e.modelValue)==null?void 0:E.value)==null?void 0:y.length}],([E])=>{E&&Array.isArray(E)&&(N==null||N.pause(),o.setElements(E),!N&&!b&&E.length?b=!0:N==null||N.resume())}),N=gn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,y])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...E,...y],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),N==null||N.stop()})})},l=()=>{i.run(()=>{let g,N,b=!!o.nodes.value.length;g=gn([e.nodes,()=>{var E,y;return(y=(E=e.nodes)==null?void 0:E.value)==null?void 0:y.length}],([E])=>{E&&Array.isArray(E)&&(N==null||N.pause(),o.setNodes(E),!N&&!b&&E.length?b=!0:N==null||N.resume())}),N=gn([o.nodes,()=>o.nodes.value.length],([E])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...E],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),N==null||N.stop()})})},r=()=>{i.run(()=>{let g,N,b=!!o.edges.value.length;g=gn([e.edges,()=>{var E,y;return(y=(E=e.edges)==null?void 0:E.value)==null?void 0:y.length}],([E])=>{E&&Array.isArray(E)&&(N==null||N.pause(),o.setEdges(E),!N&&!b&&E.length?b=!0:N==null||N.resume())}),N=gn([o.edges,()=>o.edges.value.length],([E])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...E],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),N==null||N.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&ze(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&ze(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&ze(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&ze(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{ze(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async N=>{let b=N;typeof t.autoConnect=="function"&&(b=await t.autoConnect(N)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{ze(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(N,b,E)=>{N?o.onConnect(g):o.hooks.value.connect.off(g),E(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},m=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const b=N;if(!g.includes(b)){const E=n.toRef(()=>t[b]),y=o[b];n.isRef(y)&&i.run(()=>{n.watch(E,C=>{ze(C)&&(y.value=C)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function Wg(){return{edgesChange:Ee(),nodesChange:Ee(),nodeDoubleClick:Ee(),nodeClick:Ee(),nodeMouseEnter:Ee(),nodeMouseMove:Ee(),nodeMouseLeave:Ee(),nodeContextMenu:Ee(),nodeDragStart:Ee(),nodeDrag:Ee(),nodeDragStop:Ee(),nodesInitialized:Ee(),miniMapNodeClick:Ee(),miniMapNodeDoubleClick:Ee(),miniMapNodeMouseEnter:Ee(),miniMapNodeMouseMove:Ee(),miniMapNodeMouseLeave:Ee(),connect:Ee(),connectStart:Ee(),connectEnd:Ee(),clickConnectStart:Ee(),clickConnectEnd:Ee(),paneReady:Ee(),init:Ee(),move:Ee(),moveStart:Ee(),moveEnd:Ee(),selectionDragStart:Ee(),selectionDrag:Ee(),selectionDragStop:Ee(),selectionContextMenu:Ee(),selectionStart:Ee(),selectionEnd:Ee(),viewportChangeStart:Ee(),viewportChange:Ee(),viewportChangeEnd:Ee(),paneScroll:Ee(),paneClick:Ee(),paneContextMenu:Ee(),paneMouseEnter:Ee(),paneMouseMove:Ee(),paneMouseLeave:Ee(),edgeContextMenu:Ee(),edgeMouseEnter:Ee(),edgeMouseMove:Ee(),edgeMouseLeave:Ee(),edgeDoubleClick:Ee(),edgeClick:Ee(),edgeUpdateStart:Ee(),edgeUpdate:Ee(),edgeUpdateEnd:Ee(),updateNodeInternals:Ee(),error:Ee(e=>so(e.message))}}function qg(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,l]of Object.entries(t.value)){const r=s=>{e(a,s)};l.setEmitter(r),Fn(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),Fn(l.removeHasEmitListeners)}});function i(a){var l;const r=Kg(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function Kg(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Uc(){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:Ua.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:to.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:Zt.Bezier,style:{}},connectionMode:xt.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:ro()?"Meta":"Control",zoomActivationKeyCode:ro()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Wg(),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 Xg=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function jg(e,t,o){const i=Gg(e),a=O=>{const B=O??[];e.hooks.updateNodeInternals.trigger(B)},l=O=>ug(O,e.nodes,e.edges),r=O=>dg(O,e.nodes,e.edges),s=O=>en(O,e.edges),c=({id:O,type:B,nodeId:Y})=>{var ie;const ne=O?`-${B}-${O}`:`-${B}`;return Array.from(((ie=e.connectionLookup.get(`${Y}${ne}`))==null?void 0:ie.values())??[])},d=O=>{if(O)return t.value.get(O)},u=O=>{if(O)return o.value.get(O)},f=(O,B,Y)=>{var ie,ne;const v=[];for(const S of O){const G={id:S.id,type:"position",dragging:Y,from:S.from};if(B&&(G.position=S.position,S.parentNode)){const x=d(S.parentNode);G.position={x:G.position.x-(((ie=x==null?void 0:x.computedPosition)==null?void 0:ie.x)??0),y:G.position.y-(((ne=x==null?void 0:x.computedPosition)==null?void 0:ne.y)??0)}}v.push(G)}v!=null&&v.length&&e.hooks.nodesChange.trigger(v)},p=O=>{if(!e.vueFlowRef)return;const B=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!B)return;const Y=window.getComputedStyle(B),{m22:ie}=new window.DOMMatrixReadOnly(Y.transform),ne=[];for(const v of O){const S=v,G=d(S.id);if(G){const x=ci(S.nodeElement);if(!!(x.width&&x.height&&(G.dimensions.width!==x.width||G.dimensions.height!==x.height||S.forceUpdate))){const R=S.nodeElement.getBoundingClientRect();G.dimensions=x,G.handleBounds.source=Rc("source",S.nodeElement,R,ie,G.id),G.handleBounds.target=Rc("target",S.nodeElement,R,ie,G.id),ne.push({id:G.id,type:"dimensions",dimensions:x})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ne.length&&e.hooks.nodesChange.trigger(ne)},m=(O,B)=>{const Y=new Set,ie=new Set;for(const S of O)Qt(S)?Y.add(S.id):Mt(S)&&ie.add(S.id);const ne=Dt(t.value,Y,!0),v=Dt(o.value,ie);if(e.multiSelectionActive){for(const S of Y)ne.push(Bt(S,B));for(const S of ie)v.push(Bt(S,B))}ne.length&&e.hooks.nodesChange.trigger(ne),v.length&&e.hooks.edgesChange.trigger(v)},h=O=>{if(e.multiSelectionActive){const B=O.map(Y=>Bt(Y.id,!0));e.hooks.nodesChange.trigger(B);return}e.hooks.nodesChange.trigger(Dt(t.value,new Set(O.map(B=>B.id)),!0)),e.hooks.edgesChange.trigger(Dt(o.value))},g=O=>{if(e.multiSelectionActive){const B=O.map(Y=>Bt(Y.id,!0));e.hooks.edgesChange.trigger(B);return}e.hooks.edgesChange.trigger(Dt(o.value,new Set(O.map(B=>B.id)))),e.hooks.nodesChange.trigger(Dt(t.value,new Set,!0))},N=O=>{m(O,!0)},b=O=>{const Y=(O||e.nodes).map(ie=>(ie.selected=!1,Bt(ie.id,!1)));e.hooks.nodesChange.trigger(Y)},E=O=>{const Y=(O||e.edges).map(ie=>(ie.selected=!1,Bt(ie.id,!1)));e.hooks.edgesChange.trigger(Y)},y=O=>{if(!O||!O.length)return m([],!1);const B=O.reduce((Y,ie)=>{const ne=Bt(ie.id,!1);return Qt(ie)?Y.nodes.push(ne):Y.edges.push(ne),Y},{nodes:[],edges:[]});B.nodes.length&&e.hooks.nodesChange.trigger(B.nodes),B.edges.length&&e.hooks.edgesChange.trigger(B.edges)},C=O=>{var B;(B=e.d3Zoom)==null||B.scaleExtent([O,e.maxZoom]),e.minZoom=O},Z=O=>{var B;(B=e.d3Zoom)==null||B.scaleExtent([e.minZoom,O]),e.maxZoom=O},q=O=>{var B;(B=e.d3Zoom)==null||B.translateExtent(O),e.translateExtent=O},te=O=>{e.nodeExtent=O,a()},P=O=>{var B;(B=e.d3Zoom)==null||B.clickDistance(O)},oe=O=>{e.nodesDraggable=O,e.nodesConnectable=O,e.elementsSelectable=O},z=O=>{const B=O instanceof Function?O(e.nodes):O;!e.initialized&&!B.length||(e.nodes=Vc(B,d,e.hooks.error.trigger))},J=O=>{const B=O instanceof Function?O(e.edges):O;if(!e.initialized&&!B.length)return;const Y=el(B,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Qa(e.connectionLookup,o.value,Y),e.edges=Y},W=O=>{const B=O instanceof Function?O([...e.nodes,...e.edges]):O;!e.initialized&&!B.length||(z(B.filter(Qt)),J(B.filter(Mt)))},ge=O=>{let B=O instanceof Function?O(e.nodes):O;B=Array.isArray(B)?B:[B];const Y=Vc(B,d,e.hooks.error.trigger),ie=[];for(const ne of Y)ie.push(bc(ne));ie.length&&e.hooks.nodesChange.trigger(ie)},_=O=>{let B=O instanceof Function?O(e.edges):O;B=Array.isArray(B)?B:[B];const Y=el(B,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),ie=[];for(const ne of Y)ie.push(bc(ne));ie.length&&e.hooks.edgesChange.trigger(ie)},w=(O,B=!0,Y=!1)=>{const ie=O instanceof Function?O(e.nodes):O,ne=Array.isArray(ie)?ie:[ie],v=[],S=[];function G(T){const R=s(T);for(const re of R)(!ze(re.deletable)||re.deletable)&&S.push(vc(re.id,re.source,re.target,re.sourceHandle,re.targetHandle))}function x(T){const R=[];for(const re of e.nodes)re.parentNode===T&&R.push(re);if(R.length){for(const re of R)v.push(_c(re.id));B&&G(R);for(const re of R)x(re.id)}}for(const T of ne){const R=typeof T=="string"?d(T):T;R&&(ze(R.deletable)&&!R.deletable||(v.push(_c(R.id)),B&&G([R]),Y&&x(R.id)))}S.length&&e.hooks.edgesChange.trigger(S),v.length&&e.hooks.nodesChange.trigger(v)},k=O=>{const B=O instanceof Function?O(e.edges):O,Y=Array.isArray(B)?B:[B],ie=[];for(const ne of Y){const v=typeof ne=="string"?u(ne):ne;v&&(ze(v.deletable)&&!v.deletable||ie.push(vc(typeof ne=="string"?ne:ne.id,v.source,v.target,v.sourceHandle,v.targetHandle)))}e.hooks.edgesChange.trigger(ie)},K=(O,B,Y=!0)=>{const ie=u(O.id);if(!ie)return!1;const ne=e.edges.indexOf(ie),v=Tg(O,B,ie,Y,e.hooks.error.trigger);if(v){const[S]=el([v],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((G,x)=>x===ne?S:G),Qa(e.connectionLookup,o.value,[S]),S}return!1},V=(O,B,Y={replace:!1})=>{const ie=u(O);if(!ie)return;const ne=typeof B=="function"?B(ie):B;ie.data=Y.replace?ne:{...ie.data,...ne}},H=O=>gc(O,e.nodes),U=O=>{const B=gc(O,e.edges);return Qa(e.connectionLookup,o.value,B),B},ce=(O,B,Y={replace:!1})=>{const ie=d(O);if(!ie)return;const ne=typeof B=="function"?B(ie):B;Y.replace?e.nodes.splice(e.nodes.indexOf(ie),1,ne):Object.assign(ie,ne)},he=(O,B,Y={replace:!1})=>{const ie=d(O);if(!ie)return;const ne=typeof B=="function"?B(ie):B;ie.data=Y.replace?ne:{...ie.data,...ne}},me=(O,B,Y=!1)=>{Y?e.connectionClickStartHandle=O:e.connectionStartHandle=O,e.connectionEndHandle=null,e.connectionStatus=null,B&&(e.connectionPosition=B)},be=(O,B=null,Y=null)=>{e.connectionStartHandle&&(e.connectionPosition=O,e.connectionEndHandle=B,e.connectionStatus=Y)},ue=(O,B)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,B?e.connectionClickStartHandle=null:e.connectionStartHandle=null},X=O=>{const B=sg(O),Y=B?null:oo(O)?O:d(O.id);return!B&&!Y?[null,null,B]:[B?O:ri(Y),Y,B]},F=(O,B=!0,Y=e.nodes)=>{const[ie,ne,v]=X(O);if(!ie)return[];const S=[];for(const G of Y||e.nodes){if(!v&&(G.id===ne.id||!G.computedPosition))continue;const x=ri(G),T=si(x,ie);(B&&T>0||T>=x.width*x.height||T>=Number(ie.width)*Number(ie.height))&&S.push(G)}return S},le=(O,B,Y=!0)=>{const[ie]=X(O);if(!ie)return!1;const ne=si(ie,B);return Y&&ne>0||ne>=Number(ie.width)*Number(ie.height)},ve=O=>{const{viewport:B,dimensions:Y,d3Zoom:ie,d3Selection:ne,translateExtent:v}=e;if(!ie||!ne||!O.x&&!O.y)return!1;const S=En.translate(B.x+O.x,B.y+O.y).scale(B.zoom),G=[[0,0],[Y.width,Y.height]],x=ie.constrain()(S,G,v),T=e.viewport.x!==x.x||e.viewport.y!==x.y||e.viewport.zoom!==x.k;return ie.transform(ne,x),T},we=O=>{const B=O instanceof Function?O(e):O,Y=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ze(B.defaultEdgeOptions)&&(e.defaultEdgeOptions=B.defaultEdgeOptions);const ie=B.modelValue||B.nodes||B.edges?[]:void 0;ie&&(B.modelValue&&ie.push(...B.modelValue),B.nodes&&ie.push(...B.nodes),B.edges&&ie.push(...B.edges),W(ie));const ne=()=>{ze(B.maxZoom)&&Z(B.maxZoom),ze(B.minZoom)&&C(B.minZoom),ze(B.translateExtent)&&q(B.translateExtent)};for(const v of Object.keys(B)){const S=v,G=B[S];![...Xg,...Y].includes(S)&&ze(G)&&(e[S]=G)}va(()=>e.d3Zoom).not.toBeNull().then(ne),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:W,setNodes:z,setEdges:J,addNodes:ge,addEdges:_,removeNodes:w,removeEdges:k,findNode:d,findEdge:u,updateEdge:K,updateEdgeData:V,updateNode:ce,updateNodeData:he,applyEdgeChanges:U,applyNodeChanges:H,addSelectedElements:N,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:C,setMaxZoom:Z,setTranslateExtent:q,setNodeExtent:te,setPaneClickDistance:P,removeSelectedElements:y,removeSelectedNodes:b,removeSelectedEdges:E,startConnection:me,updateConnection:be,endConnection:ue,setInteractive:oe,setState:we,getIntersectingNodes:F,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:le,panBy:ve,fitView:O=>i.value.fitView(O),zoomIn:O=>i.value.zoomIn(O),zoomOut:O=>i.value.zoomOut(O),zoomTo:(O,B)=>i.value.zoomTo(O,B),setViewport:(O,B)=>i.value.setViewport(O,B),setTransform:(O,B)=>i.value.setTransform(O,B),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(O,B,Y)=>i.value.setCenter(O,B,Y),fitBounds:(O,B)=>i.value.fitBounds(O,B),project:O=>i.value.project(O),screenToFlowCoordinate:O=>i.value.screenToFlowCoordinate(O),flowToScreenCoordinate:O=>i.value.flowToScreenCoordinate(O),toObject:()=>{const O=[],B=[];for(const Y of e.nodes){const{computedPosition:ie,handleBounds:ne,selected:v,dimensions:S,isParent:G,resizing:x,dragging:T,events:R,...re}=Y;O.push(re)}for(const Y of e.edges){const{selected:ie,sourceNode:ne,targetNode:v,events:S,...G}=Y;B.push(G)}return JSON.parse(JSON.stringify({nodes:O,edges:B,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:O=>new Promise(B=>{const{nodes:Y,edges:ie,position:ne,zoom:v,viewport:S}=O;Y&&z(Y),ie&&J(ie);const[G,x]=S!=null&&S.x&&(S!=null&&S.y)?[S.x,S.y]:ne??[null,null];if(G&&x){const T=(S==null?void 0:S.zoom)||v||e.viewport.zoom;return va(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:G,y:x,zoom:T}).then(()=>{B(!0)})})}else B(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const O=Uc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const B=En.translate(O.defaultViewport.x??0,O.defaultViewport.y??0).scale(Jt(O.defaultViewport.zoom??1,O.minZoom,O.maxZoom)),Y=e.viewportRef.getBoundingClientRect(),ie=[[0,0],[Y.width,Y.height]],ne=e.d3Zoom.constrain()(B,ie,O.translateExtent);e.d3Zoom.transform(e.d3Selection,ne)}we(O)},$destroy:()=>{}}}const Zg=["data-id","data-handleid","data-nodeid","data-handlepos"],Jg={name:"Handle",compatConfig:{MODE:3}},tn=n.defineComponent({...Jg,props:{id:{default:null},type:{},position:{default:()=>Ne.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:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:l,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:p}=Ve(),{id:m,node:h,nodeEl:g,connectedEdges:N}=Pc(),b=n.ref(),E=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=n.toRef(()=>{var J,W,ge,_,w,k;return((J=r.value)==null?void 0:J.nodeId)===m&&((W=r.value)==null?void 0:W.id)===e.id&&((ge=r.value)==null?void 0:ge.type)===i.value||((_=c.value)==null?void 0:_.nodeId)===m&&((w=c.value)==null?void 0:w.id)===e.id&&((k=c.value)==null?void 0:k.type)===i.value}),Z=n.toRef(()=>{var J,W,ge;return((J=s.value)==null?void 0:J.nodeId)===m&&((W=s.value)==null?void 0:W.id)===e.id&&((ge=s.value)==null?void 0:ge.type)===i.value}),{handlePointerDown:q,handleClick:te}=Lc({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),P=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(J=>{const W=J[`${i.value}Handle`];return J[i.value]!==m?!1:W?W===e.id:!0}):typeof e.connectable=="number"?N.value.filter(J=>{const W=J[`${i.value}Handle`];return J[i.value]!==m?!1:W?W===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,N.value):ze(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var J;if(!h.dimensions.width||!h.dimensions.height)return;const W=(J=h.handleBounds[i.value])==null?void 0:J.find(H=>H.id===e.id);if(!d.value||W)return;const ge=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!ge||!e.id)return;const _=g.value.getBoundingClientRect(),w=b.value.getBoundingClientRect(),k=window.getComputedStyle(ge),{m22:K}=new window.DOMMatrixReadOnly(k.transform),V={id:e.id,position:e.position,x:(w.left-_.left)/K,y:(w.top-_.top)/K,type:i.value,nodeId:m,...ci(b.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],V]});function oe(J){const W=Xa(J);P.value&&E.value&&(W&&J.button===0||!W)&&q(J)}function z(J){!m||!s.value&&!E.value||P.value&&te(J)}return t({handleClick:te,handlePointerDown:q,onClick:z,onPointerDown:oe}),(J,W)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":J.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${J.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:P.value,connecting:Z.value,connectablestart:E.value,connectableend:y.value,connectionindicator:P.value&&(E.value&&!C.value||y.value&&C.value)}]]),onMousedown:oe,onTouchstartPassive:oe,onClick:z},[n.renderSlot(J.$slots,"default",{id:J.id})],42,Zg))}}),yi=function({sourcePosition:e=Ne.Bottom,targetPosition:t=Ne.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(tn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(tn,{type:"source",position:e,connectable:i,isValidConnection:l})]};yi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],yi.inheritAttrs=!1,yi.compatConfig={MODE:3};const Qg=yi,gi=function({targetPosition:e=Ne.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(tn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};gi.props=["targetPosition","label","isValidTargetPos","connectable","data"],gi.inheritAttrs=!1,gi.compatConfig={MODE:3};const e0=gi,bi=function({sourcePosition:e=Ne.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const l=a.label??t;return[typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l]),n.h(tn,{type:"source",position:e,connectable:o,isValidConnection:i})]};bi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],bi.inheritAttrs=!1,bi.compatConfig={MODE:3};const t0=bi,n0=["transform"],o0=["width","height","x","y","rx","ry"],i0=["y"],a0={name:"EdgeText",compatConfig:{MODE:3}},l0=n.defineComponent({...a0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const l=o.value.getBBox();(l.width!==t.value.width||l.height!==t.value.height)&&(t.value=l)}return(l,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[l.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*l.labelBgPadding[0]}px`,height:`${t.value.height+2*l.labelBgPadding[1]}px`,x:-l.labelBgPadding[0],y:-l.labelBgPadding[1],style:n.normalizeStyle(l.labelBgStyle),rx:l.labelBgBorderRadius,ry:l.labelBgBorderRadius},null,12,o0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(l.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:l.labelStyle}),[n.renderSlot(l.$slots,"default",{},()=>[typeof l.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.label),1)],64))])],16,i0)],8,n0))}}),r0=["id","d","marker-end","marker-start"],s0=["d","stroke-width"],c0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},_i=n.defineComponent({...c0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),l=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(l),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,r0),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,s0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(l0,{key:1,ref_key:"labelEl",ref:a,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function Hc({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,l=o<e?o+a:o-a,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[l,s,a,r]}function Fc({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:r,targetControlY:s}){const c=e*.125+a*.375+r*.375+o*.125,d=t*.125+l*.375+s*.375+i*.125,u=Math.abs(c-e),f=Math.abs(d-t);return[c,d,u,f]}function vi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Gc({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Ne.Left:r=t-vi(t-i,l),s=o;break;case Ne.Right:r=t+vi(i-t,l),s=o;break;case Ne.Top:r=t,s=o-vi(o-a,l);break;case Ne.Bottom:r=t,s=o+vi(a-o,l);break}return[r,s]}function Yc(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ne.Bottom,targetX:a,targetY:l,targetPosition:r=Ne.Top,curvature:s=.25}=e,[c,d]=Gc({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Gc({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[p,m,h,g]=Fc({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,p,m,h,g]}function Wc({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Ne.Left:case Ne.Right:l=.5*(t+i),r=o;break;case Ne.Top:case Ne.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function qc(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ne.Bottom,targetX:a,targetY:l,targetPosition:r=Ne.Top}=e,[s,c]=Wc({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Wc({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,p,m,h]=Fc({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,p,m,h]}const Kc={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}};function d0({source:e,sourcePosition:t=Ne.Bottom,target:o}){return t===Ne.Left||t===Ne.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 Xc(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function u0({source:e,sourcePosition:t=Ne.Bottom,target:o,targetPosition:i=Ne.Top,center:a,offset:l}){const r=Kc[t],s=Kc[i],c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:o.x+s.x*l,y:o.y+s.y*l},u=d0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,h,g;const N={x:0,y:0},b={x:0,y:0},[E,y,C,Z]=Hc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){h=a.x??E,g=a.y??y;const te=[{x:h,y:c.y},{x:h,y:d.y}],P=[{x:c.x,y:g},{x:d.x,y:g}];r[f]===p?m=f==="x"?te:P:m=f==="x"?P:te}else{const te=[{x:c.x,y:d.y}],P=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?P:te:m=r.y===p?te:P,t===i){const ge=Math.abs(e[f]-o[f]);if(ge<=l){const _=Math.min(l-1,l-ge);r[f]===p?N[f]=(c[f]>e[f]?-1:1)*_:b[f]=(d[f]>o[f]?-1:1)*_}}if(t!==i){const ge=f==="x"?"y":"x",_=r[f]===s[ge],w=c[ge]>d[ge],k=c[ge]<d[ge];(r[f]===1&&(!_&&w||_&&k)||r[f]!==1&&(!_&&k||_&&w))&&(m=f==="x"?te:P)}const oe={x:c.x+N.x,y:c.y+N.y},z={x:d.x+b.x,y:d.y+b.y},J=Math.max(Math.abs(oe.x-m[0].x),Math.abs(z.x-m[0].x)),W=Math.max(Math.abs(oe.y-m[0].y),Math.abs(z.y-m[0].y));J>=W?(h=(oe.x+z.x)/2,g=m[0].y):(h=m[0].x,g=(oe.y+z.y)/2)}return[[e,{x:c.x+N.x,y:c.y+N.y},...m,{x:d.x+b.x,y:d.y+b.y},o],h,g,C,Z]}function f0(e,t,o,i){const a=Math.min(Xc(e,t)/2,Xc(t,o)/2,i),{x:l,y:r}=t;if(e.x===l&&l===o.x||e.y===r&&r===o.y)return`L${l} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${l+a*d},${r}Q ${l},${r} ${l},${r+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${l},${r+a*c}Q ${l},${r} ${l+a*s},${r}`}function nl(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ne.Bottom,targetX:a,targetY:l,targetPosition:r=Ne.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,h,g]=u0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((b,E,y)=>{let C;return y>0&&y<f.length-1?C=f0(f[y-1],E,f[y+1],s):C=`${y===0?"M":"L"}${E.x} ${E.y}`,b+=C,b},""),p,m,h,g]}function m0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Hc({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const p0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=m0(e);return n.h(_i,{path:o,labelX:i,labelY:a,...t,...e})}}}),jc=n.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:t}){return()=>{const[o,i,a]=nl({...e,sourcePosition:e.sourcePosition??Ne.Bottom,targetPosition:e.targetPosition??Ne.Top});return n.h(_i,{path:o,labelX:i,labelY:a,...t,...e})}}}),h0=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(jc,{...e,...t,borderRadius:0})}}),y0=n.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:t}){return()=>{const[o,i,a]=Yc({...e,sourcePosition:e.sourcePosition??Ne.Bottom,targetPosition:e.targetPosition??Ne.Top});return n.h(_i,{path:o,labelX:i,labelY:a,...t,...e})}}}),g0=n.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:t}){return()=>{const[o,i,a]=qc({...e,sourcePosition:e.sourcePosition??Ne.Bottom,targetPosition:e.targetPosition??Ne.Top});return n.h(_i,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0={input:t0,default:Qg,output:e0},_0={default:y0,straight:p0,step:h0,smoothstep:jc,simplebezier:g0};function v0(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),l=n.computed(()=>{const g={..._0,...e.edgeTypes},N=Object.keys(g);for(const b of e.edges)b.type&&!N.includes(b.type)&&(g[b.type]=b.type);return g}),r=n.computed(()=>{const g={...b0,...e.nodeTypes},N=Object.keys(g);for(const b of e.nodes)b.type&&!N.includes(b.type)&&(g[b.type]=b.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?fc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const N of e.edges){const b=t.value.get(N.source),E=t.value.get(N.target);wg({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})&&g.push(N)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const N of e.nodes)N.selected&&g.push(N);return g}),f=n.computed(()=>{const g=[];for(const N of e.edges)N.selected&&g.push(N);return g}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const g=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&g.push(N);return g}),h=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:h}}class nn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??nn.instance;return nn.instance=i??new nn,o&&(o.config.globalProperties.$vueFlowStorage=nn.instance),nn.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=Uc(),a=n.reactive(i),l={};for(const[p,m]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;l[h]=m.on}const r={};for(const[p,m]of Object.entries(a.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of a.nodes)p.set(m.id,m);return p}),c=n.computed(()=>{const p=new Map;for(const m of a.edges)p.set(m.id,m);return p}),d=v0(a,s,c),u=jg(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...gm(a),nodeLookup:s,edgeLookup:c,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function Ve(e){const t=nn.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},l=a.id,r=l??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(Mc,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,p,m)=>{const h=N=>{d.applyNodeChanges(N)},g=N=>{d.applyEdgeChanges(N)};f?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),m(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),Fn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():so(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(Mc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Ue(Pe.USEVUEFLOW_OPTIONS))}return s}function w0(e){const{emits:t,dimensions:o}=Ve();let i;n.onMounted(()=>{const a=()=>{var l,r;if(!e.value||!(((r=(l=e.value).checkVisibility)==null?void 0:r.call(l))??!0))return;const s=ci(e.value);(s.width===0||s.height===0)&&t.error(new Ue(Pe.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)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const E0={name:"UserSelection",compatConfig:{MODE:3}},k0=n.defineComponent({...E0,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),N0=["tabIndex"],x0={name:"NodesSelection",compatConfig:{MODE:3}},$0=n.defineComponent({...x0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Ve(),s=zc(),c=n.ref(null),d=Oc({el:c,onStart(h){t.selectionDragStart(h),t.nodeDragStart(h)},onDrag(h){t.selectionDrag(h),t.nodeDrag(h)},onStop(h){t.selectionDragStop(h),t.nodeDragStop(h)}});n.onMounted(()=>{var h;l.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=n.computed(()=>Ga(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){t.selectionContextMenu({event:h,nodes:i.value})}function m(h){l.value||kn[h.key]&&(h.preventDefault(),s({x:kn[h.key].x,y:kn[h.key].y},h.shiftKey))}return(h,g)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,N0)],6)):n.createCommentVNode("",!0)}});function S0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const I0={name:"Pane",compatConfig:{MODE:3}},C0=n.defineComponent({...I0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:N,multiSelectionActive:b,edgeLookup:E,nodeLookup:y,connectionLookup:C,defaultEdgeOptions:Z,connectionStartHandle:q,panOnDrag:te}=Ve(),P=n.shallowRef(null),oe=n.shallowRef(new Set),z=n.shallowRef(new Set),J=n.shallowRef(null),W=n.toRef(()=>c.value&&(e.isSelecting||l.value)),ge=n.toRef(()=>q.value!==null);let _=!1,w=!1;const k=no(g,{actInsideInputWithModifier:!1}),K=no(N);n.watch(k,ue=>{ue&&(p(f.value),m(u.value),d.value=!1)}),n.watch(K,ue=>{b.value=ue});function V(ue,X){return F=>{F.target===X&&(ue==null||ue(F))}}function H(ue){if(_||ge.value){_=!1;return}a.paneClick(ue),r(),d.value=!1}function U(ue){var X;if(Array.isArray(te.value)&&((X=te.value)!=null&&X.includes(2))){ue.preventDefault();return}a.paneContextMenu(ue)}function ce(ue){a.paneScroll(ue)}function he(ue){var X,F,le;if(J.value=((X=t.value)==null?void 0:X.getBoundingClientRect())??null,!c.value||!e.isSelecting||ue.button!==0||ue.target!==P.value||!J.value)return;(le=(F=ue.target)==null?void 0:F.setPointerCapture)==null||le.call(F,ue.pointerId);const{x:ve,y:we}=S0(ue,J.value);w=!0,_=!1,r(),s.value={width:0,height:0,startX:ve,startY:we,x:ve,y:we},a.selectionStart(ue)}function me(ue){var X;if(!J.value||!s.value)return;_=!0;const{x:F,y:le}=yt(ue,J.value),{startX:ve=0,startY:we=0}=s.value,pe={startX:ve,startY:we,x:F<ve?F:ve,y:le<we?le:we,width:Math.abs(F-ve),height:Math.abs(le-we)},ye=oe.value,ee=z.value;oe.value=new Set(fc(o.value,pe,i.value,h.value===Ua.Partial,!0).map(B=>B.id)),z.value=new Set;const O=((X=Z.value)==null?void 0:X.selectable)??!0;for(const B of oe.value){const Y=C.value.get(B);if(Y)for(const{edgeId:ie}of Y.values()){const ne=E.value.get(ie);ne&&(ne.selectable??O)&&z.value.add(ie)}}if(!Tc(ye,oe.value)){const B=Dt(y.value,oe.value,!0);a.nodesChange(B)}if(!Tc(ee,z.value)){const B=Dt(E.value,z.value);a.edgesChange(B)}s.value=pe,l.value=!0,d.value=!1}function be(ue){var X;ue.button!==0||!w||((X=ue.target)==null||X.releasePointerCapture(ue.pointerId),!l.value&&s.value&&ue.target===P.value&&H(ue),l.value=!1,s.value=null,d.value=oe.value.size>0,a.selectionEnd(ue),e.selectionKeyPressed&&(_=!1),w=!1)}return(ue,X)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:P,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ue.isSelecting}]),onClick:X[0]||(X[0]=F=>W.value?void 0:V(H,P.value)(F)),onContextmenu:X[1]||(X[1]=F=>V(U,P.value)(F)),onWheelPassive:X[2]||(X[2]=F=>V(ce,P.value)(F)),onPointerenter:X[3]||(X[3]=F=>W.value?void 0:n.unref(a).paneMouseEnter(F)),onPointerdown:X[4]||(X[4]=F=>W.value?he(F):n.unref(a).paneMouseMove(F)),onPointermove:X[5]||(X[5]=F=>W.value?me(F):n.unref(a).paneMouseMove(F)),onPointerup:X[6]||(X[6]=F=>W.value?be(F):void 0),onPointerleave:X[7]||(X[7]=F=>n.unref(a).paneMouseLeave(F))},[n.renderSlot(ue.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(k0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(f).length?(n.openBlock(),n.createBlock($0,{key:1})):n.createCommentVNode("",!0)],34))}}),R0={name:"Transform",compatConfig:{MODE:3}},V0=n.defineComponent({...R0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Ve(),a=n.computed(()=>o.value?!i.value:!1),l=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:l.value,opacity:a.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),A0={name:"Viewport",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:h,preventScrolling:g,noWheelClassName:N,noPanClassName:b,emits:E,connectionStartHandle:y,userSelectionActive:C,paneDragging:Z,d3Zoom:q,d3Selection:te,d3ZoomHandler:P,viewport:oe,viewportRef:z,paneClickDistance:J}=Ve();w0(z);const W=n.shallowRef(!1),ge=n.shallowRef(!1);let _=null,w=!1,k=0,K={x:0,y:0,zoom:0};const V=no(s),H=no(r),U=no(l),ce=n.toRef(()=>(!H.value||H.value&&r.value===!0)&&(V.value||f.value)),he=n.toRef(()=>V.value||c.value),me=n.toRef(()=>r.value===!0&&ce.value!==!0),be=n.toRef(()=>H.value&&r.value!==!0||C.value||me.value),ue=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!z.value){so("Viewport element is missing");return}const we=z.value,pe=we.getBoundingClientRect(),ye=tg().clickDistance(J.value).scaleExtent([t.value,o.value]).translateExtent(a.value),ee=it(we).call(ye),O=ee.on("wheel.zoom"),B=En.translate(i.value.x??0,i.value.y??0).scale(Jt(i.value.zoom??1,t.value,o.value)),Y=[[0,0],[pe.width,pe.height]],ie=ye.constrain()(B,Y,a.value);ye.transform(ee,ie),ye.wheelDelta(Ya),q.value=ye,te.value=ee,P.value=O,oe.value={x:ie.x,y:ie.y,zoom:ie.k},ye.on("start",ne=>{var v;if(!ne.sourceEvent)return null;k=ne.sourceEvent.button,W.value=!0;const S=le(ne.transform);((v=ne.sourceEvent)==null?void 0:v.type)==="mousedown"&&(Z.value=!0),K=S,E.viewportChangeStart(S),E.moveStart({event:ne,flowTransform:S})}),ye.on("end",ne=>{if(!ne.sourceEvent)return null;if(W.value=!1,Z.value=!1,X(ce.value,k??0)&&!w&&E.paneContextMenu(ne.sourceEvent),w=!1,F(K,ne.transform)){const v=le(ne.transform);K=v,E.viewportChangeEnd(v),E.moveEnd({event:ne,flowTransform:v})}}),ye.filter(ne=>{var v;const S=U.value||h.value,G=m.value&&ne.ctrlKey,x=ne.button,T=ne.type==="wheel";if(x===1&&ne.type==="mousedown"&&(ve(ne,"vue-flow__node")||ve(ne,"vue-flow__edge")))return!0;if(!ce.value&&!S&&!he.value&&!p.value&&!m.value||C.value||ue.value&&!T||!p.value&&ne.type==="dblclick"||ve(ne,N.value)&&T||ve(ne,b.value)&&(!T||he.value&&T&&!U.value)||!m.value&&ne.ctrlKey&&T||!S&&!he.value&&!G&&T)return!1;if(!m&&ne.type==="touchstart"&&((v=ne.touches)==null?void 0:v.length)>1)return ne.preventDefault(),!1;if(!ce.value&&(ne.type==="mousedown"||ne.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&x===0||Array.isArray(f.value)&&!f.value.includes(x)&&(ne.type==="mousedown"||ne.type==="touchstart"))return!1;const R=Array.isArray(f.value)&&f.value.includes(x)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!x||x<=1;return(!ne.ctrlKey||V.value||T)&&R}),n.watch([C,ce],()=>{C.value&&!W.value?ye.on("zoom",null):C.value||ye.on("zoom",ne=>{oe.value={x:ne.transform.x,y:ne.transform.y,zoom:ne.transform.k};const v=le(ne.transform);w=X(ce.value,k??0),E.viewportChange(v),E.move({event:ne,flowTransform:v})})},{immediate:!0}),n.watch([C,he,d,U,m,g,N],()=>{he.value&&!U.value&&!C.value?ee.on("wheel.zoom",ne=>{if(ve(ne,N.value))return!1;const v=U.value||h.value,S=m.value&&ne.ctrlKey;if(!(!g.value||he.value||v||S))return!1;ne.preventDefault(),ne.stopImmediatePropagation();const x=ee.property("__zoom").k||1,T=ro();if(!V.value&&ne.ctrlKey&&m.value&&T){const Q=ft(ne),$=Ya(ne),D=x*2**$;ye.scaleTo(ee,D,Q,ne);return}const R=ne.deltaMode===1?20:1;let re=d.value===to.Vertical?0:ne.deltaX*R,I=d.value===to.Horizontal?0:ne.deltaY*R;!T&&ne.shiftKey&&d.value!==to.Vertical&&!re&&I&&(re=I,I=0),ye.translateBy(ee,-(re/x)*u.value,-(I/x)*u.value);const A=le(ee.property("__zoom"));_&&clearTimeout(_),ge.value?(E.move({event:ne,flowTransform:A}),E.viewportChange(A),_=setTimeout(()=>{E.moveEnd({event:ne,flowTransform:A}),E.viewportChangeEnd(A),ge.value=!1},150)):(ge.value=!0,E.moveStart({event:ne,flowTransform:A}),E.viewportChangeStart(A))},{passive:!1}):typeof O<"u"&&ee.on("wheel.zoom",function(ne,v){const S=!g.value&&ne.type==="wheel"&&!ne.ctrlKey,G=U.value||h.value,x=m.value&&ne.ctrlKey;if(!G&&!c.value&&!x&&ne.type==="wheel"||S||ve(ne,N.value))return null;ne.preventDefault(),O.call(this,ne,v)},{passive:!1})},{immediate:!0})});function X(we,pe){return pe===2&&Array.isArray(we)&&we.includes(2)}function F(we,pe){return we.x!==pe.x&&!Number.isNaN(pe.x)||we.y!==pe.y&&!Number.isNaN(pe.y)||we.zoom!==pe.k&&!Number.isNaN(pe.k)}function le(we){return{x:we.x,y:we.y,zoom:we.k}}function ve(we,pe){return we.target.closest(`.${pe}`)}return(we,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:z,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(C0,{"is-selecting":be.value,"selection-key-pressed":n.unref(H),class:n.normalizeClass({connecting:ue.value,dragging:n.unref(Z),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(V0,null,{default:n.withCtx(()=>[n.renderSlot(we.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),M0=["id"],B0=["id"],D0=["id"],O0={name:"A11yDescriptions",compatConfig:{MODE:3}},L0=n.defineComponent({...O0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Ve();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(nc)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.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,M0),n.createElementVNode("div",{id:`${n.unref(oc)}-${n.unref(t)}`,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,B0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(rg)}-${n.unref(t)}`,"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%)"}},n.toDisplayString(n.unref(i)),9,D0))],64))}});function P0(){const e=Ve();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function z0(e,t,o){return o===Ne.Left?e-t:o===Ne.Right?e+t:e}function U0(e,t,o){return o===Ne.Top?e-t:o===Ne.Bottom?e+t:e}const ol=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Ne.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:z0(t,e,i),cy:U0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ol.props=["radius","centerX","centerY","position","type"],ol.compatConfig={MODE:3};const Zc=ol,H0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:N,edgesFocusable:b,hooks:E}=Ve(),y=n.computed(()=>u(e.id)),{emit:C,on:Z}=Og(y.value,l),q=n.inject(mi),te=n.getCurrentInstance(),P=n.ref(!1),oe=n.ref(!1),z=n.ref(""),J=n.ref(null),W=n.ref("source"),ge=n.ref(null),_=n.toRef(()=>typeof y.value.selectable>"u"?g.value:y.value.selectable),w=n.toRef(()=>typeof y.value.updatable>"u"?N.value:y.value.updatable),k=n.toRef(()=>typeof y.value.focusable>"u"?b.value:y.value.focusable);n.provide(Mg,e.id),n.provide(Bg,ge);const K=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),V=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),H=n.computed(()=>{const B=y.value.type||"default",Y=q==null?void 0:q[`edge-${B}`];if(Y)return Y;let ie=y.value.template??c.value[B];if(typeof ie=="string"&&te){const ne=Object.keys(te.appContext.components);ne&&ne.includes(B)&&(ie=n.resolveComponent(B,!1))}return ie&&typeof ie!="string"?ie:(l.error(new Ue(Pe.EDGE_TYPE_MISSING,ie)),!1)}),{handlePointerDown:U}=Lc({nodeId:z,handleId:J,type:W,isValidConnection:p,edgeUpdaterType:W,onEdgeUpdate:me,onEdgeUpdateEnd:be});return()=>{const B=f(y.value.source),Y=f(y.value.target),ie="pathOptions"in y.value?y.value.pathOptions:{};if(!B&&!Y)return l.error(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!B)return l.error(new Ue(Pe.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!Y)return l.error(new Ue(Pe.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||B.hidden||Y.hidden)return null;let ne;i.value===xt.Strict?ne=B.handleBounds.source:ne=[...B.handleBounds.source||[],...B.handleBounds.target||[]];const v=Nc(ne,y.value.sourceHandle);let S;i.value===xt.Strict?S=Y.handleBounds.target:S=[...Y.handleBounds.target||[],...Y.handleBounds.source||[]];const G=Nc(S,y.value.targetHandle),x=(v==null?void 0:v.position)||Ne.Bottom,T=(G==null?void 0:G.position)||Ne.Top,{x:R,y:re}=xn(B,v,x),{x:I,y:A}=xn(Y,G,T);return y.value.sourceX=R,y.value.sourceY=re,y.value.targetX=I,y.value.targetY=A,n.h("g",{ref:ge,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${H.value===!1?"default":y.value.type||"default"}`,s.value,K.value,{updating:P.value,selected:y.value.selected,animated:y.value.animated,inactive:!_.value&&!E.value.edgeClick.hasListeners()}],tabIndex:k.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":k.value?`${oc}-${t}`:void 0,"aria-roledescription":"edge",role:k.value?"group":"img",...y.value.domAttributes,onClick:X,onContextmenu:F,onDblclick:le,onMouseenter:ve,onMousemove:we,onMouseleave:pe,onKeyDown:k.value?O:void 0},[oe.value?null:n.h(H.value===!1?c.value.default:H.value,{id:e.id,sourceNode:B,targetNode:Y,source:y.value.source,target:y.value.target,type:y.value.type,updatable:w.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...Z},style:V.value,markerStart:`url('#${lo(y.value.markerStart,t)}')`,markerEnd:`url('#${lo(y.value.markerEnd,t)}')`,sourcePosition:x,targetPosition:T,sourceX:R,sourceY:re,targetX:I,targetY:A,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...ie}),[w.value==="source"||w.value===!0?[n.h("g",{onMousedown:ye,onMouseenter:ce,onMouseout:he},n.h(Zc,{position:x,centerX:R,centerY:re,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[n.h("g",{onMousedown:ee,onMouseenter:ce,onMouseout:he},n.h(Zc,{position:T,centerX:I,centerY:A,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ce(){P.value=!0}function he(){P.value=!1}function me(B,Y){C.update({event:B,edge:y.value,connection:Y})}function be(B){C.updateEnd({event:B,edge:y.value}),oe.value=!1}function ue(B,Y){B.button===0&&(oe.value=!0,z.value=Y?y.value.target:y.value.source,J.value=(Y?y.value.targetHandle:y.value.sourceHandle)??null,W.value=Y?"target":"source",C.updateStart({event:B,edge:y.value}),U(B))}function X(B){var Y;const ie={event:B,edge:y.value};_.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(Y=ge.value)==null||Y.blur()):o([y.value])),C.click(ie)}function F(B){C.contextMenu({event:B,edge:y.value})}function le(B){C.doubleClick({event:B,edge:y.value})}function ve(B){C.mouseEnter({event:B,edge:y.value})}function we(B){C.mouseMove({event:B,edge:y.value})}function pe(B){C.mouseLeave({event:B,edge:y.value})}function ye(B){ue(B,!0)}function ee(B){ue(B,!1)}function O(B){var Y;!h.value&&ic.includes(B.key)&&_.value&&(B.key==="Escape"?((Y=ge.value)==null||Y.blur(),d([u(e.id)])):o([u(e.id)]))}}}),F0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:l,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=Ve(),p=(e=n.inject(mi))==null?void 0:e["connection-line"],m=n.computed(()=>{var E;return f((E=i.value)==null?void 0:E.nodeId)}),h=n.computed(()=>{var E;return f((E=a.value)==null?void 0:E.nodeId)??null}),g=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),N=n.computed(()=>c.value.markerStart?`url(#${lo(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${lo(c.value.markerEnd,t)})`:"");return()=>{var E,y,C;if(!m.value||!i.value)return null;const Z=i.value.id,q=i.value.type,te=m.value.handleBounds;let P=(te==null?void 0:te[q])??[];if(o.value===xt.Loose){const V=(te==null?void 0:te[q==="source"?"target":"source"])??[];P=[...P,...V]}if(!P)return null;const oe=(Z?P.find(V=>V.id===Z):P[0])??null,z=(oe==null?void 0:oe.position)??Ne.Top,{x:J,y:W}=xn(m.value,oe,z);let ge=null;h.value&&(o.value===xt.Strict?ge=((E=h.value.handleBounds[q==="source"?"target":"source"])==null?void 0:E.find(V=>{var H;return V.id===((H=a.value)==null?void 0:H.id)}))||null:ge=((y=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:y.find(V=>{var H;return V.id===((H=a.value)==null?void 0:H.id)}))||null);const _=((C=a.value)==null?void 0:C.position)??(z?Za[z]:null);if(!z||!_)return null;const w=r.value??c.value.type??Zt.Bezier;let k="";const K={sourceX:J,sourceY:W,sourcePosition:z,targetX:g.value.x,targetY:g.value.y,targetPosition:_};return w===Zt.Bezier?[k]=Yc(K):w===Zt.Step?[k]=nl({...K,borderRadius:0}):w===Zt.SmoothStep?[k]=nl(K):w===Zt.SimpleBezier?[k]=qc(K):k=`M${J},${W} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},p?n.h(p,{sourceX:J,sourceY:W,sourcePosition:z,targetX:g.value.x,targetY:g.value.y,targetPosition:_,sourceNode:m.value,sourceHandle:oe,targetNode:h.value,targetHandle:ge,markerEnd:b.value,markerStart:N.value,connectionStatus:d.value}):n.h("path",{d:k,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":N.value})))}}}),G0=["id","markerWidth","markerHeight","markerUnits","orient"],Y0={name:"MarkerType",compatConfig:{MODE:3}},W0=n.defineComponent({...Y0,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(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Ha).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Ha).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,G0))}}),q0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},K0={name:"MarkerDefinitions",compatConfig:{MODE:3}},X0=n.defineComponent({...K0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Ve(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=lo(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),r.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(r,s)=>(n.openBlock(),n.createElementBlock("svg",q0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(W0,{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))])]))}}),j0={name:"Edges",compatConfig:{MODE:3}},Z0=n.defineComponent({...j0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Ve();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(X0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(Eg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(H0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(F0))],64))}}),J0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:N,snapGrid:b,nodeDragThreshold:E,nodesDraggable:y,elementsSelectable:C,nodesConnectable:Z,nodesFocusable:q,hooks:te}=Ve(),P=n.ref(null);n.provide(Dc,P),n.provide(Bc,e.id);const oe=n.inject(mi),z=n.getCurrentInstance(),J=zc(),{node:W,parentNode:ge}=Pc(e.id),{emit:_,on:w}=Ug(W,r),k=n.toRef(()=>typeof W.draggable>"u"?y.value:W.draggable),K=n.toRef(()=>typeof W.selectable>"u"?C.value:W.selectable),V=n.toRef(()=>typeof W.connectable>"u"?Z.value:W.connectable),H=n.toRef(()=>typeof W.focusable>"u"?q.value:W.focusable),U=n.computed(()=>K.value||k.value||te.value.nodeClick.hasListeners()||te.value.nodeDoubleClick.hasListeners()||te.value.nodeMouseEnter.hasListeners()||te.value.nodeMouseMove.hasListeners()||te.value.nodeMouseLeave.hasListeners()),ce=n.toRef(()=>!!W.dimensions.width&&!!W.dimensions.height),he=n.computed(()=>{const Y=W.type||"default",ie=oe==null?void 0:oe[`node-${Y}`];if(ie)return ie;let ne=W.template||f.value[Y];if(typeof ne=="string"&&z){const v=Object.keys(z.appContext.components);v&&v.includes(Y)&&(ne=n.resolveComponent(Y,!1))}return ne&&typeof ne!="string"?ne:(r.error(new Ue(Pe.NODE_TYPE_MISSING,ne)),!1)}),me=Oc({id:e.id,el:P,disabled:()=>!k.value,selectable:K,dragHandle:()=>W.dragHandle,onStart(Y){_.dragStart(Y)},onDrag(Y){_.drag(Y)},onStop(Y){_.dragStop(Y)},onClick(Y){O(Y)}}),be=n.computed(()=>W.class instanceof Function?W.class(W):W.class),ue=n.computed(()=>{const Y=(W.style instanceof Function?W.style(W):W.style)||{},ie=W.width instanceof Function?W.width(W):W.width,ne=W.height instanceof Function?W.height(W):W.height;return!Y.width&&ie&&(Y.width=typeof ie=="string"?ie:`${ie}px`),!Y.height&&ne&&(Y.height=typeof ne=="string"?ne:`${ne}px`),Y}),X=n.toRef(()=>Number(W.zIndex??ue.value.zIndex??0));return u(Y=>{(Y.includes(e.id)||!Y.length)&&le()}),n.onMounted(()=>{n.watch(()=>W.hidden,(Y=!1,ie,ne)=>{!Y&&P.value&&(e.resizeObserver.observe(P.value),ne(()=>{P.value&&e.resizeObserver.unobserve(P.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>W.type,()=>W.sourcePosition,()=>W.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])})}),n.watch([()=>W.position.x,()=>W.position.y,()=>{var Y;return(Y=ge.value)==null?void 0:Y.computedPosition.x},()=>{var Y;return(Y=ge.value)==null?void 0:Y.computedPosition.y},()=>{var Y;return(Y=ge.value)==null?void 0:Y.computedPosition.z},X,()=>W.selected,()=>W.dimensions.height,()=>W.dimensions.width,()=>{var Y;return(Y=ge.value)==null?void 0:Y.dimensions.height},()=>{var Y;return(Y=ge.value)==null?void 0:Y.dimensions.width}],([Y,ie,ne,v,S,G])=>{const x={x:Y,y:ie,z:G+(m.value&&W.selected?1e3:0)};typeof ne<"u"&&typeof v<"u"?W.computedPosition=yg({x:ne,y:v,z:S},x):W.computedPosition=x},{flush:"post",immediate:!0}),n.watch([()=>W.extent,p],([Y,ie],[ne,v])=>{(Y!==ne||ie!==v)&&F()}),W.extent==="parent"||typeof W.extent=="object"&&"range"in W.extent&&W.extent.range==="parent"?va(()=>ce).toBe(!0).then(F):F(),()=>W.hidden?null:n.h("div",{ref:P,"data-id":W.id,class:["vue-flow__node",`vue-flow__node-${he.value===!1?"default":W.type||"default"}`,{[o.value]:k.value,dragging:me==null?void 0:me.value,draggable:k.value,selected:W.selected,selectable:K.value,parent:W.isParent},be.value],style:{visibility:ce.value?"visible":"hidden",zIndex:W.computedPosition.z??X.value,transform:`translate(${W.computedPosition.x}px,${W.computedPosition.y}px)`,pointerEvents:U.value?"all":"none",...ue.value},tabIndex:H.value?0:void 0,role:H.value?"group":void 0,"aria-describedby":h.value?void 0:`${nc}-${t}`,"aria-label":W.ariaLabel,"aria-roledescription":"node",...W.domAttributes,onMouseenter:ve,onMousemove:we,onMouseleave:pe,onContextmenu:ye,onClick:O,onDblclick:ee,onKeydown:B},[n.h(he.value===!1?f.value.default:he.value,{id:W.id,type:W.type,data:W.data,events:{...W.events,...w},selected:W.selected,resizing:W.resizing,dragging:me.value,connectable:V.value,position:W.computedPosition,dimensions:W.dimensions,isValidTargetPos:W.isValidTargetPos,isValidSourcePos:W.isValidSourcePos,parent:W.parentNode,parentNodeId:W.parentNode,zIndex:W.computedPosition.z??X.value,targetPosition:W.targetPosition,sourcePosition:W.sourcePosition,label:W.label,dragHandle:W.dragHandle,onUpdateNodeInternals:le})]);function F(){const Y=W.computedPosition,{computedPosition:ie,position:ne}=Ka(W,N.value?fi(Y,b.value):Y,r.error,p.value,ge.value);(W.computedPosition.x!==ie.x||W.computedPosition.y!==ie.y)&&(W.computedPosition={...W.computedPosition,...ie}),(W.position.x!==ne.x||W.position.y!==ne.y)&&(W.position=ne)}function le(){P.value&&d([{id:e.id,nodeElement:P.value,forceUpdate:!0}])}function ve(Y){me!=null&&me.value||_.mouseEnter({event:Y,node:W})}function we(Y){me!=null&&me.value||_.mouseMove({event:Y,node:W})}function pe(Y){me!=null&&me.value||_.mouseLeave({event:Y,node:W})}function ye(Y){return _.contextMenu({event:Y,node:W})}function ee(Y){return _.doubleClick({event:Y,node:W})}function O(Y){K.value&&(!i.value||!k.value||E.value>0)&&Ja(W,l.value,c,s,a,!1,P.value),_.click({event:Y,node:W})}function B(Y){if(!(Fa(Y)||h.value))if(ic.includes(Y.key)&&K.value){const ie=Y.key==="Escape";Ja(W,l.value,c,s,a,ie,P.value)}else k.value&&W.selected&&kn[Y.key]&&(Y.preventDefault(),g.value=`Moved selected node ${Y.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~W.position.x}, y: ${~~W.position.y}`,J({x:kn[Y.key].x,y:kn[Y.key].y},Y.shiftKey))}}});function Q0(e={includeHiddenNodes:!1}){const{nodes:t}=Ve();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.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 eb={class:"vue-flow__nodes vue-flow__container"},tb={name:"Nodes",compatConfig:{MODE:3}},nb=n.defineComponent({...tb,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Ve(),a=Q0(),l=n.ref();return n.watch(a,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{l.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=l.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",eb,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const p=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,p))return f;const m=(n.openBlock(),n.createBlock(n.unref(J0),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):n.createCommentVNode("",!0)]))}});function ob(){const{emits:e}=Ve();n.onMounted(()=>{if(Cc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ue(Pe.MISSING_STYLES))}})}const ib=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),ab={name:"VueFlow",compatConfig:{MODE:3}},lb=n.defineComponent({...ab,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:t,emit:o}){const i=e,a=n.useSlots(),l=wa(i,"modelValue",o),r=wa(i,"nodes",o),s=wa(i,"edges",o),c=Ve(i),d=Yg({modelValue:l,nodes:r,edges:s},i,c);return qg(o,c.hooks),P0(),ob(),n.provide(mi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(T0,null,{default:n.withCtx(()=>[n.createVNode(Z0),ib,n.createVNode(nb),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(L0)],512))}}),rb={name:"Panel",compatConfig:{MODE:3}},Jc=n.defineComponent({...rb,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Ve(),i=n.computed(()=>`${t.position}`.split("-"));return(a,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),on=["red","amber","green","teal","blue","indigo","violet","pink"],Qc={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function sb(e){return typeof e=="string"&&e in Qc}const cb={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},db=.15;function ub(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[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,l=parseInt(o.slice(4,6),16)/255,r=Math.max(i,a,l),s=Math.min(i,a,l),c=r-s,d=(r+s)/2;let u=0,f=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),r===i?f=(a-l)/c%6:r===a?f=(l-i)/c+2:f=(i-a)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function fb(e){if(typeof e!="string")return null;const t=ub(e);if(!t||t.s<db)return null;let o=null,i=1/0;for(const a of on){const l=Math.abs(t.h-cb[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function We(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(sb(t))return t;const o=e==null?void 0:e.properties;return fb((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function il(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const mb={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)"},pb={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 ed(e,t=!1){return e?t?pb[e]:mb[e]:null}function $n(e){return Qc[e]}function Sn(e){return`var(--em-swatch-${e}-bar)`}const hb=["width","height","innerHTML"],yb=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={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"/>',"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"/>',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"/>'};return(o,i)=>(n.openBlock(),n.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:t[e.name]??""},null,8,hb))}}),Te=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ie=Te(yb,[["__scopeId","data-v-04de464d"]]),gb={class:"em-inline-issue__msgs"},an=Te(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),a=n.computed(()=>{let l=null;for(const r of i.value)(l===null||o[r.severity].order<o[l].order)&&(l=r.severity);return l});return(l,r)=>a.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${a.value}`])},[n.createVNode(Ie,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",gb,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,c)=>(n.openBlock(),n.createElementBlock("span",{key:c},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),bb={class:"em-mlang"},_b={class:"em-mlang__tabs",role:"tablist"},vb=["aria-selected","onClick"],wb={key:0,class:"em-mlang__dot"},al=Te(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const l=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function r(d){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[d])!=null&&f.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[l.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[l.value]:u[l.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",bb,[n.createElementVNode("div",_b,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":l.value===f}]),role:"tab","aria-selected":l.value===f,onClick:p=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",wb,"•")):n.createCommentVNode("",!0)],10,vb))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ae.BSTextArea),{key:0,name:`${e.name}-${l.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`${e.name}-${l.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),Eb=["disabled"],kb={class:"em-field"},Nb={class:"em-field"},xb={class:"em-field"},$b={class:"em-class"},Sb={class:"em-field"},Ib={class:"em-field"},Cb={class:"em-field"},Rb={class:"em-field"},Vb={class:"em-multilang"},Ab={class:"em-multilang"},Tb={class:"em-jpa"},Mb={class:"em-field"},Bb={class:"em-field"},Db={class:"em-field"},Ob={class:"em-swatch"},Lb={class:"em-swatch__row"},Pb=["title","onClick"],td=Te(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(z=>z.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(z=>z.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var z;return We(((z=a.value)==null?void 0:z.style)??void 0)}),r=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],s=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],c=["inherit","STRING","CHAR","INTEGER"],d=z=>z;function u(z){return z==="inherit"?"기본(따름)":z}function f(z){i.value&&o.updateEntity(i.value.modelId,z)}function p(z,J,W){var _;const ge=((_=i.value)==null?void 0:_.table)??{physicalName:""};f(z==="physicalName"?{table:{...ge,physicalName:W}}:{table:{...ge,logicalName:{...ge.logicalName,[J]:W}}})}function m(z){f({description:Object.keys(z).length?z:void 0})}function h(z,J){var W;f({jpaAttrs:{...(W=i.value)==null?void 0:W.jpaAttrs,[z]:J}})}function g(z,J){h(z,J)}const N=n.computed(()=>{var z,J;return((J=(z=i.value)==null?void 0:z.jpaAttrs)==null?void 0:J.discriminatorType)??"inherit"}),b=n.computed(()=>{var z,J;return!((J=(z=i.value)==null?void 0:z.jpaAttrs)!=null&&J.useDiscriminator)});function E(z){h("discriminatorType",z==="inherit"?void 0:z)}function y(z){f({hasPersonalInfo:z})}function C(z){f({superClass:z.trim()||void 0})}function Z(z){f({schema:z.trim()||void 0})}function q(z){f({abstractClass:z})}const te=n.computed(()=>{var z,J;return((J=(z=i.value)==null?void 0:z.declarationOfInterfaces)==null?void 0:J.join(", "))??""});function P(z){const J=z.split(",").map(W=>W.trim()).filter(Boolean);f({declarationOfInterfaces:J.length?J:void 0})}function oe(z){i.value&&o.setEntitySwatch(i.value.modelId,z)}return(z,J)=>{var W,ge,_;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createVNode(an,{controller:n.unref(o),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",kb,[J[12]||(J[12]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":i.value.name,"onUpdate:modelValue":J[0]||(J[0]=w=>f({name:w}))},null,8,["model-value"])]),n.createElementVNode("label",Nb,[J[13]||(J[13]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":i.value.stereotype,items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":J[1]||(J[1]=w=>f({stereotype:w}))},null,8,["model-value"])]),n.createElementVNode("label",xb,[J[14]||(J[14]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":i.value.packageName??"","onUpdate:modelValue":J[2]||(J[2]=w=>f({packageName:w}))},null,8,["model-value"])]),n.createElementVNode("fieldset",$b,[J[17]||(J[17]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",Sb,[J[15]||(J[15]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":i.value.superClass??"","onUpdate:modelValue":J[3]||(J[3]=w=>C(w))},null,8,["model-value"])]),n.createElementVNode("label",Ib,[J[16]||(J[16]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":te.value,"onUpdate:modelValue":J[4]||(J[4]=w=>P(w))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!i.value.abstractClass,"onUpdate:modelValue":J[5]||(J[5]=w=>q(w))},null,8,["model-value"])]),n.createElementVNode("label",Cb,[J[18]||(J[18]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((W=i.value.table)==null?void 0:W.physicalName)??"","onUpdate:modelValue":J[6]||(J[6]=w=>p("physicalName",null,w))},null,8,["model-value"])]),n.createElementVNode("label",Rb,[J[19]||(J[19]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":i.value.schema??"","onUpdate:modelValue":J[7]||(J[7]=w=>Z(w))},null,8,["model-value"])]),n.createElementVNode("fieldset",Vb,[J[20]||(J[20]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).languages.value,w=>{var k,K;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ae.BSTextInput),{name:`ent-logical-${w}`,width:"100%","model-value":((K=(k=i.value.table)==null?void 0:k.logicalName)==null?void 0:K[w])??"","onUpdate:modelValue":V=>p("logicalName",w,V)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",Ab,[J[21]||(J[21]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(al,{multiline:"",name:"ent-desc",languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":i.value.description,"onUpdate:modelValue":m},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",Tb,[J[25]||(J[25]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(s,w=>{var k;return n.createVNode(n.unref(ae.BSCheckbox),{key:w.key,name:`jpa-${w.key}`,class:"em-check",label:w.label,"model-value":!!((k=i.value.jpaAttrs)!=null&&k[w.key]),"onUpdate:modelValue":K=>g(w.key,K)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",Mb,[J[22]||(J[22]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:b.value,"model-value":((ge=i.value.jpaAttrs)==null?void 0:ge.discriminatorColumnName)??"","onUpdate:modelValue":J[8]||(J[8]=w=>h("discriminatorColumnName",w.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Bb,[J[23]||(J[23]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:b.value,"model-value":N.value,items:c,"value-provider":d,"label-provider":u,"onUpdate:modelValue":J[9]||(J[9]=w=>w&&E(w))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Db,[J[24]||(J[24]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:b.value,"model-value":(_=i.value.jpaAttrs)==null?void 0:_.discriminatorLength,"onUpdate:modelValue":J[10]||(J[10]=w=>h("discriminatorLength",w||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!i.value.hasPersonalInfo,"onUpdate:modelValue":y},null,8,["model-value"]),n.createElementVNode("fieldset",Ob,[J[26]||(J[26]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",Lb,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":l.value===null}]),title:"없음",onClick:J[11]||(J[11]=w=>oe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":l.value===w}]),style:n.normalizeStyle({background:n.unref(Sn)(w)}),title:n.unref($n)(w),onClick:k=>oe(w)},null,14,Pb))),128))])])],8,Eb)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a8c7f667"]]),nd=["ko","en","ja","zh"];function zb(e){if(e)for(const t of nd){const o=e[t];if(o)return o}}function ll(e){const t=zb(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function Ub(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:nd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const Hb=["aria-expanded"],Fb=["aria-selected","onClick","onMouseenter"],Gb={key:0,class:"gcc__opt gcc__opt--empty"},od=Te(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=n.ref(),l=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(P=>P.groupCode===o.modelValue)),p=n.computed(()=>f.value?ll(f.value):"");n.watch(p,P=>{c.value||(s.value=P)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:Ub(o.items,s.value));function h(){var oe;const P=(oe=a.value)==null?void 0:oe.getBoundingClientRect();P&&(u.value={left:`${P.left}px`,top:`${P.bottom}px`,width:`${P.width}px`})}function g(){c.value=!0,h(),d.value=Math.max(0,m.value.findIndex(P=>P.groupCode===o.modelValue)),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),document.addEventListener("mousedown",te)}function N(){c.value=!1,window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),document.removeEventListener("mousedown",te)}n.onBeforeUnmount(N);function b(){g(),n.nextTick(()=>{var P;return(P=l.value)==null?void 0:P.select()})}function E(){c.value||g(),d.value=0}function y(P){i("update:modelValue",P.groupCode),s.value=ll(P),N()}function C(){i("update:modelValue",void 0),s.value="",N()}function Z(){s.value.trim()===""?C():(s.value=p.value,N())}function q(P){var oe;if(P.key==="ArrowDown")c.value||g(),d.value=Math.min(d.value+1,m.value.length-1),P.preventDefault();else if(P.key==="ArrowUp")d.value=Math.max(d.value-1,0),P.preventDefault();else if(P.key==="Enter"){const z=m.value[d.value];z&&y(z),P.preventDefault()}else P.key==="Escape"&&(s.value=p.value,N(),(oe=l.value)==null||oe.blur())}function te(P){var z,J;const oe=P.target;!((z=a.value)!=null&&z.contains(oe))&&!((J=r.value)!=null&&J.contains(oe))&&Z()}return(P,oe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":oe[0]||(oe[0]=z=>s.value=z),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:b,onInput:E,onKeydown:q},null,40,Hb),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[c.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:oe[1]||(oe[1]=n.withModifiers(()=>{},["prevent"])),onClick:C},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(z,J)=>(n.openBlock(),n.createElementBlock("li",{key:z.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":J===d.value,"is-selected":z.groupCode===e.modelValue}]),role:"option","aria-selected":z.groupCode===e.modelValue,onMousedown:oe[2]||(oe[2]=n.withModifiers(()=>{},["prevent"])),onClick:W=>y(z),onMouseenter:W=>d.value=J},n.toDisplayString(n.unref(ll)(z)),43,Fb))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Gb,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),Yb=["disabled"],Wb={class:"em-aw__toolbar"},qb={class:"em-aw__count"},Kb={class:"em-aw__scroll"},Xb={class:"em-aw__table"},jb={key:0,class:"c-code"},Zb=["colspan"],Jb={class:"c-del"},Qb={class:"c-flag"},e1={class:"c-flag"},t1={class:"c-flag"},n1={class:"c-flag"},o1={class:"c-flag"},i1={class:"c-flag"},a1={key:0},l1={class:"c-del"},r1=["colspan"],s1={class:"c-del"},c1={class:"em-aw__embed-label"},d1={class:"em-aw__ro"},u1={class:"em-aw__ro"},f1={class:"em-aw__ro"},m1={class:"em-aw__ro"},p1={colspan:"5"},h1=["colspan"],y1={key:0},wi="__OWN__",g1=Te(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(x=>x.modelId===t.entityId)??null),a=n.computed(()=>{var x;return((x=i.value)==null?void 0:x.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var x;return(((x=i.value)==null?void 0:x.attributes)??[]).filter(T=>T.attrType!=="DIVIDER").length}),s=n.computed(()=>oe.value.length?16:15),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(x){return x==="none"?"(없음)":x}const u=x=>x;function f(x,T){i.value&&o.updateAttribute(i.value.modelId,x.modelId,T)}function p(x){return!!x.transient}const m=x=>x.value,h=x=>x.label;function g(x,T){if(!T)return;const R=Z.value.find(re=>re.type===T);if(R){const re=x.dbAttrs[0]??{modelId:x.modelId+".c",physicalName:x.name,dataType:"VARCHAR"};f(x,{type:T,customType:void 0,dbAttrs:[{...re,dataType:R.dataType,length:R.length,scale:R.scale}]});return}f(x,T===Ht?{type:T}:{type:T,customType:void 0})}function N(x,T){f(x,{customType:T.trim()===""?void 0:T})}function b(x,T){const R=x.dbAttrs[0]??{modelId:x.modelId+".c",physicalName:x.name,dataType:"VARCHAR"};f(x,{dbAttrs:[{...R,...T}]})}function E(x,T,R){var re;b(x,{logicalName:{...(re=x.dbAttrs[0])==null?void 0:re.logicalName,[T]:R}})}function y(x){return x.personalInfoAttributeType??"none"}function C(x,T){f(x,{personalInfoAttributeType:T==="none"?void 0:T})}const Z=n.computed(()=>o.predefinedCustomTypeCatalog.value),q=n.computed(()=>o.embeddableCatalog.value);function te(x){var T,R;return((T=x.label)==null?void 0:T.ko)??((R=x.label)==null?void 0:R.en)??x.type}function P(x){!x||!i.value||o.addPredefinedEmbed(i.value.modelId,x)}const oe=n.computed(()=>o.groupCodeCatalog.value);function z(x){var T;return((T=oe.value.find(R=>R.groupCode===x.groupCode))==null?void 0:T.codes)??[]}function J(x){return["none",...z(x)]}function W(x){return x==="none"?"none":x.code}function ge(x){var R,re;if(x==="none")return"(없음)";const T=((R=x.label)==null?void 0:R.ko)??((re=x.label)==null?void 0:re.en);return T?`${x.code} (${T})`:x.code}function _(x,T){i.value&&o.setAttributeGroupCode(i.value.modelId,x.modelId,T)}function w(x,T){f(x,{defaultValue:T==="none"?void 0:T})}function k(x,T){f(x,{defaultValue:T.trim()===""?void 0:T})}function K(x){return x.attrType.startsWith("EMBED")&&x.dbAttrs.length>0}function V(x,T,R){const re=x.dbAttrs.map((I,A)=>{if(A!==T)return I;const Q={...I,...R};for(const $ of Object.keys(R))R[$]===void 0&&delete Q[$];return Q});i.value&&o.setEmbedColumns(i.value.modelId,x.modelId,re)}function H(x,T,R,re){var I;V(x,T,{logicalName:{...(I=x.dbAttrs[T])==null?void 0:I.logicalName,[R]:re}})}function U(x,T){var I,A,Q;if(x.attrType==="EMBED_PREDEF"){const $=(I=o.embeddableCatalog.value.find(D=>D.type===x.type))==null?void 0:I.fields[T];return $?{name:$.name,physicalName:$.physicalName,dataType:$.dataType,length:$.length,shareable:$.shareable,logicalName:$.logicalName}:void 0}const R=(A=x.embedded)==null?void 0:A.embeddableRef;if(!R)return;const re=(Q=o.state.logical.entities.find($=>$.modelId===R))==null?void 0:Q.attributes.flatMap($=>$.dbAttrs)[T];return re?{physicalName:re.physicalName,dataType:re.dataType,length:re.length,scale:re.scale,logicalName:re.logicalName}:void 0}function ce(x,T){var R,re;return((R=U(x,T))==null?void 0:R.dataType)||((re=x.dbAttrs[T])==null?void 0:re.dataType)||""}function he(x,T){var R,re;return((R=U(x,T))==null?void 0:R.length)??((re=x.dbAttrs[T])==null?void 0:re.length)}function me(x,T){var R,re;return((R=U(x,T))==null?void 0:R.scale)??((re=x.dbAttrs[T])==null?void 0:re.scale)}const be=["inherit","true","false"];function ue(x){return x==="inherit"?"기본(따름)":x}function X(x){return(x==null?void 0:x.updatable)===void 0?"inherit":x.updatable?"true":"false"}function F(x,T,R){V(x,T,{updatable:R==="inherit"?void 0:R==="true"})}function le(x,T){b(x,{updatable:T==="inherit"?void 0:T==="true"})}const ve=["inherit","true","false"];function we(x){return x==="inherit"?"기본(따름)":x}function pe(x){return(x==null?void 0:x.insertable)===void 0?"inherit":x.insertable?"true":"false"}function ye(x,T,R){V(x,T,{insertable:R==="inherit"?void 0:R==="true"})}function ee(x,T){b(x,{insertable:T==="inherit"?void 0:T==="true"})}const O=n.computed(()=>{var x;return On(((x=i.value)==null?void 0:x.attributes.flatMap(T=>T.dbAttrs))??[])}),B=n.computed(()=>{var x;return(((x=i.value)==null?void 0:x.attributes)??[]).filter(T=>T.attrType==="NORMAL"&&T.dbAttrs.length===1&&T.dbAttrs[0]).map(T=>({modelId:T.dbAttrs[0].modelId,label:T.dbAttrs[0].physicalName||T.name}))});function Y(){return[wi,...B.value.map(x=>x.modelId)]}function ie(x){if(x===wi)return"전용 컬럼(OWN)";const T=B.value.find(R=>R.modelId===x);return T?`↗ ${T.label} (공유)`:x}function ne(x){return(x==null?void 0:x.sharedColumnRef)??wi}function v(x,T,R){V(x,T,{sharedColumnRef:R===wi?void 0:R})}function S(x){return(x==null?void 0:x.sharedColumnRef)!=null}function G(x){var T;return((T=Vo(x,O.value))==null?void 0:T.physicalName)??""}return(x,T)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Wb,[n.createElementVNode("span",qb,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:T[0]||(T[0]=R=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:T[1]||(T[1]=R=>n.unref(o).addDivider(i.value.modelId))}),q.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:q.value,"value-provider":R=>R.type,"label-provider":te,"onUpdate:modelValue":P},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",Kb,[n.createElementVNode("table",Xb,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[T[2]||(T[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),T[3]||(T[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),T[4]||(T[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),T[5]||(T[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),T[6]||(T[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),T[7]||(T[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),T[8]||(T[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),T[9]||(T[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),T[10]||(T[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),T[11]||(T[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),T[12]||(T[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),T[13]||(T[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),T[14]||(T[14]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),T[15]||(T[15]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),T[16]||(T[16]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),T[17]||(T[17]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),oe.value.length?(n.openBlock(),n.createElementBlock("th",jb,"코드그룹")):n.createCommentVNode("",!0),T[18]||(T[18]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),T[19]||(T[19]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,R=>{var re,I,A,Q,$,D,M,L,j,se,fe;return n.openBlock(),n.createElementBlock(n.Fragment,{key:R.modelId},[R.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(R.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${R.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":R.name,"onUpdate:modelValue":de=>f(R,{name:de})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,Zb),n.createElementVNode("td",Jb,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:de=>n.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])])],2)):K(R)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(R.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${R.modelId}`,width:"100%",placeholder:"이름","model-value":R.name,"onUpdate:modelValue":de=>f(R,{name:de})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${R.modelId}`,width:"100%",disabled:"","model-value":R.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:oe.value.length?15:14,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(R.dbAttrs.length)+"개",9,r1),n.createElementVNode("td",s1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:de=>n.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(R.dbAttrs,(de,xe)=>{var Re,Se,Ae,tt,Ut,_e,Le;return n.openBlock(),n.createElementBlock("tr",{key:de.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",c1,"↳ "+n.toDisplayString(((Re=U(R,xe))==null?void 0:Re.name)??((Se=U(R,xe))==null?void 0:Se.physicalName)??`컬럼 ${xe+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",d1,n.toDisplayString(ce(R,xe)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${de.modelId}`,width:"100%",placeholder:((tt=(Ae=U(R,xe))==null?void 0:Ae.logicalName)==null?void 0:tt.ko)??"논리명","model-value":((Ut=de.logicalName)==null?void 0:Ut.ko)??"","onUpdate:modelValue":He=>H(R,xe,"ko",He)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${de.modelId}`,width:"100%",disabled:S(de),placeholder:((_e=U(R,xe))==null?void 0:_e.physicalName)??"컬럼","model-value":S(de)?G(de):de.physicalName,"onUpdate:modelValue":He=>V(R,xe,{physicalName:He})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(an,{controller:n.unref(o),"ref-id":de.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",u1,n.toDisplayString(ce(R,xe)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",f1,n.toDisplayString(he(R,xe)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",m1,n.toDisplayString(me(R,xe)??""),1)]),n.createElementVNode("td",p1,[(Le=U(R,xe))!=null&&Le.shareable?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":ne(de),items:Y(),"value-provider":u,"label-provider":ie,"onUpdate:modelValue":He=>He&&v(R,xe,He)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(de),"model-value":S(de)?"false":pe(de),items:ve,"value-provider":u,"label-provider":we,"onUpdate:modelValue":He=>He&&ye(R,xe,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(de),"model-value":S(de)?"false":X(de),items:be,"value-provider":u,"label-provider":ue,"onUpdate:modelValue":He=>He&&F(R,xe,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:oe.value.length?3:2},null,8,h1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(R.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${R.modelId}`,width:"100%",placeholder:"이름","model-value":R.name,"onUpdate:modelValue":de=>f(R,{name:de})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${R.modelId}`,width:"100%",placeholder:"타입",disabled:!!R.groupCode,items:n.unref(ql)(R.type,Z.value),"value-provider":m,"label-provider":h,"model-value":R.type,"onUpdate:modelValue":de=>g(R,de)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),R.type===n.unref(Ht)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${R.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":R.customType??"","onUpdate:modelValue":de=>N(R,de)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${R.modelId}`,width:"100%",placeholder:"논리명","model-value":((I=(re=R.dbAttrs[0])==null?void 0:re.logicalName)==null?void 0:I.ko)??"","onUpdate:modelValue":de=>E(R,"ko",de)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${R.modelId}`,width:"100%",placeholder:"컬럼",disabled:p(R),"model-value":((A=R.dbAttrs[0])==null?void 0:A.physicalName)??"","onUpdate:modelValue":de=>b(R,{physicalName:de})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(an,{controller:n.unref(o),"ref-id":(Q=R.dbAttrs[0])==null?void 0:Q.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${R.modelId}`,width:"100%",placeholder:"dataType",disabled:p(R),items:n.unref(Gl)((($=R.dbAttrs[0])==null?void 0:$.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(na),"model-value":((D=R.dbAttrs[0])==null?void 0:D.dataType)??"","onUpdate:modelValue":de=>de&&b(R,{dataType:de})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${R.modelId}`,width:"100%",placeholder:"len",disabled:p(R),"model-value":(M=R.dbAttrs[0])==null?void 0:M.length,"onUpdate:modelValue":de=>b(R,{length:de||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${R.modelId}`,width:"100%",placeholder:"scale",disabled:p(R),"model-value":(L=R.dbAttrs[0])==null?void 0:L.scale,"onUpdate:modelValue":de=>b(R,{scale:de||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",Qb,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${R.modelId}`,"model-value":R.identifier,disabled:a.value||p(R),"onUpdate:modelValue":de=>f(R,{identifier:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",e1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${R.modelId}`,"model-value":R.notNull,disabled:p(R),"onUpdate:modelValue":de=>f(R,{notNull:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",t1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${R.modelId}`,"model-value":!!((j=R.dbAttrs[0])!=null&&j.unique),disabled:p(R),"onUpdate:modelValue":de=>b(R,{unique:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${R.modelId}`,"model-value":!!((se=R.dbAttrs[0])!=null&&se.autoIncrement),disabled:p(R)||!R.identifier,"onUpdate:modelValue":de=>b(R,{autoIncrement:de})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${R.modelId}`,"model-value":!!R.transient,disabled:R.identifier,"onUpdate:modelValue":de=>f(R,{transient:de||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",i1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${R.modelId}`,"model-value":!!((fe=R.dbAttrs[0])!=null&&fe.multiValue),disabled:p(R),"onUpdate:modelValue":de=>b(R,{multiValue:de||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${R.modelId}`,width:"100%",disabled:p(R),"model-value":pe(R.dbAttrs[0]),items:ve,"value-provider":u,"label-provider":we,"onUpdate:modelValue":de=>de&&ee(R,de)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${R.modelId}`,width:"100%",disabled:p(R),"model-value":X(R.dbAttrs[0]),items:be,"value-provider":u,"label-provider":ue,"onUpdate:modelValue":de=>de&&le(R,de)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":y(R),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":de=>de&&C(R,de)},null,8,["model-value","onUpdate:modelValue"])]),oe.value.length?(n.openBlock(),n.createElementBlock("td",a1,[n.createVNode(od,{"model-value":R.groupCode,items:oe.value,"onUpdate:modelValue":de=>_(R,de)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[z(R).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":R.defaultValue??"none",items:J(R),"value-provider":W,"label-provider":ge,"onUpdate:modelValue":de=>de&&w(R,de)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${R.modelId}`,width:"100%",placeholder:"기본값","model-value":R.defaultValue??"","onUpdate:modelValue":de=>k(R,de)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",l1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:de=>n.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",y1,[...T[20]||(T[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,Yb)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-eaf1fd75"]]),b1=["disabled"],_1={class:"em-idxw__list"},v1={class:"em-idxw__list-head"},w1=["onClick"],E1={class:"em-idxw__item-name"},k1={key:0,class:"em-idxw__badge"},N1={class:"em-idxw__item-cnt"},x1={key:0,class:"em-idxw__empty"},$1={key:0,class:"em-idxw__edit"},S1={class:"em-idxw__form"},I1={class:"em-field em-idxw__name"},C1={class:"em-field"},R1=["value"],V1={class:"em-idxw__transfer"},A1={class:"em-idxw__pane"},T1={class:"em-idxw__pane-head"},M1={class:"em-idxw__cols"},B1=["onClick"],D1={key:0,class:"em-idxw__empty"},O1={class:"em-idxw__arrows"},L1={class:"em-idxw__pane"},P1={class:"em-idxw__pane-head"},z1={class:"em-idxw__cols"},U1={class:"em-idxw__col-name"},H1={class:"em-idxw__col-ops"},F1=["disabled","onClick"],G1=["disabled","onClick"],Y1=["onClick"],W1={key:0,class:"em-idxw__empty"},q1={key:1,class:"em-idxw__edit em-idxw__edit--empty"},K1=Te(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(q=>q.modelId===t.entityId)??null),a=n.computed(()=>{var q;return((q=i.value)==null?void 0:q.indexes)??[]}),l=n.computed(()=>{var q;return((q=i.value)==null?void 0:q.attributes)??[]}),r=n.ref(null);n.watch(a,q=>{var te;q.some(P=>P.modelId===r.value)||(r.value=((te=q[0])==null?void 0:te.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(q=>q.modelId===r.value)??null),c=n.computed(()=>{var q;return new Set(((q=s.value)==null?void 0:q.columns.map(te=>te.columnRef))??[])}),d=n.computed(()=>l.value.filter(q=>!c.value.has(q.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(q){var P;const te=(P=q.dbAttrs[0])==null?void 0:P.physicalName;return te&&te!==q.name?`${q.name} (${te})`:q.name}function p(q){const te=l.value.find(P=>P.modelId===q);return te?f(te):q}function m(q,te){i.value&&o.updateIndex(i.value.modelId,q,te)}function h(){var te;if(!i.value)return;const q=Ce();o.addIndex(i.value.modelId,{modelId:q,name:`idx_${(((te=i.value.indexes)==null?void 0:te.length)??0)+1}`,unique:!1,columns:[]}),r.value=q}function g(q){i.value&&o.removeIndex(i.value.modelId,q)}function N(q){s.value&&m(s.value.modelId,{parameters:q.trim()===""?void 0:q})}function b(q){const te=new Set(u.value);te.has(q)?te.delete(q):te.add(q),u.value=te}function E(){const q=s.value;if(!q||!u.value.size)return;const te=[...u.value].map(P=>({columnRef:P,descending:!1}));m(q.modelId,{columns:[...q.columns,...te]}),u.value=new Set}function y(q){const te=s.value;te&&m(te.modelId,{columns:te.columns.filter((P,oe)=>oe!==q)})}function C(q,te){const P=s.value;P&&m(P.modelId,{columns:P.columns.map((oe,z)=>z===q?{...oe,descending:te}:oe)})}function Z(q,te){const P=s.value;if(!P)return;const oe=q+te;if(oe<0||oe>=P.columns.length)return;const z=[...P.columns];[z[q],z[oe]]=[z[oe],z[q]],m(P.modelId,{columns:z})}return(q,te)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",_1,[n.createElementVNode("div",v1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:h})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":P.modelId===r.value}]),onClick:oe=>r.value=P.modelId},[n.createElementVNode("span",E1,n.toDisplayString(P.name||"(이름 없음)"),1),P.unique?(n.openBlock(),n.createElementBlock("span",k1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",N1,n.toDisplayString(P.columns.length),1)],10,w1))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",x1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",$1,[n.createElementVNode("div",S1,[n.createElementVNode("label",I1,[te[4]||(te[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":te[0]||(te[0]=P=>m(s.value.modelId,{name:P}))},null,8,["model-value"]),n.createVNode(an,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":te[1]||(te[1]=P=>m(s.value.modelId,{unique:P}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:te[2]||(te[2]=P=>g(s.value.modelId))})]),n.createElementVNode("label",C1,[te[5]||(te[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:te[3]||(te[3]=P=>N(P.target.value))},null,40,R1)]),n.createElementVNode("div",V1,[n.createElementVNode("div",A1,[n.createElementVNode("div",T1,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",M1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>(n.openBlock(),n.createElementBlock("li",{key:P.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(P.modelId)}]),onClick:oe=>b(P.modelId)},n.toDisplayString(f(P)),11,B1))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",D1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",O1,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:E},null,8,["disabled"])]),n.createElementVNode("div",L1,[n.createElementVNode("div",P1,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",z1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(P,oe)=>(n.openBlock(),n.createElementBlock("li",{key:oe,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",U1,n.toDisplayString(p(P.columnRef)),1),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${oe}`,class:"em-check",label:"DESC","model-value":P.descending,"onUpdate:modelValue":z=>C(oe,z)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",H1,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:oe===0,onClick:z=>Z(oe,-1)},"↑",8,F1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:oe===s.value.columns.length-1,onClick:z=>Z(oe,1)},"↓",8,G1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:z=>y(oe)},"✕",8,Y1)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",W1,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",q1,"인덱스를 선택하거나 추가하세요."))],8,b1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),X1={class:"em-op-src"},j1={class:"em-op-src__actions"},id=Te(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",X1,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",j1,[n.createVNode(n.unref(ae.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),Z1=["disabled"],J1={class:"em-ow__toolbar"},Q1={class:"em-ow__count"},e_={class:"em-ow__scroll"},t_={class:"em-ow__table"},n_={class:"c-del"},o_={key:0},i_=Te(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModal(),a=n.computed(()=>o.state.logical.entities.find(h=>h.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["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 s(h){return h==="none"?"(없음)":h}const c=h=>h;function d(h,g){a.value&&o.updateOperation(a.value.modelId,h.modelId,g)}function u(h,g,N){d(h,{description:{...h.description,[g]:N}})}function f(h){return h.personalInfoAttributeType??"none"}function p(h,g){d(h,{personalInfoAttributeType:g==="none"?void 0:g})}function m(h){i.openModal({component:id,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:g=>d(h,{sourceCode:g})}})}return(h,g)=>{var N,b;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",J1,[n.createElementVNode("span",Q1,"오퍼레이션 ("+n.toDisplayString(((N=a.value.operations)==null?void 0:N.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=E=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",e_,[n.createElementVNode("table",t_,[g[2]||(g[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],E=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:E.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${E.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":E.name,"onUpdate:modelValue":C=>d(E,{name:C})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":E.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":C=>C&&d(E,{visibility:C})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${E.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=E.description)==null?void 0:y.ko)??"","onUpdate:modelValue":C=>u(E,"ko",C)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(E),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":C=>C&&p(E,C)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:E.sourceCode?"본문 ●":"본문",onClick:C=>m(E)},null,8,["caption","onClick"])]),n.createElementVNode("td",n_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:C=>n.unref(o).removeOperation(a.value.modelId,E.modelId)},null,8,["onClick"])])])}),128)),(b=a.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",o_,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,Z1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),a_={class:"em-detail__tabs"},l_=["onClick"],r_=Te(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const l=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`엔티티 — ${((d=a.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",a_,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,l_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(td,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(g1,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(K1,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(i_,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Ei(e,t,o){e.openModal({component:r_,bind:{controller:n.markRaw(t),entityId:o}})}const ad=()=>crypto.randomUUID(),s_=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,c_=e=>e&&e[0].toLowerCase()+e.slice(1),d_=e=>e&&e[0].toUpperCase()+e.slice(1),u_=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function f_(e,t){return c_(e)+d_(t)}function m_(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=f_(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:a,notNull:a,dbAttrs:r.dbAttrs.map(c=>({physicalName:u_(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ki=(e,t)=>`${e}::${t}`;function p_(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||s.length!==l.length||s.scale!==l.scale}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function h_(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Ni(e,t,o=ad){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===t);if(!a)return i;const l=e.associations.filter(f=>f.end2.entityRef===t),r=a.stereotype==="JPA_EMBEDDABLE"?[]:l.flatMap(f=>m_(e,f)),s=new Map(r.map(f=>[ki(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ki(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=ki(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,p)=>Math.max(f,p.order),-1)+1;for(const f of r){const p=ki(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(h_(f,u++,o));else{const h=p_(m,f,o);h&&i.update.push({attributeId:m.modelId,patch:h})}}return i}function y_(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function g_(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function b_(e,t,o=ad){const i=new Map,a=g_(e),l=new Set,r=[t];for(;r.length;){const s=r.shift();if(l.has(s))continue;l.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=Ni(a,d,o);if(s_(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(p=>p.modelId===d);f&&y_(f,u),l.has(d)||r.push(d)}}return i}function __(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Ce(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const l=Ce();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Ce()}for(const a of t.indexes??[]){a.modelId=Ce();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const ln=Symbol("editorController");function ld(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function xi(e,t){const o=[];for(const i of t.remove)o.push(Vt(e,i));for(const i of t.update)o.push(Wt(e,i.attributeId,i.patch));for(const i of t.add)o.push(vt(e,i));return o}function In(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Cn(e,t){const o=[];for(const[i,a]of b_(e,t,Ce))o.push(...xi(i,a));return o}function rd(e,t,o){const i=new Set(o.remove);return In(e,t,a=>[...a.filter(l=>!i.has(l.modelId)).map(l=>{const r=o.update.find(s=>s.attributeId===l.modelId);return r?{...l,...r.patch}:l}),...o.add])}function rl(e,t){const o=Ni(e,t,Ce),i=xi(t,o),a=rd(e,t,o);return i.push(...Cn(a,t)),i}function sd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Ce()}))}function v_(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,h)=>Math.max(m,h.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;a={modelId:Ce(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Ce(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(vt(t,a))}const l=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const p=e.associations.find(N=>N.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,h=m?p.end1:p.end2,g=m?p.end2:p.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:h.multiplicity,navigable:h.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(p=>p.ownerId===u.modelId).map(p=>p.dispId));return f.size?{...u,attributes:u.attributes.filter(p=>!f.has(p.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(p=>p.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=Ni(r,t,Ce);for(const u of l){const f=s.add.find(p=>{var m;return((m=p.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(Vt(u.ownerId,u.dispId)),i.push(Oo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...xi(t,s));const c=rd(r,t,s);return i.push(...Cn(c,t)),i}function w_(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(y=>y.modelId===c);if(!d||d.attributes.some(y=>{var C;return((C=y.embedded)==null?void 0:C.associationRef)===l.modelId}))continue;const u=Ce(),f=d.attributes.reduce((y,C)=>Math.max(y,C.order),-1)+1,p=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let h=m;for(let y=2;p.has(h);y++)h=`${m}${y}`;const g=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Ce()})),N={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(vt(c,N));const b=r?"end2":"end1",E=r?"end1":"end2";i.push(Oo(l.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Ce()},[E]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function E_(e=ld(),t={}){var ie,ne;const o=n.reactive(e);let i=new sa(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),h=n.ref(!1),g=n.ref(!1),N=n.ref(0),b=n.ref(((ie=t.meta)==null?void 0:ie.schemaVersion)??1),E=n.ref(((ne=t.meta)==null?void 0:ne.opWriteEnabled)??!1),y=n.computed(()=>b.value>=2&&E.value),C=t.historyTransport,Z=n.computed(()=>y.value&&C!==void 0),q=t.restoreTransport,te=n.ref(0),P=n.computed(()=>y.value&&z.value&&q!==void 0);async function oe(v){if(!q||!z.value)return{ok:!1,reason:"unavailable"};const S=await q(v);return S.ok&&te.value++,S}const z=n.ref(!(b.value>=2&&E.value===!1)),J=n.ref("LOGICAL_PHYSICAL"),W=n.ref("straight"),ge=n.ref(!0),_=n.ref(!0),w=n.ref(null),k=n.computed(()=>{var v;return((v=w.value)==null?void 0:v.kind)==="attribute"?{entityId:w.value.entityId,attrId:w.value.anchor}:null}),K=n.computed(()=>{var v;return((v=w.value)==null?void 0:v.kind)==="attribute"?w.value.ids:[]}),V=n.computed(()=>{var v,S;return((v=w.value)==null?void 0:v.kind)==="entity"?w.value.id:((S=w.value)==null?void 0:S.kind)==="attribute"?w.value.entityId:null}),H=n.ref(null);let U=0;const ce=n.ref(null),he=n.ref(null);let me=t.meta;function be(){i.onChange(()=>{m.value=i.canUndo,h.value=i.canRedo,g.value=i.isDirty,N.value++})}be();let ue=null,X=null;function F(){X==null||X(),X=null,ue=null}function le(){if(F(),!y.value||!t.opTransport)return;const v=new Lr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:S=>{z.value=!1,he.value=S}});v.seed((me==null?void 0:me.revSeed)??{}),X=v.attach(i),ue=v}le();const ve=n.computed(()=>Ml(o.logical,o.layout)),we=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:a.value})),pe=n.computed(()=>jl(o.logical,we.value)),ye=n.computed(()=>{const v=new Map;for(const S of pe.value){if(!S.targetRef)continue;const G=v.get(S.targetRef);G?G.push(S):v.set(S.targetRef,[S])}return v}),ee=v=>{z.value&&i.execute(v)},O=(v,S,G)=>{const x=Wt(v,S,G),T=In(o.logical,v,re=>re.map(I=>I.modelId===S?{...I,...G}:I)),R=Cn(T,v);ee(R.length?De("속성 수정",[x,...R]):x)};function B(v){const S=v.map(A=>o.layout.entityLayouts.find(Q=>Q.entityRef===A)).filter(A=>!!A);if(!S.length)return{location:{x:40,y:40},size:{width:400,height:300}};let G=1/0,x=1/0,T=-1/0,R=-1/0;for(const A of S){const Q=A.geo.size.width||220,$=A.geo.size.height||140;G=Math.min(G,A.geo.location.x),x=Math.min(x,A.geo.location.y),T=Math.max(T,A.geo.location.x+Q),R=Math.max(R,A.geo.location.y+$)}const re=40,I=28;return{location:{x:G-re,y:x-re-I},size:{width:T-G+re*2,height:R-x+re*2+I}}}function Y(v,S,G){var A;const x=o.layout.groupLayouts.find(Q=>Q.groupRef===v),T=(x==null?void 0:x.geo.location)??S,R=S.x-T.x,re=S.y-T.y,I=[cr(v,S),...G.map(Q=>hn(Q.id,Q.location))];if(R||re){const Q=new Set(((A=o.logical.groups.find($=>$.modelId===v))==null?void 0:A.memberEntityRefs)??[]);for(const $ of o.logical.associations){if(!Q.has($.end1.entityRef)||!Q.has($.end2.entityRef))continue;const D=o.layout.associationLayouts.find(M=>M.associationRef===$.modelId);D&&D.waypoints.length&&I.push(Er($.modelId,R,re))}for(const $ of(x==null?void 0:x.memberNoteRefs)??[]){const D=o.layout.notes.find(M=>M.modelId===$);D&&I.push(Hn($,{x:D.geo.location.x+R,y:D.geo.location.y+re}))}}return I}return{state:o,resolved:ve,issues:pe,issuesByRef:ye,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:h,dirty:g,revision:N,editable:z,schemaVersion:b,opWriteEnabled:E,opMode:y,opConflict:he,historyTransport:C,historyAvailable:Z,restoreTransport:q,restoreAvailable:P,restoreToSeq:oe,reloadRequest:te,displayMode:J,routingMode:W,showGrid:ge,showMinimap:_,selection:w,selectedAttr:k,selectedAttrIds:K,inspectedEntityId:V,focusRequest:H,clipboard:ce,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(v){z.value=v&&y.value},setEmbeddableCatalog(v){a.value=v},setGroupCodeCatalog(v){l.value=v},setPredefinedCustomTypeCatalog(v){r.value=v},selectAttribute(v,S,G="replace"){const x=w.value,T=(x==null?void 0:x.kind)==="attribute"&&x.entityId===v;if(G==="replace"||!T){w.value={kind:"attribute",entityId:v,ids:[S],anchor:S};return}if(G==="toggle"){const D=x.ids.includes(S),M=D?x.ids.filter(j=>j!==S):[...x.ids,S];if(!M.length){w.value=null;return}const L=D&&x.anchor===S?M[M.length-1]:D?x.anchor:S;w.value={kind:"attribute",entityId:v,ids:M,anchor:L};return}const R=o.logical.entities.find(D=>D.modelId===v),re=[...(R==null?void 0:R.attributes)??[]].sort((D,M)=>D.order-M.order).map(D=>D.modelId),I=re.indexOf(x.anchor),A=re.indexOf(S);if(I<0||A<0){w.value={kind:"attribute",entityId:v,ids:[S],anchor:S};return}const[Q,$]=I<=A?[I,A]:[A,I];w.value={kind:"attribute",entityId:v,ids:re.slice(Q,$+1),anchor:x.anchor}},moveAttributeFocus(v){const S=w.value;if((S==null?void 0:S.kind)!=="attribute")return!1;const G=o.logical.entities.find(re=>re.modelId===S.entityId);if(!G||!G.attributes.length)return!1;const x=G.attributes.findIndex(re=>re.modelId===S.anchor);if(x<0)return!1;const T=Math.min(Math.max(x+v,0),G.attributes.length-1);if(T===x)return!0;const R=G.attributes[T].modelId;return w.value={kind:"attribute",entityId:S.entityId,ids:[R],anchor:R},!0},nudgeSelectedAttributes(v){const S=w.value;if((S==null?void 0:S.kind)!=="attribute")return!1;const G=o.logical.entities.find(D=>D.modelId===S.entityId);if(!G)return!1;const x=G.attributes,T=new Set(S.ids),R=x.map((D,M)=>T.has(D.modelId)?M:-1).filter(D=>D>=0);if(!R.length)return!1;const re=Math.min(...R),I=x.filter(D=>!T.has(D.modelId)),A=x.slice(0,re).filter(D=>!T.has(D.modelId)).length;let Q;if(v<0){if(A<=0)return!0;Q=A-1}else{if(I.length-A<=0)return!0;Q=A+1}const $=x.filter(D=>T.has(D.modelId)).map(D=>D.modelId);return ee(pa(S.entityId,$,Q)),!0},deleteSelection(){if(!z.value)return!1;const v=w.value;if(!v)return!1;if(v.kind==="attribute"){const S=v.ids;if(!S.length)return!1;S.length===1?ee(Vt(v.entityId,S[0])):ee(De("속성 삭제",S.map(G=>Vt(v.entityId,G))))}else v.kind==="entity"?ee(da(v.id)):v.kind==="note"?ee(ga(v.id)):v.kind==="group"?ee(ma(v.id)):ee(ya(v.id));return w.value=null,!0},nudgeNodes(v,S,G){if(!v.length||S===0&&G===0)return!1;const x=new Set(o.logical.entities.map(Q=>Q.modelId)),T=new Set(o.logical.groups.map(Q=>Q.modelId)),R=new Set(o.layout.notes.map(Q=>Q.modelId)),re=new Set;for(const Q of v){if(!T.has(Q))continue;const $=o.logical.groups.find(D=>D.modelId===Q);for(const D of($==null?void 0:$.memberEntityRefs)??[])re.add(D)}const I=[],A=[];for(const Q of v)if(T.has(Q)){const $=o.layout.groupLayouts.find(j=>j.groupRef===Q);if(!$)continue;const D=o.logical.groups.find(j=>j.modelId===Q),M=((D==null?void 0:D.memberEntityRefs)??[]).map(j=>{var fe;const se=((fe=o.layout.entityLayouts.find(de=>de.entityRef===j))==null?void 0:fe.geo.location)??{x:0,y:0};return{id:j,location:{x:se.x+S,y:se.y+G}}}),L={x:$.geo.location.x+S,y:$.geo.location.y+G};I.push(De("그룹 이동",Y(Q,L,M))),A.push("g:"+Q)}else if(x.has(Q)){if(re.has(Q))continue;const $=o.layout.entityLayouts.find(D=>D.entityRef===Q);if(!$)continue;I.push(hn(Q,{x:$.geo.location.x+S,y:$.geo.location.y+G})),A.push("e:"+Q)}else if(R.has(Q)){const $=o.layout.notes.find(D=>D.modelId===Q);if(!$)continue;I.push(Hn(Q,{x:$.geo.location.x+S,y:$.geo.location.y+G})),A.push("n:"+Q)}return I.length?(ee(De("이동",I,"nudge:"+A.sort().join(","))),!0):!1},requestFocus(v){H.value={id:v,nonce:++U}},undo:()=>{z.value&&i.undo()},redo:()=>{z.value&&i.redo()},markSaved:()=>{z.value&&(ue==null||ue.flush(),i.markSavePoint())},loadDiagram(v,S){F(),o.logical=v.logical,o.layout=v.layout,i=new sa(o),be(),b.value=(S==null?void 0:S.schemaVersion)??1,E.value=(S==null?void 0:S.opWriteEnabled)??!1,z.value=!(b.value>=2&&E.value===!1),me=S,he.value=null,w.value=null,m.value=i.canUndo,h.value=i.canRedo,g.value=i.isDirty,le()},flush(){ue==null||ue.flush()},whenOpsSettled(){return(ue==null?void 0:ue.whenSettled())??Promise.resolve()},addEntity(v="NewEntity",S={x:80,y:80}){const G=Ce(),x={modelId:G,name:v,stereotype:"JPA_ENTITY",table:{physicalName:v.toLowerCase()},attributes:[{modelId:Ce(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Ce(),physicalName:"id",dataType:"BIGINT"}]}]};return ee(ca(x,{location:{...S},size:{width:220,height:140}})),G},renameEntity(v,S){ee(or(v,S))},updateEntity(v,S){const G=nr(v,S),x=o.logical.entities.find(re=>re.modelId===v),T=S.stereotype==="JPA_EMBEDDABLE"&&!!x&&x.stereotype!=="JPA_EMBEDDABLE",R=!!S.stereotype&&S.stereotype!=="JPA_EMBEDDABLE"&&!!x&&x.stereotype==="JPA_EMBEDDABLE";if(T&&x){const re=x.attributes.filter(D=>D.identifier&&!D.derivedFrom).map(D=>Wt(v,D.modelId,{identifier:!1})),I=In({...o.logical,entities:o.logical.entities.map(D=>D.modelId===v?{...D,stereotype:"JPA_EMBEDDABLE"}:D)},v,D=>D.map(M=>M.identifier&&!M.derivedFrom?{...M,identifier:!1}:M)),A=rl(I,v),Q=w_(o.logical,v),$=[G,...re,...A,...Q];ee($.length>1?De("임베더블 변환",$):G);return}if(R){const re=v_(o.logical,v),I=[G,...re];ee(I.length>1?De("엔터티 전환",I):G);return}ee(G)},moveEntity(v,S){ee(hn(v,S))},resizeEntity(v,S){ee(ir(v,S))},removeEntity(v){ee(da(v))},setEntitySwatch(v,S){ee(ar(v,S))},setEntityCollapsed(v,S){ee(lr(v,S))},collapseAll(){ee(ua(!0))},expandAll(){ee(ua(!1))},setAttributeSwatch(v,S,G){ee(Bo(v,S,G))},dragGroup(v,S,G){ee(De("그룹 이동",Y(v,S,G)))},resizeGroup(v,S){ee(dr(v,S))},setGroupSwatch(v,S){ee(ur(v,S))},updateGroup(v,S){ee(rr(v,S))},createGroup(v,S){if(!v.length)return null;const G=[];for(const R of o.logical.groups)for(const re of v)R.memberEntityRefs.includes(re)&&G.push(Do(R.modelId,re));const x=Ce(),T={modelId:x,name:S?{ko:S}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...v]};return G.push(fa(T,B(v))),ee(De("그룹 생성",G)),w.value=null,x},addEmptyGroup(v,S){const G=Ce();return ee(fa({modelId:G,name:S?{ko:S}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...v},size:{width:360,height:260}})),G},removeGroup(v){ee(ma(v))},dropEntity(v,S,G){var R;const x=((R=o.logical.groups.find(re=>re.memberEntityRefs.includes(v)))==null?void 0:R.modelId)??null,T=[hn(v,S)];x!==G&&(x&&T.push(Do(x,v)),G&&T.push(sr(G,v))),ee(De("이동",T))},ungroupEntity(v){const S=o.logical.groups.find(G=>G.memberEntityRefs.includes(v));S&&ee(Do(S.modelId,v))},dropNote(v,S,G){var R;const x=((R=o.layout.groupLayouts.find(re=>{var I;return(I=re.memberNoteRefs)==null?void 0:I.includes(v)}))==null?void 0:R.groupRef)??null,T=[Hn(v,S)];x!==G&&(x&&T.push(Rr(x,v)),G&&T.push(Cr(G,v))),ee(De("이동",T))},addPredefinedEmbed(v,S){const G=a.value.find(A=>A.type===S),x=o.logical.entities.find(A=>A.modelId===v);if(!G||!x)return;const T=x.attributes.reduce((A,Q)=>Math.max(A,Q.order),-1)+1,R=Ce(),re=G.fields.map(()=>({modelId:Ce(),physicalName:"",dataType:""})),I={modelId:R,name:G.defaultName,type:G.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:T,dbAttrs:re};return ee(vt(v,I)),R},addAttribute(v,S={}){const G=o.logical.entities.find($=>$.modelId===v),x=G?G.attributes.length:0,T=S.modelId??Ce(),R=S.name??`field${x}`,re={modelId:T,name:R,type:S.type??Yl,attrType:S.attrType??"NORMAL",identifier:S.identifier??!1,notNull:S.notNull??!1,order:x,dbAttrs:S.dbAttrs??[{modelId:Ce(),physicalName:R,dataType:"VARCHAR",length:255}],...S},I=vt(v,re),A=In(o.logical,v,$=>[...$,re]),Q=Cn(A,v);return ee(Q.length?De("속성 추가",[I,...Q]):I),T},addDivider(v){const S=o.logical.entities.find(R=>R.modelId===v),G=S?S.attributes.length:0,x=Ce();return ee(vt(v,{modelId:x,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:G,dbAttrs:[]})),x},updateAttribute(v,S,G){O(v,S,G)},setAttributeGroupCode(v,S,G){O(v,S,{groupCode:G,type:G?Ro:Yl})},setEmbedColumns(v,S,G){var A,Q;const x=Wt(v,S,{dbAttrs:G}),T=(A=o.logical.entities.find($=>$.modelId===v))==null?void 0:A.attributes.find($=>$.modelId===S),R=(Q=T==null?void 0:T.embedded)==null?void 0:Q.associationRef,re=R?o.logical.associations.find($=>$.modelId===R):void 0,I=[];re&&R&&(re.end1.legacyEmbedRaw&&I.push(yn(R,"end1",{legacyEmbedRaw:void 0})),re.end2.legacyEmbedRaw&&I.push(yn(R,"end2",{legacyEmbedRaw:void 0}))),ee(I.length?De("임베드 컬럼 수정",[x,...I]):x)},removeAttribute(v,S){const G=Vt(v,S),x=In(o.logical,v,R=>R.filter(re=>re.modelId!==S)),T=Cn(x,v);ee(T.length?De("속성 삭제",[G,...T]):G)},removeAttributes(v,S){var re;if(!S.length)return;const G=S.map(I=>Vt(v,I)),x=new Set(S),T=In(o.logical,v,I=>I.filter(A=>!x.has(A.modelId))),R=[...G,...Cn(T,v)];ee(R.length===1?R[0]:De("속성 삭제",R)),((re=w.value)==null?void 0:re.kind)==="attribute"&&w.value.entityId===v&&(w.value=null)},setAttributeSwatches(v,S,G){S.length&&(S.length===1?ee(Bo(v,S[0],G)):ee(De("속성 색상",S.map(x=>Bo(v,x,G)))))},reorderAttributes(v,S,G){S.length&&ee(pa(v,S,G))},addIndex(v,S){ee(gr(v,S))},updateIndex(v,S,G){ee(br(v,S,G))},removeIndex(v,S){ee(_r(v,S))},addOperation(v,S={}){var re;const G=o.logical.entities.find(I=>I.modelId===v),x=((re=G==null?void 0:G.operations)==null?void 0:re.length)??0,T=S.modelId??Ce(),R={modelId:T,name:S.name??`method${x}`,visibility:S.visibility??"PACKAGE",order:x,...S};return ee(fr(v,R)),T},updateOperation(v,S,G){ee(mr(v,S,G))},removeOperation(v,S){ee(pr(v,S))},reorderOperations(v,S,G){S.length&&ee(hr(v,S,G))},setOperationSwatch(v,S,G){ee(yr(v,S,G))},addAssociation(v,S,G,x){const T=Ce(),R={modelId:T,end1:{entityRef:v,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:G},end2:{entityRef:S,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},re={...o.logical,associations:[...o.logical.associations,R]},I=Ni(re,S,Ce),A=I.add[0];A&&(R.end2.attributeRef=A.modelId);const Q={associationRef:T,waypoints:[],sourceColumnRef:G,targetColumnRef:(A==null?void 0:A.modelId)??x},$=ha(R,Q),D=xi(S,I);return ee(D.length?De("관계 추가",[$,...D]):$),T},addEmbedAssociation(v,S){const G=o.logical.entities.find(fe=>fe.modelId===v),x=o.logical.entities.find(fe=>fe.modelId===S);if(!G||!x||x.stereotype!=="JPA_EMBEDDABLE")return;const T=Ce(),R=Ce(),re=Ce(),I=G.attributes.reduce((fe,de)=>Math.max(fe,de.order),-1)+1,A=sd(x),Q=fe=>fe&&fe.charAt(0).toLowerCase()+fe.slice(1),$=new Set(G.attributes.map(fe=>fe.name)),D=Q(x.name);let M=D;for(let fe=2;$.has(M);fe++)M=`${D}${fe}`;const L={modelId:R,name:M,type:x.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:I,dbAttrs:A,embedded:{associationRef:T,embeddableRef:S}},j={modelId:T,end1:{entityRef:v,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:re},end2:{entityRef:S,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:R}},se={associationRef:T,waypoints:[],sourceColumnRef:R,targetColumnRef:void 0};return ee(De("임베드 추가",[vt(v,L),ha(j,se)])),T},setEmbedCollectionMode(v,S){const G=o.logical.associations.find(Q=>Q.modelId===v);if(!G)return;let x,T;for(const Q of o.logical.entities){const $=Q.attributes.find(D=>{var M;return((M=D.embedded)==null?void 0:M.associationRef)===v&&D.attrType==="EMBED_OWN"});if($){x=Q.modelId,T=$;break}}if(!x||!T)return;const R=T.embedded.embeddableRef,re=G.end2.entityRef===R?"end2":"end1",I=G[re],A=I.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(S==="COLLECTION"?A:!A))if(S==="COLLECTION")ee(De("임베드 컬렉션 전환",[Wt(x,T.modelId,{dbAttrs:[]}),yn(v,re,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...I.jpa,collectionType:"LIST"}})]));else{const Q=o.logical.entities.find($=>$.modelId===R);if(!Q)return;ee(De("임베드 단일 전환",[Wt(x,T.modelId,{dbAttrs:sd(Q)}),yn(v,re,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...I.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(v){const S=o.logical.associations.find(re=>re.modelId===v),G=ya(v);if(!S){ee(G);return}for(const re of o.logical.entities){const I=re.attributes.find(A=>{var Q;return((Q=A.embedded)==null?void 0:Q.associationRef)===v});if(I){ee(De("임베드 삭제",[G,Vt(re.modelId,I.modelId)]));return}}const x=S.end2.entityRef,T={...o.logical,associations:o.logical.associations.filter(re=>re.modelId!==v)},R=rl(T,x);ee(R.length?De("관계 삭제",[G,...R]):G)},setAssociationIdentifying(v,S){const G=o.logical.associations.find(I=>I.modelId===v),x=Oo(v,{identifying:S});if(!G||G.identifying===S){ee(x);return}const T=G.end2.entityRef,R={...o.logical,associations:o.logical.associations.map(I=>I.modelId===v?{...I,identifying:S}:I)},re=rl(R,T);ee(re.length?De("식별 관계 변경",[x,...re]):x)},updateAssociationEnd(v,S,G){ee(yn(v,S,G))},moveWaypoint(v,S,G){ee(vr(v,S,G))},addWaypoint(v,S,G){ee(Nr(v,S,G))},removeWaypoint(v,S){ee(wr(v,S))},clearWaypoints(v){ee(kr(v))},addNote(v="메모",S={x:80,y:80}){const G=Ce();return ee(xr({modelId:G,memo:v,geo:{location:{...S},size:{width:200,height:120}}})),G},removeNote(v){ee(ga(v))},moveNote(v,S){ee(Hn(v,S))},resizeNote(v,S){ee($r(v,S))},setNoteMemo(v,S){ee(Sr(v,S))},setNoteSwatch(v,S){ee(Ir(v,S))},addNoteConnection(v,S){ee(Vr(v,S))},removeNoteConnection(v,S){ee(Ar(v,S))},moveNoteConnectionWaypoint(v,S,G,x){ee(Tr(v,S,G,x))},addNoteConnectionWaypoint(v,S,G,x){ee(Mr(v,S,G,x))},removeNoteConnectionWaypoint(v,S,G){ee(Br(v,S,G))},clearNoteConnectionWaypoints(v,S){ee(Dr(v,S))},autoLayout(){const v=Ol(o.logical,o.layout);v.length&&ee(De("자동 배치",v.map(S=>hn(S.id,S.location))))},copy(){const v=w.value;if((v==null?void 0:v.kind)==="attribute"){const R=o.logical.entities.find(I=>I.modelId===v.entityId);if(!R)return;const re=[...R.attributes].sort((I,A)=>I.order-A.order).filter(I=>v.ids.includes(I.modelId));if(!re.length)return;ce.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:re}));return}const S=V.value;if(!S)return;const G=o.logical.entities.find(R=>R.modelId===S),x=o.layout.entityLayouts.find(R=>R.entityRef===S);if(!G)return;const T=(x==null?void 0:x.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ce.value=JSON.parse(JSON.stringify({kind:"entity",entity:G,geo:T}))},paste(){if(!z.value)return;const v=ce.value;if(!v)return;if(v.kind==="attribute"){const x=V.value;if(!x)return;const T=o.logical.entities.find($=>$.modelId===x);if(!T)return;const R=new Set(T.attributes.map($=>$.name)),re=new Set(T.attributes.flatMap($=>$.dbAttrs.map(D=>D.physicalName))),I=T.attributes.length,A=[],Q=v.attributes.map(($,D)=>{const M=JSON.parse(JSON.stringify($));M.modelId=Ce();for(const L of M.dbAttrs)L.modelId=Ce();R.has(M.name)&&(M.name=`${M.name}_copy`);for(const L of M.dbAttrs)L.physicalName&&re.has(L.physicalName)&&(L.physicalName=`${L.physicalName}_copy`);return M.order=I+D,A.push(M.modelId),vt(x,M)});ee(Q.length===1?Q[0]:De("속성 붙여넣기",Q)),w.value={kind:"attribute",entityId:x,ids:A,anchor:A[A.length-1]};return}const S=__(v.entity),G={location:{x:v.geo.location.x+40,y:v.geo.location.y+40},size:{...v.geo.size}};ee(ca(S,G)),w.value={kind:"entity",id:S.modelId}}}}const $i=Symbol("groupHover"),cd=Symbol("groupDrag"),Rn=Symbol("relationHighlight"),k_={key:0,class:"em-sel","aria-hidden":"true"},N_=["title","aria-expanded","disabled"],x_={class:"em-entity__stereotype"},$_={key:1,class:"em-entity__name"},S_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],I_=["onPointerdown"],C_={key:1,class:"em-entity__divider-label"},R_=["title"],V_={class:"em-key-slot"},A_={class:"em-key-slot"},T_={key:0,class:"em-entity__type"},M_=["onClick"],B_={class:"em-entity__attrname"},D_={class:"em-entity__type"},O_=["data-op"],L_=["onPointerdown"],P_={class:"em-entity__op-vis","aria-hidden":"true"},z_=["title"],U_={key:4,class:"em-entity__footer"},dd=Te(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(ln,null),i=ae.useModal();function a(){o&&Ei(i,o,t.id)}const l=n.inject($i,null),r=n.inject(Rn,null),s=n.computed(()=>!!o&&o.editable.value);function c(){l&&(l.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),p=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var L;return((L=o==null?void 0:o.selection.value)==null?void 0:L.kind)==="entity"&&o.selection.value.id===t.id}),h=n.computed(()=>!!t.selected&&!m.value),g=n.computed(()=>{var L;return o&&((L=o.selectedAttr.value)==null?void 0:L.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),N=n.computed(()=>g.value.size>0);function b(L,j){const se=j.shiftKey?"range":j.metaKey||j.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,L.modelId,se)}const E=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),C=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),Z=n.computed(()=>t.data.collapsed??!1);function q(){s.value&&(o==null||o.setEntityCollapsed(t.id,!Z.value))}const te=n.computed(()=>C.value==="PHYSICAL"||C.value==="LOGICAL_PHYSICAL"),P=n.computed(()=>{const L=C.value==="PHYSICAL"||C.value==="LOGICAL_PHYSICAL",j={};for(const se of y.value.attributes){const fe=se.attrType.startsWith("RELATION")&&se.dbAttrs.length>0;j[se.modelId]={pk:se.identifier,fk:fe&&L,required:se.notNull&&!se.identifier}}return j});function oe(L){if(!L)return"";const j=[];return L.pk&&L.fk?j.push("PFK (식별 외래키)"):L.pk?j.push("PK (기본키)"):L.fk&&j.push("FK (외래키)"),L.required&&j.push("필수 (NOT NULL)"),j.join(" · ")}const z=n.computed(()=>{const L=il(We(t.data.style)),j={};return L&&(j["--em-header-bg"]=L.bar,j["--em-header-fg"]=L.barOn),j});function J(L){var j,se;return(se=il(We((j=t.data.attributeStyles)==null?void 0:j[L.modelId])))==null?void 0:se.text}const W=n.computed(()=>[...y.value.operations??[]].sort((L,j)=>L.order-j.order)),ge=n.computed(()=>C.value==="CLASS"&&W.value.length>0),_={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function w(L){return L?_[L]:"~"}function k(L){var j,se;return(se=il(We((j=t.data.operationStyles)==null?void 0:j[L.modelId])))==null?void 0:se.text}function K(L,j,se){switch(C.value){case"CLASS":return[{text:L}];case"PHYSICAL":return[{text:se||L}];case"LOGICAL":return[j?{text:j}:{text:"(논리명)",missing:!0}];default:{const fe=j?{text:j}:{text:"(논리명)",missing:!0};return se?[fe,{text:` · ${se}`}]:[fe]}}}function V(L){var j,se,fe;return H(L)?[{text:L.name}]:K(L.name,(se=(j=L.dbAttrs[0])==null?void 0:j.logicalName)==null?void 0:se.ko,((fe=L.dbAttrs[0])==null?void 0:fe.physicalName)??"")}function H(L){return L.attrType.startsWith("EMBED")&&L.dbAttrs.length>0}function U(L){return L.attrType==="DIVIDER"}function ce(L){if(L.attrType!=="EMBED_PREDEF")return L.dbAttrs;const j=o==null?void 0:o.embeddableCatalog.value.find(fe=>fe.type===L.type);if(!j)return L.dbAttrs;const se=On(y.value.attributes.flatMap(fe=>fe.dbAttrs));return L.dbAttrs.map((fe,de)=>{const xe=j.fields[de],Re=Vo(fe,se);return Re?{...fe,physicalName:Re.physicalName,logicalName:fe.logicalName??(xe==null?void 0:xe.logicalName),dataType:fe.dataType||(xe==null?void 0:xe.dataType)||""}:xe?{...fe,physicalName:fe.physicalName||xe.physicalName,logicalName:fe.logicalName??xe.logicalName,dataType:fe.dataType||xe.dataType,length:fe.length??xe.length}:fe})}function he(L){var j;return K(L.physicalName,(j=L.logicalName)==null?void 0:j.ko,L.physicalName)}function me(L){const j=Kl(L,(o==null?void 0:o.state.logical.associations)??[]);return oa(C.value,L,j)}const be=n.computed(()=>{var L,j,se;return K(y.value.name,(j=(L=y.value.table)==null?void 0:L.logicalName)==null?void 0:j.ko,((se=y.value.table)==null?void 0:se.physicalName)??"")}),ue=n.ref(!1),X=n.ref(""),F=n.ref(null);async function le(){var L,j;s.value&&(X.value=y.value.name,ue.value=!0,await n.nextTick(),(L=F.value)==null||L.focus(),(j=F.value)==null||j.select())}function ve(){if(!ue.value)return;ue.value=!1;const L=X.value.trim();L&&L!==y.value.name&&(o==null||o.renameEntity(t.id,L))}function we(){o==null||o.addAttribute(t.id)}function pe(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:ye,findNode:ee}=Ve(),O=n.ref(null),B=n.computed(()=>{const L=O.value??t.data.size;return L?{width:`${L.width}px`,minHeight:`${L.height}px`}:void 0});let Y=null;function ie(L){var fe,de,xe;if(!s.value)return;L.stopPropagation();const j=(fe=ee(t.id))==null?void 0:fe.dimensions,se=ye({x:L.clientX,y:L.clientY});Y={fx:se.x,fy:se.y,w:(j==null?void 0:j.width)??((de=t.data.size)==null?void 0:de.width)??200,h:(j==null?void 0:j.height)??((xe=t.data.size)==null?void 0:xe.height)??120},L.target.setPointerCapture(L.pointerId)}function ne(L){if(!Y)return;const j=ye({x:L.clientX,y:L.clientY});O.value={width:Math.max(40,Y.w+(j.x-Y.fx)),height:Math.max(40,Y.h+(j.y-Y.fy))}}function v(L){var j,se,fe;if(Y&&O.value&&o){const de=(j=ee(t.id))==null?void 0:j.dimensions;o.resizeEntity(t.id,{width:Math.round((de==null?void 0:de.width)??O.value.width),height:Math.round((de==null?void 0:de.height)??O.value.height)})}Y=null,O.value=null,(fe=(se=L.target).releasePointerCapture)==null||fe.call(se,L.pointerId)}const S=n.ref(null),G=n.ref(null);function x(L,j){if(!s.value)return;j.stopPropagation(),j.preventDefault();const se=g.value,fe=se.has(L.modelId)?new Set(se):new Set([L.modelId]);G.value={ids:fe,dropIndex:-1,lineY:0},j.target.setPointerCapture(j.pointerId)}function T(L){if(!G.value||!S.value)return;const j=Array.from(S.value.querySelectorAll(".em-entity__row"));if(!j.length)return;let se=j.length;for(let xe=0;xe<j.length;xe++){const Re=j[xe].getBoundingClientRect();if(L.clientY<Re.top+Re.height/2){se=xe;break}}const fe=j[j.length-1],de=se<j.length?j[se].offsetTop:fe.offsetTop+fe.offsetHeight;G.value={...G.value,dropIndex:se,lineY:de}}function R(){const L=G.value;if(G.value=null,!L||L.dropIndex<0)return;const j=y.value.attributes,se=j.filter(Se=>L.ids.has(Se.modelId)).map(Se=>Se.modelId),fe=j.filter((Se,Ae)=>L.ids.has(Se.modelId)&&Ae<L.dropIndex).length,de=L.dropIndex-fe,xe=j.filter(Se=>!L.ids.has(Se.modelId)).map(Se=>Se.modelId);[...xe.slice(0,de),...se,...xe.slice(de)].join(",")!==j.map(Se=>Se.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,se,de))}function re(){G.value=null}const I=n.ref(null),A=n.ref(null);function Q(L,j){s.value&&(j.stopPropagation(),j.preventDefault(),A.value={id:L.modelId,dropIndex:-1,lineY:0},j.target.setPointerCapture(j.pointerId))}function $(L){if(!A.value||!I.value)return;const j=Array.from(I.value.querySelectorAll(".em-entity__op-row"));if(!j.length)return;let se=j.length;for(let xe=0;xe<j.length;xe++){const Re=j[xe].getBoundingClientRect();if(L.clientY<Re.top+Re.height/2){se=xe;break}}const fe=j[j.length-1],de=se<j.length?j[se].offsetTop:fe.offsetTop+fe.offsetHeight;A.value={...A.value,dropIndex:se,lineY:de}}function D(){const L=A.value;if(A.value=null,!L||L.dropIndex<0)return;const se=W.value.findIndex(de=>de.modelId===L.id);if(se<0)return;const fe=L.dropIndex-(se<L.dropIndex?1:0);fe!==se&&(o==null||o.reorderOperations(t.id,[L.id],fe))}function M(){A.value=null}return(L,j)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":E.value,"is-selected":m.value,"is-multi-selected":h.value,"has-focused-attr":N.value}]),style:n.normalizeStyle(B.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",k_,[...j[7]||(j[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(z.value),onDblclick:n.withModifiers(le,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:Z.value?"펼치기":"접기","aria-expanded":!Z.value,disabled:!s.value,onClick:n.withModifiers(q,["stop"]),onPointerdown:j[0]||(j[0]=n.withModifiers(()=>{},["stop"])),onDblclick:j[1]||(j[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(Z.value?"▸":"▾"),41,N_),n.createElementVNode("span",x_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),ue.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:F,"onUpdate:modelValue":j[2]||(j[2]=se=>X.value=se),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(ve,["enter"]),j[3]||(j[3]=n.withKeys(se=>ue.value=!1,["esc"]))],onBlur:ve,onPointerdown:j[4]||(j[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,X.value]]):(n.openBlock(),n.createElementBlock("span",$_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(se,fe)=>(n.openBlock(),n.createElementBlock("span",{key:fe,class:n.normalizeClass({"em-entity__missing":se.missing})},n.toDisplayString(se.text),3))),128))]))],36),Z.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:S,class:"em-entity__attrs"},[G.value&&G.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${G.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,se=>{var fe,de,xe,Re;return n.openBlock(),n.createElementBlock(n.Fragment,{key:se.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(se.modelId),"is-dragging":(fe=G.value)==null?void 0:fe.ids.has(se.modelId),"is-embed":H(se),"is-divider":U(se),nodrag:U(se)&&s.value}]),"data-attr":se.modelId,onClick:n.withModifiers(Se=>b(se,Se),["stop"]),onPointerdown:Se=>U(se)?x(se,Se):void 0,onPointermove:Se=>U(se)?T(Se):void 0,onPointerup:Se=>U(se)?R():void 0,onPointercancel:Se=>U(se)?re():void 0},[s.value&&!U(se)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Se=>x(se,Se),onPointermove:T,onPointerup:R,onPointercancel:re,onClick:j[5]||(j[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,I_)):n.createCommentVNode("",!0),U(se)?(n.openBlock(),n.createElementBlock("span",C_,n.toDisplayString(se.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(tn),{id:`l:${se.modelId}`,type:"target",position:n.unref(Ne).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:oe(P.value[se.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",V_,[(de=P.value[se.modelId])!=null&&de.pk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:12,class:"em-key is-pk"})):(xe=P.value[se.modelId])!=null&&xe.required?(n.openBlock(),n.createBlock(Ie,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",A_,[H(se)?(n.openBlock(),n.createBlock(Ie,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Re=P.value[se.modelId])!=null&&Re.fk?(n.openBlock(),n.createBlock(Ie,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,R_),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:J(se)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(V(se),(Se,Ae)=>(n.openBlock(),n.createElementBlock("span",{key:Ae,class:n.normalizeClass({"em-entity__missing":Se.missing})},n.toDisplayString(Se.text),3))),128))],4),me(se)?(n.openBlock(),n.createElementBlock("span",T_,n.toDisplayString(me(se)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(tn),{id:`r:${se.modelId}`,type:"source",position:n.unref(Ne).Right,class:"em-handle"},null,8,["id","position"])],64))],42,S_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H(se)&&te.value?ce(se):[],Se=>(n.openBlock(),n.createElementBlock("li",{key:`${se.modelId}:${Se.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(se.modelId)}]),onClick:n.withModifiers(Ae=>b(se,Ae),["stop"])},[j[8]||(j[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",B_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(he(Se),(Ae,tt)=>(n.openBlock(),n.createElementBlock("span",{key:tt,class:n.normalizeClass({"em-entity__missing":Ae.missing})},n.toDisplayString(Ae.text),3))),128))]),n.createElementVNode("span",D_,n.toDisplayString(Se.dataType),1)],10,M_))),128))],64)}),128))],512)),!Z.value&&ge.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:I,class:"em-entity__ops"},[A.value&&A.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${A.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(W.value,se=>{var fe;return n.openBlock(),n.createElementBlock("li",{key:se.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((fe=A.value)==null?void 0:fe.id)===se.modelId}]),"data-op":se.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:de=>Q(se,de),onPointermove:$,onPointerup:D,onPointercancel:M,onClick:j[6]||(j[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,L_)):n.createCommentVNode("",!0),n.createElementVNode("span",P_,n.toDisplayString(w(se.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:k(se)})},n.toDisplayString(se.name)+"()",5)],10,O_)}),128))],512)):W.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${W.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ie,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(W.value.length)+"개",1)],8,z_)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",U_,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:we},"+ 속성"),j[9]||(j[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:pe},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!ue.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ie,onPointermove:ne,onPointerup:v},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3eac9bf0"]]),H_={key:0,class:"em-sel","aria-hidden":"true"},F_={class:"em-group__label"},G_={class:"em-group__name"},Y_={key:0,class:"em-group__pkg"},W_={key:1,class:"em-group__flag"},ud=Te(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>We(t.data.style)),a=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),l=n.inject(ln,null),r=n.computed(()=>!!l&&l.editable.value),s=n.computed(()=>{var P;return!!t.id&&((P=l==null?void 0:l.selection.value)==null?void 0:P.kind)==="group"&&l.selection.value.id===t.id}),c=n.computed(()=>!!t.selected&&!s.value),d=n.inject($i,null),u=n.computed(()=>!!t.id&&(d==null?void 0:d.value)===t.id),f=n.inject(Rn,null);function p(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const h=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),g=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:N,findNode:b}=Ve();let E=null,y=null;function C(P){var J;if(!t.id||!r.value)return;P.stopPropagation();const oe=((J=b(t.id))==null?void 0:J.dimensions)??{width:400,height:300},z=N({x:P.clientX,y:P.clientY});E={fx:z.x,fy:z.y,w:oe.width,h:oe.height},P.target.setPointerCapture(P.pointerId)}function Z(P){if(!E||!t.id)return;const oe=N({x:P.clientX,y:P.clientY});y={width:Math.max(160,E.w+(oe.x-E.fx)),height:Math.max(120,E.h+(oe.y-E.fy))};const z=b(t.id);z&&(z.style={width:`${y.width}px`,height:`${y.height}px`})}function q(P){var oe,z;E&&y&&t.id&&l&&l.resizeGroup(t.id,y),E=null,y=null,(z=(oe=P.target).releasePointerCapture)==null||z.call(oe,P.pointerId)}const te=n.computed(()=>{const P=o.value.name;return(P==null?void 0:P.ko)||(P==null?void 0:P.en)||(P==null?void 0:P.ja)||(P==null?void 0:P.zh)||o.value.packageName||"그룹"});return(P,oe)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":h.value,"is-dimmed":g.value,"is-selected":s.value,"is-multi-selected":c.value}]),style:n.normalizeStyle(a.value),onMouseenter:p,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",H_,[...oe[0]||(oe[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",F_,[n.createElementVNode("span",G_,n.toDisplayString(te.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Y_,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",W_,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:C,onPointermove:Z,onPointerup:q},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),q_={key:0,class:"em-sel","aria-hidden":"true"},K_={key:2,class:"em-note__text"},fd=Te(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(ln,null),i=n.inject($i,null),a=n.inject(Rn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>We(l.value.style)),c=n.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=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function f(){a==null||a.setNoteHover(null)}const p=n.computed(()=>{var _;return((_=a==null?void 0:a.source.value)==null?void 0:_.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!p.value),h=n.computed(()=>{var _;return((_=o==null?void 0:o.selection.value)==null?void 0:_.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!h.value),N=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!h.value),b=[{id:"n-top",pos:Ne.Top},{id:"n-right",pos:Ne.Right},{id:"n-bottom",pos:Ne.Bottom},{id:"n-left",pos:Ne.Left}],E=n.ref(!1),y=n.ref(""),C=n.ref(null);async function Z(){var _;r.value&&(y.value=l.value.memo,E.value=!0,await n.nextTick(),(_=C.value)==null||_.focus())}function q(){E.value&&(E.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:te,findNode:P}=Ve();let oe=null,z=null;function J(_){var K;if(!r.value)return;_.stopPropagation();const w=((K=P(t.id))==null?void 0:K.dimensions)??l.value.geo.size,k=te({x:_.clientX,y:_.clientY});oe={fx:k.x,fy:k.y,w:w.width,h:w.height},_.target.setPointerCapture(_.pointerId)}function W(_){if(!oe)return;const w=te({x:_.clientX,y:_.clientY});z={width:Math.max(140,oe.w+(w.x-oe.fx)),height:Math.max(60,oe.h+(w.y-oe.fy))};const k=P(t.id);k&&(k.style={width:`${z.width}px`,height:`${z.height}px`})}function ge(_){var w,k;oe&&z&&o&&o.resizeNote(t.id,z),oe=null,z=null,(k=(w=_.target).releasePointerCapture)==null||k.call(w,_.pointerId)}return(_,w)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":m.value,"is-dimmed":N.value,"is-selected":h.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(c.value),onDblclick:Z,onPointerdown:d,onMouseenter:u,onMouseleave:f},[h.value?(n.openBlock(),n.createElementBlock("div",q_,[...w[4]||(w[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),E.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:C,"onUpdate:modelValue":w[0]||(w[0]=k=>y.value=k),class:"em-note__edit nodrag",onBlur:q,onKeydown:w[1]||(w[1]=n.withKeys(k=>E.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",K_,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(b,k=>n.createVNode(n.unref(tn),{id:k.id,key:k.id,type:"source",position:k.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!E.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:J,onPointermove:W,onPointerup:ge},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),X_=20,j_=22,Z_=7,J_=22,md=31,pd=7,Q_=20,hd=11,yd=11,ev=md+pd;function tv(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function nv(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Si(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Math.hypot(i,a)||1;return{x:e.x+i*o/l,y:e.y+a*o/l}}function gd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Ii(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function bd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:gd(e,t);return[Ii(o,a,l-Math.PI/2),Ii(o,a,l+Math.PI/2)]}function _d(e,t,o,i){const a=t*180/Math.PI,r=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function vd(e,t,o,i){const a=[],l=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:l,polygons:r};if(i==="db"){const c=Si(e,t,X_),[d,u]=bd(e,t,c,j_);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}),tv(o.multiplicity)){const f=Si(e,t,md);l.push({cx:f.x,cy:f.y,r:pd})}if(nv(o.multiplicity)){const f=Si(e,t,Z_),[p,m]=bd(e,t,f,J_);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=Si(e,t,Q_),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=gd(e,t),f=Ii(d,hd/2,u-Math.PI/2),p=Ii(d,hd/2,u+Math.PI/2);r.push({points:[e,f,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=_d(s,c,yd,!0),u=_d(s,c,yd,!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:l,polygons:r}}const wd=200,Ed=120,sl=24;function kd(e){var a,l;if(!e)return{x:0,y:0,width:wd,height:Ed};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||wd,i=((l=e.dimensions)==null?void 0:l.height)||Ed;return{x:t.x,y:t.y,width:o,height:i}}function Nd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function xd(e){const t=n.computed(()=>kd(e.sourceNode())),o=n.computed(()=>kd(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,h;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-f)<sl){const g=(f+p)/2;f=g-sl/2,p=g+sl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),l=n.computed(()=>e.waypoints()[0]??Nd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Nd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Qi(t.value,d,l.value.x):Ji(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Qi(o.value,d,r.value.x):Ji(o.value,r.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const cl=Symbol("waypointController"),ov=["d"],iv=["d"],av=["d"],lv=["x1","y1","x2","y2"],rv=["cx","cy","r"],sv=["x","y"],cv=["x","y"],dv=["cx","cy","onDblclick"],uv=["x","y","onPointerdown","onDblclick"],$d=Te(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ve(),i=n.inject(cl),a=n.inject(ln,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(cd,null),s=n.inject(Rn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const pe=r==null?void 0:r.value;if(!pe||!a)return null;const ye=a.resolved.value.entities,ee=B=>{var Y;return(Y=ye.find(ie=>ie.entity.modelId===B))==null?void 0:Y.groupRef},O=t.data.association;return ee(O.end1.entityRef)===pe.groupId&&ee(O.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),h=n.ref({x:0,y:0}),g=n.computed(()=>{const pe=f.value;return p.value.map((ye,ee)=>ee===m.value?h.value:pe?{x:ye.x+pe.dx,y:ye.y+pe.dy}:ye)}),N=n.computed(()=>{var pe;return!!((pe=t.sourceNode.data)!=null&&pe.collapsed)}),b=n.computed(()=>{var pe;return!!((pe=t.targetNode.data)!=null&&pe.collapsed)}),{source:E,target:y,sourceSide:C,targetSide:Z,isSelf:q}=xd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!N.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),te=ev+4,P=n.computed(()=>q.value?Dl(E.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Xi(E.value,C.value,g.value,y.value,Z.value,te):Zi(E.value,g.value,y.value)),oe=n.computed(()=>q.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ji(E.value,C.value,g.value,y.value,Z.value,te):ea(E.value,g.value,y.value).map((pe,ye)=>({point:pe,segIndex:ye}))),z=n.computed(()=>q.value||!l.value?[]:g.value);function J(pe){switch(pe){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 W(pe,ye){m.value=pe,h.value={...p.value[pe]},ye.target.setPointerCapture(ye.pointerId),ye.stopPropagation()}function ge(pe){if(m.value<0)return;const ye=o({x:pe.clientX,y:pe.clientY});h.value={x:ye.x,y:ye.y}}function _(pe){var ye,ee;m.value>=0&&i&&i.movePoint(t.id,m.value,{...h.value}),m.value=-1,(ee=(ye=pe.target).releasePointerCapture)==null||ee.call(ye,pe.pointerId)}function w(pe,ye){ye.stopPropagation(),i==null||i.removePoint(t.id,pe)}function k(pe,ye){if(!i)return;const ee=o({x:ye.clientX,y:ye.clientY});i.insertPoint(t.id,pe,{x:ee.x,y:ee.y})}const K=n.computed(()=>J(t.data.association.end1.multiplicity)),V=n.computed(()=>J(t.data.association.end2.multiplicity)),H=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),U=n.computed(()=>H.value==="class"),ce=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=Bn(C.value);return{x:E.value.x+pe.x*10,y:E.value.y+pe.y*10}}return g.value[0]??y.value}),he=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ye=Bn(Z.value);return{x:y.value.x+ye.x*10,y:y.value.y+ye.y*10}}const pe=g.value;return pe[pe.length-1]??E.value}),me=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),be=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),ue=n.computed(()=>vd(E.value,ce.value,me.value,H.value)),X=n.computed(()=>vd(y.value,he.value,be.value,H.value)),F=n.computed(()=>[...ue.value.lines,...X.value.lines]),le=n.computed(()=>[...ue.value.circles,...X.value.circles]),ve=n.computed(()=>[...ue.value.polygons,...X.value.polygons].map(pe=>`M${pe.points.map(ye=>`${ye.x},${ye.y}`).join(" L")} Z`)),we=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,ye)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:P.value,fill:"none",class:"em-edge__hit"},null,8,ov),n.createElementVNode("path",{d:P.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,iv),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(ee,O)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${O}`,d:ee,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",we.value])},null,10,av))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,(ee,O)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${O}`,x1:ee.x1,y1:ee.y1,x2:ee.x2,y2:ee.y2,class:n.normalizeClass(["em-edge__marker",we.value])},null,10,lv))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.value,(ee,O)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${O}`,cx:ee.cx,cy:ee.cy,r:ee.r,class:n.normalizeClass(["em-edge__marker",we.value])},null,10,rv))),128)),U.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(E).x+8,y:n.unref(E).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(K.value),11,sv),n.createElementVNode("text",{x:n.unref(y).x-8,y:n.unref(y).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(V.value),11,cv)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,(ee,O)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${O}`,cx:ee.point.x,cy:ee.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(B=>k(ee.segIndex,B),["stop"])},null,42,dv))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.value,(ee,O)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${O}`,x:ee.x-5,y:ee.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:B=>W(O,B),onPointermove:ge,onPointerup:_,onDblclick:B=>w(O,B)},null,42,uv))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var $t=(e=>(e.Lines="lines",e.Dots="dots",e))($t||{});const Sd=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Id=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};$t.Lines+"",$t.Dots+"";const fv={[$t.Dots]:"#81818a",[$t.Lines]:"#eee"},mv=["id","x","y","width","height","patternTransform"],pv={key:2,height:"100",width:"100"},hv=["fill"],yv=["x","y","fill"],gv={name:"Background",compatConfig:{MODE:3}},bv=n.defineComponent({...gv,props:{id:{},variant:{default:()=>$t.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:t,viewport:o}=Ve(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,p*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||fv[e.variant||$t.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.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"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref($t).Lines?(n.openBlock(),n.createBlock(n.unref(Sd),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref($t).Dots?(n.openBlock(),n.createBlock(n.unref(Id),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",pv,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,hv)])):n.createCommentVNode("",!0)])],8,mv)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,yv),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),_v={name:"ControlButton",compatConfig:{MODE:3}},vv=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},wv={type:"button",class:"vue-flow__controls-button"};function Ev(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",wv,[n.renderSlot(e.$slots,"default")])}const Ci=vv(_v,[["render",Ev]]),kv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Nv=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function xv(e,t){return n.openBlock(),n.createElementBlock("svg",kv,Nv)}const $v={render:xv},Sv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Iv=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Cv(e,t){return n.openBlock(),n.createElementBlock("svg",Sv,Iv)}const Rv={render:Cv},Vv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Av=[n.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 Tv(e,t){return n.openBlock(),n.createElementBlock("svg",Vv,Av)}const Mv={render:Tv},Bv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Dv=[n.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 Ov(e,t){return n.openBlock(),n.createElementBlock("svg",Bv,Dv)}const Lv={render:Ov},Pv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},zv=[n.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 Uv(e,t){return n.openBlock(),n.createElementBlock("svg",Pv,zv)}const Hv={render:Uv},Fv={name:"Controls",compatConfig:{MODE:3}},Gv=n.defineComponent({...Fv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>ec.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:l,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=Ve(),p=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),h=n.toRef(()=>d.value.zoom>=f.value);function g(){r(),t("zoomIn")}function N(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function E(){l(!p.value),t("interactionChange",!p.value)}return(y,C)=>(n.openBlock(),n.createBlock(n.unref(Jc),{class:"vue-flow__controls",position:y.position},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"top"),y.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(y.$slots,"control-zoom-in",{},()=>[n.createVNode(Ci,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($v))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(Ci,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:N},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Rv))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Ci,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Mv))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(Ci,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:n.withCtx(()=>[p.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Hv))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Lv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var Yv={value:()=>{}};function dl(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Ri(o)}function Ri(e){this._=e}function Wv(e,t){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&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Ri.prototype=dl.prototype={constructor:Ri,on:function(e,t){var o=this._,i=Wv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=qv(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<r;)if(a=(e=i[l]).type)o[a]=Cd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Cd(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Ri(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function qv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Cd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Yv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var ul="http://www.w3.org/1999/xhtml";const Rd={svg:"http://www.w3.org/2000/svg",xhtml:ul,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Rd.hasOwnProperty(t)?{space:Rd[t],local:e}:e}function Kv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===ul&&t.documentElement.namespaceURI===ul?t.createElement(e):t.createElementNS(o,e)}}function Xv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Vd(e){var t=Vi(e);return(t.local?Xv:Kv)(t)}function jv(){}function fl(e){return e==null?jv:function(){return this.querySelector(e)}}function Zv(e){typeof e!="function"&&(e=fl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=new Array(r),c,d,u=0;u<r;++u)(c=l[u])&&(d=e.call(c,c.__data__,u,l))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new et(i,this._parents)}function Jv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qv(){return[]}function Ad(e){return e==null?Qv:function(){return this.querySelectorAll(e)}}function ew(e){return function(){return Jv(e.apply(this,arguments))}}function tw(e){typeof e=="function"?e=ew(e):e=Ad(e);for(var t=this._groups,o=t.length,i=[],a=[],l=0;l<o;++l)for(var r=t[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),a.push(c));return new et(i,a)}function Td(e){return function(){return this.matches(e)}}function Md(e){return function(t){return t.matches(e)}}var nw=Array.prototype.find;function ow(e){return function(){return nw.call(this.children,e)}}function iw(){return this.firstElementChild}function aw(e){return this.select(e==null?iw:ow(typeof e=="function"?e:Md(e)))}var lw=Array.prototype.filter;function rw(){return Array.from(this.children)}function sw(e){return function(){return lw.call(this.children,e)}}function cw(e){return this.selectAll(e==null?rw:sw(typeof e=="function"?e:Md(e)))}function dw(e){typeof e!="function"&&(e=Td(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new et(i,this._parents)}function Bd(e){return new Array(e.length)}function uw(){return new et(this._enter||this._groups.map(Bd),this._parents)}function Ai(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ai.prototype={constructor:Ai,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fw(e){return function(){return e}}function mw(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Ai(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function pw(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?a[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,l[s],s,l)+"",(c=d.get(m))?(i[s]=c,c.__data__=l[s],d.delete(m)):o[s]=new Ai(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function hw(e){return e.__data__}function yw(e,t){if(!arguments.length)return Array.from(this,hw);var o=t?pw:mw,i=this._parents,a=this._groups;typeof e!="function"&&(e=fw(e));for(var l=a.length,r=new Array(l),s=new Array(l),c=new Array(l),d=0;d<l;++d){var u=i[d],f=a[d],p=f.length,m=gw(e.call(u,u&&u.__data__,d,i)),h=m.length,g=s[d]=new Array(h),N=r[d]=new Array(h),b=c[d]=new Array(p);o(u,f,g,N,b,m,t);for(var E=0,y=0,C,Z;E<h;++E)if(C=g[E]){for(E>=y&&(y=E+1);!(Z=N[y])&&++y<h;);C._next=Z||null}}return r=new et(r,i),r._enter=s,r._exit=c,r}function gw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bw(){return new et(this._exit||this._groups.map(Bd),this._parents)}function _w(e,t,o){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?l.remove():o(l),i&&a?i.merge(a).order():a}function vw(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new et(s,this._parents)}function ww(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function Ew(e){e||(e=kw);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,a=new Array(i),l=0;l<i;++l){for(var r=o[l],s=r.length,c=a[l]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new et(a,this._parents).order()}function kw(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xw(){return Array.from(this)}function $w(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function Sw(){let e=0;for(const t of this)++e;return e}function Iw(){return!this.node()}function Cw(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],l=0,r=a.length,s;l<r;++l)(s=a[l])&&e.call(s,s.__data__,l,a);return this}function Rw(e){return function(){this.removeAttribute(e)}}function Vw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Aw(e,t){return function(){this.setAttribute(e,t)}}function Tw(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mw(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Bw(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Dw(e,t){var o=Vi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Vw:Rw:typeof t=="function"?o.local?Bw:Mw:o.local?Tw:Aw)(o,t))}function Dd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ow(e){return function(){this.style.removeProperty(e)}}function Lw(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Pw(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function zw(e,t,o){return arguments.length>1?this.each((t==null?Ow:typeof t=="function"?Pw:Lw)(e,t,o??"")):Vn(this.node(),e)}function Vn(e,t){return e.style.getPropertyValue(t)||Dd(e).getComputedStyle(e,null).getPropertyValue(t)}function Uw(e){return function(){delete this[e]}}function Hw(e,t){return function(){this[e]=t}}function Fw(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Gw(e,t){return arguments.length>1?this.each((t==null?Uw:typeof t=="function"?Fw:Hw)(e,t)):this.node()[e]}function Od(e){return e.trim().split(/^|\s+/)}function ml(e){return e.classList||new Ld(e)}function Ld(e){this._node=e,this._names=Od(e.getAttribute("class")||"")}Ld.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Pd(e,t){for(var o=ml(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function zd(e,t){for(var o=ml(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Yw(e){return function(){Pd(this,e)}}function Ww(e){return function(){zd(this,e)}}function qw(e,t){return function(){(t.apply(this,arguments)?Pd:zd)(this,e)}}function Kw(e,t){var o=Od(e+"");if(arguments.length<2){for(var i=ml(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?qw:t?Yw:Ww)(o,t))}function Xw(){this.textContent=""}function jw(e){return function(){this.textContent=e}}function Zw(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jw(e){return arguments.length?this.each(e==null?Xw:(typeof e=="function"?Zw:jw)(e)):this.node().textContent}function Qw(){this.innerHTML=""}function eE(e){return function(){this.innerHTML=e}}function tE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nE(e){return arguments.length?this.each(e==null?Qw:(typeof e=="function"?tE:eE)(e)):this.node().innerHTML}function oE(){this.nextSibling&&this.parentNode.appendChild(this)}function iE(){return this.each(oE)}function aE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function lE(){return this.each(aE)}function rE(e){var t=typeof e=="function"?e:Vd(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function sE(){return null}function cE(e,t){var o=typeof e=="function"?e:Vd(e),i=t==null?sE:typeof t=="function"?t:fl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function dE(){var e=this.parentNode;e&&e.removeChild(this)}function uE(){return this.each(dE)}function fE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pE(e){return this.select(e?mE:fE)}function hE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yE(e){return function(t){e.call(this,t,this.__data__)}}function gE(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function bE(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,l;o<a;++o)l=t[o],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function _E(e,t,o){return function(){var i=this.__on,a,l=yE(t);if(i){for(var r=0,s=i.length;r<s;++r)if((a=i[r]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=o),a.value=t;return}}this.addEventListener(e.type,l,o),a={type:e.type,name:e.name,value:t,listener:l,options:o},i?i.push(a):this.__on=[a]}}function vE(e,t,o){var i=gE(e+""),a,l=i.length,r;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<l;++a)if((r=i[a]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?_E:bE,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Ud(e,t,o){var i=Dd(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function wE(e,t){return function(){return Ud(this,e,t)}}function EE(e,t){return function(){return Ud(this,e,t.apply(this,arguments))}}function kE(e,t){return this.each((typeof t=="function"?EE:wE)(e,t))}function*NE(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length,r;a<l;++a)(r=i[a])&&(yield r)}var Hd=[null];function et(e,t){this._groups=e,this._parents=t}function co(){return new et([[document.documentElement]],Hd)}function xE(){return this}et.prototype=co.prototype={constructor:et,select:Zv,selectAll:tw,selectChild:aw,selectChildren:cw,filter:dw,data:yw,enter:uw,exit:bw,join:_w,merge:vw,selection:xE,order:ww,sort:Ew,call:Nw,nodes:xw,node:$w,size:Sw,empty:Iw,each:Cw,attr:Dw,style:zw,property:Gw,classed:Kw,text:Jw,html:nE,raise:iE,lower:lE,append:rE,insert:cE,remove:uE,clone:pE,datum:hE,on:vE,dispatch:kE,[Symbol.iterator]:NE};function Lt(e){return typeof e=="string"?new et([[document.querySelector(e)]],[document.documentElement]):new et([[e]],Hd)}function $E(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pt(e,t){if(e=$E(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const pl={capture:!0,passive:!1};function hl(e){e.preventDefault(),e.stopImmediatePropagation()}function SE(e){var t=e.document.documentElement,o=Lt(e).on("dragstart.drag",hl,pl);"onselectstart"in t?o.on("selectstart.drag",hl,pl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function IE(e,t){var o=e.document.documentElement,i=Lt(e).on("dragstart.drag",null);t&&(i.on("click.drag",hl,pl),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 yl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Fd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function uo(){}var fo=.7,Ti=1/fo,An="\\s*([+-]?\\d+)\\s*",mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CE=/^#([0-9a-f]{3,8})$/,RE=new RegExp(`^rgb\\(${An},${An},${An}\\)$`),VE=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),AE=new RegExp(`^rgba\\(${An},${An},${An},${mo}\\)$`),TE=new RegExp(`^rgba\\(${gt},${gt},${gt},${mo}\\)$`),ME=new RegExp(`^hsl\\(${mo},${gt},${gt}\\)$`),BE=new RegExp(`^hsla\\(${mo},${gt},${gt},${mo}\\)$`),Gd={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};yl(uo,po,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yd,formatHex:Yd,formatHex8:DE,formatHsl:OE,formatRgb:Wd,toString:Wd});function Yd(){return this.rgb().formatHex()}function DE(){return this.rgb().formatHex8()}function OE(){return Zd(this).formatHsl()}function Wd(){return this.rgb().formatRgb()}function po(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=CE.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?qd(t):o===3?new Ze(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Mi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Mi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=RE.exec(e))?new Ze(t[1],t[2],t[3],1):(t=VE.exec(e))?new Ze(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AE.exec(e))?Mi(t[1],t[2],t[3],t[4]):(t=TE.exec(e))?Mi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ME.exec(e))?jd(t[1],t[2]/100,t[3]/100,1):(t=BE.exec(e))?jd(t[1],t[2]/100,t[3]/100,t[4]):Gd.hasOwnProperty(e)?qd(Gd[e]):e==="transparent"?new Ze(NaN,NaN,NaN,0):null}function qd(e){return new Ze(e>>16&255,e>>8&255,e&255,1)}function Mi(e,t,o,i){return i<=0&&(e=t=o=NaN),new Ze(e,t,o,i)}function LE(e){return e instanceof uo||(e=po(e)),e?(e=e.rgb(),new Ze(e.r,e.g,e.b,e.opacity)):new Ze}function gl(e,t,o,i){return arguments.length===1?LE(e):new Ze(e,t,o,i??1)}function Ze(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}yl(Ze,gl,Fd(uo,{brighter(e){return e=e==null?Ti:Math.pow(Ti,e),new Ze(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fo:Math.pow(fo,e),new Ze(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ze(rn(this.r),rn(this.g),rn(this.b),Bi(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:Kd,formatHex:Kd,formatHex8:PE,formatRgb:Xd,toString:Xd}));function Kd(){return`#${sn(this.r)}${sn(this.g)}${sn(this.b)}`}function PE(){return`#${sn(this.r)}${sn(this.g)}${sn(this.b)}${sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xd(){const e=Bi(this.opacity);return`${e===1?"rgb(":"rgba("}${rn(this.r)}, ${rn(this.g)}, ${rn(this.b)}${e===1?")":`, ${e})`}`}function Bi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function sn(e){return e=rn(e),(e<16?"0":"")+e.toString(16)}function jd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new rt(e,t,o,i)}function Zd(e){if(e instanceof rt)return new rt(e.h,e.s,e.l,e.opacity);if(e instanceof uo||(e=po(e)),!e)return new rt;if(e instanceof rt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),l=Math.max(t,o,i),r=NaN,s=l-a,c=(l+a)/2;return s?(t===l?r=(o-i)/s+(o<i)*6:o===l?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?l+a:2-l-a,r*=60):s=c>0&&c<1?0:r,new rt(r,s,c,e.opacity)}function zE(e,t,o,i){return arguments.length===1?Zd(e):new rt(e,t,o,i??1)}function rt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}yl(rt,zE,Fd(uo,{brighter(e){return e=e==null?Ti:Math.pow(Ti,e),new rt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fo:Math.pow(fo,e),new rt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new Ze(bl(e>=240?e-240:e+120,a,i),bl(e,a,i),bl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new rt(Jd(this.h),Di(this.s),Di(this.l),Bi(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=Bi(this.opacity);return`${e===1?"hsl(":"hsla("}${Jd(this.h)}, ${Di(this.s)*100}%, ${Di(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Jd(e){return e=(e||0)%360,e<0?e+360:e}function Di(e){return Math.max(0,Math.min(1,e||0))}function bl(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const Qd=e=>()=>e;function UE(e,t){return function(o){return e+o*t}}function HE(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function FE(e){return(e=+e)==1?eu:function(t,o){return o-t?HE(t,o,e):Qd(isNaN(t)?o:t)}}function eu(e,t){var o=t-e;return o?UE(e,o):Qd(isNaN(e)?t:e)}const tu=(function e(t){var o=FE(t);function i(a,l){var r=o((a=gl(a)).r,(l=gl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=eu(a.opacity,l.opacity);return function(u){return a.r=r(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function zt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var _l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vl=new RegExp(_l.source,"g");function GE(e){return function(){return e}}function YE(e){return function(t){return e(t)+""}}function WE(e,t){var o=_l.lastIndex=vl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=_l.exec(e))&&(a=vl.exec(t));)(l=a.index)>o&&(l=t.slice(o,l),s[r]?s[r]+=l:s[++r]=l),(i=i[0])===(a=a[0])?s[r]?s[r]+=a:s[++r]=a:(s[++r]=null,c.push({i:r,x:zt(i,a)})),o=vl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?YE(c[0].x):GE(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)s[(f=c[u]).i]=f.x(d);return s.join("")})}var nu=180/Math.PI,wl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ou(e,t,o,i,a,l){var r,s,c;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(c=e*o+t*i)&&(o-=e*c,i-=t*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<t*o&&(e=-e,t=-t,c=-c,r=-r),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*nu,skewX:Math.atan(c)*nu,scaleX:r,scaleY:s}}var Oi;function qE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wl:ou(t.a,t.b,t.c,t.d,t.e,t.f)}function KE(e){return e==null||(Oi||(Oi=document.createElementNS("http://www.w3.org/2000/svg","g")),Oi.setAttribute("transform",e),!(e=Oi.transform.baseVal.consolidate()))?wl:(e=e.matrix,ou(e.a,e.b,e.c,e.d,e.e,e.f))}function iu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:zt(d,f)},{i:g-2,x:zt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(a(f)+"rotate(",null,i)-2,x:zt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(a(f)+"skewX(",null,i)-2,x:zt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var g=m.push(a(m)+"scale(",null,",",null,")");h.push({i:g-4,x:zt(d,f)},{i:g-2,x:zt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,g=p.length,N;++h<g;)f[(N=p[h]).i]=N.x(m);return f.join("")}}}var XE=iu(qE,"px, ","px)","deg)"),jE=iu(KE,", ",")",")"),ZE=1e-12;function au(e){return((e=Math.exp(e))+1/e)/2}function JE(e){return((e=Math.exp(e))-1/e)/2}function QE(e){return((e=Math.exp(2*e))-1)/(e+1)}const ek=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,g=m*m+h*h,N,b;if(g<ZE)b=Math.log(p/d)/t,N=function(te){return[s+te*m,c+te*h,d*Math.exp(t*te*b)]};else{var E=Math.sqrt(g),y=(p*p-d*d+i*g)/(2*d*o*E),C=(p*p-d*d-i*g)/(2*p*o*E),Z=Math.log(Math.sqrt(y*y+1)-y),q=Math.log(Math.sqrt(C*C+1)-C);b=(q-Z)/t,N=function(te){var P=te*b,oe=au(Z),z=d/(o*E)*(oe*QE(t*P+Z)-JE(Z));return[s+z*m,c+z*h,d*oe/au(t*P+Z)]}}return N.duration=b*1e3*t/Math.SQRT2,N}return a.rho=function(l){var r=Math.max(.001,+l),s=r*r,c=s*s;return e(r,s,c)},a})(Math.SQRT2,2,4);var Tn=0,ho=0,yo=0,lu=1e3,Li,go,Pi=0,cn=0,zi=0,bo=typeof performance=="object"&&performance.now?performance:Date,ru=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function El(){return cn||(ru(tk),cn=bo.now()+zi)}function tk(){cn=0}function Ui(){this._call=this._time=this._next=null}Ui.prototype=su.prototype={constructor:Ui,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?El():+o)+(t==null?0:+t),!this._next&&go!==this&&(go?go._next=this:Li=this,go=this),this._call=e,this._time=o,kl()},stop:function(){this._call&&(this._call=null,this._time=1/0,kl())}};function su(e,t,o){var i=new Ui;return i.restart(e,t,o),i}function nk(){El(),++Tn;for(var e=Li,t;e;)(t=cn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tn}function cu(){cn=(Pi=bo.now())+zi,Tn=ho=0;try{nk()}finally{Tn=0,ik(),cn=0}}function ok(){var e=bo.now(),t=e-Pi;t>lu&&(zi-=t,Pi=e)}function ik(){for(var e,t=Li,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Li=o);go=e,kl(i)}function kl(e){if(!Tn){ho&&(ho=clearTimeout(ho));var t=e-cn;t>24?(e<1/0&&(ho=setTimeout(cu,e-bo.now()-zi)),yo&&(yo=clearInterval(yo))):(yo||(Pi=bo.now(),yo=setInterval(ok,lu)),Tn=1,ru(cu))}}function du(e,t,o){var i=new Ui;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var ak=dl("start","end","cancel","interrupt"),lk=[],uu=0,fu=1,Nl=2,Hi=3,mu=4,xl=5,Fi=6;function Gi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;rk(e,o,{name:t,index:i,group:a,on:ak,tween:lk,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:uu})}function $l(e,t){var o=st(e,t);if(o.state>uu)throw new Error("too late; already scheduled");return o}function bt(e,t){var o=st(e,t);if(o.state>Hi)throw new Error("too late; already running");return o}function st(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function rk(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=su(l,0,o.time);function l(d){o.state=fu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==fu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Hi)return du(r);m.state===mu?(m.state=Fi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Fi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(du(function(){o.state===Hi&&(o.state=mu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Nl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Nl){for(o.state=Hi,a=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=m);a.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=xl,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===xl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Fi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Yi(e,t){var o=e.__transition,i,a,l=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){l=!1;continue}a=i.state>Nl&&i.state<xl,i.state=Fi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function sk(e){return this.each(function(){Yi(this,e)})}function ck(e,t){var o,i;return function(){var a=bt(this,e),l=a.tween;if(l!==o){i=o=l;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}a.tween=i}}function dk(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=bt(this,e),r=l.tween;if(r!==i){a=(i=r).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}l.tween=a}}function uk(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=st(this.node(),o).tween,a=0,l=i.length,r;a<l;++a)if((r=i[a]).name===e)return r.value;return null}return this.each((t==null?ck:dk)(o,e,t))}function Sl(e,t,o){var i=e._id;return e.each(function(){var a=bt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return st(a,i).value[t]}}function pu(e,t){var o;return(typeof t=="number"?zt:t instanceof po?tu:(o=po(t))?(t=o,tu):WE)(e,t)}function fk(e){return function(){this.removeAttribute(e)}}function mk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pk(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttribute(e);return r===a?null:r===i?l:l=t(i=r,o)}}function hk(e,t,o){var i,a=o+"",l;return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?l:l=t(i=r,o)}}function yk(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function gk(e,t,o){var i,a,l;return function(){var r,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),c=s+"",r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s)))}}function bk(e,t){var o=Vi(e),i=o==="transform"?jE:pu;return this.attrTween(e,typeof t=="function"?(o.local?gk:yk)(o,i,Sl(this,"attr."+e,t)):t==null?(o.local?mk:fk)(o):(o.local?hk:pk)(o,i,t))}function _k(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function vk(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function wk(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&vk(e,l)),o}return a._value=t,a}function Ek(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&_k(e,l)),o}return a._value=t,a}function kk(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Vi(e);return this.tween(o,(i.local?wk:Ek)(i,t))}function Nk(e,t){return function(){$l(this,e).delay=+t.apply(this,arguments)}}function xk(e,t){return t=+t,function(){$l(this,e).delay=t}}function $k(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Nk:xk)(t,e)):st(this.node(),t).delay}function Sk(e,t){return function(){bt(this,e).duration=+t.apply(this,arguments)}}function Ik(e,t){return t=+t,function(){bt(this,e).duration=t}}function Ck(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Sk:Ik)(t,e)):st(this.node(),t).duration}function Rk(e,t){if(typeof t!="function")throw new Error;return function(){bt(this,e).ease=t}}function Vk(e){var t=this._id;return arguments.length?this.each(Rk(t,e)):st(this.node(),t).ease}function Ak(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;bt(this,e).ease=o}}function Tk(e){if(typeof e!="function")throw new Error;return this.each(Ak(this._id,e))}function Mk(e){typeof e!="function"&&(e=Td(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new St(i,this._parents,this._name,this._id)}function Bk(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,l=Math.min(i,a),r=new Array(i),s=0;s<l;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new St(r,this._parents,this._name,this._id)}function Dk(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function Ok(e,t,o){var i,a,l=Dk(t)?$l:bt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Lk(e,t){var o=this._id;return arguments.length<2?st(this.node(),o).on.on(e):this.each(Ok(o,e,t))}function Pk(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function zk(){return this.on("end.remove",Pk(this._id))}function Uk(e){var t=this._name,o=this._id;typeof e!="function"&&(e=fl(e));for(var i=this._groups,a=i.length,l=new Array(a),r=0;r<a;++r)for(var s=i[r],c=s.length,d=l[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Gi(d[p],t,o,p,d,st(u,o)));return new St(l,this._parents,t,o)}function Hk(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Ad(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=st(u,o),g=0,N=p.length;g<N;++g)(m=p[g])&&Gi(m,t,o,g,p,h);l.push(p),r.push(u)}return new St(l,r,t,o)}var Fk=co.prototype.constructor;function Gk(){return new Fk(this._groups,this._parents)}function Yk(e,t){var o,i,a;return function(){var l=Vn(this,e),r=(this.style.removeProperty(e),Vn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function hu(e){return function(){this.style.removeProperty(e)}}function Wk(e,t,o){var i,a=o+"",l;return function(){var r=Vn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function qk(e,t,o){var i,a,l;return function(){var r=Vn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Vn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Kk(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=bt(this,e),d=c.on,u=c.value[l]==null?s||(s=hu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Xk(e,t,o){var i=(e+="")=="transform"?XE:pu;return t==null?this.styleTween(e,Yk(e,i)).on("end.style."+e,hu(e)):typeof t=="function"?this.styleTween(e,qk(e,i,Sl(this,"style."+e,t))).each(Kk(this._id,e)):this.styleTween(e,Wk(e,i,t),o).on("end.style."+e,null)}function jk(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Zk(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&jk(e,r,o)),i}return l._value=t,l}function Jk(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,Zk(e,t,o??""))}function Qk(e){return function(){this.textContent=e}}function eN(e){return function(){var t=e(this);this.textContent=t??""}}function tN(e){return this.tween("text",typeof e=="function"?eN(Sl(this,"text",e)):Qk(e==null?"":e+""))}function nN(e){return function(t){this.textContent=e.call(this,t)}}function oN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&nN(a)),t}return i._value=e,i}function iN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oN(e))}function aN(){for(var e=this._name,t=this._id,o=yu(),i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=st(c,t);Gi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new St(i,this._parents,e,o)}function lN(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(l,r){var s={value:r},c={value:function(){--a===0&&l()}};o.each(function(){var d=bt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&l()})}var rN=0;function St(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function yu(){return++rN}var It=co.prototype;St.prototype={constructor:St,select:Uk,selectAll:Hk,selectChild:It.selectChild,selectChildren:It.selectChildren,filter:Mk,merge:Bk,selection:Gk,transition:aN,call:It.call,nodes:It.nodes,node:It.node,size:It.size,empty:It.empty,each:It.each,on:Lk,attr:bk,attrTween:kk,style:Xk,styleTween:Jk,text:tN,textTween:iN,remove:zk,tween:uk,delay:$k,duration:Ck,ease:Vk,easeVarying:Tk,end:lN,[Symbol.iterator]:It[Symbol.iterator]};function sN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cN={time:null,delay:0,duration:250,ease:sN};function dN(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function uN(e){var t,o;e instanceof St?(t=e._id,e=e._name):(t=yu(),(o=cN).time=El(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var r=i[l],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Gi(c,e,t,d,r,o||dN(c,t));return new St(i,this._parents,e,t)}co.prototype.interrupt=sk,co.prototype.transition=uN;const Wi=e=>()=>e;function fN(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Ct(e,t,o){this.k=e,this.x=t,this.y=o}Ct.prototype={constructor:Ct,scale:function(e){return e===1?this:new Ct(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ct(this.k,this.x+this.k*e,this.y+this.k*t)},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 Il=new Ct(1,0,0);Ct.prototype;function Cl(e){e.stopImmediatePropagation()}function _o(e){e.preventDefault(),e.stopImmediatePropagation()}function mN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pN(){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 gu(){return this.__zoom||Il}function hN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yN(){return navigator.maxTouchPoints||"ontouchstart"in this}function gN(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],l=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),r>l?(l+r)/2:Math.min(0,l)||Math.max(0,r))}function bN(){var e=mN,t=pN,o=gN,i=hN,a=yN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ek,d=dl("start","zoom","end"),u,f,p,m=500,h=150,g=0,N=10;function b(_){_.property("__zoom",gu).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",oe).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",J).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",ge).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(_,w,k,K){var V=_.selection?_.selection():_;V.property("__zoom",gu),_!==V?Z(_,w,k,K):V.interrupt().each(function(){q(this,arguments).event(K).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},b.scaleBy=function(_,w,k,K){b.scaleTo(_,function(){var V=this.__zoom.k,H=typeof w=="function"?w.apply(this,arguments):w;return V*H},k,K)},b.scaleTo=function(_,w,k,K){b.transform(_,function(){var V=t.apply(this,arguments),H=this.__zoom,U=k==null?C(V):typeof k=="function"?k.apply(this,arguments):k,ce=H.invert(U),he=typeof w=="function"?w.apply(this,arguments):w;return o(y(E(H,he),U,ce),V,r)},k,K)},b.translateBy=function(_,w,k,K){b.transform(_,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),r)},null,K)},b.translateTo=function(_,w,k,K,V){b.transform(_,function(){var H=t.apply(this,arguments),U=this.__zoom,ce=K==null?C(H):typeof K=="function"?K.apply(this,arguments):K;return o(Il.translate(ce[0],ce[1]).scale(U.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof k=="function"?-k.apply(this,arguments):-k),H,r)},K,V)};function E(_,w){return w=Math.max(l[0],Math.min(l[1],w)),w===_.k?_:new Ct(w,_.x,_.y)}function y(_,w,k){var K=w[0]-k[0]*_.k,V=w[1]-k[1]*_.k;return K===_.x&&V===_.y?_:new Ct(_.k,K,V)}function C(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function Z(_,w,k,K){_.on("start.zoom",function(){q(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){q(this,arguments).event(K).end()}).tween("zoom",function(){var V=this,H=arguments,U=q(V,H).event(K),ce=t.apply(V,H),he=k==null?C(ce):typeof k=="function"?k.apply(V,H):k,me=Math.max(ce[1][0]-ce[0][0],ce[1][1]-ce[0][1]),be=V.__zoom,ue=typeof w=="function"?w.apply(V,H):w,X=c(be.invert(he).concat(me/be.k),ue.invert(he).concat(me/ue.k));return function(F){if(F===1)F=ue;else{var le=X(F),ve=me/le[2];F=new Ct(ve,he[0]-le[0]*ve,he[1]-le[1]*ve)}U.zoom(null,F)}})}function q(_,w,k){return!k&&_.__zooming||new te(_,w)}function te(_,w){this.that=_,this.args=w,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,w),this.taps=0}te.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,w){return this.mouse&&_!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&_!=="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(_){var w=Lt(this.that).datum();d.call(_,this.that,new fN(_,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),w)}};function P(_,...w){if(!e.apply(this,arguments))return;var k=q(this,w).event(_),K=this.__zoom,V=Math.max(l[0],Math.min(l[1],K.k*Math.pow(2,i.apply(this,arguments)))),H=Pt(_);if(k.wheel)(k.mouse[0][0]!==H[0]||k.mouse[0][1]!==H[1])&&(k.mouse[1]=K.invert(k.mouse[0]=H)),clearTimeout(k.wheel);else{if(K.k===V)return;k.mouse=[H,K.invert(H)],Yi(this),k.start()}_o(_),k.wheel=setTimeout(U,h),k.zoom("mouse",o(y(E(K,V),k.mouse[0],k.mouse[1]),k.extent,r));function U(){k.wheel=null,k.end()}}function oe(_,...w){if(p||!e.apply(this,arguments))return;var k=_.currentTarget,K=q(this,w,!0).event(_),V=Lt(_.view).on("mousemove.zoom",he,!0).on("mouseup.zoom",me,!0),H=Pt(_,k),U=_.clientX,ce=_.clientY;SE(_.view),Cl(_),K.mouse=[H,this.__zoom.invert(H)],Yi(this),K.start();function he(be){if(_o(be),!K.moved){var ue=be.clientX-U,X=be.clientY-ce;K.moved=ue*ue+X*X>g}K.event(be).zoom("mouse",o(y(K.that.__zoom,K.mouse[0]=Pt(be,k),K.mouse[1]),K.extent,r))}function me(be){V.on("mousemove.zoom mouseup.zoom",null),IE(be.view,K.moved),_o(be),K.event(be).end()}}function z(_,...w){if(e.apply(this,arguments)){var k=this.__zoom,K=Pt(_.changedTouches?_.changedTouches[0]:_,this),V=k.invert(K),H=k.k*(_.shiftKey?.5:2),U=o(y(E(k,H),K,V),t.apply(this,w),r);_o(_),s>0?Lt(this).transition().duration(s).call(Z,U,K,_):Lt(this).call(b.transform,U,K,_)}}function J(_,...w){if(e.apply(this,arguments)){var k=_.touches,K=k.length,V=q(this,w,_.changedTouches.length===K).event(_),H,U,ce,he;for(Cl(_),U=0;U<K;++U)ce=k[U],he=Pt(ce,this),he=[he,this.__zoom.invert(he),ce.identifier],V.touch0?!V.touch1&&V.touch0[2]!==he[2]&&(V.touch1=he,V.taps=0):(V.touch0=he,H=!0,V.taps=1+!!u);u&&(u=clearTimeout(u)),H&&(V.taps<2&&(f=he[0],u=setTimeout(function(){u=null},m)),Yi(this),V.start())}}function W(_,...w){if(this.__zooming){var k=q(this,w).event(_),K=_.changedTouches,V=K.length,H,U,ce,he;for(_o(_),H=0;H<V;++H)U=K[H],ce=Pt(U,this),k.touch0&&k.touch0[2]===U.identifier?k.touch0[0]=ce:k.touch1&&k.touch1[2]===U.identifier&&(k.touch1[0]=ce);if(U=k.that.__zoom,k.touch1){var me=k.touch0[0],be=k.touch0[1],ue=k.touch1[0],X=k.touch1[1],F=(F=ue[0]-me[0])*F+(F=ue[1]-me[1])*F,le=(le=X[0]-be[0])*le+(le=X[1]-be[1])*le;U=E(U,Math.sqrt(F/le)),ce=[(me[0]+ue[0])/2,(me[1]+ue[1])/2],he=[(be[0]+X[0])/2,(be[1]+X[1])/2]}else if(k.touch0)ce=k.touch0[0],he=k.touch0[1];else return;k.zoom("touch",o(y(U,ce,he),k.extent,r))}}function ge(_,...w){if(this.__zooming){var k=q(this,w).event(_),K=_.changedTouches,V=K.length,H,U;for(Cl(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),H=0;H<V;++H)U=K[H],k.touch0&&k.touch0[2]===U.identifier?delete k.touch0:k.touch1&&k.touch1[2]===U.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(U=Pt(U,this),Math.hypot(f[0]-U[0],f[1]-U[1])<N)){var ce=Lt(this).on("dblclick.zoom");ce&&ce.apply(this,arguments)}}}return b.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:Wi(+_),b):i},b.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Wi(!!_),b):e},b.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:Wi(!!_),b):a},b.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Wi([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),b):t},b.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],b):[l[0],l[1]]},b.translateExtent=function(_){return arguments.length?(r[0][0]=+_[0][0],r[1][0]=+_[1][0],r[0][1]=+_[0][1],r[1][1]=+_[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(_){return arguments.length?(o=_,b):o},b.duration=function(_){return arguments.length?(s=+_,b):s},b.interpolate=function(_){return arguments.length?(c=_,b):c},b.on=function(){var _=d.on.apply(d,arguments);return _===d?b:_},b.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,b):Math.sqrt(g)},b.tapDistance=function(_){return arguments.length?(N=+_,b):N},b}const bu=Symbol("MiniMapSlots"),_N=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],vN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},wN=n.defineComponent({...vN,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:t}){const o=e,i=n.inject(bu),a=n.useAttrs(),l=n.toRef(()=>a.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,p)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||l.value.background||l.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,_N))],64)):n.createCommentVNode("",!0)}}),EN=["width","height","viewBox","aria-labelledby"],kN=["id"],NN=["d","fill","stroke","stroke-width"],xN={name:"MiniMap",compatConfig:{MODE:3}},$N=n.defineComponent({...xN,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:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:h}=Ve(),g=n.ref();n.provide(bu,o);const N=n.toRef(()=>{var V;return e.width??((V=i.style)==null?void 0:V.width)??a}),b=n.toRef(()=>{var V;return e.height??((V=i.style)==null?void 0:V.height)??l}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),C=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),Z=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),q=n.computed(()=>Ga(h.value.filter(V=>!V.hidden))),te=n.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})),P=n.computed(()=>h.value&&h.value.length?mg(q.value,te.value):te.value),oe=n.computed(()=>{const V=P.value.width/N.value,H=P.value.height/b.value;return Math.max(V,H)}),z=n.computed(()=>{const V=oe.value*N.value,H=oe.value*b.value,U=e.offsetScale*oe.value;return{offset:U,x:P.value.x-(V-P.value.width)/2-U,y:P.value.y-(H-P.value.height)/2-U,width:V+U*2,height:H+U*2}}),J=n.computed(()=>!z.value.x||!z.value.y?"":`
|
|
28
|
-
M${
|
|
29
|
-
h${
|
|
30
|
-
v${
|
|
31
|
-
h${-
|
|
32
|
-
M${
|
|
33
|
-
h${
|
|
27
|
+
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 Fe extends Error{constructor(t,...o){var i;super((i=Sc[t])==null?void 0:i.call(Sc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Zl(e){return"clientX"in e}function Rg(e){return"sourceEvent"in e}function yt(e,t){const o=Zl(e);let i,l;return o?(i=e.clientX,l=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,l=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,l=e.changedTouches[0].clientY):(i=0,l=0),{x:i-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}}const so=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Vg(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function pi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Ag=()=>!0;function Jl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Tg(e,t,o){const i=[],l={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const a of t.values())di(l,ci(a))>0&&i.push(a);return i}const Bg=250;function Mg(e,t,o,i){var l,a;let r=[],s=Number.POSITIVE_INFINITY;const d=Tg(e,o,t+Bg);for(const c of d){const u=[...((l=c.handleBounds)==null?void 0:l.source)??[],...((a=c.handleBounds)==null?void 0:a.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:p,y:m}=xn(c,f,f.position,!0),h=Math.sqrt((p-e.x)**2+(m-e.y)**2);h>t||(h<s?(r=[{...f,x:p,y:m}],s=h):h===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const c=i.type==="source"?"target":"source";return r.find(u=>u.type===c)??r[0]}return r[0]}function Ic(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:l,fromType:a,doc:r,lib:s,flowId:d,isValidConnection:c=Ag},u,f,p,m){const h=a==="target",g=t?r.querySelector(`.${s}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:w,y:b}=yt(e),S=r.elementFromPoint(w,b),y=S!=null&&S.classList.contains(`${s}-flow__handle`)?S:g,x={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const J=Cc(void 0,y),G=y.getAttribute("data-nodeid"),j=y.getAttribute("data-handleid"),U=y.classList.contains("connectable"),Q=y.classList.contains("connectableend");if(!G||!J)return x;const te={source:h?G:i,sourceHandle:h?j:l,target:h?i:G,targetHandle:h?l:j};x.connection=te;const P=U&&Q&&(o===xt.Strict?h&&J==="source"||!h&&J==="target":G!==i||j!==l);x.isValid=P&&c(te,{nodes:f,edges:u,sourceNode:p(te.source),targetNode:p(te.target)}),x.toHandle=Rc(G,J,j,m,o,!0)}return x}function Cc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Dg(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Og(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Rc(e,t,o,i,l,a=!1){var r,s,d;const c=i.get(e);if(!c)return null;const u=l===xt.Strict?(r=c.handleBounds)==null?void 0:r[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((d=c.handleBounds)==null?void 0:d.target)??[]],f=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return f&&a?{...f,...xn(c,f,f.position,!0)}:f}const Ql={[ke.Left]:ke.Right,[ke.Right]:ke.Left,[ke.Top]:ke.Bottom,[ke.Bottom]:ke.Top},Lg=["production","prod"];function co(e,...t){Vc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Vc(){return!Lg.includes(process.env.NODE_ENV||"")}function Ac(e,t,o,i,l){const a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:l,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...ui(r)}}):null}function ea(e,t,o,i,l,a=!1,r){l.value=!1,e.selected?(a||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function He(e){return typeof n.unref(e)<"u"}function Pg(e,t,o,i){if(!e||!e.source||!e.target)return o(new Fe(Ue.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let l;return Mt(e)?l=e:l={...e,id:uc(e)},l=cc(l,void 0,i),_g(l,t)?!1:l}function zg(e,t,o,i,l){if(!t.source||!t.target)return l(new Fe(Ue.EDGE_INVALID,e.id)),!1;if(!o)return l(new Fe(Ue.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...r}=e;return{...r,id:i?uc(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Tc(e,t,o){const i={},l=[];for(let a=0;a<e.length;++a){const r=e[a];if(!en(r)){o(new Fe(Ue.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const s=yg(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),l[a]=s}for(const a of l){const r=t(a.parentNode)||l.find(s=>s.id===a.parentNode);a.parentNode&&!r&&o(new Fe(Ue.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||i[a.id])&&(i[a.id]&&(a.isParent=!0),r&&(r.isParent=!0))}return l}function Bc(e,t,o,i,l,a){let r=l;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${l}-${e}`;const d=i.get(r)||new Map;if(i.set(r,d.set(o,t)),a){r=`${l}-${e}-${a}`;const c=i.get(r)||new Map;i.set(r,c.set(o,t))}}function ta(e,t,o){e.clear();for(const i of o){const{source:l,target:a,sourceHandle:r=null,targetHandle:s=null}=i,d={edgeId:i.id,source:l,target:a,sourceHandle:r,targetHandle:s},c=`${l}-${r}--${a}-${s}`,u=`${a}-${s}--${l}-${r}`;Bc("source",d,u,e,l,r),Bc("target",d,c,e,a,s)}}function Mc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function na(e,t,o,i,l,a,r,s){const d=[];for(const c of e){const u=Mt(c)?c:Pg(c,s,l,a);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){l(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){l(new Fe(Ue.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){l(new Fe(Ue.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){l(new Fe(Ue.EDGE_INVALID,u.id));continue}const m=i(u.id);d.push({...cc(u,m,a),sourceNode:f,targetNode:p})}return d}const Dc=Symbol("vueFlow"),Oc=Symbol("nodeId"),Lc=Symbol("nodeRef"),Ug=Symbol("edgeId"),Hg=Symbol("edgeRef"),hi=Symbol("slots");function Pc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:l,nodeLookup:a,nodeExtent:r,nodeDragThreshold:s,viewport:d,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:w,removeSelectedElements:b,addSelectedNodes:S,updateNodePositions:y,emits:x}=Ae(),{onStart:J,onDrag:G,onStop:j,onClick:U,el:Q,disabled:te,id:de,selectable:P,dragHandle:le}=e,_=n.shallowRef(!1);let R=[],k,z=null,W={x:void 0,y:void 0},K={x:0,y:0},T=null,oe=!1,ce=!1,me=0,ge=!1;const se=Yg(),fe=({x:Y,y:D})=>{W={x:Y,y:D};let M=!1;if(R=R.map(B=>{const F={x:Y-B.distance.x,y:D-B.distance.y},{computedPosition:ne}=jl(B,o.value?pi(F,i.value):F,x.error,r.value,B.parentNode?m(B.parentNode):void 0);return M=M||B.position.x!==ne.x||B.position.y!==ne.y,B.position=ne,B}),ce=ce||M,!!M&&(y(R,!0,!0),_.value=!0,T)){const[B,F]=Xl({id:de,dragItems:R,findNode:m});G({event:T,node:B,nodes:F})}},ye=()=>{if(!z)return;const[Y,D]=bc(K,z,u.value);if(Y!==0||D!==0){const M={x:(W.x??0)-Y/d.value.zoom,y:(W.y??0)-D/d.value.zoom};p({x:Y,y:D})&&fe(M)}me=requestAnimationFrame(ye)},Ne=(Y,D)=>{oe=!0;const M=m(de);!w.value&&!h.value&&M&&(M.selected||b()),M&&n.toValue(P)&&w.value&&ea(M,h.value,S,b,g,!1,D);const B=se(Y.sourceEvent);if(W=B,R=Ng(a.value,f.value,B,de),R.length){const[F,ne]=Xl({id:de,dragItems:R,findNode:m});J({event:Y.sourceEvent,node:F,nodes:ne})}},ve=(Y,D)=>{var M;Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||(ce=!1,s.value===0&&Ne(Y,D),W=se(Y.sourceEvent),z=((M=t.value)==null?void 0:M.getBoundingClientRect())||null,K=yt(Y.sourceEvent,z))},$e=(Y,D)=>{const M=se(Y.sourceEvent);if(!ge&&oe&&c.value&&(ge=!0,ye()),!oe){const B=M.xSnapped-(W.x??0),F=M.ySnapped-(W.y??0);Math.sqrt(B*B+F*F)>s.value&&Ne(Y,D)}(W.x!==M.xSnapped||W.y!==M.ySnapped)&&R.length&&oe&&(T=Y.sourceEvent,K=yt(Y.sourceEvent,z),fe(M))},q=Y=>{let D=!1;if(!oe&&!_.value&&!h.value){const M=Y.sourceEvent,B=se(M),F=B.xSnapped-(W.x??0),ne=B.ySnapped-(W.y??0),X=Math.sqrt(F*F+ne*ne);X!==0&&X<=s.value&&(U==null||U(M),D=!0)}if(R.length&&!D){ce&&(y(R,!1,!1),ce=!1);const[M,B]=Xl({id:de,dragItems:R,findNode:m});j({event:Y.sourceEvent,node:M,nodes:B})}R=[],_.value=!1,ge=!1,oe=!1,W={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(te),Q],([Y,D],M,B)=>{if(D){const F=lt(D);Y||(k=hh().on("start",ne=>ve(ne,D)).on("drag",ne=>$e(ne,D)).on("end",ne=>q(ne)).filter(ne=>{const X=ne.target,E=n.toValue(le);return!ne.button&&(!l.value||!Nc(X,`.${l.value}`,D)&&(!E||Nc(X,E,D)))}),F.call(k)),B(()=>{F.on(".drag",null),k&&(k.on("start",null),k.on("drag",null),k.on("end",null))})}}),_}function Fg(){return{doubleClick:we(),click:we(),mouseEnter:we(),mouseMove:we(),mouseLeave:we(),contextMenu:we(),updateStart:we(),update:we(),updateEnd:we()}}function Gg(e,t){const o=Fg();return o.doubleClick.on(i=>{var l,a;t.edgeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.edgeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.edgeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.edgeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.edgeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.edgeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.updateStart.on(i=>{var l,a;t.edgeUpdateStart(i),(a=(l=e.events)==null?void 0:l.updateStart)==null||a.call(l,i)}),o.update.on(i=>{var l,a;t.edgeUpdate(i),(a=(l=e.events)==null?void 0:l.update)==null||a.call(l,i)}),o.updateEnd.on(i=>{var l,a;t.edgeUpdateEnd(i),(a=(l=e.events)==null?void 0:l.updateEnd)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function Yg(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Ae();return l=>{var a;const r=((a=i.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},s=Rg(l)?l.sourceEvent:l,{x:d,y:c}=yt(s,r),u=ao({x:d,y:c},e.value),{x:f,y:p}=o.value?pi(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function yi(){return!0}function zc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:l,onEdgeUpdate:a,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:d,connectionMode:c,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:g,findNode:w,panBy:b,startConnection:S,updateConnection:y,endConnection:x,emits:J,viewport:G,edges:j,nodes:U,isValidConnection:Q,nodeLookup:te}=Ae();let de=null,P=!1,le=null;function _(k){var z;const W=n.toValue(o)==="target",K=Zl(k),T=sc(k.target),oe=k.currentTarget;if(oe&&(K&&k.button===0||!K)){let ce=function(N){M=yt(N,q),fe=Mg(ao(M,G.value,!1,[1,1]),u.value,te.value,ne),B||(F(),B=!0);const O=Ic(N,{handle:fe,connectionMode:c.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:W?"target":"source",isValidConnection:se,doc:T,lib:"vue",flowId:s,nodeLookup:te.value},j.value,U.value,w,te.value);le=O.handleDomNode,de=O.connection,P=Og(!!fe,O.isValid);const V={...H,isValid:P,to:O.toHandle&&P?lo({x:O.toHandle.x,y:O.toHandle.y},G.value):M,toHandle:O.toHandle,toPosition:P&&O.toHandle?O.toHandle.position:Ql[ne.position],toNode:O.toHandle?te.value.get(O.toHandle.nodeId):null};if(P&&fe&&(H!=null&&H.toHandle)&&V.toHandle&&H.toHandle.type===V.toHandle.type&&H.toHandle.nodeId===V.toHandle.nodeId&&H.toHandle.id===V.toHandle.id&&H.to.x===V.to.x&&H.to.y===V.to.y)return;const re=fe??O.toHandle;if(y(re&&P?lo({x:re.x,y:re.y},G.value):M,re,Dg(!!re,P)),H=V,!fe&&!P&&!le)return Jl(D);de&&de.source!==de.target&&le&&(Jl(D),D=le,le.classList.add("connecting","vue-flow__handle-connecting"),le.classList.toggle("valid",!!P),le.classList.toggle("vue-flow__handle-valid",!!P))},me=function(N){"touches"in N&&N.touches.length>0||((fe||le)&&de&&P&&(a?a(N,de):J.connect(de)),J.connectEnd(N),l&&(r==null||r(N)),Jl(D),cancelAnimationFrame(ye),x(N),B=!1,P=!1,de=null,le=null,T.removeEventListener("mousemove",ce),T.removeEventListener("mouseup",me),T.removeEventListener("touchmove",ce),T.removeEventListener("touchend",me))};const ge=w(n.toValue(t));let se=n.toValue(i)||Q.value||yi;!se&&ge&&(se=(W?ge.isValidSourcePos:ge.isValidTargetPos)||yi);let fe,ye=0;const{x:Ne,y:ve}=yt(k),$e=Cc(n.toValue(l),oe),q=(z=d.value)==null?void 0:z.getBoundingClientRect();if(!q||!$e)return;const Y=Rc(n.toValue(t),$e,n.toValue(e),te.value,c.value);if(!Y)return;let D,M=yt(k,q),B=!1;const F=()=>{if(!h.value)return;const[N,O]=bc(M,q,g.value);b({x:N,y:O}),ye=requestAnimationFrame(F)},ne={...Y,nodeId:n.toValue(t),type:$e,position:Y.position},X=te.value.get(n.toValue(t)),$={inProgress:!0,isValid:null,from:xn(X,ne,ke.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:X,to:M,toHandle:null,toPosition:Ql[ne.position],toNode:null};S({nodeId:n.toValue(t),id:n.toValue(e),type:$e,position:(oe==null?void 0:oe.getAttribute("data-handlepos"))||ke.Top,...M},{x:Ne-q.left,y:ve-q.top}),J.connectStart({event:k,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:$e});let H=$;T.addEventListener("mousemove",ce),T.addEventListener("mouseup",me),T.addEventListener("touchmove",ce),T.addEventListener("touchend",me)}}function R(k){var z,W;if(!f.value)return;const K=n.toValue(o)==="target";if(!p.value){J.clickConnectStart({event:k,nodeId:n.toValue(t),handleId:n.toValue(e)}),S({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:ke.Top,...yt(k)},void 0,!0);return}let T=n.toValue(i)||Q.value||yi;const oe=w(n.toValue(t));if(!T&&oe&&(T=(K?oe.isValidSourcePos:oe.isValidTargetPos)||yi),oe&&(typeof oe.connectable>"u"?m.value:oe.connectable)===!1)return;const ce=sc(k.target),me=Ic(k,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:ke.Top,...yt(k)},connectionMode:c.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:T,doc:ce,lib:"vue",flowId:s,nodeLookup:te.value},j.value,U.value,w,te.value),ge=((z=me.connection)==null?void 0:z.source)===((W=me.connection)==null?void 0:W.target);me.isValid&&me.connection&&!ge&&J.connect(me.connection),J.clickConnectEnd(k),x(k,!0)}return{handlePointerDown:_,handleClick:R}}function Wg(){return n.inject(Oc,"")}function Uc(e){const t=e??Wg()??"",o=n.inject(Lc,n.ref(null)),{findNode:i,edges:l,emits:a}=Ae(),r=i(t);return r||a.error(new Fe(Ue.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>tn([r],l.value))}}function qg(){return{doubleClick:we(),click:we(),mouseEnter:we(),mouseMove:we(),mouseLeave:we(),contextMenu:we(),dragStart:we(),drag:we(),dragStop:we()}}function Kg(e,t){const o=qg();return o.doubleClick.on(i=>{var l,a;t.nodeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.nodeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.nodeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.nodeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.nodeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.nodeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.dragStart.on(i=>{var l,a;t.nodeDragStart(i),(a=(l=e.events)==null?void 0:l.dragStart)==null||a.call(l,i)}),o.drag.on(i=>{var l,a;t.nodeDrag(i),(a=(l=e.events)==null?void 0:l.drag)==null||a.call(l,i)}),o.dragStop.on(i=>{var l,a;t.nodeDragStop(i),(a=(l=e.events)==null?void 0:l.dragStop)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function Hc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:l,snapToGrid:a,nodesDraggable:r,emits:s}=Ae();return(d,c=!1)=>{const u=a.value?l.value[0]:5,f=a.value?l.value[1]:5,p=c?4:1,m=d.x*u*p,h=d.y*f*p,g=[];for(const w of e.value)if(w.draggable||r&&typeof w.draggable>"u"){const b={x:w.computedPosition.x+m,y:w.computedPosition.y+h},{position:S}=jl(w,b,s.error,t.value,w.parentNode?i(w.parentNode):void 0);g.push({id:w.id,position:S,from:w.position,distance:{x:d.x,y:d.y},dimensions:w.dimensions})}o(g,!0,!1)}}const gi=.1,Xg=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Lt(){return co("Viewport not initialized yet."),Promise.resolve(!1)}const jg={zoomIn:Lt,zoomOut:Lt,zoomTo:Lt,fitView:Lt,setCenter:Lt,fitBounds:Lt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Lt,setTransform:Lt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Zg(e){function t(i,l){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?jn:Qo).scaleBy(oa(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{a(!0)}),i):a(!1)})}function o(i,l,a,r){return new Promise(s=>{var d;const{x:c,y:u}=rc({x:-i,y:-l},e.translateExtent),f=kn.translate(-c,-u).scale(a);e.d3Selection&&e.d3Zoom?(d=e.d3Zoom)==null||d.interpolate((r==null?void 0:r.interpolate)==="linear"?jn:Qo).transform(oa(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:l=>t(1.2,l),zoomOut:l=>t(1/1.2,l),zoomTo:(l,a)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?jn:Qo).scaleTo(oa(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),l):r(!1)}),setViewport:(l,a)=>o(l.x,l.y,l.zoom,a),setTransform:(l,a)=>o(l.x,l.y,l.zoom,a),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:(l={padding:gi,includeHiddenNodes:!1,duration:0})=>{var a,r;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((l==null?void 0:l.includeHiddenNodes)||!p.hidden)&&(!((a=l.nodes)!=null&&a.length)||(r=l.nodes)!=null&&r.length&&l.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const d=Wl(s),{x:c,y:u,zoom:f}=hc(d,e.dimensions.width,e.dimensions.height,l.minZoom??e.minZoom,l.maxZoom??e.maxZoom,l.padding??gi);return o(c,u,f,l)},setCenter:(l,a,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,d=e.dimensions.width/2-l*s,c=e.dimensions.height/2-a*s;return o(d,c,s,r)},fitBounds:(l,a={padding:gi})=>{const{x:r,y:s,zoom:d}=hc(l,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding??gi);return o(r,s,d,a)},project:l=>ao(l,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x-a,y:l.y-r};return ao(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x+a,y:l.y+r};return lo(s,e.viewport)}return{x:0,y:0}}}:jg)}function oa(e,t=0,o=Xg,i=()=>{}){const l=typeof t=="number"&&t>0;return l||i(),l?e.transition().duration(t).ease(o).on("end",i):e}function Jg(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const l=()=>{i.run(()=>{let g,w,b=!!(o.nodes.value.length||o.edges.value.length);g=bn([e.modelValue,()=>{var S,y;return(y=(S=e.modelValue)==null?void 0:S.value)==null?void 0:y.length}],([S])=>{S&&Array.isArray(S)&&(w==null||w.pause(),o.setElements(S),!w&&!b&&S.length?b=!0:w==null||w.resume())}),w=bn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([S,y])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...S,...y],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),w==null||w.stop()})})},a=()=>{i.run(()=>{let g,w,b=!!o.nodes.value.length;g=bn([e.nodes,()=>{var S,y;return(y=(S=e.nodes)==null?void 0:S.value)==null?void 0:y.length}],([S])=>{S&&Array.isArray(S)&&(w==null||w.pause(),o.setNodes(S),!w&&!b&&S.length?b=!0:w==null||w.resume())}),w=bn([o.nodes,()=>o.nodes.value.length],([S])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...S],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),w==null||w.stop()})})},r=()=>{i.run(()=>{let g,w,b=!!o.edges.value.length;g=bn([e.edges,()=>{var S,y;return(y=(S=e.edges)==null?void 0:S.value)==null?void 0:y.length}],([S])=>{S&&Array.isArray(S)&&(w==null||w.pause(),o.setEdges(S),!w&&!b&&S.length?b=!0:w==null||w.resume())}),w=bn([o.edges,()=>o.edges.value.length],([S])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...S],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),w==null||w.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&He(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&He(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&He(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&He(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{He(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async w=>{let b=w;typeof t.autoConnect=="function"&&(b=await t.autoConnect(w)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{He(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(w,b,S)=>{w?o.onConnect(g):o.hooks.value.connect.off(g),S(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},m=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const w of Object.keys(t)){const b=w;if(!g.includes(b)){const S=n.toRef(()=>t[b]),y=o[b];n.isRef(y)&&i.run(()=>{n.watch(S,x=>{He(x)&&(y.value=x)},{immediate:!0})})}}};(()=>{l(),a(),r(),d(),s(),c(),u(),f(),p(),m()})()}),()=>i.stop()}function Qg(){return{edgesChange:we(),nodesChange:we(),nodeDoubleClick:we(),nodeClick:we(),nodeMouseEnter:we(),nodeMouseMove:we(),nodeMouseLeave:we(),nodeContextMenu:we(),nodeDragStart:we(),nodeDrag:we(),nodeDragStop:we(),nodesInitialized:we(),miniMapNodeClick:we(),miniMapNodeDoubleClick:we(),miniMapNodeMouseEnter:we(),miniMapNodeMouseMove:we(),miniMapNodeMouseLeave:we(),connect:we(),connectStart:we(),connectEnd:we(),clickConnectStart:we(),clickConnectEnd:we(),paneReady:we(),init:we(),move:we(),moveStart:we(),moveEnd:we(),selectionDragStart:we(),selectionDrag:we(),selectionDragStop:we(),selectionContextMenu:we(),selectionStart:we(),selectionEnd:we(),viewportChangeStart:we(),viewportChange:we(),viewportChangeEnd:we(),paneScroll:we(),paneClick:we(),paneContextMenu:we(),paneMouseEnter:we(),paneMouseMove:we(),paneMouseLeave:we(),edgeContextMenu:we(),edgeMouseEnter:we(),edgeMouseMove:we(),edgeMouseLeave:we(),edgeDoubleClick:we(),edgeClick:we(),edgeUpdateStart:we(),edgeUpdate:we(),edgeUpdateEnd:we(),updateNodeInternals:we(),error:we(e=>co(e.message))}}function eb(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[l,a]of Object.entries(t.value)){const r=s=>{e(l,s)};a.setEmitter(r),Gn(a.removeEmitter),a.setHasEmitListeners(()=>i(l)),Gn(a.removeHasEmitListeners)}});function i(l){var a;const r=tb(l);return!!((a=o==null?void 0:o.vnode.props)==null?void 0:a[r])}}function tb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(l,a)=>a.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Fc(){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:Fl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:no.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:Jt.Bezier,style:{}},connectionMode:xt.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:so()?"Meta":"Control",zoomActivationKeyCode:so()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Qg(),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 nb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function ob(e,t,o){const i=Zg(e),l=M=>{const B=M??[];e.hooks.updateNodeInternals.trigger(B)},a=M=>bg(M,e.nodes,e.edges),r=M=>gg(M,e.nodes,e.edges),s=M=>tn(M,e.edges),d=({id:M,type:B,nodeId:F})=>{var ne;const X=M?`-${B}-${M}`:`-${B}`;return Array.from(((ne=e.connectionLookup.get(`${F}${X}`))==null?void 0:ne.values())??[])},c=M=>{if(M)return t.value.get(M)},u=M=>{if(M)return o.value.get(M)},f=(M,B,F)=>{var ne,X;const E=[];for(const $ of M){const H={id:$.id,type:"position",dragging:F,from:$.from};if(B&&(H.position=$.position,$.parentNode)){const N=c($.parentNode);H.position={x:H.position.x-(((ne=N==null?void 0:N.computedPosition)==null?void 0:ne.x)??0),y:H.position.y-(((X=N==null?void 0:N.computedPosition)==null?void 0:X.y)??0)}}E.push(H)}E!=null&&E.length&&e.hooks.nodesChange.trigger(E)},p=M=>{if(!e.vueFlowRef)return;const B=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!B)return;const F=window.getComputedStyle(B),{m22:ne}=new window.DOMMatrixReadOnly(F.transform),X=[];for(const E of M){const $=E,H=c($.id);if(H){const N=ui($.nodeElement);if(!!(N.width&&N.height&&(H.dimensions.width!==N.width||H.dimensions.height!==N.height||$.forceUpdate))){const V=$.nodeElement.getBoundingClientRect();H.dimensions=N,H.handleBounds.source=Ac("source",$.nodeElement,V,ne,H.id),H.handleBounds.target=Ac("target",$.nodeElement,V,ne,H.id),X.push({id:H.id,type:"dimensions",dimensions:N})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},m=(M,B)=>{const F=new Set,ne=new Set;for(const $ of M)en($)?F.add($.id):Mt($)&&ne.add($.id);const X=Ot(t.value,F,!0),E=Ot(o.value,ne);if(e.multiSelectionActive){for(const $ of F)X.push(Dt($,B));for(const $ of ne)E.push(Dt($,B))}X.length&&e.hooks.nodesChange.trigger(X),E.length&&e.hooks.edgesChange.trigger(E)},h=M=>{if(e.multiSelectionActive){const B=M.map(F=>Dt(F.id,!0));e.hooks.nodesChange.trigger(B);return}e.hooks.nodesChange.trigger(Ot(t.value,new Set(M.map(B=>B.id)),!0)),e.hooks.edgesChange.trigger(Ot(o.value))},g=M=>{if(e.multiSelectionActive){const B=M.map(F=>Dt(F.id,!0));e.hooks.edgesChange.trigger(B);return}e.hooks.edgesChange.trigger(Ot(o.value,new Set(M.map(B=>B.id)))),e.hooks.nodesChange.trigger(Ot(t.value,new Set,!0))},w=M=>{m(M,!0)},b=M=>{const F=(M||e.nodes).map(ne=>(ne.selected=!1,Dt(ne.id,!1)));e.hooks.nodesChange.trigger(F)},S=M=>{const F=(M||e.edges).map(ne=>(ne.selected=!1,Dt(ne.id,!1)));e.hooks.edgesChange.trigger(F)},y=M=>{if(!M||!M.length)return m([],!1);const B=M.reduce((F,ne)=>{const X=Dt(ne.id,!1);return en(ne)?F.nodes.push(X):F.edges.push(X),F},{nodes:[],edges:[]});B.nodes.length&&e.hooks.nodesChange.trigger(B.nodes),B.edges.length&&e.hooks.edgesChange.trigger(B.edges)},x=M=>{var B;(B=e.d3Zoom)==null||B.scaleExtent([M,e.maxZoom]),e.minZoom=M},J=M=>{var B;(B=e.d3Zoom)==null||B.scaleExtent([e.minZoom,M]),e.maxZoom=M},G=M=>{var B;(B=e.d3Zoom)==null||B.translateExtent(M),e.translateExtent=M},j=M=>{e.nodeExtent=M,l()},U=M=>{var B;(B=e.d3Zoom)==null||B.clickDistance(M)},Q=M=>{e.nodesDraggable=M,e.nodesConnectable=M,e.elementsSelectable=M},te=M=>{const B=M instanceof Function?M(e.nodes):M;!e.initialized&&!B.length||(e.nodes=Tc(B,c,e.hooks.error.trigger))},de=M=>{const B=M instanceof Function?M(e.edges):M;if(!e.initialized&&!B.length)return;const F=na(B,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ta(e.connectionLookup,o.value,F),e.edges=F},P=M=>{const B=M instanceof Function?M([...e.nodes,...e.edges]):M;!e.initialized&&!B.length||(te(B.filter(en)),de(B.filter(Mt)))},le=M=>{let B=M instanceof Function?M(e.nodes):M;B=Array.isArray(B)?B:[B];const F=Tc(B,c,e.hooks.error.trigger),ne=[];for(const X of F)ne.push(wc(X));ne.length&&e.hooks.nodesChange.trigger(ne)},_=M=>{let B=M instanceof Function?M(e.edges):M;B=Array.isArray(B)?B:[B];const F=na(B,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),ne=[];for(const X of F)ne.push(wc(X));ne.length&&e.hooks.edgesChange.trigger(ne)},R=(M,B=!0,F=!1)=>{const ne=M instanceof Function?M(e.nodes):M,X=Array.isArray(ne)?ne:[ne],E=[],$=[];function H(O){const V=s(O);for(const re of V)(!He(re.deletable)||re.deletable)&&$.push(Ec(re.id,re.source,re.target,re.sourceHandle,re.targetHandle))}function N(O){const V=[];for(const re of e.nodes)re.parentNode===O&&V.push(re);if(V.length){for(const re of V)E.push(vc(re.id));B&&H(V);for(const re of V)N(re.id)}}for(const O of X){const V=typeof O=="string"?c(O):O;V&&(He(V.deletable)&&!V.deletable||(E.push(vc(V.id)),B&&H([V]),F&&N(V.id)))}$.length&&e.hooks.edgesChange.trigger($),E.length&&e.hooks.nodesChange.trigger(E)},k=M=>{const B=M instanceof Function?M(e.edges):M,F=Array.isArray(B)?B:[B],ne=[];for(const X of F){const E=typeof X=="string"?u(X):X;E&&(He(E.deletable)&&!E.deletable||ne.push(Ec(typeof X=="string"?X:X.id,E.source,E.target,E.sourceHandle,E.targetHandle)))}e.hooks.edgesChange.trigger(ne)},z=(M,B,F=!0)=>{const ne=u(M.id);if(!ne)return!1;const X=e.edges.indexOf(ne),E=zg(M,B,ne,F,e.hooks.error.trigger);if(E){const[$]=na([E],e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((H,N)=>N===X?$:H),ta(e.connectionLookup,o.value,[$]),$}return!1},W=(M,B,F={replace:!1})=>{const ne=u(M);if(!ne)return;const X=typeof B=="function"?B(ne):B;ne.data=F.replace?X:{...ne.data,...X}},K=M=>_c(M,e.nodes),T=M=>{const B=_c(M,e.edges);return ta(e.connectionLookup,o.value,B),B},oe=(M,B,F={replace:!1})=>{const ne=c(M);if(!ne)return;const X=typeof B=="function"?B(ne):B;F.replace?e.nodes.splice(e.nodes.indexOf(ne),1,X):Object.assign(ne,X)},ce=(M,B,F={replace:!1})=>{const ne=c(M);if(!ne)return;const X=typeof B=="function"?B(ne):B;ne.data=F.replace?X:{...ne.data,...X}},me=(M,B,F=!1)=>{F?e.connectionClickStartHandle=M:e.connectionStartHandle=M,e.connectionEndHandle=null,e.connectionStatus=null,B&&(e.connectionPosition=B)},ge=(M,B=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=M,e.connectionEndHandle=B,e.connectionStatus=F)},se=(M,B)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,B?e.connectionClickStartHandle=null:e.connectionStartHandle=null},fe=M=>{const B=hg(M),F=B?null:io(M)?M:c(M.id);return!B&&!F?[null,null,B]:[B?M:ci(F),F,B]},ye=(M,B=!0,F=e.nodes)=>{const[ne,X,E]=fe(M);if(!ne)return[];const $=[];for(const H of F||e.nodes){if(!E&&(H.id===X.id||!H.computedPosition))continue;const N=ci(H),O=di(N,ne);(B&&O>0||O>=N.width*N.height||O>=Number(ne.width)*Number(ne.height))&&$.push(H)}return $},Ne=(M,B,F=!0)=>{const[ne]=fe(M);if(!ne)return!1;const X=di(ne,B);return F&&X>0||X>=Number(ne.width)*Number(ne.height)},ve=M=>{const{viewport:B,dimensions:F,d3Zoom:ne,d3Selection:X,translateExtent:E}=e;if(!ne||!X||!M.x&&!M.y)return!1;const $=kn.translate(B.x+M.x,B.y+M.y).scale(B.zoom),H=[[0,0],[F.width,F.height]],N=ne.constrain()($,H,E),O=e.viewport.x!==N.x||e.viewport.y!==N.y||e.viewport.zoom!==N.k;return ne.transform(X,N),O},$e=M=>{const B=M instanceof Function?M(e):M,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];He(B.defaultEdgeOptions)&&(e.defaultEdgeOptions=B.defaultEdgeOptions);const ne=B.modelValue||B.nodes||B.edges?[]:void 0;ne&&(B.modelValue&&ne.push(...B.modelValue),B.nodes&&ne.push(...B.nodes),B.edges&&ne.push(...B.edges),P(ne));const X=()=>{He(B.maxZoom)&&J(B.maxZoom),He(B.minZoom)&&x(B.minZoom),He(B.translateExtent)&&G(B.translateExtent)};for(const E of Object.keys(B)){const $=E,H=B[$];![...nb,...F].includes($)&&He(H)&&(e[$]=H)}El(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:P,setNodes:te,setEdges:de,addNodes:le,addEdges:_,removeNodes:R,removeEdges:k,findNode:c,findEdge:u,updateEdge:z,updateEdgeData:W,updateNode:oe,updateNodeData:ce,applyEdgeChanges:T,applyNodeChanges:K,addSelectedElements:w,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:x,setMaxZoom:J,setTranslateExtent:G,setNodeExtent:j,setPaneClickDistance:U,removeSelectedElements:y,removeSelectedNodes:b,removeSelectedEdges:S,startConnection:me,updateConnection:ge,endConnection:se,setInteractive:Q,setState:$e,getIntersectingNodes:ye,getIncomers:a,getOutgoers:r,getConnectedEdges:s,getHandleConnections:d,isNodeIntersecting:Ne,panBy:ve,fitView:M=>i.value.fitView(M),zoomIn:M=>i.value.zoomIn(M),zoomOut:M=>i.value.zoomOut(M),zoomTo:(M,B)=>i.value.zoomTo(M,B),setViewport:(M,B)=>i.value.setViewport(M,B),setTransform:(M,B)=>i.value.setTransform(M,B),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(M,B,F)=>i.value.setCenter(M,B,F),fitBounds:(M,B)=>i.value.fitBounds(M,B),project:M=>i.value.project(M),screenToFlowCoordinate:M=>i.value.screenToFlowCoordinate(M),flowToScreenCoordinate:M=>i.value.flowToScreenCoordinate(M),toObject:()=>{const M=[],B=[];for(const F of e.nodes){const{computedPosition:ne,handleBounds:X,selected:E,dimensions:$,isParent:H,resizing:N,dragging:O,events:V,...re}=F;M.push(re)}for(const F of e.edges){const{selected:ne,sourceNode:X,targetNode:E,events:$,...H}=F;B.push(H)}return JSON.parse(JSON.stringify({nodes:M,edges:B,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:M=>new Promise(B=>{const{nodes:F,edges:ne,position:X,zoom:E,viewport:$}=M;F&&te(F),ne&&de(ne);const[H,N]=$!=null&&$.x&&($!=null&&$.y)?[$.x,$.y]:X??[null,null];if(H&&N){const O=($==null?void 0:$.zoom)||E||e.viewport.zoom;return El(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:H,y:N,zoom:O}).then(()=>{B(!0)})})}else B(!0)}),updateNodeInternals:l,viewportHelper:i,$reset:()=>{const M=Fc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const B=kn.translate(M.defaultViewport.x??0,M.defaultViewport.y??0).scale(Qt(M.defaultViewport.zoom??1,M.minZoom,M.maxZoom)),F=e.viewportRef.getBoundingClientRect(),ne=[[0,0],[F.width,F.height]],X=e.d3Zoom.constrain()(B,ne,M.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}$e(M)},$destroy:()=>{}}}const ib=["data-id","data-handleid","data-nodeid","data-handlepos"],lb={name:"Handle",compatConfig:{MODE:3}},nn=n.defineComponent({...lb,props:{id:{default:null},type:{},position:{default:()=>ke.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:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),l=n.toRef(()=>o.isValidConnection??null),{id:a,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:d,vueFlowRef:c,nodesConnectable:u,noDragClassName:f,noPanClassName:p}=Ae(),{id:m,node:h,nodeEl:g,connectedEdges:w}=Uc(),b=n.ref(),S=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),x=n.toRef(()=>{var de,P,le,_,R,k;return((de=r.value)==null?void 0:de.nodeId)===m&&((P=r.value)==null?void 0:P.id)===e.id&&((le=r.value)==null?void 0:le.type)===i.value||((_=d.value)==null?void 0:_.nodeId)===m&&((R=d.value)==null?void 0:R.id)===e.id&&((k=d.value)==null?void 0:k.type)===i.value}),J=n.toRef(()=>{var de,P,le;return((de=s.value)==null?void 0:de.nodeId)===m&&((P=s.value)==null?void 0:P.id)===e.id&&((le=s.value)==null?void 0:le.type)===i.value}),{handlePointerDown:G,handleClick:j}=zc({nodeId:m,handleId:e.id,isValidConnection:l,type:i}),U=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!w.value.some(de=>{const P=de[`${i.value}Handle`];return de[i.value]!==m?!1:P?P===e.id:!0}):typeof e.connectable=="number"?w.value.filter(de=>{const P=de[`${i.value}Handle`];return de[i.value]!==m?!1:P?P===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,w.value):He(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var de;if(!h.dimensions.width||!h.dimensions.height)return;const P=(de=h.handleBounds[i.value])==null?void 0:de.find(K=>K.id===e.id);if(!c.value||P)return;const le=c.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!le||!e.id)return;const _=g.value.getBoundingClientRect(),R=b.value.getBoundingClientRect(),k=window.getComputedStyle(le),{m22:z}=new window.DOMMatrixReadOnly(k.transform),W={id:e.id,position:e.position,x:(R.left-_.left)/z,y:(R.top-_.top)/z,type:i.value,nodeId:m,...ui(b.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],W]});function Q(de){const P=Zl(de);U.value&&S.value&&(P&&de.button===0||!P)&&G(de)}function te(de){!m||!s.value&&!S.value||U.value&&j(de)}return t({handleClick:j,handlePointerDown:G,onClick:te,onPointerDown:Q}),(de,P)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(a)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":de.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${de.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:U.value,connecting:J.value,connectablestart:S.value,connectableend:y.value,connectionindicator:U.value&&(S.value&&!x.value||y.value&&x.value)}]]),onMousedown:Q,onTouchstartPassive:Q,onClick:te},[n.renderSlot(de.$slots,"default",{id:de.id})],42,ib))}}),bi=function({sourcePosition:e=ke.Bottom,targetPosition:t=ke.Top,label:o,connectable:i=!0,isValidTargetPos:l,isValidSourcePos:a,data:r}){const s=r.label??o;return[n.h(nn,{type:"target",position:t,connectable:i,isValidConnection:l}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(nn,{type:"source",position:e,connectable:i,isValidConnection:a})]};bi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],bi.inheritAttrs=!1,bi.compatConfig={MODE:3};const ab=bi,_i=function({targetPosition:e=ke.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:l}){const a=l.label??t;return[n.h(nn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a])]};_i.props=["targetPosition","label","isValidTargetPos","connectable","data"],_i.inheritAttrs=!1,_i.compatConfig={MODE:3};const rb=_i,wi=function({sourcePosition:e=ke.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:l}){const a=l.label??t;return[typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a]),n.h(nn,{type:"source",position:e,connectable:o,isValidConnection:i})]};wi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],wi.inheritAttrs=!1,wi.compatConfig={MODE:3};const sb=wi,cb=["transform"],db=["width","height","x","y","rx","ry"],ub=["y"],fb={name:"EdgeText",compatConfig:{MODE:3}},mb=n.defineComponent({...fb,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(l),n.watch([()=>e.x,()=>e.y,o,()=>e.label],l);function l(){if(!o.value)return;const a=o.value.getBBox();(a.width!==t.value.width||a.height!==t.value.height)&&(t.value=a)}return(a,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*a.labelBgPadding[0]}px`,height:`${t.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:n.normalizeStyle(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,db)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(a.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:a.labelStyle}),[n.renderSlot(a.$slots,"default",{},()=>[typeof a.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(a.label),1)],64))])],16,ub)],8,cb))}}),pb=["id","d","marker-end","marker-start"],hb=["d","stroke-width"],yb={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},vi=n.defineComponent({...yb,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),l=n.ref(null),a=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:l}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(a),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,pb),r.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:r.path,"stroke-width":r.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,hb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(mb,{key:1,ref_key:"labelEl",ref:l,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function Gc({sourceX:e,sourceY:t,targetX:o,targetY:i}){const l=Math.abs(o-e)/2,a=o<e?o+l:o-l,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[a,s,l,r]}function Yc({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:l,sourceControlY:a,targetControlX:r,targetControlY:s}){const d=e*.125+l*.375+r*.375+o*.125,c=t*.125+a*.375+s*.375+i*.125,u=Math.abs(d-e),f=Math.abs(c-t);return[d,c,u,f]}function Ei(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wc({pos:e,x1:t,y1:o,x2:i,y2:l,c:a}){let r,s;switch(e){case ke.Left:r=t-Ei(t-i,a),s=o;break;case ke.Right:r=t+Ei(i-t,a),s=o;break;case ke.Top:r=t,s=o-Ei(o-l,a);break;case ke.Bottom:r=t,s=o+Ei(l-o,a);break}return[r,s]}function qc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ke.Bottom,targetX:l,targetY:a,targetPosition:r=ke.Top,curvature:s=.25}=e,[d,c]=Wc({pos:i,x1:t,y1:o,x2:l,y2:a,c:s}),[u,f]=Wc({pos:r,x1:l,y1:a,x2:t,y2:o,c:s}),[p,m,h,g]=Yc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:d,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${t},${o} C${d},${c} ${u},${f} ${l},${a}`,p,m,h,g]}function Kc({pos:e,x1:t,y1:o,x2:i,y2:l}){let a,r;switch(e){case ke.Left:case ke.Right:a=.5*(t+i),r=o;break;case ke.Top:case ke.Bottom:a=t,r=.5*(o+l);break}return[a,r]}function Xc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ke.Bottom,targetX:l,targetY:a,targetPosition:r=ke.Top}=e,[s,d]=Kc({pos:i,x1:t,y1:o,x2:l,y2:a}),[c,u]=Kc({pos:r,x1:l,y1:a,x2:t,y2:o}),[f,p,m,h]=Yc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:c,targetControlY:u});return[`M${t},${o} C${s},${d} ${c},${u} ${l},${a}`,f,p,m,h]}const jc={[ke.Left]:{x:-1,y:0},[ke.Right]:{x:1,y:0},[ke.Top]:{x:0,y:-1},[ke.Bottom]:{x:0,y:1}};function gb({source:e,sourcePosition:t=ke.Bottom,target:o}){return t===ke.Left||t===ke.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 Zc(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function bb({source:e,sourcePosition:t=ke.Bottom,target:o,targetPosition:i=ke.Top,center:l,offset:a}){const r=jc[t],s=jc[i],d={x:e.x+r.x*a,y:e.y+r.y*a},c={x:o.x+s.x*a,y:o.y+s.y*a},u=gb({source:d,sourcePosition:t,target:c}),f=u.x!==0?"x":"y",p=u[f];let m,h,g;const w={x:0,y:0},b={x:0,y:0},[S,y,x,J]=Gc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){h=l.x??S,g=l.y??y;const j=[{x:h,y:d.y},{x:h,y:c.y}],U=[{x:d.x,y:g},{x:c.x,y:g}];r[f]===p?m=f==="x"?j:U:m=f==="x"?U:j}else{const j=[{x:d.x,y:c.y}],U=[{x:c.x,y:d.y}];if(f==="x"?m=r.x===p?U:j:m=r.y===p?j:U,t===i){const le=Math.abs(e[f]-o[f]);if(le<=a){const _=Math.min(a-1,a-le);r[f]===p?w[f]=(d[f]>e[f]?-1:1)*_:b[f]=(c[f]>o[f]?-1:1)*_}}if(t!==i){const le=f==="x"?"y":"x",_=r[f]===s[le],R=d[le]>c[le],k=d[le]<c[le];(r[f]===1&&(!_&&R||_&&k)||r[f]!==1&&(!_&&k||_&&R))&&(m=f==="x"?j:U)}const Q={x:d.x+w.x,y:d.y+w.y},te={x:c.x+b.x,y:c.y+b.y},de=Math.max(Math.abs(Q.x-m[0].x),Math.abs(te.x-m[0].x)),P=Math.max(Math.abs(Q.y-m[0].y),Math.abs(te.y-m[0].y));de>=P?(h=(Q.x+te.x)/2,g=m[0].y):(h=m[0].x,g=(Q.y+te.y)/2)}return[[e,{x:d.x+w.x,y:d.y+w.y},...m,{x:c.x+b.x,y:c.y+b.y},o],h,g,x,J]}function _b(e,t,o,i){const l=Math.min(Zc(e,t)/2,Zc(t,o)/2,i),{x:a,y:r}=t;if(e.x===a&&a===o.x||e.y===r&&r===o.y)return`L${a} ${r}`;if(e.y===r){const c=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${a+l*c},${r}Q ${a},${r} ${a},${r+l*u}`}const s=e.x<o.x?1:-1,d=e.y<o.y?-1:1;return`L ${a},${r+l*d}Q ${a},${r} ${a+l*s},${r}`}function ia(e){const{sourceX:t,sourceY:o,sourcePosition:i=ke.Bottom,targetX:l,targetY:a,targetPosition:r=ke.Top,borderRadius:s=5,centerX:d,centerY:c,offset:u=20}=e,[f,p,m,h,g]=bb({source:{x:t,y:o},sourcePosition:i,target:{x:l,y:a},targetPosition:r,center:{x:d,y:c},offset:u});return[f.reduce((b,S,y)=>{let x;return y>0&&y<f.length-1?x=_b(f[y-1],S,f[y+1],s):x=`${y===0?"M":"L"}${S.x} ${S.y}`,b+=x,b},""),p,m,h,g]}function wb(e){const{sourceX:t,sourceY:o,targetX:i,targetY:l}=e,[a,r,s,d]=Gc({sourceX:t,sourceY:o,targetX:i,targetY:l});return[`M ${t},${o}L ${i},${l}`,a,r,s,d]}const vb=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=wb(e);return n.h(vi,{path:o,labelX:i,labelY:l,...t,...e})}}}),Jc=n.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:t}){return()=>{const[o,i,l]=ia({...e,sourcePosition:e.sourcePosition??ke.Bottom,targetPosition:e.targetPosition??ke.Top});return n.h(vi,{path:o,labelX:i,labelY:l,...t,...e})}}}),Eb=n.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>n.h(Jc,{...e,...t,borderRadius:0})}}),kb=n.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:t}){return()=>{const[o,i,l]=qc({...e,sourcePosition:e.sourcePosition??ke.Bottom,targetPosition:e.targetPosition??ke.Top});return n.h(vi,{path:o,labelX:i,labelY:l,...t,...e})}}}),Nb=n.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:t}){return()=>{const[o,i,l]=Xc({...e,sourcePosition:e.sourcePosition??ke.Bottom,targetPosition:e.targetPosition??ke.Top});return n.h(vi,{path:o,labelX:i,labelY:l,...t,...e})}}}),$b={input:sb,default:ab,output:rb},xb={default:kb,straight:vb,step:Eb,smoothstep:Jc,simplebezier:Nb};function Sb(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),l=n.computed(()=>g=>o.value.get(g)),a=n.computed(()=>{const g={...xb,...e.edgeTypes},w=Object.keys(g);for(const b of e.edges)b.type&&!w.includes(b.type)&&(g[b.type]=b.type);return g}),r=n.computed(()=>{const g={...$b,...e.nodeTypes},w=Object.keys(g);for(const b of e.nodes)b.type&&!w.includes(b.type)&&(g[b.type]=b.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?pc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),d=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const w of e.edges){const b=t.value.get(w.source),S=t.value.get(w.target);Ig({sourcePos:b.computedPosition||{x:0,y:0},targetPos:S.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:S.dimensions.width,targetHeight:S.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(w)}return g}return e.edges}),c=n.computed(()=>[...s.value,...d.value]),u=n.computed(()=>{const g=[];for(const w of e.nodes)w.selected&&g.push(w);return g}),f=n.computed(()=>{const g=[];for(const w of e.edges)w.selected&&g.push(w);return g}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const g=[];for(const w of e.nodes)w.dimensions.width&&w.dimensions.height&&w.handleBounds!==void 0&&g.push(w);return g}),h=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:l,getElements:c,getEdgeTypes:a,getNodeTypes:r,getEdges:d,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:h}}class on{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const o=(t=n.getCurrentInstance())==null?void 0:t.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??on.instance;return on.instance=i??new on,o&&(o.config.globalProperties.$vueFlowStorage=on.instance),on.instance}set(t,o){return this.flows.set(t,o)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,o){const i=Fc(),l=n.reactive(i),a={};for(const[p,m]of Object.entries(l.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;a[h]=m.on}const r={};for(const[p,m]of Object.entries(l.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of l.nodes)p.set(m.id,m);return p}),d=n.computed(()=>{const p=new Map;for(const m of l.edges)p.set(m.id,m);return p}),c=Sb(l,s,d),u=ob(l,s,d);u.setState({...l,...o});const f={...a,...c,...u,...Nm(l),nodeLookup:s,edgeLookup:d,emits:r,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function Ae(e){const t=on.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",l=i?e:{id:e},a=l.id,r=a??(o==null?void 0:o.vueFlowId);let s;if(o){const d=n.inject(Dc,null);typeof d<"u"&&d!==null&&(!r||d.id===r)&&(s=d)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const d=a??t.getId(),c=t.create(d,l);s=c,(o??n.effectScope(!0)).run(()=>{n.watch(c.applyDefault,(f,p,m)=>{const h=w=>{c.applyNodeChanges(w)},g=w=>{c.applyEdgeChanges(w)};f?(c.onNodesChange(h),c.onEdgesChange(g)):(c.hooks.value.nodesChange.off(h),c.hooks.value.edgesChange.off(g)),m(()=>{c.hooks.value.nodesChange.off(h),c.hooks.value.edgesChange.off(g)})},{immediate:!0}),Gn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():co(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(l);if(o&&(n.provide(Dc,s),o.vueFlowId=s.id),i){const d=n.getCurrentInstance();(d==null?void 0:d.type.name)!=="VueFlow"&&s.emits.error(new Fe(Ue.USEVUEFLOW_OPTIONS))}return s}function Ib(e){const{emits:t,dimensions:o}=Ae();let i;n.onMounted(()=>{const l=()=>{var a,r;if(!e.value||!(((r=(a=e.value).checkVisibility)==null?void 0:r.call(a))??!0))return;const s=ui(e.value);(s.width===0||s.height===0)&&t.error(new Fe(Ue.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};l(),window.addEventListener("resize",l),e.value&&(i=new ResizeObserver(()=>l()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",l),i&&e.value&&i.unobserve(e.value)})})}const Cb={name:"UserSelection",compatConfig:{MODE:3}},Rb=n.defineComponent({...Cb,props:{userSelectionRect:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:n.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Vb=["tabIndex"],Ab={name:"NodesSelection",compatConfig:{MODE:3}},Tb=n.defineComponent({...Ab,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:l,disableKeyboardA11y:a,userSelectionActive:r}=Ae(),s=Hc(),d=n.ref(null),c=Pc({el:d,onStart(h){t.selectionDragStart(h),t.nodeDragStart(h)},onDrag(h){t.selectionDrag(h),t.nodeDrag(h)},onStop(h){t.selectionDragStop(h),t.nodeDragStop(h)}});n.onMounted(()=>{var h;a.value||(h=d.value)==null||h.focus({preventScroll:!0})});const u=n.computed(()=>Wl(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){t.selectionContextMenu({event:h,nodes:i.value})}function m(h){a.value||Nn[h.key]&&(h.preventDefault(),s({x:Nn[h.key].x,y:Nn[h.key].y},h.shiftKey))}return(h,g)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(l)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:d,class:n.normalizeClass([{dragging:n.unref(c)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(a)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,Vb)],6)):n.createCommentVNode("",!0)}});function Bb(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Mb={name:"Pane",compatConfig:{MODE:3}},Db=n.defineComponent({...Mb,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:l,userSelectionActive:a,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:d,nodesSelectionActive:c,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:w,multiSelectionActive:b,edgeLookup:S,nodeLookup:y,connectionLookup:x,defaultEdgeOptions:J,connectionStartHandle:G,panOnDrag:j}=Ae(),U=n.shallowRef(null),Q=n.shallowRef(new Set),te=n.shallowRef(new Set),de=n.shallowRef(null),P=n.toRef(()=>d.value&&(e.isSelecting||a.value)),le=n.toRef(()=>G.value!==null);let _=!1,R=!1;const k=oo(g,{actInsideInputWithModifier:!1}),z=oo(w);n.watch(k,se=>{se&&(p(f.value),m(u.value),c.value=!1)}),n.watch(z,se=>{b.value=se});function W(se,fe){return ye=>{ye.target===fe&&(se==null||se(ye))}}function K(se){if(_||le.value){_=!1;return}l.paneClick(se),r(),c.value=!1}function T(se){var fe;if(Array.isArray(j.value)&&((fe=j.value)!=null&&fe.includes(2))){se.preventDefault();return}l.paneContextMenu(se)}function oe(se){l.paneScroll(se)}function ce(se){var fe,ye,Ne;if(de.value=((fe=t.value)==null?void 0:fe.getBoundingClientRect())??null,!d.value||!e.isSelecting||se.button!==0||se.target!==U.value||!de.value)return;(Ne=(ye=se.target)==null?void 0:ye.setPointerCapture)==null||Ne.call(ye,se.pointerId);const{x:ve,y:$e}=Bb(se,de.value);R=!0,_=!1,r(),s.value={width:0,height:0,startX:ve,startY:$e,x:ve,y:$e},l.selectionStart(se)}function me(se){var fe;if(!de.value||!s.value)return;_=!0;const{x:ye,y:Ne}=yt(se,de.value),{startX:ve=0,startY:$e=0}=s.value,q={startX:ve,startY:$e,x:ye<ve?ye:ve,y:Ne<$e?Ne:$e,width:Math.abs(ye-ve),height:Math.abs(Ne-$e)},Y=Q.value,D=te.value;Q.value=new Set(pc(o.value,q,i.value,h.value===Fl.Partial,!0).map(B=>B.id)),te.value=new Set;const M=((fe=J.value)==null?void 0:fe.selectable)??!0;for(const B of Q.value){const F=x.value.get(B);if(F)for(const{edgeId:ne}of F.values()){const X=S.value.get(ne);X&&(X.selectable??M)&&te.value.add(ne)}}if(!Mc(Y,Q.value)){const B=Ot(y.value,Q.value,!0);l.nodesChange(B)}if(!Mc(D,te.value)){const B=Ot(S.value,te.value);l.edgesChange(B)}s.value=q,a.value=!0,c.value=!1}function ge(se){var fe;se.button!==0||!R||((fe=se.target)==null||fe.releasePointerCapture(se.pointerId),!a.value&&s.value&&se.target===U.value&&K(se),a.value=!1,s.value=null,c.value=Q.value.size>0,l.selectionEnd(se),e.selectionKeyPressed&&(_=!1),R=!1)}return(se,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:U,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:fe[0]||(fe[0]=ye=>P.value?void 0:W(K,U.value)(ye)),onContextmenu:fe[1]||(fe[1]=ye=>W(T,U.value)(ye)),onWheelPassive:fe[2]||(fe[2]=ye=>W(oe,U.value)(ye)),onPointerenter:fe[3]||(fe[3]=ye=>P.value?void 0:n.unref(l).paneMouseEnter(ye)),onPointerdown:fe[4]||(fe[4]=ye=>P.value?ce(ye):n.unref(l).paneMouseMove(ye)),onPointermove:fe[5]||(fe[5]=ye=>P.value?me(ye):n.unref(l).paneMouseMove(ye)),onPointerup:fe[6]||(fe[6]=ye=>P.value?ge(ye):void 0),onPointerleave:fe[7]||(fe[7]=ye=>n.unref(l).paneMouseLeave(ye))},[n.renderSlot(se.$slots,"default"),n.unref(a)&&n.unref(s)?(n.openBlock(),n.createBlock(Rb,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(c)&&n.unref(f).length?(n.openBlock(),n.createBlock(Tb,{key:1})):n.createCommentVNode("",!0)],34))}}),Ob={name:"Transform",compatConfig:{MODE:3}},Lb=n.defineComponent({...Ob,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Ae(),l=n.computed(()=>o.value?!i.value:!1),a=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:a.value,opacity:l.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),Pb={name:"Viewport",compatConfig:{MODE:3}},zb=n.defineComponent({...Pb,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:l,zoomActivationKeyCode:a,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:d,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:h,preventScrolling:g,noWheelClassName:w,noPanClassName:b,emits:S,connectionStartHandle:y,userSelectionActive:x,paneDragging:J,d3Zoom:G,d3Selection:j,d3ZoomHandler:U,viewport:Q,viewportRef:te,paneClickDistance:de}=Ae();Ib(te);const P=n.shallowRef(!1),le=n.shallowRef(!1);let _=null,R=!1,k=0,z={x:0,y:0,zoom:0};const W=oo(s),K=oo(r),T=oo(a),oe=n.toRef(()=>(!K.value||K.value&&r.value===!0)&&(W.value||f.value)),ce=n.toRef(()=>W.value||d.value),me=n.toRef(()=>r.value===!0&&oe.value!==!0),ge=n.toRef(()=>K.value&&r.value!==!0||x.value||me.value),se=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!te.value){co("Viewport element is missing");return}const $e=te.value,q=$e.getBoundingClientRect(),Y=sg().clickDistance(de.value).scaleExtent([t.value,o.value]).translateExtent(l.value),D=lt($e).call(Y),M=D.on("wheel.zoom"),B=kn.translate(i.value.x??0,i.value.y??0).scale(Qt(i.value.zoom??1,t.value,o.value)),F=[[0,0],[q.width,q.height]],ne=Y.constrain()(B,F,l.value);Y.transform(D,ne),Y.wheelDelta(ql),G.value=Y,j.value=D,U.value=M,Q.value={x:ne.x,y:ne.y,zoom:ne.k},Y.on("start",X=>{var E;if(!X.sourceEvent)return null;k=X.sourceEvent.button,P.value=!0;const $=Ne(X.transform);((E=X.sourceEvent)==null?void 0:E.type)==="mousedown"&&(J.value=!0),z=$,S.viewportChangeStart($),S.moveStart({event:X,flowTransform:$})}),Y.on("end",X=>{if(!X.sourceEvent)return null;if(P.value=!1,J.value=!1,fe(oe.value,k??0)&&!R&&S.paneContextMenu(X.sourceEvent),R=!1,ye(z,X.transform)){const E=Ne(X.transform);z=E,S.viewportChangeEnd(E),S.moveEnd({event:X,flowTransform:E})}}),Y.filter(X=>{var E;const $=T.value||h.value,H=m.value&&X.ctrlKey,N=X.button,O=X.type==="wheel";if(N===1&&X.type==="mousedown"&&(ve(X,"vue-flow__node")||ve(X,"vue-flow__edge")))return!0;if(!oe.value&&!$&&!ce.value&&!p.value&&!m.value||x.value||se.value&&!O||!p.value&&X.type==="dblclick"||ve(X,w.value)&&O||ve(X,b.value)&&(!O||ce.value&&O&&!T.value)||!m.value&&X.ctrlKey&&O||!$&&!ce.value&&!H&&O)return!1;if(!m&&X.type==="touchstart"&&((E=X.touches)==null?void 0:E.length)>1)return X.preventDefault(),!1;if(!oe.value&&(X.type==="mousedown"||X.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&N===0||Array.isArray(f.value)&&!f.value.includes(N)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const V=Array.isArray(f.value)&&f.value.includes(N)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!N||N<=1;return(!X.ctrlKey||W.value||O)&&V}),n.watch([x,oe],()=>{x.value&&!P.value?Y.on("zoom",null):x.value||Y.on("zoom",X=>{Q.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const E=Ne(X.transform);R=fe(oe.value,k??0),S.viewportChange(E),S.move({event:X,flowTransform:E})})},{immediate:!0}),n.watch([x,ce,c,T,m,g,w],()=>{ce.value&&!T.value&&!x.value?D.on("wheel.zoom",X=>{if(ve(X,w.value))return!1;const E=T.value||h.value,$=m.value&&X.ctrlKey;if(!(!g.value||ce.value||E||$))return!1;X.preventDefault(),X.stopImmediatePropagation();const N=D.property("__zoom").k||1,O=so();if(!W.value&&X.ctrlKey&&m.value&&O){const A=ft(X),L=ql(X),Z=N*2**L;Y.scaleTo(D,Z,A,X);return}const V=X.deltaMode===1?20:1;let re=c.value===no.Vertical?0:X.deltaX*V,pe=c.value===no.Horizontal?0:X.deltaY*V;!O&&X.shiftKey&&c.value!==no.Vertical&&!re&&pe&&(re=pe,pe=0),Y.translateBy(D,-(re/N)*u.value,-(pe/N)*u.value);const he=Ne(D.property("__zoom"));_&&clearTimeout(_),le.value?(S.move({event:X,flowTransform:he}),S.viewportChange(he),_=setTimeout(()=>{S.moveEnd({event:X,flowTransform:he}),S.viewportChangeEnd(he),le.value=!1},150)):(le.value=!0,S.moveStart({event:X,flowTransform:he}),S.viewportChangeStart(he))},{passive:!1}):typeof M<"u"&&D.on("wheel.zoom",function(X,E){const $=!g.value&&X.type==="wheel"&&!X.ctrlKey,H=T.value||h.value,N=m.value&&X.ctrlKey;if(!H&&!d.value&&!N&&X.type==="wheel"||$||ve(X,w.value))return null;X.preventDefault(),M.call(this,X,E)},{passive:!1})},{immediate:!0})});function fe($e,q){return q===2&&Array.isArray($e)&&$e.includes(2)}function ye($e,q){return $e.x!==q.x&&!Number.isNaN(q.x)||$e.y!==q.y&&!Number.isNaN(q.y)||$e.zoom!==q.k&&!Number.isNaN(q.k)}function Ne($e){return{x:$e.x,y:$e.y,zoom:$e.k}}function ve($e,q){return $e.target.closest(`.${q}`)}return($e,q)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:te,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(Db,{"is-selecting":ge.value,"selection-key-pressed":n.unref(K),class:n.normalizeClass({connecting:se.value,dragging:n.unref(J),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(Lb,null,{default:n.withCtx(()=>[n.renderSlot($e.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Ub=["id"],Hb=["id"],Fb=["id"],Gb={name:"A11yDescriptions",compatConfig:{MODE:3}},Yb=n.defineComponent({...Gb,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Ae();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(ic)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.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,Ub),n.createElementVNode("div",{id:`${n.unref(lc)}-${n.unref(t)}`,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,Hb),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(pg)}-${n.unref(t)}`,"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%)"}},n.toDisplayString(n.unref(i)),9,Fb))],64))}});function Wb(){const e=Ae();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function qb(e,t,o){return o===ke.Left?e-t:o===ke.Right?e+t:e}function Kb(e,t,o){return o===ke.Top?e-t:o===ke.Bottom?e+t:e}const la=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=ke.Top,type:l}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${l}`,cx:qb(t,e,i),cy:Kb(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};la.props=["radius","centerX","centerY","position","type"],la.compatConfig={MODE:3};const Qc=la,Xb=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:l,emits:a,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:d,removeSelectedEdges:c,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:w,edgesFocusable:b,hooks:S}=Ae(),y=n.computed(()=>u(e.id)),{emit:x,on:J}=Gg(y.value,a),G=n.inject(hi),j=n.getCurrentInstance(),U=n.ref(!1),Q=n.ref(!1),te=n.ref(""),de=n.ref(null),P=n.ref("source"),le=n.ref(null),_=n.toRef(()=>typeof y.value.selectable>"u"?g.value:y.value.selectable),R=n.toRef(()=>typeof y.value.updatable>"u"?w.value:y.value.updatable),k=n.toRef(()=>typeof y.value.focusable>"u"?b.value:y.value.focusable);n.provide(Ug,e.id),n.provide(Hg,le);const z=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),W=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),K=n.computed(()=>{const B=y.value.type||"default",F=G==null?void 0:G[`edge-${B}`];if(F)return F;let ne=y.value.template??d.value[B];if(typeof ne=="string"&&j){const X=Object.keys(j.appContext.components);X&&X.includes(B)&&(ne=n.resolveComponent(B,!1))}return ne&&typeof ne!="string"?ne:(a.error(new Fe(Ue.EDGE_TYPE_MISSING,ne)),!1)}),{handlePointerDown:T}=zc({nodeId:te,handleId:de,type:P,isValidConnection:p,edgeUpdaterType:P,onEdgeUpdate:me,onEdgeUpdateEnd:ge});return()=>{const B=f(y.value.source),F=f(y.value.target),ne="pathOptions"in y.value?y.value.pathOptions:{};if(!B&&!F)return a.error(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!B)return a.error(new Fe(Ue.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!F)return a.error(new Fe(Ue.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||B.hidden||F.hidden)return null;let X;i.value===xt.Strict?X=B.handleBounds.source:X=[...B.handleBounds.source||[],...B.handleBounds.target||[]];const E=xc(X,y.value.sourceHandle);let $;i.value===xt.Strict?$=F.handleBounds.target:$=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const H=xc($,y.value.targetHandle),N=(E==null?void 0:E.position)||ke.Bottom,O=(H==null?void 0:H.position)||ke.Top,{x:V,y:re}=xn(B,E,N),{x:pe,y:he}=xn(F,H,O);return y.value.sourceX=V,y.value.sourceY=re,y.value.targetX=pe,y.value.targetY=he,n.h("g",{ref:le,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${K.value===!1?"default":y.value.type||"default"}`,s.value,z.value,{updating:U.value,selected:y.value.selected,animated:y.value.animated,inactive:!_.value&&!S.value.edgeClick.hasListeners()}],tabIndex:k.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":k.value?`${lc}-${t}`:void 0,"aria-roledescription":"edge",role:k.value?"group":"img",...y.value.domAttributes,onClick:fe,onContextmenu:ye,onDblclick:Ne,onMouseenter:ve,onMousemove:$e,onMouseleave:q,onKeyDown:k.value?M:void 0},[Q.value?null:n.h(K.value===!1?d.value.default:K.value,{id:e.id,sourceNode:B,targetNode:F,source:y.value.source,target:y.value.target,type:y.value.type,updatable:R.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...J},style:W.value,markerStart:`url('#${ro(y.value.markerStart,t)}')`,markerEnd:`url('#${ro(y.value.markerEnd,t)}')`,sourcePosition:N,targetPosition:O,sourceX:V,sourceY:re,targetX:pe,targetY:he,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...ne}),[R.value==="source"||R.value===!0?[n.h("g",{onMousedown:Y,onMouseenter:oe,onMouseout:ce},n.h(Qc,{position:N,centerX:V,centerY:re,radius:l.value,type:"source","data-type":"source"}))]:null,R.value==="target"||R.value===!0?[n.h("g",{onMousedown:D,onMouseenter:oe,onMouseout:ce},n.h(Qc,{position:O,centerX:pe,centerY:he,radius:l.value,type:"target","data-type":"target"}))]:null]])};function oe(){U.value=!0}function ce(){U.value=!1}function me(B,F){x.update({event:B,edge:y.value,connection:F})}function ge(B){x.updateEnd({event:B,edge:y.value}),Q.value=!1}function se(B,F){B.button===0&&(Q.value=!0,te.value=F?y.value.target:y.value.source,de.value=(F?y.value.targetHandle:y.value.sourceHandle)??null,P.value=F?"target":"source",x.updateStart({event:B,edge:y.value}),T(B))}function fe(B){var F;const ne={event:B,edge:y.value};_.value&&(r.value=!1,y.value.selected&&m.value?(c([y.value]),(F=le.value)==null||F.blur()):o([y.value])),x.click(ne)}function ye(B){x.contextMenu({event:B,edge:y.value})}function Ne(B){x.doubleClick({event:B,edge:y.value})}function ve(B){x.mouseEnter({event:B,edge:y.value})}function $e(B){x.mouseMove({event:B,edge:y.value})}function q(B){x.mouseLeave({event:B,edge:y.value})}function Y(B){se(B,!0)}function D(B){se(B,!1)}function M(B){var F;!h.value&&ac.includes(B.key)&&_.value&&(B.key==="Escape"?((F=le.value)==null||F.blur(),c([u(e.id)])):o([u(e.id)]))}}}),jb=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:l,connectionPosition:a,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:d,connectionStatus:c,viewport:u,findNode:f}=Ae(),p=(e=n.inject(hi))==null?void 0:e["connection-line"],m=n.computed(()=>{var S;return f((S=i.value)==null?void 0:S.nodeId)}),h=n.computed(()=>{var S;return f((S=l.value)==null?void 0:S.nodeId)??null}),g=n.computed(()=>({x:(a.value.x-u.value.x)/u.value.zoom,y:(a.value.y-u.value.y)/u.value.zoom})),w=n.computed(()=>d.value.markerStart?`url(#${ro(d.value.markerStart,t)})`:""),b=n.computed(()=>d.value.markerEnd?`url(#${ro(d.value.markerEnd,t)})`:"");return()=>{var S,y,x;if(!m.value||!i.value)return null;const J=i.value.id,G=i.value.type,j=m.value.handleBounds;let U=(j==null?void 0:j[G])??[];if(o.value===xt.Loose){const W=(j==null?void 0:j[G==="source"?"target":"source"])??[];U=[...U,...W]}if(!U)return null;const Q=(J?U.find(W=>W.id===J):U[0])??null,te=(Q==null?void 0:Q.position)??ke.Top,{x:de,y:P}=xn(m.value,Q,te);let le=null;h.value&&(o.value===xt.Strict?le=((S=h.value.handleBounds[G==="source"?"target":"source"])==null?void 0:S.find(W=>{var K;return W.id===((K=l.value)==null?void 0:K.id)}))||null:le=((y=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:y.find(W=>{var K;return W.id===((K=l.value)==null?void 0:K.id)}))||null);const _=((x=l.value)==null?void 0:x.position)??(te?Ql[te]:null);if(!te||!_)return null;const R=r.value??d.value.type??Jt.Bezier;let k="";const z={sourceX:de,sourceY:P,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:_};return R===Jt.Bezier?[k]=qc(z):R===Jt.Step?[k]=ia({...z,borderRadius:0}):R===Jt.SmoothStep?[k]=ia(z):R===Jt.SimpleBezier?[k]=Xc(z):k=`M${de},${P} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},p?n.h(p,{sourceX:de,sourceY:P,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:_,sourceNode:m.value,sourceHandle:Q,targetNode:h.value,targetHandle:le,markerEnd:b.value,markerStart:w.value,connectionStatus:c.value}):n.h("path",{d:k,class:[d.value.class,c.value,"vue-flow__connection-path"],style:{...s.value,...d.value.style},"marker-end":b.value,"marker-start":w.value})))}}}),Zb=["id","markerWidth","markerHeight","markerUnits","orient"],Jb={name:"MarkerType",compatConfig:{MODE:3}},Qb=n.defineComponent({...Jb,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(t,o)=>(n.openBlock(),n.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===n.unref(Gl).ArrowClosed?(n.openBlock(),n.createElementBlock("polyline",{key:0,style:n.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):n.createCommentVNode("",!0),t.type===n.unref(Gl).Arrow?(n.openBlock(),n.createElementBlock("polyline",{key:1,style:n.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):n.createCommentVNode("",!0)],8,Zb))}}),e0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},t0={name:"MarkerDefinitions",compatConfig:{MODE:3}},n0=n.defineComponent({...t0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:l}=Ae(),a=n.computed(()=>{const r=new Set,s=[],d=c=>{if(c){const u=ro(c,t);r.has(u)||(typeof c=="object"?s.push({...c,id:u,color:c.color||l.value}):s.push({id:u,color:l.value,type:c}),r.add(u))}};for(const c of[i.value.markerEnd,i.value.markerStart])d(c);for(const c of o.value)for(const u of[c.markerStart,c.markerEnd])d(u);return s.sort((c,u)=>c.id.localeCompare(u.id))});return(r,s)=>(n.openBlock(),n.createElementBlock("svg",e0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,d=>(n.openBlock(),n.createBlock(Qb,{id:d.id,key:d.id,type:d.type,color:d.color,width:d.width,height:d.height,markerUnits:d.markerUnits,"stroke-width":d.strokeWidth,orient:d.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),o0={name:"Edges",compatConfig:{MODE:3}},i0=n.defineComponent({...o0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Ae();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(n0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(Cg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(Xb),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(jb))],64))}}),l0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:l,multiSelectionActive:a,emits:r,removeSelectedNodes:s,addSelectedNodes:d,updateNodeDimensions:c,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:w,snapGrid:b,nodeDragThreshold:S,nodesDraggable:y,elementsSelectable:x,nodesConnectable:J,nodesFocusable:G,hooks:j}=Ae(),U=n.ref(null);n.provide(Lc,U),n.provide(Oc,e.id);const Q=n.inject(hi),te=n.getCurrentInstance(),de=Hc(),{node:P,parentNode:le}=Uc(e.id),{emit:_,on:R}=Kg(P,r),k=n.toRef(()=>typeof P.draggable>"u"?y.value:P.draggable),z=n.toRef(()=>typeof P.selectable>"u"?x.value:P.selectable),W=n.toRef(()=>typeof P.connectable>"u"?J.value:P.connectable),K=n.toRef(()=>typeof P.focusable>"u"?G.value:P.focusable),T=n.computed(()=>z.value||k.value||j.value.nodeClick.hasListeners()||j.value.nodeDoubleClick.hasListeners()||j.value.nodeMouseEnter.hasListeners()||j.value.nodeMouseMove.hasListeners()||j.value.nodeMouseLeave.hasListeners()),oe=n.toRef(()=>!!P.dimensions.width&&!!P.dimensions.height),ce=n.computed(()=>{const F=P.type||"default",ne=Q==null?void 0:Q[`node-${F}`];if(ne)return ne;let X=P.template||f.value[F];if(typeof X=="string"&&te){const E=Object.keys(te.appContext.components);E&&E.includes(F)&&(X=n.resolveComponent(F,!1))}return X&&typeof X!="string"?X:(r.error(new Fe(Ue.NODE_TYPE_MISSING,X)),!1)}),me=Pc({id:e.id,el:U,disabled:()=>!k.value,selectable:z,dragHandle:()=>P.dragHandle,onStart(F){_.dragStart(F)},onDrag(F){_.drag(F)},onStop(F){_.dragStop(F)},onClick(F){M(F)}}),ge=n.computed(()=>P.class instanceof Function?P.class(P):P.class),se=n.computed(()=>{const F=(P.style instanceof Function?P.style(P):P.style)||{},ne=P.width instanceof Function?P.width(P):P.width,X=P.height instanceof Function?P.height(P):P.height;return!F.width&&ne&&(F.width=typeof ne=="string"?ne:`${ne}px`),!F.height&&X&&(F.height=typeof X=="string"?X:`${X}px`),F}),fe=n.toRef(()=>Number(P.zIndex??se.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Ne()}),n.onMounted(()=>{n.watch(()=>P.hidden,(F=!1,ne,X)=>{!F&&U.value&&(e.resizeObserver.observe(U.value),X(()=>{U.value&&e.resizeObserver.unobserve(U.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>P.type,()=>P.sourcePosition,()=>P.targetPosition],()=>{n.nextTick(()=>{c([{id:e.id,nodeElement:U.value,forceUpdate:!0}])})}),n.watch([()=>P.position.x,()=>P.position.y,()=>{var F;return(F=le.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=le.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=le.value)==null?void 0:F.computedPosition.z},fe,()=>P.selected,()=>P.dimensions.height,()=>P.dimensions.width,()=>{var F;return(F=le.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=le.value)==null?void 0:F.dimensions.width}],([F,ne,X,E,$,H])=>{const N={x:F,y:ne,z:H+(m.value&&P.selected?1e3:0)};typeof X<"u"&&typeof E<"u"?P.computedPosition=kg({x:X,y:E,z:$},N):P.computedPosition=N},{flush:"post",immediate:!0}),n.watch([()=>P.extent,p],([F,ne],[X,E])=>{(F!==X||ne!==E)&&ye()}),P.extent==="parent"||typeof P.extent=="object"&&"range"in P.extent&&P.extent.range==="parent"?El(()=>oe).toBe(!0).then(ye):ye(),()=>P.hidden?null:n.h("div",{ref:U,"data-id":P.id,class:["vue-flow__node",`vue-flow__node-${ce.value===!1?"default":P.type||"default"}`,{[o.value]:k.value,dragging:me==null?void 0:me.value,draggable:k.value,selected:P.selected,selectable:z.value,parent:P.isParent},ge.value],style:{visibility:oe.value?"visible":"hidden",zIndex:P.computedPosition.z??fe.value,transform:`translate(${P.computedPosition.x}px,${P.computedPosition.y}px)`,pointerEvents:T.value?"all":"none",...se.value},tabIndex:K.value?0:void 0,role:K.value?"group":void 0,"aria-describedby":h.value?void 0:`${ic}-${t}`,"aria-label":P.ariaLabel,"aria-roledescription":"node",...P.domAttributes,onMouseenter:ve,onMousemove:$e,onMouseleave:q,onContextmenu:Y,onClick:M,onDblclick:D,onKeydown:B},[n.h(ce.value===!1?f.value.default:ce.value,{id:P.id,type:P.type,data:P.data,events:{...P.events,...R},selected:P.selected,resizing:P.resizing,dragging:me.value,connectable:W.value,position:P.computedPosition,dimensions:P.dimensions,isValidTargetPos:P.isValidTargetPos,isValidSourcePos:P.isValidSourcePos,parent:P.parentNode,parentNodeId:P.parentNode,zIndex:P.computedPosition.z??fe.value,targetPosition:P.targetPosition,sourcePosition:P.sourcePosition,label:P.label,dragHandle:P.dragHandle,onUpdateNodeInternals:Ne})]);function ye(){const F=P.computedPosition,{computedPosition:ne,position:X}=jl(P,w.value?pi(F,b.value):F,r.error,p.value,le.value);(P.computedPosition.x!==ne.x||P.computedPosition.y!==ne.y)&&(P.computedPosition={...P.computedPosition,...ne}),(P.position.x!==X.x||P.position.y!==X.y)&&(P.position=X)}function Ne(){U.value&&c([{id:e.id,nodeElement:U.value,forceUpdate:!0}])}function ve(F){me!=null&&me.value||_.mouseEnter({event:F,node:P})}function $e(F){me!=null&&me.value||_.mouseMove({event:F,node:P})}function q(F){me!=null&&me.value||_.mouseLeave({event:F,node:P})}function Y(F){return _.contextMenu({event:F,node:P})}function D(F){return _.doubleClick({event:F,node:P})}function M(F){z.value&&(!i.value||!k.value||S.value>0)&&ea(P,a.value,d,s,l,!1,U.value),_.click({event:F,node:P})}function B(F){if(!(Yl(F)||h.value))if(ac.includes(F.key)&&z.value){const ne=F.key==="Escape";ea(P,a.value,d,s,l,ne,U.value)}else k.value&&P.selected&&Nn[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~P.position.x}, y: ${~~P.position.y}`,de({x:Nn[F.key].x,y:Nn[F.key].y},F.shiftKey))}}});function a0(e={includeHiddenNodes:!1}){const{nodes:t}=Ae();return n.computed(()=>{if(t.value.length===0)return!1;for(const o of t.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 r0={class:"vue-flow__nodes vue-flow__container"},s0={name:"Nodes",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Ae(),l=a0(),a=n.ref();return n.watch(l,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{a.value=new ResizeObserver(r=>{const s=r.map(d=>({id:d.target.getAttribute("data-id"),nodeElement:d.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=a.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",r0,[a.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(d,c,u,f)=>{const p=[d.id];if(f&&f.key===d.id&&n.isMemoSame(f,p))return f;const m=(n.openBlock(),n.createBlock(n.unref(l0),{id:d.id,key:d.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):n.createCommentVNode("",!0)]))}});function d0(){const{emits:e}=Ae();n.onMounted(()=>{if(Vc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Fe(Ue.MISSING_STYLES))}})}const u0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),f0={name:"VueFlow",compatConfig:{MODE:3}},m0=n.defineComponent({...f0,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:t,emit:o}){const i=e,l=n.useSlots(),a=kl(i,"modelValue",o),r=kl(i,"nodes",o),s=kl(i,"edges",o),d=Ae(i),c=Jg({modelValue:a,nodes:r,edges:s},i,d);return eb(o,d.hooks),Wb(),d0(),n.provide(hi,l),n.onUnmounted(c),t(d),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(d).vueFlowRef,class:"vue-flow"},[n.createVNode(zb,null,{default:n.withCtx(()=>[n.createVNode(i0),u0,n.createVNode(c0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(Yb)],512))}}),p0={name:"Panel",compatConfig:{MODE:3}},ed=n.defineComponent({...p0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Ae(),i=n.computed(()=>`${t.position}`.split("-"));return(l,a)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(l.$slots,"default")],6))}}),ln=["red","amber","green","teal","blue","indigo","violet","pink"],td={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function h0(e){return typeof e=="string"&&e in td}const y0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},g0=.15;function b0(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[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,l=parseInt(o.slice(2,4),16)/255,a=parseInt(o.slice(4,6),16)/255,r=Math.max(i,l,a),s=Math.min(i,l,a),d=r-s,c=(r+s)/2;let u=0,f=0;return d!==0&&(u=d/(1-Math.abs(2*c-1)),r===i?f=(l-a)/d%6:r===l?f=(a-i)/d+2:f=(i-l)/d+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:c}}function _0(e){if(typeof e!="string")return null;const t=b0(e);if(!t||t.s<g0)return null;let o=null,i=1/0;for(const l of ln){const a=Math.abs(t.h-y0[l]),r=Math.min(a,360-a);r<i&&(i=r,o=l)}return o}function Xe(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(h0(t))return t;const o=e==null?void 0:e.properties;return _0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function aa(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const w0={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)"},v0={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 nd(e,t=!1){return e?t?v0[e]:w0[e]:null}function Sn(e){return td[e]}function In(e){return`var(--em-swatch-${e}-bar)`}const E0=["width","height","innerHTML"],k0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={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"/>',"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"/>',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"/>'};return(o,i)=>(n.openBlock(),n.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:t[e.name]??""},null,8,E0))}}),Be=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},Ie=Be(k0,[["__scopeId","data-v-04de464d"]]),N0={class:"em-inline-issue__msgs"},an=Be(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),l=n.computed(()=>{let a=null;for(const r of i.value)(a===null||o[r.severity].order<o[a].order)&&(a=r.severity);return a});return(a,r)=>l.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${l.value}`])},[n.createVNode(Ie,{name:o[l.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",N0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(s,d)=>(n.openBlock(),n.createElementBlock("span",{key:d},n.toDisplayString(s.message),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-17f46a25"]]),$0={class:"em-mlang"},x0={class:"em-mlang__tabs",role:"tablist"},S0=["aria-selected","onClick"],I0={key:0,class:"em-mlang__dot"},ra=Be(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function l(){const c=o.defaultLang;return c&&o.languages.includes(c)?c:o.languages[0]??"ko"}const a=n.ref(l());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(a.value)||(a.value=l())});function r(c){var u,f;return!!((f=(u=o.modelValue)==null?void 0:u[c])!=null&&f.trim())}const s=n.computed(()=>{var c;return((c=o.modelValue)==null?void 0:c[a.value])??""});function d(c){const u={...o.modelValue};c.trim()===""?delete u[a.value]:u[a.value]=c,i("update:modelValue",u)}return(c,u)=>(n.openBlock(),n.createElementBlock("div",$0,[n.createElementVNode("div",x0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":a.value===f}]),role:"tab","aria-selected":a.value===f,onClick:p=>a.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",I0,"•")):n.createCommentVNode("",!0)],10,S0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ae.BSTextArea),{key:0,name:`${e.name}-${a.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":d},null,8,["name","height","placeholder","model-value"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`${e.name}-${a.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":d},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),C0=["disabled"],R0={class:"em-panel__sub-label"},V0={class:"em-field"},A0={class:"em-field"},T0={class:"em-field"},B0={class:"em-class"},M0={class:"em-field"},D0={class:"em-field"},O0={class:"em-field"},L0={class:"em-field"},P0={class:"em-multilang"},z0={class:"em-multilang"},U0={class:"em-jpa"},H0={class:"em-field"},F0={class:"em-field"},G0={class:"em-field"},Y0={class:"em-swatch"},W0={class:"em-swatch__row"},q0=["title","onClick"],od=Be(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,l=o.controller,a=n.computed(()=>l.state.logical.entities.find(P=>P.modelId===o.entityId)??null),r=n.computed(()=>a.value?l.state.layout.entityLayouts.find(P=>P.entityRef===a.value.modelId)??null:null),s=n.computed(()=>{var P;return Xe(((P=r.value)==null?void 0:P.style)??void 0)}),d=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],c=[{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"],f=P=>P;function p(P){return P==="inherit"?"기본(따름)":P}function m(P){a.value&&l.updateEntity(a.value.modelId,P)}function h(P,le,_){var k;const R=((k=a.value)==null?void 0:k.table)??{physicalName:""};m(P==="physicalName"?{table:{...R,physicalName:_}}:{table:{...R,logicalName:{...R.logicalName,[le]:_}}})}function g(P){m({description:Object.keys(P).length?P:void 0})}function w(P,le){var _;m({jpaAttrs:{...(_=a.value)==null?void 0:_.jpaAttrs,[P]:le}})}function b(P,le){w(P,le)}const S=n.computed(()=>{var P,le;return((le=(P=a.value)==null?void 0:P.jpaAttrs)==null?void 0:le.discriminatorType)??"inherit"}),y=n.computed(()=>{var P,le;return!((le=(P=a.value)==null?void 0:P.jpaAttrs)!=null&&le.useDiscriminator)});function x(P){w("discriminatorType",P==="inherit"?void 0:P)}function J(P){m({hasPersonalInfo:P})}function G(P){m({superClass:P.trim()||void 0})}function j(P){m({schema:P.trim()||void 0})}function U(P){m({abstractClass:P})}const Q=n.computed(()=>{var P,le;return((le=(P=a.value)==null?void 0:P.declarationOfInterfaces)==null?void 0:le.join(", "))??""});function te(P){const le=P.split(",").map(_=>_.trim()).filter(Boolean);m({declarationOfInterfaces:le.length?le:void 0})}function de(P){a.value&&l.setEntitySwatch(a.value.modelId,P)}return(P,le)=>{var _,R,k;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(l).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:le[0]||(le[0]=z=>i("toggle"))},[n.createElementVNode("span",R0,[n.createVNode(Ie,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||a.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(an,{controller:n.unref(l),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",V0,[le[13]||(le[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":a.value.name,"onUpdate:modelValue":le[1]||(le[1]=z=>m({name:z}))},null,8,["model-value"])]),n.createElementVNode("label",A0,[le[14]||(le[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":a.value.stereotype,items:d,"value-provider":f,"label-provider":f,"onUpdate:modelValue":le[2]||(le[2]=z=>m({stereotype:z}))},null,8,["model-value"])]),n.createElementVNode("label",T0,[le[15]||(le[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":a.value.packageName??"","onUpdate:modelValue":le[3]||(le[3]=z=>m({packageName:z}))},null,8,["model-value"])]),n.createElementVNode("fieldset",B0,[le[18]||(le[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",M0,[le[16]||(le[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":a.value.superClass??"","onUpdate:modelValue":le[4]||(le[4]=z=>G(z))},null,8,["model-value"])]),n.createElementVNode("label",D0,[le[17]||(le[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":Q.value,"onUpdate:modelValue":le[5]||(le[5]=z=>te(z))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!a.value.abstractClass,"onUpdate:modelValue":le[6]||(le[6]=z=>U(z))},null,8,["model-value"])]),n.createElementVNode("label",O0,[le[19]||(le[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((_=a.value.table)==null?void 0:_.physicalName)??"","onUpdate:modelValue":le[7]||(le[7]=z=>h("physicalName",null,z))},null,8,["model-value"])]),n.createElementVNode("label",L0,[le[20]||(le[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":a.value.schema??"","onUpdate:modelValue":le[8]||(le[8]=z=>j(z))},null,8,["model-value"])]),n.createElementVNode("fieldset",P0,[le[21]||(le[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(l).languages.value,z=>{var W,K;return n.openBlock(),n.createElementBlock("label",{key:z,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(z),1),n.createVNode(n.unref(ae.BSTextInput),{name:`ent-logical-${z}`,width:"100%","model-value":((K=(W=a.value.table)==null?void 0:W.logicalName)==null?void 0:K[z])??"","onUpdate:modelValue":T=>h("logicalName",z,T)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",z0,[le[22]||(le[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ra,{multiline:"",name:"ent-desc",languages:n.unref(l).languages.value,"default-lang":n.unref(l).userLanguage.value,"model-value":a.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",U0,[le[26]||(le[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(c,z=>{var W;return n.createVNode(n.unref(ae.BSCheckbox),{key:z.key,name:`jpa-${z.key}`,class:"em-check",label:z.label,"model-value":!!((W=a.value.jpaAttrs)!=null&&W[z.key]),"onUpdate:modelValue":K=>b(z.key,K)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",H0,[le[23]||(le[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((R=a.value.jpaAttrs)==null?void 0:R.discriminatorColumnName)??"","onUpdate:modelValue":le[9]||(le[9]=z=>w("discriminatorColumnName",z.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",F0,[le[24]||(le[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:y.value,"model-value":S.value,items:u,"value-provider":f,"label-provider":p,"onUpdate:modelValue":le[10]||(le[10]=z=>z&&x(z))},null,8,["disabled","model-value"])]),n.createElementVNode("label",G0,[le[25]||(le[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":(k=a.value.jpaAttrs)==null?void 0:k.discriminatorLength,"onUpdate:modelValue":le[11]||(le[11]=z=>w("discriminatorLength",z||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!a.value.hasPersonalInfo,"onUpdate:modelValue":J},null,8,["model-value"]),n.createElementVNode("fieldset",Y0,[le[27]||(le[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",W0,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:le[12]||(le[12]=z=>de(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),z=>(n.openBlock(),n.createElementBlock("button",{key:z,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===z}]),style:n.normalizeStyle({background:n.unref(In)(z)}),title:n.unref(Sn)(z),onClick:W=>de(z)},null,14,q0))),128))])])],64)):n.createCommentVNode("",!0)],8,C0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),id=["ko","en","ja","zh"];function K0(e){if(e)for(const t of id){const o=e[t];if(o)return o}}function sa(e){const t=K0(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function X0(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:id.some(l=>{var a,r;return(r=(a=i.label)==null?void 0:a[l])==null?void 0:r.toLowerCase().includes(o)})):e}const j0=["aria-expanded"],Z0=["aria-selected","onClick","onMouseenter"],J0={key:0,class:"gcc__opt gcc__opt--empty"},ld=Be(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,l=n.ref(),a=n.ref(),r=n.ref(),s=n.ref(""),d=n.ref(!1),c=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(U=>U.groupCode===o.modelValue)),p=n.computed(()=>f.value?sa(f.value):"");n.watch(p,U=>{d.value||(s.value=U)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:X0(o.items,s.value));function h(){var Q;const U=(Q=l.value)==null?void 0:Q.getBoundingClientRect();U&&(u.value={left:`${U.left}px`,top:`${U.bottom}px`,width:`${U.width}px`})}function g(){d.value=!0,h(),c.value=Math.max(0,m.value.findIndex(U=>U.groupCode===o.modelValue)),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),document.addEventListener("mousedown",j)}function w(){d.value=!1,window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),document.removeEventListener("mousedown",j)}n.onBeforeUnmount(w);function b(){g(),n.nextTick(()=>{var U;return(U=a.value)==null?void 0:U.select()})}function S(){d.value||g(),c.value=0}function y(U){i("update:modelValue",U.groupCode),s.value=sa(U),w()}function x(){i("update:modelValue",void 0),s.value="",w()}function J(){s.value.trim()===""?x():(s.value=p.value,w())}function G(U){var Q;if(U.key==="ArrowDown")d.value||g(),c.value=Math.min(c.value+1,m.value.length-1),U.preventDefault();else if(U.key==="ArrowUp")c.value=Math.max(c.value-1,0),U.preventDefault();else if(U.key==="Enter"){const te=m.value[c.value];te&&y(te),U.preventDefault()}else U.key==="Escape"&&(s.value=p.value,w(),(Q=a.value)==null||Q.blur())}function j(U){var te,de;const Q=U.target;!((te=l.value)!=null&&te.contains(Q))&&!((de=r.value)!=null&&de.contains(Q))&&J()}return(U,Q)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:l,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:a,"onUpdate:modelValue":Q[0]||(Q[0]=te=>s.value=te),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:"코드그룹 검색/선택",onFocus:b,onInput:S,onKeydown:G},null,40,j0),[[n.vModelText,s.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[d.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:r,class:"gcc__popup",style:n.normalizeStyle(u.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:Q[1]||(Q[1]=n.withModifiers(()=>{},["prevent"])),onClick:x},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(te,de)=>(n.openBlock(),n.createElementBlock("li",{key:te.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":de===c.value,"is-selected":te.groupCode===e.modelValue}]),role:"option","aria-selected":te.groupCode===e.modelValue,onMousedown:Q[2]||(Q[2]=n.withModifiers(()=>{},["prevent"])),onClick:P=>y(te),onMouseenter:P=>c.value=de},n.toDisplayString(n.unref(sa)(te)),43,Z0))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",J0,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),Q0=["disabled"],e1={class:"em-aw__toolbar"},t1={class:"em-aw__count"},n1={class:"em-aw__scroll"},o1={class:"em-aw__table"},i1={key:0,class:"c-code"},l1=["colspan"],a1={class:"c-del"},r1={class:"c-flag"},s1={class:"c-flag"},c1={class:"c-flag"},d1={class:"c-flag"},u1={class:"c-flag"},f1={class:"c-flag"},m1={key:0},p1={class:"c-del"},h1=["colspan"],y1={class:"c-del"},g1={class:"em-aw__embed-label"},b1={class:"em-aw__ro"},_1={class:"em-aw__ro"},w1={class:"em-aw__ro"},v1={class:"em-aw__ro"},E1={colspan:"5"},k1=["colspan"],N1={key:0},ki="__OWN__",$1=Be(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(N=>N.modelId===t.entityId)??null),l=n.computed(()=>{var N;return((N=i.value)==null?void 0:N.stereotype)==="JPA_EMBEDDABLE"}),a=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var N;return(((N=i.value)==null?void 0:N.attributes)??[]).filter(O=>O.attrType!=="DIVIDER").length}),s=n.computed(()=>Q.value.length?16:15),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 c(N){return N==="none"?"(없음)":N}const u=N=>N;function f(N,O){i.value&&o.updateAttribute(i.value.modelId,N.modelId,O)}function p(N){return!!N.transient}const m=N=>N.value,h=N=>N.label;function g(N,O){if(!O)return;const V=J.value.find(re=>re.type===O);if(V){const re=N.dbAttrs[0]??{modelId:N.modelId+".c",physicalName:N.name,dataType:"VARCHAR"};f(N,{type:O,customType:void 0,dbAttrs:[{...re,dataType:V.dataType,length:V.length,scale:V.scale}]});return}f(N,O===Ft?{type:O}:{type:O,customType:void 0})}function w(N,O){f(N,{customType:O.trim()===""?void 0:O})}function b(N,O){const V=N.dbAttrs[0]??{modelId:N.modelId+".c",physicalName:N.name,dataType:"VARCHAR"};f(N,{dbAttrs:[{...V,...O}]})}function S(N,O,V){var re;b(N,{logicalName:{...(re=N.dbAttrs[0])==null?void 0:re.logicalName,[O]:V}})}function y(N){return N.personalInfoAttributeType??"none"}function x(N,O){f(N,{personalInfoAttributeType:O==="none"?void 0:O})}const J=n.computed(()=>o.predefinedCustomTypeCatalog.value),G=n.computed(()=>o.embeddableCatalog.value);function j(N){var O,V;return((O=N.label)==null?void 0:O.ko)??((V=N.label)==null?void 0:V.en)??N.type}function U(N){!N||!i.value||o.addPredefinedEmbed(i.value.modelId,N)}const Q=n.computed(()=>o.groupCodeCatalog.value);function te(N){var O;return((O=Q.value.find(V=>V.groupCode===N.groupCode))==null?void 0:O.codes)??[]}function de(N){return["none",...te(N)]}function P(N){return N==="none"?"none":N.code}function le(N){var V,re;if(N==="none")return"(없음)";const O=((V=N.label)==null?void 0:V.ko)??((re=N.label)==null?void 0:re.en);return O?`${N.code} (${O})`:N.code}function _(N,O){i.value&&o.setAttributeGroupCode(i.value.modelId,N.modelId,O)}function R(N,O){f(N,{defaultValue:O==="none"?void 0:O})}function k(N,O){f(N,{defaultValue:O.trim()===""?void 0:O})}function z(N){return N.attrType.startsWith("EMBED")&&N.dbAttrs.length>0}function W(N,O,V){const re=N.dbAttrs.map((pe,he)=>{if(he!==O)return pe;const A={...pe,...V};for(const L of Object.keys(V))V[L]===void 0&&delete A[L];return A});i.value&&o.setEmbedColumns(i.value.modelId,N.modelId,re)}function K(N,O,V,re){var pe;W(N,O,{logicalName:{...(pe=N.dbAttrs[O])==null?void 0:pe.logicalName,[V]:re}})}function T(N,O){var pe,he,A;if(N.attrType==="EMBED_PREDEF"){const L=(pe=o.embeddableCatalog.value.find(Z=>Z.type===N.type))==null?void 0:pe.fields[O];return L?{name:L.name,physicalName:L.physicalName,dataType:L.dataType,length:L.length,shareable:L.shareable,logicalName:L.logicalName}:void 0}const V=(he=N.embedded)==null?void 0:he.embeddableRef;if(!V)return;const re=(A=o.state.logical.entities.find(L=>L.modelId===V))==null?void 0:A.attributes.flatMap(L=>L.dbAttrs)[O];return re?{physicalName:re.physicalName,dataType:re.dataType,length:re.length,scale:re.scale,logicalName:re.logicalName}:void 0}function oe(N,O){var V,re;return((V=T(N,O))==null?void 0:V.dataType)||((re=N.dbAttrs[O])==null?void 0:re.dataType)||""}function ce(N,O){var V,re;return((V=T(N,O))==null?void 0:V.length)??((re=N.dbAttrs[O])==null?void 0:re.length)}function me(N,O){var V,re;return((V=T(N,O))==null?void 0:V.scale)??((re=N.dbAttrs[O])==null?void 0:re.scale)}const ge=["inherit","true","false"];function se(N){return N==="inherit"?"기본(따름)":N}function fe(N){return(N==null?void 0:N.updatable)===void 0?"inherit":N.updatable?"true":"false"}function ye(N,O,V){W(N,O,{updatable:V==="inherit"?void 0:V==="true"})}function Ne(N,O){b(N,{updatable:O==="inherit"?void 0:O==="true"})}const ve=["inherit","true","false"];function $e(N){return N==="inherit"?"기본(따름)":N}function q(N){return(N==null?void 0:N.insertable)===void 0?"inherit":N.insertable?"true":"false"}function Y(N,O,V){W(N,O,{insertable:V==="inherit"?void 0:V==="true"})}function D(N,O){b(N,{insertable:O==="inherit"?void 0:O==="true"})}const M=n.computed(()=>{var N;return Ln(((N=i.value)==null?void 0:N.attributes.flatMap(O=>O.dbAttrs))??[])}),B=n.computed(()=>{var N;return(((N=i.value)==null?void 0:N.attributes)??[]).filter(O=>O.attrType==="NORMAL"&&O.dbAttrs.length===1&&O.dbAttrs[0]).map(O=>({modelId:O.dbAttrs[0].modelId,label:O.dbAttrs[0].physicalName||O.name}))});function F(){return[ki,...B.value.map(N=>N.modelId)]}function ne(N){if(N===ki)return"전용 컬럼(OWN)";const O=B.value.find(V=>V.modelId===N);return O?`↗ ${O.label} (공유)`:N}function X(N){return(N==null?void 0:N.sharedColumnRef)??ki}function E(N,O,V){W(N,O,{sharedColumnRef:V===ki?void 0:V})}function $(N){return(N==null?void 0:N.sharedColumnRef)!=null}function H(N){var O;return((O=To(N,M.value))==null?void 0:O.physicalName)??""}return(N,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",e1,[n.createElementVNode("span",t1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:O[0]||(O[0]=V=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:O[1]||(O[1]=V=>n.unref(o).addDivider(i.value.modelId))}),G.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:G.value,"value-provider":V=>V.type,"label-provider":j,"onUpdate:modelValue":U},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",n1,[n.createElementVNode("table",o1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[O[2]||(O[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),O[3]||(O[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),O[4]||(O[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),O[5]||(O[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),O[6]||(O[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),O[7]||(O[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),O[8]||(O[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),O[9]||(O[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),O[10]||(O[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),O[11]||(O[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),O[12]||(O[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),O[13]||(O[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),O[14]||(O[14]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),O[15]||(O[15]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),O[16]||(O[16]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),O[17]||(O[17]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),Q.value.length?(n.openBlock(),n.createElementBlock("th",i1,"코드그룹")):n.createCommentVNode("",!0),O[18]||(O[18]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),O[19]||(O[19]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,V=>{var re,pe,he,A,L,Z,ue,ee,v,I,C;return n.openBlock(),n.createElementBlock(n.Fragment,{key:V.modelId},[V.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":a.value.has(V.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${V.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":V.name,"onUpdate:modelValue":ie=>f(V,{name:ie})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,l1),n.createElementVNode("td",a1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ie=>n.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])])],2)):z(V)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":a.value.has(V.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:"이름","model-value":V.name,"onUpdate:modelValue":ie=>f(V,{name:ie})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${V.modelId}`,width:"100%",disabled:"","model-value":V.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:Q.value.length?15:14,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(V.dbAttrs.length)+"개",9,h1),n.createElementVNode("td",y1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ie=>n.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(V.dbAttrs,(ie,be)=>{var Re,xe,Ce,ze,Pe,_t,Ht;return n.openBlock(),n.createElementBlock("tr",{key:ie.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",g1,"↳ "+n.toDisplayString(((Re=T(V,be))==null?void 0:Re.name)??((xe=T(V,be))==null?void 0:xe.physicalName)??`컬럼 ${be+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",b1,n.toDisplayString(oe(V,be)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${ie.modelId}`,width:"100%",placeholder:((ze=(Ce=T(V,be))==null?void 0:Ce.logicalName)==null?void 0:ze.ko)??"논리명","model-value":((Pe=ie.logicalName)==null?void 0:Pe.ko)??"","onUpdate:modelValue":Ge=>K(V,be,"ko",Ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${ie.modelId}`,width:"100%",disabled:$(ie),placeholder:((_t=T(V,be))==null?void 0:_t.physicalName)??"컬럼","model-value":$(ie)?H(ie):ie.physicalName,"onUpdate:modelValue":Ge=>W(V,be,{physicalName:Ge})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(an,{controller:n.unref(o),"ref-id":ie.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",_1,n.toDisplayString(oe(V,be)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",w1,n.toDisplayString(ce(V,be)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",v1,n.toDisplayString(me(V,be)??""),1)]),n.createElementVNode("td",E1,[(Ht=T(V,be))!=null&&Ht.shareable?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":X(ie),items:F(),"value-provider":u,"label-provider":ne,"onUpdate:modelValue":Ge=>Ge&&E(V,be,Ge)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:$(ie),"model-value":$(ie)?"false":q(ie),items:ve,"value-provider":u,"label-provider":$e,"onUpdate:modelValue":Ge=>Ge&&Y(V,be,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:$(ie),"model-value":$(ie)?"false":fe(ie),items:ge,"value-provider":u,"label-provider":se,"onUpdate:modelValue":Ge=>Ge&&ye(V,be,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:Q.value.length?3:2},null,8,k1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":a.value.has(V.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${V.modelId}`,width:"100%",placeholder:"이름","model-value":V.name,"onUpdate:modelValue":ie=>f(V,{name:ie})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${V.modelId}`,width:"100%",placeholder:"타입",disabled:!!V.groupCode,items:n.unref(Xa)(V.type,J.value),"value-provider":m,"label-provider":h,"model-value":V.type,"onUpdate:modelValue":ie=>g(V,ie)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),V.type===n.unref(Ft)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${V.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":V.customType??"","onUpdate:modelValue":ie=>w(V,ie)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${V.modelId}`,width:"100%",placeholder:"논리명","model-value":((pe=(re=V.dbAttrs[0])==null?void 0:re.logicalName)==null?void 0:pe.ko)??"","onUpdate:modelValue":ie=>S(V,"ko",ie)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${V.modelId}`,width:"100%",placeholder:"컬럼",disabled:p(V),"model-value":((he=V.dbAttrs[0])==null?void 0:he.physicalName)??"","onUpdate:modelValue":ie=>b(V,{physicalName:ie})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(an,{controller:n.unref(o),"ref-id":(A=V.dbAttrs[0])==null?void 0:A.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${V.modelId}`,width:"100%",placeholder:"dataType",disabled:p(V),items:n.unref(Wa)(((L=V.dbAttrs[0])==null?void 0:L.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(il),"model-value":((Z=V.dbAttrs[0])==null?void 0:Z.dataType)??"","onUpdate:modelValue":ie=>ie&&b(V,{dataType:ie})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${V.modelId}`,width:"100%",placeholder:"len",disabled:p(V),"model-value":(ue=V.dbAttrs[0])==null?void 0:ue.length,"onUpdate:modelValue":ie=>b(V,{length:ie||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${V.modelId}`,width:"100%",placeholder:"scale",disabled:p(V),"model-value":(ee=V.dbAttrs[0])==null?void 0:ee.scale,"onUpdate:modelValue":ie=>b(V,{scale:ie||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",r1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${V.modelId}`,"model-value":V.identifier,disabled:l.value||p(V),"onUpdate:modelValue":ie=>f(V,{identifier:ie})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",s1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${V.modelId}`,"model-value":V.notNull,disabled:p(V),"onUpdate:modelValue":ie=>f(V,{notNull:ie})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",c1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${V.modelId}`,"model-value":!!((v=V.dbAttrs[0])!=null&&v.unique),disabled:p(V),"onUpdate:modelValue":ie=>b(V,{unique:ie})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",d1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${V.modelId}`,"model-value":!!((I=V.dbAttrs[0])!=null&&I.autoIncrement),disabled:p(V)||!V.identifier,"onUpdate:modelValue":ie=>b(V,{autoIncrement:ie})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",u1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${V.modelId}`,"model-value":!!V.transient,disabled:V.identifier,"onUpdate:modelValue":ie=>f(V,{transient:ie||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",f1,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${V.modelId}`,"model-value":!!((C=V.dbAttrs[0])!=null&&C.multiValue),disabled:p(V),"onUpdate:modelValue":ie=>b(V,{multiValue:ie||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${V.modelId}`,width:"100%",disabled:p(V),"model-value":q(V.dbAttrs[0]),items:ve,"value-provider":u,"label-provider":$e,"onUpdate:modelValue":ie=>ie&&D(V,ie)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${V.modelId}`,width:"100%",disabled:p(V),"model-value":fe(V.dbAttrs[0]),items:ge,"value-provider":u,"label-provider":se,"onUpdate:modelValue":ie=>ie&&Ne(V,ie)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":y(V),items:d,"value-provider":u,"label-provider":c,"onUpdate:modelValue":ie=>ie&&x(V,ie)},null,8,["model-value","onUpdate:modelValue"])]),Q.value.length?(n.openBlock(),n.createElementBlock("td",m1,[n.createVNode(ld,{"model-value":V.groupCode,items:Q.value,"onUpdate:modelValue":ie=>_(V,ie)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[te(V).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":V.defaultValue??"none",items:de(V),"value-provider":P,"label-provider":le,"onUpdate:modelValue":ie=>ie&&R(V,ie)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${V.modelId}`,width:"100%",placeholder:"기본값","model-value":V.defaultValue??"","onUpdate:modelValue":ie=>k(V,ie)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",p1,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ie=>n.unref(o).removeAttribute(i.value.modelId,V.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",N1,[...O[20]||(O[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,Q0)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-eaf1fd75"]]),x1=["disabled"],S1={class:"em-idxw__list"},I1={class:"em-idxw__list-head"},C1=["onClick"],R1={class:"em-idxw__item-name"},V1={key:0,class:"em-idxw__badge"},A1={class:"em-idxw__item-cnt"},T1={key:0,class:"em-idxw__empty"},B1={key:0,class:"em-idxw__edit"},M1={class:"em-idxw__form"},D1={class:"em-field em-idxw__name"},O1={class:"em-field"},L1=["value"],P1={class:"em-idxw__transfer"},z1={class:"em-idxw__pane"},U1={class:"em-idxw__pane-head"},H1={class:"em-idxw__cols"},F1=["onClick"],G1={key:0,class:"em-idxw__empty"},Y1={class:"em-idxw__arrows"},W1={class:"em-idxw__pane"},q1={class:"em-idxw__pane-head"},K1={class:"em-idxw__cols"},X1={class:"em-idxw__col-name"},j1={class:"em-idxw__col-ops"},Z1=["disabled","onClick"],J1=["disabled","onClick"],Q1=["onClick"],e_={key:0,class:"em-idxw__empty"},t_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},n_=Be(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(G=>G.modelId===t.entityId)??null),l=n.computed(()=>{var G;return((G=i.value)==null?void 0:G.indexes)??[]}),a=n.computed(()=>{var G;return((G=i.value)==null?void 0:G.attributes)??[]}),r=n.ref(null);n.watch(l,G=>{var j;G.some(U=>U.modelId===r.value)||(r.value=((j=G[0])==null?void 0:j.modelId)??null)},{immediate:!0});const s=n.computed(()=>l.value.find(G=>G.modelId===r.value)??null),d=n.computed(()=>{var G;return new Set(((G=s.value)==null?void 0:G.columns.map(j=>j.columnRef))??[])}),c=n.computed(()=>a.value.filter(G=>!d.value.has(G.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(G){var U;const j=(U=G.dbAttrs[0])==null?void 0:U.physicalName;return j&&j!==G.name?`${G.name} (${j})`:G.name}function p(G){const j=a.value.find(U=>U.modelId===G);return j?f(j):G}function m(G,j){i.value&&o.updateIndex(i.value.modelId,G,j)}function h(){var j;if(!i.value)return;const G=Ve();o.addIndex(i.value.modelId,{modelId:G,name:`idx_${(((j=i.value.indexes)==null?void 0:j.length)??0)+1}`,unique:!1,columns:[]}),r.value=G}function g(G){i.value&&o.removeIndex(i.value.modelId,G)}function w(G){s.value&&m(s.value.modelId,{parameters:G.trim()===""?void 0:G})}function b(G){const j=new Set(u.value);j.has(G)?j.delete(G):j.add(G),u.value=j}function S(){const G=s.value;if(!G||!u.value.size)return;const j=[...u.value].map(U=>({columnRef:U,descending:!1}));m(G.modelId,{columns:[...G.columns,...j]}),u.value=new Set}function y(G){const j=s.value;j&&m(j.modelId,{columns:j.columns.filter((U,Q)=>Q!==G)})}function x(G,j){const U=s.value;U&&m(U.modelId,{columns:U.columns.map((Q,te)=>te===G?{...Q,descending:j}:Q)})}function J(G,j){const U=s.value;if(!U)return;const Q=G+j;if(Q<0||Q>=U.columns.length)return;const te=[...U.columns];[te[G],te[Q]]=[te[Q],te[G]],m(U.modelId,{columns:te})}return(G,j)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",S1,[n.createElementVNode("div",I1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(l.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:h})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,U=>(n.openBlock(),n.createElementBlock("li",{key:U.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":U.modelId===r.value}]),onClick:Q=>r.value=U.modelId},[n.createElementVNode("span",R1,n.toDisplayString(U.name||"(이름 없음)"),1),U.unique?(n.openBlock(),n.createElementBlock("span",V1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",A1,n.toDisplayString(U.columns.length),1)],10,C1))),128)),l.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",T1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",B1,[n.createElementVNode("div",M1,[n.createElementVNode("label",D1,[j[4]||(j[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":j[0]||(j[0]=U=>m(s.value.modelId,{name:U}))},null,8,["model-value"]),n.createVNode(an,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":j[1]||(j[1]=U=>m(s.value.modelId,{unique:U}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:j[2]||(j[2]=U=>g(s.value.modelId))})]),n.createElementVNode("label",O1,[j[5]||(j[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:j[3]||(j[3]=U=>w(U.target.value))},null,40,L1)]),n.createElementVNode("div",P1,[n.createElementVNode("div",z1,[n.createElementVNode("div",U1,"가용 컬럼 ("+n.toDisplayString(c.value.length)+")",1),n.createElementVNode("ul",H1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,U=>(n.openBlock(),n.createElementBlock("li",{key:U.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(U.modelId)}]),onClick:Q=>b(U.modelId)},n.toDisplayString(f(U)),11,F1))),128)),c.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",G1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",Y1,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:S},null,8,["disabled"])]),n.createElementVNode("div",W1,[n.createElementVNode("div",q1,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",K1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(U,Q)=>(n.openBlock(),n.createElementBlock("li",{key:Q,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",X1,n.toDisplayString(p(U.columnRef)),1),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${Q}`,class:"em-check",label:"DESC","model-value":U.descending,"onUpdate:modelValue":te=>x(Q,te)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",j1,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:Q===0,onClick:te=>J(Q,-1)},"↑",8,Z1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:Q===s.value.columns.length-1,onClick:te=>J(Q,1)},"↓",8,J1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:te=>y(Q)},"✕",8,Q1)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",e_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",t_,"인덱스를 선택하거나 추가하세요."))],8,x1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),o_={class:"em-op-src"},i_={class:"em-op-src__actions"},ad=Be(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(t.sourceCode);function l(){t.onSave(i.value),o.close()}return(a,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",o_,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",i_,[n.createVNode(n.unref(ae.BSButton),{caption:"저장",onClick:l}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),l_=["disabled"],a_={class:"em-ow__toolbar"},r_={class:"em-ow__count"},s_={class:"em-ow__scroll"},c_={class:"em-ow__table"},d_={class:"c-del"},u_={key:0},f_=Be(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModal(),l=n.computed(()=>o.state.logical.entities.find(h=>h.modelId===t.entityId)??null),a=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["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 s(h){return h==="none"?"(없음)":h}const d=h=>h;function c(h,g){l.value&&o.updateOperation(l.value.modelId,h.modelId,g)}function u(h,g,w){c(h,{description:{...h.description,[g]:w}})}function f(h){return h.personalInfoAttributeType??"none"}function p(h,g){c(h,{personalInfoAttributeType:g==="none"?void 0:g})}function m(h){i.openModal({component:ad,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:g=>c(h,{sourceCode:g})}})}return(h,g)=>{var w,b;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",a_,[n.createElementVNode("span",r_,"오퍼레이션 ("+n.toDisplayString(((w=l.value.operations)==null?void 0:w.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=S=>n.unref(o).addOperation(l.value.modelId))})]),n.createElementVNode("div",s_,[n.createElementVNode("table",c_,[g[2]||(g[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value.operations??[],S=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:S.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":x=>c(S,{name:x})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":S.visibility??"PACKAGE",items:a,"value-provider":d,"label-provider":d,"onUpdate:modelValue":x=>x&&c(S,{visibility:x})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${S.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=S.description)==null?void 0:y.ko)??"","onUpdate:modelValue":x=>u(S,"ko",x)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(S),items:r,"value-provider":d,"label-provider":s,"onUpdate:modelValue":x=>x&&p(S,x)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:S.sourceCode?"본문 ●":"본문",onClick:x=>m(S)},null,8,["caption","onClick"])]),n.createElementVNode("td",d_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>n.unref(o).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])])])}),128)),(b=l.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",u_,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,l_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),m_={class:"em-detail__tabs"},p_=["onClick"],h_=Be(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModalHandle(),l=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(l,s=>{s||i.close()});const a=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,d)=>{var c;return n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:`엔티티 — ${((c=l.value)==null?void 0:c.name)??""}`},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",m_,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,p_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(od,{key:0,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock($1,{key:1,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(n_,{key:2,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(f_,{key:3,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Ni(e,t,o){e.openModal({component:h_,bind:{controller:n.markRaw(t),entityId:o}})}const rd=()=>crypto.randomUUID(),y_=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,g_=e=>e&&e[0].toLowerCase()+e.slice(1),b_=e=>e&&e[0].toUpperCase()+e.slice(1),__=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function w_(e,t){return g_(e)+b_(t)}function v_(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const l=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=w_(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:l,notNull:l,dbAttrs:r.dbAttrs.map(d=>({physicalName:__(s),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const $i=(e,t)=>`${e}::${t}`;function E_(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((a,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==a.dataType||s.length!==a.length||s.scale!==a.scale}))&&(i.dbAttrs=t.dbAttrs.map((a,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??a.physicalName,logicalName:(s==null?void 0:s.logicalName)??a.logicalName,dataType:a.dataType,length:a.length,scale:a.scale}})),Object.keys(i).length?i:null}function k_(e,t,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:t,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function xi(e,t,o=rd){const i={add:[],update:[],remove:[]},l=e.entities.find(f=>f.modelId===t);if(!l)return i;const a=e.associations.filter(f=>f.end2.entityRef===t),r=l.stereotype==="JPA_EMBEDDABLE"?[]:a.flatMap(f=>v_(e,f)),s=new Map(r.map(f=>[$i(f.associationRef,f.sourceAttributeRef),f])),d=l.attributes.filter(f=>f.derivedFrom),c=new Map(d.map(f=>[$i(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of d){const p=$i(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(f.modelId)}let u=l.attributes.reduce((f,p)=>Math.max(f,p.order),-1)+1;for(const f of r){const p=$i(f.associationRef,f.sourceAttributeRef),m=c.get(p);if(!m)i.add.push(k_(f,u++,o));else{const h=E_(m,f,o);h&&i.update.push({attributeId:m.modelId,patch:h})}}return i}function N_(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(l=>l.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function $_(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function x_(e,t,o=rd){const i=new Map,l=$_(e),a=new Set,r=[t];for(;r.length;){const s=r.shift();if(a.has(s))continue;a.add(s);const d=new Set(l.associations.filter(c=>c.end1.entityRef===s).map(c=>c.end2.entityRef));for(const c of d){const u=xi(l,c,o);if(y_(u))continue;i.has(c)||i.set(c,u);const f=l.entities.find(p=>p.modelId===c);f&&N_(f,u),a.has(c)||r.push(c)}}return i}function S_(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Ve(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const l of t.attributes){const a=Ve();o.set(l.modelId,a),l.modelId=a;for(const r of l.dbAttrs)r.modelId=Ve()}for(const l of t.indexes??[]){l.modelId=Ve();for(const a of l.columns)a.columnRef=o.get(a.columnRef)??a.columnRef}return t}const rn=Symbol("editorController");function sd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Si(e,t){const o=[];for(const i of t.remove)o.push(At(e,i));for(const i of t.update)o.push(qt(e,i.attributeId,i.patch));for(const i of t.add)o.push(vt(e,i));return o}function Cn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Rn(e,t){const o=[];for(const[i,l]of x_(e,t,Ve))o.push(...Si(i,l));return o}function cd(e,t,o){const i=new Set(o.remove);return Cn(e,t,l=>[...l.filter(a=>!i.has(a.modelId)).map(a=>{const r=o.update.find(s=>s.attributeId===a.modelId);return r?{...a,...r.patch}:a}),...o.add])}function ca(e,t){const o=xi(e,t,Ve),i=Si(t,o),l=cd(e,t,o);return i.push(...Rn(l,t)),i}function dd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Ve()}))}function I_(e,t){var c;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let l;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,h)=>Math.max(m,h.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;l={modelId:Ve(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Ve(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(vt(t,l))}const a=[];for(const u of e.entities)for(const f of u.attributes){if(((c=f.embedded)==null?void 0:c.embeddableRef)!==t)continue;const p=e.associations.find(w=>w.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,h=m?p.end1:p.end2,g=m?p.end2:p.end1;a.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:h.multiplicity,navigable:h.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return l?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,l]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(a.filter(p=>p.ownerId===u.modelId).map(p=>p.dispId));return f.size?{...u,attributes:u.attributes.filter(p=>!f.has(p.modelId))}:u}),associations:e.associations.map(u=>{const f=a.find(p=>p.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=xi(r,t,Ve);for(const u of a){const f=s.add.find(p=>{var m;return((m=p.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of a)i.push(At(u.ownerId,u.dispId)),i.push(Po(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Si(t,s));const d=cd(r,t,s);return i.push(...Rn(d,t)),i}function C_(e,t){const o=e.entities.find(a=>a.modelId===t);if(!o)return[];const i=[],l=a=>a&&a.charAt(0).toLowerCase()+a.slice(1);for(const a of e.associations){if(a.end1.entityRef===a.end2.entityRef)continue;const r=a.end1.entityRef===t,s=a.end2.entityRef===t;if(!r&&!s)continue;const d=r?a.end2.entityRef:a.end1.entityRef,c=e.entities.find(y=>y.modelId===d);if(!c||c.attributes.some(y=>{var x;return((x=y.embedded)==null?void 0:x.associationRef)===a.modelId}))continue;const u=Ve(),f=c.attributes.reduce((y,x)=>Math.max(y,x.order),-1)+1,p=new Set(c.attributes.map(y=>y.name)),m=l(o.name);let h=m;for(let y=2;p.has(h);y++)h=`${m}${y}`;const g=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Ve()})),w={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:a.modelId,embeddableRef:t}};i.push(vt(d,w));const b=r?"end2":"end1",S=r?"end1":"end2";i.push(Po(a.modelId,{identifying:!1,[b]:{entityRef:d,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Ve()},[S]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function R_(e=sd(),t={}){var ne,X;const o=n.reactive(e);let i=new dl(o);const l=n.ref(t.embeddableCatalog??[]),a=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),c=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),h=n.ref(!1),g=n.ref(!1),w=n.ref(0),b=n.ref(((ne=t.meta)==null?void 0:ne.schemaVersion)??1),S=n.ref(((X=t.meta)==null?void 0:X.opWriteEnabled)??!1),y=n.computed(()=>b.value>=2&&S.value),x=t.historyTransport,J=n.computed(()=>y.value&&x!==void 0),G=t.restoreTransport,j=n.ref(0),U=n.computed(()=>y.value&&te.value&&G!==void 0);async function Q(E){if(!G||!te.value)return{ok:!1,reason:"unavailable"};const $=await G(E);return $.ok&&j.value++,$}const te=n.ref(!(b.value>=2&&S.value===!1)),de=n.ref("LOGICAL_PHYSICAL"),P=n.ref("straight"),le=n.ref(!0),_=n.ref(!0),R=n.ref(null),k=n.computed(()=>{var E;return((E=R.value)==null?void 0:E.kind)==="attribute"?{entityId:R.value.entityId,attrId:R.value.anchor}:null}),z=n.computed(()=>{var E;return((E=R.value)==null?void 0:E.kind)==="attribute"?R.value.ids:[]}),W=n.computed(()=>{var E,$;return((E=R.value)==null?void 0:E.kind)==="entity"?R.value.id:(($=R.value)==null?void 0:$.kind)==="attribute"?R.value.entityId:null}),K=n.ref(null);let T=0;const oe=n.ref(null),ce=n.ref(null);let me=t.meta;function ge(){i.onChange(()=>{m.value=i.canUndo,h.value=i.canRedo,g.value=i.isDirty,w.value++})}ge();let se=null,fe=null;function ye(){fe==null||fe(),fe=null,se=null}function Ne(){if(ye(),!y.value||!t.opTransport)return;const E=new zr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:$=>{te.value=!1,ce.value=$}});E.seed((me==null?void 0:me.revSeed)??{}),fe=E.attach(i),se=E}Ne();const ve=n.computed(()=>Da(o.logical,o.layout)),$e=n.computed(()=>({reservedWords:c.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:l.value})),q=n.computed(()=>Ja(o.logical,$e.value)),Y=n.computed(()=>{const E=new Map;for(const $ of q.value){if(!$.targetRef)continue;const H=E.get($.targetRef);H?H.push($):E.set($.targetRef,[$])}return E}),D=E=>{te.value&&i.execute(E)},M=(E,$,H)=>{const N=qt(E,$,H),O=Cn(o.logical,E,re=>re.map(pe=>pe.modelId===$?{...pe,...H}:pe)),V=Rn(O,E);D(V.length?De("속성 수정",[N,...V]):N)};function B(E){const $=E.map(he=>o.layout.entityLayouts.find(A=>A.entityRef===he)).filter(he=>!!he);if(!$.length)return{location:{x:40,y:40},size:{width:400,height:300}};let H=1/0,N=1/0,O=-1/0,V=-1/0;for(const he of $){const A=he.geo.size.width||220,L=he.geo.size.height||140;H=Math.min(H,he.geo.location.x),N=Math.min(N,he.geo.location.y),O=Math.max(O,he.geo.location.x+A),V=Math.max(V,he.geo.location.y+L)}const re=40,pe=28;return{location:{x:H-re,y:N-re-pe},size:{width:O-H+re*2,height:V-N+re*2+pe}}}function F(E,$,H){var he;const N=o.layout.groupLayouts.find(A=>A.groupRef===E),O=(N==null?void 0:N.geo.location)??$,V=$.x-O.x,re=$.y-O.y,pe=[ur(E,$),...H.map(A=>yn(A.id,A.location))];if(V||re){const A=new Set(((he=o.logical.groups.find(L=>L.modelId===E))==null?void 0:he.memberEntityRefs)??[]);for(const L of o.logical.associations){if(!A.has(L.end1.entityRef)||!A.has(L.end2.entityRef))continue;const Z=o.layout.associationLayouts.find(ue=>ue.associationRef===L.modelId);Z&&Z.waypoints.length&&pe.push(Nr(L.modelId,V,re))}for(const L of(N==null?void 0:N.memberNoteRefs)??[]){const Z=o.layout.notes.find(ue=>ue.modelId===L);Z&&pe.push(Fn(L,{x:Z.geo.location.x+V,y:Z.geo.location.y+re}))}}return pe}return{state:o,resolved:ve,issues:q,issuesByRef:Y,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:h,dirty:g,revision:w,editable:te,schemaVersion:b,opWriteEnabled:S,opMode:y,opConflict:ce,historyTransport:x,historyAvailable:J,restoreTransport:G,restoreAvailable:U,restoreToSeq:Q,reloadRequest:j,displayMode:de,routingMode:P,showGrid:le,showMinimap:_,selection:R,selectedAttr:k,selectedAttrIds:z,inspectedEntityId:W,focusRequest:K,clipboard:oe,embeddableCatalog:l,groupCodeCatalog:a,predefinedCustomTypeCatalog:r,languages:s,userLanguage:d,selectableDataTypes:u,setEditable(E){te.value=E&&y.value},setEmbeddableCatalog(E){l.value=E},setGroupCodeCatalog(E){a.value=E},setPredefinedCustomTypeCatalog(E){r.value=E},selectAttribute(E,$,H="replace"){const N=R.value,O=(N==null?void 0:N.kind)==="attribute"&&N.entityId===E;if(H==="replace"||!O){R.value={kind:"attribute",entityId:E,ids:[$],anchor:$};return}if(H==="toggle"){const Z=N.ids.includes($),ue=Z?N.ids.filter(v=>v!==$):[...N.ids,$];if(!ue.length){R.value=null;return}const ee=Z&&N.anchor===$?ue[ue.length-1]:Z?N.anchor:$;R.value={kind:"attribute",entityId:E,ids:ue,anchor:ee};return}const V=o.logical.entities.find(Z=>Z.modelId===E),re=[...(V==null?void 0:V.attributes)??[]].sort((Z,ue)=>Z.order-ue.order).map(Z=>Z.modelId),pe=re.indexOf(N.anchor),he=re.indexOf($);if(pe<0||he<0){R.value={kind:"attribute",entityId:E,ids:[$],anchor:$};return}const[A,L]=pe<=he?[pe,he]:[he,pe];R.value={kind:"attribute",entityId:E,ids:re.slice(A,L+1),anchor:N.anchor}},moveAttributeFocus(E){const $=R.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const H=o.logical.entities.find(re=>re.modelId===$.entityId);if(!H||!H.attributes.length)return!1;const N=H.attributes.findIndex(re=>re.modelId===$.anchor);if(N<0)return!1;const O=Math.min(Math.max(N+E,0),H.attributes.length-1);if(O===N)return!0;const V=H.attributes[O].modelId;return R.value={kind:"attribute",entityId:$.entityId,ids:[V],anchor:V},!0},nudgeSelectedAttributes(E){const $=R.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const H=o.logical.entities.find(Z=>Z.modelId===$.entityId);if(!H)return!1;const N=H.attributes,O=new Set($.ids),V=N.map((Z,ue)=>O.has(Z.modelId)?ue:-1).filter(Z=>Z>=0);if(!V.length)return!1;const re=Math.min(...V),pe=N.filter(Z=>!O.has(Z.modelId)),he=N.slice(0,re).filter(Z=>!O.has(Z.modelId)).length;let A;if(E<0){if(he<=0)return!0;A=he-1}else{if(pe.length-he<=0)return!0;A=he+1}const L=N.filter(Z=>O.has(Z.modelId)).map(Z=>Z.modelId);return D(yl($.entityId,L,A)),!0},deleteSelection(){if(!te.value)return!1;const E=R.value;if(!E)return!1;if(E.kind==="attribute"){const $=E.ids;if(!$.length)return!1;$.length===1?D(At(E.entityId,$[0])):D(De("속성 삭제",$.map(H=>At(E.entityId,H))))}else E.kind==="entity"?D(fl(E.id)):E.kind==="note"?D(_l(E.id)):E.kind==="group"?D(hl(E.id)):D(bl(E.id));return R.value=null,!0},nudgeNodes(E,$,H){if(!E.length||$===0&&H===0)return!1;const N=new Set(o.logical.entities.map(A=>A.modelId)),O=new Set(o.logical.groups.map(A=>A.modelId)),V=new Set(o.layout.notes.map(A=>A.modelId)),re=new Set;for(const A of E){if(!O.has(A))continue;const L=o.logical.groups.find(Z=>Z.modelId===A);for(const Z of(L==null?void 0:L.memberEntityRefs)??[])re.add(Z)}const pe=[],he=[];for(const A of E)if(O.has(A)){const L=o.layout.groupLayouts.find(v=>v.groupRef===A);if(!L)continue;const Z=o.logical.groups.find(v=>v.modelId===A),ue=((Z==null?void 0:Z.memberEntityRefs)??[]).map(v=>{var C;const I=((C=o.layout.entityLayouts.find(ie=>ie.entityRef===v))==null?void 0:C.geo.location)??{x:0,y:0};return{id:v,location:{x:I.x+$,y:I.y+H}}}),ee={x:L.geo.location.x+$,y:L.geo.location.y+H};pe.push(De("그룹 이동",F(A,ee,ue))),he.push("g:"+A)}else if(N.has(A)){if(re.has(A))continue;const L=o.layout.entityLayouts.find(Z=>Z.entityRef===A);if(!L)continue;pe.push(yn(A,{x:L.geo.location.x+$,y:L.geo.location.y+H})),he.push("e:"+A)}else if(V.has(A)){const L=o.layout.notes.find(Z=>Z.modelId===A);if(!L)continue;pe.push(Fn(A,{x:L.geo.location.x+$,y:L.geo.location.y+H})),he.push("n:"+A)}return pe.length?(D(De("이동",pe,"nudge:"+he.sort().join(","))),!0):!1},requestFocus(E){K.value={id:E,nonce:++T}},undo:()=>{te.value&&i.undo()},redo:()=>{te.value&&i.redo()},markSaved:()=>{te.value&&(se==null||se.flush(),i.markSavePoint())},loadDiagram(E,$){ye(),o.logical=E.logical,o.layout=E.layout,i=new dl(o),ge(),b.value=($==null?void 0:$.schemaVersion)??1,S.value=($==null?void 0:$.opWriteEnabled)??!1,te.value=!(b.value>=2&&S.value===!1),me=$,ce.value=null,R.value=null,m.value=i.canUndo,h.value=i.canRedo,g.value=i.isDirty,Ne()},flush(){se==null||se.flush()},whenOpsSettled(){return(se==null?void 0:se.whenSettled())??Promise.resolve()},addEntity(E="NewEntity",$={x:80,y:80}){const H=Ve(),N={modelId:H,name:E,stereotype:"JPA_ENTITY",table:{physicalName:E.toLowerCase()},attributes:[{modelId:Ve(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Ve(),physicalName:"id",dataType:"BIGINT"}]}]};return D(ul(N,{location:{...$},size:{width:220,height:140}})),H},renameEntity(E,$){D(lr(E,$))},updateEntity(E,$){const H=ir(E,$),N=o.logical.entities.find(re=>re.modelId===E),O=$.stereotype==="JPA_EMBEDDABLE"&&!!N&&N.stereotype!=="JPA_EMBEDDABLE",V=!!$.stereotype&&$.stereotype!=="JPA_EMBEDDABLE"&&!!N&&N.stereotype==="JPA_EMBEDDABLE";if(O&&N){const re=N.attributes.filter(Z=>Z.identifier&&!Z.derivedFrom).map(Z=>qt(E,Z.modelId,{identifier:!1})),pe=Cn({...o.logical,entities:o.logical.entities.map(Z=>Z.modelId===E?{...Z,stereotype:"JPA_EMBEDDABLE"}:Z)},E,Z=>Z.map(ue=>ue.identifier&&!ue.derivedFrom?{...ue,identifier:!1}:ue)),he=ca(pe,E),A=C_(o.logical,E),L=[H,...re,...he,...A];D(L.length>1?De("임베더블 변환",L):H);return}if(V){const re=I_(o.logical,E),pe=[H,...re];D(pe.length>1?De("엔터티 전환",pe):H);return}D(H)},moveEntity(E,$){D(yn(E,$))},resizeEntity(E,$){D(ar(E,$))},removeEntity(E){D(fl(E))},setEntitySwatch(E,$){D(rr(E,$))},setEntityCollapsed(E,$){D(sr(E,$))},collapseAll(){D(ml(!0))},expandAll(){D(ml(!1))},setAttributeSwatch(E,$,H){D(Oo(E,$,H))},dragGroup(E,$,H){D(De("그룹 이동",F(E,$,H)))},resizeGroup(E,$){D(fr(E,$))},setGroupSwatch(E,$){D(mr(E,$))},updateGroup(E,$){D(cr(E,$))},createGroup(E,$){if(!E.length)return null;const H=[];for(const V of o.logical.groups)for(const re of E)V.memberEntityRefs.includes(re)&&H.push(Lo(V.modelId,re));const N=Ve(),O={modelId:N,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...E]};return H.push(pl(O,B(E))),D(De("그룹 생성",H)),R.value=null,N},addEmptyGroup(E,$){const H=Ve();return D(pl({modelId:H,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...E},size:{width:360,height:260}})),H},removeGroup(E){D(hl(E))},dropEntity(E,$,H){var V;const N=((V=o.logical.groups.find(re=>re.memberEntityRefs.includes(E)))==null?void 0:V.modelId)??null,O=[yn(E,$)];N!==H&&(N&&O.push(Lo(N,E)),H&&O.push(dr(H,E))),D(De("이동",O))},ungroupEntity(E){const $=o.logical.groups.find(H=>H.memberEntityRefs.includes(E));$&&D(Lo($.modelId,E))},dropNote(E,$,H){var V;const N=((V=o.layout.groupLayouts.find(re=>{var pe;return(pe=re.memberNoteRefs)==null?void 0:pe.includes(E)}))==null?void 0:V.groupRef)??null,O=[Fn(E,$)];N!==H&&(N&&O.push(Ar(N,E)),H&&O.push(Vr(H,E))),D(De("이동",O))},addPredefinedEmbed(E,$){const H=l.value.find(he=>he.type===$),N=o.logical.entities.find(he=>he.modelId===E);if(!H||!N)return;const O=N.attributes.reduce((he,A)=>Math.max(he,A.order),-1)+1,V=Ve(),re=H.fields.map(()=>({modelId:Ve(),physicalName:"",dataType:""})),pe={modelId:V,name:H.defaultName,type:H.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:O,dbAttrs:re};return D(vt(E,pe)),V},addAttribute(E,$={}){const H=o.logical.entities.find(L=>L.modelId===E),N=H?H.attributes.length:0,O=$.modelId??Ve(),V=$.name??`field${N}`,re={modelId:O,name:V,type:$.type??qa,attrType:$.attrType??"NORMAL",identifier:$.identifier??!1,notNull:$.notNull??!1,order:N,dbAttrs:$.dbAttrs??[{modelId:Ve(),physicalName:V,dataType:"VARCHAR",length:255}],...$},pe=vt(E,re),he=Cn(o.logical,E,L=>[...L,re]),A=Rn(he,E);return D(A.length?De("속성 추가",[pe,...A]):pe),O},addDivider(E){const $=o.logical.entities.find(V=>V.modelId===E),H=$?$.attributes.length:0,N=Ve();return D(vt(E,{modelId:N,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:H,dbAttrs:[]})),N},updateAttribute(E,$,H){M(E,$,H)},setAttributeGroupCode(E,$,H){M(E,$,{groupCode:H,type:H?Ao:qa})},setEmbedColumns(E,$,H){var he,A;const N=qt(E,$,{dbAttrs:H}),O=(he=o.logical.entities.find(L=>L.modelId===E))==null?void 0:he.attributes.find(L=>L.modelId===$),V=(A=O==null?void 0:O.embedded)==null?void 0:A.associationRef,re=V?o.logical.associations.find(L=>L.modelId===V):void 0,pe=[];re&&V&&(re.end1.legacyEmbedRaw&&pe.push(gn(V,"end1",{legacyEmbedRaw:void 0})),re.end2.legacyEmbedRaw&&pe.push(gn(V,"end2",{legacyEmbedRaw:void 0}))),D(pe.length?De("임베드 컬럼 수정",[N,...pe]):N)},removeAttribute(E,$){const H=At(E,$),N=Cn(o.logical,E,V=>V.filter(re=>re.modelId!==$)),O=Rn(N,E);D(O.length?De("속성 삭제",[H,...O]):H)},removeAttributes(E,$){var re;if(!$.length)return;const H=$.map(pe=>At(E,pe)),N=new Set($),O=Cn(o.logical,E,pe=>pe.filter(he=>!N.has(he.modelId))),V=[...H,...Rn(O,E)];D(V.length===1?V[0]:De("속성 삭제",V)),((re=R.value)==null?void 0:re.kind)==="attribute"&&R.value.entityId===E&&(R.value=null)},setAttributeSwatches(E,$,H){$.length&&($.length===1?D(Oo(E,$[0],H)):D(De("속성 색상",$.map(N=>Oo(E,N,H)))))},reorderAttributes(E,$,H){$.length&&D(yl(E,$,H))},addIndex(E,$){D(_r(E,$))},updateIndex(E,$,H){D(wr(E,$,H))},removeIndex(E,$){D(vr(E,$))},addOperation(E,$={}){var re;const H=o.logical.entities.find(pe=>pe.modelId===E),N=((re=H==null?void 0:H.operations)==null?void 0:re.length)??0,O=$.modelId??Ve(),V={modelId:O,name:$.name??`method${N}`,visibility:$.visibility??"PACKAGE",order:N,...$};return D(pr(E,V)),O},updateOperation(E,$,H){D(hr(E,$,H))},removeOperation(E,$){D(yr(E,$))},reorderOperations(E,$,H){$.length&&D(gr(E,$,H))},setOperationSwatch(E,$,H){D(br(E,$,H))},addAssociation(E,$,H,N){const O=Ve(),V={modelId:O,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:H},end2:{entityRef:$,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},re={...o.logical,associations:[...o.logical.associations,V]},pe=xi(re,$,Ve),he=pe.add[0];he&&(V.end2.attributeRef=he.modelId);const A={associationRef:O,waypoints:[],sourceColumnRef:H,targetColumnRef:(he==null?void 0:he.modelId)??N},L=gl(V,A),Z=Si($,pe);return D(Z.length?De("관계 추가",[L,...Z]):L),O},addEmbedAssociation(E,$){const H=o.logical.entities.find(C=>C.modelId===E),N=o.logical.entities.find(C=>C.modelId===$);if(!H||!N||N.stereotype!=="JPA_EMBEDDABLE")return;const O=Ve(),V=Ve(),re=Ve(),pe=H.attributes.reduce((C,ie)=>Math.max(C,ie.order),-1)+1,he=dd(N),A=C=>C&&C.charAt(0).toLowerCase()+C.slice(1),L=new Set(H.attributes.map(C=>C.name)),Z=A(N.name);let ue=Z;for(let C=2;L.has(ue);C++)ue=`${Z}${C}`;const ee={modelId:V,name:ue,type:N.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:pe,dbAttrs:he,embedded:{associationRef:O,embeddableRef:$}},v={modelId:O,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:re},end2:{entityRef:$,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:V}},I={associationRef:O,waypoints:[],sourceColumnRef:V,targetColumnRef:void 0};return D(De("임베드 추가",[vt(E,ee),gl(v,I)])),O},setEmbedCollectionMode(E,$){const H=o.logical.associations.find(A=>A.modelId===E);if(!H)return;let N,O;for(const A of o.logical.entities){const L=A.attributes.find(Z=>{var ue;return((ue=Z.embedded)==null?void 0:ue.associationRef)===E&&Z.attrType==="EMBED_OWN"});if(L){N=A.modelId,O=L;break}}if(!N||!O)return;const V=O.embedded.embeddableRef,re=H.end2.entityRef===V?"end2":"end1",pe=H[re],he=pe.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!($==="COLLECTION"?he:!he))if($==="COLLECTION")D(De("임베드 컬렉션 전환",[qt(N,O.modelId,{dbAttrs:[]}),gn(E,re,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...pe.jpa,collectionType:"LIST"}})]));else{const A=o.logical.entities.find(L=>L.modelId===V);if(!A)return;D(De("임베드 단일 전환",[qt(N,O.modelId,{dbAttrs:dd(A)}),gn(E,re,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...pe.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(E){const $=o.logical.associations.find(re=>re.modelId===E),H=bl(E);if(!$){D(H);return}for(const re of o.logical.entities){const pe=re.attributes.find(he=>{var A;return((A=he.embedded)==null?void 0:A.associationRef)===E});if(pe){D(De("임베드 삭제",[H,At(re.modelId,pe.modelId)]));return}}const N=$.end2.entityRef,O={...o.logical,associations:o.logical.associations.filter(re=>re.modelId!==E)},V=ca(O,N);D(V.length?De("관계 삭제",[H,...V]):H)},setAssociationIdentifying(E,$){const H=o.logical.associations.find(pe=>pe.modelId===E),N=Po(E,{identifying:$});if(!H||H.identifying===$){D(N);return}const O=H.end2.entityRef,V={...o.logical,associations:o.logical.associations.map(pe=>pe.modelId===E?{...pe,identifying:$}:pe)},re=ca(V,O);D(re.length?De("식별 관계 변경",[N,...re]):N)},updateAssociationEnd(E,$,H){D(gn(E,$,H))},moveWaypoint(E,$,H){D(Er(E,$,H))},addWaypoint(E,$,H){D(xr(E,$,H))},removeWaypoint(E,$){D(kr(E,$))},clearWaypoints(E){D($r(E))},addNote(E="메모",$={x:80,y:80}){const H=Ve();return D(Sr({modelId:H,memo:E,geo:{location:{...$},size:{width:200,height:120}}})),H},removeNote(E){D(_l(E))},moveNote(E,$){D(Fn(E,$))},resizeNote(E,$){D(Ir(E,$))},setNoteMemo(E,$){D(Cr(E,$))},setNoteSwatch(E,$){D(Rr(E,$))},addNoteConnection(E,$){D(Tr(E,$))},removeNoteConnection(E,$){D(Br(E,$))},moveNoteConnectionWaypoint(E,$,H,N){D(Mr(E,$,H,N))},addNoteConnectionWaypoint(E,$,H,N){D(Dr(E,$,H,N))},removeNoteConnectionWaypoint(E,$,H){D(Or(E,$,H))},clearNoteConnectionWaypoints(E,$){D(Lr(E,$))},autoLayout(){const E=Pa(o.logical,o.layout);E.length&&D(De("자동 배치",E.map($=>yn($.id,$.location))))},copy(){const E=R.value;if((E==null?void 0:E.kind)==="attribute"){const V=o.logical.entities.find(pe=>pe.modelId===E.entityId);if(!V)return;const re=[...V.attributes].sort((pe,he)=>pe.order-he.order).filter(pe=>E.ids.includes(pe.modelId));if(!re.length)return;oe.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:re}));return}const $=W.value;if(!$)return;const H=o.logical.entities.find(V=>V.modelId===$),N=o.layout.entityLayouts.find(V=>V.entityRef===$);if(!H)return;const O=(N==null?void 0:N.geo)??{location:{x:80,y:80},size:{width:220,height:140}};oe.value=JSON.parse(JSON.stringify({kind:"entity",entity:H,geo:O}))},paste(){if(!te.value)return;const E=oe.value;if(!E)return;if(E.kind==="attribute"){const N=W.value;if(!N)return;const O=o.logical.entities.find(L=>L.modelId===N);if(!O)return;const V=new Set(O.attributes.map(L=>L.name)),re=new Set(O.attributes.flatMap(L=>L.dbAttrs.map(Z=>Z.physicalName))),pe=O.attributes.length,he=[],A=E.attributes.map((L,Z)=>{const ue=JSON.parse(JSON.stringify(L));ue.modelId=Ve();for(const ee of ue.dbAttrs)ee.modelId=Ve();V.has(ue.name)&&(ue.name=`${ue.name}_copy`);for(const ee of ue.dbAttrs)ee.physicalName&&re.has(ee.physicalName)&&(ee.physicalName=`${ee.physicalName}_copy`);return ue.order=pe+Z,he.push(ue.modelId),vt(N,ue)});D(A.length===1?A[0]:De("속성 붙여넣기",A)),R.value={kind:"attribute",entityId:N,ids:he,anchor:he[he.length-1]};return}const $=S_(E.entity),H={location:{x:E.geo.location.x+40,y:E.geo.location.y+40},size:{...E.geo.size}};D(ul($,H)),R.value={kind:"entity",id:$.modelId}}}}const Ii=Symbol("groupHover"),ud=Symbol("groupDrag"),Vn=Symbol("relationHighlight"),V_={key:0,class:"em-sel","aria-hidden":"true"},A_=["title","aria-expanded","disabled"],T_={class:"em-entity__stereotype"},B_={key:1,class:"em-entity__name"},M_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],D_=["onPointerdown"],O_={key:1,class:"em-entity__divider-label"},L_=["title"],P_={class:"em-key-slot"},z_={class:"em-key-slot"},U_={key:0,class:"em-entity__type"},H_=["onClick"],F_={class:"em-entity__attrname"},G_={class:"em-entity__type"},Y_=["data-op"],W_=["onPointerdown"],q_={class:"em-entity__op-vis","aria-hidden":"true"},K_=["title"],X_={key:4,class:"em-entity__footer"},fd=Be(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(rn,null),i=ae.useModal();function l(){o&&Ni(i,o,t.id)}const a=n.inject(Ii,null),r=n.inject(Vn,null),s=n.computed(()=>!!o&&o.editable.value);function d(){a&&(a.value=t.data.groupRef??null)}function c(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),p=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var ee;return((ee=o==null?void 0:o.selection.value)==null?void 0:ee.kind)==="entity"&&o.selection.value.id===t.id}),h=n.computed(()=>!!t.selected&&!m.value),g=n.computed(()=>{var ee;return o&&((ee=o.selectedAttr.value)==null?void 0:ee.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),w=n.computed(()=>g.value.size>0);function b(ee,v){const I=v.shiftKey?"range":v.metaKey||v.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,ee.modelId,I)}const S=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),x=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),J=n.computed(()=>t.data.collapsed??!1);function G(){s.value&&(o==null||o.setEntityCollapsed(t.id,!J.value))}const j=n.computed(()=>x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL"),U=n.computed(()=>{const ee=x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL",v={};for(const I of y.value.attributes){const C=I.attrType.startsWith("RELATION")&&I.dbAttrs.length>0;v[I.modelId]={pk:I.identifier,fk:C&&ee,required:I.notNull&&!I.identifier}}return v});function Q(ee){if(!ee)return"";const v=[];return ee.pk&&ee.fk?v.push("PFK (식별 외래키)"):ee.pk?v.push("PK (기본키)"):ee.fk&&v.push("FK (외래키)"),ee.required&&v.push("필수 (NOT NULL)"),v.join(" · ")}const te=n.computed(()=>{const ee=aa(Xe(t.data.style)),v={};return ee&&(v["--em-header-bg"]=ee.bar,v["--em-header-fg"]=ee.barOn),v});function de(ee){var v,I;return(I=aa(Xe((v=t.data.attributeStyles)==null?void 0:v[ee.modelId])))==null?void 0:I.text}const P=n.computed(()=>[...y.value.operations??[]].sort((ee,v)=>ee.order-v.order)),le=n.computed(()=>x.value==="CLASS"&&P.value.length>0),_={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(ee){return ee?_[ee]:"~"}function k(ee){var v,I;return(I=aa(Xe((v=t.data.operationStyles)==null?void 0:v[ee.modelId])))==null?void 0:I.text}function z(ee,v,I){switch(x.value){case"CLASS":return[{text:ee}];case"PHYSICAL":return[{text:I||ee}];case"LOGICAL":return[v?{text:v}:{text:"(논리명)",missing:!0}];default:{const C=v?{text:v}:{text:"(논리명)",missing:!0};return I?[C,{text:` · ${I}`}]:[C]}}}function W(ee){var v,I,C;return K(ee)?[{text:ee.name}]:z(ee.name,(I=(v=ee.dbAttrs[0])==null?void 0:v.logicalName)==null?void 0:I.ko,((C=ee.dbAttrs[0])==null?void 0:C.physicalName)??"")}function K(ee){return ee.attrType.startsWith("EMBED")&&ee.dbAttrs.length>0}function T(ee){return ee.attrType==="DIVIDER"}function oe(ee){if(ee.attrType!=="EMBED_PREDEF")return ee.dbAttrs;const v=o==null?void 0:o.embeddableCatalog.value.find(C=>C.type===ee.type);if(!v)return ee.dbAttrs;const I=Ln(y.value.attributes.flatMap(C=>C.dbAttrs));return ee.dbAttrs.map((C,ie)=>{const be=v.fields[ie],Re=To(C,I);return Re?{...C,physicalName:Re.physicalName,logicalName:C.logicalName??(be==null?void 0:be.logicalName),dataType:C.dataType||(be==null?void 0:be.dataType)||""}:be?{...C,physicalName:C.physicalName||be.physicalName,logicalName:C.logicalName??be.logicalName,dataType:C.dataType||be.dataType,length:C.length??be.length}:C})}function ce(ee){var v;return z(ee.physicalName,(v=ee.logicalName)==null?void 0:v.ko,ee.physicalName)}function me(ee){const v=ja(ee,(o==null?void 0:o.state.logical.associations)??[]);return ll(x.value,ee,v)}const ge=n.computed(()=>{var ee,v,I;return z(y.value.name,(v=(ee=y.value.table)==null?void 0:ee.logicalName)==null?void 0:v.ko,((I=y.value.table)==null?void 0:I.physicalName)??"")}),se=n.ref(!1),fe=n.ref(""),ye=n.ref(null);async function Ne(){var ee,v;s.value&&(fe.value=y.value.name,se.value=!0,await n.nextTick(),(ee=ye.value)==null||ee.focus(),(v=ye.value)==null||v.select())}function ve(){if(!se.value)return;se.value=!1;const ee=fe.value.trim();ee&&ee!==y.value.name&&(o==null||o.renameEntity(t.id,ee))}function $e(){o==null||o.addAttribute(t.id)}function q(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:Y,findNode:D}=Ae(),M=n.ref(null),B=n.computed(()=>{const ee=M.value??t.data.size;return ee?{width:`${ee.width}px`,minHeight:`${ee.height}px`}:void 0});let F=null;function ne(ee){var C,ie,be;if(!s.value)return;ee.stopPropagation();const v=(C=D(t.id))==null?void 0:C.dimensions,I=Y({x:ee.clientX,y:ee.clientY});F={fx:I.x,fy:I.y,w:(v==null?void 0:v.width)??((ie=t.data.size)==null?void 0:ie.width)??200,h:(v==null?void 0:v.height)??((be=t.data.size)==null?void 0:be.height)??120},ee.target.setPointerCapture(ee.pointerId)}function X(ee){if(!F)return;const v=Y({x:ee.clientX,y:ee.clientY});M.value={width:Math.max(40,F.w+(v.x-F.fx)),height:Math.max(40,F.h+(v.y-F.fy))}}function E(ee){var v,I,C;if(F&&M.value&&o){const ie=(v=D(t.id))==null?void 0:v.dimensions;o.resizeEntity(t.id,{width:Math.round((ie==null?void 0:ie.width)??M.value.width),height:Math.round((ie==null?void 0:ie.height)??M.value.height)})}F=null,M.value=null,(C=(I=ee.target).releasePointerCapture)==null||C.call(I,ee.pointerId)}const $=n.ref(null),H=n.ref(null);function N(ee,v){if(!s.value)return;v.stopPropagation(),v.preventDefault();const I=g.value,C=I.has(ee.modelId)?new Set(I):new Set([ee.modelId]);H.value={ids:C,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId)}function O(ee){if(!H.value||!$.value)return;const v=Array.from($.value.querySelectorAll(".em-entity__row"));if(!v.length)return;let I=v.length;for(let be=0;be<v.length;be++){const Re=v[be].getBoundingClientRect();if(ee.clientY<Re.top+Re.height/2){I=be;break}}const C=v[v.length-1],ie=I<v.length?v[I].offsetTop:C.offsetTop+C.offsetHeight;H.value={...H.value,dropIndex:I,lineY:ie}}function V(){const ee=H.value;if(H.value=null,!ee||ee.dropIndex<0)return;const v=y.value.attributes,I=v.filter(xe=>ee.ids.has(xe.modelId)).map(xe=>xe.modelId),C=v.filter((xe,Ce)=>ee.ids.has(xe.modelId)&&Ce<ee.dropIndex).length,ie=ee.dropIndex-C,be=v.filter(xe=>!ee.ids.has(xe.modelId)).map(xe=>xe.modelId);[...be.slice(0,ie),...I,...be.slice(ie)].join(",")!==v.map(xe=>xe.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,I,ie))}function re(){H.value=null}const pe=n.ref(null),he=n.ref(null);function A(ee,v){s.value&&(v.stopPropagation(),v.preventDefault(),he.value={id:ee.modelId,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId))}function L(ee){if(!he.value||!pe.value)return;const v=Array.from(pe.value.querySelectorAll(".em-entity__op-row"));if(!v.length)return;let I=v.length;for(let be=0;be<v.length;be++){const Re=v[be].getBoundingClientRect();if(ee.clientY<Re.top+Re.height/2){I=be;break}}const C=v[v.length-1],ie=I<v.length?v[I].offsetTop:C.offsetTop+C.offsetHeight;he.value={...he.value,dropIndex:I,lineY:ie}}function Z(){const ee=he.value;if(he.value=null,!ee||ee.dropIndex<0)return;const I=P.value.findIndex(ie=>ie.modelId===ee.id);if(I<0)return;const C=ee.dropIndex-(I<ee.dropIndex?1:0);C!==I&&(o==null||o.reorderOperations(t.id,[ee.id],C))}function ue(){he.value=null}return(ee,v)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":S.value,"is-selected":m.value,"is-multi-selected":h.value,"has-focused-attr":w.value}]),style:n.normalizeStyle(B.value),onPointerdown:d,onMouseenter:c,onMouseleave:u,onDblclick:l},[m.value?(n.openBlock(),n.createElementBlock("div",V_,[...v[7]||(v[7]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("header",{class:"em-entity__header",style:n.normalizeStyle(te.value),onDblclick:n.withModifiers(Ne,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:J.value?"펼치기":"접기","aria-expanded":!J.value,disabled:!s.value,onClick:n.withModifiers(G,["stop"]),onPointerdown:v[0]||(v[0]=n.withModifiers(()=>{},["stop"])),onDblclick:v[1]||(v[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(J.value?"▸":"▾"),41,A_),n.createElementVNode("span",T_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),se.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ye,"onUpdate:modelValue":v[2]||(v[2]=I=>fe.value=I),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(ve,["enter"]),v[3]||(v[3]=n.withKeys(I=>se.value=!1,["esc"]))],onBlur:ve,onPointerdown:v[4]||(v[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,fe.value]]):(n.openBlock(),n.createElementBlock("span",B_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.value,(I,C)=>(n.openBlock(),n.createElementBlock("span",{key:C,class:n.normalizeClass({"em-entity__missing":I.missing})},n.toDisplayString(I.text),3))),128))]))],36),J.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$,class:"em-entity__attrs"},[H.value&&H.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${H.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,I=>{var C,ie,be,Re;return n.openBlock(),n.createElementBlock(n.Fragment,{key:I.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(I.modelId),"is-dragging":(C=H.value)==null?void 0:C.ids.has(I.modelId),"is-embed":K(I),"is-divider":T(I),nodrag:T(I)&&s.value}]),"data-attr":I.modelId,onClick:n.withModifiers(xe=>b(I,xe),["stop"]),onPointerdown:xe=>T(I)?N(I,xe):void 0,onPointermove:xe=>T(I)?O(xe):void 0,onPointerup:xe=>T(I)?V():void 0,onPointercancel:xe=>T(I)?re():void 0},[s.value&&!T(I)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:xe=>N(I,xe),onPointermove:O,onPointerup:V,onPointercancel:re,onClick:v[5]||(v[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,D_)):n.createCommentVNode("",!0),T(I)?(n.openBlock(),n.createElementBlock("span",O_,n.toDisplayString(I.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(nn),{id:`l:${I.modelId}`,type:"target",position:n.unref(ke).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:Q(U.value[I.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",P_,[(ie=U.value[I.modelId])!=null&&ie.pk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:12,class:"em-key is-pk"})):(be=U.value[I.modelId])!=null&&be.required?(n.openBlock(),n.createBlock(Ie,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",z_,[K(I)?(n.openBlock(),n.createBlock(Ie,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Re=U.value[I.modelId])!=null&&Re.fk?(n.openBlock(),n.createBlock(Ie,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,L_),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:de(I)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(W(I),(xe,Ce)=>(n.openBlock(),n.createElementBlock("span",{key:Ce,class:n.normalizeClass({"em-entity__missing":xe.missing})},n.toDisplayString(xe.text),3))),128))],4),me(I)?(n.openBlock(),n.createElementBlock("span",U_,n.toDisplayString(me(I)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(nn),{id:`r:${I.modelId}`,type:"source",position:n.unref(ke).Right,class:"em-handle"},null,8,["id","position"])],64))],42,M_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(K(I)&&j.value?oe(I):[],xe=>(n.openBlock(),n.createElementBlock("li",{key:`${I.modelId}:${xe.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(I.modelId)}]),onClick:n.withModifiers(Ce=>b(I,Ce),["stop"])},[v[8]||(v[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",F_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce(xe),(Ce,ze)=>(n.openBlock(),n.createElementBlock("span",{key:ze,class:n.normalizeClass({"em-entity__missing":Ce.missing})},n.toDisplayString(Ce.text),3))),128))]),n.createElementVNode("span",G_,n.toDisplayString(xe.dataType),1)],10,H_))),128))],64)}),128))],512)),!J.value&&le.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:pe,class:"em-entity__ops"},[he.value&&he.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${he.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value,I=>{var C;return n.openBlock(),n.createElementBlock("li",{key:I.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((C=he.value)==null?void 0:C.id)===I.modelId}]),"data-op":I.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ie=>A(I,ie),onPointermove:L,onPointerup:Z,onPointercancel:ue,onClick:v[6]||(v[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,W_)):n.createCommentVNode("",!0),n.createElementVNode("span",q_,n.toDisplayString(R(I.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:k(I)})},n.toDisplayString(I.name)+"()",5)],10,Y_)}),128))],512)):P.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${P.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ie,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(P.value.length)+"개",1)],8,K_)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",X_,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:$e},"+ 속성"),v[9]||(v[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:q},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!se.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ne,onPointermove:X,onPointerup:E},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3eac9bf0"]]),j_={key:0,class:"em-sel","aria-hidden":"true"},Z_={class:"em-group__label"},J_={class:"em-group__name"},Q_={key:0,class:"em-group__pkg"},ew={key:1,class:"em-group__flag"},md=Be(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>Xe(t.data.style)),l=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),a=n.inject(rn,null),r=n.computed(()=>!!a&&a.editable.value),s=n.computed(()=>{var U;return!!t.id&&((U=a==null?void 0:a.selection.value)==null?void 0:U.kind)==="group"&&a.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!s.value),c=n.inject(Ii,null),u=n.computed(()=>!!t.id&&(c==null?void 0:c.value)===t.id),f=n.inject(Vn,null);function p(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const h=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),g=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:w,findNode:b}=Ae();let S=null,y=null;function x(U){var de;if(!t.id||!r.value)return;U.stopPropagation();const Q=((de=b(t.id))==null?void 0:de.dimensions)??{width:400,height:300},te=w({x:U.clientX,y:U.clientY});S={fx:te.x,fy:te.y,w:Q.width,h:Q.height},U.target.setPointerCapture(U.pointerId)}function J(U){if(!S||!t.id)return;const Q=w({x:U.clientX,y:U.clientY});y={width:Math.max(160,S.w+(Q.x-S.fx)),height:Math.max(120,S.h+(Q.y-S.fy))};const te=b(t.id);te&&(te.style={width:`${y.width}px`,height:`${y.height}px`})}function G(U){var Q,te;S&&y&&t.id&&a&&a.resizeGroup(t.id,y),S=null,y=null,(te=(Q=U.target).releasePointerCapture)==null||te.call(Q,U.pointerId)}const j=n.computed(()=>{const U=o.value.name;return(U==null?void 0:U.ko)||(U==null?void 0:U.en)||(U==null?void 0:U.ja)||(U==null?void 0:U.zh)||o.value.packageName||"그룹"});return(U,Q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":h.value,"is-dimmed":g.value,"is-selected":s.value,"is-multi-selected":d.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",j_,[...Q[0]||(Q[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Z_,[n.createElementVNode("span",J_,n.toDisplayString(j.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Q_,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",ew,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:x,onPointermove:J,onPointerup:G},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),tw={key:0,class:"em-sel","aria-hidden":"true"},nw={key:2,class:"em-note__text"},pd=Be(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(rn,null),i=n.inject(Ii,null),l=n.inject(Vn,null),a=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>Xe(a.value.style)),d=n.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 c(){i&&(i.value=t.data.groupRef??null)}function u(){l==null||l.setNoteHover(t.id)}function f(){l==null||l.setNoteHover(null)}const p=n.computed(()=>{var _;return((_=l==null?void 0:l.source.value)==null?void 0:_.kind)==="note"&&l.source.value.id===t.id}),m=n.computed(()=>!!l&&l.relatedNoteIds.value.has(t.id)&&!p.value),h=n.computed(()=>{var _;return((_=o==null?void 0:o.selection.value)==null?void 0:_.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!h.value),w=n.computed(()=>!!l&&l.active.value&&!l.relatedNoteIds.value.has(t.id)&&!h.value),b=[{id:"n-top",pos:ke.Top},{id:"n-right",pos:ke.Right},{id:"n-bottom",pos:ke.Bottom},{id:"n-left",pos:ke.Left}],S=n.ref(!1),y=n.ref(""),x=n.ref(null);async function J(){var _;r.value&&(y.value=a.value.memo,S.value=!0,await n.nextTick(),(_=x.value)==null||_.focus())}function G(){S.value&&(S.value=!1,y.value!==a.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:j,findNode:U}=Ae();let Q=null,te=null;function de(_){var z;if(!r.value)return;_.stopPropagation();const R=((z=U(t.id))==null?void 0:z.dimensions)??a.value.geo.size,k=j({x:_.clientX,y:_.clientY});Q={fx:k.x,fy:k.y,w:R.width,h:R.height},_.target.setPointerCapture(_.pointerId)}function P(_){if(!Q)return;const R=j({x:_.clientX,y:_.clientY});te={width:Math.max(140,Q.w+(R.x-Q.fx)),height:Math.max(60,Q.h+(R.y-Q.fy))};const k=U(t.id);k&&(k.style={width:`${te.width}px`,height:`${te.height}px`})}function le(_){var R,k;Q&&te&&o&&o.resizeNote(t.id,te),Q=null,te=null,(k=(R=_.target).releasePointerCapture)==null||k.call(R,_.pointerId)}return(_,R)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":m.value,"is-dimmed":w.value,"is-selected":h.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(d.value),onDblclick:J,onPointerdown:c,onMouseenter:u,onMouseleave:f},[h.value?(n.openBlock(),n.createElementBlock("div",tw,[...R[4]||(R[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),S.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:x,"onUpdate:modelValue":R[0]||(R[0]=k=>y.value=k),class:"em-note__edit nodrag",onBlur:G,onKeydown:R[1]||(R[1]=n.withKeys(k=>S.value=!1,["esc"])),onPointerdown:R[2]||(R[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",nw,n.toDisplayString(a.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(b,k=>n.createVNode(n.unref(nn),{id:k.id,key:k.id,type:"source",position:k.pos,class:"em-note-handle",onPointerdown:R[3]||(R[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!S.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:de,onPointermove:P,onPointerup:le},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),ow=20,iw=22,lw=7,aw=22,hd=31,yd=7,rw=20,gd=11,bd=11,sw=hd+yd;function cw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function dw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ci(e,t,o){const i=t.x-e.x,l=t.y-e.y,a=Math.hypot(i,l)||1;return{x:e.x+i*o/a,y:e.y+l*o/a}}function _d(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Ri(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function wd(e,t,o,i){const l=i/2,a=e.x===t.x&&e.y===t.y?Math.PI/2:_d(e,t);return[Ri(o,l,a-Math.PI/2),Ri(o,l,a+Math.PI/2)]}function vd(e,t,o,i){const l=t*180/Math.PI,r=(l>=0?i?l-20:l+20:i?l+20:l-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function Ed(e,t,o,i){const l=[],a=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:l,circles:a,polygons:r};if(i==="db"){const d=Ci(e,t,ow),[c,u]=wd(e,t,d,iw);if(l.push({x1:c.x,y1:c.y,x2:u.x,y2:u.y}),l.push({x1:d.x,y1:d.y,x2:e.x,y2:e.y}),cw(o.multiplicity)){const f=Ci(e,t,hd);a.push({cx:f.x,cy:f.y,r:yd})}if(dw(o.multiplicity)){const f=Ci(e,t,lw),[p,m]=wd(e,t,f,aw);l.push({x1:d.x,y1:d.y,x2:p.x,y2:p.y}),l.push({x1:d.x,y1:d.y,x2:m.x,y2:m.y}),l.push({x1:d.x,y1:d.y,x2:f.x,y2:f.y})}return{lines:l,circles:a,polygons:r}}let s=e;if(o.composition){const d=Ci(e,t,rw),c={x:(e.x+d.x)/2,y:(e.y+d.y)/2},u=_d(e,t),f=Ri(c,gd/2,u-Math.PI/2),p=Ri(c,gd/2,u+Math.PI/2);r.push({points:[e,f,d,p]}),s=d}if(o.navigable&&!o.otherNavigable){const d=Math.atan2(t.x-e.x,t.y-e.y),c=vd(s,d,bd,!0),u=vd(s,d,bd,!1);l.push({x1:s.x,y1:s.y,x2:c.x,y2:c.y}),l.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:l,circles:a,polygons:r}}const kd=200,Nd=120,da=24;function $d(e){var l,a;if(!e)return{x:0,y:0,width:kd,height:Nd};const t=e.computedPosition??e.position??{x:0,y:0},o=((l=e.dimensions)==null?void 0:l.width)||kd,i=((a=e.dimensions)==null?void 0:a.height)||Nd;return{x:t.x,y:t.y,width:o,height:i}}function xd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Sd(e){const t=n.computed(()=>$d(e.sourceNode())),o=n.computed(()=>$d(e.targetNode())),i=n.computed(()=>{const c=e.sourceNode(),u=e.targetNode();return!!c&&!!u&&c.id===u.id}),l=n.computed(()=>{var m,h;const c=t.value,u=c.x+c.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??c.y+c.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??c.y+c.height*2/3;if(Math.abs(p-f)<da){const g=(f+p)/2;f=g-da/2,p=g+da/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),a=n.computed(()=>e.waypoints()[0]??xd(o.value)),r=n.computed(()=>{const c=e.waypoints();return c[c.length-1]??xd(t.value)}),s=n.computed(()=>{var u;const c=(u=e.sourceRowY)==null?void 0:u.call(e);return c!=null?tl(t.value,c,a.value.x):el(t.value,a.value)}),d=n.computed(()=>{var u;const c=(u=e.targetRowY)==null?void 0:u.call(e);return c!=null?tl(o.value,c,r.value.x):el(o.value,r.value)});return{source:n.computed(()=>i.value?l.value.source:s.value.point),target:n.computed(()=>i.value?l.value.target:d.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":d.value.side),isSelf:i}}const ua=Symbol("waypointController"),uw=["d"],fw=["d"],mw=["d"],pw=["x1","y1","x2","y2"],hw=["cx","cy","r"],yw=["x","y"],gw=["x","y"],bw=["cx","cy","onDblclick"],_w=["x","y","onPointerdown","onDblclick"],Id=Be(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ae(),i=n.inject(ua),l=n.inject(rn,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(ud,null),s=n.inject(Vn,null),d=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),c=n.computed(()=>{var q;return((q=l==null?void 0:l.selection.value)==null?void 0:q.kind)==="association"&&l.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!c.value),f=n.computed(()=>{const q=r==null?void 0:r.value;if(!q||!l)return null;const Y=l.resolved.value.entities,D=B=>{var F;return(F=Y.find(ne=>ne.entity.modelId===B))==null?void 0:F.groupRef},M=t.data.association;return D(M.end1.entityRef)===q.groupId&&D(M.end2.entityRef)===q.groupId?{dx:q.dx,dy:q.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),h=n.ref({x:0,y:0}),g=n.computed(()=>{const q=f.value;return p.value.map((Y,D)=>D===m.value?h.value:q?{x:Y.x+q.dx,y:Y.y+q.dy}:Y)}),w=n.computed(()=>{var q;return!!((q=t.sourceNode.data)!=null&&q.collapsed)}),b=n.computed(()=>{var q;return!!((q=t.targetNode.data)!=null&&q.collapsed)}),{source:S,target:y,sourceSide:x,targetSide:J,isSelf:G}=Sd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!w.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),j=sw+4,U=n.computed(()=>G.value?La(S.value,y.value):(l==null?void 0:l.routingMode.value)==="orthogonal"?Zi(S.value,x.value,g.value,y.value,J.value,j):Qi(S.value,g.value,y.value)),Q=n.computed(()=>G.value||!a.value?[]:(l==null?void 0:l.routingMode.value)==="orthogonal"?Ji(S.value,x.value,g.value,y.value,J.value,j):nl(S.value,g.value,y.value).map((q,Y)=>({point:q,segIndex:Y}))),te=n.computed(()=>G.value||!a.value?[]:g.value);function de(q){switch(q){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 P(q,Y){m.value=q,h.value={...p.value[q]},Y.target.setPointerCapture(Y.pointerId),Y.stopPropagation()}function le(q){if(m.value<0)return;const Y=o({x:q.clientX,y:q.clientY});h.value={x:Y.x,y:Y.y}}function _(q){var Y,D;m.value>=0&&i&&i.movePoint(t.id,m.value,{...h.value}),m.value=-1,(D=(Y=q.target).releasePointerCapture)==null||D.call(Y,q.pointerId)}function R(q,Y){Y.stopPropagation(),i==null||i.removePoint(t.id,q)}function k(q,Y){if(!i)return;const D=o({x:Y.clientX,y:Y.clientY});i.insertPoint(t.id,q,{x:D.x,y:D.y})}const z=n.computed(()=>de(t.data.association.end1.multiplicity)),W=n.computed(()=>de(t.data.association.end2.multiplicity)),K=n.computed(()=>(l==null?void 0:l.displayMode.value)==="CLASS"?"class":"db"),T=n.computed(()=>K.value==="class"),oe=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const q=Dn(x.value);return{x:S.value.x+q.x*10,y:S.value.y+q.y*10}}return g.value[0]??y.value}),ce=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const Y=Dn(J.value);return{x:y.value.x+Y.x*10,y:y.value.y+Y.y*10}}const q=g.value;return q[q.length-1]??S.value}),me=n.computed(()=>{const q=t.data.association;return{multiplicity:q.end1.multiplicity,navigable:q.end1.navigable,composition:q.end1.composition,otherNavigable:q.end2.navigable}}),ge=n.computed(()=>{const q=t.data.association;return{multiplicity:q.end2.multiplicity,navigable:q.end2.navigable,composition:q.end2.composition,otherNavigable:q.end1.navigable}}),se=n.computed(()=>Ed(S.value,oe.value,me.value,K.value)),fe=n.computed(()=>Ed(y.value,ce.value,ge.value,K.value)),ye=n.computed(()=>[...se.value.lines,...fe.value.lines]),Ne=n.computed(()=>[...se.value.circles,...fe.value.circles]),ve=n.computed(()=>[...se.value.polygons,...fe.value.polygons].map(q=>`M${q.points.map(Y=>`${Y.x},${Y.y}`).join(" L")} Z`)),$e=n.computed(()=>({"is-highlighted":d.value,"is-dimmed":u.value,"is-selected":c.value}));return(q,Y)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:U.value,fill:"none",class:"em-edge__hit"},null,8,uw),n.createElementVNode("path",{d:U.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":d.value,"is-dimmed":u.value,"is-selected":c.value}])},null,10,fw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(D,M)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${M}`,d:D,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",$e.value])},null,10,mw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.value,(D,M)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${M}`,x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,class:n.normalizeClass(["em-edge__marker",$e.value])},null,10,pw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ne.value,(D,M)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${M}`,cx:D.cx,cy:D.cy,r:D.r,class:n.normalizeClass(["em-edge__marker",$e.value])},null,10,hw))),128)),T.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(S).x+8,y:n.unref(S).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(z.value),11,yw),n.createElementVNode("text",{x:n.unref(y).x-8,y:n.unref(y).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,gw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Q.value,(D,M)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${M}`,cx:D.point.x,cy:D.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(B=>k(D.segIndex,B),["stop"])},null,42,bw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te.value,(D,M)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${M}`,x:D.x-5,y:D.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:B=>P(M,B),onPointermove:le,onPointerup:_,onDblclick:B=>R(M,B)},null,42,_w))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var St=(e=>(e.Lines="lines",e.Dots="dots",e))(St||{});const Cd=function({dimensions:e,size:t,color:o}){return n.h("path",{stroke:o,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Rd=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};St.Lines+"",St.Dots+"";const ww={[St.Dots]:"#81818a",[St.Lines]:"#eee"},vw=["id","x","y","width","height","patternTransform"],Ew={key:2,height:"100",width:"100"},kw=["fill"],Nw=["x","y","fill"],$w={name:"Background",compatConfig:{MODE:3}},xw=n.defineComponent({...$w,props:{id:{},variant:{default:()=>St.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:t,viewport:o}=Ae(),i=n.computed(()=>{const r=o.value.zoom,[s,d]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],c=[s*r||1,d*r||1],u=e.size*r,[f,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+c[0]/2,p*r||1+c[1]/2];return{scaledGap:c,offset:m,size:u}}),l=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),a=n.toRef(()=>e.color||e.patternColor||ww[e.variant||St.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:l.value},()=>[n.createElementVNode("pattern",{id:l.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.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"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(St).Lines?(n.openBlock(),n.createBlock(n.unref(Cd),{key:0,size:r.lineWidth,color:a.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(St).Dots?(n.openBlock(),n.createBlock(n.unref(Rd),{key:1,color:a.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Ew,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,kw)])):n.createCommentVNode("",!0)])],8,vw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${l.value})`},null,8,Nw),n.renderSlot(r.$slots,"default",{id:l.value})],4))}}),Sw={name:"ControlButton",compatConfig:{MODE:3}},Iw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},Cw={type:"button",class:"vue-flow__controls-button"};function Rw(e,t,o,i,l,a){return n.openBlock(),n.createElementBlock("button",Cw,[n.renderSlot(e.$slots,"default")])}const Vi=Iw(Sw,[["render",Rw]]),Vw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Aw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Tw(e,t){return n.openBlock(),n.createElementBlock("svg",Vw,Aw)}const Bw={render:Tw},Mw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Dw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Ow(e,t){return n.openBlock(),n.createElementBlock("svg",Mw,Dw)}const Lw={render:Ow},Pw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},zw=[n.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 Uw(e,t){return n.openBlock(),n.createElementBlock("svg",Pw,zw)}const Hw={render:Uw},Fw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Gw=[n.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 Yw(e,t){return n.openBlock(),n.createElementBlock("svg",Fw,Gw)}const Ww={render:Yw},qw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Kw=[n.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 Xw(e,t){return n.openBlock(),n.createElementBlock("svg",qw,Kw)}const jw={render:Xw},Zw={name:"Controls",compatConfig:{MODE:3}},Jw=n.defineComponent({...Zw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>nc.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:l,setInteractive:a,zoomIn:r,zoomOut:s,fitView:d,viewport:c,minZoom:u,maxZoom:f}=Ae(),p=n.toRef(()=>o.value||i.value||l.value),m=n.toRef(()=>c.value.zoom<=u.value),h=n.toRef(()=>c.value.zoom>=f.value);function g(){r(),t("zoomIn")}function w(){s(),t("zoomOut")}function b(){d(e.fitViewParams),t("fitView")}function S(){a(!p.value),t("interactionChange",!p.value)}return(y,x)=>(n.openBlock(),n.createBlock(n.unref(ed),{class:"vue-flow__controls",position:y.position},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"top"),y.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(y.$slots,"control-zoom-in",{},()=>[n.createVNode(Vi,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Bw))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(Vi,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:w},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Lw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Vi,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Hw))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(Vi,{key:0,class:"vue-flow__controls-interactive",onClick:S},{default:n.withCtx(()=>[p.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(jw))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Ww))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var Qw={value:()=>{}};function fa(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Ai(o)}function Ai(e){this._=e}function ev(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Ai.prototype=fa.prototype={constructor:Ai,on:function(e,t){var o=this._,i=ev(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=tv(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=Vd(o[l],e.name,t);else if(t==null)for(l in o)o[l]=Vd(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Ai(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function tv(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function Vd(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=Qw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var ma="http://www.w3.org/1999/xhtml";const Ad={svg:"http://www.w3.org/2000/svg",xhtml:ma,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ti(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ad.hasOwnProperty(t)?{space:Ad[t],local:e}:e}function nv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===ma&&t.documentElement.namespaceURI===ma?t.createElement(e):t.createElementNS(o,e)}}function ov(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Td(e){var t=Ti(e);return(t.local?ov:nv)(t)}function iv(){}function pa(e){return e==null?iv:function(){return this.querySelector(e)}}function lv(e){typeof e!="function"&&(e=pa(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),d,c,u=0;u<r;++u)(d=a[u])&&(c=e.call(d,d.__data__,u,a))&&("__data__"in d&&(c.__data__=d.__data__),s[u]=c);return new nt(i,this._parents)}function av(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function rv(){return[]}function Bd(e){return e==null?rv:function(){return this.querySelectorAll(e)}}function sv(e){return function(){return av(e.apply(this,arguments))}}function cv(e){typeof e=="function"?e=sv(e):e=Bd(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,d,c=0;c<s;++c)(d=r[c])&&(i.push(e.call(d,d.__data__,c,r)),l.push(d));return new nt(i,l)}function Md(e){return function(){return this.matches(e)}}function Dd(e){return function(t){return t.matches(e)}}var dv=Array.prototype.find;function uv(e){return function(){return dv.call(this.children,e)}}function fv(){return this.firstElementChild}function mv(e){return this.select(e==null?fv:uv(typeof e=="function"?e:Dd(e)))}var pv=Array.prototype.filter;function hv(){return Array.from(this.children)}function yv(e){return function(){return pv.call(this.children,e)}}function gv(e){return this.selectAll(e==null?hv:yv(typeof e=="function"?e:Dd(e)))}function bv(e){typeof e!="function"&&(e=Md(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],d,c=0;c<r;++c)(d=a[c])&&e.call(d,d.__data__,c,a)&&s.push(d);return new nt(i,this._parents)}function Od(e){return new Array(e.length)}function _v(){return new nt(this._enter||this._groups.map(Od),this._parents)}function Bi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bi.prototype={constructor:Bi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function wv(e){return function(){return e}}function vv(e,t,o,i,l,a){for(var r=0,s,d=t.length,c=a.length;r<c;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new Bi(e,a[r]);for(;r<d;++r)(s=t[r])&&(l[r]=s)}function Ev(e,t,o,i,l,a,r){var s,d,c=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(d=t[s])&&(p[s]=m=r.call(d,d.__data__,s,t)+"",c.has(m)?l[s]=d:c.set(m,d));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(d=c.get(m))?(i[s]=d,d.__data__=a[s],c.delete(m)):o[s]=new Bi(e,a[s]);for(s=0;s<u;++s)(d=t[s])&&c.get(p[s])===d&&(l[s]=d)}function kv(e){return e.__data__}function Nv(e,t){if(!arguments.length)return Array.from(this,kv);var o=t?Ev:vv,i=this._parents,l=this._groups;typeof e!="function"&&(e=wv(e));for(var a=l.length,r=new Array(a),s=new Array(a),d=new Array(a),c=0;c<a;++c){var u=i[c],f=l[c],p=f.length,m=$v(e.call(u,u&&u.__data__,c,i)),h=m.length,g=s[c]=new Array(h),w=r[c]=new Array(h),b=d[c]=new Array(p);o(u,f,g,w,b,m,t);for(var S=0,y=0,x,J;S<h;++S)if(x=g[S]){for(S>=y&&(y=S+1);!(J=w[y])&&++y<h;);x._next=J||null}}return r=new nt(r,i),r._enter=s,r._exit=d,r}function $v(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function xv(){return new nt(this._exit||this._groups.map(Od),this._parents)}function Sv(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function Iv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),d=0;d<r;++d)for(var c=o[d],u=i[d],f=c.length,p=s[d]=new Array(f),m,h=0;h<f;++h)(m=c[h]||u[h])&&(p[h]=m);for(;d<l;++d)s[d]=o[d];return new nt(s,this._parents)}function Cv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function Rv(e){e||(e=Vv);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,d=l[a]=new Array(s),c,u=0;u<s;++u)(c=r[u])&&(d[u]=c);d.sort(t)}return new nt(l,this._parents).order()}function Vv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Av(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tv(){return Array.from(this)}function Bv(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function Mv(){let e=0;for(const t of this)++e;return e}function Dv(){return!this.node()}function Ov(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function Lv(e){return function(){this.removeAttribute(e)}}function Pv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zv(e,t){return function(){this.setAttribute(e,t)}}function Uv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Hv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Fv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Gv(e,t){var o=Ti(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Pv:Lv:typeof t=="function"?o.local?Fv:Hv:o.local?Uv:zv)(o,t))}function Ld(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Yv(e){return function(){this.style.removeProperty(e)}}function Wv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function qv(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Kv(e,t,o){return arguments.length>1?this.each((t==null?Yv:typeof t=="function"?qv:Wv)(e,t,o??"")):An(this.node(),e)}function An(e,t){return e.style.getPropertyValue(t)||Ld(e).getComputedStyle(e,null).getPropertyValue(t)}function Xv(e){return function(){delete this[e]}}function jv(e,t){return function(){this[e]=t}}function Zv(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Jv(e,t){return arguments.length>1?this.each((t==null?Xv:typeof t=="function"?Zv:jv)(e,t)):this.node()[e]}function Pd(e){return e.trim().split(/^|\s+/)}function ha(e){return e.classList||new zd(e)}function zd(e){this._node=e,this._names=Pd(e.getAttribute("class")||"")}zd.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ud(e,t){for(var o=ha(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function Hd(e,t){for(var o=ha(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function Qv(e){return function(){Ud(this,e)}}function eE(e){return function(){Hd(this,e)}}function tE(e,t){return function(){(t.apply(this,arguments)?Ud:Hd)(this,e)}}function nE(e,t){var o=Pd(e+"");if(arguments.length<2){for(var i=ha(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?tE:t?Qv:eE)(o,t))}function oE(){this.textContent=""}function iE(e){return function(){this.textContent=e}}function lE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function aE(e){return arguments.length?this.each(e==null?oE:(typeof e=="function"?lE:iE)(e)):this.node().textContent}function rE(){this.innerHTML=""}function sE(e){return function(){this.innerHTML=e}}function cE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function dE(e){return arguments.length?this.each(e==null?rE:(typeof e=="function"?cE:sE)(e)):this.node().innerHTML}function uE(){this.nextSibling&&this.parentNode.appendChild(this)}function fE(){return this.each(uE)}function mE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pE(){return this.each(mE)}function hE(e){var t=typeof e=="function"?e:Td(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yE(){return null}function gE(e,t){var o=typeof e=="function"?e:Td(e),i=t==null?yE:typeof t=="function"?t:pa(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function bE(){var e=this.parentNode;e&&e.removeChild(this)}function _E(){return this.each(bE)}function wE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function EE(e){return this.select(e?vE:wE)}function kE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function NE(e){return function(t){e.call(this,t,this.__data__)}}function $E(e){return e.trim().split(/^|\s+/).map(function(t){var o="",i=t.indexOf(".");return i>=0&&(o=t.slice(i+1),t=t.slice(0,i)),{type:t,name:o}})}function xE(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function SE(e,t,o){return function(){var i=this.__on,l,a=NE(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function IE(e,t,o){var i=$E(e+""),l,a=i.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var d=0,c=s.length,u;d<c;++d)for(l=0,u=s[d];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?SE:xE,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function Fd(e,t,o){var i=Ld(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function CE(e,t){return function(){return Fd(this,e,t)}}function RE(e,t){return function(){return Fd(this,e,t.apply(this,arguments))}}function VE(e,t){return this.each((typeof t=="function"?RE:CE)(e,t))}function*AE(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var Gd=[null];function nt(e,t){this._groups=e,this._parents=t}function uo(){return new nt([[document.documentElement]],Gd)}function TE(){return this}nt.prototype=uo.prototype={constructor:nt,select:lv,selectAll:cv,selectChild:mv,selectChildren:gv,filter:bv,data:Nv,enter:_v,exit:xv,join:Sv,merge:Iv,selection:TE,order:Cv,sort:Rv,call:Av,nodes:Tv,node:Bv,size:Mv,empty:Dv,each:Ov,attr:Gv,style:Kv,property:Jv,classed:nE,text:aE,html:dE,raise:fE,lower:pE,append:hE,insert:gE,remove:_E,clone:EE,datum:kE,on:IE,dispatch:VE,[Symbol.iterator]:AE};function Pt(e){return typeof e=="string"?new nt([[document.querySelector(e)]],[document.documentElement]):new nt([[e]],Gd)}function BE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function zt(e,t){if(e=BE(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const ya={capture:!0,passive:!1};function ga(e){e.preventDefault(),e.stopImmediatePropagation()}function ME(e){var t=e.document.documentElement,o=Pt(e).on("dragstart.drag",ga,ya);"onselectstart"in t?o.on("selectstart.drag",ga,ya):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function DE(e,t){var o=e.document.documentElement,i=Pt(e).on("dragstart.drag",null);t&&(i.on("click.drag",ga,ya),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 ba(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Yd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function fo(){}var mo=.7,Mi=1/mo,Tn="\\s*([+-]?\\d+)\\s*",po="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",OE=/^#([0-9a-f]{3,8})$/,LE=new RegExp(`^rgb\\(${Tn},${Tn},${Tn}\\)$`),PE=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),zE=new RegExp(`^rgba\\(${Tn},${Tn},${Tn},${po}\\)$`),UE=new RegExp(`^rgba\\(${gt},${gt},${gt},${po}\\)$`),HE=new RegExp(`^hsl\\(${po},${gt},${gt}\\)$`),FE=new RegExp(`^hsla\\(${po},${gt},${gt},${po}\\)$`),Wd={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};ba(fo,ho,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qd,formatHex:qd,formatHex8:GE,formatHsl:YE,formatRgb:Kd,toString:Kd});function qd(){return this.rgb().formatHex()}function GE(){return this.rgb().formatHex8()}function YE(){return Qd(this).formatHsl()}function Kd(){return this.rgb().formatRgb()}function ho(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=OE.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Xd(t):o===3?new Qe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Di(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Di(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=LE.exec(e))?new Qe(t[1],t[2],t[3],1):(t=PE.exec(e))?new Qe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=zE.exec(e))?Di(t[1],t[2],t[3],t[4]):(t=UE.exec(e))?Di(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=HE.exec(e))?Jd(t[1],t[2]/100,t[3]/100,1):(t=FE.exec(e))?Jd(t[1],t[2]/100,t[3]/100,t[4]):Wd.hasOwnProperty(e)?Xd(Wd[e]):e==="transparent"?new Qe(NaN,NaN,NaN,0):null}function Xd(e){return new Qe(e>>16&255,e>>8&255,e&255,1)}function Di(e,t,o,i){return i<=0&&(e=t=o=NaN),new Qe(e,t,o,i)}function WE(e){return e instanceof fo||(e=ho(e)),e?(e=e.rgb(),new Qe(e.r,e.g,e.b,e.opacity)):new Qe}function _a(e,t,o,i){return arguments.length===1?WE(e):new Qe(e,t,o,i??1)}function Qe(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}ba(Qe,_a,Yd(fo,{brighter(e){return e=e==null?Mi:Math.pow(Mi,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?mo:Math.pow(mo,e),new Qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qe(sn(this.r),sn(this.g),sn(this.b),Oi(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:jd,formatHex:jd,formatHex8:qE,formatRgb:Zd,toString:Zd}));function jd(){return`#${cn(this.r)}${cn(this.g)}${cn(this.b)}`}function qE(){return`#${cn(this.r)}${cn(this.g)}${cn(this.b)}${cn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zd(){const e=Oi(this.opacity);return`${e===1?"rgb(":"rgba("}${sn(this.r)}, ${sn(this.g)}, ${sn(this.b)}${e===1?")":`, ${e})`}`}function Oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function cn(e){return e=sn(e),(e<16?"0":"")+e.toString(16)}function Jd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new st(e,t,o,i)}function Qd(e){if(e instanceof st)return new st(e.h,e.s,e.l,e.opacity);if(e instanceof fo||(e=ho(e)),!e)return new st;if(e instanceof st)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,d=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=d<.5?a+l:2-a-l,r*=60):s=d>0&&d<1?0:r,new st(r,s,d,e.opacity)}function KE(e,t,o,i){return arguments.length===1?Qd(e):new st(e,t,o,i??1)}function st(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}ba(st,KE,Yd(fo,{brighter(e){return e=e==null?Mi:Math.pow(Mi,e),new st(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?mo:Math.pow(mo,e),new st(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new Qe(wa(e>=240?e-240:e+120,l,i),wa(e,l,i),wa(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new st(eu(this.h),Li(this.s),Li(this.l),Oi(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=Oi(this.opacity);return`${e===1?"hsl(":"hsla("}${eu(this.h)}, ${Li(this.s)*100}%, ${Li(this.l)*100}%${e===1?")":`, ${e})`}`}}));function eu(e){return e=(e||0)%360,e<0?e+360:e}function Li(e){return Math.max(0,Math.min(1,e||0))}function wa(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}const tu=e=>()=>e;function XE(e,t){return function(o){return e+o*t}}function jE(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(i){return Math.pow(e+i*t,o)}}function ZE(e){return(e=+e)==1?nu:function(t,o){return o-t?jE(t,o,e):tu(isNaN(t)?o:t)}}function nu(e,t){var o=t-e;return o?XE(e,o):tu(isNaN(e)?t:e)}const ou=(function e(t){var o=ZE(t);function i(l,a){var r=o((l=_a(l)).r,(a=_a(a)).r),s=o(l.g,a.g),d=o(l.b,a.b),c=nu(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=d(u),l.opacity=c(u),l+""}}return i.gamma=e,i})(1);function Ut(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var va=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ea=new RegExp(va.source,"g");function JE(e){return function(){return e}}function QE(e){return function(t){return e(t)+""}}function ek(e,t){var o=va.lastIndex=Ea.lastIndex=0,i,l,a,r=-1,s=[],d=[];for(e=e+"",t=t+"";(i=va.exec(e))&&(l=Ea.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,d.push({i:r,x:Ut(i,l)})),o=Ea.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?d[0]?QE(d[0].x):JE(t):(t=d.length,function(c){for(var u=0,f;u<t;++u)s[(f=d[u]).i]=f.x(c);return s.join("")})}var iu=180/Math.PI,ka={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lu(e,t,o,i,l,a){var r,s,d;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(d=e*o+t*i)&&(o-=e*d,i-=t*d),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,d/=s),e*i<t*o&&(e=-e,t=-t,d=-d,r=-r),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*iu,skewX:Math.atan(d)*iu,scaleX:r,scaleY:s}}var Pi;function tk(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ka:lu(t.a,t.b,t.c,t.d,t.e,t.f)}function nk(e){return e==null||(Pi||(Pi=document.createElementNS("http://www.w3.org/2000/svg","g")),Pi.setAttribute("transform",e),!(e=Pi.transform.baseVal.consolidate()))?ka:(e=e.matrix,lu(e.a,e.b,e.c,e.d,e.e,e.f))}function au(e,t,o,i){function l(c){return c.length?c.pop()+" ":""}function a(c,u,f,p,m,h){if(c!==f||u!==p){var g=m.push("translate(",null,t,null,o);h.push({i:g-4,x:Ut(c,f)},{i:g-2,x:Ut(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(c,u,f,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:Ut(c,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(c,u,f,p){c!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:Ut(c,u)}):u&&f.push(l(f)+"skewX("+u+i)}function d(c,u,f,p,m,h){if(c!==f||u!==p){var g=m.push(l(m)+"scale(",null,",",null,")");h.push({i:g-4,x:Ut(c,f)},{i:g-2,x:Ut(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(c,u){var f=[],p=[];return c=e(c),u=e(u),a(c.translateX,c.translateY,u.translateX,u.translateY,f,p),r(c.rotate,u.rotate,f,p),s(c.skewX,u.skewX,f,p),d(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,p),c=u=null,function(m){for(var h=-1,g=p.length,w;++h<g;)f[(w=p[h]).i]=w.x(m);return f.join("")}}}var ok=au(tk,"px, ","px)","deg)"),ik=au(nk,", ",")",")"),lk=1e-12;function ru(e){return((e=Math.exp(e))+1/e)/2}function ak(e){return((e=Math.exp(e))-1/e)/2}function rk(e){return((e=Math.exp(2*e))-1)/(e+1)}const sk=(function e(t,o,i){function l(a,r){var s=a[0],d=a[1],c=a[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-d,g=m*m+h*h,w,b;if(g<lk)b=Math.log(p/c)/t,w=function(j){return[s+j*m,d+j*h,c*Math.exp(t*j*b)]};else{var S=Math.sqrt(g),y=(p*p-c*c+i*g)/(2*c*o*S),x=(p*p-c*c-i*g)/(2*p*o*S),J=Math.log(Math.sqrt(y*y+1)-y),G=Math.log(Math.sqrt(x*x+1)-x);b=(G-J)/t,w=function(j){var U=j*b,Q=ru(J),te=c/(o*S)*(Q*rk(t*U+J)-ak(J));return[s+te*m,d+te*h,c*Q/ru(t*U+J)]}}return w.duration=b*1e3*t/Math.SQRT2,w}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,d=s*s;return e(r,s,d)},l})(Math.SQRT2,2,4);var Bn=0,yo=0,go=0,su=1e3,zi,bo,Ui=0,dn=0,Hi=0,_o=typeof performance=="object"&&performance.now?performance:Date,cu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Na(){return dn||(cu(ck),dn=_o.now()+Hi)}function ck(){dn=0}function Fi(){this._call=this._time=this._next=null}Fi.prototype=du.prototype={constructor:Fi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Na():+o)+(t==null?0:+t),!this._next&&bo!==this&&(bo?bo._next=this:zi=this,bo=this),this._call=e,this._time=o,$a()},stop:function(){this._call&&(this._call=null,this._time=1/0,$a())}};function du(e,t,o){var i=new Fi;return i.restart(e,t,o),i}function dk(){Na(),++Bn;for(var e=zi,t;e;)(t=dn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bn}function uu(){dn=(Ui=_o.now())+Hi,Bn=yo=0;try{dk()}finally{Bn=0,fk(),dn=0}}function uk(){var e=_o.now(),t=e-Ui;t>su&&(Hi-=t,Ui=e)}function fk(){for(var e,t=zi,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:zi=o);bo=e,$a(i)}function $a(e){if(!Bn){yo&&(yo=clearTimeout(yo));var t=e-dn;t>24?(e<1/0&&(yo=setTimeout(uu,e-_o.now()-Hi)),go&&(go=clearInterval(go))):(go||(Ui=_o.now(),go=setInterval(uk,su)),Bn=1,cu(uu))}}function fu(e,t,o){var i=new Fi;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var mk=fa("start","end","cancel","interrupt"),pk=[],mu=0,pu=1,xa=2,Gi=3,hu=4,Sa=5,Yi=6;function Wi(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;hk(e,o,{name:t,index:i,group:l,on:mk,tween:pk,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:mu})}function Ia(e,t){var o=ct(e,t);if(o.state>mu)throw new Error("too late; already scheduled");return o}function bt(e,t){var o=ct(e,t);if(o.state>Gi)throw new Error("too late; already running");return o}function ct(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function hk(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=du(a,0,o.time);function a(c){o.state=pu,o.timer.restart(r,o.delay,o.time),o.delay<=c&&r(c-o.delay)}function r(c){var u,f,p,m;if(o.state!==pu)return d();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Gi)return fu(r);m.state===hu?(m.state=Yi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Yi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(fu(function(){o.state===Gi&&(o.state=hu,o.timer.restart(s,o.delay,o.time),s(c))}),o.state=xa,o.on.call("start",e,e.__data__,o.index,o.group),o.state===xa){for(o.state=Gi,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(c){for(var u=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(d),o.state=Sa,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===Sa&&(o.on.call("end",e,e.__data__,o.index,o.group),d())}function d(){o.state=Yi,o.timer.stop(),delete i[t];for(var c in i)return;delete e.__transition}}function qi(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>xa&&i.state<Sa,i.state=Yi,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function yk(e){return this.each(function(){qi(this,e)})}function gk(e,t){var o,i;return function(){var l=bt(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function bk(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=bt(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},d=0,c=l.length;d<c;++d)if(l[d].name===t){l[d]=s;break}d===c&&l.push(s)}a.tween=l}}function _k(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ct(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?gk:bk)(o,e,t))}function Ca(e,t,o){var i=e._id;return e.each(function(){var l=bt(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return ct(l,i).value[t]}}function yu(e,t){var o;return(typeof t=="number"?Ut:t instanceof ho?ou:(o=ho(t))?(t=o,ou):ek)(e,t)}function wk(e){return function(){this.removeAttribute(e)}}function vk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ek(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function kk(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function Nk(e,t,o){var i,l,a;return function(){var r,s=o(this),d;return s==null?void this.removeAttribute(e):(r=this.getAttribute(e),d=s+"",r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s)))}}function $k(e,t,o){var i,l,a;return function(){var r,s=o(this),d;return s==null?void this.removeAttributeNS(e.space,e.local):(r=this.getAttributeNS(e.space,e.local),d=s+"",r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s)))}}function xk(e,t){var o=Ti(e),i=o==="transform"?ik:yu;return this.attrTween(e,typeof t=="function"?(o.local?$k:Nk)(o,i,Ca(this,"attr."+e,t)):t==null?(o.local?vk:wk)(o):(o.local?kk:Ek)(o,i,t))}function Sk(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Ik(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Ck(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&Ik(e,a)),o}return l._value=t,l}function Rk(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&Sk(e,a)),o}return l._value=t,l}function Vk(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=Ti(e);return this.tween(o,(i.local?Ck:Rk)(i,t))}function Ak(e,t){return function(){Ia(this,e).delay=+t.apply(this,arguments)}}function Tk(e,t){return t=+t,function(){Ia(this,e).delay=t}}function Bk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ak:Tk)(t,e)):ct(this.node(),t).delay}function Mk(e,t){return function(){bt(this,e).duration=+t.apply(this,arguments)}}function Dk(e,t){return t=+t,function(){bt(this,e).duration=t}}function Ok(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Mk:Dk)(t,e)):ct(this.node(),t).duration}function Lk(e,t){if(typeof t!="function")throw new Error;return function(){bt(this,e).ease=t}}function Pk(e){var t=this._id;return arguments.length?this.each(Lk(t,e)):ct(this.node(),t).ease}function zk(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;bt(this,e).ease=o}}function Uk(e){if(typeof e!="function")throw new Error;return this.each(zk(this._id,e))}function Hk(e){typeof e!="function"&&(e=Md(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],d,c=0;c<r;++c)(d=a[c])&&e.call(d,d.__data__,c,a)&&s.push(d);return new It(i,this._parents,this._name,this._id)}function Fk(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var d=t[s],c=o[s],u=d.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=d[m]||c[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new It(r,this._parents,this._name,this._id)}function Gk(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function Yk(e,t,o){var i,l,a=Gk(t)?Ia:bt;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function Wk(e,t){var o=this._id;return arguments.length<2?ct(this.node(),o).on.on(e):this.each(Yk(o,e,t))}function qk(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Kk(){return this.on("end.remove",qk(this._id))}function Xk(e){var t=this._name,o=this._id;typeof e!="function"&&(e=pa(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],d=s.length,c=a[r]=new Array(d),u,f,p=0;p<d;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),c[p]=f,Wi(c[p],t,o,p,c,ct(u,o)));return new It(a,this._parents,t,o)}function jk(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Bd(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var d=i[s],c=d.length,u,f=0;f<c;++f)if(u=d[f]){for(var p=e.call(u,u.__data__,f,d),m,h=ct(u,o),g=0,w=p.length;g<w;++g)(m=p[g])&&Wi(m,t,o,g,p,h);a.push(p),r.push(u)}return new It(a,r,t,o)}var Zk=uo.prototype.constructor;function Jk(){return new Zk(this._groups,this._parents)}function Qk(e,t){var o,i,l;return function(){var a=An(this,e),r=(this.style.removeProperty(e),An(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function gu(e){return function(){this.style.removeProperty(e)}}function eN(e,t,o){var i,l=o+"",a;return function(){var r=An(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function tN(e,t,o){var i,l,a;return function(){var r=An(this,e),s=o(this),d=s+"";return s==null&&(d=s=(this.style.removeProperty(e),An(this,e))),r===d?null:r===i&&d===l?a:(l=d,a=t(i=r,s))}}function nN(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var d=bt(this,e),c=d.on,u=d.value[a]==null?s||(s=gu(t)):void 0;(c!==o||l!==u)&&(i=(o=c).copy()).on(r,l=u),d.on=i}}function oN(e,t,o){var i=(e+="")=="transform"?ok:yu;return t==null?this.styleTween(e,Qk(e,i)).on("end.style."+e,gu(e)):typeof t=="function"?this.styleTween(e,tN(e,i,Ca(this,"style."+e,t))).each(nN(this._id,e)):this.styleTween(e,eN(e,i,t),o).on("end.style."+e,null)}function iN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function lN(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&iN(e,r,o)),i}return a._value=t,a}function aN(e,t,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,lN(e,t,o??""))}function rN(e){return function(){this.textContent=e}}function sN(e){return function(){var t=e(this);this.textContent=t??""}}function cN(e){return this.tween("text",typeof e=="function"?sN(Ca(this,"text",e)):rN(e==null?"":e+""))}function dN(e){return function(t){this.textContent=e.call(this,t)}}function uN(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&dN(l)),t}return i._value=e,i}function fN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,uN(e))}function mN(){for(var e=this._name,t=this._id,o=bu(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,d,c=0;c<s;++c)if(d=r[c]){var u=ct(d,t);Wi(d,e,o,c,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new It(i,this._parents,e,o)}function pN(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},d={value:function(){--l===0&&a()}};o.each(function(){var c=bt(this,i),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(d)),c.on=t}),l===0&&a()})}var hN=0;function It(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function bu(){return++hN}var Ct=uo.prototype;It.prototype={constructor:It,select:Xk,selectAll:jk,selectChild:Ct.selectChild,selectChildren:Ct.selectChildren,filter:Hk,merge:Fk,selection:Jk,transition:mN,call:Ct.call,nodes:Ct.nodes,node:Ct.node,size:Ct.size,empty:Ct.empty,each:Ct.each,on:Wk,attr:xk,attrTween:Vk,style:oN,styleTween:aN,text:cN,textTween:fN,remove:Kk,tween:_k,delay:Bk,duration:Ok,ease:Pk,easeVarying:Uk,end:pN,[Symbol.iterator]:Ct[Symbol.iterator]};function yN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gN={time:null,delay:0,duration:250,ease:yN};function bN(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function _N(e){var t,o;e instanceof It?(t=e._id,e=e._name):(t=bu(),(o=gN).time=Na(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,d,c=0;c<s;++c)(d=r[c])&&Wi(d,e,t,c,r,o||bN(d,t));return new It(i,this._parents,e,t)}uo.prototype.interrupt=yk,uo.prototype.transition=_N;const Ki=e=>()=>e;function wN(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function Rt(e,t,o){this.k=e,this.x=t,this.y=o}Rt.prototype={constructor:Rt,scale:function(e){return e===1?this:new Rt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Rt(this.k,this.x+this.k*e,this.y+this.k*t)},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 Ra=new Rt(1,0,0);Rt.prototype;function Va(e){e.stopImmediatePropagation()}function wo(e){e.preventDefault(),e.stopImmediatePropagation()}function vN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function EN(){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 _u(){return this.__zoom||Ra}function kN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function NN(){return navigator.maxTouchPoints||"ontouchstart"in this}function $N(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function xN(){var e=vN,t=EN,o=$N,i=kN,l=NN,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,d=sk,c=fa("start","zoom","end"),u,f,p,m=500,h=150,g=0,w=10;function b(_){_.property("__zoom",_u).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",Q).on("dblclick.zoom",te).filter(l).on("touchstart.zoom",de).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",le).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(_,R,k,z){var W=_.selection?_.selection():_;W.property("__zoom",_u),_!==W?J(_,R,k,z):W.interrupt().each(function(){G(this,arguments).event(z).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(_,R,k,z){b.scaleTo(_,function(){var W=this.__zoom.k,K=typeof R=="function"?R.apply(this,arguments):R;return W*K},k,z)},b.scaleTo=function(_,R,k,z){b.transform(_,function(){var W=t.apply(this,arguments),K=this.__zoom,T=k==null?x(W):typeof k=="function"?k.apply(this,arguments):k,oe=K.invert(T),ce=typeof R=="function"?R.apply(this,arguments):R;return o(y(S(K,ce),T,oe),W,r)},k,z)},b.translateBy=function(_,R,k,z){b.transform(_,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),r)},null,z)},b.translateTo=function(_,R,k,z,W){b.transform(_,function(){var K=t.apply(this,arguments),T=this.__zoom,oe=z==null?x(K):typeof z=="function"?z.apply(this,arguments):z;return o(Ra.translate(oe[0],oe[1]).scale(T.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof k=="function"?-k.apply(this,arguments):-k),K,r)},z,W)};function S(_,R){return R=Math.max(a[0],Math.min(a[1],R)),R===_.k?_:new Rt(R,_.x,_.y)}function y(_,R,k){var z=R[0]-k[0]*_.k,W=R[1]-k[1]*_.k;return z===_.x&&W===_.y?_:new Rt(_.k,z,W)}function x(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function J(_,R,k,z){_.on("start.zoom",function(){G(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).event(z).end()}).tween("zoom",function(){var W=this,K=arguments,T=G(W,K).event(z),oe=t.apply(W,K),ce=k==null?x(oe):typeof k=="function"?k.apply(W,K):k,me=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),ge=W.__zoom,se=typeof R=="function"?R.apply(W,K):R,fe=d(ge.invert(ce).concat(me/ge.k),se.invert(ce).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var Ne=fe(ye),ve=me/Ne[2];ye=new Rt(ve,ce[0]-Ne[0]*ve,ce[1]-Ne[1]*ve)}T.zoom(null,ye)}})}function G(_,R,k){return!k&&_.__zooming||new j(_,R)}function j(_,R){this.that=_,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,R),this.taps=0}j.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,R){return this.mouse&&_!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var R=Pt(this.that).datum();c.call(_,this.that,new wN(_,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),R)}};function U(_,...R){if(!e.apply(this,arguments))return;var k=G(this,R).event(_),z=this.__zoom,W=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,i.apply(this,arguments)))),K=zt(_);if(k.wheel)(k.mouse[0][0]!==K[0]||k.mouse[0][1]!==K[1])&&(k.mouse[1]=z.invert(k.mouse[0]=K)),clearTimeout(k.wheel);else{if(z.k===W)return;k.mouse=[K,z.invert(K)],qi(this),k.start()}wo(_),k.wheel=setTimeout(T,h),k.zoom("mouse",o(y(S(z,W),k.mouse[0],k.mouse[1]),k.extent,r));function T(){k.wheel=null,k.end()}}function Q(_,...R){if(p||!e.apply(this,arguments))return;var k=_.currentTarget,z=G(this,R,!0).event(_),W=Pt(_.view).on("mousemove.zoom",ce,!0).on("mouseup.zoom",me,!0),K=zt(_,k),T=_.clientX,oe=_.clientY;ME(_.view),Va(_),z.mouse=[K,this.__zoom.invert(K)],qi(this),z.start();function ce(ge){if(wo(ge),!z.moved){var se=ge.clientX-T,fe=ge.clientY-oe;z.moved=se*se+fe*fe>g}z.event(ge).zoom("mouse",o(y(z.that.__zoom,z.mouse[0]=zt(ge,k),z.mouse[1]),z.extent,r))}function me(ge){W.on("mousemove.zoom mouseup.zoom",null),DE(ge.view,z.moved),wo(ge),z.event(ge).end()}}function te(_,...R){if(e.apply(this,arguments)){var k=this.__zoom,z=zt(_.changedTouches?_.changedTouches[0]:_,this),W=k.invert(z),K=k.k*(_.shiftKey?.5:2),T=o(y(S(k,K),z,W),t.apply(this,R),r);wo(_),s>0?Pt(this).transition().duration(s).call(J,T,z,_):Pt(this).call(b.transform,T,z,_)}}function de(_,...R){if(e.apply(this,arguments)){var k=_.touches,z=k.length,W=G(this,R,_.changedTouches.length===z).event(_),K,T,oe,ce;for(Va(_),T=0;T<z;++T)oe=k[T],ce=zt(oe,this),ce=[ce,this.__zoom.invert(ce),oe.identifier],W.touch0?!W.touch1&&W.touch0[2]!==ce[2]&&(W.touch1=ce,W.taps=0):(W.touch0=ce,K=!0,W.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(W.taps<2&&(f=ce[0],u=setTimeout(function(){u=null},m)),qi(this),W.start())}}function P(_,...R){if(this.__zooming){var k=G(this,R).event(_),z=_.changedTouches,W=z.length,K,T,oe,ce;for(wo(_),K=0;K<W;++K)T=z[K],oe=zt(T,this),k.touch0&&k.touch0[2]===T.identifier?k.touch0[0]=oe:k.touch1&&k.touch1[2]===T.identifier&&(k.touch1[0]=oe);if(T=k.that.__zoom,k.touch1){var me=k.touch0[0],ge=k.touch0[1],se=k.touch1[0],fe=k.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,Ne=(Ne=fe[0]-ge[0])*Ne+(Ne=fe[1]-ge[1])*Ne;T=S(T,Math.sqrt(ye/Ne)),oe=[(me[0]+se[0])/2,(me[1]+se[1])/2],ce=[(ge[0]+fe[0])/2,(ge[1]+fe[1])/2]}else if(k.touch0)oe=k.touch0[0],ce=k.touch0[1];else return;k.zoom("touch",o(y(T,oe,ce),k.extent,r))}}function le(_,...R){if(this.__zooming){var k=G(this,R).event(_),z=_.changedTouches,W=z.length,K,T;for(Va(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),K=0;K<W;++K)T=z[K],k.touch0&&k.touch0[2]===T.identifier?delete k.touch0:k.touch1&&k.touch1[2]===T.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(T=zt(T,this),Math.hypot(f[0]-T[0],f[1]-T[1])<w)){var oe=Pt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:Ki(+_),b):i},b.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Ki(!!_),b):e},b.touchable=function(_){return arguments.length?(l=typeof _=="function"?_:Ki(!!_),b):l},b.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Ki([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),b):t},b.scaleExtent=function(_){return arguments.length?(a[0]=+_[0],a[1]=+_[1],b):[a[0],a[1]]},b.translateExtent=function(_){return arguments.length?(r[0][0]=+_[0][0],r[1][0]=+_[1][0],r[0][1]=+_[0][1],r[1][1]=+_[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(_){return arguments.length?(o=_,b):o},b.duration=function(_){return arguments.length?(s=+_,b):s},b.interpolate=function(_){return arguments.length?(d=_,b):d},b.on=function(){var _=c.on.apply(c,arguments);return _===c?b:_},b.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,b):Math.sqrt(g)},b.tapDistance=function(_){return arguments.length?(w=+_,b):w},b}const wu=Symbol("MiniMapSlots"),SN=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],IN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},CN=n.defineComponent({...IN,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:t}){const o=e,i=n.inject(wu),l=n.useAttrs(),a=n.toRef(()=>l.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function d(f){t("mouseenter",f)}function c(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,p)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||a.value.background||a.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:d,onMousemove:c,onMouseleave:u}),null,16,SN))],64)):n.createCommentVNode("",!0)}}),RN=["width","height","viewBox","aria-labelledby"],VN=["id"],AN=["d","fill","stroke","stroke-width"],TN={name:"MiniMap",compatConfig:{MODE:3}},BN=n.defineComponent({...TN,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:t}){const o=n.useSlots(),i=n.useAttrs(),l=200,a=150,{id:r,edges:s,viewport:d,translateExtent:c,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:h}=Ae(),g=n.ref();n.provide(wu,o);const w=n.toRef(()=>{var W;return e.width??((W=i.style)==null?void 0:W.width)??l}),b=n.toRef(()=>{var W;return e.height??((W=i.style)==null?void 0:W.height)??a}),S=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),x=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),J=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),G=n.computed(()=>Wl(h.value.filter(W=>!W.hidden))),j=n.computed(()=>({x:-d.value.x/d.value.zoom,y:-d.value.y/d.value.zoom,width:u.value.width/d.value.zoom,height:u.value.height/d.value.zoom})),U=n.computed(()=>h.value&&h.value.length?wg(G.value,j.value):j.value),Q=n.computed(()=>{const W=U.value.width/w.value,K=U.value.height/b.value;return Math.max(W,K)}),te=n.computed(()=>{const W=Q.value*w.value,K=Q.value*b.value,T=e.offsetScale*Q.value;return{offset:T,x:U.value.x-(W-U.value.width)/2-T,y:U.value.y-(K-U.value.height)/2-T,width:W+T*2,height:K+T*2}}),de=n.computed(()=>!te.value.x||!te.value.y?"":`
|
|
28
|
+
M${te.value.x-te.value.offset},${te.value.y-te.value.offset}
|
|
29
|
+
h${te.value.width+te.value.offset*2}
|
|
30
|
+
v${te.value.height+te.value.offset*2}
|
|
31
|
+
h${-te.value.width-te.value.offset*2}z
|
|
32
|
+
M${j.value.x+e.maskBorderRadius},${j.value.y}
|
|
33
|
+
h${j.value.width-2*e.maskBorderRadius}
|
|
34
34
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
35
|
-
v${
|
|
35
|
+
v${j.value.height-2*e.maskBorderRadius}
|
|
36
36
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
37
|
-
h${-(
|
|
37
|
+
h${-(j.value.width-2*e.maskBorderRadius)}
|
|
38
38
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
39
|
-
v${-(
|
|
40
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(V=>{if(g.value){const H=Lt(g.value),U=me=>{if(me.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const be=me.sourceEvent.ctrlKey&&ro()?10:1,ue=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,X=c.value.zoom*2**(ue*be);m.value.scaleTo(p.value,X)},ce=me=>{if(me.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const be=oe.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),ue={x:c.value.x-me.sourceEvent.movementX*be,y:c.value.y-me.sourceEvent.movementY*be},X=[[0,0],[u.value.width,u.value.height]],F=Il.translate(ue.x,ue.y).scale(c.value.zoom),le=m.value.constrain()(F,X,d.value);m.value.transform(p.value,le)},he=bN().wheelDelta(me=>Ya(me)*(e.zoomStep/10)).on("zoom",e.pannable?ce:()=>{}).on("zoom.wheel",e.zoomable?U:()=>{});H.call(he),V(()=>{H.on("zoom",null)})}},{flush:"post"});function W(V){const[H,U]=Pt(V);t("click",{event:V,position:{x:H,y:U}})}function ge(V,H){const U={event:V,node:H,connectedEdges:en([H],s.value)};f.miniMapNodeClick(U),t("nodeClick",U)}function _(V,H){const U={event:V,node:H,connectedEdges:en([H],s.value)};f.miniMapNodeDoubleClick(U),t("nodeDblclick",U)}function w(V,H){const U={event:V,node:H,connectedEdges:en([H],s.value)};f.miniMapNodeMouseEnter(U),t("nodeMouseenter",U)}function k(V,H){const U={event:V,node:H,connectedEdges:en([H],s.value)};f.miniMapNodeMouseMove(U),t("nodeMousemove",U)}function K(V,H){const U={event:V,node:H,connectedEdges:en([H],s.value)};f.miniMapNodeMouseLeave(U),t("nodeMouseleave",U)}return(V,H)=>(n.openBlock(),n.createBlock(n.unref(Jc),{position:V.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:V.pannable,zoomable:V.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:N.value,height:b.value,viewBox:[z.value.x,z.value.y,z.value.width,z.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:W},[V.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(V.ariaLabel),9,kN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(h),U=>(n.openBlock(),n.createBlock(wN,{id:U.id,key:U.id,f:"",position:U.computedPosition,dimensions:U.dimensions,selected:U.selected,dragging:U.dragging,style:n.normalizeStyle(U.style),class:n.normalizeClass(Z.value(U)),color:y.value(U),"border-radius":V.nodeBorderRadius,"stroke-color":C.value(U),"stroke-width":V.nodeStrokeWidth,"shape-rendering":n.unref(E),type:U.type,hidden:U.hidden,onClick:ce=>ge(ce,U),onDblclick:ce=>_(ce,U),onMouseenter:ce=>w(ce,U),onMousemove:ce=>k(ce,U),onMouseleave:ce=>K(ce,U)},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)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:J.value,fill:V.maskColor,stroke:V.maskStrokeColor,"stroke-width":V.maskStrokeWidth,"fill-rule":"evenodd"},null,8,NN)],8,EN))]),_:1},8,["position","class"]))}}),SN=["d"],IN=["cx","cy","onDblclick"],CN=["x","y","onPointerdown","onDblclick"],RN=Te(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ve(),i=n.inject(cl),a=n.inject(ln,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Rn,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),c=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),d=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>c.value.map((P,oe)=>oe===d.value?u.value:P)),{source:p,target:m,sourceSide:h,targetSide:g}=xd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),N=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Xi(p.value,h.value,f.value,m.value,g.value):Zi(p.value,f.value,m.value)),b=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ji(p.value,h.value,f.value,m.value,g.value):ea(p.value,f.value,m.value).map((P,oe)=>({point:P,segIndex:oe})):[]),E=n.computed(()=>l.value?f.value:[]);function y(P,oe){d.value=P,u.value={...c.value[P]},oe.target.setPointerCapture(oe.pointerId),oe.stopPropagation()}function C(P){if(d.value<0)return;const oe=o({x:P.clientX,y:P.clientY});u.value={x:oe.x,y:oe.y}}function Z(P){var oe,z;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(z=(oe=P.target).releasePointerCapture)==null||z.call(oe,P.pointerId)}function q(P,oe){oe.stopPropagation(),i==null||i.removePoint(t.id,P)}function te(P,oe){if(!i)return;const z=o({x:oe.clientX,y:oe.clientY});i.insertPoint(t.id,P,{x:z.x,y:z.y})}return(P,oe)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:N.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,SN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(z,J)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${J}`,cx:z.point.x,cy:z.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(W=>te(z.segIndex,W),["stop"])},null,42,IN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E.value,(z,J)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${J}`,x:z.x-5,y:z.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:W=>y(J,W),onPointermove:C,onPointerup:Z,onDblclick:W=>q(J,W)},null,42,CN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),VN=["data-theme"],AN={key:0,class:"em-ctx__sep",role:"separator"},TN={key:1,class:"em-ctx__swatches"},MN={class:"em-ctx__swatches-label"},BN={class:"em-ctx__chips"},DN=["onClick"],ON=["title","onClick"],LN=["disabled","onClick"],PN={class:"em-ctx__icon"},zN={class:"em-ctx__caption"},UN=Te(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,h){var b;i.value=h,a.value=(b=m.target)!=null&&b.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const g=l.value;if(!g)return;const N=g.getBoundingClientRect();r.x+N.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-N.width)),r.y+N.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-N.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function p(m,h){m.onPick(h),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,h)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(g,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",AN)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",TN,[n.createElementVNode("span",MN,n.toDisplayString(g.caption),1),n.createElementVNode("div",BN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":g.current===null}]),title:"없음",onClick:b=>p(g,null)},null,10,DN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),b=>(n.openBlock(),n.createElementBlock("button",{key:b,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":g.current===b}]),style:n.normalizeStyle({background:n.unref(Sn)(b)}),title:n.unref($n)(b),onClick:E=>p(g,b)},null,14,ON))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":g.danger,"is-disabled":g.disabled}]),disabled:g.disabled,role:"menuitem",onClick:b=>f(g)},[n.createElementVNode("span",PN,[g.icon?(n.openBlock(),n.createBlock(Ie,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",zN,n.toDisplayString(g.caption),1)],10,LN))],64))),128))],36)],8,VN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Rl=[".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 Mn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function HN(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function FN(e,t){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 l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const h=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=t(h.left,h.top+h.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const h=d.trim();if(h){const g=t(f,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(l,h),a.setEnd(l,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(m(),u=g.top,f=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return m(),c}function qi(e,t){const o=[];for(const i of e.querySelectorAll("*"))HN(i)&&(i.closest(Rl)||Mn(i)&&o.push(...FN(i,t)));return o}function vo(e){return Math.round(e*100)/100}function GN(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Rl)||!Mn(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const l=t(a.left,a.top),r=t(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="${vo(l.x)}" y="${vo(l.y)}" width="${vo(r.x-l.x)}" height="${vo(r.y-l.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function YN(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Mn(o))continue;const i=getComputedStyle(o),a=i.stroke,l=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>vo(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${l}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${l}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${a}" stroke-width="${l}" stroke-linejoin="round" />`)}return t}function _u(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Rl)||!Mn(a))continue;const l=getComputedStyle(a),r=parseFloat(l.borderTopWidth);if(!r)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:l.borderTopColor,strokeWidth:r})}return i}function wo(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),l=t(o.right,o.bottom),r=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:l.x-a.x,h:l.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function Vl(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function WN(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,h)=>e.screenToFlowCoordinate({x:m,y:h}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const h=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!h||!Mn(h))continue;const g=h.firstElementChild;if(g)if(m.type==="group"){const N=wo(g,o);Vl(s,N),i.push({...N,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...wo(b,o),stroke:"none",texts:[]}),i.push({...N,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:qi(g,o)})}else if(m.type==="note"){const N={...wo(g,o),texts:qi(g,o),lines:_u(g,g,o)};Vl(s,N),l.push(N)}else{const N=wo(g,o);Vl(s,N);const b=N.radius??{tl:0,tr:0};a.push({...N,stroke:"none",texts:[]});const E=g.querySelector(".em-entity__header");if(E){const y=wo(E,o);a.push({x:N.x,y:N.y,w:N.w,h:y.y+y.h-N.y,fill:y.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({...N,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:qi(g,o),lines:_u(g,g,o),icons:GN(g,o)}),a.push({...N,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const h=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Mn(h))continue;const g=h.getAttribute("d");if(!g)continue;const N=getComputedStyle(h),b=N.strokeDasharray,E=YN(m);r.push({d:g,stroke:N.stroke,strokeWidth:parseFloat(N.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:qi(m,o),markers:E.length?E:void 0})}const c=t.closest(".em-canvas")??t,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:r,entities:a,notes:l}}function vu(e){return Fl(WN(e))}function wu(e,t="diagram.svg"){const o=vu(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i);try{const l=document.createElement("a");l.href=a,l.download=t,document.body.appendChild(l),l.click(),l.remove()}finally{URL.revokeObjectURL(a)}}const Al="nc:",Eu=Te(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(I){s.x=I.clientX,s.y=I.clientY}const d=n.ref(null);n.provide($i,d);const u=n.ref(null);n.provide(cd,u);const f=n.ref(null),p=n.computed(()=>{const I=f.value,A=new Set;if(!I)return A;if(I.kind==="entity")A.add(I.id);else if(I.kind==="group"){const Q=i.resolved.value.groups.find($=>$.group.modelId===I.id);for(const $ of(Q==null?void 0:Q.group.memberEntityRefs)??[])A.add($)}return A}),m=n.computed(()=>{const I=f.value,A=new Set(p.value),Q=new Set,$=new Set;if(!I)return{related:A,edges:Q,notes:$};if(I.kind==="note"){$.add(I.id);for(const M of i.resolved.value.noteConnections)M.noteRef===I.id&&A.add(M.targetRef);return{related:A,edges:Q,notes:$}}const D=p.value;if(!D.size)return{related:A,edges:Q,notes:$};for(const M of i.resolved.value.associations){const{end1:L,end2:j}=M.association;(D.has(L.entityRef)||D.has(j.entityRef))&&(Q.add(M.association.modelId),A.add(L.entityRef),A.add(j.entityRef))}for(const M of i.resolved.value.noteConnections)A.has(M.targetRef)&&$.add(M.noteRef);return{related:A,edges:Q,notes:$}});n.provide(Rn,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:p,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var I;return((I=f.value)==null?void 0:I.kind)==="group"?f.value.id:null}),setEntityHover:I=>{u.value||r.value||(f.value=I?{kind:"entity",id:I}:null)},setGroupHover:I=>{u.value||r.value||(f.value=I?{kind:"group",id:I}:null)},setNoteHover:I=>{u.value||r.value||(f.value=I?{kind:"note",id:I}:null)}}),n.provide(ln,i);function h(I,A){return`${Al}${I}:${A}`}function g(I){if(!I.startsWith(Al))return null;const[A,Q]=I.slice(Al.length).split(":");return A&&Q?{noteRef:A,targetRef:Q}:null}n.provide(cl,{points:I=>{var Q,$;const A=g(I);return A?((Q=i.resolved.value.noteConnections.find(D=>D.noteRef===A.noteRef&&D.targetRef===A.targetRef))==null?void 0:Q.waypoints)??[]:(($=i.resolved.value.associations.find(D=>D.association.modelId===I))==null?void 0:$.waypoints)??[]},movePoint:(I,A,Q)=>{const $=g(I);$?i.moveNoteConnectionWaypoint($.noteRef,$.targetRef,A,Q):i.moveWaypoint(I,A,Q)},insertPoint:(I,A,Q)=>{const $=g(I);$?i.addNoteConnectionWaypoint($.noteRef,$.targetRef,A,Q):i.addWaypoint(I,A,Q)},removePoint:(I,A)=>{const Q=g(I);Q?i.removeNoteConnectionWaypoint(Q.noteRef,Q.targetRef,A):i.removeWaypoint(I,A)}});const N=Ve(),{nodes:b,edges:E,findNode:y,findEdge:C,addNodes:Z,addEdges:q,removeNodes:te,removeEdges:P,fitView:oe,setCenter:z,getViewport:J,screenToFlowCoordinate:W,getSelectedNodes:ge}=N,_=n.ref(!1);async function w(){_.value=!0,await n.nextTick(),await new Promise(I=>requestAnimationFrame(()=>I(null)));try{wu(N)}finally{_.value=!1}}t({exportSvg:w});function k(I){for(const A of i.resolved.value.groups){const{location:Q,size:$}=A.geo;if(I.x>=Q.x&&I.x<=Q.x+$.width&&I.y>=Q.y&&I.y<=Q.y+$.height)return A.group.modelId}return null}function K(){const I=i.resolved.value,A=new Map(I.groups.map(L=>[L.group.modelId,L.geo])),Q=new Set(I.groups.map(L=>L.group.modelId)),$=new Set([...Q,...I.entities.map(L=>L.entity.modelId),...I.notes.map(L=>L.note.modelId)]);for(const L of[...b.value])$.has(L.id)||te([L.id]);for(const L of I.groups){const j=L.group.modelId,se={width:`${L.geo.size.width}px`,height:`${L.geo.size.height}px`},fe={group:L.group,style:L.style},de=y(j);de?(de.position={...L.geo.location},de.data=fe,de.style=se):Z([{id:j,type:"group",position:{...L.geo.location},style:se,data:fe}])}for(const L of I.entities){const j=L.entity.modelId,se=L.groupRef&&Q.has(L.groupRef)?L.groupRef:void 0,fe={entity:L.entity,displayMode:i.displayMode.value,collapsed:L.collapsed,groupRef:se,size:L.geo.size,style:L.style,attributeStyles:L.attributeStyles,operationStyles:L.operationStyles},de=se?A.get(se):void 0,xe=de?{x:L.geo.location.x-de.location.x,y:L.geo.location.y-de.location.y}:{...L.geo.location},Re=y(j);Re?(Re.position=xe,Re.data=fe,Re.parentNode=se):Z([{id:j,type:"entity",position:xe,parentNode:se,data:fe}])}for(const L of I.notes){const j=L.note,se=j.modelId,fe=L.groupRef&&Q.has(L.groupRef)?L.groupRef:void 0,de={note:j,groupRef:fe},xe={width:`${j.geo.size.width}px`,height:`${j.geo.size.height}px`},Re=fe?A.get(fe):void 0,Se=Re?{x:j.geo.location.x-Re.location.x,y:j.geo.location.y-Re.location.y}:{...j.geo.location},Ae=y(se);Ae?(Ae.position=Se,Ae.data=de,Ae.style=xe,Ae.parentNode=fe):Z([{id:se,type:"note",position:Se,parentNode:fe,style:xe,data:de}])}const D=new Map(I.associations.map(L=>[L.association.modelId,L])),M=new Set(I.noteConnections.map(L=>h(L.noteRef,L.targetRef)));for(const L of[...E.value])!D.has(L.id)&&!M.has(L.id)&&P([L.id]);for(const[L,j]of D){const se={id:L,type:"association",source:j.association.end1.entityRef,target:j.association.end2.entityRef,sourceHandle:j.sourceColumnRef?`r:${j.sourceColumnRef}`:void 0,targetHandle:j.targetColumnRef?`l:${j.targetColumnRef}`:void 0,data:{association:j.association,sourceColumnRef:j.sourceColumnRef,targetColumnRef:j.targetColumnRef}},fe=C(L);fe?(fe.data=se.data,fe.sourceHandle=se.sourceHandle,fe.targetHandle=se.targetHandle):q([se])}for(const L of I.noteConnections){const j=h(L.noteRef,L.targetRef),se={noteRef:L.noteRef,targetRef:L.targetRef},fe=C(j);fe?fe.data=se:q([{id:j,type:"note-connection",source:L.noteRef,target:L.targetRef,data:se}])}}function V(){const I=ge.value.map(Q=>Q.id);if(I.length)return I;const A=i.selection.value;return A&&(A.kind==="entity"||A.kind==="note"||A.kind==="group")?[A.id]:[]}function H(I){var D;const A=I.target;if(A&&(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.isContentEditable))return;if(!i.editable.value){(I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="c"&&(i.copy(),I.preventDefault());return}if(I.key==="Delete"||I.key==="Backspace"){i.deleteSelection()&&I.preventDefault();return}if(I.key==="ArrowUp"||I.key==="ArrowDown"||I.key==="ArrowLeft"||I.key==="ArrowRight"){if(((D=i.selection.value)==null?void 0:D.kind)==="attribute"){if(I.key==="ArrowUp"||I.key==="ArrowDown"){const se=I.key==="ArrowDown"?1:-1;(I.altKey?i.nudgeSelectedAttributes(se):i.moveAttributeFocus(se))&&I.preventDefault()}return}const M=I.shiftKey?10:1,L=I.key==="ArrowLeft"?-M:I.key==="ArrowRight"?M:0,j=I.key==="ArrowUp"?-M:I.key==="ArrowDown"?M:0;i.nudgeNodes(V(),L,j)&&I.preventDefault();return}if(!(I.metaKey||I.ctrlKey))return;const $=I.key.toLowerCase();$==="c"?(i.copy(),I.preventDefault()):$==="v"?(i.paste(),I.preventDefault()):$==="z"&&(I.shiftKey?i.redo():i.undo(),I.preventDefault())}n.onMounted(async()=>{K(),await n.nextTick(),oe(),window.addEventListener("keydown",H),window.addEventListener("pointerup",U),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",H),window.removeEventListener("pointerup",U),window.removeEventListener("pointermove",c)});function U(){d.value=null}function ce(){r.value=!0,f.value=null}function he(){var $;r.value=!1;const I=($=document.elementFromPoint(s.x,s.y))==null?void 0:$.closest(".vue-flow__node"),A=I==null?void 0:I.dataset.id;if(!A){f.value=null;return}const Q=I.classList.contains("vue-flow__node-group")?"group":I.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:Q,id:A}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],K),n.watch(()=>i.resolved.value,I=>{const A=f.value;if(!A)return;(A.kind==="entity"?I.entities.some($=>$.entity.modelId===A.id):A.kind==="group"?I.groups.some($=>$.group.modelId===A.id):I.notes.some($=>$.note.modelId===A.id))||(f.value=null)});function me(I){const A=I.computedPosition??I.position,Q=I.dimensions??{width:0,height:0};return{x:A.x+Q.width/2,y:A.y+Q.height/2}}function be(I){const A=I.node;if(A){if(f.value=null,A.type==="group"){const Q=i.resolved.value.groups.find($=>$.group.modelId===A.id);u.value=Q?{groupId:A.id,dx:A.position.x-Q.geo.location.x,dy:A.position.y-Q.geo.location.y}:null,d.value=null;return}if(A.type!=="entity"&&A.type!=="note"){d.value=null;return}d.value=k(me(A))}}function ue(I){var $;d.value=null,u.value=null;const A=($=I.nodes)!=null&&$.length?I.nodes:[I.node],Q=A.filter(D=>(D==null?void 0:D.type)==="group");if(Q.length){for(const D of Q){if(!D)continue;const M=i.resolved.value.entities.filter(L=>L.groupRef===D.id).map(L=>{const j=y(L.entity.modelId),se=(j==null?void 0:j.computedPosition)??(j==null?void 0:j.position)??{x:0,y:0};return{id:L.entity.modelId,location:{x:se.x,y:se.y}}});i.dragGroup(D.id,{x:D.position.x,y:D.position.y},M)}return}for(const D of A){if(!D||D.type==="group")continue;const M=D.computedPosition??D.position,L=D.dimensions??{width:0,height:0},j={x:M.x+L.width/2,y:M.y+L.height/2};D.type==="note"?i.dropNote(D.id,{x:M.x,y:M.y},k(j)):i.dropEntity(D.id,{x:M.x,y:M.y},k(j))}}function X(I){var se,fe,de,xe,Re;if(!i.editable.value||!I.source||!I.target)return;const A=((se=y(I.source))==null?void 0:se.type)==="note",Q=((fe=y(I.target))==null?void 0:fe.type)==="note";if(A||Q){if(A&&Q)return;const Se=A?I.source:I.target,Ae=A?I.target:I.source;((de=y(Ae))==null?void 0:de.type)==="entity"&&i.addNoteConnection(Se,Ae);return}const $=Se=>{var Ae;return(Ae=i.state.logical.entities.find(tt=>tt.modelId===Se))==null?void 0:Ae.stereotype},D=$(I.source)==="JPA_EMBEDDABLE",M=$(I.target)==="JPA_EMBEDDABLE";if(D||M){if(D&&M)return;const Se=D?I.source:I.target,Ae=D?I.target:I.source;i.addEmbedAssociation(Ae,Se);return}const L=(xe=I.sourceHandle)!=null&&xe.startsWith("r:")?I.sourceHandle.slice(2):void 0,j=(Re=I.targetHandle)!=null&&Re.startsWith("l:")?I.targetHandle.slice(2):void 0;i.addAssociation(I.source,I.target,L,j)}const F=n.ref(null);function le(I,A){var $;const Q=i.state.layout.entityLayouts.find(D=>D.entityRef===I);return We(($=Q==null?void 0:Q.attributeStyles)==null?void 0:$[A])}function ve(I,A){var $;const Q=i.state.layout.entityLayouts.find(D=>D.entityRef===I);return We(($=Q==null?void 0:Q.operationStyles)==null?void 0:$[A])}function we(I){var A;return We((A=i.state.layout.groupLayouts.find(Q=>Q.groupRef===I))==null?void 0:A.style)}function pe(I){var A;return We((A=i.state.layout.notes.find(Q=>Q.modelId===I))==null?void 0:A.style)}function ye(I){var $,D;if(I.preventDefault(),!i.editable.value)return;const A=()=>W({x:I.clientX,y:I.clientY}),Q=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const M=A();i.addEntity("NewEntity",{x:M.x,y:M.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const M=A();i.addNote("메모",{x:M.x,y:M.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const M=A();i.addEmptyGroup({x:M.x,y:M.y})}}];(($=i.clipboard.value)==null?void 0:$.kind)==="entity"&&Q.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&Q.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(D=F.value)==null||D.open(I,Q)}function ee({event:I,node:A}){var de,xe,Re,Se,Ae,tt,Ut,_e,Le,He,Eo,ko,No,xo,$o,So,Xe;const Q=I;if(Q.preventDefault(),!i.editable.value){if(A.type==="group"||A.type==="note")return;const Me=(xe=(de=Q.target)==null?void 0:de.closest("[data-attr]"))==null?void 0:xe.dataset.attr;if(Me){const nt=i.selection.value;(nt==null?void 0:nt.kind)==="attribute"&&nt.entityId===A.id&&nt.ids.includes(Me)||i.selectAttribute(A.id,Me);const un=((Re=i.selection.value)==null?void 0:Re.kind)==="attribute"&&i.selection.value.entityId===A.id?[...i.selection.value.ids]:[Me];(Se=F.value)==null||Se.open(Q,[{caption:un.length>1?`복사 (${un.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ae=F.value)==null||Ae.open(Q,[{caption:"상세 편집…",icon:"pencil",handler:()=>Ei(a,i,A.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.copy()}}]);return}if(A.type==="group"){(tt=F.value)==null||tt.open(Q,[{type:"swatches",caption:"색상",current:we(A.id),onPick:Me=>i.setGroupSwatch(A.id,Me)},{type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(A.id)}]);return}if(A.type==="note"){(Ut=F.value)==null||Ut.open(Q,[{type:"swatches",caption:"색상",current:pe(A.id),onPick:Me=>i.setNoteSwatch(A.id,Me)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(A.id)}]);return}const $=(Le=(_e=Q.target)==null?void 0:_e.closest("[data-attr]"))==null?void 0:Le.dataset.attr;if($){const Me=i.selection.value;(Me==null?void 0:Me.kind)==="attribute"&&Me.entityId===A.id&&Me.ids.includes($)||i.selectAttribute(A.id,$);const dn=((He=i.selection.value)==null?void 0:He.kind)==="attribute"&&i.selection.value.entityId===A.id?[...i.selection.value.ids]:[$],un=dn.length>1,Tl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(A.id)},{type:"swatches",caption:un?`색상 (${dn.length})`:"색상",current:un?null:le(A.id,$),onPick:$S=>i.setAttributeSwatches(A.id,dn,$S)},{type:"separator"},{caption:un?`복사 (${dn.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Io=i.clipboard.value;(Io==null?void 0:Io.kind)==="attribute"&&Tl.push({caption:Io.attributes.length>1?`속성 붙여넣기 (${Io.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.paste()}}),Tl.push({type:"separator"},{caption:un?`속성 삭제 (${dn.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(A.id,dn)}),(Eo=F.value)==null||Eo.open(Q,Tl);return}const D=(No=(ko=Q.target)==null?void 0:ko.closest("[data-op]"))==null?void 0:No.dataset.op;if(D){(xo=F.value)==null||xo.open(Q,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(A.id)},{type:"swatches",caption:"색상",current:ve(A.id,D),onPick:Me=>i.setOperationSwatch(A.id,D,Me)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(A.id,D)}]);return}const M=[{caption:"상세 편집…",icon:"pencil",handler:()=>Ei(a,i,A.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(A.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(A.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Me=ge.value.filter(nt=>nt.type==="entity").map(nt=>nt.id);i.createGroup(Me.includes(A.id)&&Me.length?Me:[A.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(A.id,A.id)}],L=i.embeddableCatalog.value;if(L.length){M.push({type:"separator"});for(const Me of L){const nt=(($o=Me.label)==null?void 0:$o.ko)??((So=Me.label)==null?void 0:So.en)??Me.type;M.push({caption:`임베더블 추가: ${nt}`,icon:"link",handler:()=>i.addPredefinedEmbed(A.id,Me.type)})}}const j=i.resolved.value.entities.find(Me=>Me.entity.modelId===A.id);M.push({type:"separator"}),M.push({caption:j!=null&&j.collapsed?"펼치기":"접기",icon:j!=null&&j.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(A.id,!(j!=null&&j.collapsed))}),(j==null?void 0:j.groupRef)&&M.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(A.id)}),M.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.copy()}});const fe=i.clipboard.value;(fe==null?void 0:fe.kind)==="attribute"&&M.push({caption:fe.attributes.length>1?`속성 붙여넣기 (${fe.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.paste()}}),M.push({type:"separator"}),M.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(A.id)}),(Xe=F.value)==null||Xe.open(Q,M)}function O({event:I,edge:A}){var D,M;const Q=I;if(Q.preventDefault(),!i.editable.value)return;const $=g(A.id);if($){(D=F.value)==null||D.open(Q,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints($.noteRef,$.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection($.noteRef,$.targetRef)}]);return}(M=F.value)==null||M.open(Q,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(A.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(A.id)}])}function B(I){return I==="group"?"group":I==="note"?"note":"entity"}function Y({node:I}){if(ge.value.length>1){i.selection.value=null;return}i.selection.value={kind:B(I.type),id:I.id}}function ie({nodes:I}){I.length>1&&(i.selection.value=null)}function ne({edge:I}){const A=g(I.id);i.selection.value=A?{kind:"note",id:A.noteRef}:{kind:"association",id:I.id}}function v(I){const A=i.selection.value;return!!A&&A.kind!=="attribute"&&A.id===I.id}function S(I){var A,Q;return v(I)?I.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":I.type==="note"?"var(--em-note-soft)":I.type==="group"?ed(We((A=I.data)==null?void 0:A.style),!0)??"var(--em-mm-group)":ed(We((Q=I.data)==null?void 0:Q.style))??"var(--em-mm-entity)"}function G(I){return v(I)?"var(--em-selection)":I.type==="note"?"var(--em-note-accent)":I.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function x(I,A){z(I,A,{zoom:J().zoom,duration:350})}n.watch(()=>i.focusRequest.value,I=>{if(!I)return;const A=y(I.id);if(!A)return;const Q=A.computedPosition??A.position,$=A.dimensions??{width:0,height:0};x(Q.x+$.width/2,Q.y+$.height/2)});function T({position:I}){x(I.x,I.y)}function R({node:I}){i.selection.value={kind:B(I.type),id:I.id};const A=I.computedPosition??I.position,Q=I.dimensions??{width:0,height:0};x(A.x+Q.width/2,A.y+Q.height/2)}function re({node:I}){oe({nodes:[I.id],duration:350,maxZoom:1.2,padding:.6})}return(I,A)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":l.value,"is-panning":r.value}])},[n.createVNode(n.unref(lb),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!_.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(xt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ce,onMoveEnd:he,onConnect:X,onConnectStart:A[0]||(A[0]=Q=>l.value=!0),onConnectEnd:A[1]||(A[1]=Q=>l.value=!1),onNodeDrag:be,onNodeDragStop:ue,onNodeClick:Y,onEdgeClick:ne,onSelectionChange:ie,onPaneClick:A[2]||(A[2]=Q=>n.unref(i).selection.value=null),onPaneContextMenu:ye,onNodeContextMenu:ee,onEdgeContextMenu:O},{"node-group":n.withCtx(Q=>[n.createVNode(ud,n.normalizeProps(n.guardReactiveProps(Q)),null,16)]),"node-entity":n.withCtx(Q=>[n.createVNode(dd,n.normalizeProps(n.guardReactiveProps(Q)),null,16)]),"node-note":n.withCtx(Q=>[n.createVNode(fd,n.normalizeProps(n.guardReactiveProps(Q)),null,16)]),"edge-association":n.withCtx(Q=>[n.createVNode($d,n.normalizeProps(n.guardReactiveProps(Q)),null,16)]),"edge-note-connection":n.withCtx(Q=>[n.createVNode(RN,n.normalizeProps(n.guardReactiveProps(Q)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(bv),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Gv),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref($N),{key:1,pannable:"",width:224,height:160,"node-color":S,"node-stroke-color":G,"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:T,onNodeClick:R,onNodeDblclick:re})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(UN,{ref_key:"menuRef",ref:F},null,512)],2))}}),[["__scopeId","data-v-fe483f3b"]]),qN={class:"em-explorer em-scroll-overlay"},KN={class:"em-explorer__rows"},XN=["data-key","onClick","onDblclick"],jN=["onClick"],ZN=["title"],JN={class:"em-key-slot"},QN={class:"em-key-slot"},ex={class:"em-explorer__label"},ku=Te(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var _;const b=i.resolved.value,E=i.displayMode.value,y=w=>{var k,K,V;return Co(E,w.name,(K=(k=w.table)==null?void 0:k.logicalName)==null?void 0:K.ko,(V=w.table)==null?void 0:V.physicalName)},C=E==="PHYSICAL"||E==="LOGICAL_PHYSICAL",Z=w=>{const k=w.attrType.startsWith("RELATION")&&w.dbAttrs.length>0;return{icon:w.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:w.identifier,fk:k&&C}}},q=w=>w.attrType.startsWith("EMBED")&&w.dbAttrs.length>0,te=E==="PHYSICAL"||E==="LOGICAL_PHYSICAL",P=w=>{if(w.attrType!=="EMBED_PREDEF")return w.dbAttrs;const k=i.embeddableCatalog.value.find(K=>K.type===w.type);return k?w.dbAttrs.map((K,V)=>{const H=k.fields[V];return H?{...K,physicalName:K.physicalName||H.physicalName,logicalName:K.logicalName??H.logicalName,dataType:K.dataType||H.dataType,length:K.length??H.length}:K}):w.dbAttrs},oe=(w,k)=>{var U,ce,he;const K={entityId:k,attrId:w.modelId};if(q(w)){const me=oa(E,w);return{key:`attr:${w.modelId}`,label:w.name+(me?` : ${me}`:""),icon:"table",attrRef:K,focusId:k,children:te?P(w).map(be=>{var ue;return{key:`attr:${w.modelId}:col:${be.modelId}`,label:Co(E,be.physicalName,(ue=be.logicalName)==null?void 0:ue.ko,be.physicalName)+(be.dataType?` : ${be.dataType}`:""),icon:"field",attrRef:K,focusId:k,children:[]}}):[]}}const V=Kl(w,i.state.logical.associations),H=oa(E,w,V);return{key:`attr:${w.modelId}`,label:Co(E,w.name,(ce=(U=w.dbAttrs[0])==null?void 0:U.logicalName)==null?void 0:ce.ko,(he=w.dbAttrs[0])==null?void 0:he.physicalName)+(H?` : ${H}`:""),...Z(w),attrRef:K,focusId:k,children:[]}},z=w=>{const k=w.entity,K=[...k.attributes].sort((V,H)=>V.order-H.order);return{key:`entity:${k.modelId}`,label:y(k),icon:"table",selectKind:"entity",selectId:k.modelId,focusId:k.modelId,children:K.map(V=>oe(V,k.modelId))}},J=new Map,W=[];for(const w of b.entities)if(w.groupRef){const k=J.get(w.groupRef)??[];k.push(w),J.set(w.groupRef,k)}else W.push(w);const ge=[];for(const w of b.groups){const k=w.group;ge.push({key:`group:${k.modelId}`,label:((_=k.name)==null?void 0:_.ko)||k.packageName||"(그룹)",icon:"folder",focusId:k.modelId,children:(J.get(k.modelId)??[]).map(z)})}for(const w of W)ge.push(z(w));if(b.associations.length){const w=new Map(b.entities.map(k=>[k.entity.modelId,y(k.entity)]));ge.push({key:"section:associations",label:`관계 (${b.associations.length})`,icon:"arrow-lr",children:b.associations.map(k=>{const K=k.association,V=w.get(K.end1.entityRef)??K.end1.entityRef,H=w.get(K.end2.entityRef)??K.end2.entityRef;return{key:`assoc:${K.modelId}`,label:`${V} — ${H}`,icon:"arrow-lr",selectKind:"association",selectId:K.modelId,children:[]}})})}return b.notes.length&&ge.push({key:"section:notes",label:`노트 (${b.notes.length})`,icon:"note",children:b.notes.map(({note:w})=>{var k;return{key:`note:${w.modelId}`,label:((k=w.memo.split(`
|
|
41
|
-
`)[0])==null?void 0:k.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:w.modelId,focusId:w.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:ge}});function r(b){return b?b.pk&&b.fk?"PFK (식별 외래키)":b.pk?"PK (기본키)":b.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(b){const E=new Set(s.value);E.has(b)?E.delete(b):E.add(b),s.value=E}const d=n.computed(()=>{const b=[],E=(y,C)=>{if(b.push({node:y,depth:C}),!s.value.has(y.key))for(const Z of y.children)E(Z,C+1)};return E(l.value,0),b}),u=n.computed(()=>{const b=[],E=y=>{if(y.children.length){y.key!=="root"&&b.push(y.key);for(const C of y.children)E(C)}};return E(l.value),b}),f=n.computed(()=>!u.value.some(b=>s.value.has(b)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(b){const E=i.selection.value;return b.attrRef?(E==null?void 0:E.kind)==="attribute"&&E.entityId===b.attrRef.entityId&&E.ids.includes(b.attrRef.attrId):!!E&&E.kind!=="attribute"&&!!b.selectId&&b.selectKind===E.kind&&b.selectId===E.id}function h(b){const E=i.selection.value;return b.selectKind==="entity"&&(E==null?void 0:E.kind)==="attribute"&&E.entityId===b.selectId}function g(b,E){if(b.attrRef){const y=E.shiftKey?"range":E.metaKey||E.ctrlKey?"toggle":"replace";i.selectAttribute(b.attrRef.entityId,b.attrRef.attrId,y)}else b.selectKind&&b.selectId&&(i.selection.value={kind:b.selectKind,id:b.selectId});b.focusId&&i.requestFocus(b.focusId)}function N(b){b.selectKind==="entity"&&b.selectId&&Ei(a,i,b.selectId)}return(b,E)=>(n.openBlock(),n.createElementBlock("section",qN,[n.createElementVNode("div",KN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:y,depth:C})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":h(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+C*14+"px"}),onClick:Z=>g(y,Z),onDblclick:Z=>N(y)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!y.children.length,"is-open":!s.value.has(y.key)}]),onClick:n.withModifiers(Z=>y.children.length&&c(y.key),["stop"])},[y.children.length?(n.openBlock(),n.createBlock(Ie,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,jN),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",JN,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ie,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",QN,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,ZN)):(n.openBlock(),n.createBlock(Ie,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",ex,n.toDisplayString(y.label),1)],46,XN))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),tx={class:"em-text-preview"},nx={class:"em-text-preview__pre"},ox={class:"em-text-preview__actions"},ix=Te(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=ae.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.showNotification("복사에 실패했습니다.","error")}}return(a,l)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",tx,[n.createElementVNode("pre",nx,n.toDisplayString(t.text),1),n.createElementVNode("div",ox,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:l[0]||(l[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),ax={class:"em-toolbar"},lx={class:"em-toolbar__mode"},Nu=Te(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ae.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){const m=i.state.logical.entities.length;i.addEntity("NewEntity",{x:80+m*40,y:80+m*30})}function d(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const u=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(h=>h.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function p(){l.openModal({component:ix,bind:{text:Ul(i.state.logical)}})}return(m,h)=>(n.openBlock(),n.createElementBlock("div",ax,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:h[0]||(h[0]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:h[1]||(h[1]=g=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"redo",size:16})]),_:1},8,["disabled"]),h[10]||(h[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"엔티티 추가",disabled:!n.unref(i).editable.value,onClick:c},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"add-entity",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:h[2]||(h[2]=g=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),h[11]||(h[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",lx,[h[8]||(h[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":h[3]||(h[3]=g=>s.value=g),items:r,"value-provider":g=>g.v,"label-provider":g=>g.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:d},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:h[4]||(h[4]=g=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:h[5]||(h[5]=g=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:u.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ie,{name:u.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),h[12]||(h[12]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:p},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:h[6]||(h[6]=g=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"image",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[h[9]||(h[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:h[7]||(h[7]=g=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b9382781"]]),rx=Te(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,a)=>(n.openBlock(),n.createBlock(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:a[0]||(a[0]=l=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),sx=["disabled"],cx={class:"em-panel__sub"},dx=["data-attr-block"],ux={class:"em-attr__row"},fx={key:0,class:"em-attr__row"},mx={class:"em-attr__row"},px={class:"em-attr__row"},hx={class:"em-attr__flags"},yx={class:"em-attr__pii"},gx={class:"em-attr__pii"},bx={class:"em-attr__pii"},_x={key:0,class:"em-attr__pii em-attr__codetop"},vx={class:"em-multilang"},wx={key:2,class:"em-embed-cols"},Ex={class:"em-embed-col__label"},kx={class:"em-attr__row"},Nx={class:"em-attr__row"},xx={key:0,class:"em-embed-upd"},$x={class:"em-embed-upd"},Sx={class:"em-embed-upd"},Ix={class:"em-swatch__row em-attr__swatch"},Cx=["onClick"],Rx=["title","onClick"],Vx={key:0,class:"em-attr__swatch-hint"},Ki="__OWN__",Ax=Te(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>{var $;return(($=o.selectedAttr.value)==null?void 0:$.attrId)??null}),s=n.computed(()=>new Set(o.selectedAttrIds.value)),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(D=>D.attrType!=="DIVIDER"))??[]}),d=n.ref(null);n.watch(r,async $=>{var D,M;$&&(await n.nextTick(),(M=(D=d.value)==null?void 0:D.querySelector(`[data-attr-block="${$}"]`))==null||M.scrollIntoView({block:"nearest",behavior:"smooth"}))});const u=["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 f($){return $==="none"?"(없음)":$}const p=$=>$;function m($){var D,M;return We((M=(D=a.value)==null?void 0:D.attributeStyles)==null?void 0:M[$.modelId])}function h($){return s.value.size>1&&s.value.has($.modelId)}function g($,D){if(!i.value)return;const M=h($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,M,D)}function N($,D){i.value&&o.updateAttribute(i.value.modelId,$.modelId,D)}function b($){return!!$.transient}const E=$=>$.value,y=$=>$.label;function C($,D){if(!D)return;const M=J.value.find(L=>L.type===D);if(M){const L=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};N($,{type:D,customType:void 0,dbAttrs:[{...L,dataType:M.dataType,length:M.length,scale:M.scale}]});return}N($,D===Ht?{type:D}:{type:D,customType:void 0})}function Z($,D){N($,{customType:D.trim()===""?void 0:D})}function q($,D){const M=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};N($,{dbAttrs:[{...M,...D}]})}function te($,D,M){var L;q($,{logicalName:{...(L=$.dbAttrs[0])==null?void 0:L.logicalName,[D]:M}})}function P($,D){N($,{description:Object.keys(D).length?D:void 0})}function oe($){return $.personalInfoAttributeType??"none"}function z($,D){N($,{personalInfoAttributeType:D==="none"?void 0:D})}const J=n.computed(()=>o.predefinedCustomTypeCatalog.value),W=n.computed(()=>o.embeddableCatalog.value),ge=n.ref(void 0);function _($){var D,M;return((D=$.label)==null?void 0:D.ko)??((M=$.label)==null?void 0:M.en)??$.type}function w($){!$||!i.value||(o.addPredefinedEmbed(i.value.modelId,$),ge.value=void 0)}const k=n.computed(()=>o.groupCodeCatalog.value);function K($){var D;return((D=k.value.find(M=>M.groupCode===$.groupCode))==null?void 0:D.codes)??[]}function V($){return["none",...K($)]}function H($){return $==="none"?"none":$.code}function U($){var M,L;if($==="none")return"(없음)";const D=((M=$.label)==null?void 0:M.ko)??((L=$.label)==null?void 0:L.en);return D?`${$.code} (${D})`:$.code}function ce($,D){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,D)}function he($,D){N($,{defaultValue:D==="none"?void 0:D})}function me($,D){N($,{defaultValue:D.trim()===""?void 0:D})}function be($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function ue($,D,M){const L=$.dbAttrs.map((j,se)=>{if(se!==D)return j;const fe={...j,...M};for(const de of Object.keys(M))M[de]===void 0&&delete fe[de];return fe});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,L)}function X($,D,M,L){var j;ue($,D,{logicalName:{...(j=$.dbAttrs[D])==null?void 0:j.logicalName,[M]:L}})}function F($,D){var j,se,fe;if($.attrType==="EMBED_PREDEF"){const de=(j=o.embeddableCatalog.value.find(xe=>xe.type===$.type))==null?void 0:j.fields[D];return de?{name:de.name,physicalName:de.physicalName,dataType:de.dataType,length:de.length,shareable:de.shareable,logicalName:de.logicalName}:void 0}const M=(se=$.embedded)==null?void 0:se.embeddableRef;if(!M)return;const L=(fe=o.state.logical.entities.find(de=>de.modelId===M))==null?void 0:fe.attributes.flatMap(de=>de.dbAttrs)[D];return L?{physicalName:L.physicalName,dataType:L.dataType,length:L.length,scale:L.scale,logicalName:L.logicalName}:void 0}function le($,D){var M,L;return((M=F($,D))==null?void 0:M.dataType)||((L=$.dbAttrs[D])==null?void 0:L.dataType)||""}function ve($,D){var M,L;return((M=F($,D))==null?void 0:M.length)??((L=$.dbAttrs[D])==null?void 0:L.length)}function we($,D){var M,L;return((M=F($,D))==null?void 0:M.scale)??((L=$.dbAttrs[D])==null?void 0:L.scale)}const pe=["inherit","true","false"];function ye($){return $==="inherit"?"기본(따름)":$}function ee($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function O($,D,M){ue($,D,{updatable:M==="inherit"?void 0:M==="true"})}function B($,D){q($,{updatable:D==="inherit"?void 0:D==="true"})}const Y=["inherit","true","false"];function ie($){return $==="inherit"?"기본(따름)":$}function ne($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function v($,D,M){ue($,D,{insertable:M==="inherit"?void 0:M==="true"})}function S($,D){q($,{insertable:D==="inherit"?void 0:D==="true"})}const G=n.computed(()=>{var $;return On((($=i.value)==null?void 0:$.attributes.flatMap(D=>D.dbAttrs))??[])}),x=n.computed(()=>{var $;return((($=i.value)==null?void 0:$.attributes)??[]).filter(D=>D.attrType==="NORMAL"&&D.dbAttrs.length===1&&D.dbAttrs[0]).map(D=>({modelId:D.dbAttrs[0].modelId,label:D.dbAttrs[0].physicalName||D.name}))});function T(){return[Ki,...x.value.map($=>$.modelId)]}function R($){if($===Ki)return"전용 컬럼(OWN)";const D=x.value.find(M=>M.modelId===$);return D?`↗ ${D.label} (공유)`:$}function re($){return($==null?void 0:$.sharedColumnRef)??Ki}function I($,D,M){ue($,D,{sharedColumnRef:M===Ki?void 0:M})}function A($){return($==null?void 0:$.sharedColumnRef)!=null}function Q($){var D;return((D=Vo($,G.value))==null?void 0:D.physicalName)??""}return($,D)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,ref_key:"sectionEl",ref:d,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",cx,[n.createTextVNode("속성 ("+n.toDisplayString(c.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:D[0]||(D[0]=M=>n.unref(o).addAttribute(i.value.modelId))}),W.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":ge.value,items:W.value,"value-provider":M=>M.type,"label-provider":_,"onUpdate:modelValue":w},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,M=>{var L,j,se,fe,de,xe,Re,Se,Ae,tt,Ut;return n.openBlock(),n.createElementBlock("div",{key:M.modelId,class:n.normalizeClass(["em-attr",{"is-focused":s.value.has(M.modelId)}]),"data-attr-block":M.modelId},[n.createElementVNode("div",ux,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${M.modelId}`,width:"100%",placeholder:"이름","model-value":M.name,"onUpdate:modelValue":_e=>N(M,{name:_e})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${M.modelId}`,width:"84px",placeholder:"타입",disabled:M.attrType.startsWith("EMBED")||!!M.groupCode,items:n.unref(ql)(M.type,J.value),"value-provider":E,"label-provider":y,"model-value":M.type,"onUpdate:modelValue":_e=>C(M,_e)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>n.unref(o).removeAttribute(i.value.modelId,M.modelId)},null,8,["onClick"])]),M.type===n.unref(Ht)?(n.openBlock(),n.createElementBlock("div",fx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${M.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":M.customType??"","onUpdate:modelValue":_e=>Z(M,_e)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),be(M)?(n.openBlock(),n.createElementBlock("div",wx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.dbAttrs,(_e,Le)=>{var He,Eo,ko,No,xo,$o,So;return n.openBlock(),n.createElementBlock("div",{key:_e.modelId,class:"em-embed-col"},[n.createElementVNode("span",Ex,n.toDisplayString(((He=F(M,Le))==null?void 0:He.name)??((Eo=F(M,Le))==null?void 0:Eo.physicalName)??`컬럼 ${Le+1}`),1),n.createElementVNode("div",kx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${_e.modelId}`,width:"100%",disabled:A(_e),placeholder:((ko=F(M,Le))==null?void 0:ko.physicalName)??"컬럼","model-value":A(_e)?Q(_e):_e.physicalName,"onUpdate:modelValue":Xe=>ue(M,Le,{physicalName:Xe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSTextInput),{name:`embed-dtype-${_e.modelId}`,width:"84px",disabled:"","model-value":le(M,Le)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${_e.modelId}`,width:"48px",disabled:"","model-value":ve(M,Le)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${_e.modelId}`,width:"48px",disabled:"","model-value":we(M,Le)},null,8,["name","model-value"])]),n.createVNode(an,{controller:n.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Nx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${_e.modelId}`,width:"100%",placeholder:((xo=(No=F(M,Le))==null?void 0:No.logicalName)==null?void 0:xo.ko)??"논리명","model-value":(($o=_e.logicalName)==null?void 0:$o.ko)??"","onUpdate:modelValue":Xe=>X(M,Le,"ko",Xe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(So=F(M,Le))!=null&&So.shareable?(n.openBlock(),n.createElementBlock("label",xx,[D[7]||(D[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":re(_e),items:T(),"value-provider":p,"label-provider":R,"onUpdate:modelValue":Xe=>Xe&&I(M,Le,Xe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",$x,[D[8]||(D[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:A(_e),"model-value":A(_e)?"false":ne(_e),items:Y,"value-provider":p,"label-provider":ie,"onUpdate:modelValue":Xe=>Xe&&v(M,Le,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Sx,[D[9]||(D[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:A(_e),"model-value":A(_e)?"false":ee(_e),items:pe,"value-provider":p,"label-provider":ye,"onUpdate:modelValue":Xe=>Xe&&O(M,Le,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",mx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${M.modelId}`,width:"100%",placeholder:"논리명","model-value":((j=(L=M.dbAttrs[0])==null?void 0:L.logicalName)==null?void 0:j.ko)??"","onUpdate:modelValue":_e=>te(M,"ko",_e)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",px,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${M.modelId}`,width:"100%",placeholder:"컬럼",disabled:b(M),"model-value":((se=M.dbAttrs[0])==null?void 0:se.physicalName)??"","onUpdate:modelValue":_e=>q(M,{physicalName:_e})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${M.modelId}`,width:"84px",placeholder:"dataType",disabled:b(M),items:n.unref(Gl)(((fe=M.dbAttrs[0])==null?void 0:fe.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":p,"label-provider":n.unref(na),"model-value":((de=M.dbAttrs[0])==null?void 0:de.dataType)??"","onUpdate:modelValue":_e=>_e&&q(M,{dataType:_e})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${M.modelId}`,width:"48px",placeholder:"len",disabled:b(M),"model-value":(xe=M.dbAttrs[0])==null?void 0:xe.length,"onUpdate:modelValue":_e=>q(M,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${M.modelId}`,width:"48px",placeholder:"scale",disabled:b(M),"model-value":(Re=M.dbAttrs[0])==null?void 0:Re.scale,"onUpdate:modelValue":_e=>q(M,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(an,{controller:n.unref(o),"ref-id":(Se=M.dbAttrs[0])==null?void 0:Se.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",hx,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${M.modelId}`,label:"Primary Key","model-value":M.identifier,disabled:l.value||b(M),"onUpdate:modelValue":_e=>N(M,{identifier:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${M.modelId}`,label:"Not Null","model-value":M.notNull,disabled:b(M),"onUpdate:modelValue":_e=>N(M,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${M.modelId}`,label:"Unique","model-value":!!((Ae=M.dbAttrs[0])!=null&&Ae.unique),disabled:b(M),"onUpdate:modelValue":_e=>q(M,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${M.modelId}`,label:"Auto Increment","model-value":!!((tt=M.dbAttrs[0])!=null&&tt.autoIncrement),disabled:b(M)||!M.identifier,"onUpdate:modelValue":_e=>q(M,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${M.modelId}`,label:"@Transient","model-value":!!M.transient,disabled:M.identifier,"onUpdate:modelValue":_e=>N(M,{transient:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${M.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ut=M.dbAttrs[0])!=null&&Ut.multiValue),disabled:b(M),"onUpdate:modelValue":_e=>q(M,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",yx,[D[1]||(D[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:b(M),"model-value":ne(M.dbAttrs[0]),items:Y,"value-provider":p,"label-provider":ie,"onUpdate:modelValue":_e=>_e&&S(M,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",gx,[D[2]||(D[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:b(M),"model-value":ee(M.dbAttrs[0]),items:pe,"value-provider":p,"label-provider":ye,"onUpdate:modelValue":_e=>_e&&B(M,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",bx,[D[3]||(D[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":oe(M),items:u,"value-provider":p,"label-provider":f,"onUpdate:modelValue":_e=>_e&&z(M,_e)},null,8,["model-value","onUpdate:modelValue"])]),k.value.length?(n.openBlock(),n.createElementBlock("label",_x,[D[4]||(D[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(od,{"model-value":M.groupCode,items:k.value,"onUpdate:modelValue":_e=>ce(M,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!k.value.length}])},[D[5]||(D[5]=n.createElementVNode("span",null,"기본값",-1)),K(M).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":M.defaultValue??"none",items:V(M),"value-provider":H,"label-provider":U,"onUpdate:modelValue":_e=>_e&&he(M,_e)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${M.modelId}`,width:"100%",placeholder:"기본값","model-value":M.defaultValue??"","onUpdate:modelValue":_e=>me(M,_e)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",vx,[D[6]||(D[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(al,{multiline:"",name:`attr-desc-${M.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":M.description,"onUpdate:modelValue":_e=>P(M,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",Ix,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":m(M)===null}]),title:"없음",onClick:_e=>g(M,null)},"∅",10,Cx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),_e=>(n.openBlock(),n.createElementBlock("button",{key:_e,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":m(M)===_e}]),style:n.normalizeStyle({background:n.unref(Sn)(_e)}),title:n.unref($n)(_e),onClick:Le=>g(M,_e)},null,14,Rx))),128)),h(M)?(n.openBlock(),n.createElementBlock("span",Vx,"선택 "+n.toDisplayString(s.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,dx)}),128))],8,sx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4383b724"]]),Tx=["disabled"],Mx={class:"em-panel__sub"},Bx={class:"em-attr__row"},Dx={class:"em-field em-idx-params"},Ox=["value","onChange"],Lx=Te(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(f=>f.modelId===t.entityId)??null);function a(){var p;if(!i.value)return;const f=i.value.attributes[0];o.addIndex(i.value.modelId,{modelId:Ce(),name:`idx_${(((p=i.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:f?[{columnRef:f.modelId,descending:!1}]:[]})}function l(f,p){i.value&&o.updateIndex(i.value.modelId,f,p)}function r(f){var m;const p=(m=i.value)==null?void 0:m.attributes[0];p&&l(f.modelId,{columns:[...f.columns,{columnRef:p.modelId,descending:!1}]})}function s(f,p,m){l(f.modelId,{columns:f.columns.map((h,g)=>g===p?{...h,columnRef:m}:h)})}function c(f,p,m){l(f.modelId,{columns:f.columns.map((h,g)=>g===p?{...h,descending:m}:h)})}function d(f,p){l(f.modelId,{columns:f.columns.filter((m,h)=>h!==p)})}function u(f,p){l(f.modelId,{parameters:p.trim()===""?void 0:p})}return(f,p)=>{var m;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Mx,[n.createTextVNode("인덱스 ("+n.toDisplayString(((m=i.value.indexes)==null?void 0:m.length)??0)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:a})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.indexes??[],h=>(n.openBlock(),n.createElementBlock("div",{key:h.modelId,class:"em-attr"},[n.createElementVNode("div",Bx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${h.modelId}`,width:"100%",placeholder:"인덱스명","model-value":h.name,"onUpdate:modelValue":g=>l(h.modelId,{name:g})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${h.modelId}`,class:"em-check",label:"UQ","model-value":h.unique,"onUpdate:modelValue":g=>l(h.modelId,{unique:g})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:g=>n.unref(o).removeIndex(i.value.modelId,h.modelId)},null,8,["onClick"])]),n.createVNode(an,{controller:n.unref(o),"ref-id":h.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.columns,(g,N)=>(n.openBlock(),n.createElementBlock("div",{key:N,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":g.columnRef,items:i.value.attributes,"value-provider":b=>b.modelId,"label-provider":b=>b.name,"onUpdate:modelValue":b=>b&&s(h,N,b)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${h.modelId}-desc-${N}`,class:"em-check",label:"DESC","model-value":g.descending,"onUpdate:modelValue":b=>c(h,N,b)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:b=>d(h,N)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:g=>r(h)},null,8,["onClick"]),n.createElementVNode("label",Dx,[p[0]||(p[0]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:h.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:g=>u(h,g.target.value)},null,40,Ox)])]))),128))],8,Tx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-63401907"]]),Px=["disabled"],zx={class:"em-panel__sub"},Ux={class:"em-attr__row"},Hx={class:"em-attr__row"},Fx={class:"em-multilang"},Gx={class:"em-attr__pii"},Yx={class:"em-swatch__row em-attr__swatch"},Wx=["onClick"],qx=["title","onClick"],Kx=Te(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ae.useModal(),a=n.computed(()=>o.state.logical.entities.find(b=>b.modelId===t.entityId)??null),l=n.computed(()=>a.value?o.state.layout.entityLayouts.find(b=>b.entityRef===a.value.modelId)??null:null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],s=["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 c(b){return b==="none"?"(없음)":b}const d=b=>b;function u(b,E){a.value&&o.updateOperation(a.value.modelId,b.modelId,E)}function f(b,E){u(b,{description:Object.keys(E).length?E:void 0})}function p(b){return b.personalInfoAttributeType??"none"}function m(b,E){u(b,{personalInfoAttributeType:E==="none"?void 0:E})}function h(b){var E,y;return We((y=(E=l.value)==null?void 0:E.operationStyles)==null?void 0:y[b.modelId])}function g(b,E){a.value&&o.setOperationSwatch(a.value.modelId,b.modelId,E)}function N(b){i.openModal({component:id,bind:{operationName:b.name,sourceCode:b.sourceCode??"",onSave:E=>u(b,{sourceCode:E})}})}return(b,E)=>{var y;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",zx,[n.createTextVNode("오퍼레이션 ("+n.toDisplayString(((y=a.value.operations)==null?void 0:y.length)??0)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:E[0]||(E[0]=C=>n.unref(o).addOperation(a.value.modelId))})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],C=>(n.openBlock(),n.createElementBlock("div",{key:C.modelId,class:"em-attr"},[n.createElementVNode("div",Ux,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${C.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":C.name,"onUpdate:modelValue":Z=>u(C,{name:Z})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":C.visibility??"PACKAGE",items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":Z=>Z&&u(C,{visibility:Z})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Z=>n.unref(o).removeOperation(a.value.modelId,C.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Hx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:C.sourceCode?"본문 편집 ●":"본문 편집",onClick:Z=>N(C)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Fx,[E[1]||(E[1]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(al,{multiline:"",name:`op-desc-${C.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":C.description,"onUpdate:modelValue":Z=>f(C,Z)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Gx,[E[2]||(E[2]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":p(C),items:s,"value-provider":d,"label-provider":c,"onUpdate:modelValue":Z=>Z&&m(C,Z)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Yx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":h(C)===null}]),title:"없음",onClick:Z=>g(C,null)},"∅",10,Wx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),Z=>(n.openBlock(),n.createElementBlock("button",{key:Z,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":h(C)===Z}]),style:n.normalizeStyle({background:n.unref(Sn)(Z)}),title:n.unref($n)(Z),onClick:q=>g(C,Z)},null,14,qx))),128))])]))),128))],8,Px)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-cd38ffcd"]]),Xx={class:"em-panel__head"},jx={class:"em-panel__head-row"},Zx={class:"em-panel__context"},Jx=["disabled"],Qx={key:0,class:"em-panel__note"},e$={key:1,class:"em-panel__note"},t$={key:2,class:"em-jpa"},n$={class:"em-field"},o$={class:"em-field"},i$={key:0,class:"em-field"},a$={class:"em-panel__sub"},l$={class:"em-field"},r$={class:"em-jpa"},s$={key:0,class:"em-panel__note"},c$={class:"em-jpa"},d$={class:"em-field"},u$={key:0,class:"em-panel__note"},f$={class:"em-field"},m$={class:"em-multilang"},p$={class:"em-field"},h$=["value"],y$={class:"em-field"},g$={class:"em-swatch"},b$={class:"em-swatch__row"},_$=["title","onClick"],v$={class:"em-panel__note"},w$={class:"em-field"},E$=["value"],k$={class:"em-swatch"},N$={class:"em-swatch__row"},x$=["title","onClick"],xu=Te(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.selection.value),r=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const X=r.value;return X?a.state.logical.entities.find(F=>F.modelId===X)??null:null}),c=n.computed(()=>{var X;return((X=a.selectedAttr.value)==null?void 0:X.attrId)??null}),d=n.computed(()=>new Set(a.selectedAttrIds.value)),u=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="association"?a.state.logical.associations.find(F=>F.modelId===X.id)??null:null}),f=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="group"?a.state.logical.groups.find(F=>F.modelId===X.id)??null:null}),p=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="note"?a.state.layout.notes.find(F=>F.modelId===X.id)??null:null}),m=n.computed(()=>{var F,le;const X=(F=f.value)==null?void 0:F.name;return(X==null?void 0:X.ko)||(X==null?void 0:X.en)||(X==null?void 0:X.ja)||(X==null?void 0:X.zh)||((le=f.value)==null?void 0:le.packageName)||"그룹"}),h=n.computed(()=>{if(s.value){const X=d.value.size;if(X>1)return`엔티티 · ${s.value.name} › 속성 · ${X}개`;if(c.value){const F=s.value.attributes.find(le=>le.modelId===c.value);return(F==null?void 0:F.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(F==null?void 0:F.name)??""}`}return`엔티티 · ${s.value.name}`}if(u.value){const X=F=>{var le;return((le=a.state.logical.entities.find(ve=>ve.modelId===F))==null?void 0:le.name)??F};return`관계 · ${X(u.value.end1.entityRef)} — ${X(u.value.end2.entityRef)}`}return f.value?`그룹 · ${m.value}`:p.value?"노트":"선택된 항목 없음"}),g=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],N=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],b=["LIST","SET"],E=["inherit","LAZY","EAGER"],y=X=>X;function C(X){return X==="inherit"?"기본(따름)":X}const Z=n.computed(()=>!!u.value&&u.value.end1.entityRef===u.value.end2.entityRef);function q(X,F){u.value&&a.updateAssociationEnd(u.value.modelId,X,F)}function te(X){u.value&&!Z.value&&a.setAssociationIdentifying(u.value.modelId,X)}function P(X){var F,le,ve;return!!((ve=(le=(F=u.value)==null?void 0:F[X].jpa)==null?void 0:le.cascadeTypes)!=null&&ve.includes("ALL"))}function oe(X,F,le){var pe,ye;const ve=(pe=u.value)==null?void 0:pe[X];if(F==="ALL"&&le){q(X,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const we=new Set(((ye=ve==null?void 0:ve.jpa)==null?void 0:ye.cascadeTypes)??[]);le?we.add(F):we.delete(F),q(X,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...we]}})}function z(X,F){var ve;const le=(ve=u.value)==null?void 0:ve[X];q(X,{jpa:{...le==null?void 0:le.jpa,...F}})}function J(X){var F,le;return((le=(F=u.value)==null?void 0:F[X].jpa)==null?void 0:le.fetchType)??"inherit"}function W(X,F){z(X,{fetchType:F==="inherit"?void 0:F})}function ge(X){var le;const F=(le=u.value)==null?void 0:le[X==="end1"?"end2":"end1"];return(F==null?void 0:F.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(F==null?void 0:F.multiplicity)==="ONE_OR_MORE_INSTANCES"}const _=n.computed(()=>{const X=u.value;if(!X)return null;for(const F of a.state.logical.entities){const le=F.attributes.find(pe=>{var ye;return((ye=pe.embedded)==null?void 0:ye.associationRef)===X.modelId&&pe.attrType==="EMBED_OWN"});if(!le)continue;const ve=X.end2.entityRef===le.embedded.embeddableRef?"end2":"end1",we=X[ve].jpa;return{which:ve,isCollection:X[ve].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(we==null?void 0:we.collectionType)??"LIST",collectionTable:(we==null?void 0:we.collectionTable)??"",orderColumn:(we==null?void 0:we.orderColumn)??""}}return null});function w(X){u.value&&a.setEmbedCollectionMode(u.value.modelId,X?"COLLECTION":"SINGLE")}function k(X){const F=_.value;F&&z(F.which,X==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function K(X){const F=_.value;F&&z(F.which,{collectionTable:X.trim()||void 0})}function V(X){const F=_.value;F&&z(F.which,{orderColumn:X.trim()||void 0})}function H(X){f.value&&a.updateGroup(f.value.modelId,X)}function U(X,F){var le;H({name:{...(le=f.value)==null?void 0:le.name,[X]:F}})}const ce=n.computed(()=>{var X;return f.value?We((X=a.state.layout.groupLayouts.find(F=>F.groupRef===f.value.modelId))==null?void 0:X.style):null});function he(X){f.value&&a.setGroupSwatch(f.value.modelId,X)}function me(X){p.value&&a.setNoteMemo(p.value.modelId,X)}const be=n.computed(()=>{var X;return We((X=p.value)==null?void 0:X.style)});function ue(X){p.value&&a.setNoteSwatch(p.value.modelId,X)}return(X,F)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:F[0]||(F[0]=(...le)=>e.startResize&&e.startResize(...le))},null,34),n.createElementVNode("header",Xx,[n.createElementVNode("div",jx,[F[9]||(F[9]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:F[1]||(F[1]=le=>i("collapse"))},[n.createVNode(Ie,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",Zx,n.toDisplayString(h.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(td,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Ax,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Lx,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Kx,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"])],64)):n.createCommentVNode("",!0),u.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ae.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!u.value.identifying,disabled:Z.value||!!_.value,"onUpdate:modelValue":te},null,8,["model-value","disabled"]),Z.value?(n.openBlock(),n.createElementBlock("p",Qx,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):_.value?(n.openBlock(),n.createElementBlock("p",e$,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock("fieldset",t$,[F[13]||(F[13]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":_.value.isCollection,"onUpdate:modelValue":w},null,8,["model-value"]),_.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",n$,[F[10]||(F[10]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":_.value.collectionType,items:b,"value-provider":y,"label-provider":y,"onUpdate:modelValue":F[2]||(F[2]=le=>le&&k(le))},null,8,["model-value"])]),n.createElementVNode("label",o$,[F[11]||(F[11]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":_.value.collectionTable,"onUpdate:modelValue":K},null,8,["model-value"])]),_.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",i$,[F[12]||(F[12]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":_.value.orderColumn,"onUpdate:modelValue":V},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),F[14]||(F[14]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],le=>{var ve,we,pe,ye;return n.createElementVNode("div",{key:le,class:"em-end"},[n.createElementVNode("h4",a$,n.toDisplayString(le)+" → "+n.toDisplayString(u.value[le].entityRef),1),n.createElementVNode("label",l$,[F[15]||(F[15]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":u.value[le].multiplicity,items:g,"value-provider":y,"label-provider":y,disabled:((ve=_.value)==null?void 0:ve.which)===le,"onUpdate:modelValue":ee=>q(le,{multiplicity:ee})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${le}-navigable`,class:"em-check",label:"navigable","model-value":u.value[le].navigable,"onUpdate:modelValue":ee=>q(le,{navigable:ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${le}-composition`,class:"em-check",label:"composition","model-value":u.value[le].composition,"onUpdate:modelValue":ee=>q(le,{composition:ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",r$,[F[16]||(F[16]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(N,ee=>{var O,B;return n.createVNode(n.unref(ae.BSCheckbox),{key:ee,name:`${le}-cascade-${ee}`,class:"em-check",label:ee,"model-value":!!((B=(O=u.value[le].jpa)==null?void 0:O.cascadeTypes)!=null&&B.includes(ee)),disabled:ee!=="ALL"&&P(le),"onUpdate:modelValue":Y=>oe(le,ee,Y)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),P(le)?(n.openBlock(),n.createElementBlock("p",s$,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",c$,[F[19]||(F[19]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",d$,[F[17]||(F[17]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":J(le),items:E,"value-provider":y,"label-provider":C,"onUpdate:modelValue":ee=>ee&&W(le,ee)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${le}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((we=u.value[le].jpa)!=null&&we.orphanRemoval),disabled:ge(le),"onUpdate:modelValue":ee=>z(le,{orphanRemoval:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ge(le)&&((pe=u.value[le].jpa)!=null&&pe.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",u$,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",f$,[F[18]||(F[18]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${le}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((ye=u.value[le].jpa)==null?void 0:ye.orderBy)??"","onUpdate:modelValue":ee=>z(le,{orderBy:ee.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),f.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",m$,[F[20]||(F[20]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,le=>{var ve;return n.openBlock(),n.createElementBlock("label",{key:le,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(le),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${le}`,width:"100%","model-value":((ve=f.value.name)==null?void 0:ve[le])??"","onUpdate:modelValue":we=>U(le,we)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",p$,[F[21]||(F[21]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:f.value.description??"",rows:"3",onChange:F[3]||(F[3]=le=>H({description:le.target.value}))},null,40,h$)]),n.createElementVNode("label",y$,[F[22]||(F[22]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":f.value.packageName??"","onUpdate:modelValue":F[4]||(F[4]=le=>H({packageName:le}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":f.value.excludeDDLGeneration,"onUpdate:modelValue":F[5]||(F[5]=le=>H({excludeDDLGeneration:le}))},null,8,["model-value"]),n.createElementVNode("fieldset",g$,[F[23]||(F[23]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",b$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ce.value===null}]),title:"없음",onClick:F[6]||(F[6]=le=>he(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),le=>(n.openBlock(),n.createElementBlock("button",{key:le,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ce.value===le}]),style:n.normalizeStyle({background:n.unref(Sn)(le)}),title:n.unref($n)(le),onClick:ve=>he(le)},null,14,_$))),128))])]),n.createElementVNode("p",v$,"멤버 엔티티 "+n.toDisplayString(f.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),p.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",w$,[F[24]||(F[24]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:p.value.memo,rows:"6",onChange:F[7]||(F[7]=le=>me(le.target.value))},null,40,E$)]),n.createElementVNode("fieldset",k$,[F[25]||(F[25]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",N$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":be.value===null}]),title:"없음",onClick:F[8]||(F[8]=le=>ue(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(on),le=>(n.openBlock(),n.createElementBlock("button",{key:le,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":be.value===le}]),style:n.normalizeStyle({background:n.unref(Sn)(le)}),title:n.unref($n)(le),onClick:ve=>ue(le)},null,14,x$))),128))])])],64)):n.createCommentVNode("",!0)],8,Jx)],4))}}),[["__scopeId","data-v-d86834f4"]]),$$={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function S$(e){const t=e.split("-")[1];return t?$$[t]??t:e}function I$(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const C$=["title"],R$=["title","onClick"],V$={key:0,class:"em-validation__body"},A$={class:"em-validation__opt"},T$={key:0,class:"em-validation__empty"},M$={key:1,class:"em-validation__empty"},B$={key:2,class:"em-validation__list"},D$=["onClick"],O$={class:"em-validation__item-msg"},L$={key:0,class:"em-validation__item-entity"},P$=["title"],z$=Te(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const N of o.state.logical.entities)g.set(N.modelId,N.name);return g});function l(g){const N=I$(g);if(!N)return null;const b=a.value.get(N);return b===void 0?null:b.trim()===""?"(이름 없음)":b}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const N of i.value)g[N.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,N)=>r[g.severity].order-r[N.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:l(g),category:S$(g.ruleId)}))),f=n.ref(!1);function p(g){c.value[g]=!c.value[g]}function m(g){if(!f.value){f.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,N)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:N[1]||(N[1]=b=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ie,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),N[3]||(N[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,C$),n.createElementVNode("div",{class:"em-validation__counts",onClick:N[0]||(N[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:f.value?`${r[b].label} ${c.value[b]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:E=>m(b)},[n.createVNode(Ie,{name:r[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,R$)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",V$,[n.createElementVNode("label",A$,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":N[2]||(N[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",T$,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",M$," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",B$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:E,category:y},C)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${C}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:Z=>h(b)},[n.createVNode(Ie,{name:r[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",O$,[E?(n.openBlock(),n.createElementBlock("span",L$,n.toDisplayString(E),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(y),9,P$)],10,D$))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),U$={class:"em-history"},H$={class:"em-history__head"},F$={class:"em-history__title"},G$={class:"em-history__head-actions"},Y$=["disabled"],W$={class:"em-history__filters"},q$={class:"em-history__filter"},K$={class:"em-history__body"},X$={key:0,class:"em-history__empty"},j$={key:1,class:"em-history__empty is-error"},Z$={key:2,class:"em-history__empty"},J$={key:3,class:"em-history__list"},Q$=["onClick"],eS={class:"em-history__summary"},tS={class:"em-history__seq"},nS={class:"em-history__gmeta"},oS={class:"em-history__who"},iS={key:0,class:"em-history__time"},aS={key:1,class:"em-history__restored-from"},lS={key:0,class:"em-history__detail"},rS={class:"em-history__action-head"},sS={class:"em-history__action-name"},cS={key:0,class:"em-history__fields"},dS={class:"em-history__fname"},uS={key:0,class:"em-history__old"},fS={class:"em-history__val"},mS={key:1,class:"em-history__restore"},pS=["disabled","onClick"],hS=["disabled"],yS=["onClick"],gS=Te(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.ref([]),r=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){r.value=!0,s.value=null;try{l.value=await a.historyTransport(),c.value=!0}catch(V){s.value=V instanceof Error?V.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,V=>{V&&u()},{immediate:!0});let f=null;n.watch(()=>a.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const p=n.computed(()=>new Map(a.state.logical.entities.map(V=>[V.modelId,V]))),m=n.computed(()=>new Map(a.state.logical.associations.map(V=>[V.modelId,V]))),h=n.computed(()=>new Map((a.state.logical.groups??[]).map(V=>{var H;return[V.modelId,V.packageName||((H=V.name)==null?void 0:H.ko)||V.modelId]})));function g(V){var he,me,be,ue,X,F,le;const H=m.value.get(V);if(!H)return"연관";if((he=H.description)!=null&&he.trim())return H.description.trim();const U=(ue=(be=p.value.get((me=H.end1)==null?void 0:me.entityRef))==null?void 0:be.name)==null?void 0:ue.trim(),ce=(le=(F=p.value.get((X=H.end2)==null?void 0:X.entityRef))==null?void 0:F.name)==null?void 0:le.trim();return U&&ce?`${U}→${ce}`:"연관"}function N(V){var H,U,ce,he;if(V.kind==="entity")return((U=(H=p.value.get(V.ref))==null?void 0:H.name)==null?void 0:U.trim())||"(이름 없음)";if(V.kind==="attribute"||V.kind==="operation"||V.kind==="index"){const me=V.entityRef?p.value.get(V.entityRef):void 0,ue=((V.kind==="attribute"?me==null?void 0:me.attributes:V.kind==="operation"?me==null?void 0:me.operations:me==null?void 0:me.indexes)??[]).find(F=>F.modelId===V.ref),X=(ce=me==null?void 0:me.name)==null?void 0:ce.trim();return`${X?X+".":""}${((he=ue==null?void 0:ue.name)==null?void 0:he.trim())||V.ref}`}return V.kind==="association"?g(V.ref):V.kind==="associationEnd"?`${g(V.ref)}(${V.end})`:V.kind==="group"?`그룹 ${h.value.get(V.ref)??V.ref}`:V.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},E={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),C=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],Z=n.computed({get:()=>y.value,set:V=>{V&&(y.value=V)}}),q=n.computed(()=>{let V=er(l.value);return y.value!=="all"&&(V=V.filter(H=>(H.kind??"edit")===y.value)),V});function te(V){return V===void 0?"—":V===null?"(비움)":typeof V=="object"?JSON.stringify(V):String(V)}function P(V){const H=N(V.subject);if(V.verb==="add")return`${H} 추가`;if(V.verb==="remove")return`${H} 삭제`;if(V.fields.length===1){const U=V.fields[0];return`${H}.${U.field} ${U.oldValue!==void 0?te(U.oldValue)+"→":""}${te(U.value)}`}return`${H} ${V.fields.length}개 변경`}function oe(V){return V.actions.length===0?"변경 없음":V.actions.length===1?P(V.actions[0]):`${P(V.actions[0])} 외 ${V.actions.length-1}건`}const z=n.ref(new Set);function J(V){const H=new Set(z.value);H.has(V)?H.delete(V):H.add(V),z.value=H}function W(V){if(V==null)return"";const H=new Date(V);return isNaN(H.getTime())?String(V):H.toLocaleString()}function ge(V){return V.author||(V.origin?`(${V.origin})`:"—")}const _=n.ref(null),w=n.ref(!1);function k(V){_.value=V}async function K(V){w.value=!0;try{const H=await a.restoreToSeq(V);H.ok||(s.value=`복원 실패: ${H.reason??"알 수 없음"}`)}finally{w.value=!1,_.value=null}}return(V,H)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",U$,[n.createElementVNode("header",H$,[n.createElementVNode("div",F$,[n.createVNode(Ie,{name:"undo",size:15}),H[4]||(H[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",G$,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:H[0]||(H[0]=U=>d())},[n.createVNode(Ie,{name:"redo",size:15})],8,Y$),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:H[1]||(H[1]=U=>i("close"))},[n.createVNode(Ie,{name:"panel-close",size:15})])])]),n.createElementVNode("div",W$,[n.createElementVNode("label",q$,[H[5]||(H[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:Z.value,"onUpdate:modelValue":H[2]||(H[2]=U=>Z.value=U),items:C,"value-provider":U=>U.v,"label-provider":U=>U.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",K$,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",X$,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",j$,n.toDisplayString(s.value),1)):q.value.length===0?(n.openBlock(),n.createElementBlock("p",Z$,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",J$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(q.value,U=>(n.openBlock(),n.createElementBlock("li",{key:U.seq,class:n.normalizeClass(["em-history__group",[`is-${U.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ce=>J(U.seq)},[n.createVNode(Ie,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":z.value.has(U.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${U.kind??"edit"}`])},n.toDisplayString(U.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",eS,n.toDisplayString(oe(U)),1),n.createElementVNode("span",tS,"#"+n.toDisplayString(U.seq),1)],8,Q$),n.createElementVNode("div",nS,[n.createElementVNode("span",oS,n.toDisplayString(ge(U)),1),U.ts?(n.openBlock(),n.createElementBlock("span",iS,n.toDisplayString(W(U.ts)),1)):n.createCommentVNode("",!0),U.kind==="restore"&&U.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",aS,"← #"+n.toDisplayString(U.restoredFromSeq),1)):n.createCommentVNode("",!0)]),z.value.has(U.seq)?(n.openBlock(),n.createElementBlock("div",lS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(U.actions,(ce,he)=>(n.openBlock(),n.createElementBlock("div",{key:he,class:"em-history__action"},[n.createElementVNode("div",rS,[n.createVNode(Ie,{name:b[ce.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",sS,n.toDisplayString(N(ce.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ce.verb}`])},n.toDisplayString(E[ce.verb]),3)]),ce.fields.length?(n.openBlock(),n.createElementBlock("ul",cS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.fields,(me,be)=>(n.openBlock(),n.createElementBlock("li",{key:be,class:"em-history__field"},[n.createElementVNode("span",dS,n.toDisplayString(me.field),1),me.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",uS,n.toDisplayString(te(me.oldValue)),1)):n.createCommentVNode("",!0),me.oldValue!==void 0?(n.openBlock(),n.createBlock(Ie,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",fS,n.toDisplayString(te(me.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value?(n.openBlock(),n.createElementBlock("div",mS,[_.value===U.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[H[6]||(H[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:w.value,onClick:ce=>K(U.seq)},"복원",8,pS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:w.value,onClick:H[3]||(H[3]=ce=>_.value=null)},"취소",8,hS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ce=>k(U.seq)},[n.createVNode(Ie,{name:"undo",size:12}),H[7]||(H[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,yS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-4ef62cf3"]]);function bS(e,t){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>=t?i:null}function $u(e){const t=n.ref(bS(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const l=a.clientX,r=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?l-d.clientX:d.clientX-l;let f=r+u;f=Math.max(e.min,f),e.max!=null&&(f=Math.min(e.max,f)),t.value=f},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(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const _S={class:"em-modeler"},vS={class:"em-modeler__body"},wS={class:"em-drawer__inner"},ES={class:"em-drawer__head"},kS={class:"em-drawer__actions"},NS=["title"],xS=Te(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:l,startResize:r}=$u({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=$u({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(p,m)=>{var h,g,N;return n.openBlock(),n.createElementBlock("div",_S,[n.createVNode(Nu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=b=>{var E;return(E=u.value)==null?void 0:E.exportSvg()}),onToggleHistory:m[1]||(m[1]=b=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",vS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",wS,[n.createElementVNode("header",ES,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",kS,[(h=f.value)!=null&&h.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=b=>{var E;return(E=f.value)==null?void 0:E.toggleAll()})},[n.createVNode(Ie,{name:(N=f.value)!=null&&N.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,NS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=b=>t.value=!1)},[n.createVNode(Ie,{name:"panel-close",size:16})])])]),n.createVNode(ku,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[4]||(m[4]=(...b)=>n.unref(r)&&n.unref(r)(...b))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[5]||(m[5]=b=>t.value=!0)},[n.createVNode(Ie,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(l),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(Eu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(xu,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[6]||(m[6]=b=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[7]||(m[7]=b=>o.value=!0)},[n.createVNode(Ie,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(gS,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=b=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(z$,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-dc519653"]]);ke.APPLY_MODEL_OPS_INPUT_SCHEMA=Tf,ke.AssociationEdge=$d,ke.CommandStack=sa,ke.DiagramCanvas=Eu,ke.DiagramExplorer=ku,ke.EDITOR=ln,ke.EditModeToggle=rx,ke.EditorToolbar=Nu,ke.EntityModeler=xS,ke.EntityNode=dd,ke.GroupNode=ud,ke.NoteNode=fd,ke.OpSyncAdapter=Lr,ke.PHYSICAL_NAME_MAX_LENGTH=ia,ke.PropertyPanel=xu,ke.RevCache=Or,ke.SYMBOLIC_OP_KINDS=Pr,ke.SYMBOLIC_OP_SCHEMA=qr,ke.anchoredEdgePoint=Qi,ke.buildAgentBatch=Mf,ke.buildDiagramSvg=vu,ke.buildOrthogonalPath=Xi,ke.buildSelfLoopPath=Dl,ke.buildStraightPath=Zi,ke.commands=mf,ke.computeAutoLayout=Ol,ke.createEditorController=E_,ke.displayLabel=Co,ke.emptyState=ld,ke.entityModelToText=Ul,ke.estimateEntityHeight=Pl,ke.exportDiagramSvg=wu,ke.fromPersisted=qf,ke.indexColumnsByModelId=On,ke.newId=Ce,ke.orthogonalMidpoints=ji,ke.packEntityBoxes=Tu,ke.physicalNameWarning=Ao,ke.projectActionLog=er,ke.projectEntityAudit=Jl,ke.projectFieldAudit=Rt,ke.rectExitPoint=Ji,ke.renderDiagramSvg=Fl,ke.resolveDiagram=Ml,ke.resolveSharedColumn=Vo,ke.resolveSymbolicOps=kf,ke.restoreDeepEqual=mn,ke.segmentMidpoints=ea,ke.sideDir=Bn,ke.synthesizeRestoreOps=of,ke.toPersisted=rm,ke.toPersistedV2=sm,ke.validateModel=jl,Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"})}));
|
|
39
|
+
v${-(j.value.height-2*e.maskBorderRadius)}
|
|
40
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(W=>{if(g.value){const K=Pt(g.value),T=me=>{if(me.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const ge=me.sourceEvent.ctrlKey&&so()?10:1,se=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,fe=d.value.zoom*2**(se*ge);m.value.scaleTo(p.value,fe)},oe=me=>{if(me.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const ge=Q.value*Math.max(1,d.value.zoom)*(e.inversePan?-1:1),se={x:d.value.x-me.sourceEvent.movementX*ge,y:d.value.y-me.sourceEvent.movementY*ge},fe=[[0,0],[u.value.width,u.value.height]],ye=Ra.translate(se.x,se.y).scale(d.value.zoom),Ne=m.value.constrain()(ye,fe,c.value);m.value.transform(p.value,Ne)},ce=xN().wheelDelta(me=>ql(me)*(e.zoomStep/10)).on("zoom",e.pannable?oe:()=>{}).on("zoom.wheel",e.zoomable?T:()=>{});K.call(ce),W(()=>{K.on("zoom",null)})}},{flush:"post"});function P(W){const[K,T]=zt(W);t("click",{event:W,position:{x:K,y:T}})}function le(W,K){const T={event:W,node:K,connectedEdges:tn([K],s.value)};f.miniMapNodeClick(T),t("nodeClick",T)}function _(W,K){const T={event:W,node:K,connectedEdges:tn([K],s.value)};f.miniMapNodeDoubleClick(T),t("nodeDblclick",T)}function R(W,K){const T={event:W,node:K,connectedEdges:tn([K],s.value)};f.miniMapNodeMouseEnter(T),t("nodeMouseenter",T)}function k(W,K){const T={event:W,node:K,connectedEdges:tn([K],s.value)};f.miniMapNodeMouseMove(T),t("nodeMousemove",T)}function z(W,K){const T={event:W,node:K,connectedEdges:tn([K],s.value)};f.miniMapNodeMouseLeave(T),t("nodeMouseleave",T)}return(W,K)=>(n.openBlock(),n.createBlock(n.unref(ed),{position:W.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:W.pannable,zoomable:W.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:w.value,height:b.value,viewBox:[te.value.x,te.value.y,te.value.width,te.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:P},[W.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(W.ariaLabel),9,VN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(h),T=>(n.openBlock(),n.createBlock(CN,{id:T.id,key:T.id,f:"",position:T.computedPosition,dimensions:T.dimensions,selected:T.selected,dragging:T.dragging,style:n.normalizeStyle(T.style),class:n.normalizeClass(J.value(T)),color:y.value(T),"border-radius":W.nodeBorderRadius,"stroke-color":x.value(T),"stroke-width":W.nodeStrokeWidth,"shape-rendering":n.unref(S),type:T.type,hidden:T.hidden,onClick:oe=>le(oe,T),onDblclick:oe=>_(oe,T),onMouseenter:oe=>R(oe,T),onMousemove:oe=>k(oe,T),onMouseleave:oe=>z(oe,T)},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)),n.createElementVNode("path",{class:"vue-flow__minimap-mask",d:de.value,fill:W.maskColor,stroke:W.maskStrokeColor,"stroke-width":W.maskStrokeWidth,"fill-rule":"evenodd"},null,8,AN)],8,RN))]),_:1},8,["position","class"]))}}),MN=["d"],DN=["cx","cy","onDblclick"],ON=["x","y","onPointerdown","onDblclick"],LN=Be(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ae(),i=n.inject(ua),l=n.inject(rn,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(Vn,null),s=n.computed(()=>!!r&&r.active.value&&(!r.relatedEntityIds.value.has(t.data.targetRef)||!r.relatedNoteIds.value.has(t.data.noteRef))),d=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),c=n.ref(-1),u=n.ref({x:0,y:0}),f=n.computed(()=>d.value.map((U,Q)=>Q===c.value?u.value:U)),{source:p,target:m,sourceSide:h,targetSide:g}=Sd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),w=n.computed(()=>(l==null?void 0:l.routingMode.value)==="orthogonal"?Zi(p.value,h.value,f.value,m.value,g.value):Qi(p.value,f.value,m.value)),b=n.computed(()=>a.value?(l==null?void 0:l.routingMode.value)==="orthogonal"?Ji(p.value,h.value,f.value,m.value,g.value):nl(p.value,f.value,m.value).map((U,Q)=>({point:U,segIndex:Q})):[]),S=n.computed(()=>a.value?f.value:[]);function y(U,Q){c.value=U,u.value={...d.value[U]},Q.target.setPointerCapture(Q.pointerId),Q.stopPropagation()}function x(U){if(c.value<0)return;const Q=o({x:U.clientX,y:U.clientY});u.value={x:Q.x,y:Q.y}}function J(U){var Q,te;c.value>=0&&i&&i.movePoint(t.id,c.value,{...u.value}),c.value=-1,(te=(Q=U.target).releasePointerCapture)==null||te.call(Q,U.pointerId)}function G(U,Q){Q.stopPropagation(),i==null||i.removePoint(t.id,U)}function j(U,Q){if(!i)return;const te=o({x:Q.clientX,y:Q.clientY});i.insertPoint(t.id,U,{x:te.x,y:te.y})}return(U,Q)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:w.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,MN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(te,de)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${de}`,cx:te.point.x,cy:te.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(P=>j(te.segIndex,P),["stop"])},null,42,DN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S.value,(te,de)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${de}`,x:te.x-5,y:te.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:P=>y(de,P),onPointermove:x,onPointerup:J,onDblclick:P=>G(de,P)},null,42,ON))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),PN=["data-theme"],zN={key:0,class:"em-ctx__sep",role:"separator"},UN={key:1,class:"em-ctx__swatches"},HN={class:"em-ctx__swatches-label"},FN={class:"em-ctx__chips"},GN=["onClick"],YN=["title","onClick"],WN=["disabled","onClick"],qN={class:"em-ctx__icon"},KN={class:"em-ctx__caption"},XN=Be(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),l=n.ref(void 0),a=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function d(m,h){var b;i.value=h,l.value=(b=m.target)!=null&&b.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",c),await n.nextTick();const g=a.value;if(!g)return;const w=g.getBoundingClientRect();r.x+w.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-w.width)),r.y+w.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-w.height))}function c(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",c))}function u(m){m.key==="Escape"&&(m.stopPropagation(),c())}function f(m){m.disabled||(m.handler(),c())}function p(m,h){m.onPick(h),c()}return n.onBeforeUnmount(c),t({open:d,close:c}),(m,h)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:c,onContextmenu:n.withModifiers(c,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:a,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(g,w)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:w},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",zN)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",UN,[n.createElementVNode("span",HN,n.toDisplayString(g.caption),1),n.createElementVNode("div",FN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":g.current===null}]),title:"없음",onClick:b=>p(g,null)},null,10,GN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),b=>(n.openBlock(),n.createElementBlock("button",{key:b,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":g.current===b}]),style:n.normalizeStyle({background:n.unref(In)(b)}),title:n.unref(Sn)(b),onClick:S=>p(g,b)},null,14,YN))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":g.danger,"is-disabled":g.disabled}]),disabled:g.disabled,role:"menuitem",onClick:b=>f(g)},[n.createElementVNode("span",qN,[g.icon?(n.openBlock(),n.createBlock(Ie,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",KN,n.toDisplayString(g.caption),1)],10,WN))],64))),128))],36)],8,PN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Aa=[".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 Mn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function jN(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function ZN(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},l=document.createRange();l.selectNodeContents(e);const a=e.firstChild,r=l.getClientRects();if(!a||a.nodeType!==3||r.length<=1){const h=r.length?l.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=t(h.left,h.top+h.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=a.textContent??"",d=[];let c="",u=null,f=0,p=0;const m=()=>{const h=c.trim();if(h){const g=t(f,(u+p)/2);d.push({...i,x:g.x,y:g.y,text:h})}c=""};for(let h=0;h<s.length;h++){l.setStart(a,h),l.setEnd(a,h+1);const g=l.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(m(),u=g.top,f=g.left,p=g.bottom,c=s[h]):(c+=s[h],p=Math.max(p,g.bottom))}return m(),d}function Xi(e,t){const o=[];for(const i of e.querySelectorAll("*"))jN(i)&&(i.closest(Aa)||Mn(i)&&o.push(...ZN(i,t)));return o}function vo(e){return Math.round(e*100)/100}function JN(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Aa)||!Mn(i))continue;const l=i.getBoundingClientRect();if(l.width===0||l.height===0)continue;const a=t(l.left,l.top),r=t(l.right,l.bottom),s=getComputedStyle(i),d=i.getAttribute("viewBox")??"0 0 24 24",c=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${vo(a.x)}" y="${vo(a.y)}" width="${vo(r.x-a.x)}" height="${vo(r.y-a.y)}" viewBox="${d}" fill="none" stroke="${s.color}" stroke-width="${c}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function QN(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Mn(o))continue;const i=getComputedStyle(o),l=i.stroke,a=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),d=c=>vo(parseFloat(o.getAttribute(c)??"0"));s==="line"?t.push(`<line x1="${d("x1")}" y1="${d("y1")}" x2="${d("x2")}" y2="${d("y2")}" stroke="${l}" stroke-width="${a}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${d("cx")}" cy="${d("cy")}" r="${d("r")}" fill="none" stroke="${l}" stroke-width="${a}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${l}" stroke-width="${a}" stroke-linejoin="round" />`)}return t}function vu(e,t,o){const i=[];for(const l of e.querySelectorAll("*")){if(l===t||l.closest(Aa)||!Mn(l))continue;const a=getComputedStyle(l),r=parseFloat(a.borderTopWidth);if(!r)continue;const s=l.getBoundingClientRect();if(s.width===0)continue;const d=o(s.left,s.top),c=o(s.right,s.top);i.push({x1:d.x,x2:c.x,y:d.y,stroke:a.borderTopColor,strokeWidth:r})}return i}function Eo(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),l=t(o.left,o.top),a=t(o.right,o.bottom),r=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:l.x,y:l.y,w:a.x-l.x,h:a.y-l.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function Ta(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function e$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,h)=>e.screenToFlowCoordinate({x:m,y:h}),i=[],l=[],a=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const h=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!h||!Mn(h))continue;const g=h.firstElementChild;if(g)if(m.type==="group"){const w=Eo(g,o);Ta(s,w),i.push({...w,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...Eo(b,o),stroke:"none",texts:[]}),i.push({...w,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Xi(g,o)})}else if(m.type==="note"){const w={...Eo(g,o),texts:Xi(g,o),lines:vu(g,g,o)};Ta(s,w),a.push(w)}else{const w=Eo(g,o);Ta(s,w);const b=w.radius??{tl:0,tr:0};l.push({...w,stroke:"none",texts:[]});const S=g.querySelector(".em-entity__header");if(S){const y=Eo(S,o);l.push({x:w.x,y:w.y,w:w.w,h:y.y+y.h-w.y,fill:y.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}l.push({...w,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Xi(g,o),lines:vu(g,g,o),icons:JN(g,o)}),l.push({...w,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const h=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Mn(h))continue;const g=h.getAttribute("d");if(!g)continue;const w=getComputedStyle(h),b=w.strokeDasharray,S=QN(m);r.push({d:g,stroke:w.stroke,strokeWidth:parseFloat(w.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Xi(m,o),markers:S.length?S:void 0})}const d=t.closest(".em-canvas")??t,c=getComputedStyle(d).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:c,groups:i,edges:r,entities:l,notes:a}}function Eu(e){return Ya(e$(e))}function ku(e,t="diagram.svg"){const o=Eu(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(i);try{const a=document.createElement("a");a.href=l,a.download=t,document.body.appendChild(a),a.click(),a.remove()}finally{URL.revokeObjectURL(l)}}const Ba="nc:",Nu=Be(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=ae.useModal(),a=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function d(A){s.x=A.clientX,s.y=A.clientY}const c=n.ref(null);n.provide(Ii,c);const u=n.ref(null);n.provide(ud,u);const f=n.ref(null),p=n.computed(()=>{const A=f.value,L=new Set;if(!A)return L;if(A.kind==="entity")L.add(A.id);else if(A.kind==="group"){const Z=i.resolved.value.groups.find(ue=>ue.group.modelId===A.id);for(const ue of(Z==null?void 0:Z.group.memberEntityRefs)??[])L.add(ue)}return L}),m=n.computed(()=>{const A=f.value,L=new Set(p.value),Z=new Set,ue=new Set;if(!A)return{related:L,edges:Z,notes:ue};if(A.kind==="note"){ue.add(A.id);for(const v of i.resolved.value.noteConnections)v.noteRef===A.id&&L.add(v.targetRef);return{related:L,edges:Z,notes:ue}}const ee=p.value;if(!ee.size)return{related:L,edges:Z,notes:ue};for(const v of i.resolved.value.associations){const{end1:I,end2:C}=v.association;(ee.has(I.entityRef)||ee.has(C.entityRef))&&(Z.add(v.association.modelId),L.add(I.entityRef),L.add(C.entityRef))}for(const v of i.resolved.value.noteConnections)L.has(v.targetRef)&&ue.add(v.noteRef);return{related:L,edges:Z,notes:ue}});n.provide(Vn,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:p,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var A;return((A=f.value)==null?void 0:A.kind)==="group"?f.value.id:null}),setEntityHover:A=>{u.value||r.value||(f.value=A?{kind:"entity",id:A}:null)},setGroupHover:A=>{u.value||r.value||(f.value=A?{kind:"group",id:A}:null)},setNoteHover:A=>{u.value||r.value||(f.value=A?{kind:"note",id:A}:null)}}),n.provide(rn,i);function h(A,L){return`${Ba}${A}:${L}`}function g(A){if(!A.startsWith(Ba))return null;const[L,Z]=A.slice(Ba.length).split(":");return L&&Z?{noteRef:L,targetRef:Z}:null}n.provide(ua,{points:A=>{var Z,ue;const L=g(A);return L?((Z=i.resolved.value.noteConnections.find(ee=>ee.noteRef===L.noteRef&&ee.targetRef===L.targetRef))==null?void 0:Z.waypoints)??[]:((ue=i.resolved.value.associations.find(ee=>ee.association.modelId===A))==null?void 0:ue.waypoints)??[]},movePoint:(A,L,Z)=>{const ue=g(A);ue?i.moveNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,Z):i.moveWaypoint(A,L,Z)},insertPoint:(A,L,Z)=>{const ue=g(A);ue?i.addNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,Z):i.addWaypoint(A,L,Z)},removePoint:(A,L)=>{const Z=g(A);Z?i.removeNoteConnectionWaypoint(Z.noteRef,Z.targetRef,L):i.removeWaypoint(A,L)}});const w=Ae(),{nodes:b,edges:S,findNode:y,findEdge:x,addNodes:J,addEdges:G,removeNodes:j,removeEdges:U,fitView:Q,setCenter:te,getViewport:de,screenToFlowCoordinate:P,getSelectedNodes:le,updateNodeInternals:_}=w,R=n.ref(!1);async function k(){R.value=!0,await n.nextTick(),await new Promise(A=>requestAnimationFrame(()=>A(null)));try{ku(w)}finally{R.value=!1}}t({exportSvg:k});function z(A){for(const L of i.resolved.value.groups){const{location:Z,size:ue}=L.geo;if(A.x>=Z.x&&A.x<=Z.x+ue.width&&A.y>=Z.y&&A.y<=Z.y+ue.height)return L.group.modelId}return null}function W(){const A=i.resolved.value,L=new Map(A.groups.map(I=>[I.group.modelId,I.geo])),Z=new Set(A.groups.map(I=>I.group.modelId)),ue=new Set([...Z,...A.entities.map(I=>I.entity.modelId),...A.notes.map(I=>I.note.modelId)]);for(const I of[...b.value])ue.has(I.id)||j([I.id]);for(const I of A.groups){const C=I.group.modelId,ie={width:`${I.geo.size.width}px`,height:`${I.geo.size.height}px`},be={group:I.group,style:I.style},Re=y(C);Re?(Re.position={...I.geo.location},Re.data=be,Re.style=ie):J([{id:C,type:"group",position:{...I.geo.location},style:ie,data:be}])}for(const I of A.entities){const C=I.entity.modelId,ie=I.groupRef&&Z.has(I.groupRef)?I.groupRef:void 0,be={entity:I.entity,displayMode:i.displayMode.value,collapsed:I.collapsed,groupRef:ie,size:I.geo.size,style:I.style,attributeStyles:I.attributeStyles,operationStyles:I.operationStyles},Re=ie?L.get(ie):void 0,xe=Re?{x:I.geo.location.x-Re.location.x,y:I.geo.location.y-Re.location.y}:{...I.geo.location},Ce=y(C);Ce?(Ce.position=xe,Ce.data=be,Ce.parentNode=ie):J([{id:C,type:"entity",position:xe,parentNode:ie,data:be}])}for(const I of A.notes){const C=I.note,ie=C.modelId,be=I.groupRef&&Z.has(I.groupRef)?I.groupRef:void 0,Re={note:C,groupRef:be},xe={width:`${C.geo.size.width}px`,height:`${C.geo.size.height}px`},Ce=be?L.get(be):void 0,ze=Ce?{x:C.geo.location.x-Ce.location.x,y:C.geo.location.y-Ce.location.y}:{...C.geo.location},Pe=y(ie);Pe?(Pe.position=ze,Pe.data=Re,Pe.style=xe,Pe.parentNode=be):J([{id:ie,type:"note",position:ze,parentNode:be,style:xe,data:Re}])}const ee=new Map(A.associations.map(I=>[I.association.modelId,I])),v=new Set(A.noteConnections.map(I=>h(I.noteRef,I.targetRef)));for(const I of[...S.value])!ee.has(I.id)&&!v.has(I.id)&&U([I.id]);for(const[I,C]of ee){const ie={id:I,type:"association",source:C.association.end1.entityRef,target:C.association.end2.entityRef,sourceHandle:C.sourceColumnRef?`r:${C.sourceColumnRef}`:void 0,targetHandle:C.targetColumnRef?`l:${C.targetColumnRef}`:void 0,data:{association:C.association,sourceColumnRef:C.sourceColumnRef,targetColumnRef:C.targetColumnRef}},be=x(I);be?(be.data=ie.data,be.sourceHandle=ie.sourceHandle,be.targetHandle=ie.targetHandle):G([ie])}for(const I of A.noteConnections){const C=h(I.noteRef,I.targetRef),ie={noteRef:I.noteRef,targetRef:I.targetRef},be=x(C);be?be.data=ie:G([{id:C,type:"note-connection",source:I.noteRef,target:I.targetRef,data:ie}])}K()}function K(){n.nextTick(()=>requestAnimationFrame(()=>_()))}function T(){const A=le.value.map(Z=>Z.id);if(A.length)return A;const L=i.selection.value;return L&&(L.kind==="entity"||L.kind==="note"||L.kind==="group")?[L.id]:[]}function oe(A){var ee;const L=A.target;if(L&&(L.tagName==="INPUT"||L.tagName==="TEXTAREA"||L.isContentEditable))return;if(!i.editable.value){(A.metaKey||A.ctrlKey)&&A.key.toLowerCase()==="c"&&(i.copy(),A.preventDefault());return}if(A.key==="Delete"||A.key==="Backspace"){i.deleteSelection()&&A.preventDefault();return}if(A.key==="ArrowUp"||A.key==="ArrowDown"||A.key==="ArrowLeft"||A.key==="ArrowRight"){if(((ee=i.selection.value)==null?void 0:ee.kind)==="attribute"){if(A.key==="ArrowUp"||A.key==="ArrowDown"){const ie=A.key==="ArrowDown"?1:-1;(A.altKey?i.nudgeSelectedAttributes(ie):i.moveAttributeFocus(ie))&&A.preventDefault()}return}const v=A.shiftKey?10:1,I=A.key==="ArrowLeft"?-v:A.key==="ArrowRight"?v:0,C=A.key==="ArrowUp"?-v:A.key==="ArrowDown"?v:0;i.nudgeNodes(T(),I,C)&&A.preventDefault();return}if(!(A.metaKey||A.ctrlKey))return;const ue=A.key.toLowerCase();ue==="c"?(i.copy(),A.preventDefault()):ue==="v"?(i.paste(),A.preventDefault()):ue==="z"&&(A.shiftKey?i.redo():i.undo(),A.preventDefault())}n.onMounted(async()=>{W(),await n.nextTick(),Q(),window.addEventListener("keydown",oe),window.addEventListener("pointerup",ce),window.addEventListener("pointermove",d,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",oe),window.removeEventListener("pointerup",ce),window.removeEventListener("pointermove",d)});function ce(){c.value=null}function me(){r.value=!0,f.value=null}function ge(){var ue;r.value=!1;const A=(ue=document.elementFromPoint(s.x,s.y))==null?void 0:ue.closest(".vue-flow__node"),L=A==null?void 0:A.dataset.id;if(!L){f.value=null;return}const Z=A.classList.contains("vue-flow__node-group")?"group":A.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:Z,id:L}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],W),n.watch(()=>i.revision.value,K),n.watch(()=>i.resolved.value,A=>{const L=f.value;if(!L)return;(L.kind==="entity"?A.entities.some(ue=>ue.entity.modelId===L.id):L.kind==="group"?A.groups.some(ue=>ue.group.modelId===L.id):A.notes.some(ue=>ue.note.modelId===L.id))||(f.value=null)});function se(A){const L=A.computedPosition??A.position,Z=A.dimensions??{width:0,height:0};return{x:L.x+Z.width/2,y:L.y+Z.height/2}}function fe(A){const L=A.node;if(L){if(f.value=null,L.type==="group"){const Z=i.resolved.value.groups.find(ue=>ue.group.modelId===L.id);u.value=Z?{groupId:L.id,dx:L.position.x-Z.geo.location.x,dy:L.position.y-Z.geo.location.y}:null,c.value=null;return}if(L.type!=="entity"&&L.type!=="note"){c.value=null;return}c.value=z(se(L))}}function ye(A){var ue;c.value=null,u.value=null;const L=(ue=A.nodes)!=null&&ue.length?A.nodes:[A.node],Z=L.filter(ee=>(ee==null?void 0:ee.type)==="group");if(Z.length){for(const ee of Z){if(!ee)continue;const v=i.resolved.value.entities.filter(I=>I.groupRef===ee.id).map(I=>{const C=y(I.entity.modelId),ie=(C==null?void 0:C.computedPosition)??(C==null?void 0:C.position)??{x:0,y:0};return{id:I.entity.modelId,location:{x:ie.x,y:ie.y}}});i.dragGroup(ee.id,{x:ee.position.x,y:ee.position.y},v)}return}for(const ee of L){if(!ee||ee.type==="group")continue;const v=ee.computedPosition??ee.position,I=ee.dimensions??{width:0,height:0},C={x:v.x+I.width/2,y:v.y+I.height/2};ee.type==="note"?i.dropNote(ee.id,{x:v.x,y:v.y},z(C)):i.dropEntity(ee.id,{x:v.x,y:v.y},z(C))}}function Ne(A){var ie,be,Re,xe,Ce;if(!i.editable.value||!A.source||!A.target)return;const L=((ie=y(A.source))==null?void 0:ie.type)==="note",Z=((be=y(A.target))==null?void 0:be.type)==="note";if(L||Z){if(L&&Z)return;const ze=L?A.source:A.target,Pe=L?A.target:A.source;((Re=y(Pe))==null?void 0:Re.type)==="entity"&&i.addNoteConnection(ze,Pe);return}const ue=ze=>{var Pe;return(Pe=i.state.logical.entities.find(_t=>_t.modelId===ze))==null?void 0:Pe.stereotype},ee=ue(A.source)==="JPA_EMBEDDABLE",v=ue(A.target)==="JPA_EMBEDDABLE";if(ee||v){if(ee&&v)return;const ze=ee?A.source:A.target,Pe=ee?A.target:A.source;i.addEmbedAssociation(Pe,ze);return}const I=(xe=A.sourceHandle)!=null&&xe.startsWith("r:")?A.sourceHandle.slice(2):void 0,C=(Ce=A.targetHandle)!=null&&Ce.startsWith("l:")?A.targetHandle.slice(2):void 0;i.addAssociation(A.source,A.target,I,C)}const ve=n.ref(null);function $e(A,L){var ue;const Z=i.state.layout.entityLayouts.find(ee=>ee.entityRef===A);return Xe((ue=Z==null?void 0:Z.attributeStyles)==null?void 0:ue[L])}function q(A,L){var ue;const Z=i.state.layout.entityLayouts.find(ee=>ee.entityRef===A);return Xe((ue=Z==null?void 0:Z.operationStyles)==null?void 0:ue[L])}function Y(A){var L;return Xe((L=i.state.layout.groupLayouts.find(Z=>Z.groupRef===A))==null?void 0:L.style)}function D(A){var L;return Xe((L=i.state.layout.notes.find(Z=>Z.modelId===A))==null?void 0:L.style)}function M(A){var ue,ee;if(A.preventDefault(),!i.editable.value)return;const L=()=>P({x:A.clientX,y:A.clientY}),Z=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const v=L();i.addEntity("NewEntity",{x:v.x,y:v.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const v=L();i.addNote("메모",{x:v.x,y:v.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const v=L();i.addEmptyGroup({x:v.x,y:v.y})}}];((ue=i.clipboard.value)==null?void 0:ue.kind)==="entity"&&Z.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&Z.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(ee=ve.value)==null||ee.open(A,Z)}function B({event:A,node:L}){var Re,xe,Ce,ze,Pe,_t,Ht,Ge,ko,_e,Ye,No,$o,xo,So,Io,Co;const Z=A;if(Z.preventDefault(),!i.editable.value){if(L.type==="group"||L.type==="note")return;const Te=(xe=(Re=Z.target)==null?void 0:Re.closest("[data-attr]"))==null?void 0:xe.dataset.attr;if(Te){const Oe=i.selection.value;(Oe==null?void 0:Oe.kind)==="attribute"&&Oe.entityId===L.id&&Oe.ids.includes(Te)||i.selectAttribute(L.id,Te);const fn=((Ce=i.selection.value)==null?void 0:Ce.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[Te];(ze=ve.value)==null||ze.open(Z,[{caption:fn.length>1?`복사 (${fn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Pe=ve.value)==null||Pe.open(Z,[{caption:"상세 편집…",icon:"pencil",handler:()=>Ni(l,i,L.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}}]);return}if(L.type==="group"){(_t=ve.value)==null||_t.open(Z,[{type:"swatches",caption:"색상",current:Y(L.id),onPick:Te=>i.setGroupSwatch(L.id,Te)},{type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(L.id)}]);return}if(L.type==="note"){(Ht=ve.value)==null||Ht.open(Z,[{type:"swatches",caption:"색상",current:D(L.id),onPick:Te=>i.setNoteSwatch(L.id,Te)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(L.id)}]);return}const ue=(ko=(Ge=Z.target)==null?void 0:Ge.closest("[data-attr]"))==null?void 0:ko.dataset.attr;if(ue){const Te=i.selection.value;(Te==null?void 0:Te.kind)==="attribute"&&Te.entityId===L.id&&Te.ids.includes(ue)||i.selectAttribute(L.id,ue);const un=((_e=i.selection.value)==null?void 0:_e.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[ue],fn=un.length>1,Ma=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{type:"swatches",caption:fn?`색상 (${un.length})`:"색상",current:fn?null:$e(L.id,ue),onPick:US=>i.setAttributeSwatches(L.id,un,US)},{type:"separator"},{caption:fn?`복사 (${un.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ro=i.clipboard.value;(Ro==null?void 0:Ro.kind)==="attribute"&&Ma.push({caption:Ro.attributes.length>1?`속성 붙여넣기 (${Ro.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),Ma.push({type:"separator"},{caption:fn?`속성 삭제 (${un.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(L.id,un)}),(Ye=ve.value)==null||Ye.open(Z,Ma);return}const ee=($o=(No=Z.target)==null?void 0:No.closest("[data-op]"))==null?void 0:$o.dataset.op;if(ee){(xo=ve.value)==null||xo.open(Z,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(L.id)},{type:"swatches",caption:"색상",current:q(L.id,ee),onPick:Te=>i.setOperationSwatch(L.id,ee,Te)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(L.id,ee)}]);return}const v=[{caption:"상세 편집…",icon:"pencil",handler:()=>Ni(l,i,L.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(L.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Te=le.value.filter(Oe=>Oe.type==="entity").map(Oe=>Oe.id);i.createGroup(Te.includes(L.id)&&Te.length?Te:[L.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(L.id,L.id)}],I=i.embeddableCatalog.value;if(I.length){v.push({type:"separator"});for(const Te of I){const Oe=((So=Te.label)==null?void 0:So.ko)??((Io=Te.label)==null?void 0:Io.en)??Te.type;v.push({caption:`임베더블 추가: ${Oe}`,icon:"link",handler:()=>i.addPredefinedEmbed(L.id,Te.type)})}}const C=i.resolved.value.entities.find(Te=>Te.entity.modelId===L.id);v.push({type:"separator"}),v.push({caption:C!=null&&C.collapsed?"펼치기":"접기",icon:C!=null&&C.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(L.id,!(C!=null&&C.collapsed))}),(C==null?void 0:C.groupRef)&&v.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(L.id)}),v.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}});const be=i.clipboard.value;(be==null?void 0:be.kind)==="attribute"&&v.push({caption:be.attributes.length>1?`속성 붙여넣기 (${be.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),v.push({type:"separator"}),v.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(L.id)}),(Co=ve.value)==null||Co.open(Z,v)}function F({event:A,edge:L}){var ee,v;const Z=A;if(Z.preventDefault(),!i.editable.value)return;const ue=g(L.id);if(ue){(ee=ve.value)==null||ee.open(Z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ue.noteRef,ue.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ue.noteRef,ue.targetRef)}]);return}(v=ve.value)==null||v.open(Z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(L.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(L.id)}])}function ne(A){return A==="group"?"group":A==="note"?"note":"entity"}function X({node:A}){if(le.value.length>1){i.selection.value=null;return}i.selection.value={kind:ne(A.type),id:A.id}}function E({nodes:A}){A.length>1&&(i.selection.value=null)}function $({edge:A}){const L=g(A.id);i.selection.value=L?{kind:"note",id:L.noteRef}:{kind:"association",id:A.id}}function H(A){const L=i.selection.value;return!!L&&L.kind!=="attribute"&&L.id===A.id}function N(A){var L,Z;return H(A)?A.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":A.type==="note"?"var(--em-note-soft)":A.type==="group"?nd(Xe((L=A.data)==null?void 0:L.style),!0)??"var(--em-mm-group)":nd(Xe((Z=A.data)==null?void 0:Z.style))??"var(--em-mm-entity)"}function O(A){return H(A)?"var(--em-selection)":A.type==="note"?"var(--em-note-accent)":A.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function V(A,L){te(A,L,{zoom:de().zoom,duration:350})}n.watch(()=>i.focusRequest.value,A=>{if(!A)return;const L=y(A.id);if(!L)return;const Z=L.computedPosition??L.position,ue=L.dimensions??{width:0,height:0};V(Z.x+ue.width/2,Z.y+ue.height/2)});function re({position:A}){V(A.x,A.y)}function pe({node:A}){i.selection.value={kind:ne(A.type),id:A.id};const L=A.computedPosition??A.position,Z=A.dimensions??{width:0,height:0};V(L.x+Z.width/2,L.y+Z.height/2)}function he({node:A}){Q({nodes:[A.id],duration:350,maxZoom:1.2,padding:.6})}return(A,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":a.value,"is-panning":r.value}])},[n.createVNode(n.unref(m0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!R.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":n.unref(i).editable.value,"nodes-connectable":n.unref(i).editable.value,"connection-mode":n.unref(xt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:me,onMoveEnd:ge,onConnect:Ne,onConnectStart:L[0]||(L[0]=Z=>a.value=!0),onConnectEnd:L[1]||(L[1]=Z=>a.value=!1),onNodeDrag:fe,onNodeDragStop:ye,onNodeClick:X,onEdgeClick:$,onSelectionChange:E,onPaneClick:L[2]||(L[2]=Z=>n.unref(i).selection.value=null),onPaneContextMenu:M,onNodeContextMenu:B,onEdgeContextMenu:F},{"node-group":n.withCtx(Z=>[n.createVNode(md,n.normalizeProps(n.guardReactiveProps(Z)),null,16)]),"node-entity":n.withCtx(Z=>[n.createVNode(fd,n.normalizeProps(n.guardReactiveProps(Z)),null,16)]),"node-note":n.withCtx(Z=>[n.createVNode(pd,n.normalizeProps(n.guardReactiveProps(Z)),null,16)]),"edge-association":n.withCtx(Z=>[n.createVNode(Id,n.normalizeProps(n.guardReactiveProps(Z)),null,16)]),"edge-note-connection":n.withCtx(Z=>[n.createVNode(LN,n.normalizeProps(n.guardReactiveProps(Z)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(xw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Jw),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(BN),{key:1,pannable:"",width:224,height:160,"node-color":N,"node-stroke-color":O,"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:re,onNodeClick:pe,onNodeDblclick:he})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(XN,{ref_key:"menuRef",ref:ve},null,512)],2))}}),[["__scopeId","data-v-46292641"]]),t$={class:"em-explorer em-scroll-overlay"},n$={class:"em-explorer__rows"},o$=["data-key","onClick","onDblclick"],i$=["onClick"],l$=["title"],a$={class:"em-key-slot"},r$={class:"em-key-slot"},s$={class:"em-explorer__label"},$u=Be(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=ae.useModal(),a=n.computed(()=>{var _;const b=i.resolved.value,S=i.displayMode.value,y=R=>{var k,z,W;return Vo(S,R.name,(z=(k=R.table)==null?void 0:k.logicalName)==null?void 0:z.ko,(W=R.table)==null?void 0:W.physicalName)},x=S==="PHYSICAL"||S==="LOGICAL_PHYSICAL",J=R=>{const k=R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0;return{icon:R.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:R.identifier,fk:k&&x}}},G=R=>R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0,j=S==="PHYSICAL"||S==="LOGICAL_PHYSICAL",U=R=>{if(R.attrType!=="EMBED_PREDEF")return R.dbAttrs;const k=i.embeddableCatalog.value.find(z=>z.type===R.type);return k?R.dbAttrs.map((z,W)=>{const K=k.fields[W];return K?{...z,physicalName:z.physicalName||K.physicalName,logicalName:z.logicalName??K.logicalName,dataType:z.dataType||K.dataType,length:z.length??K.length}:z}):R.dbAttrs},Q=(R,k)=>{var T,oe,ce;const z={entityId:k,attrId:R.modelId};if(G(R)){const me=ll(S,R);return{key:`attr:${R.modelId}`,label:R.name+(me?` : ${me}`:""),icon:"table",attrRef:z,focusId:k,children:j?U(R).map(ge=>{var se;return{key:`attr:${R.modelId}:col:${ge.modelId}`,label:Vo(S,ge.physicalName,(se=ge.logicalName)==null?void 0:se.ko,ge.physicalName)+(ge.dataType?` : ${ge.dataType}`:""),icon:"field",attrRef:z,focusId:k,children:[]}}):[]}}const W=ja(R,i.state.logical.associations),K=ll(S,R,W);return{key:`attr:${R.modelId}`,label:Vo(S,R.name,(oe=(T=R.dbAttrs[0])==null?void 0:T.logicalName)==null?void 0:oe.ko,(ce=R.dbAttrs[0])==null?void 0:ce.physicalName)+(K?` : ${K}`:""),...J(R),attrRef:z,focusId:k,children:[]}},te=R=>{const k=R.entity,z=[...k.attributes].sort((W,K)=>W.order-K.order);return{key:`entity:${k.modelId}`,label:y(k),icon:"table",selectKind:"entity",selectId:k.modelId,focusId:k.modelId,children:z.map(W=>Q(W,k.modelId))}},de=new Map,P=[];for(const R of b.entities)if(R.groupRef){const k=de.get(R.groupRef)??[];k.push(R),de.set(R.groupRef,k)}else P.push(R);const le=[];for(const R of b.groups){const k=R.group;le.push({key:`group:${k.modelId}`,label:((_=k.name)==null?void 0:_.ko)||k.packageName||"(그룹)",icon:"folder",focusId:k.modelId,children:(de.get(k.modelId)??[]).map(te)})}for(const R of P)le.push(te(R));if(b.associations.length){const R=new Map(b.entities.map(k=>[k.entity.modelId,y(k.entity)]));le.push({key:"section:associations",label:`관계 (${b.associations.length})`,icon:"arrow-lr",children:b.associations.map(k=>{const z=k.association,W=R.get(z.end1.entityRef)??z.end1.entityRef,K=R.get(z.end2.entityRef)??z.end2.entityRef;return{key:`assoc:${z.modelId}`,label:`${W} — ${K}`,icon:"arrow-lr",selectKind:"association",selectId:z.modelId,children:[]}})})}return b.notes.length&&le.push({key:"section:notes",label:`노트 (${b.notes.length})`,icon:"note",children:b.notes.map(({note:R})=>{var k;return{key:`note:${R.modelId}`,label:((k=R.memo.split(`
|
|
41
|
+
`)[0])==null?void 0:k.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:R.modelId,focusId:R.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:le}});function r(b){return b?b.pk&&b.fk?"PFK (식별 외래키)":b.pk?"PK (기본키)":b.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function d(b){const S=new Set(s.value);S.has(b)?S.delete(b):S.add(b),s.value=S}const c=n.computed(()=>{const b=[],S=(y,x)=>{if(b.push({node:y,depth:x}),!s.value.has(y.key))for(const J of y.children)S(J,x+1)};return S(a.value,0),b}),u=n.computed(()=>{const b=[],S=y=>{if(y.children.length){y.key!=="root"&&b.push(y.key);for(const x of y.children)S(x)}};return S(a.value),b}),f=n.computed(()=>!u.value.some(b=>s.value.has(b)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(b){const S=i.selection.value;return b.attrRef?(S==null?void 0:S.kind)==="attribute"&&S.entityId===b.attrRef.entityId&&S.ids.includes(b.attrRef.attrId):!!S&&S.kind!=="attribute"&&!!b.selectId&&b.selectKind===S.kind&&b.selectId===S.id}function h(b){const S=i.selection.value;return b.selectKind==="entity"&&(S==null?void 0:S.kind)==="attribute"&&S.entityId===b.selectId}function g(b,S){if(b.attrRef){const y=S.shiftKey?"range":S.metaKey||S.ctrlKey?"toggle":"replace";i.selectAttribute(b.attrRef.entityId,b.attrRef.attrId,y)}else b.selectKind&&b.selectId&&(i.selection.value={kind:b.selectKind,id:b.selectId});b.focusId&&i.requestFocus(b.focusId)}function w(b){b.selectKind==="entity"&&b.selectId&&Ni(l,i,b.selectId)}return(b,S)=>(n.openBlock(),n.createElementBlock("section",t$,[n.createElementVNode("div",n$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,({node:y,depth:x})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":h(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+x*14+"px"}),onClick:J=>g(y,J),onDblclick:J=>w(y)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!y.children.length,"is-open":!s.value.has(y.key)}]),onClick:n.withModifiers(J=>y.children.length&&d(y.key),["stop"])},[y.children.length?(n.openBlock(),n.createBlock(Ie,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,i$),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",a$,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ie,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",r$,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,l$)):(n.openBlock(),n.createBlock(Ie,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",s$,n.toDisplayString(y.label),1)],46,o$))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),c$={class:"em-text-preview"},d$={class:"em-text-preview__pre"},u$={class:"em-text-preview__actions"},f$=Be(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=ae.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.showNotification("복사에 실패했습니다.","error")}}return(l,a)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",c$,[n.createElementVNode("pre",d$,n.toDisplayString(t.text),1),n.createElementVNode("div",u$,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:a[0]||(a[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),m$={class:"em-toolbar"},p$={class:"em-toolbar__mode"},xu=Be(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,l=t,a=ae.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function d(){const m=i.state.logical.entities.length;i.addEntity("NewEntity",{x:80+m*40,y:80+m*30})}function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const u=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(h=>h.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function p(){a.openModal({component:f$,bind:{text:Fa(i.state.logical)}})}return(m,h)=>(n.openBlock(),n.createElementBlock("div",m$,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:h[0]||(h[0]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:h[1]||(h[1]=g=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"redo",size:16})]),_:1},8,["disabled"]),h[10]||(h[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"엔티티 추가",disabled:!n.unref(i).editable.value,onClick:d},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"add-entity",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:h[2]||(h[2]=g=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),h[11]||(h[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",p$,[h[8]||(h[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":h[3]||(h[3]=g=>s.value=g),items:r,"value-provider":g=>g.v,"label-provider":g=>g.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:h[4]||(h[4]=g=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:h[5]||(h[5]=g=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:u.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ie,{name:u.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),h[12]||(h[12]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:p},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:h[6]||(h[6]=g=>l("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"image",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[h[9]||(h[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:h[7]||(h[7]=g=>l("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b9382781"]]),h$=Be(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,l)=>(n.openBlock(),n.createBlock(n.unref(ae.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:l[0]||(l[0]=a=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Ie,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),y$=["disabled"],g$={class:"em-panel__sub"},b$={class:"em-nav"},_$={key:0,class:"em-nav__divider","aria-hidden":"true"},w$={key:1},v$=["onClick","onKeydown"],E$={class:"em-nav__name"},k$=["title"],N$={key:0,class:"em-panel__note"},$$=["data-attr-block"],x$={class:"em-attr__row"},S$={key:0,class:"em-attr__row"},I$={class:"em-attr__row"},C$={class:"em-attr__row"},R$={class:"em-attr__flags"},V$={class:"em-attr__pii"},A$={class:"em-attr__pii"},T$={class:"em-attr__pii"},B$={key:0,class:"em-attr__pii em-attr__codetop"},M$={class:"em-multilang"},D$={key:2,class:"em-embed-cols"},O$={class:"em-embed-col__label"},L$={class:"em-attr__row"},P$={class:"em-attr__row"},z$={key:0,class:"em-embed-upd"},U$={class:"em-embed-upd"},H$={class:"em-embed-upd"},F$={class:"em-swatch__row em-attr__swatch"},G$=["onClick"],Y$=["title","onClick"],W$={key:0,class:"em-attr__swatch-hint"},ji="__OWN__",q$=Be(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(v=>v.modelId===t.entityId)??null),l=n.computed(()=>i.value?o.state.layout.entityLayouts.find(v=>v.entityRef===i.value.modelId)??null:null),a=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes.filter(I=>I.attrType!=="DIVIDER"))??[]}),d=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes)??[]}),c=n.computed(()=>s.value.filter(v=>r.value.has(v.modelId)));function u(v){return{pk:v.identifier,fk:v.attrType.startsWith("RELATION")&&v.dbAttrs.length>0,required:v.notNull&&!v.identifier}}function f(v){const I=u(v),C=[I.pk&&"PK",I.fk&&"FK",I.required&&"NOT NULL"].filter(Boolean);return C.length?C.join(" · "):void 0}function p(v,I){i.value&&o.selectAttribute(i.value.modelId,v.modelId,I.shiftKey?"range":I.metaKey||I.ctrlKey?"toggle":"replace")}const m=["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 h(v){return v==="none"?"(없음)":v}const g=v=>v;function w(v){var I,C;return Xe((C=(I=l.value)==null?void 0:I.attributeStyles)==null?void 0:C[v.modelId])}function b(v){return r.value.size>1&&r.value.has(v.modelId)}function S(v,I){if(!i.value)return;const C=b(v)?o.selectedAttrIds.value:[v.modelId];o.setAttributeSwatches(i.value.modelId,C,I)}function y(v,I){i.value&&o.updateAttribute(i.value.modelId,v.modelId,I)}function x(v){return!!v.transient}const J=v=>v.value,G=v=>v.label;function j(v,I){if(!I)return;const C=_.value.find(ie=>ie.type===I);if(C){const ie=v.dbAttrs[0]??{modelId:v.modelId+".c",physicalName:v.name,dataType:"VARCHAR"};y(v,{type:I,customType:void 0,dbAttrs:[{...ie,dataType:C.dataType,length:C.length,scale:C.scale}]});return}y(v,I===Ft?{type:I}:{type:I,customType:void 0})}function U(v,I){y(v,{customType:I.trim()===""?void 0:I})}function Q(v,I){const C=v.dbAttrs[0]??{modelId:v.modelId+".c",physicalName:v.name,dataType:"VARCHAR"};y(v,{dbAttrs:[{...C,...I}]})}function te(v,I,C){var ie;Q(v,{logicalName:{...(ie=v.dbAttrs[0])==null?void 0:ie.logicalName,[I]:C}})}function de(v,I){y(v,{description:Object.keys(I).length?I:void 0})}function P(v){return v.personalInfoAttributeType??"none"}function le(v,I){y(v,{personalInfoAttributeType:I==="none"?void 0:I})}const _=n.computed(()=>o.predefinedCustomTypeCatalog.value),R=n.computed(()=>o.embeddableCatalog.value),k=n.ref(void 0);function z(v){var I,C;return((I=v.label)==null?void 0:I.ko)??((C=v.label)==null?void 0:C.en)??v.type}function W(v){if(!v||!i.value)return;const I=o.addPredefinedEmbed(i.value.modelId,v);I&&o.selectAttribute(i.value.modelId,I),k.value=void 0}function K(){if(!i.value)return;const v=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,v)}const T=n.computed(()=>o.groupCodeCatalog.value);function oe(v){var I;return((I=T.value.find(C=>C.groupCode===v.groupCode))==null?void 0:I.codes)??[]}function ce(v){return["none",...oe(v)]}function me(v){return v==="none"?"none":v.code}function ge(v){var C,ie;if(v==="none")return"(없음)";const I=((C=v.label)==null?void 0:C.ko)??((ie=v.label)==null?void 0:ie.en);return I?`${v.code} (${I})`:v.code}function se(v,I){i.value&&o.setAttributeGroupCode(i.value.modelId,v.modelId,I)}function fe(v,I){y(v,{defaultValue:I==="none"?void 0:I})}function ye(v,I){y(v,{defaultValue:I.trim()===""?void 0:I})}function Ne(v){return v.attrType.startsWith("EMBED")&&v.dbAttrs.length>0}function ve(v,I,C){const ie=v.dbAttrs.map((be,Re)=>{if(Re!==I)return be;const xe={...be,...C};for(const Ce of Object.keys(C))C[Ce]===void 0&&delete xe[Ce];return xe});i.value&&o.setEmbedColumns(i.value.modelId,v.modelId,ie)}function $e(v,I,C,ie){var be;ve(v,I,{logicalName:{...(be=v.dbAttrs[I])==null?void 0:be.logicalName,[C]:ie}})}function q(v,I){var be,Re,xe;if(v.attrType==="EMBED_PREDEF"){const Ce=(be=o.embeddableCatalog.value.find(ze=>ze.type===v.type))==null?void 0:be.fields[I];return Ce?{name:Ce.name,physicalName:Ce.physicalName,dataType:Ce.dataType,length:Ce.length,shareable:Ce.shareable,logicalName:Ce.logicalName}:void 0}const C=(Re=v.embedded)==null?void 0:Re.embeddableRef;if(!C)return;const ie=(xe=o.state.logical.entities.find(Ce=>Ce.modelId===C))==null?void 0:xe.attributes.flatMap(Ce=>Ce.dbAttrs)[I];return ie?{physicalName:ie.physicalName,dataType:ie.dataType,length:ie.length,scale:ie.scale,logicalName:ie.logicalName}:void 0}function Y(v,I){var C,ie;return((C=q(v,I))==null?void 0:C.dataType)||((ie=v.dbAttrs[I])==null?void 0:ie.dataType)||""}function D(v,I){var C,ie;return((C=q(v,I))==null?void 0:C.length)??((ie=v.dbAttrs[I])==null?void 0:ie.length)}function M(v,I){var C,ie;return((C=q(v,I))==null?void 0:C.scale)??((ie=v.dbAttrs[I])==null?void 0:ie.scale)}const B=["inherit","true","false"];function F(v){return v==="inherit"?"기본(따름)":v}function ne(v){return(v==null?void 0:v.updatable)===void 0?"inherit":v.updatable?"true":"false"}function X(v,I,C){ve(v,I,{updatable:C==="inherit"?void 0:C==="true"})}function E(v,I){Q(v,{updatable:I==="inherit"?void 0:I==="true"})}const $=["inherit","true","false"];function H(v){return v==="inherit"?"기본(따름)":v}function N(v){return(v==null?void 0:v.insertable)===void 0?"inherit":v.insertable?"true":"false"}function O(v,I,C){ve(v,I,{insertable:C==="inherit"?void 0:C==="true"})}function V(v,I){Q(v,{insertable:I==="inherit"?void 0:I==="true"})}const re=n.computed(()=>{var v;return Ln(((v=i.value)==null?void 0:v.attributes.flatMap(I=>I.dbAttrs))??[])}),pe=n.computed(()=>{var v;return(((v=i.value)==null?void 0:v.attributes)??[]).filter(I=>I.attrType==="NORMAL"&&I.dbAttrs.length===1&&I.dbAttrs[0]).map(I=>({modelId:I.dbAttrs[0].modelId,label:I.dbAttrs[0].physicalName||I.name}))});function he(){return[ji,...pe.value.map(v=>v.modelId)]}function A(v){if(v===ji)return"전용 컬럼(OWN)";const I=pe.value.find(C=>C.modelId===v);return I?`↗ ${I.label} (공유)`:v}function L(v){return(v==null?void 0:v.sharedColumnRef)??ji}function Z(v,I,C){ve(v,I,{sharedColumnRef:C===ji?void 0:C})}function ue(v){return(v==null?void 0:v.sharedColumnRef)!=null}function ee(v){var I;return((I=To(v,re.value))==null?void 0:I.physicalName)??""}return(v,I)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",g$,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:K}),R.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":k.value,items:R.value,"value-provider":C=>C.type,"label-provider":z,"onUpdate:modelValue":W},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",b$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,C=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:C.modelId},[C.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",_$,[...I[0]||(I[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",w$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(C.modelId)}]),role:"button",tabindex:"0",onClick:ie=>p(C,ie),onKeydown:[n.withKeys(n.withModifiers(ie=>p(C,ie),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ie=>p(C,ie),["prevent"]),["space"])]},[n.createElementVNode("span",E$,n.toDisplayString(C.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(C)},[u(C).pk?(n.openBlock(),n.createBlock(Ie,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(C).required?(n.openBlock(),n.createBlock(Ie,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(C).fk?(n.openBlock(),n.createBlock(Ie,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,k$)],42,v$)]))],64))),128))]),s.value.length&&!c.value.length?(n.openBlock(),n.createElementBlock("p",N$," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,C=>{var ie,be,Re,xe,Ce,ze,Pe,_t,Ht,Ge,ko;return n.openBlock(),n.createElementBlock("div",{key:C.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(C.modelId)}]),"data-attr-block":C.modelId},[n.createElementVNode("div",x$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${C.modelId}`,width:"100%",placeholder:"이름","model-value":C.name,"onUpdate:modelValue":_e=>y(C,{name:_e})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${C.modelId}`,width:"84px",placeholder:"타입",disabled:C.attrType.startsWith("EMBED")||!!C.groupCode,items:n.unref(Xa)(C.type,_.value),"value-provider":J,"label-provider":G,"model-value":C.type,"onUpdate:modelValue":_e=>j(C,_e)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>n.unref(o).removeAttribute(i.value.modelId,C.modelId)},null,8,["onClick"])]),C.type===n.unref(Ft)?(n.openBlock(),n.createElementBlock("div",S$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${C.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":C.customType??"","onUpdate:modelValue":_e=>U(C,_e)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),Ne(C)?(n.openBlock(),n.createElementBlock("div",D$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C.dbAttrs,(_e,Ye)=>{var No,$o,xo,So,Io,Co,Te;return n.openBlock(),n.createElementBlock("div",{key:_e.modelId,class:"em-embed-col"},[n.createElementVNode("span",O$,n.toDisplayString(((No=q(C,Ye))==null?void 0:No.name)??(($o=q(C,Ye))==null?void 0:$o.physicalName)??`컬럼 ${Ye+1}`),1),n.createElementVNode("div",L$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${_e.modelId}`,width:"100%",disabled:ue(_e),placeholder:((xo=q(C,Ye))==null?void 0:xo.physicalName)??"컬럼","model-value":ue(_e)?ee(_e):_e.physicalName,"onUpdate:modelValue":Oe=>ve(C,Ye,{physicalName:Oe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSTextInput),{name:`embed-dtype-${_e.modelId}`,width:"84px",disabled:"","model-value":Y(C,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${_e.modelId}`,width:"48px",disabled:"","model-value":D(C,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${_e.modelId}`,width:"48px",disabled:"","model-value":M(C,Ye)},null,8,["name","model-value"])]),n.createVNode(an,{controller:n.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",P$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${_e.modelId}`,width:"100%",placeholder:((Io=(So=q(C,Ye))==null?void 0:So.logicalName)==null?void 0:Io.ko)??"논리명","model-value":((Co=_e.logicalName)==null?void 0:Co.ko)??"","onUpdate:modelValue":Oe=>$e(C,Ye,"ko",Oe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Te=q(C,Ye))!=null&&Te.shareable?(n.openBlock(),n.createElementBlock("label",z$,[I[7]||(I[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":L(_e),items:he(),"value-provider":g,"label-provider":A,"onUpdate:modelValue":Oe=>Oe&&Z(C,Ye,Oe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",U$,[I[8]||(I[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:ue(_e),"model-value":ue(_e)?"false":N(_e),items:$,"value-provider":g,"label-provider":H,"onUpdate:modelValue":Oe=>Oe&&O(C,Ye,Oe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",H$,[I[9]||(I[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:ue(_e),"model-value":ue(_e)?"false":ne(_e),items:B,"value-provider":g,"label-provider":F,"onUpdate:modelValue":Oe=>Oe&&X(C,Ye,Oe)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",I$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${C.modelId}`,width:"100%",placeholder:"논리명","model-value":((be=(ie=C.dbAttrs[0])==null?void 0:ie.logicalName)==null?void 0:be.ko)??"","onUpdate:modelValue":_e=>te(C,"ko",_e)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",C$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${C.modelId}`,width:"100%",placeholder:"컬럼",disabled:x(C),"model-value":((Re=C.dbAttrs[0])==null?void 0:Re.physicalName)??"","onUpdate:modelValue":_e=>Q(C,{physicalName:_e})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${C.modelId}`,width:"84px",placeholder:"dataType",disabled:x(C),items:n.unref(Wa)(((xe=C.dbAttrs[0])==null?void 0:xe.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(il),"model-value":((Ce=C.dbAttrs[0])==null?void 0:Ce.dataType)??"","onUpdate:modelValue":_e=>_e&&Q(C,{dataType:_e})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${C.modelId}`,width:"48px",placeholder:"len",disabled:x(C),"model-value":(ze=C.dbAttrs[0])==null?void 0:ze.length,"onUpdate:modelValue":_e=>Q(C,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${C.modelId}`,width:"48px",placeholder:"scale",disabled:x(C),"model-value":(Pe=C.dbAttrs[0])==null?void 0:Pe.scale,"onUpdate:modelValue":_e=>Q(C,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(an,{controller:n.unref(o),"ref-id":(_t=C.dbAttrs[0])==null?void 0:_t.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",R$,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${C.modelId}`,label:"Primary Key","model-value":C.identifier,disabled:a.value||x(C),"onUpdate:modelValue":_e=>y(C,{identifier:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${C.modelId}`,label:"Not Null","model-value":C.notNull,disabled:x(C),"onUpdate:modelValue":_e=>y(C,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${C.modelId}`,label:"Unique","model-value":!!((Ht=C.dbAttrs[0])!=null&&Ht.unique),disabled:x(C),"onUpdate:modelValue":_e=>Q(C,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${C.modelId}`,label:"Auto Increment","model-value":!!((Ge=C.dbAttrs[0])!=null&&Ge.autoIncrement),disabled:x(C)||!C.identifier,"onUpdate:modelValue":_e=>Q(C,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${C.modelId}`,label:"@Transient","model-value":!!C.transient,disabled:C.identifier,"onUpdate:modelValue":_e=>y(C,{transient:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${C.modelId}`,label:"Multi-Value (Set)","model-value":!!((ko=C.dbAttrs[0])!=null&&ko.multiValue),disabled:x(C),"onUpdate:modelValue":_e=>Q(C,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",V$,[I[1]||(I[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:x(C),"model-value":N(C.dbAttrs[0]),items:$,"value-provider":g,"label-provider":H,"onUpdate:modelValue":_e=>_e&&V(C,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",A$,[I[2]||(I[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:x(C),"model-value":ne(C.dbAttrs[0]),items:B,"value-provider":g,"label-provider":F,"onUpdate:modelValue":_e=>_e&&E(C,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",T$,[I[3]||(I[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":P(C),items:m,"value-provider":g,"label-provider":h,"onUpdate:modelValue":_e=>_e&&le(C,_e)},null,8,["model-value","onUpdate:modelValue"])]),T.value.length?(n.openBlock(),n.createElementBlock("label",B$,[I[4]||(I[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(ld,{"model-value":C.groupCode,items:T.value,"onUpdate:modelValue":_e=>se(C,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!T.value.length}])},[I[5]||(I[5]=n.createElementVNode("span",null,"기본값",-1)),oe(C).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":C.defaultValue??"none",items:ce(C),"value-provider":me,"label-provider":ge,"onUpdate:modelValue":_e=>_e&&fe(C,_e)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${C.modelId}`,width:"100%",placeholder:"기본값","model-value":C.defaultValue??"","onUpdate:modelValue":_e=>ye(C,_e)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",M$,[I[6]||(I[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ra,{multiline:"",name:`attr-desc-${C.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":C.description,"onUpdate:modelValue":_e=>de(C,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",F$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":w(C)===null}]),title:"없음",onClick:_e=>S(C,null)},"∅",10,G$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),_e=>(n.openBlock(),n.createElementBlock("button",{key:_e,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":w(C)===_e}]),style:n.normalizeStyle({background:n.unref(In)(_e)}),title:n.unref(Sn)(_e),onClick:Ye=>S(C,_e)},null,14,Y$))),128)),b(C)?(n.openBlock(),n.createElementBlock("span",W$,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,$$)}),128))],8,y$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-e65c9502"]]),K$=["disabled"],X$={class:"em-panel__sub-label"},j$={class:"em-attr__row"},Z$={class:"em-field em-idx-params"},J$=["value","onChange"],Q$=Be(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,l=o.controller,a=n.computed(()=>l.state.logical.entities.find(m=>m.modelId===o.entityId)??null);function r(){var h;if(!a.value)return;const m=a.value.attributes[0];l.addIndex(a.value.modelId,{modelId:Ve(),name:`idx_${(((h=a.value.indexes)==null?void 0:h.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,h){a.value&&l.updateIndex(a.value.modelId,m,h)}function d(m){var g;const h=(g=a.value)==null?void 0:g.attributes[0];h&&s(m.modelId,{columns:[...m.columns,{columnRef:h.modelId,descending:!1}]})}function c(m,h,g){s(m.modelId,{columns:m.columns.map((w,b)=>b===h?{...w,columnRef:g}:w)})}function u(m,h,g){s(m.modelId,{columns:m.columns.map((w,b)=>b===h?{...w,descending:g}:w)})}function f(m,h){s(m.modelId,{columns:m.columns.filter((g,w)=>w!==h)})}function p(m,h){s(m.modelId,{parameters:h.trim()===""?void 0:h})}return(m,h)=>{var g;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(l).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:h[0]||(h[0]=w=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",X$,[e.collapsible?(n.openBlock(),n.createBlock(Ie,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 인덱스 ("+n.toDisplayString(((g=a.value.indexes)==null?void 0:g.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(a.value.indexes??[],w=>(n.openBlock(),n.createElementBlock("div",{key:w.modelId,class:"em-attr"},[n.createElementVNode("div",j$,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${w.modelId}`,width:"100%",placeholder:"인덱스명","model-value":w.name,"onUpdate:modelValue":b=>s(w.modelId,{name:b})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${w.modelId}`,class:"em-check",label:"UQ","model-value":w.unique,"onUpdate:modelValue":b=>s(w.modelId,{unique:b})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:b=>n.unref(l).removeIndex(a.value.modelId,w.modelId)},null,8,["onClick"])]),n.createVNode(an,{controller:n.unref(l),"ref-id":w.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(w.columns,(b,S)=>(n.openBlock(),n.createElementBlock("div",{key:S,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":b.columnRef,items:a.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&c(w,S,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${w.modelId}-desc-${S}`,class:"em-check",label:"DESC","model-value":b.descending,"onUpdate:modelValue":y=>u(w,S,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:y=>f(w,S)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:b=>d(w)},null,8,["onClick"]),n.createElementVNode("label",Z$,[h[1]||(h[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:w.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:b=>p(w,b.target.value)},null,40,J$)])]))),128)):n.createCommentVNode("",!0)],8,K$)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),ex=["disabled"],tx={class:"em-panel__sub-label"},nx={class:"em-attr__row"},ox={class:"em-attr__row"},ix={class:"em-multilang"},lx={class:"em-attr__pii"},ax={class:"em-swatch__row em-attr__swatch"},rx=["onClick"],sx=["title","onClick"],cx=Be(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,l=o.controller,a=ae.useModal(),r=n.computed(()=>l.state.logical.entities.find(y=>y.modelId===o.entityId)??null),s=n.computed(()=>r.value?l.state.layout.entityLayouts.find(y=>y.entityRef===r.value.modelId)??null:null),d=["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 u(y){return y==="none"?"(없음)":y}const f=y=>y;function p(y,x){r.value&&l.updateOperation(r.value.modelId,y.modelId,x)}function m(y,x){p(y,{description:Object.keys(x).length?x:void 0})}function h(y){return y.personalInfoAttributeType??"none"}function g(y,x){p(y,{personalInfoAttributeType:x==="none"?void 0:x})}function w(y){var x,J;return Xe((J=(x=s.value)==null?void 0:x.operationStyles)==null?void 0:J[y.modelId])}function b(y,x){r.value&&l.setOperationSwatch(r.value.modelId,y.modelId,x)}function S(y){a.openModal({component:ad,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:x=>p(y,{sourceCode:x})}})}return(y,x)=>{var J;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(l).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:x[1]||(x[1]=G=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",tx,[e.collapsible?(n.openBlock(),n.createBlock(Ie,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((J=r.value.operations)==null?void 0:J.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:x[0]||(x[0]=n.withModifiers(G=>n.unref(l).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],G=>(n.openBlock(),n.createElementBlock("div",{key:G.modelId,class:"em-attr"},[n.createElementVNode("div",nx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${G.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":G.name,"onUpdate:modelValue":j=>p(G,{name:j})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":G.visibility??"PACKAGE",items:d,"value-provider":f,"label-provider":f,"onUpdate:modelValue":j=>j&&p(G,{visibility:j})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>n.unref(l).removeOperation(r.value.modelId,G.modelId)},null,8,["onClick"])]),n.createElementVNode("div",ox,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:G.sourceCode?"본문 편집 ●":"본문 편집",onClick:j=>S(G)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",ix,[x[2]||(x[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(ra,{multiline:"",name:`op-desc-${G.modelId}`,languages:n.unref(l).languages.value,"default-lang":n.unref(l).userLanguage.value,"model-value":G.description,"onUpdate:modelValue":j=>m(G,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",lx,[x[3]||(x[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":h(G),items:c,"value-provider":f,"label-provider":u,"onUpdate:modelValue":j=>j&&g(G,j)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",ax,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":w(G)===null}]),title:"없음",onClick:j=>b(G,null)},"∅",10,rx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),j=>(n.openBlock(),n.createElementBlock("button",{key:j,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":w(G)===j}]),style:n.normalizeStyle({background:n.unref(In)(j)}),title:n.unref(Sn)(j),onClick:U=>b(G,j)},null,14,sx))),128))])]))),128)):n.createCommentVNode("",!0)],8,ex)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),dx={class:"em-panel__head"},ux={class:"em-panel__head-row"},fx={class:"em-panel__context"},mx=["disabled"],px={key:0,class:"em-panel__note"},hx={key:1,class:"em-panel__note"},yx={key:2,class:"em-jpa"},gx={class:"em-field"},bx={class:"em-field"},_x={key:0,class:"em-field"},wx={class:"em-panel__sub"},vx={class:"em-field"},Ex={class:"em-jpa"},kx={key:0,class:"em-panel__note"},Nx={class:"em-jpa"},$x={class:"em-field"},xx={key:0,class:"em-panel__note"},Sx={class:"em-field"},Ix={class:"em-multilang"},Cx={class:"em-field"},Rx=["value"],Vx={class:"em-field"},Ax={class:"em-swatch"},Tx={class:"em-swatch__row"},Bx=["title","onClick"],Mx={class:"em-panel__note"},Dx={class:"em-field"},Ox=["value"],Lx={class:"em-swatch"},Px={class:"em-swatch__row"},zx=["title","onClick"],Su=Be(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,l=o.controller,a=n.computed(()=>l.selection.value),r=n.computed(()=>l.inspectedEntityId.value),s=n.computed(()=>{const q=r.value;return q?l.state.logical.entities.find(Y=>Y.modelId===q)??null:null}),d=n.computed(()=>{var q;return((q=l.selectedAttr.value)==null?void 0:q.attrId)??null}),c=n.computed(()=>new Set(l.selectedAttrIds.value)),u=n.computed(()=>d.value!==null),f=n.ref({});n.watch(u,()=>{f.value={}});function p(q){return f.value[q]??u.value}function m(q){f.value={...f.value,[q]:!p(q)}}const h=n.computed(()=>{var D;const q=s.value;if(!q)return"엔티티";const Y=(D=q.table)==null?void 0:D.physicalName;return Y?`${q.name} (${Y})`:q.name}),g=n.computed(()=>{const q=a.value;return(q==null?void 0:q.kind)==="association"?l.state.logical.associations.find(Y=>Y.modelId===q.id)??null:null}),w=n.computed(()=>{const q=a.value;return(q==null?void 0:q.kind)==="group"?l.state.logical.groups.find(Y=>Y.modelId===q.id)??null:null}),b=n.computed(()=>{const q=a.value;return(q==null?void 0:q.kind)==="note"?l.state.layout.notes.find(Y=>Y.modelId===q.id)??null:null}),S=n.computed(()=>{var Y,D;const q=(Y=w.value)==null?void 0:Y.name;return(q==null?void 0:q.ko)||(q==null?void 0:q.en)||(q==null?void 0:q.ja)||(q==null?void 0:q.zh)||((D=w.value)==null?void 0:D.packageName)||"그룹"}),y=n.computed(()=>{if(s.value){const q=c.value.size;if(q>1)return`엔티티 · ${s.value.name} › 속성 · ${q}개`;if(d.value){const Y=s.value.attributes.find(D=>D.modelId===d.value);return(Y==null?void 0:Y.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(Y==null?void 0:Y.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const q=Y=>{var D;return((D=l.state.logical.entities.find(M=>M.modelId===Y))==null?void 0:D.name)??Y};return`관계 · ${q(g.value.end1.entityRef)} — ${q(g.value.end2.entityRef)}`}return w.value?`그룹 · ${S.value}`:b.value?"노트":"선택된 항목 없음"}),x=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],J=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],G=["LIST","SET"],j=["inherit","LAZY","EAGER"],U=q=>q;function Q(q){return q==="inherit"?"기본(따름)":q}const te=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function de(q,Y){g.value&&l.updateAssociationEnd(g.value.modelId,q,Y)}function P(q){g.value&&!te.value&&l.setAssociationIdentifying(g.value.modelId,q)}function le(q){var Y,D,M;return!!((M=(D=(Y=g.value)==null?void 0:Y[q].jpa)==null?void 0:D.cascadeTypes)!=null&&M.includes("ALL"))}function _(q,Y,D){var F,ne;const M=(F=g.value)==null?void 0:F[q];if(Y==="ALL"&&D){de(q,{jpa:{...M==null?void 0:M.jpa,cascadeTypes:["ALL"]}});return}const B=new Set(((ne=M==null?void 0:M.jpa)==null?void 0:ne.cascadeTypes)??[]);D?B.add(Y):B.delete(Y),de(q,{jpa:{...M==null?void 0:M.jpa,cascadeTypes:[...B]}})}function R(q,Y){var M;const D=(M=g.value)==null?void 0:M[q];de(q,{jpa:{...D==null?void 0:D.jpa,...Y}})}function k(q){var Y,D;return((D=(Y=g.value)==null?void 0:Y[q].jpa)==null?void 0:D.fetchType)??"inherit"}function z(q,Y){R(q,{fetchType:Y==="inherit"?void 0:Y})}function W(q){var D;const Y=(D=g.value)==null?void 0:D[q==="end1"?"end2":"end1"];return(Y==null?void 0:Y.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(Y==null?void 0:Y.multiplicity)==="ONE_OR_MORE_INSTANCES"}const K=n.computed(()=>{const q=g.value;if(!q)return null;for(const Y of l.state.logical.entities){const D=Y.attributes.find(F=>{var ne;return((ne=F.embedded)==null?void 0:ne.associationRef)===q.modelId&&F.attrType==="EMBED_OWN"});if(!D)continue;const M=q.end2.entityRef===D.embedded.embeddableRef?"end2":"end1",B=q[M].jpa;return{which:M,isCollection:q[M].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(B==null?void 0:B.collectionType)??"LIST",collectionTable:(B==null?void 0:B.collectionTable)??"",orderColumn:(B==null?void 0:B.orderColumn)??""}}return null});function T(q){g.value&&l.setEmbedCollectionMode(g.value.modelId,q?"COLLECTION":"SINGLE")}function oe(q){const Y=K.value;Y&&R(Y.which,q==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function ce(q){const Y=K.value;Y&&R(Y.which,{collectionTable:q.trim()||void 0})}function me(q){const Y=K.value;Y&&R(Y.which,{orderColumn:q.trim()||void 0})}function ge(q){w.value&&l.updateGroup(w.value.modelId,q)}function se(q,Y){var D;ge({name:{...(D=w.value)==null?void 0:D.name,[q]:Y}})}const fe=n.computed(()=>{var q;return w.value?Xe((q=l.state.layout.groupLayouts.find(Y=>Y.groupRef===w.value.modelId))==null?void 0:q.style):null});function ye(q){w.value&&l.setGroupSwatch(w.value.modelId,q)}function Ne(q){b.value&&l.setNoteMemo(b.value.modelId,q)}const ve=n.computed(()=>{var q;return Xe((q=b.value)==null?void 0:q.style)});function $e(q){b.value&&l.setNoteSwatch(b.value.modelId,q)}return(q,Y)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:Y[0]||(Y[0]=(...D)=>e.startResize&&e.startResize(...D))},null,34),n.createElementVNode("header",dx,[n.createElementVNode("div",ux,[Y[12]||(Y[12]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:Y[1]||(Y[1]=D=>i("collapse"))},[n.createVNode(Ie,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",fx,n.toDisplayString(y.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(l).editable.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(od,{controller:n.unref(l),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:h.value,onToggle:Y[2]||(Y[2]=D=>m("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(q$,{controller:n.unref(l),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Q$,{controller:n.unref(l),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:Y[3]||(Y[3]=D=>m("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(cx,{controller:n.unref(l),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:Y[4]||(Y[4]=D=>m("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ae.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!g.value.identifying,disabled:te.value||!!K.value,"onUpdate:modelValue":P},null,8,["model-value","disabled"]),te.value?(n.openBlock(),n.createElementBlock("p",px,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):K.value?(n.openBlock(),n.createElementBlock("p",hx,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),K.value?(n.openBlock(),n.createElementBlock("fieldset",yx,[Y[16]||(Y[16]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":K.value.isCollection,"onUpdate:modelValue":T},null,8,["model-value"]),K.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",gx,[Y[13]||(Y[13]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":K.value.collectionType,items:G,"value-provider":U,"label-provider":U,"onUpdate:modelValue":Y[5]||(Y[5]=D=>D&&oe(D))},null,8,["model-value"])]),n.createElementVNode("label",bx,[Y[14]||(Y[14]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":K.value.collectionTable,"onUpdate:modelValue":ce},null,8,["model-value"])]),K.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",_x,[Y[15]||(Y[15]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":K.value.orderColumn,"onUpdate:modelValue":me},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),Y[17]||(Y[17]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],D=>{var M,B,F,ne;return n.createElementVNode("div",{key:D,class:"em-end"},[n.createElementVNode("h4",wx,n.toDisplayString(D)+" → "+n.toDisplayString(g.value[D].entityRef),1),n.createElementVNode("label",vx,[Y[18]||(Y[18]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":g.value[D].multiplicity,items:x,"value-provider":U,"label-provider":U,disabled:((M=K.value)==null?void 0:M.which)===D,"onUpdate:modelValue":X=>de(D,{multiplicity:X})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${D}-navigable`,class:"em-check",label:"navigable","model-value":g.value[D].navigable,"onUpdate:modelValue":X=>de(D,{navigable:X})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${D}-composition`,class:"em-check",label:"composition","model-value":g.value[D].composition,"onUpdate:modelValue":X=>de(D,{composition:X})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",Ex,[Y[19]||(Y[19]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(J,X=>{var E,$;return n.createVNode(n.unref(ae.BSCheckbox),{key:X,name:`${D}-cascade-${X}`,class:"em-check",label:X,"model-value":!!(($=(E=g.value[D].jpa)==null?void 0:E.cascadeTypes)!=null&&$.includes(X)),disabled:X!=="ALL"&&le(D),"onUpdate:modelValue":H=>_(D,X,H)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),le(D)?(n.openBlock(),n.createElementBlock("p",kx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",Nx,[Y[22]||(Y[22]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",$x,[Y[20]||(Y[20]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":k(D),items:j,"value-provider":U,"label-provider":Q,"onUpdate:modelValue":X=>X&&z(D,X)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${D}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((B=g.value[D].jpa)!=null&&B.orphanRemoval),disabled:W(D),"onUpdate:modelValue":X=>R(D,{orphanRemoval:X})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),W(D)&&((F=g.value[D].jpa)!=null&&F.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",xx,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",Sx,[Y[21]||(Y[21]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${D}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((ne=g.value[D].jpa)==null?void 0:ne.orderBy)??"","onUpdate:modelValue":X=>R(D,{orderBy:X.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),w.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",Ix,[Y[23]||(Y[23]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(l).languages.value,D=>{var M;return n.openBlock(),n.createElementBlock("label",{key:D,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(D),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${D}`,width:"100%","model-value":((M=w.value.name)==null?void 0:M[D])??"","onUpdate:modelValue":B=>se(D,B)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",Cx,[Y[24]||(Y[24]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:w.value.description??"",rows:"3",onChange:Y[6]||(Y[6]=D=>ge({description:D.target.value}))},null,40,Rx)]),n.createElementVNode("label",Vx,[Y[25]||(Y[25]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":w.value.packageName??"","onUpdate:modelValue":Y[7]||(Y[7]=D=>ge({packageName:D}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":w.value.excludeDDLGeneration,"onUpdate:modelValue":Y[8]||(Y[8]=D=>ge({excludeDDLGeneration:D}))},null,8,["model-value"]),n.createElementVNode("fieldset",Ax,[Y[26]||(Y[26]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Tx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":fe.value===null}]),title:"없음",onClick:Y[9]||(Y[9]=D=>ye(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),D=>(n.openBlock(),n.createElementBlock("button",{key:D,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":fe.value===D}]),style:n.normalizeStyle({background:n.unref(In)(D)}),title:n.unref(Sn)(D),onClick:M=>ye(D)},null,14,Bx))),128))])]),n.createElementVNode("p",Mx,"멤버 엔티티 "+n.toDisplayString(w.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",Dx,[Y[27]||(Y[27]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.memo,rows:"6",onChange:Y[10]||(Y[10]=D=>Ne(D.target.value))},null,40,Ox)]),n.createElementVNode("fieldset",Lx,[Y[28]||(Y[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Px,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ve.value===null}]),title:"없음",onClick:Y[11]||(Y[11]=D=>$e(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(ln),D=>(n.openBlock(),n.createElementBlock("button",{key:D,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ve.value===D}]),style:n.normalizeStyle({background:n.unref(In)(D)}),title:n.unref(Sn)(D),onClick:M=>$e(D)},null,14,zx))),128))])])],64)):n.createCommentVNode("",!0)],8,mx)],4))}}),[["__scopeId","data-v-c5358a75"]]),Ux={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function Hx(e){const t=e.split("-")[1];return t?Ux[t]??t:e}function Fx(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Gx=["title"],Yx=["title","onClick"],Wx={key:0,class:"em-validation__body"},qx={class:"em-validation__opt"},Kx={key:0,class:"em-validation__empty"},Xx={key:1,class:"em-validation__empty"},jx={key:2,class:"em-validation__list"},Zx=["onClick"],Jx={class:"em-validation__item-msg"},Qx={key:0,class:"em-validation__item-entity"},eS=["title"],tS=Be(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),l=n.computed(()=>{const g=new Map;for(const w of o.state.logical.entities)g.set(w.modelId,w.name);return g});function a(g){const w=Fx(g);if(!w)return null;const b=l.value.get(w);return b===void 0?null:b.trim()===""?"(이름 없음)":b}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const w of i.value)g[w.severity]++;return g}),d=n.ref({error:!0,warning:!0,info:!0}),c=n.computed(()=>i.value.filter(g=>d.value[g.severity]).slice().sort((g,w)=>r[g.severity].order-r[w.severity].order)),u=n.computed(()=>c.value.map(g=>({issue:g,entityName:a(g),category:Hx(g.ruleId)}))),f=n.ref(!1);function p(g){d.value[g]=!d.value[g]}function m(g){if(!f.value){f.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,w)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(f.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:w[1]||(w[1]=b=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ie,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),w[3]||(w[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,Gx),n.createElementVNode("div",{class:"em-validation__counts",onClick:w[0]||(w[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!d.value[b]}]]),title:f.value?`${r[b].label} ${d.value[b]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:S=>m(b)},[n.createVNode(Ie,{name:r[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,Yx)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",Wx,[n.createElementVNode("label",qx,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":w[2]||(w[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",Kx,"검증 이슈가 없습니다.")):c.value.length===0?(n.openBlock(),n.createElementBlock("p",Xx," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",jx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:S,category:y},x)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${x}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:J=>h(b)},[n.createVNode(Ie,{name:r[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",Jx,[S?(n.openBlock(),n.createElementBlock("span",Qx,n.toDisplayString(S),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(y),9,eS)],10,Zx))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),nS={class:"em-history"},oS={class:"em-history__head"},iS={class:"em-history__title"},lS={class:"em-history__head-actions"},aS=["disabled"],rS={class:"em-history__filters"},sS={class:"em-history__filter"},cS={class:"em-history__body"},dS={key:0,class:"em-history__empty"},uS={key:1,class:"em-history__empty is-error"},fS={key:2,class:"em-history__empty"},mS={key:3,class:"em-history__list"},pS=["onClick"],hS={class:"em-history__summary"},yS={class:"em-history__seq"},gS={class:"em-history__gmeta"},bS={class:"em-history__who"},_S={key:0,class:"em-history__time"},wS={key:1,class:"em-history__restored-from"},vS={key:0,class:"em-history__detail"},ES={class:"em-history__action-head"},kS={class:"em-history__action-name"},NS={key:0,class:"em-history__fields"},$S={class:"em-history__fname"},xS={key:0,class:"em-history__old"},SS={class:"em-history__val"},IS={key:1,class:"em-history__restore"},CS=["disabled","onClick"],RS=["disabled"],VS=["onClick"],AS=Be(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,l=o.controller,a=n.ref([]),r=n.ref(!1),s=n.ref(null),d=n.ref(!1);async function c(){if(l.historyTransport){r.value=!0,s.value=null;try{a.value=await l.historyTransport(),d.value=!0}catch(T){s.value=T instanceof Error?T.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await l.whenOpsSettled(),await c()}n.watch(()=>o.open,T=>{T&&u()},{immediate:!0});let f=null;n.watch(()=>l.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>l.reloadRequest.value,()=>{o.open&&u()});const p=n.computed(()=>new Map(l.state.logical.entities.map(T=>[T.modelId,T]))),m=n.computed(()=>new Map(l.state.logical.associations.map(T=>[T.modelId,T]))),h=n.computed(()=>new Map((l.state.logical.groups??[]).map(T=>{var oe;return[T.modelId,T.packageName||((oe=T.name)==null?void 0:oe.ko)||T.modelId]})));function g(T){var ge,se,fe,ye,Ne,ve,$e;const oe=m.value.get(T);if(!oe)return"연관";if((ge=oe.description)!=null&&ge.trim())return oe.description.trim();const ce=(ye=(fe=p.value.get((se=oe.end1)==null?void 0:se.entityRef))==null?void 0:fe.name)==null?void 0:ye.trim(),me=($e=(ve=p.value.get((Ne=oe.end2)==null?void 0:Ne.entityRef))==null?void 0:ve.name)==null?void 0:$e.trim();return ce&&me?`${ce}→${me}`:"연관"}function w(T){var oe,ce,me,ge;if(T.kind==="entity")return((ce=(oe=p.value.get(T.ref))==null?void 0:oe.name)==null?void 0:ce.trim())||"(이름 없음)";if(T.kind==="attribute"||T.kind==="operation"||T.kind==="index"){const se=T.entityRef?p.value.get(T.entityRef):void 0,ye=((T.kind==="attribute"?se==null?void 0:se.attributes:T.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(ve=>ve.modelId===T.ref),Ne=(me=se==null?void 0:se.name)==null?void 0:me.trim();return`${Ne?Ne+".":""}${((ge=ye==null?void 0:ye.name)==null?void 0:ge.trim())||T.ref}`}return T.kind==="association"?g(T.ref):T.kind==="associationEnd"?`${g(T.ref)}(${T.end})`:T.kind==="group"?`그룹 ${h.value.get(T.ref)??T.ref}`:T.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},S={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),x=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],J=n.computed({get:()=>y.value,set:T=>{T&&(y.value=T)}}),G=n.computed(()=>nr(a.value)),j=n.computed(()=>G.value.length?G.value[0].seq:null),U=n.computed(()=>y.value==="all"?G.value:G.value.filter(T=>(T.kind??"edit")===y.value));function Q(T){return T===void 0?"—":T===null?"(비움)":typeof T=="object"?JSON.stringify(T):String(T)}function te(T){const oe=w(T.subject);if(T.verb==="add")return`${oe} 추가`;if(T.verb==="remove")return`${oe} 삭제`;if(T.fields.length===1){const ce=T.fields[0];return`${oe}.${ce.field} ${ce.oldValue!==void 0?Q(ce.oldValue)+"→":""}${Q(ce.value)}`}return`${oe} ${T.fields.length}개 변경`}function de(T){return T.actions.length===0?"변경 없음":T.actions.length===1?te(T.actions[0]):`${te(T.actions[0])} 외 ${T.actions.length-1}건`}const P=n.ref(new Set);function le(T){const oe=new Set(P.value);oe.has(T)?oe.delete(T):oe.add(T),P.value=oe}function _(T){if(T==null)return"";const oe=new Date(T);return isNaN(oe.getTime())?String(T):oe.toLocaleString()}function R(T){return T.author||(T.origin?`(${T.origin})`:"—")}const k=n.ref(null),z=n.ref(!1);function W(T){k.value=T}async function K(T){z.value=!0;try{const oe=await l.restoreToSeq(T);oe.ok||(s.value=`복원 실패: ${oe.reason??"알 수 없음"}`)}finally{z.value=!1,k.value=null}}return(T,oe)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",nS,[n.createElementVNode("header",oS,[n.createElementVNode("div",iS,[n.createVNode(Ie,{name:"undo",size:15}),oe[4]||(oe[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",lS,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:oe[0]||(oe[0]=ce=>c())},[n.createVNode(Ie,{name:"redo",size:15})],8,aS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:oe[1]||(oe[1]=ce=>i("close"))},[n.createVNode(Ie,{name:"panel-close",size:15})])])]),n.createElementVNode("div",rS,[n.createElementVNode("label",sS,[oe[5]||(oe[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:J.value,"onUpdate:modelValue":oe[2]||(oe[2]=ce=>J.value=ce),items:x,"value-provider":ce=>ce.v,"label-provider":ce=>ce.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",cS,[r.value&&!d.value?(n.openBlock(),n.createElementBlock("p",dS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",uS,n.toDisplayString(s.value),1)):U.value.length===0?(n.openBlock(),n.createElementBlock("p",fS,n.toDisplayString(d.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",mS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(U.value,ce=>(n.openBlock(),n.createElementBlock("li",{key:ce.seq,class:n.normalizeClass(["em-history__group",[`is-${ce.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:me=>le(ce.seq)},[n.createVNode(Ie,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":P.value.has(ce.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${ce.kind??"edit"}`])},n.toDisplayString(ce.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",hS,n.toDisplayString(de(ce)),1),n.createElementVNode("span",yS,"#"+n.toDisplayString(ce.seq),1)],8,pS),n.createElementVNode("div",gS,[n.createElementVNode("span",bS,n.toDisplayString(R(ce)),1),ce.ts?(n.openBlock(),n.createElementBlock("span",_S,n.toDisplayString(_(ce.ts)),1)):n.createCommentVNode("",!0),ce.kind==="restore"&&ce.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",wS,"← #"+n.toDisplayString(ce.restoredFromSeq),1)):n.createCommentVNode("",!0)]),P.value.has(ce.seq)?(n.openBlock(),n.createElementBlock("div",vS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.actions,(me,ge)=>(n.openBlock(),n.createElementBlock("div",{key:ge,class:"em-history__action"},[n.createElementVNode("div",ES,[n.createVNode(Ie,{name:b[me.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",kS,n.toDisplayString(w(me.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${me.verb}`])},n.toDisplayString(S[me.verb]),3)]),me.fields.length?(n.openBlock(),n.createElementBlock("ul",NS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me.fields,(se,fe)=>(n.openBlock(),n.createElementBlock("li",{key:fe,class:"em-history__field"},[n.createElementVNode("span",$S,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",xS,n.toDisplayString(Q(se.oldValue)),1)):n.createCommentVNode("",!0),se.oldValue!==void 0?(n.openBlock(),n.createBlock(Ie,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",SS,n.toDisplayString(Q(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(l).restoreAvailable.value&&ce.seq!==j.value?(n.openBlock(),n.createElementBlock("div",IS,[k.value===ce.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[oe[6]||(oe[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:z.value,onClick:me=>K(ce.seq)},"복원",8,CS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:z.value,onClick:oe[3]||(oe[3]=me=>k.value=null)},"취소",8,RS)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:me=>W(ce.seq)},[n.createVNode(Ie,{name:"undo",size:12}),oe[7]||(oe[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,VS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-14fe445b"]]);function TS(e,t){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>=t?i:null}function Iu(e){const t=n.ref(TS(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(l){l.preventDefault();const a=l.clientX,r=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=c=>{const u=e.edge==="left"?a-c.clientX:c.clientX-a;let f=r+u;f=Math.max(e.min,f),e.max!=null&&(f=Math.min(e.max,f)),t.value=f},d=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",d),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",d)}return{width:t,dragging:o,startResize:i}}const BS={class:"em-modeler"},MS={class:"em-modeler__body"},DS={class:"em-drawer__inner"},OS={class:"em-drawer__head"},LS={class:"em-drawer__actions"},PS=["title"],zS=Be(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:l,dragging:a,startResize:r}=Iu({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:d,startResize:c}=Iu({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(p,m)=>{var h,g,w;return n.openBlock(),n.createElementBlock("div",BS,[n.createVNode(xu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=b=>{var S;return(S=u.value)==null?void 0:S.exportSvg()}),onToggleHistory:m[1]||(m[1]=b=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",MS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(l)+"px"})},[n.createElementVNode("div",DS,[n.createElementVNode("header",OS,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",LS,[(h=f.value)!=null&&h.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=b=>{var S;return(S=f.value)==null?void 0:S.toggleAll()})},[n.createVNode(Ie,{name:(w=f.value)!=null&&w.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,PS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=b=>t.value=!1)},[n.createVNode(Ie,{name:"panel-close",size:16})])])]),n.createVNode($u,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(a)}]),title:"너비 조절",onPointerdown:m[4]||(m[4]=(...b)=>n.unref(r)&&n.unref(r)(...b))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[5]||(m[5]=b=>t.value=!0)},[n.createVNode(Ie,{name:"panel-open",size:18})],512),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(a),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(l)-6+"px"})},[n.createVNode(Nu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Su,{controller:e.controller,width:n.unref(s),resizing:n.unref(d),"start-resize":n.unref(c),onCollapse:m[6]||(m[6]=b=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[7]||(m[7]=b=>o.value=!0)},[n.createVNode(Ie,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(AS,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=b=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(tS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-dc519653"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=zf,Ee.AssociationEdge=Id,Ee.CommandStack=dl,Ee.DiagramCanvas=Nu,Ee.DiagramExplorer=$u,Ee.EDITOR=rn,Ee.EditModeToggle=h$,Ee.EditorToolbar=xu,Ee.EntityModeler=zS,Ee.EntityNode=fd,Ee.GroupNode=md,Ee.NoteNode=pd,Ee.OpSyncAdapter=zr,Ee.PHYSICAL_NAME_MAX_LENGTH=al,Ee.PropertyPanel=Su,Ee.RevCache=Pr,Ee.SYMBOLIC_OP_KINDS=Ur,Ee.SYMBOLIC_OP_SCHEMA=Xr,Ee.anchoredEdgePoint=tl,Ee.buildAgentBatch=Uf,Ee.buildDiagramSvg=Eu,Ee.buildOrthogonalPath=Zi,Ee.buildSelfLoopPath=La,Ee.buildStraightPath=Qi,Ee.commands=wf,Ee.computeAutoLayout=Pa,Ee.createEditorController=R_,Ee.displayLabel=Vo,Ee.emptyState=sd,Ee.entityModelToText=Fa,Ee.estimateEntityHeight=Ua,Ee.exportDiagramSvg=ku,Ee.fromPersisted=em,Ee.indexColumnsByModelId=Ln,Ee.migrateLegacyMoney=ef,Ee.newId=Ve,Ee.orthogonalMidpoints=Ji,Ee.packEntityBoxes=Mu,Ee.physicalNameWarning=Bo,Ee.projectActionLog=nr,Ee.projectEntityAudit=er,Ee.projectFieldAudit=Vt,Ee.rectExitPoint=el,Ee.renderDiagramSvg=Ya,Ee.resolveDiagram=Da,Ee.resolveSharedColumn=To,Ee.resolveSymbolicOps=Rf,Ee.restoreDeepEqual=pn,Ee.segmentMidpoints=nl,Ee.sideDir=Dn,Ee.synthesizeRestoreOps=uf,Ee.toPersisted=pm,Ee.toPersistedV2=hm,Ee.validateModel=Ja,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));
|