@g1cloud/entity-modeler-next 5.0.0-alpha.22 → 5.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/scaffoldJava.d.ts +20 -0
- package/dist/entity-modeler.js +6042 -5996
- package/dist/entity-modeler.umd.cjs +14 -11
- package/package.json +1 -1
|
@@ -1,18 +1,21 @@
|
|
|
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
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function qf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const Xf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(Xf,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Te(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Sr(e){return`<text ${[`x="${Te(e.x)}"`,`y="${Te(e.y)}"`,`fill="${dt(e.fill)}"`,`font-size="${Te(e.fontSize)}"`,e.fontFamily?`font-family="${dt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${dt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${dt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${dt(e.text)}</text>`}function Zf(e){return`<line x1="${Te(e.x1)}" y1="${Te(e.y)}" x2="${Te(e.x2)}" y2="${Te(e.y)}" stroke="${dt(e.stroke)}" stroke-width="${Te(e.strokeWidth??1)}" />`}function Jf(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 Qf(e,t,o,i,a){return[`M${Te(e+a.tl)},${Te(t)}`,`L${Te(e+o-a.tr)},${Te(t)}`,a.tr?`Q${Te(e+o)},${Te(t)} ${Te(e+o)},${Te(t+a.tr)}`:"",`L${Te(e+o)},${Te(t+i-a.br)}`,a.br?`Q${Te(e+o)},${Te(t+i)} ${Te(e+o-a.br)},${Te(t+i)}`:"",`L${Te(e+a.bl)},${Te(t+i)}`,a.bl?`Q${Te(e)},${Te(t+i)} ${Te(e)},${Te(t+i-a.bl)}`:"",`L${Te(e)},${Te(t+a.tl)}`,a.tl?`Q${Te(e)},${Te(t)} ${Te(e+a.tl)},${Te(t)}`:"","Z"].filter(Boolean).join(" ")}function Ta(e){const t=Jf(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${dt(e.fill)}"`,`stroke="${dt(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Te(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Qf(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Te(e.x)}" y="${Te(e.y)}" width="${Te(e.w)}" height="${Te(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Zf(r));for(const r of e.texts)l.push(Sr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function em(e){const o=[`<path ${[`d="${dt(e.d)}"`,'fill="none"',`stroke="${dt(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Sr(i));return`<g>${o.join("")}</g>`}function xr(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Te(t)}" y="${Te(o)}" width="${Te(i)}" height="${Te(a)}" fill="${dt(e.background)}" />`);for(const r of e.groups)l.push(Ta(r));for(const r of e.edges)l.push(em(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="${Te(t)} ${Te(o)} ${Te(i)} ${Te(a)}" width="${Te(i)}" height="${Te(a)}">`+l.join("")+"</svg>"}const tm=["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"],nm=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"]),om=tm.filter(e=>!nm.has(e)),im={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Ma(e){return im[e]??e}const am=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),oo=new Set(["NUMERIC","DECIMAL"]);function Cr(e,t=om){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Et="CustomType",Nn="GroupCodeEnum",Ba="String",Qo=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Nn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Et,label:"CustomType"}],lm=new Map(Qo.map(e=>[e.value,e.label]));function $n(e){return lm.get(e)??e}const rm=new Set([Nn,"CustomMoneyType"]),Rr=Qo.filter(e=>!rm.has(e.value)).map(e=>e.value===Et?{...e,label:"CustomType (사용자정의)"}:e);function Vr(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=[...Rr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:$n(e)},...i]:i}function sm(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Oa(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 Da(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${$n(t.type)}>`:sm(t)?$n(t.type):e==="CLASS"?t.type===Et&&t.customType||$n(t.type):Ma(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function ei(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var l;return a.attrType==="EMBED_OWN"&&((l=a.embedded)==null?void 0:l.embeddableRef)===e.modelId}));return[e,...o]}function In(e,t){return ei(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function Qt(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Sn(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 La=63;function ti(e){if(!e)return null;const t=e.length;return t<=La?null:`물리명이 ${La}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Ar(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function mt(e){return!e||e.trim()===""}function io(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function cm(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 m=l.get(f)??o;if(m===o)d(f);else if(m===i){const p=r.slice(r.indexOf(f)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function dm(e,t,o,i,a){var l,r,s,c,d;if(!mt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(r=(l=a==null?void 0:a.embeddableCatalog)==null?void 0:l.find(u=>u.type===e.type))==null?void 0:r.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const f=(d=i.entities.find(m=>m.modelId===u))==null?void 0:d.attributes.flatMap(m=>m.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function Pa(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 Tr(e,t){var l,r,s,c,d;const o=[];for(const u of Pa(e.entities,f=>f.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`엔티티 이름이 중복됩니다: "${u.name}"`});for(const u of e.entities){const f=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(mt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"엔티티 이름이 비어 있습니다"}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(f.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=u.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),u.stereotype==="JPA_EMBEDDABLE")for(const h of f.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of f.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f)if(!h.identifier)for(const w of h.dbAttrs)!w.autoIncrement&&mt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:u.modelId,message:`채번(${w.autoIncrement?"auto increment":`시퀀스 "${w.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});for(const h of f.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${h.name}"`});for(const h of f.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${h.name}"`});!u.abstractClass&&f.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&f.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:`속성이 ${f.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of Pa(f,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of f)mt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:"속성 이름이 비어 있습니다"});const m=f.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=f.flatMap(h=>h.dbAttrs.map((w,X)=>({col:w,name:dm(h,w,X,e,t)})).filter(w=>w.col.sharedColumnRef==null));for(const h of Pa(p,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,message:`컬럼 물리명이 중복됩니다: "${h.name}"`});for(const h of m){const w=ti(h.physicalName);w&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:w}),t!=null&&t.reservedWords&&!mt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!mt(h.dataType)&&am.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Qt(In(u,e.entities));for(const w of f){if(w.attrType!=="EMBED_PREDEF")continue;const X=t.embeddableCatalog.find(B=>B.type===w.type);X&&w.dbAttrs.forEach((B,H)=>{if(B.sharedColumnRef==null)return;const A=X.fields[H],S=h.get(B.sharedColumnRef);if(!A||!S)return;(S.dataType!==A.dataType||(S.length??null)!==(A.length??null)||(S.scale??null)!==(A.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:B.modelId,contextRef:u.modelId,message:`공유 대상 컬럼의 타입(${Ar(S)})이 ${A.name??"컬럼"} 정의(${Ar(A)})와 다릅니다`})})}}for(const h of f){const w=h.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;h.type===Nn&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:u.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${w.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const y=(s=u.table)==null?void 0:s.physicalName,b=ti(y);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:b}),t!=null&&t.reservedWords&&!mt(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${y}"`});const g=new Set;for(const h of u.attributes){g.add(h.modelId);for(const w of h.dbAttrs)g.add(w.modelId)}const E=new Set(to(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),$=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const w=ti(h.name);w&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:w}),t!=null&&t.reservedWords&&!mt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`});for(const X of h.columns){const B=X.columnRef;if(g.has(B)||E.has(B))continue;const H=eo(B);H&&!$||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:H?`인덱스 "${h.name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다(${((d=Ra(B))==null?void 0:d.field)??B}).`:`인덱스 "${h.name}"가 존재하지 않는 컬럼을 참조합니다.`})}}}const i=new Map;for(const u of e.entities)for(const f of u.attributes)f.attrType==="EMBED_OWN"&&f.embedded&&i.set(f.embedded.associationRef,f);for(const u of e.associations){io(u.end1.multiplicity)&&io(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const f of["end1","end2"]){const m=u[f].jpa;if(!m)continue;const p=m.cascadeTypes??[],y=p.includes("ALL"),b=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),m.orphanRemoval&&(b||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval이 cascade ${y?"ALL":"REMOVE"}와 의미가 겹칩니다`}),io(u[f].multiplicity)&&m.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),m.orphanRemoval&&io(u[f==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!io(u[f].multiplicity)&&(m.collectionType||m.collectionTable||m.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),m.collectionType==="SET"&&m.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of cm(e)){const f=[...u,u[0]].map(m=>a.get(m)??m).join(" → ");for(const m of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:m,message:`식별 관계 사이클입니다 (PK 무한 의존): ${f}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const m of e.associations)u.add(m.end1.entityRef),u.add(m.end2.entityRef);const f=new Map(e.entities.map(m=>[m.name,m.modelId]));for(const m of e.entities){for(const p of m.attributes)p.embedded&&(u.add(m.modelId),u.add(p.embedded.embeddableRef));if(!mt(m.superClass)){u.add(m.modelId);const p=f.get(m.superClass);p&&u.add(p)}}for(const m of e.entities)u.has(m.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:m.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}const ni="javax.persistence",Ue={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},um={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function fm(e,t,o={}){const i=new Map(e.entities.map(l=>[l.modelId,l])),a=[];for(const l of t){const r=i.get(l);r&&a.push(ym(r,e,o))}return a}class Mr{constructor(){He(this,"imports",new Set);He(this,"body",[]);He(this,"fillIns",[])}import(t){t.includes(".")&&!t.startsWith("java.lang.")&&this.imports.add(t)}jpa(t){this.import(`${ni}.${t}`)}line(t=""){this.body.push(t)}fillIn(t){this.fillIns.push(t)}render(t){const o=[`package ${t};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
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 wR=Object.defineProperty;var vR=(Ee,n,ae)=>n in Ee?wR(Ee,n,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Ee[n]=ae;var He=(Ee,n,ae)=>vR(Ee,typeof n!="symbol"?n+"":n,ae);const Lf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Pf(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 gr(e,t,o={}){const i={...Lf,...o},a=new Map(e.entities.map(h=>[h.modelId,h])),l=new Map(e.associations.map(h=>[h.modelId,h])),r=new Map(t.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(t.associationLayouts.map(h=>[h.associationRef,h])),c=t.entityLayouts.map(h=>h.entityRef).filter(h=>!a.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!l.has(h)),u=new Map;for(const h of e.groups)for(const k of h.memberEntityRefs)u.set(k,h.modelId);const f=new Map;for(const h of t.groupLayouts)for(const k of h.memberNoteRefs??[])f.set(k,h.groupRef);let p=0;const m=e.entities.map(h=>{const k=u.get(h.modelId),q=r.get(h.modelId);if(q){const H={location:{x:q.geo.location.x,y:q.geo.location.y},size:{width:q.geo.size.width,height:q.geo.size.height}};return{entity:h,geo:H,collapsed:q.collapsed??!1,locked:q.locked??!1,groupRef:k,style:q.style,attributeStyles:q.attributeStyles,operationStyles:q.operationStyles}}const B=Pf(p++,i);return{entity:h,geo:B,collapsed:!1,locked:!1,groupRef:k}}),y=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),b=e.groups.map(h=>{const k=y.get(h.modelId),q=k?{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:q,style:k==null?void 0:k.style,locked:(k==null?void 0:k.locked)??!1}}),g=e.associations.map(h=>{const k=s.get(h.modelId);return{association:h,waypoints:(k==null?void 0:k.waypoints)??[],sourceColumnRef:k==null?void 0:k.sourceColumnRef,targetColumnRef:k==null?void 0:k.targetColumnRef}}),E=t.notes.map(h=>({note:{...h,geo:{location:{x:h.geo.location.x,y:h.geo.location.y},size:{width:h.geo.size.width,height:h.geo.size.height}}},groupRef:f.get(h.modelId)})),N=[];for(const h of t.notes)for(const k of h.connections??[])a.has(k.targetRef)&&N.push({noteRef:h.modelId,targetRef:k.targetRef,waypoints:k.waypoints.map(q=>({x:q.x,y:q.y}))});return{entities:m,associations:g,groups:b,notes:E,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function eo(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 vn=.5;function br(e,t,o,i,a,l){const r=eo(t),s=eo(a),c={x:e.x+r.x*l,y:e.y+r.y*l},d={x:i.x+s.x*l,y:i.y+s.y*l},u=[c,...o,d],f=[];let p=e;const m=(g,E)=>{(Math.abs(g.x-p.x)>=vn||Math.abs(g.y-p.y)>=vn)&&(f.push({a:p,b:g,seg:E}),p=g)};m(c,0);let y=r.x!==0,b=c;for(let g=1;g<u.length;g++){const E=u[g],N=g<=o.length?g-1:o.length,h=Math.abs(E.x-b.x)<vn,k=Math.abs(E.y-b.y)<vn;h&&k||(h?(m(E,N),y=!1):k?(m(E,N),y=!0):y?(m({x:b.x,y:E.y},N),m(E,N),y=!0):(m({x:E.x,y:b.y},N),m(E,N),y=!1),b=E)}return m(i,o.length),f}function Sa(e,t,o,i,a,l=20){const r=br(e,t,o,i,a,l);let s=`M ${it(e.x)},${it(e.y)}`;for(const c of r)s+=` L ${it(c.b.x)},${it(c.b.y)}`;return s}const zf=14;function xa(e,t,o,i,a,l=20){return br(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=zf).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function it(e){return Math.round(e*100)/100}const Uf=36;function _r(e,t,o=Uf){const i=Math.max(e.x,t.x)+o;return`M ${it(e.x)},${it(e.y)} L ${it(i)},${it(e.y)} L ${it(i)},${it(t.y)} L ${it(t.x)},${it(t.y)}`}function Ca(e,t,o){const i=[e,...t,o];let a=`M ${it(i[0].x)},${it(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${it(i[l].x)},${it(i[l].y)}`;return a}function Ff(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ra(e,t){const o=Ff(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<vn&&Math.abs(r)<vn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=l!==0?i/Math.abs(l):1/0,c=r!==0?a/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+l*d,y:o.y+r*d},f=s<=c?l>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function Va(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 Aa(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const Hf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Er(e,t,o={}){const i={...Hf,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),l=[];let r=0;for(const u of e.groups){const f=a.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 y=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((b,g)=>{const E=g%y,N=Math.floor(g/y);l.push({id:b,location:{x:p.x+i.pad+E*i.cellWidth,y:p.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const p=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+m*i.cellHeight}})}),l}const kr={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function wr(e,t={}){const o={...kr,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Gf(e,t={}){const o={...kr,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=wr(l.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:l.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}const Qo="inherited:";function vr(e,t){return`${Qo}${e}:${t}`}function to(e){return e.startsWith(Qo)}function Ta(e){if(!to(e))return null;const t=e.slice(Qo.length),o=t.indexOf(":");if(o<0)return null;const i=t.slice(0,o),a=t.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function no(e,t){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(t.some(l=>l.name===e.name))return[];const o=e.superClass||((a=t.find(l=>l.default))==null?void 0:a.name);if(!o)return[];const i=t.find(l=>l.name===o);return i?i.columns.map(l=>({modelId:vr(i.name,l.field),baseClass:i.name,field:l.field,physicalName:l.physicalName,dataType:l.dataType,logicalName:l.logicalName,length:l.length,scale:l.scale})):[]}function ei(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 Nr(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 $r(e){var l,r,s;const t=new Map(e.entities.map(c=>[c.modelId,c.name])),o=new Map;for(const c of e.entities)for(const d of c.attributes)o.set(d.modelId,d.name);const i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((l=c.name)==null?void 0:l.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,y)=>m.order-y.order);for(const m of f){if(m.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const y=m.dbAttrs[0],b=y!=null&&y.length?`(${y.length}${y.scale!=null?`,${y.scale}`:""})`:"",g=y?` → ${y.physicalName} ${y.dataType}${b}`:"",E=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",y!=null&&y.unique?"UNIQUE":"",y!=null&&y.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${m.name}: ${m.type}${g}${E.length?` {${E.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const y=m.columns.map(b=>{var g;return`${o.get(b.columnRef)??((g=Ta(b.columnRef))==null?void 0:g.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${y}`)}const p=[...c.operations??[]].sort((m,y)=>m.order-y.order);for(const m of p){const y=m.visibility?` {${m.visibility}}`:"",b=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${y}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,f=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Nr(c.end1.multiplicity)} —— ${Nr(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
|
|
2
|
+
`).trim()}function Yf(e){return e==="CLASS"?"class":"er"}function Ma(e,t){return t==="class"?Xf(e):Wf(e)}function oo(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function Ba(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Ir(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,l)=>{const r=oo(t(a),`Entity_${l+1}`);let s=r,c=2;for(;o.has(s);)s=`${r}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function jf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function Sr(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 xr(e,t){return(t==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function Wf(e){var i,a;const t=Ir(e,l=>{var r;return((r=l.table)==null?void 0:r.physicalName)||l.name}),o=["erDiagram"];for(const l of e.entities){const r=t.get(l.modelId),s=[...l.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${r}`);continue}o.push(` ${r} {`);for(const c of s){const d=c.dbAttrs[0],u=oo((d==null?void 0:d.dataType)||c.type,"unknown"),f=oo((d==null?void 0:d.physicalName)||c.name,"col"),p=[c.identifier?"PK":"",jf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),m=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",y=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,b=Ba([y,m].filter(Boolean).join(" ")),g=[` ${u} ${f}`];p&&g.push(p);let E=g.join(" ");b&&(E+=` "${b}"`),o.push(E)}o.push(" }")}for(const l of e.associations){const r=t.get(l.end1.entityRef),s=t.get(l.end2.entityRef);if(!r||!s)continue;const c=`${xr(l.end1.multiplicity,"left")}--${xr(l.end2.multiplicity,"right")}`,d=Ba(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
|
|
3
|
+
`)}function Kf(e){return e&&e!=="UNDEFINED"?e:null}function qf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Xf(e){const t=Ir(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=Kf(i.stereotype);r&&l.push(` <<${r}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)l.push(` +${qf(c.type)} ${oo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${oo(c.name,"op")}()`);l.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...l),o.push(" }"))}for(const i of e.associations){const a=t.get(i.end1.entityRef),l=t.get(i.end2.entityRef);if(!a||!l)continue;const r=Zf(i),s=Ba(i.description),c=` ${a} "${Sr(i.end1.multiplicity)}" ${r} "${Sr(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function Zf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const Jf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(Jf,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Te(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Cr(e){return`<text ${[`x="${Te(e.x)}"`,`y="${Te(e.y)}"`,`fill="${dt(e.fill)}"`,`font-size="${Te(e.fontSize)}"`,e.fontFamily?`font-family="${dt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${dt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${dt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${dt(e.text)}</text>`}function Qf(e){return`<line x1="${Te(e.x1)}" y1="${Te(e.y)}" x2="${Te(e.x2)}" y2="${Te(e.y)}" stroke="${dt(e.stroke)}" stroke-width="${Te(e.strokeWidth??1)}" />`}function em(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 tm(e,t,o,i,a){return[`M${Te(e+a.tl)},${Te(t)}`,`L${Te(e+o-a.tr)},${Te(t)}`,a.tr?`Q${Te(e+o)},${Te(t)} ${Te(e+o)},${Te(t+a.tr)}`:"",`L${Te(e+o)},${Te(t+i-a.br)}`,a.br?`Q${Te(e+o)},${Te(t+i)} ${Te(e+o-a.br)},${Te(t+i)}`:"",`L${Te(e+a.bl)},${Te(t+i)}`,a.bl?`Q${Te(e)},${Te(t+i)} ${Te(e)},${Te(t+i-a.bl)}`:"",`L${Te(e)},${Te(t+a.tl)}`,a.tl?`Q${Te(e)},${Te(t)} ${Te(e+a.tl)},${Te(t)}`:"","Z"].filter(Boolean).join(" ")}function Oa(e){const t=em(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${dt(e.fill)}"`,`stroke="${dt(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Te(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${tm(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Te(e.x)}" y="${Te(e.y)}" width="${Te(e.w)}" height="${Te(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Qf(r));for(const r of e.texts)l.push(Cr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function nm(e){const o=[`<path ${[`d="${dt(e.d)}"`,'fill="none"',`stroke="${dt(e.stroke)}"`,`stroke-width="${Te(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Cr(i));return`<g>${o.join("")}</g>`}function Rr(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Te(t)}" y="${Te(o)}" width="${Te(i)}" height="${Te(a)}" fill="${dt(e.background)}" />`);for(const r of e.groups)l.push(Oa(r));for(const r of e.edges)l.push(nm(r));for(const r of e.entities)l.push(Oa(r));for(const r of e.notes)l.push(Oa(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Te(t)} ${Te(o)} ${Te(i)} ${Te(a)}" width="${Te(i)}" height="${Te(a)}">`+l.join("")+"</svg>"}const om=["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"],im=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"]),am=om.filter(e=>!im.has(e)),lm={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Da(e){return lm[e]??e}const rm=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),io=new Set(["NUMERIC","DECIMAL"]);function Vr(e,t=am){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Et="CustomType",Nn="GroupCodeEnum",La="String",ti=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Nn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Et,label:"CustomType"}],sm=new Map(ti.map(e=>[e.value,e.label]));function $n(e){return sm.get(e)??e}const cm=new Set([Nn,"CustomMoneyType"]),Ar=ti.filter(e=>!cm.has(e.value)).map(e=>e.value===Et?{...e,label:"CustomType (사용자정의)"}:e);function Tr(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=[...Ar,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:$n(e)},...i]:i}function dm(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Pa(e,t){var l;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(r=>r.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((l=i.jpa)==null?void 0:l.collectionType)??"LIST"}function za(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${$n(t.type)}>`:dm(t)?$n(t.type):e==="CLASS"?t.type===Et&&t.customType||$n(t.type):Da(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function ni(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var l;return a.attrType==="EMBED_OWN"&&((l=a.embedded)==null?void 0:l.embeddableRef)===e.modelId}));return[e,...o]}function In(e,t){return ni(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function Qt(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Sn(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 Ua=63;function oi(e){if(!e)return null;const t=e.length;return t<=Ua?null:`물리명이 ${Ua}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Mr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function mt(e){return!e||e.trim()===""}function ao(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function um(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)),y=[...m].sort().join(" ");c.has(y)||(c.add(y),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 fm(e,t,o,i,a){var l,r,s,c,d;if(!mt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(r=(l=a==null?void 0:a.embeddableCatalog)==null?void 0:l.find(u=>u.type===e.type))==null?void 0:r.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const f=(d=i.entities.find(p=>p.modelId===u))==null?void 0:d.attributes.flatMap(p=>p.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function Fa(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 Br(e,t){var l,r,s,c,d;const o=[];for(const u of Fa(e.entities,f=>f.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`엔티티 이름이 중복됩니다: "${u.name}"`});for(const u of e.entities){const f=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(mt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"엔티티 이름이 비어 있습니다"}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(f.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=u.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),u.stereotype==="JPA_EMBEDDABLE")for(const h of f.filter(k=>k.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of f.filter(k=>k.identifier&&k.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f)if(!h.identifier)for(const k of h.dbAttrs)!k.autoIncrement&&mt(k.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,message:`채번(${k.autoIncrement?"auto increment":`시퀀스 "${k.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});for(const h of f.filter(k=>k.naturalId&&k.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${h.name}"`});for(const h of f.filter(k=>k.naturalId&&k.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of f.filter(k=>k.naturalId&&!k.notNull&&!k.identifier&&!k.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${h.name}"`});!u.abstractClass&&f.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&f.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,message:`속성이 ${f.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of Fa(f,k=>k.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of f)mt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,message:"속성 이름이 비어 있습니다"});const p=f.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),m=f.flatMap(h=>h.dbAttrs.map((k,q)=>({col:k,name:fm(h,k,q,e,t)})).filter(k=>k.col.sharedColumnRef==null));for(const h of Fa(m,k=>k.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,message:`컬럼 물리명이 중복됩니다: "${h.name}"`});for(const h of p){const k=oi(h.physicalName);k&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:k}),t!=null&&t.reservedWords&&!mt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!mt(h.dataType)&&rm.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Qt(In(u,e.entities));for(const k of f){if(k.attrType!=="EMBED_PREDEF")continue;const q=t.embeddableCatalog.find(B=>B.type===k.type);q&&k.dbAttrs.forEach((B,H)=>{if(B.sharedColumnRef==null)return;const A=q.fields[H],S=h.get(B.sharedColumnRef);if(!A||!S)return;(S.dataType!==A.dataType||(S.length??null)!==(A.length??null)||(S.scale??null)!==(A.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:B.modelId,contextRef:u.modelId,message:`공유 대상 컬럼의 타입(${Mr(S)})이 ${A.name??"컬럼"} 정의(${Mr(A)})와 다릅니다`})})}}for(const h of f){const k=h.dbAttrs[0];if(!(k!=null&&k.multiValue))continue;h.type===Nn&&k.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${k.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const y=(s=u.table)==null?void 0:s.physicalName,b=oi(y);b&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:b}),t!=null&&t.reservedWords&&!mt(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${y}"`});const g=new Set;for(const h of u.attributes){g.add(h.modelId);for(const k of h.dbAttrs)g.add(k.modelId)}const E=new Set(no(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),N=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const k=oi(h.name);k&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:k}),t!=null&&t.reservedWords&&!mt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`});for(const q of h.columns){const B=q.columnRef;if(g.has(B)||E.has(B))continue;const H=to(B);H&&!N||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,message:H?`인덱스 "${h.name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다(${((d=Ta(B))==null?void 0:d.field)??B}).`:`인덱스 "${h.name}"가 존재하지 않는 컬럼을 참조합니다.`})}}}const i=new Map;for(const u of e.entities)for(const f of u.attributes)f.attrType==="EMBED_OWN"&&f.embedded&&i.set(f.embedded.associationRef,f);for(const u of e.associations){ao(u.end1.multiplicity)&&ao(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const f of["end1","end2"]){const p=u[f].jpa;if(!p)continue;const m=p.cascadeTypes??[],y=m.includes("ALL"),b=m.includes("REMOVE");y&&m.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),p.orphanRemoval&&(b||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval이 cascade ${y?"ALL":"REMOVE"}와 의미가 겹칩니다`}),ao(u[f].multiplicity)&&p.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),p.orphanRemoval&&ao(u[f==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,message:`${f}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!ao(u[f].multiplicity)&&(p.collectionType||p.collectionTable||p.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),p.collectionType==="SET"&&p.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,message:`${f}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of um(e)){const f=[...u,u[0]].map(p=>a.get(p)??p).join(" → ");for(const p of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:p,message:`식별 관계 사이클입니다 (PK 무한 의존): ${f}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const p of e.associations)u.add(p.end1.entityRef),u.add(p.end2.entityRef);const f=new Map(e.entities.map(p=>[p.name,p.modelId]));for(const p of e.entities){for(const m of p.attributes)m.embedded&&(u.add(p.modelId),u.add(m.embedded.embeddableRef));if(!mt(p.superClass)){u.add(p.modelId);const m=f.get(p.superClass);m&&u.add(m)}}for(const p of e.entities)u.has(p.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:p.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}const xn="javax.persistence",Ue={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},ii={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function mm(e){if(!e)return;if(ii[e])return{simpleName:e,fqn:ii[e]};const t=Object.entries(ii).find(([,o])=>o===e);return t?{simpleName:t[0],fqn:t[1]}:void 0}function pm(e,t,o={}){const i=new Map(e.entities.map(l=>[l.modelId,l])),a=[];for(const l of t){const r=i.get(l);r&&a.push(bm(r,e,o))}return a}class Or{constructor(){He(this,"imports",new Set);He(this,"body",[]);He(this,"fillIns",[])}import(t){t.includes(".")&&!t.startsWith("java.lang.")&&this.imports.add(t)}jpa(t){this.import(`${xn}.${t}`)}line(t=""){this.body.push(t)}fillIn(t){this.fillIns.push(t)}render(t){const o=[`package ${t};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
5
5
|
`)+`
|
|
6
|
-
`}}function Br(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function mm(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(t,o)=>o.toUpperCase()):""}function xn(e,t){t&&(e.import(Ue.lombokGetter),e.line(" @Getter"))}const pm=["ko","en","ja","zh"];function za(e,t){if(!e)return[];const o=pm.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${t} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${t}/**`,`${t} * <ul>`,...o,`${t} * </ul>`,`${t} */`]}function oi(e,t,o){const i={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...i,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...Qo,...o.javaTypeCatalog??[]].find(s=>s.value===e);if(e===Nn)return{type:"Enum",primitive:!1,imports:[`${ni}.Enumerated`,`${ni}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (모델은 groupCode만 보유, 실제 자바 enum 클래스 지정)"]};if(e===Et)return{...i,type:t||"Object",fillIns:[`CustomType 확인 필요: ${t??"(미지정)"}`]};if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${ni}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const r=um[e];if(r)return{type:e,primitive:!1,imports:[r,Ue.jdbcTypeCode,Ue.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const s=l.label,c=[],d=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(s)?c.push(`java.time.${s}`):s==="Date"?(c.push("java.util.Date"),d.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):s==="BigDecimal"||s==="BigInteger"?c.push(`java.math.${s}`):s==="Currency"&&c.push("java.util.Currency"),{type:s,primitive:l.boxed!=null,imports:c,fieldAnnotations:[],fillIns:d}}return{...i,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Or(e){return e.attributes.filter(t=>t.identifier&&(t.attrType==="NORMAL"||t.attrType==="RELATION_OWN")).sort((t,o)=>t.order-o.order)}function Ua(e,t,o,i=new Set){if(e.attrType!=="RELATION_OWN")return oi(e.type,e.customType,o).type;const a=t.entities.find(r=>r.name===e.type);if(!a||i.has(a.modelId))return oi(e.type,e.customType,o).type;const l=Or(a);return l.length>=2?`${a.name}PK`:l.length===1?Ua(l[0],t,o,new Set([...i,a.modelId])):oi(e.type,e.customType,o).type}function hm(e,t,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!t)return!1;const i=!Ha(t.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function ym(e,t,o){var A,S,L,ee,M,oe;if(e.stereotype==="JPA_EMBEDDABLE")return gm(e,t,o);const i=new Mr,a=e.name,l=Ga(e,t),r=new Map(t.entities.map(_=>[_.modelId,_])),s=l,c=$m(e,o,i),d=new Map;for(const _ of t.associations)_.end2.attributeRef&&d.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&d.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const u=Or(e),f=new Set(u.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),m=new Set;for(const _ of u)hm(_,(A=d.get(_.modelId))==null?void 0:A.assoc,f)&&m.add(_.modelId);const p=u.filter(_=>!m.has(_.modelId)),y=p.length>=2,b=p.length===1,g=`${a}PK`,E=_=>m.has(_.modelId)?"mapsId":_.identifier?"id":"none",$=o.lombok!==!1;i.jpa("Entity"),i.import(Ue.jsonIdentityInfo),i.import(Ue.jsogGenerator);const h=["@Entity"];h.push(Em(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${l}.${a}.${g}`),h.push(`@IdClass(${a}.${g}.class)`)),(S=e.jpaAttrs)!=null&&S.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(Ue.dynamicInsert)),(L=e.jpaAttrs)!=null&&L.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(Ue.dynamicUpdate)),(ee=e.jpaAttrs)!=null&&ee.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),$&&(i.import(Ue.lombokNoArgs),i.import(Ue.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const _ of za((M=e.table)==null?void 0:M.logicalName,""))i.line(_);for(const _ of h)i.line(_);i.line(`public class ${a}${c} {`);const w=e.attributes.filter(_=>_.attrType!=="DIVIDER").sort((_,Y)=>_.order-Y.order),X=(oe=e.jpaAttrs)!=null&&oe.useVersion?u.length?u[u.length-1].modelId:null:void 0,B=[];for(const _ of w){if(_.attrType.startsWith("EMBED"))B.push(...Ur(_,e,t,o,i));else if(_.attrType==="RELATION_OWN"){const Y=d.get(_.modelId);Y&&B.push(wm(_,Y.assoc,s,r,E(_),$,i))}else if(_.attrType==="RELATION_REF"){const Y=d.get(_.modelId);Y&&B.push(vm(_,Y.assoc,s,r,$,i))}else B.push(Pr(_,a,o,i));_.modelId===X&&Dr(i,B,$)}X===null&&Dr(i,B,$),$||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Lr(B,i,$),y&&(i.import(Ue.jsonBackReference),i.import(Ue.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${g} getPK() {`),i.line(` return (${g}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Im(g,p.map(_=>({type:Ua(_,t,o),name:_.name})),$,i)),i.line("}");let H;return y?H=Sm(a,g,l):b&&(H=xm(a,l,Ua(p[0],t,o))),{modelId:e.modelId,fileName:`${a}.java`,source:i.render(l),fillIns:i.fillIns,repository:H}}function Dr(e,t,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||t.push({type:"int",name:"dataVersion",category:0})}function Lr(e,t,o){const i=e.map((a,l)=>({g:a,i:l})).sort((a,l)=>a.g.category-l.g.category||a.i-l.i);for(const{g:a}of i){if(o&&!a.collection)continue;t.line(""),t.line(` public ${a.type} get${Br(a.name)}() {`);const l=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;l?(t.import("java.util.Collections"),t.line(` return Collections.${l}(this.${a.name});`)):t.line(` return ${a.name};`),t.line(" }")}}function gm(e,t,o){var c;const i=new Mr,a=e.name,l=Ga(e,t);i.jpa("Embeddable"),i.import(Ue.jsonIdentityInfo),i.import(Ue.jsogGenerator),i.import(Ue.serializable);for(const d of za((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const r=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of r){if(d.attrType.startsWith("EMBED")){s.push(...Ur(d,e,t,o,i));continue}s.push(Pr(d,a,o,i))}return Lr(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,source:i.render(l),fillIns:i.fillIns}}function Pr(e,t,o,i){const a=e.dbAttrs[0],l=e.name||mm(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${t}.${l}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const r=oi(e.type,e.customType,o);for(const d of r.imports)i.import(d);for(const d of r.fillIns)i.fillIn(`${t}.${l}: ${d}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${r.type}>`:r.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${t}.${l}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of za(a==null?void 0:a.logicalName," "))i.line(d);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(Ue.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Nm(e,a,i)}`);for(const d of r.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${l} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),xn(i,o.lombok!==!1),i.line(` private ${c} ${l} = new LinkedHashSet<>();`)):(xn(i,o.lombok!==!1),i.line(` private ${c} ${l};`)),{type:c,name:l,category:0}}function zr(e,t,o){var l,r;if(e.attrType==="EMBED_PREDEF"){const s=(l=o.embeddableCatalog)==null?void 0:l.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,f;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((f=s==null?void 0:s.fields[d])==null?void 0:f.physicalName)??""}})}const i=(r=e.embedded)!=null&&r.embeddableRef?t.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function bm(e,t,o,i,a){const l=Qt(In(t,o.entities)),r=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=Sn(s,l);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${t.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){r.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const f=s.physicalName||d.defaultPhysical;f&&f!==d.defaultPhysical&&r.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${f}"))`)}),r}function Ur(e,t,o,i,a){var f,m,p,y;const l=t.name,r=Ga(t,o);let s=e.type;if(e.attrType==="EMBED_OWN"){const b=(f=e.embedded)!=null&&f.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;b&&(s=b.name,b.packageName&&b.packageName!==r&&a.import(`${b.packageName}.${b.name}`))}if(e.type==="Money")return[_m(e,t,o,i,a)];const c=zr(e,o,i),d=bm(e,t,o,c,a),u=Oa(e,o.associations);if(a.line(""),u){const b=o.associations.find(X=>{var B;return X.modelId===((B=e.embedded)==null?void 0:B.associationRef)}),g=b?b.end2.entityRef===((m=e.embedded)==null?void 0:m.embeddableRef)?b.end2:b.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const E=(p=g==null?void 0:g.jpa)==null?void 0:p.collectionTable;E?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${E}")`)):a.fillIn(`${l}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),Fa(d,a);const $=u==="SET";!$&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import($?"java.util.Set":"java.util.List"),a.import($?"java.util.LinkedHashSet":"java.util.ArrayList");const h=$?`Set<${s}>`:`List<${s}>`,w=$?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${w};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),Fa(d,a),xn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function _m(e,t,o,i,a){a.jpa("Embedded"),a.import(Ue.compositeType),a.import(Ue.money),a.import(Ue.moneyUserType);const l=zr(e,o,i),r=Qt(In(t,o.entities)),s=e.dbAttrs.map((c,d)=>{var p,y;const u=((p=l[d])==null?void 0:p.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),f=Sn(c,r),m=[`name = "${f?f.physicalName:c.physicalName||((y=l[d])==null?void 0:y.defaultPhysical)||""}"`];return e.notNull&&m.push("nullable = false"),f&&m.push("insertable = false","updatable = false"),`@AttributeOverride(name = "${u}", column = @Column(${m.join(", ")}))`});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),Fa(s,a),xn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function Fa(e,t){e.length!==0&&(t.jpa("AttributeOverride"),t.jpa("AttributeOverrides"),t.jpa("Column"),t.line(" @AttributeOverrides({"),e.forEach((o,i)=>t.line(` ${o}${i<e.length-1?",":""}`)),t.line(" })"))}function Em(e,t,o){var s;o.jpa("Table");const i=((s=e.table)==null?void 0:s.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const l=new Map;for(const c of e.attributes)for(const d of c.dbAttrs)l.set(d.modelId,d.physicalName);for(const c of to(e,t.superClassCatalog??[]))l.set(c.modelId,c.physicalName);const r=a.map(c=>{const d=[];for(const f of c.columns){const m=l.get(f.columnRef);m?d.push(m):o.fillIn(`${e.name}.@Index(${c.name}): 컬럼 참조 미해소(${f.columnRef}) — 카탈로그 확인`)}const u=c.unique?", unique = true":"";return`@Index(name = "${c.name}", columnList = "${d.join(", ")}"${u})`});return`@Table(name = "${i}", indexes = { ${r.join(", ")} })`}function Ha(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function km(e,t,o){var l;const i=o.get(t.end1.entityRef);if(e.derivedFrom){const r=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(r!=null&&r.dbAttrs[0])return r.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(r=>r.identifier&&r.dbAttrs.length>0);return(l=a==null?void 0:a.dbAttrs[0])==null?void 0:l.physicalName}function Fr(e,t,o){e!=null&&e.packageName&&e.packageName!==t&&o.import(`${e.packageName}.${e.name}`)}function wm(e,t,o,i,a,l,r){var b;const s=i.get(t.end1.entityRef),c=(s==null?void 0:s.name)??t.end1.entityRef,d=Ha(t.end2.multiplicity)?"ManyToOne":"OneToOne";r.jpa(d),Fr(s,o,r);const u=t.end2.jpa,f=[];e.notNull&&f.push("optional = false"),u!=null&&u.fetchType&&(r.jpa("FetchType"),f.push(`fetch = FetchType.${u.fetchType}`)),(b=u==null?void 0:u.cascadeTypes)!=null&&b.length&&(r.jpa("CascadeType"),f.push(`cascade = { ${u.cascadeTypes.map(g=>`CascadeType.${g}`).join(", ")} }`));const m=e.dbAttrs[0];r.jpa("JoinColumn");const p=[`name = "${(m==null?void 0:m.physicalName)??""}"`],y=km(e,t,i);return y&&p.push(`referencedColumnName = "${y}"`),e.notNull&&p.push("nullable = false"),(m==null?void 0:m.insertable)===!1&&p.push("insertable = false"),(m==null?void 0:m.updatable)===!1&&p.push("updatable = false"),r.line(""),a==="id"&&(r.jpa("Id"),r.line(" @Id")),r.line(` @${d}${f.length?`(${f.join(", ")})`:""}`),r.line(` @JoinColumn(${p.join(", ")})`),a==="mapsId"&&(r.jpa("MapsId"),r.line(" @MapsId")),xn(r,l),r.line(` private ${c} ${e.name};`),{type:c,name:e.name,category:2}}function vm(e,t,o,i,a,l){const r=i.get(t.end2.entityRef),s=(r==null?void 0:r.name)??t.end2.entityRef;Fr(r,o,l);const c=r==null?void 0:r.attributes.find(h=>h.modelId===t.end2.attributeRef),d=(c==null?void 0:c.name)??"",u=Ha(t.end2.multiplicity);if(l.line(""),!u)return l.jpa("OneToOne"),l.line(` @OneToOne(mappedBy = "${d}")`),xn(l,a),l.line(` private ${s} ${e.name};`),{type:s,name:e.name,category:1};l.jpa("OneToMany");const f=t.end1.jpa,m=t.end1.composition||t.end2.composition;let p=(f==null?void 0:f.cascadeTypes)??[],y=f==null?void 0:f.orphanRemoval;m&&p.length===0&&(p=["ALL"],y==null&&(y=!0),l.fillIn(`${s}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${d}"`];p.length&&(l.jpa("CascadeType"),b.push(`cascade = { ${p.map(h=>`CascadeType.${h}`).join(", ")} }`)),y&&b.push("orphanRemoval = true"),f!=null&&f.fetchType&&(l.jpa("FetchType"),b.push(`fetch = FetchType.${f.fetchType}`)),l.line(` @OneToMany(${b.join(", ")})`),f!=null&&f.orderBy&&(l.jpa("OrderBy"),l.line(` @OrderBy("${f.orderBy}")`));const g=(f==null?void 0:f.collectionType)==="SET";l.import(g?"java.util.Set":"java.util.List"),l.import(g?"java.util.LinkedHashSet":"java.util.ArrayList");const E=g?`Set<${s}>`:`List<${s}>`,$=g?"new LinkedHashSet<>()":"new ArrayList<>()";return l.line(` private ${E} ${e.name} = ${$};`),{type:E,name:e.name,category:1,collection:!0}}function Nm(e,t,o){o.jpa("Column");const i=[`name = "${(t==null?void 0:t.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),t){const a=oo.has(t.dataType);t.length!=null&&i.push(a?`precision = ${t.length}`:`length = ${t.length}`),t.scale!=null&&i.push(`scale = ${t.scale}`),t.insertable===!1&&i.push("insertable = false"),t.updatable===!1&&i.push("updatable = false"),t.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function $m(e,t,o){var r;const i=t.superClassCatalog??[],a=e.superClass||((r=i.find(s=>s.default))==null?void 0:r.name);if(!a||a==="Object")return"";const l=i.find(s=>s.name===a);return l!=null&&l.packageName?o.import(`${l.packageName}.${l.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function Im(e,t,o,i){i.import(Ue.serializable),i.import(Ue.objects),i.import(Ue.jsonUtils),o&&i.import(Ue.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of t)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${t.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of t)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of t)i.line(""),i.line(` public ${a.type} get${Br(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${t.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${t.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function Sm(e,t,o){const i=[`${o}.${e}`,`${o}.${e}.${t}`,Ue.jpaRepository,Ue.querydslExecutor].sort(),a=[`package ${o};`,""];for(const l of i)a.push(`import ${l};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${t}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
6
|
+
`}}function Dr(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function hm(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(t,o)=>o.toUpperCase()):""}function Cn(e,t){t&&(e.import(Ue.lombokGetter),e.line(" @Getter"))}const ym=["ko","en","ja","zh"];function Ha(e,t){if(!e)return[];const o=ym.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${t} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${t}/**`,`${t} * <ul>`,...o,`${t} * </ul>`,`${t} */`]}function ai(e,t,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const r=[...ti,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Nn){if(i){const c=[`${xn}.Enumerated`,`${xn}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${xn}.Enumerated`,`${xn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===Et){const c=mm(t),d=c?`CustomType '${t}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${t??"(미지정)"}`;return{...a,type:t||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${xn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=ii[e];if(s)return{type:e,primitive:!1,imports:[s,Ue.jdbcTypeCode,Ue.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(r){const c=r.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:r.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Lr(e){return e.attributes.filter(t=>t.identifier&&(t.attrType==="NORMAL"||t.attrType==="RELATION_OWN")).sort((t,o)=>t.order-o.order)}function Ga(e,t,o,i=new Set){if(e.attrType!=="RELATION_OWN")return ai(e.type,e.customType,o,e.groupCode).type;const a=t.entities.find(r=>r.name===e.type);if(!a||i.has(a.modelId))return ai(e.type,e.customType,o).type;const l=Lr(a);return l.length>=2?`${a.name}PK`:l.length===1?Ga(l[0],t,o,new Set([...i,a.modelId])):ai(e.type,e.customType,o).type}function gm(e,t,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!t)return!1;const i=!ja(t.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function bm(e,t,o){var A,S,L,ee,M,oe;if(e.stereotype==="JPA_EMBEDDABLE")return _m(e,t,o);const i=new Or,a=e.name;let l=lo(e,t,o);l||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${li}')`),l=li);const r=new Map(t.entities.map(_=>[_.modelId,_])),s=l,c=Sm(e,o,i),d=new Map;for(const _ of t.associations)_.end2.attributeRef&&d.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&d.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const u=Lr(e),f=new Set(u.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),p=new Set;for(const _ of u)gm(_,(A=d.get(_.modelId))==null?void 0:A.assoc,f)&&p.add(_.modelId);const m=u.filter(_=>!p.has(_.modelId)),y=m.length>=2,b=m.length===1,g=`${a}PK`,E=_=>p.has(_.modelId)?"mapsId":_.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(Ue.jsonIdentityInfo),i.import(Ue.jsogGenerator);const h=["@Entity"];h.push(wm(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${l}.${a}.${g}`),h.push(`@IdClass(${a}.${g}.class)`)),(S=e.jpaAttrs)!=null&&S.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(Ue.dynamicInsert)),(L=e.jpaAttrs)!=null&&L.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(Ue.dynamicUpdate)),(ee=e.jpaAttrs)!=null&&ee.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),N&&(i.import(Ue.lombokNoArgs),i.import(Ue.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const _ of Ha((M=e.table)==null?void 0:M.logicalName,""))i.line(_);for(const _ of h)i.line(_);i.line(`public class ${a}${c} {`);const k=e.attributes.filter(_=>_.attrType!=="DIVIDER").sort((_,Y)=>_.order-Y.order),q=(oe=e.jpaAttrs)!=null&&oe.useVersion?u.length?u[u.length-1].modelId:null:void 0,B=[];for(const _ of k){if(_.attrType.startsWith("EMBED"))B.push(...Hr(_,e,t,o,i));else if(_.attrType==="RELATION_OWN"){const Y=d.get(_.modelId);Y&&B.push(Nm(_,Y.assoc,s,r,E(_),N,t,o,i))}else if(_.attrType==="RELATION_REF"){const Y=d.get(_.modelId);Y&&B.push($m(_,Y.assoc,s,r,N,t,o,i))}else B.push(Ur(_,a,o,i));_.modelId===q&&Pr(i,B,N)}q===null&&Pr(i,B,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),zr(B,i,N),y&&(i.import(Ue.jsonBackReference),i.import(Ue.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${g} getPK() {`),i.line(` return (${g}) HibernateBeanUtil.getPK(this);`),i.line(" }"),xm(g,m.map(_=>({type:Ga(_,t,o),name:_.name})),N,i)),i.line("}");let H;return y?H=Cm(a,g,l):b&&(H=Rm(a,l,Ga(m[0],t,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:l,source:i.render(l),fillIns:i.fillIns,repository:H}}function Pr(e,t,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||t.push({type:"int",name:"dataVersion",category:0})}function zr(e,t,o){const i=e.map((a,l)=>({g:a,i:l})).sort((a,l)=>a.g.category-l.g.category||a.i-l.i);for(const{g:a}of i){if(o&&!a.collection)continue;t.line(""),t.line(` public ${a.type} get${Dr(a.name)}() {`);const l=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;l?(t.import("java.util.Collections"),t.line(` return Collections.${l}(this.${a.name});`)):t.line(` return ${a.name};`),t.line(" }")}}function _m(e,t,o){var c;const i=new Or,a=e.name;let l=lo(e,t,o);l||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${li}')`),l=li),i.jpa("Embeddable"),i.import(Ue.jsonIdentityInfo),i.import(Ue.jsogGenerator),i.import(Ue.serializable);for(const d of Ha((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const r=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of r){if(d.attrType.startsWith("EMBED")){s.push(...Hr(d,e,t,o,i));continue}s.push(Ur(d,a,o,i))}return zr(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:l,source:i.render(l),fillIns:i.fillIns}}function Ur(e,t,o,i){const a=e.dbAttrs[0],l=e.name||hm(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${t}.${l}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const r=ai(e.type,e.customType,o,e.groupCode);for(const d of r.imports)i.import(d);for(const d of r.fillIns)i.fillIn(`${t}.${l}: ${d}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${r.type}>`:r.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${t}.${l}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of Ha(a==null?void 0:a.logicalName," "))i.line(d);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(Ue.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Im(e,a,i)}`);for(const d of r.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${l} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Cn(i,o.lombok!==!1),i.line(` private ${c} ${l} = new LinkedHashSet<>();`)):(Cn(i,o.lombok!==!1),i.line(` private ${c} ${l};`)),{type:c,name:l,category:0}}function Fr(e,t,o){var l,r;if(e.attrType==="EMBED_PREDEF"){const s=(l=o.embeddableCatalog)==null?void 0:l.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,f;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((f=s==null?void 0:s.fields[d])==null?void 0:f.physicalName)??""}})}const i=(r=e.embedded)!=null&&r.embeddableRef?t.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function Em(e,t,o,i,a){const l=Qt(In(t,o.entities)),r=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=Sn(s,l);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${t.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){r.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const f=s.physicalName||d.defaultPhysical;f&&f!==d.defaultPhysical&&r.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${f}"))`)}),r}function Hr(e,t,o,i,a){var f,p,m,y;const l=t.name,r=lo(t,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const b=(f=e.embedded)!=null&&f.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;if(b){s=b.name;const g=lo(b,o,i);g&&g!==r&&a.import(`${g}.${b.name}`)}}if(e.type==="Money")return[km(e,t,o,i,a)];const c=Fr(e,o,i),d=Em(e,t,o,c,a),u=Pa(e,o.associations);if(a.line(""),u){const b=o.associations.find(q=>{var B;return q.modelId===((B=e.embedded)==null?void 0:B.associationRef)}),g=b?b.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?b.end2:b.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const E=(m=g==null?void 0:g.jpa)==null?void 0:m.collectionTable;E?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${E}")`)):a.fillIn(`${l}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),Ya(d,a);const N=u==="SET";!N&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${s}>`:`List<${s}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${k};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),Ya(d,a),Cn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function km(e,t,o,i,a){a.jpa("Embedded"),a.import(Ue.compositeType),a.import(Ue.money),a.import(Ue.moneyUserType);const l=Fr(e,o,i),r=Qt(In(t,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var g,E;const u=((g=l[d])==null?void 0:g.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),f=Sn(c,r),p=((E=l[d])==null?void 0:E.defaultPhysical)||"",m=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!f&&!y&&(!m||m===p))return[];const b=[`name = "${f?f.physicalName:m||p}"`];return e.notNull&&b.push("nullable = false"),f?b.push("insertable = false","updatable = false"):(c.insertable===!1&&b.push("insertable = false"),c.updatable===!1&&b.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${b.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),Ya(s,a),Cn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function Ya(e,t){e.length!==0&&(t.jpa("AttributeOverride"),t.jpa("AttributeOverrides"),t.jpa("Column"),t.line(" @AttributeOverrides({"),e.forEach((o,i)=>t.line(` ${o}${i<e.length-1?",":""}`)),t.line(" })"))}function wm(e,t,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const l=new Map;for(const d of e.attributes)for(const u of d.dbAttrs)l.set(u.modelId,u.physicalName);for(const d of no(e,t.superClassCatalog??[]))l.set(d.modelId,d.physicalName);const r=a.map(d=>{const u=[];for(const p of d.columns){const m=l.get(p.columnRef);m?u.push(m):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${p.columnRef}) — 카탈로그 확인`)}const f=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${u.join(", ")}"${f})`});if(r.length===1)return`@Table(name = "${i}", indexes = { ${r[0]} })`;const s=r.map(d=>` ${d}`).join(`,
|
|
7
|
+
`);return`@Table(name = "${i}", indexes = {
|
|
8
|
+
${s}
|
|
9
|
+
})`}function ja(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function vm(e,t,o){var l;const i=o.get(t.end1.entityRef);if(e.derivedFrom){const r=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(r!=null&&r.dbAttrs[0])return r.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(r=>r.identifier&&r.dbAttrs.length>0);return(l=a==null?void 0:a.dbAttrs[0])==null?void 0:l.physicalName}function Gr(e,t,o,i,a){if(!e)return;const l=lo(e,o,i);l&&l!==t&&a.import(`${l}.${e.name}`)}function Nm(e,t,o,i,a,l,r,s,c){var N,h;const d=i.get(t.end1.entityRef),u=(d==null?void 0:d.name)??t.end1.entityRef,f=ja(t.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(f),Gr(d,o,r,s,c);const p=t.end2.jpa,m=[];e.notNull&&m.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),m.push(`fetch = FetchType.${p.fetchType}`)),(N=p==null?void 0:p.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),m.push(`cascade = { ${p.cascadeTypes.map(k=>`CascadeType.${k}`).join(", ")} }`));const y=e.dbAttrs[0];c.jpa("JoinColumn");const b=vm(e,t,i),g=(y==null?void 0:y.physicalName)||b||"",E=[];return g?E.push(`name = "${g}"`):c.fillIn(`${((h=i.get(t.end2.entityRef))==null?void 0:h.name)??""}.${e.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),b&&E.push(`referencedColumnName = "${b}"`),e.notNull&&E.push("nullable = false"),(y==null?void 0:y.insertable)===!1&&E.push("insertable = false"),(y==null?void 0:y.updatable)===!1&&E.push("updatable = false"),c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${f}${m.length?`(${m.join(", ")})`:""}`),c.line(` @JoinColumn(${E.join(", ")})`),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Cn(c,l),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function $m(e,t,o,i,a,l,r,s){const c=i.get(t.end2.entityRef),d=(c==null?void 0:c.name)??t.end2.entityRef;Gr(c,o,l,r,s);const u=c==null?void 0:c.attributes.find(q=>q.modelId===t.end2.attributeRef),f=(u==null?void 0:u.name)??"",p=ja(t.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${f}")`),Cn(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const m=t.end1.jpa,y=t.end1.composition||t.end2.composition;let b=(m==null?void 0:m.cascadeTypes)??[],g=m==null?void 0:m.orphanRemoval;y&&b.length===0&&(b=["ALL"],g==null&&(g=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const E=[`mappedBy = "${f}"`];b.length&&(s.jpa("CascadeType"),E.push(`cascade = { ${b.map(q=>`CascadeType.${q}`).join(", ")} }`)),g&&E.push("orphanRemoval = true"),m!=null&&m.fetchType&&(s.jpa("FetchType"),E.push(`fetch = FetchType.${m.fetchType}`)),s.line(` @OneToMany(${E.join(", ")})`),m!=null&&m.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${m.orderBy}")`));const N=(m==null?void 0:m.collectionType)==="SET";s.import(N?"java.util.Set":"java.util.List"),s.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${d}>`:`List<${d}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${k};`),{type:h,name:e.name,category:1,collection:!0}}function Im(e,t,o){o.jpa("Column");const i=[`name = "${(t==null?void 0:t.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),t){const a=io.has(t.dataType);t.length!=null&&i.push(a?`precision = ${t.length}`:`length = ${t.length}`),t.scale!=null&&i.push(`scale = ${t.scale}`),t.insertable===!1&&i.push("insertable = false"),t.updatable===!1&&i.push("updatable = false"),t.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function Sm(e,t,o){var r;const i=t.superClassCatalog??[],a=e.superClass||((r=i.find(s=>s.default))==null?void 0:r.name);if(!a||a==="Object")return"";const l=i.find(s=>s.name===a);return l!=null&&l.packageName?o.import(`${l.packageName}.${l.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function xm(e,t,o,i){i.import(Ue.serializable),i.import(Ue.objects),i.import(Ue.jsonUtils),o&&i.import(Ue.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of t)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${t.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of t)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of t)i.line(""),i.line(` public ${a.type} get${Dr(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${t.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${t.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function Cm(e,t,o){const i=[`${o}.${e}`,`${o}.${e}.${t}`,Ue.jpaRepository,Ue.querydslExecutor].sort(),a=[`package ${o};`,""];for(const l of i)a.push(`import ${l};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${t}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
7
10
|
`)+`
|
|
8
|
-
`}}function
|
|
11
|
+
`}}function Rm(e,t,o){const i=[`${t}.${e}`,Ue.jpaRepository,Ue.querydslExecutor].sort(),a=[`package ${t};`,""];for(const l of i)a.push(`import ${l};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
9
12
|
`)+`
|
|
10
|
-
`}}function Ga(e,t){return e.packageName||t.packageName||""}function De(){return crypto.randomUUID()}const Cm="CustomMoneyType",Rm="Money";function Vm(e){return!(e.type!==Cm||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Am(e){const t=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Rm,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Tm(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Vm(r)?(a=!0,t=!0,Am(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function Hr(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Gr(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Hr);if(!i.length)continue;const a=o.filter(s=>!Hr(s));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)});const r=[...a.slice(0,l),...i,...a.slice(l)];r.forEach((s,c)=>s.order=c),t.attributes=r}}function Cn(e){return JSON.parse(JSON.stringify(e))}function Yr(e,t,o){var H;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:l,layout:r}=e,s=new Set(t);if(o.includeRelated){const A=new Set(t);for(const S of l.associations){const L=A.has(S.end1.entityRef),ee=A.has(S.end2.entityRef);L!==ee&&s.add(L?S.end2.entityRef:S.end1.entityRef)}}const c=l.entities.filter(A=>s.has(A.modelId)),d=new Set(c.map(A=>A.modelId)),u=l.associations.filter(A=>d.has(A.end1.entityRef)&&d.has(A.end2.entityRef)),f=new Set(u.map(A=>A.modelId)),m=new Map,p=A=>{let S=m.get(A);return S||(S=i(),m.set(A,S)),S};for(const A of c){p(A.modelId);for(const S of A.attributes){p(S.modelId);for(const L of S.dbAttrs)p(L.modelId)}for(const S of A.indexes??[])p(S.modelId);for(const S of A.operations??[])p(S.modelId)}for(const A of u)p(A.modelId);const y=A=>m.get(A),b=c.map(A=>{const S=Cn(A);S.modelId=y(A.modelId),S.attributes=S.attributes.map(L=>Mm(L,y,f,d));for(const L of S.indexes??[])L.modelId=y(L.modelId),L.columns=L.columns.map(ee=>eo(ee.columnRef)?ee:{...ee,columnRef:y(ee.columnRef)}).filter(ee=>ee.columnRef!==void 0);for(const L of S.operations??[])L.modelId=y(L.modelId);return S});Gr(b);const g=u.map(A=>{const S=Cn(A);return S.modelId=y(A.modelId),S.end1=jr(S.end1,y),S.end2=jr(S.end2,y),S}),E=[];for(const A of l.groups){const S=A.memberEntityRefs.filter(ee=>d.has(ee));if(S.length===0)continue;const L=Cn(A);L.modelId=p(A.modelId),L.memberEntityRefs=S.map(ee=>y(ee)),E.push(L)}const $=new Set(o.existing.entities.map(A=>A.name)),h=new Set(o.existing.entities.map(A=>{var S;return(S=A.table)==null?void 0:S.physicalName}).filter(A=>!!A));for(const A of b)$.has(A.name)&&(A.name=`${A.name}_imported`),(H=A.table)!=null&&H.physicalName&&h.has(A.table.physicalName)&&(A.table.physicalName=`${A.table.physicalName}_imported`);const w=[];for(const A of r.entityLayouts){const S=y(A.entityRef);if(!S)continue;const L=Cn(A);L.entityRef=S,L.geo={...L.geo,location:Ya(L.geo.location,a)},L.attributeStyles&&(L.attributeStyles=Wr(L.attributeStyles,y)),L.operationStyles&&(L.operationStyles=Wr(L.operationStyles,y)),w.push(L)}const X=[];for(const A of r.associationLayouts){const S=y(A.associationRef);if(!S)continue;const L=Cn(A);L.associationRef=S,L.sourceColumnRef=A.sourceColumnRef?y(A.sourceColumnRef):void 0,L.targetColumnRef=A.targetColumnRef?y(A.targetColumnRef):void 0,L.waypoints=L.waypoints.map(ee=>Ya(ee,a)),X.push(L)}const B=[];for(const A of r.groupLayouts){const S=y(A.groupRef);if(!S)continue;const L=Cn(A);L.groupRef=S,L.geo={...L.geo,location:Ya(L.geo.location,a)},delete L.memberNoteRefs,B.push(L)}return{logical:{entities:b,associations:g,groups:E},layout:{entityLayouts:w,associationLayouts:X,groupLayouts:B},idMap:m}}function Ya(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Mm(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const l=t(a.sharedColumnRef);l?a.sharedColumnRef=l:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function jr(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function Wr(e,t){const o={};for(const[i,a]of Object.entries(e)){const l=t(i);l&&(o[l]=a)}return o}function ja(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function Rn(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)=>Rn(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(!Rn(e[i],t[i]))return!1;return!0}return!1}function en(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||Rn(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function tn(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 Bm(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 Om=new Set(["attributes","operations","indexes","rev"]),Dm=new Set(["end1","end2","rev"]),Lm=new Set(["memberEntityRefs","rev"]),Kr=new Set(["modelId"]),Pm=new Set(["modelId","columns"]),zm=new Set([]);function Um(e,t,o,i){const a=tn(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=en(s,c,Kr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=tn(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=en(s,c,Kr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=tn(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(!Rn(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=en(s,c,Pm);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Fm(e,t,o){const i=tn(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:ja(r)});for(const{cur:r,tgt:s}of i.common){const c=en(r,s,Om);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Um(r.modelId,r,s,o)}const a=tn(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:ja(r)});for(const{cur:r,tgt:s}of a.common){const c=en(r,s,Dm);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=en(r[d]??{},s[d]??{},zm);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=tn(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:ja(r)});for(const{cur:r,tgt:s}of l.common){const c=en(r,s,Lm);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Bm(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 ii(e,t,o,i,a,l,r){const s=tn(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)Rn(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 Hm(e,t,o){ii(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ii(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ii(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ii(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Gm(e,t){const o=[];return Fm(e.logical,t.logical,o),Hm(e.layout,t.layout,o),o}function Ym(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 jm={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 Wm{constructor(t){He(this,"out",[]);He(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({...ao(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({...ao(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({...ao(t),field:a,value:void 0,removed:!0});continue}this.out.push({...ao(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({...ao(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ao(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 kt(e,t,o,i){if(o==null||typeof o!="object")return;const a=jm[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function nn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function Wa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ft(e,t){var l,r,s,c,d,u,f,m;const o=Ym(t),i=new Wm(t.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?kt(i,p,y.value,"entity"):y.kind==="entity.update"?nn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Wa((l=y.value)==null?void 0:l.attributes,t.attributeRef);b&&kt(i,p,b,"attribute")}else y.kind==="attribute.add"&&((r=y.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?nn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Wa((s=y.value)==null?void 0:s.operations,t.operationRef);b&&kt(i,p,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?kt(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?nn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=Wa((d=y.value)==null?void 0:d.indexes,t.indexRef);b&&kt(i,p,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?kt(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?nn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?kt(i,p,y.value,"association"):y.kind==="association.update"?nn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const b=(f=y.value)==null?void 0:f[t.end];kt(i,p,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?nn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){kt(i,p,y.value,"group");const b=(m=y.value)==null?void 0:m.memberEntityRefs;if(Array.isArray(b))for(const g of b)i.member(p,g,!1)}else y.kind==="group.update"?nn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function Km(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Vn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function qm(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;Vn(c==null?void 0:c.attributes,o),Vn(c==null?void 0:c.operations,i),Vn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?Vn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?Vn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?Vn([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 ai(e,t){return e.map(o=>({...o,subject:t}))}function qr(e,t){const o=e.filter(s=>s.ops.some(c=>Km(c,t))),{attributes:i,operations:a,indexes:l}=qm(o,t),r=[...ai(Ft(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...ai(Ft(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...ai(Ft(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...ai(Ft(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 Xr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Xm(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 Zm(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 Jm(e){const{entities:t,associations:o,groups:i}=Zm(e),a=[];for(const l of t)for(const r of qr(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ft(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ft(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ft(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function Zr(e){const t=Jm(e),o=Xm(e),i=new Map;for(const r of t){const s=Xr(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=Xr(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)}class Ka{constructor(t){He(this,"undoStack",[]);He(this,"redoStack",[]);He(this,"savePoint",null);He(this,"listeners",new Set);He(this,"commandListeners",new Set);He(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 Jr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Je(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function pt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Ge(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function Vt(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 li(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=Jr(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const l=Je(i,e.modelId);l>=0&&i.layout.entityLayouts.splice(l,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Qr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Jr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Je(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(m=>m.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 es(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Ge(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Ge(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 ts(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Ge(i,e);o=a.name,a.name=t},invert(i){Ge(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 An(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Je(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=Je(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 ns(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Je(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=Je(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 lo(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 os(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=lo(l.style,t)},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Je(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 is(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Je(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=Je(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 as(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.locked,l.locked=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function qa(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 ri(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=lo(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Je(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 si(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(r=>r.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const l=i.layout.groupLayouts.findIndex(r=>r.groupRef===e.modelId);l>=0&&i.layout.groupLayouts.splice(l,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ls(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 rs(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 ss(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 ci(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 cs(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 ds(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 us(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=lo(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 fs(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function At(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Ge(o,e).attributes.push(t)},invert(o){const i=Ge(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 on(e,t,o){const i={},a=l=>{const r=Ge(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 Tn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Ge(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&&Ge(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 Xa(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Ge(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,m)=>f.order=m)},invert(a){i&&Ge(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Ge(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 ms(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Ge(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Ge(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 ps(e,t,o){const i={},a=l=>{var s;const r=(s=Ge(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 hs(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Ge(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=Ge(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 ys(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Ge(a,e),r=l.operations??[];i=r.map(m=>({...m}));const s=new Set(t),c=r.filter(m=>s.has(m.modelId)),d=r.filter(m=>!s.has(m.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((m,p)=>m.order=p),l.operations=r},invert(a){if(!i)return;const l=Ge(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Ge(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 gs(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=lo(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Je(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 di(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 bs(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 ui(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 Mn(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 _s(e,t){return{label:"인덱스 추가",apply(o){const i=Ge(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Ge(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 Es(e,t,o){const i={},a=l=>{var s;const r=(s=Ge(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 ks(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Ge(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&&Ge(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 wt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),ro=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function ws(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=pt(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=pt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=ro(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function vs(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=pt(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=pt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=ro(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Ns(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=pt(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=pt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[wt(e,ro(a,e))],invert:[wt(e,i??[])]}}}}function $s(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=pt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=pt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[wt(e,ro(o,e))],invert:[wt(e,t??[])]}}}}function Is(e,t,o){return{label:"waypoint 추가",apply(i){const a=pt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=pt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=ro(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Ss(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 xs(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 so(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 Cs(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 Rs(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 Vs(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=lo(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 As(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 Ts(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 Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),fi=(e,t,o)=>{var i;return((i=Vt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Ms(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 Bs(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 Os(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Vt(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=Vt(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=fi(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function Ds(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Vt(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Vt(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=fi(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function Ls(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Vt(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=Vt(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=fi(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function Ps(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Vt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Vt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,fi(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Ye(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 Qm=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:di,addAttribute:At,addEntity:li,addEntityToGroup:ss,addGroup:si,addIndex:_s,addNote:Ss,addNoteConnection:Ms,addNoteConnectionWaypoint:Ds,addNoteToGroup:As,addOperation:ms,addWaypoint:Is,clearNoteConnectionWaypoints:Ps,clearWaypoints:$s,composite:Ye,moveEntity:An,moveGroup:cs,moveNote:so,moveNoteConnectionWaypoint:Os,moveWaypoint:ws,removeAssociation:bs,removeAttribute:Tn,removeEntity:Qr,removeEntityFromGroup:ci,removeGroup:rs,removeIndex:ks,removeNote:xs,removeNoteConnection:Bs,removeNoteConnectionWaypoint:Ls,removeNoteFromGroup:Ts,removeOperation:hs,removeWaypoint:vs,renameEntity:ts,reorderAttributes:Xa,reorderOperations:ys,resizeEntity:ns,resizeGroup:ds,resizeNote:Cs,setAllEntitiesCollapsed:qa,setAttributeSwatch:ri,setEntityCollapsed:is,setEntityLocked:as,setEntitySwatch:os,setGroupLocked:fs,setGroupSwatch:us,setNoteMemo:Rs,setNoteSwatch:Vs,setOperationSwatch:gs,translateWaypoints:Ns,updateAssociation:ui,updateAssociationEnd:Mn,updateAttribute:on,updateEntity:es,updateGroup:ls,updateIndex:Es,updateOperation:ps},Symbol.toStringTag,{value:"Module"}));class zs{constructor(){He(this,"revs",new Map);He(this,"layoutVersion",0);He(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 Us{constructor(t){He(this,"cache",new zs);He(this,"newClientOpId");He(this,"debounceMs");He(this,"emissions",new WeakMap);He(this,"open",null);He(this,"debounceHandle",null);He(this,"queue",[]);He(this,"sending",!1);He(this,"_frozen",!1);He(this,"stack",null);He(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??De,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,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",l),(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 Fs=["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"],Hs=()=>crypto.randomUUID(),ep=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,tp=e=>e&&e[0].toLowerCase()+e.slice(1),np=e=>e&&e[0].toUpperCase()+e.slice(1),op=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function ip(e,t){return tp(e)+np(t)}function ap(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=ip(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:op(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const mi=(e,t)=>`${e}::${t}`,pi=e=>e??void 0;function lp(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||pi(s.length)!==pi(l.length)||pi(s.scale)!==pi(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 rp(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 co(e,t,o=Hs){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=>ap(e,f)),s=new Map(r.map(f=>[mi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[mi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const m=mi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(m)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,m)=>Math.max(f,m.order),-1)+1;for(const f of r){const m=mi(f.associationRef,f.sourceAttributeRef),p=d.get(m);if(!p)i.add.push(rp(f,u++,o));else{const y=lp(p,f,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function sp(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 cp(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function dp(e,t,o=Hs){const i=new Map,a=cp(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=co(a,d,o);if(ep(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(m=>m.modelId===d);f&&sp(f,u),l.has(d)||r.push(d)}}return i}function hi(e,t,o){var r;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const l=(r=a.derivedFrom)==null?void 0:r.associationRef;if(l){const s=e.associations.find(c=>c.modelId===l);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function up(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 fp(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 Gs(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function lt(e,t){const o=up(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 mp(e,t){const o=fp(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 pp(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 hp(e,t){const o=pp(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 yp(e,t){const o=e.filter(i=>i.physicalName===t.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function gp(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function bp(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function _p(e,t){const o=gp(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 Ep(e,t){const o=bp(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 Ys(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.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function js(e,t,o,i,a,l,r,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),f=[];let m=!1;for(const p of t.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=yp(In(i,a),b);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:l,entity:r,handle:b}:{code:"shared-column-target-ambiguous",opIndex:l,entity:r,handle:b,matches:g.matches}),m=!0;continue}f.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}f.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return m?null:{modelId:d,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:f}}function Ws(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 Ks(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=hp(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 kp(e,t,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],l=f=>a.find(m=>m.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,m)=>{var p,y,b;switch(f.kind){case"entity.add":{const g=i(),E={modelId:g,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},$={ref:f.spec.name};let h=!1;for(const[B,H]of(f.spec.attributes??[]).entries()){if(H.type==="GroupCodeEnum"&&!H.groupCode){s.push({code:"groupcode-required",opIndex:m,entity:$,handle:{ref:H.name}}),h=!0;continue}const A=l(H.type);if(A){const S=js(H,A,B,E,e.entities,m,$,s,i);S?E.attributes.push(S):h=!0}else(p=H.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:m,entity:$,handle:{ref:H.name}}),h=!0):E.attributes.push(Ys(H,B,i))}const w=(f.spec.operations??[]).map((B,H)=>Ws(B,H,i));w.length&&(E.operations=w);const X=[];for(const B of f.spec.indexes??[]){const H=Ks(E,B,m,$,s,i);H?X.push(H):h=!0}if(X.length&&(E.indexes=X),h)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:g,value:E});break}case"entity.update":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,patch:f.patch});break}case"entity.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:g.value.modelId});break}case"attribute.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:m,entity:f.entity,handle:{ref:f.spec.name}});break}const E=c.get(g.value.modelId)??g.value.attributes.length;c.set(g.value.modelId,E+1);const $=l(f.spec.type);let h;if($)h=js(f.spec,$,E,g.value,e.entities,m,f.entity,s,i);else if((y=f.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:m,entity:f.entity,handle:{ref:f.spec.name}});break}else h=Ys(f.spec,E,i);if(!h)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,value:h});break}case"attribute.update":case"attribute.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}const E=mp(g.value,f.attribute);if(!E.ok){s.push(E.reason==="not-found"?{code:"attribute-not-found",opIndex:m,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:m,entity:f.entity,handle:f.attribute,matches:E.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:E.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:E.value.modelId});break}case"association.add":{const g=lt(e,f.spec.from),E=lt(e,f.spec.to);if(g.ok||s.push(rt(g.reason,m,f.spec.from,g.matches,u)),E.ok||s.push(rt(E.reason,m,f.spec.to,E.matches,u)),!g.ok||!E.ok)break;if(f.spec.identifying&&g.value.modelId===E.value.modelId){s.push({code:"self-identifying",opIndex:m,handle:{from:f.spec.from,to:f.spec.to}});break}const $=i(),h={modelId:$,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:g.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:E.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},w={...e,associations:[...e.associations,h]},X=co(w,E.value.modelId,i);X.add[0]&&(h.end2.attributeRef=X.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:$,value:h});for(const B of X.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:E.value.modelId,entityRef:E.value.modelId,value:B});break}case"association.remove":{const g=lt(e,f.association.from),E=lt(e,f.association.to);if(g.ok||s.push(rt(g.reason,m,f.association.from,g.matches,u)),E.ok||s.push(rt(E.reason,m,f.association.to,E.matches,u)),!g.ok||!E.ok)break;const $=Gs(e,g.value.modelId,E.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:m,handle:f.association}:{code:"association-ambiguous",opIndex:m,handle:f.association,matches:$.map(h=>h.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:$[0].modelId});break}case"association.update":{const g=qs(e,f.association,m,s,u);if(!g)break;r.push({kind:"association.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,patch:f.patch});break}case"associationEnd.update":{const g=qs(e,f.association,m,s,u);if(!g)break;const E=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,end:E,patch:f.patch});break}case"index.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}const E=Ks(g.value,f.spec,m,f.entity,s,i);if(!E)break;r.push({kind:"index.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.modelId,value:E});break}case"index.update":case"index.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}const E=_p(g.value,f.index);if(!E.ok){s.push(E.reason==="not-found"?{code:"index-not-found",opIndex:m,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:m,entity:f.entity,handle:f.index,matches:E.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:m,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.value.modelId});break}case"operation.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}const E=d.get(g.value.modelId)??((b=g.value.operations)==null?void 0:b.length)??0;d.set(g.value.modelId,E+1);const $=Ws(f.spec,E,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,m,f.entity,g.matches,u));break}const E=Ep(g.value,f.operation);if(!E.ok){s.push(E.reason==="not-found"?{code:"operation-not-found",opIndex:m,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:m,entity:f.entity,handle:f.operation,matches:E.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:E.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:E.value.modelId});break}case"group.add":{const g=[];let E=!1;for(const w of f.spec.members){const X=lt(e,w);if(!X.ok){s.push(rt(X.reason,m,w,X.matches,u)),E=!0;continue}g.push(X.value.modelId)}if(E)break;const $=i(),h={modelId:$,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:g,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:$,value:h});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function rt(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 qs(e,t,o,i,a){const l=lt(e,t.from),r=lt(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(rt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=Gs(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 Xs={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},wp={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},vp={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},yi={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Np={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...yi,description:"속성 설명(다국어)."},columnLogicalName:{...yi,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(type이 카탈로그 엔트리일 때만). field=카탈로그 필드명으로 매칭 (@AttributeOverride 대응). 미설정 서브컬럼은 카탈로그 기본 상속. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}}},required:["name","type"],additionalProperties:!1},Zs={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},$p={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Zs,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Zs,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},Ip={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Xs,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},Sp={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...yi,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},xp={type:"object",properties:{name:{...yi,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},Cp={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function nt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Rp={"entity.add":nt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":nt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":nt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":nt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":nt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":nt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":nt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":nt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":nt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":nt("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":nt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":nt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":nt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":nt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":nt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":nt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":nt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Js={anyOf:Fs.map(e=>Rp[e])},Vp={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Xs,assocHandle:wp,entitySpec:vp,attrSpec:Np,assocSpec:$p,indexSpec:Ip,operationSpec:Sp,groupSpec:xp,patch:Cp,symbolicOp:Js}};function Ap(e,t,o,i={}){const a=i.mkClientOpId??De,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 Qs={location:{x:0,y:0},size:{width:220,height:140}};function ec(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 Tp=/^[-=_*~\s]{3,}$/;function Mp(e){return e.attrType&&e.attrType!=="NORMAL"||!Tp.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Bp(e){return e.type===Et&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Op(e,t){if(e.attrType==="DIVIDER"||Mp(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Bp(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(ec)}}function Dp(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 Lp(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 Pp(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(Op),operations:(t=e.operations)==null?void 0:t.map(Dp),indexes:(o=e.indexes)==null?void 0:o.map(Lp),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function zp(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??{...Qs},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function tc(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 Za(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:tc(e)}}function Up(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Za(e.end1),end2:Za(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 nc(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function oc(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ic(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 ac(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_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(ec)}}function Fp(e,t,o){var g,E;const i=nc(e.end1.attribute),a=nc(e.end2.attribute);if(i===a)return Up(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(E=(g=s.dbAttrs)==null?void 0:g[0])==null?void 0:E.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce(($,h)=>Math.max($,h.order),-1)+1:s.order??0,m={...ac(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(m);const p=($,h)=>({entityRef:$.endModel.refId,multiplicity:$.multiplicity,navigable:$.navigable,composition:$.composition,attributeRef:h?d:m.modelId,legacyNavRaw:h?void 0:$.attribute,jpa:tc($)}),y={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:b}}function Hp(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 Gp(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.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((b,g)=>Math.max(b,g.order),-1)+1:r.order??0,d={...ac(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>Hp(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...Za(b),legacyEmbedRaw:b.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},m=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:m?d.modelId:void 0,targetColumnRef:m?void 0:d.modelId,style:e.style};return{assoc:f,layout:p}}function Yp(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 lc(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=Yp(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 rc(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(r=>[r.modelId,r])),a=new Map(t.map(r=>[r.modelId,r])),l=(r,s)=>{var c;return!!s&&!!((c=i.get(r??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const r of o){const s=a.get(r.associationRef);s&&(r.sourceColumnRef&&!l(s.end1.entityRef,r.sourceColumnRef)&&(r.sourceColumnRef=void 0),r.targetColumnRef&&!l(s.end2.entityRef,r.targetColumnRef)&&(r.targetColumnRef=void 0))}}function jp(e){return(e.schemaVersion??1)>=2&&"logical"in e?Wp(e):Kp(e)}function Wp(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:m,...p}=f;return m!=null&&(o[f.modelId]=m),p},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout;rc(a,l,c.associationLayouts);const 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 Kp(e){var E,$;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(h,w)=>{o.push(Pp(h));const X=zp(h);X.geo={location:{x:X.geo.location.x+w.x,y:X.geo.location.y+w.y},size:X.geo.size},i.push(X);for(const B of h.ownedAssociations??[])c.push(B)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const f=[];for(const h of e.groups??[]){const w=h.entities??[];r.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:w.map(B=>B.modelId)});const X=((E=h.geo)==null?void 0:E.location)??u;if(h.geo){const B=(h.notes??[]).map(H=>H.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:B.length?B:void 0})}for(const B of w)d(B,X);for(const B of h.notes??[])f.push(lc(B,X))}const m=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const w of h.attributes)for(const X of w.dbAttrs)p.set(X.modelId,w.modelId),y.set(X.modelId,X);for(const h of c)for(const w of[h.end1,h.end2]){const X=w.attribute;if(X&&((($=X.dbAttrs)==null?void 0:$.length)??0)>0)for(const B of X.dbAttrs)B.modelId&&p.set(B.modelId,X.modelId)}for(const h of c){const w=oc(h.end1.attribute),X=oc(h.end2.attribute),B=ic(h.end1)||ic(h.end2),{assoc:H,layout:A}=w!==X||B?Gp(h,m,y):Fp(h,m,p);a.push(H),l.push(A)}rc(o,a,l),Gr(o);const b={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(h=>lc(h)),...f]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function sc(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 qp(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,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(sc),style:t}}function Xp(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 Zp(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 Gt(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 Jp(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{...sc(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function Qp(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 eh(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 th(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function nh(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:th(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 oh(e,t,o){let i;for(const f of t.logical.entities){const m=f.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(m){i=m;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,m)=>nh(f,r[m]))},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:Gt(e.end1,c?s:u),end2:Gt(e.end2,c?u:s)}}function ih(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:Gt(e.end1,e.end1.legacyEmbedRaw),end2:Gt(e.end2,e.end2.legacyEmbedRaw)};const a=oh(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(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),f=t.logical.entities.find(y=>y.modelId===c.entityRef),m=u?Jp(u,f):void 0,p=s.legacyNavRaw;return{...i,end1:Gt(e.end1,l?p:m),end2:Gt(e.end2,r?p:m)}}return{...i,end1:Gt(e.end1),end2:Gt(e.end2)}}function cc(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(m=>m.entityRef===e.modelId),r=t.logical.associations.filter(m=>m.end1.entityRef===e.modelId),s=m=>t.layout.associationLayouts.find(p=>p.associationRef===m),c=(l==null?void 0:l.geo)??{...Qs},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(m=>!o.has(m.modelId)&&!i.has(m.modelId)).map(m=>{var p;return qp(m,(p=l==null?void 0:l.attributeStyles)==null?void 0:p[m.modelId])}),operations:(u=e.operations)==null?void 0:u.map(m=>{var p;return Xp(m,(p=l==null?void 0:l.operationStyles)==null?void 0:p[m.modelId])}),ownedAssociations:r.map(m=>ih(m,t,s(m.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Zp),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,locked:l==null?void 0:l.locked}}function ah(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=>dc(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>cc(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,locked:a==null?void 0:a.locked}}function dc(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 lh(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Qp(e),l=eh(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=>cc(s,e,a,l)),groups:e.logical.groups.map(s=>ah(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>dc(s))}}function rh(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 uo(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Tt(e){return typeof e=="function"?e():n.unref(e)}const sh=typeof window<"u"&&typeof document<"u",ch=e=>typeof e<"u",dh=Object.prototype.toString,uh=e=>dh.call(e)==="[object Object]",fh=()=>{};function mh(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 uc=e=>e();function ph(e=uc){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 fc(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function hh(e,t,o={}){const{eventFilter:i=uc,...a}=o;return n.watch(e,mh(i,t),a)}function Bn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=ph(i);return{stop:hh(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function yh(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=Tt(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 Ja(e,t=!1){function o(f,{flush:m="sync",deep:p=!1,timeout:y,throwOnTimeout:b}={}){let g=null;const $=[new Promise(h=>{g=n.watch(e,w=>{f(w)!==t&&(g==null||g(),h(w))},{flush:m,deep:p,immediate:!0})})];return y!=null&&$.push(fc(y,b).then(()=>Tt(e)).finally(()=>g==null?void 0:g())),Promise.race($)}function i(f,m){if(!n.isRef(f))return o(w=>w===f,m);const{flush:p="sync",deep:y=!1,timeout:b,throwOnTimeout:g}=m??{};let E=null;const h=[new Promise(w=>{E=n.watch([e,f],([X,B])=>{t!==(X===B)&&(E==null||E(),w(X))},{flush:p,deep:y,immediate:!0})})];return b!=null&&h.push(fc(b,g).then(()=>Tt(e)).finally(()=>(E==null||E(),Tt(e)))),Promise.race(h)}function a(f){return o(m=>!!m,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,m){return o(p=>{const y=Array.from(p);return y.includes(f)||y.includes(Tt(f))},m)}function d(f){return u(1,f)}function u(f=1,m){let p=-1;return o(()=>(p+=1,p>=f),m)}return Array.isArray(Tt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Ja(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Ja(e,!t)}}}function Qa(e){return Ja(e)}function gh(e){var t;const o=Tt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const mc=sh?window:void 0;function pc(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=mc):[t,o,i,a]=e,!t)return fh;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,m,p)=>(u.addEventListener(f,m,p),()=>u.removeEventListener(f,m,p)),c=n.watch(()=>[gh(t),Tt(a)],([u,f])=>{if(r(),!u)return;const m=uh(f)?{...f}:f;l.push(...o.flatMap(p=>i.map(y=>s(u,p,y,m))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return uo(d),d}function bh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function hc(...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=mc,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=bh(t);return pc(a,l,u=>{u.repeat&&Tt(s)||c(u)&&o(u)},r)}function _h(e){return JSON.parse(JSON.stringify(e))}function el(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:m}=i,p=n.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((r=(l=p==null?void 0:p.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(p==null?void 0:p.proxy));let b=d;t||(t="modelValue"),b=b||`update:${t.toString()}`;const g=h=>s?typeof s=="function"?s(h):_h(h):h,E=()=>ch(e[t])?g(e[t]):f,$=h=>{m?m(h)&&y(b,h):y(b,h)};if(c){const h=E(),w=n.ref(h);let X=!1;return n.watch(()=>e[t],B=>{X||(X=!0,w.value=g(B),n.nextTick(()=>X=!1))}),n.watch(w,B=>{!X&&(B!==e[t]||u)&&$(B)},{deep:u}),w}else return n.computed({get(){return E()},set(h){$(h)}})}var Eh={value:()=>{}};function gi(){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 bi(o)}function bi(e){this._=e}function kh(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}})}bi.prototype=gi.prototype={constructor:bi,on:function(e,t){var o=this._,i=kh(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=wh(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]=yc(o[a],e.name,t);else if(t==null)for(a in o)o[a]=yc(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 bi(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 wh(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function yc(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Eh,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var tl="http://www.w3.org/1999/xhtml";const gc={svg:"http://www.w3.org/2000/svg",xhtml:tl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _i(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),gc.hasOwnProperty(t)?{space:gc[t],local:e}:e}function vh(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===tl&&t.documentElement.namespaceURI===tl?t.createElement(e):t.createElementNS(o,e)}}function Nh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bc(e){var t=_i(e);return(t.local?Nh:vh)(t)}function $h(){}function nl(e){return e==null?$h:function(){return this.querySelector(e)}}function Ih(e){typeof e!="function"&&(e=nl(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 ut(i,this._parents)}function Sh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xh(){return[]}function _c(e){return e==null?xh:function(){return this.querySelectorAll(e)}}function Ch(e){return function(){return Sh(e.apply(this,arguments))}}function Rh(e){typeof e=="function"?e=Ch(e):e=_c(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 ut(i,a)}function Ec(e){return function(){return this.matches(e)}}function kc(e){return function(t){return t.matches(e)}}var Vh=Array.prototype.find;function Ah(e){return function(){return Vh.call(this.children,e)}}function Th(){return this.firstElementChild}function Mh(e){return this.select(e==null?Th:Ah(typeof e=="function"?e:kc(e)))}var Bh=Array.prototype.filter;function Oh(){return Array.from(this.children)}function Dh(e){return function(){return Bh.call(this.children,e)}}function Lh(e){return this.selectAll(e==null?Oh:Dh(typeof e=="function"?e:kc(e)))}function Ph(e){typeof e!="function"&&(e=Ec(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 ut(i,this._parents)}function wc(e){return new Array(e.length)}function zh(){return new ut(this._enter||this._groups.map(wc),this._parents)}function Ei(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ei.prototype={constructor:Ei,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 Uh(e){return function(){return e}}function Fh(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 Ei(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Hh(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,m=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(m[s]=p=r.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<f;++s)p=r.call(e,l[s],s,l)+"",(c=d.get(p))?(i[s]=c,c.__data__=l[s],d.delete(p)):o[s]=new Ei(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(m[s])===c&&(a[s]=c)}function Gh(e){return e.__data__}function Yh(e,t){if(!arguments.length)return Array.from(this,Gh);var o=t?Hh:Fh,i=this._parents,a=this._groups;typeof e!="function"&&(e=Uh(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],m=f.length,p=jh(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),g=r[d]=new Array(y),E=c[d]=new Array(m);o(u,f,b,g,E,p,t);for(var $=0,h=0,w,X;$<y;++$)if(w=b[$]){for($>=h&&(h=$+1);!(X=g[h])&&++h<y;);w._next=X||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function jh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wh(){return new ut(this._exit||this._groups.map(wc),this._parents)}function Kh(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 qh(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,m=s[c]=new Array(f),p,y=0;y<f;++y)(p=d[y]||u[y])&&(m[y]=p);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function Xh(){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 Zh(e){e||(e=Jh);function t(f,m){return f&&m?e(f.__data__,m.__data__):!f-!m}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 ut(a,this._parents).order()}function Jh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ey(){return Array.from(this)}function ty(){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 ny(){let e=0;for(const t of this)++e;return e}function oy(){return!this.node()}function iy(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 ay(e){return function(){this.removeAttribute(e)}}function ly(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ry(e,t){return function(){this.setAttribute(e,t)}}function sy(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cy(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function dy(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 uy(e,t){var o=_i(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?ly:ay:typeof t=="function"?o.local?dy:cy:o.local?sy:ry)(o,t))}function vc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fy(e){return function(){this.style.removeProperty(e)}}function my(e,t,o){return function(){this.style.setProperty(e,t,o)}}function py(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function hy(e,t,o){return arguments.length>1?this.each((t==null?fy:typeof t=="function"?py:my)(e,t,o??"")):On(this.node(),e)}function On(e,t){return e.style.getPropertyValue(t)||vc(e).getComputedStyle(e,null).getPropertyValue(t)}function yy(e){return function(){delete this[e]}}function gy(e,t){return function(){this[e]=t}}function by(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function _y(e,t){return arguments.length>1?this.each((t==null?yy:typeof t=="function"?by:gy)(e,t)):this.node()[e]}function Nc(e){return e.trim().split(/^|\s+/)}function ol(e){return e.classList||new $c(e)}function $c(e){this._node=e,this._names=Nc(e.getAttribute("class")||"")}$c.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 Ic(e,t){for(var o=ol(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Sc(e,t){for(var o=ol(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Ey(e){return function(){Ic(this,e)}}function ky(e){return function(){Sc(this,e)}}function wy(e,t){return function(){(t.apply(this,arguments)?Ic:Sc)(this,e)}}function vy(e,t){var o=Nc(e+"");if(arguments.length<2){for(var i=ol(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?wy:t?Ey:ky)(o,t))}function Ny(){this.textContent=""}function $y(e){return function(){this.textContent=e}}function Iy(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sy(e){return arguments.length?this.each(e==null?Ny:(typeof e=="function"?Iy:$y)(e)):this.node().textContent}function xy(){this.innerHTML=""}function Cy(e){return function(){this.innerHTML=e}}function Ry(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vy(e){return arguments.length?this.each(e==null?xy:(typeof e=="function"?Ry:Cy)(e)):this.node().innerHTML}function Ay(){this.nextSibling&&this.parentNode.appendChild(this)}function Ty(){return this.each(Ay)}function My(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function By(){return this.each(My)}function Oy(e){var t=typeof e=="function"?e:bc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Dy(){return null}function Ly(e,t){var o=typeof e=="function"?e:bc(e),i=t==null?Dy:typeof t=="function"?t:nl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Py(){var e=this.parentNode;e&&e.removeChild(this)}function zy(){return this.each(Py)}function Uy(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fy(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hy(e){return this.select(e?Fy:Uy)}function Gy(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yy(e){return function(t){e.call(this,t,this.__data__)}}function jy(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 Wy(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 Ky(e,t,o){return function(){var i=this.__on,a,l=Yy(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 qy(e,t,o){var i=jy(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?Ky:Wy,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function xc(e,t,o){var i=vc(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 Xy(e,t){return function(){return xc(this,e,t)}}function Zy(e,t){return function(){return xc(this,e,t.apply(this,arguments))}}function Jy(e,t){return this.each((typeof t=="function"?Zy:Xy)(e,t))}function*Qy(){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 Cc=[null];function ut(e,t){this._groups=e,this._parents=t}function fo(){return new ut([[document.documentElement]],Cc)}function eg(){return this}ut.prototype=fo.prototype={constructor:ut,select:Ih,selectAll:Rh,selectChild:Mh,selectChildren:Lh,filter:Ph,data:Yh,enter:zh,exit:Wh,join:Kh,merge:qh,selection:eg,order:Xh,sort:Zh,call:Qh,nodes:ey,node:ty,size:ny,empty:oy,each:iy,attr:uy,style:hy,property:_y,classed:vy,text:Sy,html:Vy,raise:Ty,lower:By,append:Oy,insert:Ly,remove:zy,clone:Hy,datum:Gy,on:qy,dispatch:Jy,[Symbol.iterator]:Qy};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Cc)}function tg(e){let t;for(;t=e.sourceEvent;)e=t;return e}function vt(e,t){if(e=tg(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 ng={passive:!1},mo={capture:!0,passive:!1};function il(e){e.stopImmediatePropagation()}function Dn(e){e.preventDefault(),e.stopImmediatePropagation()}function Rc(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Dn,mo);"onselectstart"in t?o.on("selectstart.drag",Dn,mo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Vc(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Dn,mo),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 ki=e=>()=>e;function al(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}})}al.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function og(e){return!e.ctrlKey&&!e.button}function ig(){return this.parentNode}function ag(e,t){return t??{x:e.x,y:e.y}}function lg(){return navigator.maxTouchPoints||"ontouchstart"in this}function rg(){var e=og,t=ig,o=ag,i=lg,a={},l=gi("start","drag","end"),r=0,s,c,d,u,f=0;function m(w){w.on("mousedown.drag",p).filter(i).on("touchstart.drag",g).on("touchmove.drag",E,ng).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,X){if(!(u||!e.call(this,w,X))){var B=h(this,t.call(this,w,X),w,X,"mouse");B&&(ht(w.view).on("mousemove.drag",y,mo).on("mouseup.drag",b,mo),Rc(w.view),il(w),d=!1,s=w.clientX,c=w.clientY,B("start",w))}}function y(w){if(Dn(w),!d){var X=w.clientX-s,B=w.clientY-c;d=X*X+B*B>f}a.mouse("drag",w)}function b(w){ht(w.view).on("mousemove.drag mouseup.drag",null),Vc(w.view,d),Dn(w),a.mouse("end",w)}function g(w,X){if(e.call(this,w,X)){var B=w.changedTouches,H=t.call(this,w,X),A=B.length,S,L;for(S=0;S<A;++S)(L=h(this,H,w,X,B[S].identifier,B[S]))&&(il(w),L("start",w,B[S]))}}function E(w){var X=w.changedTouches,B=X.length,H,A;for(H=0;H<B;++H)(A=a[X[H].identifier])&&(Dn(w),A("drag",w,X[H]))}function $(w){var X=w.changedTouches,B=X.length,H,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),H=0;H<B;++H)(A=a[X[H].identifier])&&(il(w),A("end",w,X[H]))}function h(w,X,B,H,A,S){var L=l.copy(),ee=vt(S||B,X),M,oe,_;if((_=o.call(w,new al("beforestart",{sourceEvent:B,target:m,identifier:A,active:r,x:ee[0],y:ee[1],dx:0,dy:0,dispatch:L}),H))!=null)return M=_.x-ee[0]||0,oe=_.y-ee[1]||0,function Y(T,W,Q){var te=ee,C;switch(T){case"start":a[A]=Y,C=r++;break;case"end":delete a[A],--r;case"drag":ee=vt(Q||W,X),C=r;break}L.call(T,w,new al(T,{sourceEvent:W,subject:_,target:m,identifier:A,active:C,x:ee[0]+M,y:ee[1]+oe,dx:ee[0]-te[0],dy:ee[1]-te[1],dispatch:L}),H)}}return m.filter=function(w){return arguments.length?(e=typeof w=="function"?w:ki(!!w),m):e},m.container=function(w){return arguments.length?(t=typeof w=="function"?w:ki(w),m):t},m.subject=function(w){return arguments.length?(o=typeof w=="function"?w:ki(w),m):o},m.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:ki(!!w),m):i},m.on=function(){var w=l.on.apply(l,arguments);return w===l?m:w},m.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,m):Math.sqrt(f)},m}function ll(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Ac(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function po(){}var ho=.7,wi=1/ho,Ln="\\s*([+-]?\\d+)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sg=/^#([0-9a-f]{3,8})$/,cg=new RegExp(`^rgb\\(${Ln},${Ln},${Ln}\\)$`),dg=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),ug=new RegExp(`^rgba\\(${Ln},${Ln},${Ln},${yo}\\)$`),fg=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${yo}\\)$`),mg=new RegExp(`^hsl\\(${yo},${Nt},${Nt}\\)$`),pg=new RegExp(`^hsla\\(${yo},${Nt},${Nt},${yo}\\)$`),Tc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ll(po,an,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Mc,formatHex:Mc,formatHex8:hg,formatHsl:yg,formatRgb:Bc,toString:Bc});function Mc(){return this.rgb().formatHex()}function hg(){return this.rgb().formatHex8()}function yg(){return zc(this).formatHsl()}function Bc(){return this.rgb().formatRgb()}function an(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=sg.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Oc(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?vi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?vi(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=cg.exec(e))?new st(t[1],t[2],t[3],1):(t=dg.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ug.exec(e))?vi(t[1],t[2],t[3],t[4]):(t=fg.exec(e))?vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mg.exec(e))?Pc(t[1],t[2]/100,t[3]/100,1):(t=pg.exec(e))?Pc(t[1],t[2]/100,t[3]/100,t[4]):Tc.hasOwnProperty(e)?Oc(Tc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function Oc(e){return new st(e>>16&255,e>>8&255,e&255,1)}function vi(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function gg(e){return e instanceof po||(e=an(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function rl(e,t,o,i){return arguments.length===1?gg(e):new st(e,t,o,i??1)}function st(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}ll(st,rl,Ac(po,{brighter(e){return e=e==null?wi:Math.pow(wi,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ho:Math.pow(ho,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(ln(this.r),ln(this.g),ln(this.b),Ni(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:Dc,formatHex:Dc,formatHex8:bg,formatRgb:Lc,toString:Lc}));function Dc(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}`}function bg(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}${rn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Lc(){const e=Ni(this.opacity);return`${e===1?"rgb(":"rgba("}${ln(this.r)}, ${ln(this.g)}, ${ln(this.b)}${e===1?")":`, ${e})`}`}function Ni(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ln(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rn(e){return e=ln(e),(e<16?"0":"")+e.toString(16)}function Pc(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new yt(e,t,o,i)}function zc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof po||(e=an(e)),!e)return new yt;if(e instanceof yt)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 yt(r,s,c,e.opacity)}function _g(e,t,o,i){return arguments.length===1?zc(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}ll(yt,_g,Ac(po,{brighter(e){return e=e==null?wi:Math.pow(wi,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ho:Math.pow(ho,e),new yt(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 st(sl(e>=240?e-240:e+120,a,i),sl(e,a,i),sl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(Uc(this.h),$i(this.s),$i(this.l),Ni(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=Ni(this.opacity);return`${e===1?"hsl(":"hsla("}${Uc(this.h)}, ${$i(this.s)*100}%, ${$i(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Uc(e){return e=(e||0)%360,e<0?e+360:e}function $i(e){return Math.max(0,Math.min(1,e||0))}function sl(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 cl=e=>()=>e;function Eg(e,t){return function(o){return e+o*t}}function kg(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 wg(e){return(e=+e)==1?Fc:function(t,o){return o-t?kg(t,o,e):cl(isNaN(t)?o:t)}}function Fc(e,t){var o=t-e;return o?Eg(e,o):cl(isNaN(e)?t:e)}const Ii=(function e(t){var o=wg(t);function i(a,l){var r=o((a=rl(a)).r,(l=rl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Fc(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 vg(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 Ng(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $g(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]=go(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 Ig(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function $t(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Sg(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]=go(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var dl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ul=new RegExp(dl.source,"g");function xg(e){return function(){return e}}function Cg(e){return function(t){return e(t)+""}}function Hc(e,t){var o=dl.lastIndex=ul.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=dl.exec(e))&&(a=ul.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:$t(i,a)})),o=ul.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Cg(c[0].x):xg(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 go(e,t){var o=typeof t,i;return t==null||o==="boolean"?cl(t):(o==="number"?$t:o==="string"?(i=an(t))?(t=i,Ii):Hc:t instanceof an?Ii:t instanceof Date?Ig:Ng(t)?vg:Array.isArray(t)?$g:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Sg:$t)(e,t)}var Gc=180/Math.PI,fl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yc(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)*Gc,skewX:Math.atan(c)*Gc,scaleX:r,scaleY:s}}var Si;function Rg(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fl:Yc(t.a,t.b,t.c,t.d,t.e,t.f)}function Vg(e){return e==null||(Si||(Si=document.createElementNS("http://www.w3.org/2000/svg","g")),Si.setAttribute("transform",e),!(e=Si.transform.baseVal.consolidate()))?fl:(e=e.matrix,Yc(e.a,e.b,e.c,e.d,e.e,e.f))}function jc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push("translate(",null,t,null,o);y.push({i:b-4,x:$t(d,f)},{i:b-2,x:$t(u,m)})}else(f||m)&&p.push("translate("+f+t+m+o)}function r(d,u,f,m){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),m.push({i:f.push(a(f)+"rotate(",null,i)-2,x:$t(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,m){d!==u?m.push({i:f.push(a(f)+"skewX(",null,i)-2,x:$t(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:$t(d,f)},{i:b-2,x:$t(u,m)})}else(f!==1||m!==1)&&p.push(a(p)+"scale("+f+","+m+")")}return function(d,u){var f=[],m=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,m),r(d.rotate,u.rotate,f,m),s(d.skewX,u.skewX,f,m),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,m),d=u=null,function(p){for(var y=-1,b=m.length,g;++y<b;)f[(g=m[y]).i]=g.x(p);return f.join("")}}}var Ag=jc(Rg,"px, ","px)","deg)"),Tg=jc(Vg,", ",")",")"),Mg=1e-12;function Wc(e){return((e=Math.exp(e))+1/e)/2}function Bg(e){return((e=Math.exp(e))-1/e)/2}function Og(e){return((e=Math.exp(2*e))-1)/(e+1)}const xi=(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],m=r[2],p=u-s,y=f-c,b=p*p+y*y,g,E;if(b<Mg)E=Math.log(m/d)/t,g=function(H){return[s+H*p,c+H*y,d*Math.exp(t*H*E)]};else{var $=Math.sqrt(b),h=(m*m-d*d+i*b)/(2*d*o*$),w=(m*m-d*d-i*b)/(2*m*o*$),X=Math.log(Math.sqrt(h*h+1)-h),B=Math.log(Math.sqrt(w*w+1)-w);E=(B-X)/t,g=function(H){var A=H*E,S=Wc(X),L=d/(o*$)*(S*Og(t*A+X)-Bg(X));return[s+L*p,c+L*y,d*S/Wc(t*A+X)]}}return g.duration=E*1e3*t/Math.SQRT2,g}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 Pn=0,bo=0,_o=0,Kc=1e3,Ci,Eo,Ri=0,sn=0,Vi=0,ko=typeof performance=="object"&&performance.now?performance:Date,qc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ml(){return sn||(qc(Dg),sn=ko.now()+Vi)}function Dg(){sn=0}function Ai(){this._call=this._time=this._next=null}Ai.prototype=Xc.prototype={constructor:Ai,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ml():+o)+(t==null?0:+t),!this._next&&Eo!==this&&(Eo?Eo._next=this:Ci=this,Eo=this),this._call=e,this._time=o,pl()},stop:function(){this._call&&(this._call=null,this._time=1/0,pl())}};function Xc(e,t,o){var i=new Ai;return i.restart(e,t,o),i}function Lg(){ml(),++Pn;for(var e=Ci,t;e;)(t=sn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Pn}function Zc(){sn=(Ri=ko.now())+Vi,Pn=bo=0;try{Lg()}finally{Pn=0,zg(),sn=0}}function Pg(){var e=ko.now(),t=e-Ri;t>Kc&&(Vi-=t,Ri=e)}function zg(){for(var e,t=Ci,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:Ci=o);Eo=e,pl(i)}function pl(e){if(!Pn){bo&&(bo=clearTimeout(bo));var t=e-sn;t>24?(e<1/0&&(bo=setTimeout(Zc,e-ko.now()-Vi)),_o&&(_o=clearInterval(_o))):(_o||(Ri=ko.now(),_o=setInterval(Pg,Kc)),Pn=1,qc(Zc))}}function Jc(e,t,o){var i=new Ai;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Ug=gi("start","end","cancel","interrupt"),Fg=[],Qc=0,ed=1,hl=2,Ti=3,td=4,yl=5,Mi=6;function Bi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Hg(e,o,{name:t,index:i,group:a,on:Ug,tween:Fg,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Qc})}function gl(e,t){var o=gt(e,t);if(o.state>Qc)throw new Error("too late; already scheduled");return o}function It(e,t){var o=gt(e,t);if(o.state>Ti)throw new Error("too late; already running");return o}function gt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Hg(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Xc(l,0,o.time);function l(d){o.state=ed,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,m,p;if(o.state!==ed)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Ti)return Jc(r);p.state===td?(p.state=Mi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Mi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Jc(function(){o.state===Ti&&(o.state=td,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=hl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===hl){for(o.state=Ti,a=new Array(m=o.tween.length),u=0,f=-1;u<m;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=p);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=yl,1),f=-1,m=a.length;++f<m;)a[f].call(e,u);o.state===yl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Mi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Oi(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>hl&&i.state<yl,i.state=Mi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Gg(e){return this.each(function(){Oi(this,e)})}function Yg(e,t){var o,i;return function(){var a=It(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 jg(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=It(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 Wg(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=gt(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?Yg:jg)(o,e,t))}function bl(e,t,o){var i=e._id;return e.each(function(){var a=It(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return gt(a,i).value[t]}}function nd(e,t){var o;return(typeof t=="number"?$t:t instanceof an?Ii:(o=an(t))?(t=o,Ii):Hc)(e,t)}function Kg(e){return function(){this.removeAttribute(e)}}function qg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xg(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 Zg(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 Jg(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 Qg(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 eb(e,t){var o=_i(e),i=o==="transform"?Tg:nd;return this.attrTween(e,typeof t=="function"?(o.local?Qg:Jg)(o,i,bl(this,"attr."+e,t)):t==null?(o.local?qg:Kg)(o):(o.local?Zg:Xg)(o,i,t))}function tb(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function nb(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function ob(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&nb(e,l)),o}return a._value=t,a}function ib(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&tb(e,l)),o}return a._value=t,a}function ab(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=_i(e);return this.tween(o,(i.local?ob:ib)(i,t))}function lb(e,t){return function(){gl(this,e).delay=+t.apply(this,arguments)}}function rb(e,t){return t=+t,function(){gl(this,e).delay=t}}function sb(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lb:rb)(t,e)):gt(this.node(),t).delay}function cb(e,t){return function(){It(this,e).duration=+t.apply(this,arguments)}}function db(e,t){return t=+t,function(){It(this,e).duration=t}}function ub(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cb:db)(t,e)):gt(this.node(),t).duration}function fb(e,t){if(typeof t!="function")throw new Error;return function(){It(this,e).ease=t}}function mb(e){var t=this._id;return arguments.length?this.each(fb(t,e)):gt(this.node(),t).ease}function pb(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;It(this,e).ease=o}}function hb(e){if(typeof e!="function")throw new Error;return this.each(pb(this._id,e))}function yb(e){typeof e!="function"&&(e=Ec(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 Mt(i,this._parents,this._name,this._id)}function gb(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),m,p=0;p<u;++p)(m=c[p]||d[p])&&(f[p]=m);for(;s<i;++s)r[s]=t[s];return new Mt(r,this._parents,this._name,this._id)}function bb(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 _b(e,t,o){var i,a,l=bb(t)?gl:It;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Eb(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(_b(o,e,t))}function kb(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function wb(){return this.on("end.remove",kb(this._id))}function vb(e){var t=this._name,o=this._id;typeof e!="function"&&(e=nl(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,m=0;m<c;++m)(u=s[m])&&(f=e.call(u,u.__data__,m,s))&&("__data__"in u&&(f.__data__=u.__data__),d[m]=f,Bi(d[m],t,o,m,d,gt(u,o)));return new Mt(l,this._parents,t,o)}function Nb(e){var t=this._name,o=this._id;typeof e!="function"&&(e=_c(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 m=e.call(u,u.__data__,f,c),p,y=gt(u,o),b=0,g=m.length;b<g;++b)(p=m[b])&&Bi(p,t,o,b,m,y);l.push(m),r.push(u)}return new Mt(l,r,t,o)}var $b=fo.prototype.constructor;function Ib(){return new $b(this._groups,this._parents)}function Sb(e,t){var o,i,a;return function(){var l=On(this,e),r=(this.style.removeProperty(e),On(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function od(e){return function(){this.style.removeProperty(e)}}function xb(e,t,o){var i,a=o+"",l;return function(){var r=On(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Cb(e,t,o){var i,a,l;return function(){var r=On(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),On(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Rb(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=It(this,e),d=c.on,u=c.value[l]==null?s||(s=od(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Vb(e,t,o){var i=(e+="")=="transform"?Ag:nd;return t==null?this.styleTween(e,Sb(e,i)).on("end.style."+e,od(e)):typeof t=="function"?this.styleTween(e,Cb(e,i,bl(this,"style."+e,t))).each(Rb(this._id,e)):this.styleTween(e,xb(e,i,t),o).on("end.style."+e,null)}function Ab(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Tb(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Ab(e,r,o)),i}return l._value=t,l}function Mb(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,Tb(e,t,o??""))}function Bb(e){return function(){this.textContent=e}}function Ob(e){return function(){var t=e(this);this.textContent=t??""}}function Db(e){return this.tween("text",typeof e=="function"?Ob(bl(this,"text",e)):Bb(e==null?"":e+""))}function Lb(e){return function(t){this.textContent=e.call(this,t)}}function Pb(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Lb(a)),t}return i._value=e,i}function zb(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,Pb(e))}function Ub(){for(var e=this._name,t=this._id,o=id(),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=gt(c,t);Bi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(i,this._parents,e,o)}function Fb(){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=It(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 Hb=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function id(){return++Hb}var Bt=fo.prototype;Mt.prototype={constructor:Mt,select:vb,selectAll:Nb,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:yb,merge:gb,selection:Ib,transition:Ub,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:Eb,attr:eb,attrTween:ab,style:Vb,styleTween:Mb,text:Db,textTween:zb,remove:wb,tween:Wg,delay:sb,duration:ub,ease:mb,easeVarying:hb,end:Fb,[Symbol.iterator]:Bt[Symbol.iterator]};function Gb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yb={time:null,delay:0,duration:250,ease:Gb};function jb(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 Wb(e){var t,o;e instanceof Mt?(t=e._id,e=e._name):(t=id(),(o=Yb).time=ml(),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])&&Bi(c,e,t,d,r,o||jb(c,t));return new Mt(i,this._parents,e,t)}fo.prototype.interrupt=Gg,fo.prototype.transition=Wb;const Di=e=>()=>e;function Kb(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 Ot(e,t,o){this.k=e,this.x=t,this.y=o}Ot.prototype={constructor:Ot,scale:function(e){return e===1?this:new Ot(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ot(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 zn=new Ot(1,0,0);Ot.prototype;function _l(e){e.stopImmediatePropagation()}function wo(e){e.preventDefault(),e.stopImmediatePropagation()}function qb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Xb(){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 ad(){return this.__zoom||zn}function Zb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qb(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 e0(){var e=qb,t=Xb,o=Qb,i=Zb,a=Jb,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=xi,d=gi("start","zoom","end"),u,f,m,p=500,y=150,b=0,g=10;function E(_){_.property("__zoom",ad).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",ee).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(_,Y,T,W){var Q=_.selection?_.selection():_;Q.property("__zoom",ad),_!==Q?X(_,Y,T,W):Q.interrupt().each(function(){B(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},E.scaleBy=function(_,Y,T,W){E.scaleTo(_,function(){var Q=this.__zoom.k,te=typeof Y=="function"?Y.apply(this,arguments):Y;return Q*te},T,W)},E.scaleTo=function(_,Y,T,W){E.transform(_,function(){var Q=t.apply(this,arguments),te=this.__zoom,C=T==null?w(Q):typeof T=="function"?T.apply(this,arguments):T,Z=te.invert(C),le=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h($(te,le),C,Z),Q,r)},T,W)},E.translateBy=function(_,Y,T,W){E.transform(_,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),r)},null,W)},E.translateTo=function(_,Y,T,W,Q){E.transform(_,function(){var te=t.apply(this,arguments),C=this.__zoom,Z=W==null?w(te):typeof W=="function"?W.apply(this,arguments):W;return o(zn.translate(Z[0],Z[1]).scale(C.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof T=="function"?-T.apply(this,arguments):-T),te,r)},W,Q)};function $(_,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===_.k?_:new Ot(Y,_.x,_.y)}function h(_,Y,T){var W=Y[0]-T[0]*_.k,Q=Y[1]-T[1]*_.k;return W===_.x&&Q===_.y?_:new Ot(_.k,W,Q)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function X(_,Y,T,W){_.on("start.zoom",function(){B(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,te=arguments,C=B(Q,te).event(W),Z=t.apply(Q,te),le=T==null?w(Z):typeof T=="function"?T.apply(Q,te):T,pe=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),be=Q.__zoom,de=typeof Y=="function"?Y.apply(Q,te):Y,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new Ot(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}C.zoom(null,ye)}})}function B(_,Y,T){return!T&&_.__zooming||new H(_,Y)}function H(_,Y){this.that=_,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,Y),this.taps=0}H.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,Y){return this.mouse&&_!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var Y=ht(this.that).datum();d.call(_,this.that,new Kb(_,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),Y)}};function A(_,...Y){if(!e.apply(this,arguments))return;var T=B(this,Y).event(_),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),te=vt(_);if(T.wheel)(T.mouse[0][0]!==te[0]||T.mouse[0][1]!==te[1])&&(T.mouse[1]=W.invert(T.mouse[0]=te)),clearTimeout(T.wheel);else{if(W.k===Q)return;T.mouse=[te,W.invert(te)],Oi(this),T.start()}wo(_),T.wheel=setTimeout(C,y),T.zoom("mouse",o(h($(W,Q),T.mouse[0],T.mouse[1]),T.extent,r));function C(){T.wheel=null,T.end()}}function S(_,...Y){if(m||!e.apply(this,arguments))return;var T=_.currentTarget,W=B(this,Y,!0).event(_),Q=ht(_.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),te=vt(_,T),C=_.clientX,Z=_.clientY;Rc(_.view),_l(_),W.mouse=[te,this.__zoom.invert(te)],Oi(this),W.start();function le(be){if(wo(be),!W.moved){var de=be.clientX-C,me=be.clientY-Z;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=vt(be,T),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),Vc(be.view,W.moved),wo(be),W.event(be).end()}}function L(_,...Y){if(e.apply(this,arguments)){var T=this.__zoom,W=vt(_.changedTouches?_.changedTouches[0]:_,this),Q=T.invert(W),te=T.k*(_.shiftKey?.5:2),C=o(h($(T,te),W,Q),t.apply(this,Y),r);wo(_),s>0?ht(this).transition().duration(s).call(X,C,W,_):ht(this).call(E.transform,C,W,_)}}function ee(_,...Y){if(e.apply(this,arguments)){var T=_.touches,W=T.length,Q=B(this,Y,_.changedTouches.length===W).event(_),te,C,Z,le;for(_l(_),C=0;C<W;++C)Z=T[C],le=vt(Z,this),le=[le,this.__zoom.invert(le),Z.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,te=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},p)),Oi(this),Q.start())}}function M(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C,Z,le;for(wo(_),te=0;te<Q;++te)C=W[te],Z=vt(C,this),T.touch0&&T.touch0[2]===C.identifier?T.touch0[0]=Z:T.touch1&&T.touch1[2]===C.identifier&&(T.touch1[0]=Z);if(C=T.that.__zoom,T.touch1){var pe=T.touch0[0],be=T.touch0[1],de=T.touch1[0],me=T.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;C=$(C,Math.sqrt(ye/ve)),Z=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(T.touch0)Z=T.touch0[0],le=T.touch0[1];else return;T.zoom("touch",o(h(C,Z,le),T.extent,r))}}function oe(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C;for(_l(_),m&&clearTimeout(m),m=setTimeout(function(){m=null},p),te=0;te<Q;++te)C=W[te],T.touch0&&T.touch0[2]===C.identifier?delete T.touch0:T.touch1&&T.touch1[2]===C.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(C=vt(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<g)){var Z=ht(this).on("dblclick.zoom");Z&&Z.apply(this,arguments)}}}return E.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:Di(+_),E):i},E.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Di(!!_),E):e},E.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:Di(!!_),E):a},E.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Di([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),E):t},E.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],E):[l[0],l[1]]},E.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],E):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},E.constrain=function(_){return arguments.length?(o=_,E):o},E.duration=function(_){return arguments.length?(s=+_,E):s},E.interpolate=function(_){return arguments.length?(c=_,E):c},E.on=function(){var _=d.on.apply(d,arguments);return _===d?E:_},E.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,E):Math.sqrt(b)},E.tapDistance=function(_){return arguments.length?(g=+_,E):g},E}var xe=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(xe||{}),El=(e=>(e.Partial="partial",e.Full="full",e))(El||{}),cn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(cn||{}),Dt=(e=>(e.Strict="strict",e.Loose="loose",e))(Dt||{}),kl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(kl||{}),vo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(vo||{}),ld=(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))(ld||{});const t0=["INPUT","SELECT","TEXTAREA"],n0=typeof document<"u"?document:null;function wl(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 t0.includes(i==null?void 0:i.nodeName)||a||!!l}function o0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function rd(e,t,o,i){const a=t.replace("+",`
|
|
13
|
+
`}}const li="com.example",Vm="command.domain";function lo(e,t,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=t.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),l=a!=null&&a.packageName?`.${a.packageName}`:"",r=i.layerSuffix??Vm,s=r?`.${r}`:"";return`${i.basePackage}${l}${s}`}return t.packageName||""}function De(){return crypto.randomUUID()}const Am="CustomMoneyType",Tm="Money";function Mm(e){return!(e.type!==Am||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Bm(e){const t=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Tm,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Om(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Mm(r)?(a=!0,t=!0,Bm(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function Yr(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function jr(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Yr);if(!i.length)continue;const a=o.filter(s=>!Yr(s));let l=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(l=c+1)});const r=[...a.slice(0,l),...i,...a.slice(l)];r.forEach((s,c)=>s.order=c),t.attributes=r}}function Rn(e){return JSON.parse(JSON.stringify(e))}function Wr(e,t,o){var H;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:l,layout:r}=e,s=new Set(t);if(o.includeRelated){const A=new Set(t);for(const S of l.associations){const L=A.has(S.end1.entityRef),ee=A.has(S.end2.entityRef);L!==ee&&s.add(L?S.end2.entityRef:S.end1.entityRef)}}const c=l.entities.filter(A=>s.has(A.modelId)),d=new Set(c.map(A=>A.modelId)),u=l.associations.filter(A=>d.has(A.end1.entityRef)&&d.has(A.end2.entityRef)),f=new Set(u.map(A=>A.modelId)),p=new Map,m=A=>{let S=p.get(A);return S||(S=i(),p.set(A,S)),S};for(const A of c){m(A.modelId);for(const S of A.attributes){m(S.modelId);for(const L of S.dbAttrs)m(L.modelId)}for(const S of A.indexes??[])m(S.modelId);for(const S of A.operations??[])m(S.modelId)}for(const A of u)m(A.modelId);const y=A=>p.get(A),b=c.map(A=>{const S=Rn(A);S.modelId=y(A.modelId),S.attributes=S.attributes.map(L=>Dm(L,y,f,d));for(const L of S.indexes??[])L.modelId=y(L.modelId),L.columns=L.columns.map(ee=>to(ee.columnRef)?ee:{...ee,columnRef:y(ee.columnRef)}).filter(ee=>ee.columnRef!==void 0);for(const L of S.operations??[])L.modelId=y(L.modelId);return S});jr(b);const g=u.map(A=>{const S=Rn(A);return S.modelId=y(A.modelId),S.end1=Kr(S.end1,y),S.end2=Kr(S.end2,y),S}),E=[];for(const A of l.groups){const S=A.memberEntityRefs.filter(ee=>d.has(ee));if(S.length===0)continue;const L=Rn(A);L.modelId=m(A.modelId),L.memberEntityRefs=S.map(ee=>y(ee)),E.push(L)}const N=new Set(o.existing.entities.map(A=>A.name)),h=new Set(o.existing.entities.map(A=>{var S;return(S=A.table)==null?void 0:S.physicalName}).filter(A=>!!A));for(const A of b)N.has(A.name)&&(A.name=`${A.name}_imported`),(H=A.table)!=null&&H.physicalName&&h.has(A.table.physicalName)&&(A.table.physicalName=`${A.table.physicalName}_imported`);const k=[];for(const A of r.entityLayouts){const S=y(A.entityRef);if(!S)continue;const L=Rn(A);L.entityRef=S,L.geo={...L.geo,location:Wa(L.geo.location,a)},L.attributeStyles&&(L.attributeStyles=qr(L.attributeStyles,y)),L.operationStyles&&(L.operationStyles=qr(L.operationStyles,y)),k.push(L)}const q=[];for(const A of r.associationLayouts){const S=y(A.associationRef);if(!S)continue;const L=Rn(A);L.associationRef=S,L.sourceColumnRef=A.sourceColumnRef?y(A.sourceColumnRef):void 0,L.targetColumnRef=A.targetColumnRef?y(A.targetColumnRef):void 0,L.waypoints=L.waypoints.map(ee=>Wa(ee,a)),q.push(L)}const B=[];for(const A of r.groupLayouts){const S=y(A.groupRef);if(!S)continue;const L=Rn(A);L.groupRef=S,L.geo={...L.geo,location:Wa(L.geo.location,a)},delete L.memberNoteRefs,B.push(L)}return{logical:{entities:b,associations:g,groups:E},layout:{entityLayouts:k,associationLayouts:q,groupLayouts:B},idMap:p}}function Wa(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Dm(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const l=t(a.sharedColumnRef);l?a.sharedColumnRef=l:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Kr(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function qr(e,t){const o={};for(const[i,a]of Object.entries(e)){const l=t(i);l&&(o[l]=a)}return o}function Ka(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function Vn(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)=>Vn(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(!Vn(e[i],t[i]))return!1;return!0}return!1}function en(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||Vn(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function tn(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 Lm(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 Pm=new Set(["attributes","operations","indexes","rev"]),zm=new Set(["end1","end2","rev"]),Um=new Set(["memberEntityRefs","rev"]),Xr=new Set(["modelId"]),Fm=new Set(["modelId","columns"]),Hm=new Set([]);function Gm(e,t,o,i){const a=tn(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=en(s,c,Xr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=tn(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=en(s,c,Xr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=tn(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(!Vn(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=en(s,c,Fm);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Ym(e,t,o){const i=tn(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:Ka(r)});for(const{cur:r,tgt:s}of i.common){const c=en(r,s,Pm);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Gm(r.modelId,r,s,o)}const a=tn(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:Ka(r)});for(const{cur:r,tgt:s}of a.common){const c=en(r,s,zm);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=en(r[d]??{},s[d]??{},Hm);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=tn(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:Ka(r)});for(const{cur:r,tgt:s}of l.common){const c=en(r,s,Um);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Lm(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 ri(e,t,o,i,a,l,r){const s=tn(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)Vn(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 jm(e,t,o){ri(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ri(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ri(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ri(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Wm(e,t){const o=[];return Ym(e.logical,t.logical,o),jm(e.layout,t.layout,o),o}function Km(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 qm={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 Xm{constructor(t){He(this,"out",[]);He(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({...ro(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({...ro(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({...ro(t),field:a,value:void 0,removed:!0});continue}this.out.push({...ro(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({...ro(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ro(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 kt(e,t,o,i){if(o==null||typeof o!="object")return;const a=qm[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function nn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function qa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ft(e,t){var l,r,s,c,d,u,f,p;const o=Km(t),i=new Xm(t.field),a=[...e].sort((m,y)=>m.seq-y.seq);for(const m of a)for(const y of m.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?kt(i,m,y.value,"entity"):y.kind==="entity.update"?nn(i,m,y.patch):y.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=qa((l=y.value)==null?void 0:l.attributes,t.attributeRef);b&&kt(i,m,b,"attribute")}else y.kind==="attribute.add"&&((r=y.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,m,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?nn(i,m,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(m);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=qa((s=y.value)==null?void 0:s.operations,t.operationRef);b&&kt(i,m,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?kt(i,m,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?nn(i,m,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(m);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const b=qa((d=y.value)==null?void 0:d.indexes,t.indexRef);b&&kt(i,m,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?kt(i,m,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?nn(i,m,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(m);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?kt(i,m,y.value,"association"):y.kind==="association.update"?nn(i,m,y.patch):y.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const b=(f=y.value)==null?void 0:f[t.end];kt(i,m,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?nn(i,m,y.patch):y.kind==="association.remove"&&i.remove(m);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){kt(i,m,y.value,"group");const b=(p=y.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(b))for(const g of b)i.member(m,g,!1)}else y.kind==="group.update"?nn(i,m,y.patch):y.kind==="group.remove"?i.remove(m):y.kind==="group.addMember"&&y.entityRef!=null?i.member(m,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(m,y.entityRef,!0);break}return i.result()}function Zm(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function An(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Jm(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;An(c==null?void 0:c.attributes,o),An(c==null?void 0:c.operations,i),An(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?An([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?An([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?An([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 si(e,t){return e.map(o=>({...o,subject:t}))}function Zr(e,t){const o=e.filter(s=>s.ops.some(c=>Zm(c,t))),{attributes:i,operations:a,indexes:l}=Jm(o,t),r=[...si(Ft(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...si(Ft(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...si(Ft(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...si(Ft(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 Jr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qm(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 ep(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 tp(e){const{entities:t,associations:o,groups:i}=ep(e),a=[];for(const l of t)for(const r of Zr(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ft(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ft(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ft(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function Qr(e){const t=tp(e),o=Qm(e),i=new Map;for(const r of t){const s=Jr(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=Jr(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)}class Xa{constructor(t){He(this,"undoStack",[]);He(this,"redoStack",[]);He(this,"savePoint",null);He(this,"listeners",new Set);He(this,"commandListeners",new Set);He(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 es(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Je(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function pt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Ge(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function Vt(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 ci(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=es(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const l=Je(i,e.modelId);l>=0&&i.layout.entityLayouts.splice(l,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function ts(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=es(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Je(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 ns(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Ge(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Ge(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 os(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Ge(i,e);o=a.name,a.name=t},invert(i){Ge(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 Tn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Je(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=Je(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 is(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Je(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=Je(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 so(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 as(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=so(l.style,t)},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Je(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 ls(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Je(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=Je(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 rs(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Je(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.locked,l.locked=t},invert(i){const a=Je(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Za(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 di(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=so(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Je(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 ui(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(r=>r.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const l=i.layout.groupLayouts.findIndex(r=>r.groupRef===e.modelId);l>=0&&i.layout.groupLayouts.splice(l,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function ss(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 cs(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 ds(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 fi(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 us(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 fs(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 ms(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=so(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 ps(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function At(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Ge(o,e).attributes.push(t)},invert(o){const i=Ge(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 on(e,t,o){const i={},a=l=>{const r=Ge(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 Mn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Ge(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&&Ge(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 Ja(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Ge(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&&Ge(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Ge(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 hs(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Ge(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Ge(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 ys(e,t,o){const i={},a=l=>{var s;const r=(s=Ge(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 gs(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Ge(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=Ge(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 bs(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Ge(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=Ge(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Ge(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 _s(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Je(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=so(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Je(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Je(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 mi(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 Es(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 pi(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 Bn(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 ks(e,t){return{label:"인덱스 추가",apply(o){const i=Ge(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Ge(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 ws(e,t,o){const i={},a=l=>{var s;const r=(s=Ge(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 vs(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Ge(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&&Ge(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 wt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),co=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Ns(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=pt(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=pt(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=co(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function $s(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=pt(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=pt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=co(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Is(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=pt(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=pt(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[wt(e,co(a,e))],invert:[wt(e,i??[])]}}}}function Ss(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=pt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=pt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[wt(e,co(o,e))],invert:[wt(e,t??[])]}}}}function xs(e,t,o){return{label:"waypoint 추가",apply(i){const a=pt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=pt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=co(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Cs(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 Rs(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 uo(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 Vs(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 As(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 Ts(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=so(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 Ms(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 Bs(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 Ht=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),hi=(e,t,o)=>{var i;return((i=Vt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Os(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 Ds(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 Ls(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=Vt(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=Vt(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=hi(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Ht(e,t,r)],invert:[Ht(e,t,s)]}}}}function Ps(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Vt(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Vt(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=hi(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function zs(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Vt(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=Vt(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=hi(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function Us(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Vt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Vt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,hi(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Ye(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 np=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:mi,addAttribute:At,addEntity:ci,addEntityToGroup:ds,addGroup:ui,addIndex:ks,addNote:Cs,addNoteConnection:Os,addNoteConnectionWaypoint:Ps,addNoteToGroup:Ms,addOperation:hs,addWaypoint:xs,clearNoteConnectionWaypoints:Us,clearWaypoints:Ss,composite:Ye,moveEntity:Tn,moveGroup:us,moveNote:uo,moveNoteConnectionWaypoint:Ls,moveWaypoint:Ns,removeAssociation:Es,removeAttribute:Mn,removeEntity:ts,removeEntityFromGroup:fi,removeGroup:cs,removeIndex:vs,removeNote:Rs,removeNoteConnection:Ds,removeNoteConnectionWaypoint:zs,removeNoteFromGroup:Bs,removeOperation:gs,removeWaypoint:$s,renameEntity:os,reorderAttributes:Ja,reorderOperations:bs,resizeEntity:is,resizeGroup:fs,resizeNote:Vs,setAllEntitiesCollapsed:Za,setAttributeSwatch:di,setEntityCollapsed:ls,setEntityLocked:rs,setEntitySwatch:as,setGroupLocked:ps,setGroupSwatch:ms,setNoteMemo:As,setNoteSwatch:Ts,setOperationSwatch:_s,translateWaypoints:Is,updateAssociation:pi,updateAssociationEnd:Bn,updateAttribute:on,updateEntity:ns,updateGroup:ss,updateIndex:ws,updateOperation:ys},Symbol.toStringTag,{value:"Module"}));class Fs{constructor(){He(this,"revs",new Map);He(this,"layoutVersion",0);He(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 Hs{constructor(t){He(this,"cache",new Fs);He(this,"newClientOpId");He(this,"debounceMs");He(this,"emissions",new WeakMap);He(this,"open",null);He(this,"debounceHandle",null);He(this,"queue",[]);He(this,"sending",!1);He(this,"_frozen",!1);He(this,"stack",null);He(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??De,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,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",l),(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 Gs=["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"],Ys=()=>crypto.randomUUID(),op=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,ip=e=>e&&e[0].toLowerCase()+e.slice(1),ap=e=>e&&e[0].toUpperCase()+e.slice(1),lp=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function rp(e,t){return ip(e)+ap(t)}function sp(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=rp(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:lp(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const yi=(e,t)=>`${e}::${t}`,gi=e=>e??void 0;function cp(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||gi(s.length)!==gi(l.length)||gi(s.scale)!==gi(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 dp(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 fo(e,t,o=Ys){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=>sp(e,f)),s=new Map(r.map(f=>[yi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[yi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=yi(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=yi(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(dp(f,u++,o));else{const y=cp(m,f,o);y&&i.update.push({attributeId:m.modelId,patch:y})}}return i}function up(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 fp(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function mp(e,t,o=Ys){const i=new Map,a=fp(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=fo(a,d,o);if(op(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(p=>p.modelId===d);f&&up(f,u),l.has(d)||r.push(d)}}return i}function bi(e,t,o){var r;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const l=(r=a.derivedFrom)==null?void 0:r.associationRef;if(l){const s=e.associations.find(c=>c.modelId===l);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function pp(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 hp(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 js(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function lt(e,t){const o=pp(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 yp(e,t){const o=hp(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 gp(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 bp(e,t){const o=gp(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 _p(e,t){const o=e.filter(i=>i.physicalName===t.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Ep(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function kp(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function wp(e,t){const o=Ep(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 vp(e,t){const o=kp(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 Ws(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.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Ks(e,t,o,i,a,l,r,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(m=>[m.field,m])),f=[];let p=!1;for(const m of t.fields){const y=u.get(m.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=_p(In(i,a),b);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:l,entity:r,handle:b}:{code:"shared-column-target-ambiguous",opIndex:l,entity:r,handle:b,matches:g.matches}),p=!0;continue}f.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});continue}f.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return p?null:{modelId:d,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:f}}function qs(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 Xs(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=bp(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 Np(e,t,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],l=f=>a.find(p=>p.type===f),r=[],s=[],c=new Map,d=new Map,u=new Set;for(const f of t)f.kind==="entity.add"&&(u.add(f.spec.name),f.spec.physicalName&&u.add(f.spec.physicalName));return t.forEach((f,p)=>{var m,y,b;switch(f.kind){case"entity.add":{const g=i(),E={modelId:g,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},N={ref:f.spec.name};let h=!1;for(const[B,H]of(f.spec.attributes??[]).entries()){if(H.type==="GroupCodeEnum"&&!H.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:N,handle:{ref:H.name}}),h=!0;continue}const A=l(H.type);if(A){const S=Ks(H,A,B,E,e.entities,p,N,s,i);S?E.attributes.push(S):h=!0}else(m=H.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:p,entity:N,handle:{ref:H.name}}),h=!0):E.attributes.push(Ws(H,B,i))}const k=(f.spec.operations??[]).map((B,H)=>qs(B,H,i));k.length&&(E.operations=k);const q=[];for(const B of f.spec.indexes??[]){const H=Xs(E,B,p,N,s,i);H?q.push(H):h=!0}if(q.length&&(E.indexes=q),h)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:g,value:E});break}case"entity.update":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,patch:f.patch});break}case"entity.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:g.value.modelId});break}case"attribute.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:f.entity,handle:{ref:f.spec.name}});break}const E=c.get(g.value.modelId)??g.value.attributes.length;c.set(g.value.modelId,E+1);const N=l(f.spec.type);let h;if(N)h=Ks(f.spec,N,E,g.value,e.entities,p,f.entity,s,i);else if((y=f.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:p,entity:f.entity,handle:{ref:f.spec.name}});break}else h=Ws(f.spec,E,i);if(!h)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,value:h});break}case"attribute.update":case"attribute.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}const E=yp(g.value,f.attribute);if(!E.ok){s.push(E.reason==="not-found"?{code:"attribute-not-found",opIndex:p,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:p,entity:f.entity,handle:f.attribute,matches:E.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:E.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,attributeRef:E.value.modelId});break}case"association.add":{const g=lt(e,f.spec.from),E=lt(e,f.spec.to);if(g.ok||s.push(rt(g.reason,p,f.spec.from,g.matches,u)),E.ok||s.push(rt(E.reason,p,f.spec.to,E.matches,u)),!g.ok||!E.ok)break;if(f.spec.identifying&&g.value.modelId===E.value.modelId){s.push({code:"self-identifying",opIndex:p,handle:{from:f.spec.from,to:f.spec.to}});break}const N=i(),h={modelId:N,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:g.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:E.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},k={...e,associations:[...e.associations,h]},q=fo(k,E.value.modelId,i);q.add[0]&&(h.end2.attributeRef=q.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:N,value:h});for(const B of q.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:E.value.modelId,entityRef:E.value.modelId,value:B});break}case"association.remove":{const g=lt(e,f.association.from),E=lt(e,f.association.to);if(g.ok||s.push(rt(g.reason,p,f.association.from,g.matches,u)),E.ok||s.push(rt(E.reason,p,f.association.to,E.matches,u)),!g.ok||!E.ok)break;const N=js(e,g.value.modelId,E.value.modelId);if(N.length!==1){s.push(N.length===0?{code:"association-not-found",opIndex:p,handle:f.association}:{code:"association-ambiguous",opIndex:p,handle:f.association,matches:N.map(h=>h.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:N[0].modelId});break}case"association.update":{const g=Zs(e,f.association,p,s,u);if(!g)break;r.push({kind:"association.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,patch:f.patch});break}case"associationEnd.update":{const g=Zs(e,f.association,p,s,u);if(!g)break;const E=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:g.modelId,associationRef:g.modelId,end:E,patch:f.patch});break}case"index.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}const E=Xs(g.value,f.spec,p,f.entity,s,i);if(!E)break;r.push({kind:"index.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.modelId,value:E});break}case"index.update":case"index.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}const E=wp(g.value,f.index);if(!E.ok){s.push(E.reason==="not-found"?{code:"index-not-found",opIndex:p,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:p,entity:f.entity,handle:f.index,matches:E.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:p,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,indexRef:E.value.modelId});break}case"operation.add":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}const E=d.get(g.value.modelId)??((b=g.value.operations)==null?void 0:b.length)??0;d.set(g.value.modelId,E+1);const N=qs(f.spec,E,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const g=lt(e,f.entity);if(!g.ok){s.push(rt(g.reason,p,f.entity,g.matches,u));break}const E=vp(g.value,f.operation);if(!E.ok){s.push(E.reason==="not-found"?{code:"operation-not-found",opIndex:p,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:p,entity:f.entity,handle:f.operation,matches:E.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:E.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,operationRef:E.value.modelId});break}case"group.add":{const g=[];let E=!1;for(const k of f.spec.members){const q=lt(e,k);if(!q.ok){s.push(rt(q.reason,p,k,q.matches,u)),E=!0;continue}g.push(q.value.modelId)}if(E)break;const N=i(),h={modelId:N,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:g,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};r.push({kind:"group.add",casUnit:"logical",groupRef:N,value:h});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function rt(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 Zs(e,t,o,i,a){const l=lt(e,t.from),r=lt(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(rt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=js(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 Js={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},$p={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ip={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},_i={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Sp={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{..._i,description:"속성 설명(다국어)."},columnLogicalName:{..._i,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(type이 카탈로그 엔트리일 때만). field=카탈로그 필드명으로 매칭 (@AttributeOverride 대응). 미설정 서브컬럼은 카탈로그 기본 상속. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}}},required:["name","type"],additionalProperties:!1},Qs={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},xp={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Qs,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Qs,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},Cp={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Js,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},Rp={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{..._i,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Vp={type:"object",properties:{name:{..._i,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},Ap={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function nt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Tp={"entity.add":nt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":nt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":nt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":nt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":nt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":nt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":nt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":nt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":nt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":nt("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":nt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":nt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":nt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":nt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":nt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":nt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":nt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},ec={anyOf:Gs.map(e=>Tp[e])},Mp={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Js,assocHandle:$p,entitySpec:Ip,attrSpec:Sp,assocSpec:xp,indexSpec:Cp,operationSpec:Rp,groupSpec:Vp,patch:Ap,symbolicOp:ec}};function Bp(e,t,o,i={}){const a=i.mkClientOpId??De,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 tc={location:{x:0,y:0},size:{width:220,height:140}};function nc(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 Op=/^[-=_*~\s]{3,}$/;function Dp(e){return e.attrType&&e.attrType!=="NORMAL"||!Op.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Lp(e){return e.type===Et&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Pp(e,t){if(e.attrType==="DIVIDER"||Dp(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Lp(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(nc)}}function zp(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 Up(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 Fp(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(Pp),operations:(t=e.operations)==null?void 0:t.map(zp),indexes:(o=e.indexes)==null?void 0:o.map(Up),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Hp(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??{...tc},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function oc(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 Qa(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:oc(e)}}function Gp(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Qa(e.end1),end2:Qa(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 ic(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ac(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function lc(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 rc(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_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(nc)}}function Yp(e,t,o){var g,E;const i=ic(e.end1.attribute),a=ic(e.end2.attribute);if(i===a)return Gp(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(E=(g=s.dbAttrs)==null?void 0:g[0])==null?void 0:E.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((N,h)=>Math.max(N,h.order),-1)+1:s.order??0,p={...rc(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=(N,h)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:h?d:p.modelId,legacyNavRaw:h?void 0:N.attribute,jpa:oc(N)}),y={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},b={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:b}}function jp(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 Wp(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.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((b,g)=>Math.max(b,g.order),-1)+1:r.order??0,d={...rc(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(b=>jp(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...Qa(b),legacyEmbedRaw:b.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 Kp(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 sc(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=Kp(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 cc(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(r=>[r.modelId,r])),a=new Map(t.map(r=>[r.modelId,r])),l=(r,s)=>{var c;return!!s&&!!((c=i.get(r??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const r of o){const s=a.get(r.associationRef);s&&(r.sourceColumnRef&&!l(s.end1.entityRef,r.sourceColumnRef)&&(r.sourceColumnRef=void 0),r.targetColumnRef&&!l(s.end2.entityRef,r.targetColumnRef)&&(r.targetColumnRef=void 0))}}function qp(e){return(e.schemaVersion??1)>=2&&"logical"in e?Xp(e):Zp(e)}function Xp(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;cc(a,l,c.associationLayouts);const 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 Zp(e){var E,N;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(h,k)=>{o.push(Fp(h));const q=Hp(h);q.geo={location:{x:q.geo.location.x+k.x,y:q.geo.location.y+k.y},size:q.geo.size},i.push(q);for(const B of h.ownedAssociations??[])c.push(B)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const f=[];for(const h of e.groups??[]){const k=h.entities??[];r.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:k.map(B=>B.modelId)});const q=((E=h.geo)==null?void 0:E.location)??u;if(h.geo){const B=(h.notes??[]).map(H=>H.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:B.length?B:void 0})}for(const B of k)d(B,q);for(const B of h.notes??[])f.push(sc(B,q))}const p=new Map(o.map(h=>[h.modelId,h])),m=new Map,y=new Map;for(const h of o)for(const k of h.attributes)for(const q of k.dbAttrs)m.set(q.modelId,k.modelId),y.set(q.modelId,q);for(const h of c)for(const k of[h.end1,h.end2]){const q=k.attribute;if(q&&(((N=q.dbAttrs)==null?void 0:N.length)??0)>0)for(const B of q.dbAttrs)B.modelId&&m.set(B.modelId,q.modelId)}for(const h of c){const k=ac(h.end1.attribute),q=ac(h.end2.attribute),B=lc(h.end1)||lc(h.end2),{assoc:H,layout:A}=k!==q||B?Wp(h,p,y):Yp(h,p,m);a.push(H),l.push(A)}cc(o,a,l),jr(o);const b={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(h=>sc(h)),...f]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:g}}function dc(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 Jp(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,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(dc),style:t}}function Qp(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 eh(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 Gt(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 th(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{...dc(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function nh(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 oh(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 ih(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function ah(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:ih(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 lh(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var y;return((y=m.embedded)==null?void 0:y.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)=>ah(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:Gt(e.end1,c?s:u),end2:Gt(e.end2,c?u:s)}}function rh(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:Gt(e.end1,e.end1.legacyEmbedRaw),end2:Gt(e.end2,e.end2.legacyEmbedRaw)};const a=lh(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(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),f=t.logical.entities.find(y=>y.modelId===c.entityRef),p=u?th(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Gt(e.end1,l?m:p),end2:Gt(e.end2,r?m:p)}}return{...i,end1:Gt(e.end1),end2:Gt(e.end2)}}function uc(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)??{...tc},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 Jp(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 Qp(p,(m=l==null?void 0:l.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>rh(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(eh),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,locked:l==null?void 0:l.locked}}function sh(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=>fc(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>uc(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,locked:a==null?void 0:a.locked}}function fc(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 ch(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=nh(e),l=oh(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=>uc(s,e,a,l)),groups:e.logical.groups.map(s=>sh(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>fc(s))}}function dh(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 mo(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Tt(e){return typeof e=="function"?e():n.unref(e)}const uh=typeof window<"u"&&typeof document<"u",fh=e=>typeof e<"u",mh=Object.prototype.toString,ph=e=>mh.call(e)==="[object Object]",hh=()=>{};function yh(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 mc=e=>e();function gh(e=mc){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 pc(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function bh(e,t,o={}){const{eventFilter:i=mc,...a}=o;return n.watch(e,yh(i,t),a)}function On(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=gh(i);return{stop:bh(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function _h(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=Tt(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 el(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:y,throwOnTimeout:b}={}){let g=null;const N=[new Promise(h=>{g=n.watch(e,k=>{f(k)!==t&&(g==null||g(),h(k))},{flush:p,deep:m,immediate:!0})})];return y!=null&&N.push(pc(y,b).then(()=>Tt(e)).finally(()=>g==null?void 0:g())),Promise.race(N)}function i(f,p){if(!n.isRef(f))return o(k=>k===f,p);const{flush:m="sync",deep:y=!1,timeout:b,throwOnTimeout:g}=p??{};let E=null;const h=[new Promise(k=>{E=n.watch([e,f],([q,B])=>{t!==(q===B)&&(E==null||E(),k(q))},{flush:m,deep:y,immediate:!0})})];return b!=null&&h.push(pc(b,g).then(()=>Tt(e)).finally(()=>(E==null||E(),Tt(e)))),Promise.race(h)}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 y=Array.from(m);return y.includes(f)||y.includes(Tt(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(Tt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return el(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return el(e,!t)}}}function tl(e){return el(e)}function Eh(e){var t;const o=Tt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const hc=uh?window:void 0;function yc(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=hc):[t,o,i,a]=e,!t)return hh;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(()=>[Eh(t),Tt(a)],([u,f])=>{if(r(),!u)return;const p=ph(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(y=>s(u,m,y,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return mo(d),d}function kh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function gc(...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=hc,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=kh(t);return yc(a,l,u=>{u.repeat&&Tt(s)||c(u)&&o(u)},r)}function wh(e){return JSON.parse(JSON.stringify(e))}function nl(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(),y=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 b=d;t||(t="modelValue"),b=b||`update:${t.toString()}`;const g=h=>s?typeof s=="function"?s(h):wh(h):h,E=()=>fh(e[t])?g(e[t]):f,N=h=>{p?p(h)&&y(b,h):y(b,h)};if(c){const h=E(),k=n.ref(h);let q=!1;return n.watch(()=>e[t],B=>{q||(q=!0,k.value=g(B),n.nextTick(()=>q=!1))}),n.watch(k,B=>{!q&&(B!==e[t]||u)&&N(B)},{deep:u}),k}else return n.computed({get(){return E()},set(h){N(h)}})}var vh={value:()=>{}};function Ei(){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 ki(o)}function ki(e){this._=e}function Nh(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}})}ki.prototype=Ei.prototype={constructor:ki,on:function(e,t){var o=this._,i=Nh(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=$h(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]=bc(o[a],e.name,t);else if(t==null)for(a in o)o[a]=bc(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 ki(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 $h(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function bc(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=vh,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var ol="http://www.w3.org/1999/xhtml";const _c={svg:"http://www.w3.org/2000/svg",xhtml:ol,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),_c.hasOwnProperty(t)?{space:_c[t],local:e}:e}function Ih(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===ol&&t.documentElement.namespaceURI===ol?t.createElement(e):t.createElementNS(o,e)}}function Sh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ec(e){var t=wi(e);return(t.local?Sh:Ih)(t)}function xh(){}function il(e){return e==null?xh:function(){return this.querySelector(e)}}function Ch(e){typeof e!="function"&&(e=il(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 ut(i,this._parents)}function Rh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Vh(){return[]}function kc(e){return e==null?Vh:function(){return this.querySelectorAll(e)}}function Ah(e){return function(){return Rh(e.apply(this,arguments))}}function Th(e){typeof e=="function"?e=Ah(e):e=kc(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 ut(i,a)}function wc(e){return function(){return this.matches(e)}}function vc(e){return function(t){return t.matches(e)}}var Mh=Array.prototype.find;function Bh(e){return function(){return Mh.call(this.children,e)}}function Oh(){return this.firstElementChild}function Dh(e){return this.select(e==null?Oh:Bh(typeof e=="function"?e:vc(e)))}var Lh=Array.prototype.filter;function Ph(){return Array.from(this.children)}function zh(e){return function(){return Lh.call(this.children,e)}}function Uh(e){return this.selectAll(e==null?Ph:zh(typeof e=="function"?e:vc(e)))}function Fh(e){typeof e!="function"&&(e=wc(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 ut(i,this._parents)}function Nc(e){return new Array(e.length)}function Hh(){return new ut(this._enter||this._groups.map(Nc),this._parents)}function vi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}vi.prototype={constructor:vi,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 Gh(e){return function(){return e}}function Yh(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 vi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function jh(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 vi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Wh(e){return e.__data__}function Kh(e,t){if(!arguments.length)return Array.from(this,Wh);var o=t?jh:Yh,i=this._parents,a=this._groups;typeof e!="function"&&(e=Gh(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=qh(e.call(u,u&&u.__data__,d,i)),y=m.length,b=s[d]=new Array(y),g=r[d]=new Array(y),E=c[d]=new Array(p);o(u,f,b,g,E,m,t);for(var N=0,h=0,k,q;N<y;++N)if(k=b[N]){for(N>=h&&(h=N+1);!(q=g[h])&&++h<y;);k._next=q||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function qh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xh(){return new ut(this._exit||this._groups.map(Nc),this._parents)}function Zh(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 Jh(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,y=0;y<f;++y)(m=d[y]||u[y])&&(p[y]=m);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function Qh(){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 ey(e){e||(e=ty);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 ut(a,this._parents).order()}function ty(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ny(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function oy(){return Array.from(this)}function iy(){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 ay(){let e=0;for(const t of this)++e;return e}function ly(){return!this.node()}function ry(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 sy(e){return function(){this.removeAttribute(e)}}function cy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dy(e,t){return function(){this.setAttribute(e,t)}}function uy(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fy(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function my(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 py(e,t){var o=wi(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?cy:sy:typeof t=="function"?o.local?my:fy:o.local?uy:dy)(o,t))}function $c(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hy(e){return function(){this.style.removeProperty(e)}}function yy(e,t,o){return function(){this.style.setProperty(e,t,o)}}function gy(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function by(e,t,o){return arguments.length>1?this.each((t==null?hy:typeof t=="function"?gy:yy)(e,t,o??"")):Dn(this.node(),e)}function Dn(e,t){return e.style.getPropertyValue(t)||$c(e).getComputedStyle(e,null).getPropertyValue(t)}function _y(e){return function(){delete this[e]}}function Ey(e,t){return function(){this[e]=t}}function ky(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function wy(e,t){return arguments.length>1?this.each((t==null?_y:typeof t=="function"?ky:Ey)(e,t)):this.node()[e]}function Ic(e){return e.trim().split(/^|\s+/)}function al(e){return e.classList||new Sc(e)}function Sc(e){this._node=e,this._names=Ic(e.getAttribute("class")||"")}Sc.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 xc(e,t){for(var o=al(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Cc(e,t){for(var o=al(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function vy(e){return function(){xc(this,e)}}function Ny(e){return function(){Cc(this,e)}}function $y(e,t){return function(){(t.apply(this,arguments)?xc:Cc)(this,e)}}function Iy(e,t){var o=Ic(e+"");if(arguments.length<2){for(var i=al(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?$y:t?vy:Ny)(o,t))}function Sy(){this.textContent=""}function xy(e){return function(){this.textContent=e}}function Cy(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ry(e){return arguments.length?this.each(e==null?Sy:(typeof e=="function"?Cy:xy)(e)):this.node().textContent}function Vy(){this.innerHTML=""}function Ay(e){return function(){this.innerHTML=e}}function Ty(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function My(e){return arguments.length?this.each(e==null?Vy:(typeof e=="function"?Ty:Ay)(e)):this.node().innerHTML}function By(){this.nextSibling&&this.parentNode.appendChild(this)}function Oy(){return this.each(By)}function Dy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ly(){return this.each(Dy)}function Py(e){var t=typeof e=="function"?e:Ec(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zy(){return null}function Uy(e,t){var o=typeof e=="function"?e:Ec(e),i=t==null?zy:typeof t=="function"?t:il(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Fy(){var e=this.parentNode;e&&e.removeChild(this)}function Hy(){return this.each(Fy)}function Gy(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yy(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jy(e){return this.select(e?Yy:Gy)}function Wy(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ky(e){return function(t){e.call(this,t,this.__data__)}}function qy(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 Xy(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 Zy(e,t,o){return function(){var i=this.__on,a,l=Ky(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 Jy(e,t,o){var i=qy(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?Zy:Xy,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Rc(e,t,o){var i=$c(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 Qy(e,t){return function(){return Rc(this,e,t)}}function eg(e,t){return function(){return Rc(this,e,t.apply(this,arguments))}}function tg(e,t){return this.each((typeof t=="function"?eg:Qy)(e,t))}function*ng(){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 Vc=[null];function ut(e,t){this._groups=e,this._parents=t}function po(){return new ut([[document.documentElement]],Vc)}function og(){return this}ut.prototype=po.prototype={constructor:ut,select:Ch,selectAll:Th,selectChild:Dh,selectChildren:Uh,filter:Fh,data:Kh,enter:Hh,exit:Xh,join:Zh,merge:Jh,selection:og,order:Qh,sort:ey,call:ny,nodes:oy,node:iy,size:ay,empty:ly,each:ry,attr:py,style:by,property:wy,classed:Iy,text:Ry,html:My,raise:Oy,lower:Ly,append:Py,insert:Uy,remove:Hy,clone:jy,datum:Wy,on:Jy,dispatch:tg,[Symbol.iterator]:ng};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],Vc)}function ig(e){let t;for(;t=e.sourceEvent;)e=t;return e}function vt(e,t){if(e=ig(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 ag={passive:!1},ho={capture:!0,passive:!1};function ll(e){e.stopImmediatePropagation()}function Ln(e){e.preventDefault(),e.stopImmediatePropagation()}function Ac(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Ln,ho);"onselectstart"in t?o.on("selectstart.drag",Ln,ho):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tc(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Ln,ho),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 Ni=e=>()=>e;function rl(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}})}rl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lg(e){return!e.ctrlKey&&!e.button}function rg(){return this.parentNode}function sg(e,t){return t??{x:e.x,y:e.y}}function cg(){return navigator.maxTouchPoints||"ontouchstart"in this}function dg(){var e=lg,t=rg,o=sg,i=cg,a={},l=Ei("start","drag","end"),r=0,s,c,d,u,f=0;function p(k){k.on("mousedown.drag",m).filter(i).on("touchstart.drag",g).on("touchmove.drag",E,ag).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(k,q){if(!(u||!e.call(this,k,q))){var B=h(this,t.call(this,k,q),k,q,"mouse");B&&(ht(k.view).on("mousemove.drag",y,ho).on("mouseup.drag",b,ho),Ac(k.view),ll(k),d=!1,s=k.clientX,c=k.clientY,B("start",k))}}function y(k){if(Ln(k),!d){var q=k.clientX-s,B=k.clientY-c;d=q*q+B*B>f}a.mouse("drag",k)}function b(k){ht(k.view).on("mousemove.drag mouseup.drag",null),Tc(k.view,d),Ln(k),a.mouse("end",k)}function g(k,q){if(e.call(this,k,q)){var B=k.changedTouches,H=t.call(this,k,q),A=B.length,S,L;for(S=0;S<A;++S)(L=h(this,H,k,q,B[S].identifier,B[S]))&&(ll(k),L("start",k,B[S]))}}function E(k){var q=k.changedTouches,B=q.length,H,A;for(H=0;H<B;++H)(A=a[q[H].identifier])&&(Ln(k),A("drag",k,q[H]))}function N(k){var q=k.changedTouches,B=q.length,H,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),H=0;H<B;++H)(A=a[q[H].identifier])&&(ll(k),A("end",k,q[H]))}function h(k,q,B,H,A,S){var L=l.copy(),ee=vt(S||B,q),M,oe,_;if((_=o.call(k,new rl("beforestart",{sourceEvent:B,target:p,identifier:A,active:r,x:ee[0],y:ee[1],dx:0,dy:0,dispatch:L}),H))!=null)return M=_.x-ee[0]||0,oe=_.y-ee[1]||0,function Y(T,W,Q){var te=ee,C;switch(T){case"start":a[A]=Y,C=r++;break;case"end":delete a[A],--r;case"drag":ee=vt(Q||W,q),C=r;break}L.call(T,k,new rl(T,{sourceEvent:W,subject:_,target:p,identifier:A,active:C,x:ee[0]+M,y:ee[1]+oe,dx:ee[0]-te[0],dy:ee[1]-te[1],dispatch:L}),H)}}return p.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ni(!!k),p):e},p.container=function(k){return arguments.length?(t=typeof k=="function"?k:Ni(k),p):t},p.subject=function(k){return arguments.length?(o=typeof k=="function"?k:Ni(k),p):o},p.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:Ni(!!k),p):i},p.on=function(){var k=l.on.apply(l,arguments);return k===l?p:k},p.clickDistance=function(k){return arguments.length?(f=(k=+k)*k,p):Math.sqrt(f)},p}function sl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Mc(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function yo(){}var go=.7,$i=1/go,Pn="\\s*([+-]?\\d+)\\s*",bo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ug=/^#([0-9a-f]{3,8})$/,fg=new RegExp(`^rgb\\(${Pn},${Pn},${Pn}\\)$`),mg=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),pg=new RegExp(`^rgba\\(${Pn},${Pn},${Pn},${bo}\\)$`),hg=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${bo}\\)$`),yg=new RegExp(`^hsl\\(${bo},${Nt},${Nt}\\)$`),gg=new RegExp(`^hsla\\(${bo},${Nt},${Nt},${bo}\\)$`),Bc={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};sl(yo,an,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Oc,formatHex:Oc,formatHex8:bg,formatHsl:_g,formatRgb:Dc,toString:Dc});function Oc(){return this.rgb().formatHex()}function bg(){return this.rgb().formatHex8()}function _g(){return Fc(this).formatHsl()}function Dc(){return this.rgb().formatRgb()}function an(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=ug.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Lc(t):o===3?new st(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Ii(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Ii(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=fg.exec(e))?new st(t[1],t[2],t[3],1):(t=mg.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pg.exec(e))?Ii(t[1],t[2],t[3],t[4]):(t=hg.exec(e))?Ii(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=yg.exec(e))?Uc(t[1],t[2]/100,t[3]/100,1):(t=gg.exec(e))?Uc(t[1],t[2]/100,t[3]/100,t[4]):Bc.hasOwnProperty(e)?Lc(Bc[e]):e==="transparent"?new st(NaN,NaN,NaN,0):null}function Lc(e){return new st(e>>16&255,e>>8&255,e&255,1)}function Ii(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function Eg(e){return e instanceof yo||(e=an(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function cl(e,t,o,i){return arguments.length===1?Eg(e):new st(e,t,o,i??1)}function st(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}sl(st,cl,Mc(yo,{brighter(e){return e=e==null?$i:Math.pow($i,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?go:Math.pow(go,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(ln(this.r),ln(this.g),ln(this.b),Si(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:Pc,formatHex:Pc,formatHex8:kg,formatRgb:zc,toString:zc}));function Pc(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}`}function kg(){return`#${rn(this.r)}${rn(this.g)}${rn(this.b)}${rn((isNaN(this.opacity)?1:this.opacity)*255)}`}function zc(){const e=Si(this.opacity);return`${e===1?"rgb(":"rgba("}${ln(this.r)}, ${ln(this.g)}, ${ln(this.b)}${e===1?")":`, ${e})`}`}function Si(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ln(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rn(e){return e=ln(e),(e<16?"0":"")+e.toString(16)}function Uc(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new yt(e,t,o,i)}function Fc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof yo||(e=an(e)),!e)return new yt;if(e instanceof yt)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 yt(r,s,c,e.opacity)}function wg(e,t,o,i){return arguments.length===1?Fc(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}sl(yt,wg,Mc(yo,{brighter(e){return e=e==null?$i:Math.pow($i,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?go:Math.pow(go,e),new yt(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 st(dl(e>=240?e-240:e+120,a,i),dl(e,a,i),dl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(Hc(this.h),xi(this.s),xi(this.l),Si(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=Si(this.opacity);return`${e===1?"hsl(":"hsla("}${Hc(this.h)}, ${xi(this.s)*100}%, ${xi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hc(e){return e=(e||0)%360,e<0?e+360:e}function xi(e){return Math.max(0,Math.min(1,e||0))}function dl(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 ul=e=>()=>e;function vg(e,t){return function(o){return e+o*t}}function Ng(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 $g(e){return(e=+e)==1?Gc:function(t,o){return o-t?Ng(t,o,e):ul(isNaN(t)?o:t)}}function Gc(e,t){var o=t-e;return o?vg(e,o):ul(isNaN(e)?t:e)}const Ci=(function e(t){var o=$g(t);function i(a,l){var r=o((a=cl(a)).r,(l=cl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Gc(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 Ig(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 Sg(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xg(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]=_o(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 Cg(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function $t(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Rg(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]=_o(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var fl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ml=new RegExp(fl.source,"g");function Vg(e){return function(){return e}}function Ag(e){return function(t){return e(t)+""}}function Yc(e,t){var o=fl.lastIndex=ml.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=fl.exec(e))&&(a=ml.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:$t(i,a)})),o=ml.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Ag(c[0].x):Vg(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 _o(e,t){var o=typeof t,i;return t==null||o==="boolean"?ul(t):(o==="number"?$t:o==="string"?(i=an(t))?(t=i,Ci):Yc:t instanceof an?Ci:t instanceof Date?Cg:Sg(t)?Ig:Array.isArray(t)?xg:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Rg:$t)(e,t)}var jc=180/Math.PI,pl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wc(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)*jc,skewX:Math.atan(c)*jc,scaleX:r,scaleY:s}}var Ri;function Tg(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?pl:Wc(t.a,t.b,t.c,t.d,t.e,t.f)}function Mg(e){return e==null||(Ri||(Ri=document.createElementNS("http://www.w3.org/2000/svg","g")),Ri.setAttribute("transform",e),!(e=Ri.transform.baseVal.consolidate()))?pl:(e=e.matrix,Wc(e.a,e.b,e.c,e.d,e.e,e.f))}function Kc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,y){if(d!==f||u!==p){var b=m.push("translate(",null,t,null,o);y.push({i:b-4,x:$t(d,f)},{i:b-2,x:$t(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:$t(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:$t(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,y){if(d!==f||u!==p){var b=m.push(a(m)+"scale(",null,",",null,")");y.push({i:b-4,x:$t(d,f)},{i:b-2,x:$t(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 y=-1,b=p.length,g;++y<b;)f[(g=p[y]).i]=g.x(m);return f.join("")}}}var Bg=Kc(Tg,"px, ","px)","deg)"),Og=Kc(Mg,", ",")",")"),Dg=1e-12;function qc(e){return((e=Math.exp(e))+1/e)/2}function Lg(e){return((e=Math.exp(e))-1/e)/2}function Pg(e){return((e=Math.exp(2*e))-1)/(e+1)}const Vi=(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,y=f-c,b=m*m+y*y,g,E;if(b<Dg)E=Math.log(p/d)/t,g=function(H){return[s+H*m,c+H*y,d*Math.exp(t*H*E)]};else{var N=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*N),k=(p*p-d*d-i*b)/(2*p*o*N),q=Math.log(Math.sqrt(h*h+1)-h),B=Math.log(Math.sqrt(k*k+1)-k);E=(B-q)/t,g=function(H){var A=H*E,S=qc(q),L=d/(o*N)*(S*Pg(t*A+q)-Lg(q));return[s+L*m,c+L*y,d*S/qc(t*A+q)]}}return g.duration=E*1e3*t/Math.SQRT2,g}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 zn=0,Eo=0,ko=0,Xc=1e3,Ai,wo,Ti=0,sn=0,Mi=0,vo=typeof performance=="object"&&performance.now?performance:Date,Zc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function hl(){return sn||(Zc(zg),sn=vo.now()+Mi)}function zg(){sn=0}function Bi(){this._call=this._time=this._next=null}Bi.prototype=Jc.prototype={constructor:Bi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?hl():+o)+(t==null?0:+t),!this._next&&wo!==this&&(wo?wo._next=this:Ai=this,wo=this),this._call=e,this._time=o,yl()},stop:function(){this._call&&(this._call=null,this._time=1/0,yl())}};function Jc(e,t,o){var i=new Bi;return i.restart(e,t,o),i}function Ug(){hl(),++zn;for(var e=Ai,t;e;)(t=sn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--zn}function Qc(){sn=(Ti=vo.now())+Mi,zn=Eo=0;try{Ug()}finally{zn=0,Hg(),sn=0}}function Fg(){var e=vo.now(),t=e-Ti;t>Xc&&(Mi-=t,Ti=e)}function Hg(){for(var e,t=Ai,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:Ai=o);wo=e,yl(i)}function yl(e){if(!zn){Eo&&(Eo=clearTimeout(Eo));var t=e-sn;t>24?(e<1/0&&(Eo=setTimeout(Qc,e-vo.now()-Mi)),ko&&(ko=clearInterval(ko))):(ko||(Ti=vo.now(),ko=setInterval(Fg,Xc)),zn=1,Zc(Qc))}}function ed(e,t,o){var i=new Bi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var Gg=Ei("start","end","cancel","interrupt"),Yg=[],td=0,nd=1,gl=2,Oi=3,od=4,bl=5,Di=6;function Li(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;jg(e,o,{name:t,index:i,group:a,on:Gg,tween:Yg,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:td})}function _l(e,t){var o=gt(e,t);if(o.state>td)throw new Error("too late; already scheduled");return o}function It(e,t){var o=gt(e,t);if(o.state>Oi)throw new Error("too late; already running");return o}function gt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function jg(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Jc(l,0,o.time);function l(d){o.state=nd,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!==nd)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Oi)return ed(r);m.state===od?(m.state=Di,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Di,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(ed(function(){o.state===Oi&&(o.state=od,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=gl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===gl){for(o.state=Oi,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=bl,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===bl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Di,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Pi(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>gl&&i.state<bl,i.state=Di,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Wg(e){return this.each(function(){Pi(this,e)})}function Kg(e,t){var o,i;return function(){var a=It(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 qg(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=It(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 Xg(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=gt(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?Kg:qg)(o,e,t))}function El(e,t,o){var i=e._id;return e.each(function(){var a=It(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return gt(a,i).value[t]}}function id(e,t){var o;return(typeof t=="number"?$t:t instanceof an?Ci:(o=an(t))?(t=o,Ci):Yc)(e,t)}function Zg(e){return function(){this.removeAttribute(e)}}function Jg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qg(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 eb(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 tb(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 nb(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 ob(e,t){var o=wi(e),i=o==="transform"?Og:id;return this.attrTween(e,typeof t=="function"?(o.local?nb:tb)(o,i,El(this,"attr."+e,t)):t==null?(o.local?Jg:Zg)(o):(o.local?eb:Qg)(o,i,t))}function ib(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ab(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function lb(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ab(e,l)),o}return a._value=t,a}function rb(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&ib(e,l)),o}return a._value=t,a}function sb(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=wi(e);return this.tween(o,(i.local?lb:rb)(i,t))}function cb(e,t){return function(){_l(this,e).delay=+t.apply(this,arguments)}}function db(e,t){return t=+t,function(){_l(this,e).delay=t}}function ub(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cb:db)(t,e)):gt(this.node(),t).delay}function fb(e,t){return function(){It(this,e).duration=+t.apply(this,arguments)}}function mb(e,t){return t=+t,function(){It(this,e).duration=t}}function pb(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fb:mb)(t,e)):gt(this.node(),t).duration}function hb(e,t){if(typeof t!="function")throw new Error;return function(){It(this,e).ease=t}}function yb(e){var t=this._id;return arguments.length?this.each(hb(t,e)):gt(this.node(),t).ease}function gb(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;It(this,e).ease=o}}function bb(e){if(typeof e!="function")throw new Error;return this.each(gb(this._id,e))}function _b(e){typeof e!="function"&&(e=wc(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 Mt(i,this._parents,this._name,this._id)}function Eb(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 Mt(r,this._parents,this._name,this._id)}function kb(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 wb(e,t,o){var i,a,l=kb(t)?_l:It;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function vb(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(wb(o,e,t))}function Nb(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function $b(){return this.on("end.remove",Nb(this._id))}function Ib(e){var t=this._name,o=this._id;typeof e!="function"&&(e=il(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,Li(d[p],t,o,p,d,gt(u,o)));return new Mt(l,this._parents,t,o)}function Sb(e){var t=this._name,o=this._id;typeof e!="function"&&(e=kc(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,y=gt(u,o),b=0,g=p.length;b<g;++b)(m=p[b])&&Li(m,t,o,b,p,y);l.push(p),r.push(u)}return new Mt(l,r,t,o)}var xb=po.prototype.constructor;function Cb(){return new xb(this._groups,this._parents)}function Rb(e,t){var o,i,a;return function(){var l=Dn(this,e),r=(this.style.removeProperty(e),Dn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function ad(e){return function(){this.style.removeProperty(e)}}function Vb(e,t,o){var i,a=o+"",l;return function(){var r=Dn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Ab(e,t,o){var i,a,l;return function(){var r=Dn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Dn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Tb(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=It(this,e),d=c.on,u=c.value[l]==null?s||(s=ad(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Mb(e,t,o){var i=(e+="")=="transform"?Bg:id;return t==null?this.styleTween(e,Rb(e,i)).on("end.style."+e,ad(e)):typeof t=="function"?this.styleTween(e,Ab(e,i,El(this,"style."+e,t))).each(Tb(this._id,e)):this.styleTween(e,Vb(e,i,t),o).on("end.style."+e,null)}function Bb(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Ob(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Bb(e,r,o)),i}return l._value=t,l}function Db(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,Ob(e,t,o??""))}function Lb(e){return function(){this.textContent=e}}function Pb(e){return function(){var t=e(this);this.textContent=t??""}}function zb(e){return this.tween("text",typeof e=="function"?Pb(El(this,"text",e)):Lb(e==null?"":e+""))}function Ub(e){return function(t){this.textContent=e.call(this,t)}}function Fb(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Ub(a)),t}return i._value=e,i}function Hb(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,Fb(e))}function Gb(){for(var e=this._name,t=this._id,o=ld(),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=gt(c,t);Li(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(i,this._parents,e,o)}function Yb(){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=It(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 jb=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ld(){return++jb}var Bt=po.prototype;Mt.prototype={constructor:Mt,select:Ib,selectAll:Sb,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:_b,merge:Eb,selection:Cb,transition:Gb,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:vb,attr:ob,attrTween:sb,style:Mb,styleTween:Db,text:zb,textTween:Hb,remove:$b,tween:Xg,delay:ub,duration:pb,ease:yb,easeVarying:bb,end:Yb,[Symbol.iterator]:Bt[Symbol.iterator]};function Wb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kb={time:null,delay:0,duration:250,ease:Wb};function qb(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 Xb(e){var t,o;e instanceof Mt?(t=e._id,e=e._name):(t=ld(),(o=Kb).time=hl(),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])&&Li(c,e,t,d,r,o||qb(c,t));return new Mt(i,this._parents,e,t)}po.prototype.interrupt=Wg,po.prototype.transition=Xb;const zi=e=>()=>e;function Zb(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 Ot(e,t,o){this.k=e,this.x=t,this.y=o}Ot.prototype={constructor:Ot,scale:function(e){return e===1?this:new Ot(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ot(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 Un=new Ot(1,0,0);Ot.prototype;function kl(e){e.stopImmediatePropagation()}function No(e){e.preventDefault(),e.stopImmediatePropagation()}function Jb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Qb(){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 rd(){return this.__zoom||Un}function e0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function t0(){return navigator.maxTouchPoints||"ontouchstart"in this}function n0(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 o0(){var e=Jb,t=Qb,o=n0,i=e0,a=t0,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Vi,d=Ei("start","zoom","end"),u,f,p,m=500,y=150,b=0,g=10;function E(_){_.property("__zoom",rd).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",ee).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(_,Y,T,W){var Q=_.selection?_.selection():_;Q.property("__zoom",rd),_!==Q?q(_,Y,T,W):Q.interrupt().each(function(){B(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},E.scaleBy=function(_,Y,T,W){E.scaleTo(_,function(){var Q=this.__zoom.k,te=typeof Y=="function"?Y.apply(this,arguments):Y;return Q*te},T,W)},E.scaleTo=function(_,Y,T,W){E.transform(_,function(){var Q=t.apply(this,arguments),te=this.__zoom,C=T==null?k(Q):typeof T=="function"?T.apply(this,arguments):T,Z=te.invert(C),le=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(te,le),C,Z),Q,r)},T,W)},E.translateBy=function(_,Y,T,W){E.transform(_,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),r)},null,W)},E.translateTo=function(_,Y,T,W,Q){E.transform(_,function(){var te=t.apply(this,arguments),C=this.__zoom,Z=W==null?k(te):typeof W=="function"?W.apply(this,arguments):W;return o(Un.translate(Z[0],Z[1]).scale(C.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof T=="function"?-T.apply(this,arguments):-T),te,r)},W,Q)};function N(_,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===_.k?_:new Ot(Y,_.x,_.y)}function h(_,Y,T){var W=Y[0]-T[0]*_.k,Q=Y[1]-T[1]*_.k;return W===_.x&&Q===_.y?_:new Ot(_.k,W,Q)}function k(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function q(_,Y,T,W){_.on("start.zoom",function(){B(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,te=arguments,C=B(Q,te).event(W),Z=t.apply(Q,te),le=T==null?k(Z):typeof T=="function"?T.apply(Q,te):T,pe=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),be=Q.__zoom,de=typeof Y=="function"?Y.apply(Q,te):Y,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new Ot(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}C.zoom(null,ye)}})}function B(_,Y,T){return!T&&_.__zooming||new H(_,Y)}function H(_,Y){this.that=_,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,Y),this.taps=0}H.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,Y){return this.mouse&&_!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var Y=ht(this.that).datum();d.call(_,this.that,new Zb(_,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),Y)}};function A(_,...Y){if(!e.apply(this,arguments))return;var T=B(this,Y).event(_),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),te=vt(_);if(T.wheel)(T.mouse[0][0]!==te[0]||T.mouse[0][1]!==te[1])&&(T.mouse[1]=W.invert(T.mouse[0]=te)),clearTimeout(T.wheel);else{if(W.k===Q)return;T.mouse=[te,W.invert(te)],Pi(this),T.start()}No(_),T.wheel=setTimeout(C,y),T.zoom("mouse",o(h(N(W,Q),T.mouse[0],T.mouse[1]),T.extent,r));function C(){T.wheel=null,T.end()}}function S(_,...Y){if(p||!e.apply(this,arguments))return;var T=_.currentTarget,W=B(this,Y,!0).event(_),Q=ht(_.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),te=vt(_,T),C=_.clientX,Z=_.clientY;Ac(_.view),kl(_),W.mouse=[te,this.__zoom.invert(te)],Pi(this),W.start();function le(be){if(No(be),!W.moved){var de=be.clientX-C,me=be.clientY-Z;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=vt(be,T),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),Tc(be.view,W.moved),No(be),W.event(be).end()}}function L(_,...Y){if(e.apply(this,arguments)){var T=this.__zoom,W=vt(_.changedTouches?_.changedTouches[0]:_,this),Q=T.invert(W),te=T.k*(_.shiftKey?.5:2),C=o(h(N(T,te),W,Q),t.apply(this,Y),r);No(_),s>0?ht(this).transition().duration(s).call(q,C,W,_):ht(this).call(E.transform,C,W,_)}}function ee(_,...Y){if(e.apply(this,arguments)){var T=_.touches,W=T.length,Q=B(this,Y,_.changedTouches.length===W).event(_),te,C,Z,le;for(kl(_),C=0;C<W;++C)Z=T[C],le=vt(Z,this),le=[le,this.__zoom.invert(le),Z.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,te=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),Pi(this),Q.start())}}function M(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C,Z,le;for(No(_),te=0;te<Q;++te)C=W[te],Z=vt(C,this),T.touch0&&T.touch0[2]===C.identifier?T.touch0[0]=Z:T.touch1&&T.touch1[2]===C.identifier&&(T.touch1[0]=Z);if(C=T.that.__zoom,T.touch1){var pe=T.touch0[0],be=T.touch0[1],de=T.touch1[0],me=T.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;C=N(C,Math.sqrt(ye/ve)),Z=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(T.touch0)Z=T.touch0[0],le=T.touch0[1];else return;T.zoom("touch",o(h(C,Z,le),T.extent,r))}}function oe(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C;for(kl(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),te=0;te<Q;++te)C=W[te],T.touch0&&T.touch0[2]===C.identifier?delete T.touch0:T.touch1&&T.touch1[2]===C.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(C=vt(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<g)){var Z=ht(this).on("dblclick.zoom");Z&&Z.apply(this,arguments)}}}return E.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:zi(+_),E):i},E.filter=function(_){return arguments.length?(e=typeof _=="function"?_:zi(!!_),E):e},E.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:zi(!!_),E):a},E.extent=function(_){return arguments.length?(t=typeof _=="function"?_:zi([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),E):t},E.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],E):[l[0],l[1]]},E.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],E):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},E.constrain=function(_){return arguments.length?(o=_,E):o},E.duration=function(_){return arguments.length?(s=+_,E):s},E.interpolate=function(_){return arguments.length?(c=_,E):c},E.on=function(){var _=d.on.apply(d,arguments);return _===d?E:_},E.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,E):Math.sqrt(b)},E.tapDistance=function(_){return arguments.length?(g=+_,E):g},E}var xe=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(xe||{}),wl=(e=>(e.Partial="partial",e.Full="full",e))(wl||{}),cn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(cn||{}),Dt=(e=>(e.Strict="strict",e.Loose="loose",e))(Dt||{}),vl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(vl||{}),$o=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))($o||{}),sd=(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))(sd||{});const i0=["INPUT","SELECT","TEXTAREA"],a0=typeof document<"u"?document:null;function Nl(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 i0.includes(i==null?void 0:i.nodeName)||a||!!l}function l0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function cd(e,t,o,i){const a=t.replace("+",`
|
|
11
14
|
`).replace(`
|
|
12
15
|
|
|
13
16
|
`,`
|
|
14
17
|
+`).split(`
|
|
15
|
-
`).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 i0(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=a0(o.code,e);return Array.isArray(e)?e.some(a=>rd(o[i],a,t,o.type==="keyup")):rd(o[i],e,t,o.type==="keyup")}}function a0(e,t){return t.includes(e)?"code":"key"}function No(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??n0),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}),pc(["blur","contextmenu"],s),hc((...d)=>r(...d),d=>{var u,f;const m=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=o0(d),(!a||a&&!m)&&wl(d))return;const b=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!p&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),hc((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&wl(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"?i0(d,l):d}return i}const sd="vue-flow__node-desc",cd="vue-flow__edge-desc",l0="vue-flow__aria-live",dd=["Enter"," ","Escape"],Un={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Li(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Pi(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 zi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function dn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function ud(e,t){return{x:dn(e.x,t[0][0],t[1][0]),y:dn(e.y,t[0][1],t[1][1])}}function fd(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Yt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function un(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Yt(e)}function $o(e){return un(e)&&"computedPosition"in e}function Ui(e){return!Number.isNaN(e)&&Number.isFinite(e)}function r0(e){return Ui(e.width)&&Ui(e.height)&&Ui(e.x)&&Ui(e.y)}function s0(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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function md(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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(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 pd(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 c0(...e){if(e.length===3){const[l,r,s]=e;return pd(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Yt(l)&&l.source===i).map(l=>o.find(r=>un(r)&&r.id===l.target))}function d0(...e){if(e.length===3){const[l,r,s]=e;return pd(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Yt(l)&&l.target===i).map(l=>o.find(r=>un(r)&&r.id===l.source))}function hd({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function u0(e,t){return t.some(o=>Yt(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 So({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?Hi(s,r):s}function yd(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 Fi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function gd({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function f0(e,t){return gd(yd(Fi(e),Fi(t)))}function vl(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=yd(t,Fi({...i.computedPosition,...i.dimensions}))}return gd(t)}function bd(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...So(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,m=c.height??s.height??null;if(a&&!d||u)continue;const p=Pi(l,Li(s)),y=f===null||m===null,b=i&&p>0,g=(f??0)*(m??0);(y||b||p>=g||s.dragging)&&r.push(s)}return r}function fn(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 Fn(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 Ro(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function m0(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Fn(e,o),a=Fn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Fn(e.top??e.y??0,o),a=Fn(e.bottom??e.y??0,o),l=Fn(e.left??e.x??0,t),r=Fn(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 p0(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 _d(e,t,o,i,a,l=.1){const r=m0(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=dn(d,i,a),f=e.x+e.width/2,m=e.y+e.height/2,p=t/2-f*u,y=o/2-m*u,b=p0(e,p,y,u,t,o),g={left:Math.min(b.left-r.left,0),top:Math.min(b.top-r.top,0),right:Math.min(b.right-r.right,0),bottom:Math.min(b.bottom-r.bottom,0)};return{x:p-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function h0(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Ed(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Ed(o,t):!1}function xo(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Nl(e){const t=e.ctrlKey&&Co()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function kd(e,t,o){return e<t?dn(Math.abs(e-t),1,t)/t:e>o?-dn(Math.abs(e-o),1,t)/t:0}function wd(e,t,o=15,i=40){const a=kd(e.x,i,t.width-i)*o,l=kd(e.y,i,t.height-i)*o;return[a,l]}function $l(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 vd(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($o(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&&$o(c)&&$l(r,c)}break;case"dimensions":if($o(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&&$o(c)&&(!!c.dimensions.width&&!!c.dimensions.height?$l(r,c):n.nextTick(()=>{$l(r,c)}))}break}return t}function jt(e,t){return{id:e,type:"select",selected:t}}function Nd(e){return{item:e,type:"add"}}function $d(e){return{id:e,type:"remove"}}function Id(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Wt(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(jt(l.id,r)))}return i}const Sd=()=>{};function Ie(e){const t=new Set;let o=Sd,i=()=>!1;const a=()=>t.size>0||i(),l=m=>{o=m},r=()=>{o=Sd},s=m=>{i=m},c=()=>{i=()=>!1},d=m=>{t.delete(m)};return{on:m=>{t.add(m);const p=()=>d(m);return uo(p),{off:p}},off:d,trigger:m=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(y=>y(m)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function xd(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 y0(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Ed(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 Il({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 Cd(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 g0(e,t,o){const[i,a,l,r]=typeof e!="string"?Cd(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 b0(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=g0(a,e,i);l&&(a=l)}else t(new Qe(qe.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]=Cd(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 _0({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Sl(e,t,o,i,a){const l=_0(e.dimensions,b0(e,o,i,a)),r=ud(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 Hn(e,t,o=xe.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??v0(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case xe.Top:return{x:a+r/2,y:l};case xe.Right:return{x:a+r,y:l+s/2};case xe.Bottom:return{x:a+r/2,y:l+s};case xe.Left:return{x:a,y:l+s/2}}}function Rd(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function E0({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=Fi({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)),m=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*m)>0}function k0(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 qe=(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))(qe||{});const Vd={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
|
|
18
|
+
`).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 r0(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=s0(o.code,e);return Array.isArray(e)?e.some(a=>cd(o[i],a,t,o.type==="keyup")):cd(o[i],e,t,o.type==="keyup")}}function s0(e,t){return t.includes(e)?"code":"key"}function Io(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??a0),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}),yc(["blur","contextmenu"],s),gc((...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=l0(d),(!a||a&&!p)&&Nl(d))return;const b=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,g=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!m&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),gc((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Nl(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"?r0(d,l):d}return i}const dd="vue-flow__node-desc",ud="vue-flow__edge-desc",c0="vue-flow__aria-live",fd=["Enter"," ","Escape"],Fn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ui(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Fi(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 Hi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function dn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function md(e,t){return{x:dn(e.x,t[0][0],t[1][0]),y:dn(e.y,t[0][1],t[1][1])}}function pd(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Yt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function un(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Yt(e)}function So(e){return un(e)&&"computedPosition"in e}function Gi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function d0(e){return Gi(e.width)&&Gi(e.height)&&Gi(e.x)&&Gi(e.y)}function u0(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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function hd(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:Xe(e.data)?e.data:{},events:n.markRaw(Xe(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 yd(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 f0(...e){if(e.length===3){const[l,r,s]=e;return yd(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Yt(l)&&l.source===i).map(l=>o.find(r=>un(r)&&r.id===l.target))}function m0(...e){if(e.length===3){const[l,r,s]=e;return yd(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Yt(l)&&l.target===i).map(l=>o.find(r=>un(r)&&r.id===l.source))}function gd({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function p0(e,t){return t.some(o=>Yt(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 xo({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function Co({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?ji(s,r):s}function bd(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 Yi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function _d({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function h0(e,t){return _d(bd(Yi(e),Yi(t)))}function $l(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=bd(t,Yi({...i.computedPosition,...i.dimensions}))}return _d(t)}function Ed(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...Co(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=Fi(l,Ui(s)),y=f===null||p===null,b=i&&m>0,g=(f??0)*(p??0);(y||b||m>=g||s.dragging)&&r.push(s)}return r}function fn(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 Hn(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 Ao(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function y0(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Hn(e,o),a=Hn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Hn(e.top??e.y??0,o),a=Hn(e.bottom??e.y??0,o),l=Hn(e.left??e.x??0,t),r=Hn(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 g0(e,t,o,i,a,l){const{x:r,y:s}=xo(e,{x:t,y:o,zoom:i}),{x:c,y:d}=xo({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 kd(e,t,o,i,a,l=.1){const r=y0(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=dn(d,i,a),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,y=o/2-p*u,b=g0(e,m,y,u,t,o),g={left:Math.min(b.left-r.left,0),top:Math.min(b.top-r.top,0),right:Math.min(b.right-r.right,0),bottom:Math.min(b.bottom-r.bottom,0)};return{x:m-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function b0(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function wd(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:wd(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 Il(e){const t=e.ctrlKey&&Vo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function vd(e,t,o){return e<t?dn(Math.abs(e-t),1,t)/t:e>o?-dn(Math.abs(e-o),1,t)/t:0}function Nd(e,t,o=15,i=40){const a=vd(e.x,i,t.width-i)*o,l=vd(e.y,i,t.height-i)*o;return[a,l]}function Sl(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 $d(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(So(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&&So(c)&&Sl(r,c)}break;case"dimensions":if(So(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&&So(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Sl(r,c):n.nextTick(()=>{Sl(r,c)}))}break}return t}function jt(e,t){return{id:e,type:"select",selected:t}}function Id(e){return{item:e,type:"add"}}function Sd(e){return{id:e,type:"remove"}}function xd(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Wt(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(jt(l.id,r)))}return i}const Cd=()=>{};function Ie(e){const t=new Set;let o=Cd,i=()=>!1;const a=()=>t.size>0||i(),l=p=>{o=p},r=()=>{o=Cd},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return mo(m),{off:m}},off:d,trigger:p=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(y=>y(p)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Rd(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 _0(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!wd(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 xl({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 Vd(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 E0(e,t,o){const[i,a,l,r]=typeof e!="string"?Vd(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 k0(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=E0(a,e,i);l&&(a=l)}else t(new Qe(qe.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]=Vd(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 w0({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Cl(e,t,o,i,a){const l=w0(e.dimensions,k0(e,o,i,a)),r=md(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 Gn(e,t,o=xe.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??I0(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case xe.Top:return{x:a+r/2,y:l};case xe.Right:return{x:a+r,y:l+s/2};case xe.Bottom:return{x:a+r/2,y:l+s};case xe.Left:return{x:a,y:l+s/2}}}function Ad(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function v0({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=Yi({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 N0(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 qe=(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))(qe||{});const Td={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
|
|
16
19
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
17
20
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
18
21
|
Node: ${e}
|
|
@@ -32,7 +35,7 @@ Edge: ${e}
|
|
|
32
35
|
Source: ${t}
|
|
33
36
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
34
37
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
35
|
-
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 Qe extends Error{constructor(t,...o){var i;super((i=Vd[t])==null?void 0:i.call(Vd,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function xl(e){return"clientX"in e}function w0(e){return"sourceEvent"in e}function St(e,t){const o=xl(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 Co=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function v0(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 Hi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const N0=()=>!0;function Cl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function $0(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())Pi(a,Li(l))>0&&i.push(l);return i}const I0=250;function S0(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=$0(e,o,t+I0);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:m,y:p}=Hn(d,f,f.position,!0),y=Math.sqrt((m-e.x)**2+(p-e.y)**2);y>t||(y<s?(r=[{...f,x:m,y:p}],s=y):y===s&&r.push({...f,x:m,y:p}))}}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 Ad(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=N0},u,f,m,p){const y=l==="target",b=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:g,y:E}=St(e),$=r.elementFromPoint(g,E),h=$!=null&&$.classList.contains(`${s}-flow__handle`)?$:b,w={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const X=Td(void 0,h),B=h.getAttribute("data-nodeid"),H=h.getAttribute("data-handleid"),A=h.classList.contains("connectable"),S=h.classList.contains("connectableend");if(!B||!X)return w;const L={source:y?B:i,sourceHandle:y?H:a,target:y?i:B,targetHandle:y?a:H};w.connection=L;const M=A&&S&&(o===Dt.Strict?y&&X==="source"||!y&&X==="target":B!==i||H!==a);w.isValid=M&&d(L,{nodes:f,edges:u,sourceNode:m(L.source),targetNode:m(L.target)}),w.toHandle=Md(B,X,H,p,o,!0)}return w}function Td(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function x0(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function C0(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Md(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Dt.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(m=>m.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...Hn(d,f,f.position,!0)}:f}const Rl={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},R0=["production","prod"];function Ro(e,...t){Bd()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Bd(){return!R0.includes(process.env.NODE_ENV||"")}function Od(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,...zi(r)}}):null}function Vl(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 Xe(e){return typeof n.unref(e)<"u"}function V0(e,t,o,i){if(!e||!e.source||!e.target)return o(new Qe(qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Yt(e)?a=e:a={...e,id:hd(e)},a=md(a,void 0,i),u0(a,t)?!1:a}function A0(e,t,o,i,a){if(!t.source||!t.target)return a(new Qe(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Qe(qe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?hd(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Dd(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!un(r)){o(new Qe(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=s0(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 Qe(qe.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 Ld(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 Al(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}`;Ld("source",c,u,e,a,r),Ld("target",c,d,e,l,s)}}function Pd(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Tl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Yt(d)?d:V0(d,s,a,l);if(!u)continue;const f=o(u.source),m=o(u.target);if(!f||!m){a(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Qe(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!m){a(new Qe(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:m})){a(new Qe(qe.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...md(u,p,l),sourceNode:f,targetNode:m})}return c}const zd=Symbol("vueFlow"),Ud=Symbol("nodeId"),Fd=Symbol("nodeRef"),T0=Symbol("edgeId"),M0=Symbol("edgeRef"),Gi=Symbol("slots");function Hd(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:m,findNode:p,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:g,removeSelectedElements:E,addSelectedNodes:$,updateNodePositions:h,emits:w}=Pe(),{onStart:X,onDrag:B,onStop:H,onClick:A,el:S,disabled:L,id:ee,selectable:M,dragHandle:oe}=e,_=n.shallowRef(!1);let Y=[],T,W=null,Q={x:void 0,y:void 0},te={x:0,y:0},C=null,Z=!1,le=!1,pe=0,be=!1;const de=D0(),me=({x:J,y:q})=>{Q={x:J,y:q};let v=!1;if(Y=Y.map(V=>{const j={x:J-V.distance.x,y:q-V.distance.y},{computedPosition:D}=Sl(V,o.value?Hi(j,i.value):j,w.error,r.value,V.parentNode?p(V.parentNode):void 0);return v=v||V.position.x!==D.x||V.position.y!==D.y,V.position=D,V}),le=le||v,!!v&&(h(Y,!0,!0),_.value=!0,C)){const[V,j]=Il({id:ee,dragItems:Y,findNode:p});B({event:C,node:V,nodes:j})}},ye=()=>{if(!W)return;const[J,q]=wd(te,W,u.value);if(J!==0||q!==0){const v={x:(Q.x??0)-J/c.value.zoom,y:(Q.y??0)-q/c.value.zoom};m({x:J,y:q})&&me(v)}pe=requestAnimationFrame(ye)},ve=(J,q)=>{Z=!0;const v=p(ee);!g.value&&!y.value&&v&&(v.selected||E()),v&&n.toValue(M)&&g.value&&Vl(v,y.value,$,E,b,!1,q);const V=de(J.sourceEvent);if(Q=V,Y=y0(l.value,f.value,V,ee),Y.length){const[j,D]=Il({id:ee,dragItems:Y,findNode:p});X({event:J.sourceEvent,node:j,nodes:D})}},Ce=(J,q)=>{var v;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(le=!1,s.value===0&&ve(J,q),Q=de(J.sourceEvent),W=((v=t.value)==null?void 0:v.getBoundingClientRect())||null,te=St(J.sourceEvent,W))},Se=(J,q)=>{const v=de(J.sourceEvent);if(!be&&Z&&d.value&&(be=!0,ye()),!Z){const V=v.xSnapped-(Q.x??0),j=v.ySnapped-(Q.y??0);Math.sqrt(V*V+j*j)>s.value&&ve(J,q)}(Q.x!==v.xSnapped||Q.y!==v.ySnapped)&&Y.length&&Z&&(C=J.sourceEvent,te=St(J.sourceEvent,W),me(v))},ge=J=>{let q=!1;if(!Z&&!_.value&&!y.value){const v=J.sourceEvent,V=de(v),j=V.xSnapped-(Q.x??0),D=V.ySnapped-(Q.y??0),K=Math.sqrt(j*j+D*D);K!==0&&K<=s.value&&(A==null||A(v),q=!0)}if(Y.length&&!q){le&&(h(Y,!1,!1),le=!1);const[v,V]=Il({id:ee,dragItems:Y,findNode:p});H({event:J.sourceEvent,node:v,nodes:V})}Y=[],_.value=!1,be=!1,Z=!1,Q={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(L),S],([J,q],v,V)=>{if(q){const j=ht(q);J||(T=rg().on("start",D=>Ce(D,q)).on("drag",D=>Se(D,q)).on("end",D=>ge(D)).filter(D=>{const K=D.target,he=n.toValue(oe);return!D.button&&(!a.value||!xd(K,`.${a.value}`,q)&&(!he||xd(K,he,q)))}),j.call(T)),V(()=>{j.on(".drag",null),T&&(T.on("start",null),T.on("drag",null),T.on("end",null))})}}),_}function B0(){return{doubleClick:Ie(),click:Ie(),mouseEnter:Ie(),mouseMove:Ie(),mouseLeave:Ie(),contextMenu:Ie(),updateStart:Ie(),update:Ie(),updateEnd:Ie()}}function O0(e,t){const o=B0();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 D0(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Pe();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=w0(a)?a.sourceEvent:a,{x:c,y:d}=St(s,r),u=So({x:c,y:d},e.value),{x:f,y:m}=o.value?Hi(u,t.value):u;return{xSnapped:f,ySnapped:m,...u}}}function Yi(){return!0}function Gd({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:m,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:b,findNode:g,panBy:E,startConnection:$,updateConnection:h,endConnection:w,emits:X,viewport:B,edges:H,nodes:A,isValidConnection:S,nodeLookup:L}=Pe();let ee=null,M=!1,oe=null;function _(T){var W;const Q=n.toValue(o)==="target",te=xl(T),C=fd(T.target),Z=T.currentTarget;if(Z&&(te&&T.button===0||!te)){let le=function(ke){v=St(ke,ge),me=S0(So(v,B.value,!1,[1,1]),u.value,L.value,D),V||(j(),V=!0);const Re=Ad(ke,{handle:me,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:Q?"target":"source",isValidConnection:de,doc:C,lib:"vue",flowId:s,nodeLookup:L.value},H.value,A.value,g,L.value);oe=Re.handleDomNode,ee=Re.connection,M=C0(!!me,Re.isValid);const Ae={...$e,isValid:M,to:Re.toHandle&&M?Io({x:Re.toHandle.x,y:Re.toHandle.y},B.value):v,toHandle:Re.toHandle,toPosition:M&&Re.toHandle?Re.toHandle.position:Rl[D.position],toNode:Re.toHandle?L.value.get(Re.toHandle.nodeId):null};if(M&&me&&($e!=null&&$e.toHandle)&&Ae.toHandle&&$e.toHandle.type===Ae.toHandle.type&&$e.toHandle.nodeId===Ae.toHandle.nodeId&&$e.toHandle.id===Ae.toHandle.id&&$e.to.x===Ae.to.x&&$e.to.y===Ae.to.y)return;const Oe=me??Re.toHandle;if(h(Oe&&M?Io({x:Oe.x,y:Oe.y},B.value):v,Oe,x0(!!Oe,M)),$e=Ae,!me&&!M&&!oe)return Cl(q);ee&&ee.source!==ee.target&&oe&&(Cl(q),q=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!M),oe.classList.toggle("vue-flow__handle-valid",!!M))},pe=function(ke){"touches"in ke&&ke.touches.length>0||((me||oe)&&ee&&M&&(l?l(ke,ee):X.connect(ee)),X.connectEnd(ke),a&&(r==null||r(ke)),Cl(q),cancelAnimationFrame(ye),w(ke),V=!1,M=!1,ee=null,oe=null,C.removeEventListener("mousemove",le),C.removeEventListener("mouseup",pe),C.removeEventListener("touchmove",le),C.removeEventListener("touchend",pe))};const be=g(n.toValue(t));let de=n.toValue(i)||S.value||Yi;!de&&be&&(de=(Q?be.isValidSourcePos:be.isValidTargetPos)||Yi);let me,ye=0;const{x:ve,y:Ce}=St(T),Se=Td(n.toValue(a),Z),ge=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!ge||!Se)return;const J=Md(n.toValue(t),Se,n.toValue(e),L.value,d.value);if(!J)return;let q,v=St(T,ge),V=!1;const j=()=>{if(!y.value)return;const[ke,Re]=wd(v,ge,b.value);E({x:ke,y:Re}),ye=requestAnimationFrame(j)},D={...J,nodeId:n.toValue(t),type:Se,position:J.position},K=L.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Hn(K,D,xe.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:K,to:v,toHandle:null,toPosition:Rl[D.position],toNode:null};$({nodeId:n.toValue(t),id:n.toValue(e),type:Se,position:(Z==null?void 0:Z.getAttribute("data-handlepos"))||xe.Top,...v},{x:ve-ge.left,y:Ce-ge.top}),X.connectStart({event:T,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Se});let $e=we;C.addEventListener("mousemove",le),C.addEventListener("mouseup",pe),C.addEventListener("touchmove",le),C.addEventListener("touchend",pe)}}function Y(T){var W,Q;if(!f.value)return;const te=n.toValue(o)==="target";if(!m.value){X.clickConnectStart({event:T,nodeId:n.toValue(t),handleId:n.toValue(e)}),$({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:xe.Top,...St(T)},void 0,!0);return}let C=n.toValue(i)||S.value||Yi;const Z=g(n.toValue(t));if(!C&&Z&&(C=(te?Z.isValidSourcePos:Z.isValidTargetPos)||Yi),Z&&(typeof Z.connectable>"u"?p.value:Z.connectable)===!1)return;const le=fd(T.target),pe=Ad(T,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:xe.Top,...St(T)},connectionMode:d.value,fromNodeId:m.value.nodeId,fromHandleId:m.value.id??null,fromType:m.value.type,isValidConnection:C,doc:le,lib:"vue",flowId:s,nodeLookup:L.value},H.value,A.value,g,L.value),be=((W=pe.connection)==null?void 0:W.source)===((Q=pe.connection)==null?void 0:Q.target);pe.isValid&&pe.connection&&!be&&X.connect(pe.connection),X.clickConnectEnd(T),w(T,!0)}return{handlePointerDown:_,handleClick:Y}}function L0(){return n.inject(Ud,"")}function Yd(e){const t=e??L0()??"",o=n.inject(Fd,n.ref(null)),{findNode:i,edges:a,emits:l}=Pe(),r=i(t);return r||l.error(new Qe(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>fn([r],a.value))}}function P0(){return{doubleClick:Ie(),click:Ie(),mouseEnter:Ie(),mouseMove:Ie(),mouseLeave:Ie(),contextMenu:Ie(),dragStart:Ie(),drag:Ie(),dragStop:Ie()}}function z0(e,t){const o=P0();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 jd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Pe();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,m=d?4:1,p=c.x*u*m,y=c.y*f*m,b=[];for(const g of e.value)if(g.draggable||r&&typeof g.draggable>"u"){const E={x:g.computedPosition.x+p,y:g.computedPosition.y+y},{position:$}=Sl(g,E,s.error,t.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:$,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const ji=.1,U0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return Ro("Viewport not initialized yet."),Promise.resolve(!1)}const F0={zoomIn:Kt,zoomOut:Kt,zoomTo:Kt,fitView:Kt,setCenter:Kt,fitBounds:Kt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kt,setTransform:Kt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function H0(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?go:xi).scaleBy(Ml(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}=ud({x:-i,y:-a},e.translateExtent),f=zn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?go:xi).transform(Ml(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"?go:xi).scaleTo(Ml(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:ji,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const m of e.nodes)m.dimensions.width&&m.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!m.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(m.id))&&s.push(m);if(!s.length)return Promise.resolve(!1);const c=vl(s),{x:d,y:u,zoom:f}=_d(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??ji);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:ji})=>{const{x:r,y:s,zoom:c}=_d(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??ji);return o(r,s,c,l)},project:a=>So(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 So(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}}}:F0)}function Ml(e,t=0,o=U0,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function G0(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,E=!!(o.nodes.value.length||o.edges.value.length);b=Bn([e.modelValue,()=>{var $,h;return(h=($=e.modelValue)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(g==null||g.pause(),o.setElements($),!g&&!E&&$.length?E=!0:g==null||g.resume())}),g=Bn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([$,h])=>{var w;(w=e.modelValue)!=null&&w.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...$,...h],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,E=!!o.nodes.value.length;b=Bn([e.nodes,()=>{var $,h;return(h=($=e.nodes)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(g==null||g.pause(),o.setNodes($),!g&&!E&&$.length?E=!0:g==null||g.resume())}),g=Bn([o.nodes,()=>o.nodes.value.length],([$])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...$],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,E=!!o.edges.value.length;b=Bn([e.edges,()=>{var $,h;return(h=($=e.edges)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(g==null||g.pause(),o.setEdges($),!g&&!E&&$.length?E=!0:g==null||g.resume())}),g=Bn([o.edges,()=>o.edges.value.length],([$])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...$],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},m=()=>{i.run(()=>{const b=async g=>{let E=g;typeof t.autoConnect=="function"&&(E=await t.autoConnect(g)),E!==!1&&o.addEdges([E])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(g,E,$)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),$(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(t)){const E=g;if(!b.includes(E)){const $=n.toRef(()=>t[E]),h=o[E];n.isRef(h)&&i.run(()=>{n.watch($,w=>{Xe(w)&&(h.value=w)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),m(),p()})()}),()=>i.stop()}function Y0(){return{edgesChange:Ie(),nodesChange:Ie(),nodeDoubleClick:Ie(),nodeClick:Ie(),nodeMouseEnter:Ie(),nodeMouseMove:Ie(),nodeMouseLeave:Ie(),nodeContextMenu:Ie(),nodeDragStart:Ie(),nodeDrag:Ie(),nodeDragStop:Ie(),nodesInitialized:Ie(),miniMapNodeClick:Ie(),miniMapNodeDoubleClick:Ie(),miniMapNodeMouseEnter:Ie(),miniMapNodeMouseMove:Ie(),miniMapNodeMouseLeave:Ie(),connect:Ie(),connectStart:Ie(),connectEnd:Ie(),clickConnectStart:Ie(),clickConnectEnd:Ie(),paneReady:Ie(),init:Ie(),move:Ie(),moveStart:Ie(),moveEnd:Ie(),selectionDragStart:Ie(),selectionDrag:Ie(),selectionDragStop:Ie(),selectionContextMenu:Ie(),selectionStart:Ie(),selectionEnd:Ie(),viewportChangeStart:Ie(),viewportChange:Ie(),viewportChangeEnd:Ie(),paneScroll:Ie(),paneClick:Ie(),paneContextMenu:Ie(),paneMouseEnter:Ie(),paneMouseMove:Ie(),paneMouseLeave:Ie(),edgeContextMenu:Ie(),edgeMouseEnter:Ie(),edgeMouseMove:Ie(),edgeMouseLeave:Ie(),edgeDoubleClick:Ie(),edgeClick:Ie(),edgeUpdateStart:Ie(),edgeUpdate:Ie(),edgeUpdateEnd:Ie(),updateNodeInternals:Ie(),error:Ie(e=>Ro(e.message))}}function j0(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),uo(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),uo(l.removeHasEmitListeners)}});function i(a){var l;const r=W0(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function W0(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Wd(){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:El.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:vo.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:cn.Bezier,style:{}},connectionMode:Dt.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:Co()?"Meta":"Control",zoomActivationKeyCode:Co()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Y0(),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 K0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function q0(e,t,o){const i=H0(e),a=v=>{const V=v??[];e.hooks.updateNodeInternals.trigger(V)},l=v=>d0(v,e.nodes,e.edges),r=v=>c0(v,e.nodes,e.edges),s=v=>fn(v,e.edges),c=({id:v,type:V,nodeId:j})=>{var D;const K=v?`-${V}-${v}`:`-${V}`;return Array.from(((D=e.connectionLookup.get(`${j}${K}`))==null?void 0:D.values())??[])},d=v=>{if(v)return t.value.get(v)},u=v=>{if(v)return o.value.get(v)},f=(v,V,j)=>{var D,K;const he=[];for(const we of v){const $e={id:we.id,type:"position",dragging:j,from:we.from};if(V&&($e.position=we.position,we.parentNode)){const ke=d(we.parentNode);$e.position={x:$e.position.x-(((D=ke==null?void 0:ke.computedPosition)==null?void 0:D.x)??0),y:$e.position.y-(((K=ke==null?void 0:ke.computedPosition)==null?void 0:K.y)??0)}}he.push($e)}he!=null&&he.length&&e.hooks.nodesChange.trigger(he)},m=v=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const j=window.getComputedStyle(V),{m22:D}=new window.DOMMatrixReadOnly(j.transform),K=[];for(const he of v){const we=he,$e=d(we.id);if($e){const ke=zi(we.nodeElement);if(!!(ke.width&&ke.height&&($e.dimensions.width!==ke.width||$e.dimensions.height!==ke.height||we.forceUpdate))){const Ae=we.nodeElement.getBoundingClientRect();$e.dimensions=ke,$e.handleBounds.source=Od("source",we.nodeElement,Ae,D,$e.id),$e.handleBounds.target=Od("target",we.nodeElement,Ae,D,$e.id),K.push({id:$e.id,type:"dimensions",dimensions:ke})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),K.length&&e.hooks.nodesChange.trigger(K)},p=(v,V)=>{const j=new Set,D=new Set;for(const we of v)un(we)?j.add(we.id):Yt(we)&&D.add(we.id);const K=Wt(t.value,j,!0),he=Wt(o.value,D);if(e.multiSelectionActive){for(const we of j)K.push(jt(we,V));for(const we of D)he.push(jt(we,V))}K.length&&e.hooks.nodesChange.trigger(K),he.length&&e.hooks.edgesChange.trigger(he)},y=v=>{if(e.multiSelectionActive){const V=v.map(j=>jt(j.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(v.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},b=v=>{if(e.multiSelectionActive){const V=v.map(j=>jt(j.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(v.map(V=>V.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},g=v=>{p(v,!0)},E=v=>{const j=(v||e.nodes).map(D=>(D.selected=!1,jt(D.id,!1)));e.hooks.nodesChange.trigger(j)},$=v=>{const j=(v||e.edges).map(D=>(D.selected=!1,jt(D.id,!1)));e.hooks.edgesChange.trigger(j)},h=v=>{if(!v||!v.length)return p([],!1);const V=v.reduce((j,D)=>{const K=jt(D.id,!1);return un(D)?j.nodes.push(K):j.edges.push(K),j},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},w=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([v,e.maxZoom]),e.minZoom=v},X=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,v]),e.maxZoom=v},B=v=>{var V;(V=e.d3Zoom)==null||V.translateExtent(v),e.translateExtent=v},H=v=>{e.nodeExtent=v,a()},A=v=>{var V;(V=e.d3Zoom)==null||V.clickDistance(v)},S=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},L=v=>{const V=v instanceof Function?v(e.nodes):v;!e.initialized&&!V.length||(e.nodes=Dd(V,d,e.hooks.error.trigger))},ee=v=>{const V=v instanceof Function?v(e.edges):v;if(!e.initialized&&!V.length)return;const j=Tl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Al(e.connectionLookup,o.value,j),e.edges=j},M=v=>{const V=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!V.length||(L(V.filter(un)),ee(V.filter(Yt)))},oe=v=>{let V=v instanceof Function?v(e.nodes):v;V=Array.isArray(V)?V:[V];const j=Dd(V,d,e.hooks.error.trigger),D=[];for(const K of j)D.push(Nd(K));D.length&&e.hooks.nodesChange.trigger(D)},_=v=>{let V=v instanceof Function?v(e.edges):v;V=Array.isArray(V)?V:[V];const j=Tl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),D=[];for(const K of j)D.push(Nd(K));D.length&&e.hooks.edgesChange.trigger(D)},Y=(v,V=!0,j=!1)=>{const D=v instanceof Function?v(e.nodes):v,K=Array.isArray(D)?D:[D],he=[],we=[];function $e(Re){const Ae=s(Re);for(const Oe of Ae)(!Xe(Oe.deletable)||Oe.deletable)&&we.push(Id(Oe.id,Oe.source,Oe.target,Oe.sourceHandle,Oe.targetHandle))}function ke(Re){const Ae=[];for(const Oe of e.nodes)Oe.parentNode===Re&&Ae.push(Oe);if(Ae.length){for(const Oe of Ae)he.push($d(Oe.id));V&&$e(Ae);for(const Oe of Ae)ke(Oe.id)}}for(const Re of K){const Ae=typeof Re=="string"?d(Re):Re;Ae&&(Xe(Ae.deletable)&&!Ae.deletable||(he.push($d(Ae.id)),V&&$e([Ae]),j&&ke(Ae.id)))}we.length&&e.hooks.edgesChange.trigger(we),he.length&&e.hooks.nodesChange.trigger(he)},T=v=>{const V=v instanceof Function?v(e.edges):v,j=Array.isArray(V)?V:[V],D=[];for(const K of j){const he=typeof K=="string"?u(K):K;he&&(Xe(he.deletable)&&!he.deletable||D.push(Id(typeof K=="string"?K:K.id,he.source,he.target,he.sourceHandle,he.targetHandle)))}e.hooks.edgesChange.trigger(D)},W=(v,V,j=!0)=>{const D=u(v.id);if(!D)return!1;const K=e.edges.indexOf(D),he=A0(v,V,D,j,e.hooks.error.trigger);if(he){const[we]=Tl([he],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(($e,ke)=>ke===K?we:$e),Al(e.connectionLookup,o.value,[we]),we}return!1},Q=(v,V,j={replace:!1})=>{const D=u(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=j.replace?K:{...D.data,...K}},te=v=>vd(v,e.nodes),C=v=>{const V=vd(v,e.edges);return Al(e.connectionLookup,o.value,V),V},Z=(v,V,j={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;j.replace?e.nodes.splice(e.nodes.indexOf(D),1,K):Object.assign(D,K)},le=(v,V,j={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=j.replace?K:{...D.data,...K}},pe=(v,V,j=!1)=>{j?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},be=(v,V=null,j=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=V,e.connectionStatus=j)},de=(v,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},me=v=>{const V=r0(v),j=V?null:$o(v)?v:d(v.id);return!V&&!j?[null,null,V]:[V?v:Li(j),j,V]},ye=(v,V=!0,j=e.nodes)=>{const[D,K,he]=me(v);if(!D)return[];const we=[];for(const $e of j||e.nodes){if(!he&&($e.id===K.id||!$e.computedPosition))continue;const ke=Li($e),Re=Pi(ke,D);(V&&Re>0||Re>=ke.width*ke.height||Re>=Number(D.width)*Number(D.height))&&we.push($e)}return we},ve=(v,V,j=!0)=>{const[D]=me(v);if(!D)return!1;const K=Pi(D,V);return j&&K>0||K>=Number(D.width)*Number(D.height)},Ce=v=>{const{viewport:V,dimensions:j,d3Zoom:D,d3Selection:K,translateExtent:he}=e;if(!D||!K||!v.x&&!v.y)return!1;const we=zn.translate(V.x+v.x,V.y+v.y).scale(V.zoom),$e=[[0,0],[j.width,j.height]],ke=D.constrain()(we,$e,he),Re=e.viewport.x!==ke.x||e.viewport.y!==ke.y||e.viewport.zoom!==ke.k;return D.transform(K,ke),Re},Se=v=>{const V=v instanceof Function?v(e):v,j=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const D=V.modelValue||V.nodes||V.edges?[]:void 0;D&&(V.modelValue&&D.push(...V.modelValue),V.nodes&&D.push(...V.nodes),V.edges&&D.push(...V.edges),M(D));const K=()=>{Xe(V.maxZoom)&&X(V.maxZoom),Xe(V.minZoom)&&w(V.minZoom),Xe(V.translateExtent)&&B(V.translateExtent)};for(const he of Object.keys(V)){const we=he,$e=V[we];![...K0,...j].includes(we)&&Xe($e)&&(e[we]=$e)}Qa(()=>e.d3Zoom).not.toBeNull().then(K),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:m,setElements:M,setNodes:L,setEdges:ee,addNodes:oe,addEdges:_,removeNodes:Y,removeEdges:T,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:Q,updateNode:Z,updateNodeData:le,applyEdgeChanges:C,applyNodeChanges:te,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:w,setMaxZoom:X,setTranslateExtent:B,setNodeExtent:H,setPaneClickDistance:A,removeSelectedElements:h,removeSelectedNodes:E,removeSelectedEdges:$,startConnection:pe,updateConnection:be,endConnection:de,setInteractive:S,setState:Se,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ve,panBy:Ce,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,V)=>i.value.zoomTo(v,V),setViewport:(v,V)=>i.value.setViewport(v,V),setTransform:(v,V)=>i.value.setTransform(v,V),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,V,j)=>i.value.setCenter(v,V,j),fitBounds:(v,V)=>i.value.fitBounds(v,V),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],V=[];for(const j of e.nodes){const{computedPosition:D,handleBounds:K,selected:he,dimensions:we,isParent:$e,resizing:ke,dragging:Re,events:Ae,...Oe}=j;v.push(Oe)}for(const j of e.edges){const{selected:D,sourceNode:K,targetNode:he,events:we,...$e}=j;V.push($e)}return JSON.parse(JSON.stringify({nodes:v,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(V=>{const{nodes:j,edges:D,position:K,zoom:he,viewport:we}=v;j&&L(j),D&&ee(D);const[$e,ke]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:K??[null,null];if($e&&ke){const Re=(we==null?void 0:we.zoom)||he||e.viewport.zoom;return Qa(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:$e,y:ke,zoom:Re}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const v=Wd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=zn.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(dn(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),j=e.viewportRef.getBoundingClientRect(),D=[[0,0],[j.width,j.height]],K=e.d3Zoom.constrain()(V,D,v.translateExtent);e.d3Zoom.transform(e.d3Selection,K)}Se(v)},$destroy:()=>{}}}const X0=["data-id","data-handleid","data-nodeid","data-handlepos"],Z0={name:"Handle",compatConfig:{MODE:3}},mn=n.defineComponent({...Z0,props:{id:{default:null},type:{},position:{default:()=>xe.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:m}=Pe(),{id:p,node:y,nodeEl:b,connectedEdges:g}=Yd(),E=n.ref(),$=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),w=n.toRef(()=>{var ee,M,oe,_,Y,T;return((ee=r.value)==null?void 0:ee.nodeId)===p&&((M=r.value)==null?void 0:M.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((_=c.value)==null?void 0:_.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((T=c.value)==null?void 0:T.type)===i.value}),X=n.toRef(()=>{var ee,M,oe;return((ee=s.value)==null?void 0:ee.nodeId)===p&&((M=s.value)==null?void 0:M.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:B,handleClick:H}=Gd({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),A=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(ee=>{const M=ee[`${i.value}Handle`];return ee[i.value]!==p?!1:M?M===e.id:!0}):typeof e.connectable=="number"?g.value.filter(ee=>{const M=ee[`${i.value}Handle`];return ee[i.value]!==p?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var ee;if(!y.dimensions.width||!y.dimensions.height)return;const M=(ee=y.handleBounds[i.value])==null?void 0:ee.find(te=>te.id===e.id);if(!d.value||M)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!E.value||!oe||!e.id)return;const _=b.value.getBoundingClientRect(),Y=E.value.getBoundingClientRect(),T=window.getComputedStyle(oe),{m22:W}=new window.DOMMatrixReadOnly(T.transform),Q={id:e.id,position:e.position,x:(Y.left-_.left)/W,y:(Y.top-_.top)/W,type:i.value,nodeId:p,...zi(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],Q]});function S(ee){const M=xl(ee);A.value&&$.value&&(M&&ee.button===0||!M)&&B(ee)}function L(ee){!p||!s.value&&!$.value||A.value&&H(ee)}return t({handleClick:H,handlePointerDown:B,onClick:L,onPointerDown:S}),(ee,M)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${n.unref(l)}-${n.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(p),"data-handlepos":ee.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${ee.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(m),i.value,{connectable:A.value,connecting:X.value,connectablestart:$.value,connectableend:h.value,connectionindicator:A.value&&($.value&&!w.value||h.value&&w.value)}]]),onMousedown:S,onTouchstartPassive:S,onClick:L},[n.renderSlot(ee.$slots,"default",{id:ee.id})],42,X0))}}),Wi=function({sourcePosition:e=xe.Bottom,targetPosition:t=xe.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(mn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(mn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Wi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Wi.inheritAttrs=!1,Wi.compatConfig={MODE:3};const J0=Wi,Ki=function({targetPosition:e=xe.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(mn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Ki.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ki.inheritAttrs=!1,Ki.compatConfig={MODE:3};const Q0=Ki,qi=function({sourcePosition:e=xe.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(mn,{type:"source",position:e,connectable:o,isValidConnection:i})]};qi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],qi.inheritAttrs=!1,qi.compatConfig={MODE:3};const e1=qi,t1=["transform"],n1=["width","height","x","y","rx","ry"],o1=["y"],i1={name:"EdgeText",compatConfig:{MODE:3}},a1=n.defineComponent({...i1,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,n1)):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,o1)],8,t1))}}),l1=["id","d","marker-end","marker-start"],r1=["d","stroke-width"],s1={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Xi=n.defineComponent({...s1,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,l1),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,r1)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(a1,{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 Kd({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 qd({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 Zi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case xe.Left:r=t-Zi(t-i,l),s=o;break;case xe.Right:r=t+Zi(i-t,l),s=o;break;case xe.Top:r=t,s=o-Zi(o-a,l);break;case xe.Bottom:r=t,s=o+Zi(a-o,l);break}return[r,s]}function Zd(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top,curvature:s=.25}=e,[c,d]=Xd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Xd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[m,p,y,b]=qd({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}`,m,p,y,b]}function Jd({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case xe.Left:case xe.Right:l=.5*(t+i),r=o;break;case xe.Top:case xe.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function Qd(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top}=e,[s,c]=Jd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Jd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,m,p,y]=qd({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,m,p,y]}const eu={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}};function c1({source:e,sourcePosition:t=xe.Bottom,target:o}){return t===xe.Left||t===xe.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 tu(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function d1({source:e,sourcePosition:t=xe.Bottom,target:o,targetPosition:i=xe.Top,center:a,offset:l}){const r=eu[t],s=eu[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=c1({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",m=u[f];let p,y,b;const g={x:0,y:0},E={x:0,y:0},[$,h,w,X]=Kd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){y=a.x??$,b=a.y??h;const H=[{x:y,y:c.y},{x:y,y:d.y}],A=[{x:c.x,y:b},{x:d.x,y:b}];r[f]===m?p=f==="x"?H:A:p=f==="x"?A:H}else{const H=[{x:c.x,y:d.y}],A=[{x:d.x,y:c.y}];if(f==="x"?p=r.x===m?A:H:p=r.y===m?H:A,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const _=Math.min(l-1,l-oe);r[f]===m?g[f]=(c[f]>e[f]?-1:1)*_:E[f]=(d[f]>o[f]?-1:1)*_}}if(t!==i){const oe=f==="x"?"y":"x",_=r[f]===s[oe],Y=c[oe]>d[oe],T=c[oe]<d[oe];(r[f]===1&&(!_&&Y||_&&T)||r[f]!==1&&(!_&&T||_&&Y))&&(p=f==="x"?H:A)}const S={x:c.x+g.x,y:c.y+g.y},L={x:d.x+E.x,y:d.y+E.y},ee=Math.max(Math.abs(S.x-p[0].x),Math.abs(L.x-p[0].x)),M=Math.max(Math.abs(S.y-p[0].y),Math.abs(L.y-p[0].y));ee>=M?(y=(S.x+L.x)/2,b=p[0].y):(y=p[0].x,b=(S.y+L.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:d.x+E.x,y:d.y+E.y},o],y,b,w,X]}function u1(e,t,o,i){const a=Math.min(tu(e,t)/2,tu(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 Bl(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,m,p,y,b]=d1({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((E,$,h)=>{let w;return h>0&&h<f.length-1?w=u1(f[h-1],$,f[h+1],s):w=`${h===0?"M":"L"}${$.x} ${$.y}`,E+=w,E},""),m,p,y,b]}function f1(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Kd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const m1=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]=f1(e);return n.h(Xi,{path:o,labelX:i,labelY:a,...t,...e})}}}),nu=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]=Bl({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Xi,{path:o,labelX:i,labelY:a,...t,...e})}}}),p1=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(nu,{...e,...t,borderRadius:0})}}),h1=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]=Zd({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Xi,{path:o,labelX:i,labelY:a,...t,...e})}}}),y1=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]=Qd({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Xi,{path:o,labelX:i,labelY:a,...t,...e})}}}),g1={input:e1,default:J0,output:Q0},b1={default:h1,straight:m1,step:p1,smoothstep:nu,simplebezier:y1};function _1(e,t,o){const i=n.computed(()=>b=>t.value.get(b)),a=n.computed(()=>b=>o.value.get(b)),l=n.computed(()=>{const b={...b1,...e.edgeTypes},g=Object.keys(b);for(const E of e.edges)E.type&&!g.includes(E.type)&&(b[E.type]=E.type);return b}),r=n.computed(()=>{const b={...g1,...e.nodeTypes},g=Object.keys(b);for(const E of e.nodes)E.type&&!g.includes(E.type)&&(b[E.type]=E.type);return b}),s=n.computed(()=>e.onlyRenderVisibleElements?bd(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 b=[];for(const g of e.edges){const E=t.value.get(g.source),$=t.value.get(g.target);E0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:$.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:$.dimensions.width,targetHeight:$.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),f=n.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),m=n.computed(()=>[...u.value,...f.value]),p=n.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),y=n.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:m,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:y}}class pn{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)??pn.instance;return pn.instance=i??new pn,o&&(o.config.globalProperties.$vueFlowStorage=pn.instance),pn.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=Wd(),a=n.reactive(i),l={};for(const[m,p]of Object.entries(a.hooks)){const y=`on${m.charAt(0).toUpperCase()+m.slice(1)}`;l[y]=p.on}const r={};for(const[m,p]of Object.entries(a.hooks))r[m]=p.trigger;const s=n.computed(()=>{const m=new Map;for(const p of a.nodes)m.set(p.id,p);return m}),c=n.computed(()=>{const m=new Map;for(const p of a.edges)m.set(p.id,p);return m}),d=_1(a,s,c),u=q0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...yh(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 Pe(e){const t=pn.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(zd,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,m,p)=>{const y=g=>{d.applyNodeChanges(g)},b=g=>{d.applyEdgeChanges(g)};f?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),uo(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Ro(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(zd,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Qe(qe.USEVUEFLOW_OPTIONS))}return s}function E1(e){const{emits:t,dimensions:o}=Pe();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=zi(e.value);(s.width===0||s.height===0)&&t.error(new Qe(qe.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 k1={name:"UserSelection",compatConfig:{MODE:3}},w1=n.defineComponent({...k1,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))}}),v1=["tabIndex"],N1={name:"NodesSelection",compatConfig:{MODE:3}},$1=n.defineComponent({...N1,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Pe(),s=jd(),c=n.ref(null),d=Hd({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;l.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>vl(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 m(y){t.selectionContextMenu({event:y,nodes:i.value})}function p(y){l.value||Un[y.key]&&(y.preventDefault(),s({x:Un[y.key].x,y:Un[y.key].y},y.shiftKey))}return(y,b)=>!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:m,onKeydown:p},null,46,v1)],6)):n.createCommentVNode("",!0)}});function I1(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const S1={name:"Pane",compatConfig:{MODE:3}},x1=n.defineComponent({...S1,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:m,removeEdges:p,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:g,multiSelectionActive:E,edgeLookup:$,nodeLookup:h,connectionLookup:w,defaultEdgeOptions:X,connectionStartHandle:B,panOnDrag:H}=Pe(),A=n.shallowRef(null),S=n.shallowRef(new Set),L=n.shallowRef(new Set),ee=n.shallowRef(null),M=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>B.value!==null);let _=!1,Y=!1;const T=No(b,{actInsideInputWithModifier:!1}),W=No(g);n.watch(T,de=>{de&&(m(f.value),p(u.value),d.value=!1)}),n.watch(W,de=>{E.value=de});function Q(de,me){return ye=>{ye.target===me&&(de==null||de(ye))}}function te(de){if(_||oe.value){_=!1;return}a.paneClick(de),r(),d.value=!1}function C(de){var me;if(Array.isArray(H.value)&&((me=H.value)!=null&&me.includes(2))){de.preventDefault();return}a.paneContextMenu(de)}function Z(de){a.paneScroll(de)}function le(de){var me,ye,ve;if(ee.value=((me=t.value)==null?void 0:me.getBoundingClientRect())??null,!c.value||!e.isSelecting||de.button!==0||de.target!==A.value||!ee.value)return;(ve=(ye=de.target)==null?void 0:ye.setPointerCapture)==null||ve.call(ye,de.pointerId);const{x:Ce,y:Se}=I1(de,ee.value);Y=!0,_=!1,r(),s.value={width:0,height:0,startX:Ce,startY:Se,x:Ce,y:Se},a.selectionStart(de)}function pe(de){var me;if(!ee.value||!s.value)return;_=!0;const{x:ye,y:ve}=St(de,ee.value),{startX:Ce=0,startY:Se=0}=s.value,ge={startX:Ce,startY:Se,x:ye<Ce?ye:Ce,y:ve<Se?ve:Se,width:Math.abs(ye-Ce),height:Math.abs(ve-Se)},J=S.value,q=L.value;S.value=new Set(bd(o.value,ge,i.value,y.value===El.Partial,!0).map(V=>V.id)),L.value=new Set;const v=((me=X.value)==null?void 0:me.selectable)??!0;for(const V of S.value){const j=w.value.get(V);if(j)for(const{edgeId:D}of j.values()){const K=$.value.get(D);K&&(K.selectable??v)&&L.value.add(D)}}if(!Pd(J,S.value)){const V=Wt(h.value,S.value,!0);a.nodesChange(V)}if(!Pd(q,L.value)){const V=Wt($.value,L.value);a.edgesChange(V)}s.value=ge,l.value=!0,d.value=!1}function be(de){var me;de.button!==0||!Y||((me=de.target)==null||me.releasePointerCapture(de.pointerId),!l.value&&s.value&&de.target===A.value&&te(de),l.value=!1,s.value=null,d.value=S.value.size>0,a.selectionEnd(de),e.selectionKeyPressed&&(_=!1),Y=!1)}return(de,me)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:A,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:de.isSelecting}]),onClick:me[0]||(me[0]=ye=>M.value?void 0:Q(te,A.value)(ye)),onContextmenu:me[1]||(me[1]=ye=>Q(C,A.value)(ye)),onWheelPassive:me[2]||(me[2]=ye=>Q(Z,A.value)(ye)),onPointerenter:me[3]||(me[3]=ye=>M.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:me[4]||(me[4]=ye=>M.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:me[5]||(me[5]=ye=>M.value?pe(ye):n.unref(a).paneMouseMove(ye)),onPointerup:me[6]||(me[6]=ye=>M.value?be(ye):void 0),onPointerleave:me[7]||(me[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(de.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(w1,{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($1,{key:1})):n.createCommentVNode("",!0)],34))}}),C1={name:"Transform",compatConfig:{MODE:3}},R1=n.defineComponent({...C1,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Pe(),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))}}),V1={name:"Viewport",compatConfig:{MODE:3}},A1=n.defineComponent({...V1,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:m,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:b,noWheelClassName:g,noPanClassName:E,emits:$,connectionStartHandle:h,userSelectionActive:w,paneDragging:X,d3Zoom:B,d3Selection:H,d3ZoomHandler:A,viewport:S,viewportRef:L,paneClickDistance:ee}=Pe();E1(L);const M=n.shallowRef(!1),oe=n.shallowRef(!1);let _=null,Y=!1,T=0,W={x:0,y:0,zoom:0};const Q=No(s),te=No(r),C=No(l),Z=n.toRef(()=>(!te.value||te.value&&r.value===!0)&&(Q.value||f.value)),le=n.toRef(()=>Q.value||c.value),pe=n.toRef(()=>r.value===!0&&Z.value!==!0),be=n.toRef(()=>te.value&&r.value!==!0||w.value||pe.value),de=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!L.value){Ro("Viewport element is missing");return}const Se=L.value,ge=Se.getBoundingClientRect(),J=e0().clickDistance(ee.value).scaleExtent([t.value,o.value]).translateExtent(a.value),q=ht(Se).call(J),v=q.on("wheel.zoom"),V=zn.translate(i.value.x??0,i.value.y??0).scale(dn(i.value.zoom??1,t.value,o.value)),j=[[0,0],[ge.width,ge.height]],D=J.constrain()(V,j,a.value);J.transform(q,D),J.wheelDelta(Nl),B.value=J,H.value=q,A.value=v,S.value={x:D.x,y:D.y,zoom:D.k},J.on("start",K=>{var he;if(!K.sourceEvent)return null;T=K.sourceEvent.button,M.value=!0;const we=ve(K.transform);((he=K.sourceEvent)==null?void 0:he.type)==="mousedown"&&(X.value=!0),W=we,$.viewportChangeStart(we),$.moveStart({event:K,flowTransform:we})}),J.on("end",K=>{if(!K.sourceEvent)return null;if(M.value=!1,X.value=!1,me(Z.value,T??0)&&!Y&&$.paneContextMenu(K.sourceEvent),Y=!1,ye(W,K.transform)){const he=ve(K.transform);W=he,$.viewportChangeEnd(he),$.moveEnd({event:K,flowTransform:he})}}),J.filter(K=>{var he;const we=C.value||y.value,$e=p.value&&K.ctrlKey,ke=K.button,Re=K.type==="wheel";if(ke===1&&K.type==="mousedown"&&(Ce(K,"vue-flow__node")||Ce(K,"vue-flow__edge")))return!0;if(!Z.value&&!we&&!le.value&&!m.value&&!p.value||w.value||de.value&&!Re||!m.value&&K.type==="dblclick"||Ce(K,g.value)&&Re||Ce(K,E.value)&&(!Re||le.value&&Re&&!C.value)||!p.value&&K.ctrlKey&&Re||!we&&!le.value&&!$e&&Re)return!1;if(!p&&K.type==="touchstart"&&((he=K.touches)==null?void 0:he.length)>1)return K.preventDefault(),!1;if(!Z.value&&(K.type==="mousedown"||K.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&ke===0||Array.isArray(f.value)&&!f.value.includes(ke)&&(K.type==="mousedown"||K.type==="touchstart"))return!1;const Ae=Array.isArray(f.value)&&f.value.includes(ke)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!ke||ke<=1;return(!K.ctrlKey||Q.value||Re)&&Ae}),n.watch([w,Z],()=>{w.value&&!M.value?J.on("zoom",null):w.value||J.on("zoom",K=>{S.value={x:K.transform.x,y:K.transform.y,zoom:K.transform.k};const he=ve(K.transform);Y=me(Z.value,T??0),$.viewportChange(he),$.move({event:K,flowTransform:he})})},{immediate:!0}),n.watch([w,le,d,C,p,b,g],()=>{le.value&&!C.value&&!w.value?q.on("wheel.zoom",K=>{if(Ce(K,g.value))return!1;const he=C.value||y.value,we=p.value&&K.ctrlKey;if(!(!b.value||le.value||he||we))return!1;K.preventDefault(),K.stopImmediatePropagation();const ke=q.property("__zoom").k||1,Re=Co();if(!Q.value&&K.ctrlKey&&p.value&&Re){const O=vt(K),re=Nl(K),ue=ke*2**re;J.scaleTo(q,ue,O,K);return}const Ae=K.deltaMode===1?20:1;let Oe=d.value===vo.Vertical?0:K.deltaX*Ae,We=d.value===vo.Horizontal?0:K.deltaY*Ae;!Re&&K.shiftKey&&d.value!==vo.Vertical&&!Oe&&We&&(Oe=We,We=0),J.translateBy(q,-(Oe/ke)*u.value,-(We/ke)*u.value);const I=ve(q.property("__zoom"));_&&clearTimeout(_),oe.value?($.move({event:K,flowTransform:I}),$.viewportChange(I),_=setTimeout(()=>{$.moveEnd({event:K,flowTransform:I}),$.viewportChangeEnd(I),oe.value=!1},150)):(oe.value=!0,$.moveStart({event:K,flowTransform:I}),$.viewportChangeStart(I))},{passive:!1}):typeof v<"u"&&q.on("wheel.zoom",function(K,he){const we=!b.value&&K.type==="wheel"&&!K.ctrlKey,$e=C.value||y.value,ke=p.value&&K.ctrlKey;if(!$e&&!c.value&&!ke&&K.type==="wheel"||we||Ce(K,g.value))return null;K.preventDefault(),v.call(this,K,he)},{passive:!1})},{immediate:!0})});function me(Se,ge){return ge===2&&Array.isArray(Se)&&Se.includes(2)}function ye(Se,ge){return Se.x!==ge.x&&!Number.isNaN(ge.x)||Se.y!==ge.y&&!Number.isNaN(ge.y)||Se.zoom!==ge.k&&!Number.isNaN(ge.k)}function ve(Se){return{x:Se.x,y:Se.y,zoom:Se.k}}function Ce(Se,ge){return Se.target.closest(`.${ge}`)}return(Se,ge)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:L,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(x1,{"is-selecting":be.value,"selection-key-pressed":n.unref(te),class:n.normalizeClass({connecting:de.value,dragging:n.unref(X),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(R1,null,{default:n.withCtx(()=>[n.renderSlot(Se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),T1=["id"],M1=["id"],B1=["id"],O1={name:"A11yDescriptions",compatConfig:{MODE:3}},D1=n.defineComponent({...O1,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(sd)}-${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,T1),n.createElementVNode("div",{id:`${n.unref(cd)}-${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,M1),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(l0)}-${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,B1))],64))}});function L1(){const e=Pe();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function P1(e,t,o){return o===xe.Left?e-t:o===xe.Right?e+t:e}function z1(e,t,o){return o===xe.Top?e-t:o===xe.Bottom?e+t:e}const Ol=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=xe.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:P1(t,e,i),cy:z1(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Ol.props=["radius","centerX","centerY","position","type"],Ol.compatConfig={MODE:3};const ou=Ol,U1=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:m,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:g,edgesFocusable:E,hooks:$}=Pe(),h=n.computed(()=>u(e.id)),{emit:w,on:X}=O0(h.value,l),B=n.inject(Gi),H=n.getCurrentInstance(),A=n.ref(!1),S=n.ref(!1),L=n.ref(""),ee=n.ref(null),M=n.ref("source"),oe=n.ref(null),_=n.toRef(()=>typeof h.value.selectable>"u"?b.value:h.value.selectable),Y=n.toRef(()=>typeof h.value.updatable>"u"?g.value:h.value.updatable),T=n.toRef(()=>typeof h.value.focusable>"u"?E.value:h.value.focusable);n.provide(T0,e.id),n.provide(M0,oe);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),Q=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),te=n.computed(()=>{const V=h.value.type||"default",j=B==null?void 0:B[`edge-${V}`];if(j)return j;let D=h.value.template??c.value[V];if(typeof D=="string"&&H){const K=Object.keys(H.appContext.components);K&&K.includes(V)&&(D=n.resolveComponent(V,!1))}return D&&typeof D!="string"?D:(l.error(new Qe(qe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:C}=Gd({nodeId:L,handleId:ee,type:M,isValidConnection:m,edgeUpdaterType:M,onEdgeUpdate:pe,onEdgeUpdateEnd:be});return()=>{const V=f(h.value.source),j=f(h.value.target),D="pathOptions"in h.value?h.value.pathOptions:{};if(!V&&!j)return l.error(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!V)return l.error(new Qe(qe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!j)return l.error(new Qe(qe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||V.hidden||j.hidden)return null;let K;i.value===Dt.Strict?K=V.handleBounds.source:K=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const he=Rd(K,h.value.sourceHandle);let we;i.value===Dt.Strict?we=j.handleBounds.target:we=[...j.handleBounds.target||[],...j.handleBounds.source||[]];const $e=Rd(we,h.value.targetHandle),ke=(he==null?void 0:he.position)||xe.Bottom,Re=($e==null?void 0:$e.position)||xe.Top,{x:Ae,y:Oe}=Hn(V,he,ke),{x:We,y:I}=Hn(j,$e,Re);return h.value.sourceX=Ae,h.value.sourceY=Oe,h.value.targetX=We,h.value.targetY=I,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${te.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:A.value,selected:h.value.selected,animated:h.value.animated,inactive:!_.value&&!$.value.edgeClick.hasListeners()}],tabIndex:T.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":T.value?`${cd}-${t}`:void 0,"aria-roledescription":"edge",role:T.value?"group":"img",...h.value.domAttributes,onClick:me,onContextmenu:ye,onDblclick:ve,onMouseenter:Ce,onMousemove:Se,onMouseleave:ge,onKeyDown:T.value?v:void 0},[S.value?null:n.h(te.value===!1?c.value.default:te.value,{id:e.id,sourceNode:V,targetNode:j,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...X},style:Q.value,markerStart:`url('#${xo(h.value.markerStart,t)}')`,markerEnd:`url('#${xo(h.value.markerEnd,t)}')`,sourcePosition:ke,targetPosition:Re,sourceX:Ae,sourceY:Oe,targetX:We,targetY:I,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...D}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:J,onMouseenter:Z,onMouseout:le},n.h(ou,{position:ke,centerX:Ae,centerY:Oe,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:q,onMouseenter:Z,onMouseout:le},n.h(ou,{position:Re,centerX:We,centerY:I,radius:a.value,type:"target","data-type":"target"}))]:null]])};function Z(){A.value=!0}function le(){A.value=!1}function pe(V,j){w.update({event:V,edge:h.value,connection:j})}function be(V){w.updateEnd({event:V,edge:h.value}),S.value=!1}function de(V,j){V.button===0&&(S.value=!0,L.value=j?h.value.target:h.value.source,ee.value=(j?h.value.targetHandle:h.value.sourceHandle)??null,M.value=j?"target":"source",w.updateStart({event:V,edge:h.value}),C(V))}function me(V){var j;const D={event:V,edge:h.value};_.value&&(r.value=!1,h.value.selected&&p.value?(d([h.value]),(j=oe.value)==null||j.blur()):o([h.value])),w.click(D)}function ye(V){w.contextMenu({event:V,edge:h.value})}function ve(V){w.doubleClick({event:V,edge:h.value})}function Ce(V){w.mouseEnter({event:V,edge:h.value})}function Se(V){w.mouseMove({event:V,edge:h.value})}function ge(V){w.mouseLeave({event:V,edge:h.value})}function J(V){de(V,!0)}function q(V){de(V,!1)}function v(V){var j;!y.value&&dd.includes(V.key)&&_.value&&(V.key==="Escape"?((j=oe.value)==null||j.blur(),d([u(e.id)])):o([u(e.id)]))}}}),F1=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}=Pe(),m=(e=n.inject(Gi))==null?void 0:e["connection-line"],p=n.computed(()=>{var $;return f(($=i.value)==null?void 0:$.nodeId)}),y=n.computed(()=>{var $;return f(($=a.value)==null?void 0:$.nodeId)??null}),b=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),g=n.computed(()=>c.value.markerStart?`url(#${xo(c.value.markerStart,t)})`:""),E=n.computed(()=>c.value.markerEnd?`url(#${xo(c.value.markerEnd,t)})`:"");return()=>{var $,h,w;if(!p.value||!i.value)return null;const X=i.value.id,B=i.value.type,H=p.value.handleBounds;let A=(H==null?void 0:H[B])??[];if(o.value===Dt.Loose){const Q=(H==null?void 0:H[B==="source"?"target":"source"])??[];A=[...A,...Q]}if(!A)return null;const S=(X?A.find(Q=>Q.id===X):A[0])??null,L=(S==null?void 0:S.position)??xe.Top,{x:ee,y:M}=Hn(p.value,S,L);let oe=null;y.value&&(o.value===Dt.Strict?oe=(($=y.value.handleBounds[B==="source"?"target":"source"])==null?void 0:$.find(Q=>{var te;return Q.id===((te=a.value)==null?void 0:te.id)}))||null:oe=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(Q=>{var te;return Q.id===((te=a.value)==null?void 0:te.id)}))||null);const _=((w=a.value)==null?void 0:w.position)??(L?Rl[L]:null);if(!L||!_)return null;const Y=r.value??c.value.type??cn.Bezier;let T="";const W={sourceX:ee,sourceY:M,sourcePosition:L,targetX:b.value.x,targetY:b.value.y,targetPosition:_};return Y===cn.Bezier?[T]=Zd(W):Y===cn.Step?[T]=Bl({...W,borderRadius:0}):Y===cn.SmoothStep?[T]=Bl(W):Y===cn.SimpleBezier?[T]=Qd(W):T=`M${ee},${M} ${b.value.x},${b.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},m?n.h(m,{sourceX:ee,sourceY:M,sourcePosition:L,targetX:b.value.x,targetY:b.value.y,targetPosition:_,sourceNode:p.value,sourceHandle:S,targetNode:y.value,targetHandle:oe,markerEnd:E.value,markerStart:g.value,connectionStatus:d.value}):n.h("path",{d:T,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":E.value,"marker-start":g.value})))}}}),H1=["id","markerWidth","markerHeight","markerUnits","orient"],G1={name:"MarkerType",compatConfig:{MODE:3}},Y1=n.defineComponent({...G1,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(kl).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(kl).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,H1))}}),j1={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},W1={name:"MarkerDefinitions",compatConfig:{MODE:3}},K1=n.defineComponent({...W1,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Pe(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=xo(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",j1,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(Y1,{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))])]))}}),q1={name:"Edges",compatConfig:{MODE:3}},X1=n.defineComponent({...q1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(K1),(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(k0)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(U1),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(F1))],64))}}),Z1=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:m,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:g,snapGrid:E,nodeDragThreshold:$,nodesDraggable:h,elementsSelectable:w,nodesConnectable:X,nodesFocusable:B,hooks:H}=Pe(),A=n.ref(null);n.provide(Fd,A),n.provide(Ud,e.id);const S=n.inject(Gi),L=n.getCurrentInstance(),ee=jd(),{node:M,parentNode:oe}=Yd(e.id),{emit:_,on:Y}=z0(M,r),T=n.toRef(()=>typeof M.draggable>"u"?h.value:M.draggable),W=n.toRef(()=>typeof M.selectable>"u"?w.value:M.selectable),Q=n.toRef(()=>typeof M.connectable>"u"?X.value:M.connectable),te=n.toRef(()=>typeof M.focusable>"u"?B.value:M.focusable),C=n.computed(()=>W.value||T.value||H.value.nodeClick.hasListeners()||H.value.nodeDoubleClick.hasListeners()||H.value.nodeMouseEnter.hasListeners()||H.value.nodeMouseMove.hasListeners()||H.value.nodeMouseLeave.hasListeners()),Z=n.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),le=n.computed(()=>{const j=M.type||"default",D=S==null?void 0:S[`node-${j}`];if(D)return D;let K=M.template||f.value[j];if(typeof K=="string"&&L){const he=Object.keys(L.appContext.components);he&&he.includes(j)&&(K=n.resolveComponent(j,!1))}return K&&typeof K!="string"?K:(r.error(new Qe(qe.NODE_TYPE_MISSING,K)),!1)}),pe=Hd({id:e.id,el:A,disabled:()=>!T.value,selectable:W,dragHandle:()=>M.dragHandle,onStart(j){_.dragStart(j)},onDrag(j){_.drag(j)},onStop(j){_.dragStop(j)},onClick(j){v(j)}}),be=n.computed(()=>M.class instanceof Function?M.class(M):M.class),de=n.computed(()=>{const j=(M.style instanceof Function?M.style(M):M.style)||{},D=M.width instanceof Function?M.width(M):M.width,K=M.height instanceof Function?M.height(M):M.height;return!j.width&&D&&(j.width=typeof D=="string"?D:`${D}px`),!j.height&&K&&(j.height=typeof K=="string"?K:`${K}px`),j}),me=n.toRef(()=>Number(M.zIndex??de.value.zIndex??0));return u(j=>{(j.includes(e.id)||!j.length)&&ve()}),n.onMounted(()=>{n.watch(()=>M.hidden,(j=!1,D,K)=>{!j&&A.value&&(e.resizeObserver.observe(A.value),K(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),n.watch([()=>M.position.x,()=>M.position.y,()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.x},()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.y},()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.z},me,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var j;return(j=oe.value)==null?void 0:j.dimensions.height},()=>{var j;return(j=oe.value)==null?void 0:j.dimensions.width}],([j,D,K,he,we,$e])=>{const ke={x:j,y:D,z:$e+(p.value&&M.selected?1e3:0)};typeof K<"u"&&typeof he<"u"?M.computedPosition=h0({x:K,y:he,z:we},ke):M.computedPosition=ke},{flush:"post",immediate:!0}),n.watch([()=>M.extent,m],([j,D],[K,he])=>{(j!==K||D!==he)&&ye()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?Qa(()=>Z).toBe(!0).then(ye):ye(),()=>M.hidden?null:n.h("div",{ref:A,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":M.type||"default"}`,{[o.value]:T.value,dragging:pe==null?void 0:pe.value,draggable:T.value,selected:M.selected,selectable:W.value,parent:M.isParent},be.value],style:{visibility:Z.value?"visible":"hidden",zIndex:M.computedPosition.z??me.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:C.value?"all":"none",...de.value},tabIndex:te.value?0:void 0,role:te.value?"group":void 0,"aria-describedby":y.value?void 0:`${sd}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:Ce,onMousemove:Se,onMouseleave:ge,onContextmenu:J,onClick:v,onDblclick:q,onKeydown:V},[n.h(le.value===!1?f.value.default:le.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...Y},selected:M.selected,resizing:M.resizing,dragging:pe.value,connectable:Q.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??me.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:ve})]);function ye(){const j=M.computedPosition,{computedPosition:D,position:K}=Sl(M,g.value?Hi(j,E.value):j,r.error,m.value,oe.value);(M.computedPosition.x!==D.x||M.computedPosition.y!==D.y)&&(M.computedPosition={...M.computedPosition,...D}),(M.position.x!==K.x||M.position.y!==K.y)&&(M.position=K)}function ve(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function Ce(j){pe!=null&&pe.value||_.mouseEnter({event:j,node:M})}function Se(j){pe!=null&&pe.value||_.mouseMove({event:j,node:M})}function ge(j){pe!=null&&pe.value||_.mouseLeave({event:j,node:M})}function J(j){return _.contextMenu({event:j,node:M})}function q(j){return _.doubleClick({event:j,node:M})}function v(j){W.value&&(!i.value||!T.value||$.value>0)&&Vl(M,l.value,c,s,a,!1,A.value),_.click({event:j,node:M})}function V(j){if(!(wl(j)||y.value))if(dd.includes(j.key)&&W.value){const D=j.key==="Escape";Vl(M,l.value,c,s,a,D,A.value)}else T.value&&M.selected&&Un[j.key]&&(j.preventDefault(),b.value=`Moved selected node ${j.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,ee({x:Un[j.key].x,y:Un[j.key].y},j.shiftKey))}}});function J1(e={includeHiddenNodes:!1}){const{nodes:t}=Pe();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 Q1={class:"vue-flow__nodes vue-flow__container"},e_={name:"Nodes",compatConfig:{MODE:3}},t_=n.defineComponent({...e_,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Pe(),a=J1(),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",Q1,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const m=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,m))return f;const p=(n.openBlock(),n.createBlock(n.unref(Z1),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return p.memo=m,p},s,0),128)):n.createCommentVNode("",!0)]))}});function n_(){const{emits:e}=Pe();n.onMounted(()=>{if(Bd()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Qe(qe.MISSING_STYLES))}})}const o_=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),i_={name:"VueFlow",compatConfig:{MODE:3}},a_=n.defineComponent({...i_,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=el(i,"modelValue",o),r=el(i,"nodes",o),s=el(i,"edges",o),c=Pe(i),d=G0({modelValue:l,nodes:r,edges:s},i,c);return j0(o,c.hooks),L1(),n_(),n.provide(Gi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(A1,null,{default:n.withCtx(()=>[n.createVNode(X1),o_,n.createVNode(t_),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(D1)],512))}}),l_={name:"Panel",compatConfig:{MODE:3}},iu=n.defineComponent({...l_,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Pe(),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))}}),hn=["red","amber","green","teal","blue","indigo","violet","pink"],au={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function r_(e){return typeof e=="string"&&e in au}const s_={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},c_=.15;function d_(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 u_(e){if(typeof e!="string")return null;const t=d_(e);if(!t||t.s<c_)return null;let o=null,i=1/0;for(const a of hn){const l=Math.abs(t.h-s_[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function at(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(r_(t))return t;const o=e==null?void 0:e.properties;return u_((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Dl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const f_={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)"},m_={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 lu(e,t=!1){return e?t?m_[e]:f_[e]:null}function Gn(e){return au[e]}function Yn(e){return`var(--em-swatch-${e}-bar)`}const p_=["width","height","innerHTML"],h_=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"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(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,p_))}}),ze=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=ze(h_,[["__scopeId","data-v-92c1dba8"]]),y_={class:"em-inline-issue__msgs"},yn=ze(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(Ve,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",y_,[(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"]]),g_={class:"em-mlang"},b_={class:"em-mlang__tabs",role:"tablist"},__=["aria-selected","onClick"],E_={key:0,class:"em-mlang__dot"},Ll=ze(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",g_,[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:m=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",E_,"•")):n.createCommentVNode("",!0)],10,__))),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"]]),k_=["disabled"],w_={class:"em-panel__sub-label"},v_={class:"em-field"},N_={class:"em-field"},$_={class:"em-field"},I_={class:"em-class"},S_={class:"em-field"},x_={class:"em-field"},C_={class:"em-field"},R_={class:"em-field"},V_={class:"em-multilang"},A_={class:"em-multilang"},T_={class:"em-jpa"},M_={class:"em-field"},B_={class:"em-field"},O_={class:"em-field"},D_={class:"em-swatch"},L_={class:"em-swatch__row"},P_=["title","onClick"],ru=ze(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,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(M=>M.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(M=>M.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var M;return at(((M=r.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=M=>M;function m(M){return M==="inherit"?"기본(따름)":M}function p(M){l.value&&a.updateEntity(l.value.modelId,M)}function y(M,oe,_){var T;const Y=((T=l.value)==null?void 0:T.table)??{physicalName:""};p(M==="physicalName"?{table:{...Y,physicalName:_}}:{table:{...Y,logicalName:{...Y.logicalName,[oe]:_}}})}function b(M){p({description:Object.keys(M).length?M:void 0})}function g(M,oe){var _;p({jpaAttrs:{...(_=l.value)==null?void 0:_.jpaAttrs,[M]:oe}})}function E(M,oe){g(M,oe)}const $=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),h=n.computed(()=>{var M,oe;return!((oe=(M=l.value)==null?void 0:M.jpaAttrs)!=null&&oe.useDiscriminator)});function w(M){g("discriminatorType",M==="inherit"?void 0:M)}function X(M){p({hasPersonalInfo:M})}function B(M){p({superClass:M.trim()||void 0})}function H(M){p({schema:M.trim()||void 0})}function A(M){p({abstractClass:M})}const S=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function L(M){const oe=M.split(",").map(_=>_.trim()).filter(Boolean);p({declarationOfInterfaces:oe.length?oe:void 0})}function ee(M){l.value&&a.setEntitySwatch(l.value.modelId,M)}return(M,oe)=>{var _,Y,T;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:oe[0]||(oe[0]=W=>i("toggle"))},[n.createElementVNode("span",w_,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||l.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(yn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",v_,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=W=>p({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",N_,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",$_,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=W=>p({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",I_,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",S_,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=W=>B(W))},null,8,["model-value"])]),n.createElementVNode("label",x_,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":S.value,"onUpdate:modelValue":oe[5]||(oe[5]=W=>L(W))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=W=>A(W))},null,8,["model-value"])]),n.createElementVNode("label",C_,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((_=l.value.table)==null?void 0:_.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",R_,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=W=>H(W))},null,8,["model-value"])]),n.createElementVNode("fieldset",V_,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var Q,te;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":((te=(Q=l.value.table)==null?void 0:Q.logicalName)==null?void 0:te[W])??"","onUpdate:modelValue":C=>y("logicalName",W,C)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",A_,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Ll,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",T_,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var Q;return n.createVNode(n.unref(ae.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((Q=l.value.jpaAttrs)!=null&&Q[W.key]),"onUpdate:modelValue":te=>E(W.key,te)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",M_,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:h.value,"model-value":((Y=l.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=W=>g("discriminatorColumnName",W.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",B_,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:h.value,"model-value":$.value,items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":oe[10]||(oe[10]=W=>W&&w(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",O_,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(T=l.value.jpaAttrs)==null?void 0:T.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=W=>g("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":!!l.value.hasPersonalInfo,"onUpdate:modelValue":X},null,8,["model-value"]),n.createElementVNode("fieldset",D_,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",L_,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:oe[12]||(oe[12]=W=>ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(Yn)(W)}),title:n.unref(Gn)(W),onClick:Q=>ee(W)},null,14,P_))),128))])])],64)):n.createCommentVNode("",!0)],8,k_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),su=["ko","en","ja","zh"];function z_(e){if(e)for(const t of su){const o=e[t];if(o)return o}}function Pl(e){const t=z_(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function U_(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:su.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const F_=["aria-expanded"],H_=["aria-selected","onClick","onMouseenter"],G_={key:0,class:"gcc__opt gcc__opt--empty"},cu=ze(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(A=>A.groupCode===o.modelValue)),m=n.computed(()=>f.value?Pl(f.value):"");n.watch(m,A=>{c.value||(s.value=A)},{immediate:!0});const p=n.computed(()=>s.value===m.value?o.items:U_(o.items,s.value));function y(){var S;const A=(S=a.value)==null?void 0:S.getBoundingClientRect();A&&(u.value={left:`${A.left}px`,top:`${A.bottom}px`,width:`${A.width}px`})}function b(){c.value=!0,y(),d.value=Math.max(0,p.value.findIndex(A=>A.groupCode===o.modelValue)),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),document.addEventListener("mousedown",H)}function g(){c.value=!1,window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),document.removeEventListener("mousedown",H)}n.onBeforeUnmount(g);function E(){b(),n.nextTick(()=>{var A;return(A=l.value)==null?void 0:A.select()})}function $(){c.value||b(),d.value=0}function h(A){i("update:modelValue",A.groupCode),s.value=Pl(A),g()}function w(){i("update:modelValue",void 0),s.value="",g()}function X(){s.value.trim()===""?w():(s.value=m.value,g())}function B(A){var S;if(A.key==="ArrowDown")c.value||b(),d.value=Math.min(d.value+1,p.value.length-1),A.preventDefault();else if(A.key==="ArrowUp")d.value=Math.max(d.value-1,0),A.preventDefault();else if(A.key==="Enter"){const L=p.value[d.value];L&&h(L),A.preventDefault()}else A.key==="Escape"&&(s.value=m.value,g(),(S=l.value)==null||S.blur())}function H(A){var L,ee;const S=A.target;!((L=a.value)!=null&&L.contains(S))&&!((ee=r.value)!=null&&ee.contains(S))&&X()}return(A,S)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=L=>s.value=L),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:E,onInput:$,onKeydown:B},null,40,F_),[[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:S[1]||(S[1]=n.withModifiers(()=>{},["prevent"])),onClick:w},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,(L,ee)=>(n.openBlock(),n.createElementBlock("li",{key:L.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":ee===d.value,"is-selected":L.groupCode===e.modelValue}]),role:"option","aria-selected":L.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=n.withModifiers(()=>{},["prevent"])),onClick:M=>h(L),onMouseenter:M=>d.value=ee},n.toDisplayString(n.unref(Pl)(L)),43,H_))),128)),p.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",G_,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),Y_=["disabled"],j_={class:"em-aw__toolbar"},W_={class:"em-aw__count"},K_={class:"em-aw__scroll"},q_={class:"em-aw__table"},X_={class:"c-del"},Z_={class:"c-expand"},J_=["title","onClick","onKeydown"],Q_={class:"c-constraints"},eE={class:"em-aw__cflags"},tE=["title"],nE={colspan:"8"},oE={class:"em-aw__detail"},iE={class:"em-aw__dgroup"},aE={class:"em-aw__df"},lE={class:"em-aw__df"},rE={class:"em-aw__df"},sE={class:"em-aw__dgroup"},cE={class:"em-aw__dgroup"},dE={class:"em-aw__df"},uE={key:0,class:"em-aw__df"},fE={class:"em-aw__df"},mE={class:"c-expand"},pE={class:"em-aw__caret is-static","aria-hidden":"true"},hE={class:"c-del"},yE={class:"c-expand"},gE=["title","onClick","onKeydown"],bE={class:"em-aw__embed-label"},_E={class:"em-aw__ro"},EE={class:"em-aw__ro"},kE={class:"c-constraints"},wE={class:"em-aw__ro"},vE={key:0,class:"em-aw__detail-row em-aw__embed-detail"},NE={colspan:"8"},$E={class:"em-aw__detail"},IE={class:"em-aw__dgroup"},SE={key:0,class:"em-aw__df"},xE={class:"em-aw__df"},CE={class:"em-aw__df"},RE={key:0},VE=6,AE=5,TE="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Ji="__OWN__",ME=ze(n.defineComponent({__name:"EntityAttributesWide",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(()=>{var z;return((z=i.value)==null?void 0:z.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var z;return(((z=i.value)==null?void 0:z.attributes)??[]).filter(U=>U.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(z){return s.value.has(z)}function d(z){const U=new Set(s.value);U.has(z)?U.delete(z):U.add(z),s.value=U}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(z){return z==="none"?"(없음)":z}const m=z=>z;function p(z,U){i.value&&o.updateAttribute(i.value.modelId,z.modelId,U)}function y(z){return!!i.value&&!!hi(o.state.logical,i.value.modelId,z.modelId)}function b(z,U){p(z,{naturalId:U||void 0,naturalIdMutable:U?z.naturalIdMutable:void 0})}function g(){return{naturalId:void 0,naturalIdMutable:void 0}}function E(z,U){p(z,{identifier:U,...U?g():{}})}function $(z,U){p(z,{transient:U||void 0,...U?g():{}})}function h(z){return!!z.transient}const w=z=>z.value,X=z=>z.label;function B(z,U){if(!U)return;const k=oe.value.find(F=>F.type===U);if(k){const F=z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"};p(z,{type:U,customType:void 0,dbAttrs:[{...F,dataType:k.dataType,length:k.length,scale:k.scale}]});return}p(z,U===Et?{type:U}:{type:U,customType:void 0})}function H(z,U){p(z,{customType:U.trim()===""?void 0:U})}function A(z,U){const F={...z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!oo.has(F.dataType)&&(F.scale=void 0),p(z,{dbAttrs:[F]})}function S(z){var U;return oo.has(((U=z.dbAttrs[0])==null?void 0:U.dataType)??"")}function L(z,U,k){var F;A(z,{logicalName:{...(F=z.dbAttrs[0])==null?void 0:F.logicalName,[U]:k}})}function ee(z){return z.personalInfoAttributeType??"none"}function M(z,U){p(z,{personalInfoAttributeType:U==="none"?void 0:U})}const oe=n.computed(()=>o.predefinedCustomTypeCatalog.value),_=n.computed(()=>o.embeddableCatalog.value);function Y(z){var U,k;return((U=z.label)==null?void 0:U.ko)??((k=z.label)==null?void 0:k.en)??z.type}function T(z){!z||!i.value||o.addPredefinedEmbed(i.value.modelId,z)}const W=n.computed(()=>o.groupCodeCatalog.value);function Q(z){var U;return((U=W.value.find(k=>k.groupCode===z.groupCode))==null?void 0:U.codes)??[]}function te(z){return["none",...Q(z)]}function C(z){return z==="none"?"none":z.code}function Z(z){var k,F;if(z==="none")return"(없음)";const U=((k=z.label)==null?void 0:k.ko)??((F=z.label)==null?void 0:F.en);return U?`${z.code} (${U})`:z.code}function le(z,U){i.value&&o.setAttributeGroupCode(i.value.modelId,z.modelId,U)}function pe(z,U){p(z,{defaultValue:U==="none"?void 0:U})}function be(z,U){p(z,{defaultValue:U.trim()===""?void 0:U})}function de(z){return z.attrType.startsWith("EMBED")&&z.dbAttrs.length>0}function me(z,U,k){const F=z.dbAttrs.map((ne,ce)=>{if(ce!==U)return ne;const N={...ne,...k};for(const x of Object.keys(k))k[x]===void 0&&delete N[x];return N});i.value&&o.setEmbedColumns(i.value.modelId,z.modelId,F)}function ye(z,U,k,F){var ne;me(z,U,{logicalName:{...(ne=z.dbAttrs[U])==null?void 0:ne.logicalName,[k]:F}})}function ve(z,U){var ne,ce,N;if(z.attrType==="EMBED_PREDEF"){const x=(ne=o.embeddableCatalog.value.find(ie=>ie.type===z.type))==null?void 0:ne.fields[U];return x?{name:x.name,physicalName:x.physicalName,dataType:x.dataType,length:x.length,shareable:x.shareable,logicalName:x.logicalName}:void 0}const k=(ce=z.embedded)==null?void 0:ce.embeddableRef;if(!k)return;const F=(N=o.state.logical.entities.find(x=>x.modelId===k))==null?void 0:N.attributes.flatMap(x=>x.dbAttrs)[U];return F?{physicalName:F.physicalName,dataType:F.dataType,length:F.length,scale:F.scale,logicalName:F.logicalName}:void 0}function Ce(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.dataType)||((F=z.dbAttrs[U])==null?void 0:F.dataType)||""}function Se(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.length)??((F=z.dbAttrs[U])==null?void 0:F.length)}function ge(z,U){var k,F;return((k=ve(z,U))==null?void 0:k.scale)??((F=z.dbAttrs[U])==null?void 0:F.scale)}const J=["inherit","true","false"];function q(z){return z==="inherit"?"기본(따름)":z}function v(z){return(z==null?void 0:z.updatable)===void 0?"inherit":z.updatable?"true":"false"}function V(z,U,k){me(z,U,{updatable:k==="inherit"?void 0:k==="true"})}function j(z,U){A(z,{updatable:U==="inherit"?void 0:U==="true"})}const D=["inherit","true","false"];function K(z){return z==="inherit"?"기본(따름)":z}function he(z){return(z==null?void 0:z.insertable)===void 0?"inherit":z.insertable?"true":"false"}function we(z,U,k){me(z,U,{insertable:k==="inherit"?void 0:k==="true"})}function $e(z,U){A(z,{insertable:U==="inherit"?void 0:U==="true"})}const ke=n.computed(()=>i.value?ei(i.value,o.state.logical.entities):[]),Re=n.computed(()=>Qt(ke.value.flatMap(z=>z.attributes.flatMap(U=>U.dbAttrs)))),Ae=n.computed(()=>ke.value.flatMap(z=>z.attributes.filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>{var k;return{modelId:U.dbAttrs[0].modelId,physical:U.dbAttrs[0].physicalName||U.name,isCurrency:U.type==="Currency",ownerName:z.modelId===((k=i.value)==null?void 0:k.modelId)?void 0:z.name}})));function Oe(){const z=[...Ae.value].sort((U,k)=>Number(k.isCurrency)-Number(U.isCurrency));return[Ji,...z.map(U=>U.modelId)]}function We(z){if(z===Ji)return"전용 컬럼(OWN)";const U=Ae.value.find(F=>F.modelId===z);return U?`↗ ${U.ownerName?`${U.ownerName}.`:""}${U.physical} (${U.isCurrency?"통화":"공유"})`:z}function I(z){return(z==null?void 0:z.sharedColumnRef)??Ji}function O(z,U,k){me(z,U,{sharedColumnRef:k===Ji?void 0:k})}function re(z){return(z==null?void 0:z.sharedColumnRef)!=null}function ue(z){var U;return((U=Sn(z,Re.value))==null?void 0:U.physicalName)??""}return(z,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",j_,[n.createElementVNode("span",W_,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:U[0]||(U[0]=k=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:U[1]||(U[1]=k=>n.unref(o).addDivider(i.value.modelId))}),_.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:_.value,"value-provider":k=>k.type,"label-provider":Y,"onUpdate:modelValue":T},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",K_,[n.createElementVNode("table",q_,[U[21]||(U[21]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-expand"}),n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-type"},"타입"),n.createElementVNode("th",{class:"c-logical"},"논리명"),n.createElementVNode("th",{class:"c-col"},"컬럼(물리)"),n.createElementVNode("th",{class:"c-dtype"},"dataType"),n.createElementVNode("th",{class:"c-len"},"len"),n.createElementVNode("th",{class:"c-constraints"},"제약"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,k=>{var F,ne,ce,N,x,ie,R,G,P,se,Ne;return n.openBlock(),n.createElementBlock(n.Fragment,{key:k.modelId},[k.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(k.modelId)}])},[U[2]||(U[2]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${k.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:VE,class:"em-aw__divider-note"},"── 시각 구획 ──"),n.createElementVNode("td",X_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])])],2)):de(k)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(k.modelId)}])},[n.createElementVNode("td",mE,[n.createElementVNode("span",pE,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${k.modelId}`,width:"100%",placeholder:"이름","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${k.modelId}`,width:"100%",disabled:"","model-value":k.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:AE,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(k.dbAttrs.length)+"개",1),n.createElementVNode("td",hE,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(k.dbAttrs,(fe,Me)=>{var Le,Fe,et,je,Ke,Rt,Jt;return n.openBlock(),n.createElementBlock(n.Fragment,{key:fe.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(fe.modelId)}])},[n.createElementVNode("td",yE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(fe.modelId)}]),role:"button",tabindex:"0",title:c(fe.modelId)?"오버라이드 접기":"오버라이드 펼치기",onClick:_e=>d(fe.modelId),onKeydown:[n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,gE)]),n.createElementVNode("td",bE,"↳ "+n.toDisplayString(((Le=ve(k,Me))==null?void 0:Le.name)??((Fe=ve(k,Me))==null?void 0:Fe.physicalName)??`컬럼 ${Me+1}`),1),U[13]||(U[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${fe.modelId}`,width:"100%",placeholder:((je=(et=ve(k,Me))==null?void 0:et.logicalName)==null?void 0:je.ko)??"논리명","model-value":((Ke=fe.logicalName)==null?void 0:Ke.ko)??"","onUpdate:modelValue":_e=>ye(k,Me,"ko",_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${fe.modelId}`,width:"100%",disabled:re(fe),placeholder:((Rt=ve(k,Me))==null?void 0:Rt.physicalName)??"컬럼","model-value":re(fe)?ue(fe):fe.physicalName,"onUpdate:modelValue":_e=>me(k,Me,{physicalName:_e})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(yn,{controller:n.unref(o),"ref-id":fe.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",_E,n.toDisplayString(Ce(k,Me)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",EE,n.toDisplayString(Se(k,Me)??""),1)]),n.createElementVNode("td",kE,[n.createElementVNode("span",wE,n.toDisplayString(ge(k,Me)!=null?`scale ${ge(k,Me)}`:""),1)]),U[14]||(U[14]=n.createElementVNode("td",null,null,-1))],2),c(fe.modelId)?(n.openBlock(),n.createElementBlock("tr",vE,[U[19]||(U[19]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",NE,[n.createElementVNode("div",$E,[n.createElementVNode("fieldset",IE,[U[18]||(U[18]=n.createElementVNode("legend",null,"컬럼 오버라이드",-1)),(Jt=ve(k,Me))!=null&&Jt.shareable?(n.openBlock(),n.createElementBlock("label",SE,[U[15]||(U[15]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":I(fe),items:Oe(),"value-provider":m,"label-provider":We,"onUpdate:modelValue":_e=>_e&&O(k,Me,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",xE,[U[16]||(U[16]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":he(fe),items:D,"value-provider":m,"label-provider":K,"onUpdate:modelValue":_e=>_e&&we(k,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",CE,[U[17]||(U[17]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":v(fe),items:J,"value-provider":m,"label-provider":q,"onUpdate:modelValue":_e=>_e&&V(k,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":l.value.has(k.modelId),"em-aw__open":c(k.modelId)})},[n.createElementVNode("td",Z_,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(k.modelId)}]),role:"button",tabindex:"0",title:c(k.modelId)?"상세 접기":"상세 펼치기",onClick:fe=>d(k.modelId),onKeydown:[n.withKeys(n.withModifiers(fe=>d(k.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(fe=>d(k.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,J_)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${k.modelId}`,width:"100%",placeholder:"이름","model-value":k.name,"onUpdate:modelValue":fe=>p(k,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${k.modelId}`,width:"100%",placeholder:"타입",disabled:!!k.groupCode,items:n.unref(Vr)(k.type,oe.value),"value-provider":w,"label-provider":X,"model-value":k.type,"onUpdate:modelValue":fe=>B(k,fe)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),k.type===n.unref(Et)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${k.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":k.customType??"","onUpdate:modelValue":fe=>H(k,fe)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${k.modelId}`,width:"100%",placeholder:"논리명","model-value":((ne=(F=k.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko)??"","onUpdate:modelValue":fe=>L(k,"ko",fe)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${k.modelId}`,width:"100%",placeholder:"컬럼",disabled:h(k),"model-value":((ce=k.dbAttrs[0])==null?void 0:ce.physicalName)??"","onUpdate:modelValue":fe=>A(k,{physicalName:fe})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(yn,{controller:n.unref(o),"ref-id":(N=k.dbAttrs[0])==null?void 0:N.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${k.modelId}`,width:"100%",placeholder:"dataType",disabled:h(k),items:n.unref(Cr)(((x=k.dbAttrs[0])==null?void 0:x.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":m,"label-provider":n.unref(Ma),"model-value":((ie=k.dbAttrs[0])==null?void 0:ie.dataType)??"","onUpdate:modelValue":fe=>fe&&A(k,{dataType:fe})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${k.modelId}`,width:"100%",placeholder:"len",disabled:h(k),"model-value":(R=k.dbAttrs[0])==null?void 0:R.length,"onUpdate:modelValue":fe=>A(k,{length:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",Q_,[n.createElementVNode("div",eE,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${k.modelId}`,label:"PK","model-value":k.identifier,disabled:a.value||h(k),"onUpdate:modelValue":fe=>E(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${k.modelId}`,label:"NN","model-value":k.notNull,disabled:h(k),"onUpdate:modelValue":fe=>p(k,{notNull:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${k.modelId}`,label:"UQ","model-value":!!((G=k.dbAttrs[0])!=null&&G.unique),disabled:h(k),"onUpdate:modelValue":fe=>A(k,{unique:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(k)?TE:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,k.modelId)},null,8,["onClick"])],8,tE)],2),c(k.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":l.value.has(k.modelId)}])},[U[12]||(U[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",nE,[n.createElementVNode("div",oE,[n.createElementVNode("fieldset",iE,[U[6]||(U[6]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",aE,[U[3]||(U[3]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${k.modelId}`,width:"72px",placeholder:"scale",disabled:h(k)||!S(k),"model-value":(P=k.dbAttrs[0])==null?void 0:P.scale,"onUpdate:modelValue":fe=>A(k,{scale:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${k.modelId}`,label:"Auto Increment","model-value":!!((se=k.dbAttrs[0])!=null&&se.autoIncrement),disabled:h(k)||!k.identifier,"onUpdate:modelValue":fe=>A(k,{autoIncrement:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",lE,[U[4]||(U[4]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${k.modelId}`,width:"110px",disabled:h(k),"model-value":he(k.dbAttrs[0]),items:D,"value-provider":m,"label-provider":K,"onUpdate:modelValue":fe=>fe&&$e(k,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",rE,[U[5]||(U[5]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${k.modelId}`,width:"110px",disabled:h(k),"model-value":v(k.dbAttrs[0]),items:J,"value-provider":m,"label-provider":q,"onUpdate:modelValue":fe=>fe&&j(k,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",sE,[U[7]||(U[7]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${k.modelId}`,label:"@Transient","model-value":!!k.transient,disabled:k.identifier,"onUpdate:modelValue":fe=>$(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nid-${k.modelId}`,label:"@NaturalId","model-value":!!k.naturalId,disabled:k.identifier||h(k),"onUpdate:modelValue":fe=>b(k,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${k.modelId}`,label:"mutable","model-value":!!k.naturalIdMutable,disabled:h(k)||!k.naturalId,"onUpdate:modelValue":fe=>p(k,{naturalIdMutable:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${k.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ne=k.dbAttrs[0])!=null&&Ne.multiValue),disabled:h(k),"onUpdate:modelValue":fe=>A(k,{multiValue:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",cE,[U[11]||(U[11]=n.createElementVNode("legend",null,"의미",-1)),n.createElementVNode("label",dE,[U[8]||(U[8]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":ee(k),items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":fe=>fe&&M(k,fe)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",uE,[U[9]||(U[9]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(cu,{"model-value":k.groupCode,items:W.value,"onUpdate:modelValue":fe=>le(k,fe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",fE,[U[10]||(U[10]=n.createElementVNode("span",null,"기본값",-1)),Q(k).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"150px","model-value":k.defaultValue??"none",items:te(k),"value-provider":C,"label-provider":Z,"onUpdate:modelValue":fe=>fe&&pe(k,fe)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${k.modelId}`,width:"150px",placeholder:"기본값","model-value":k.defaultValue??"","onUpdate:modelValue":fe=>be(k,fe)},null,8,["name","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",RE,[...U[20]||(U[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,Y_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-e52d4460"]]),BE=["disabled"],OE={class:"em-idxw__list"},DE={class:"em-idxw__list-head"},LE=["onClick"],PE={class:"em-idxw__item-name"},zE={key:0,class:"em-idxw__badge"},UE={class:"em-idxw__item-cnt"},FE={key:0,class:"em-idxw__empty"},HE={key:0,class:"em-idxw__edit"},GE={class:"em-idxw__form"},YE={class:"em-field em-idxw__name"},jE={class:"em-field"},WE=["value"],KE={class:"em-idxw__transfer"},qE={class:"em-idxw__pane"},XE={class:"em-idxw__pane-head"},ZE={class:"em-idxw__cols"},JE=["onClick"],QE={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},ek={key:0,class:"em-idxw__empty"},tk={class:"em-idxw__arrows"},nk={class:"em-idxw__pane"},ok={class:"em-idxw__pane-head"},ik={class:"em-idxw__cols"},ak={class:"em-idxw__col-name"},lk={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},rk={class:"em-idxw__col-ops"},sk=["disabled","onClick"],ck=["disabled","onClick"],dk=["onClick"],uk={key:0,class:"em-idxw__empty"},fk={key:1,class:"em-idxw__edit em-idxw__edit--empty"},mk=ze(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(S=>S.modelId===t.entityId)??null),a=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.indexes)??[]}),l=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.attributes)??[]}),r=n.ref(null);n.watch(a,S=>{var L;S.some(ee=>ee.modelId===r.value)||(r.value=((L=S[0])==null?void 0:L.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(S=>S.modelId===r.value)??null),c=n.computed(()=>i.value?to(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(L=>L.columnRef))??[])}),u=n.computed(()=>[...l.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:m(S),inherited:!1})),...c.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:p(S),inherited:!0}))]),f=n.ref(new Set);n.watch(r,()=>f.value=new Set);function m(S){var ee;const L=(ee=S.dbAttrs[0])==null?void 0:ee.physicalName;return L&&L!==S.name?`${S.name} (${L})`:S.name}function p(S){return S.physicalName&&S.physicalName!==S.field?`${S.field} (${S.physicalName})`:S.field}function y(S){const L=l.value.find(M=>M.modelId===S);if(L)return m(L);const ee=c.value.find(M=>M.modelId===S);return ee?p(ee):S}function b(S){return eo(S)}function g(S,L){i.value&&o.updateIndex(i.value.modelId,S,L)}function E(){var L;if(!i.value)return;const S=De();o.addIndex(i.value.modelId,{modelId:S,name:`idx_${(((L=i.value.indexes)==null?void 0:L.length)??0)+1}`,unique:!1,columns:[]}),r.value=S}function $(S){i.value&&o.removeIndex(i.value.modelId,S)}function h(S){s.value&&g(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function w(S){const L=new Set(f.value);L.has(S)?L.delete(S):L.add(S),f.value=L}function X(){const S=s.value;if(!S||!f.value.size)return;const L=[...f.value].map(ee=>({columnRef:ee,descending:!1}));g(S.modelId,{columns:[...S.columns,...L]}),f.value=new Set}function B(S){const L=s.value;L&&g(L.modelId,{columns:L.columns.filter((ee,M)=>M!==S)})}function H(S,L){const ee=s.value;ee&&g(ee.modelId,{columns:ee.columns.map((M,oe)=>oe===S?{...M,descending:L}:M)})}function A(S,L){const ee=s.value;if(!ee)return;const M=S+L;if(M<0||M>=ee.columns.length)return;const oe=[...ee.columns];[oe[S],oe[M]]=[oe[M],oe[S]],g(ee.modelId,{columns:oe})}return(S,L)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",OE,[n.createElementVNode("div",DE,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:E})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,ee=>(n.openBlock(),n.createElementBlock("li",{key:ee.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":ee.modelId===r.value}]),onClick:M=>r.value=ee.modelId},[n.createElementVNode("span",PE,n.toDisplayString(ee.name||"(이름 없음)"),1),ee.unique?(n.openBlock(),n.createElementBlock("span",zE,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",UE,n.toDisplayString(ee.columns.length),1)],10,LE))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",FE,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",HE,[n.createElementVNode("div",GE,[n.createElementVNode("label",YE,[L[4]||(L[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":L[0]||(L[0]=ee=>g(s.value.modelId,{name:ee}))},null,8,["model-value"]),n.createVNode(yn,{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":L[1]||(L[1]=ee=>g(s.value.modelId,{unique:ee}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:L[2]||(L[2]=ee=>$(s.value.modelId))})]),n.createElementVNode("label",jE,[L[5]||(L[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:L[3]||(L[3]=ee=>h(ee.target.value))},null,40,WE)]),n.createElementVNode("div",KE,[n.createElementVNode("div",qE,[n.createElementVNode("div",XE,"가용 컬럼 ("+n.toDisplayString(u.value.length)+")",1),n.createElementVNode("ul",ZE,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,ee=>(n.openBlock(),n.createElementBlock("li",{key:ee.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":f.value.has(ee.ref)}]),onClick:M=>w(ee.ref)},[n.createTextVNode(n.toDisplayString(ee.label),1),ee.inherited?(n.openBlock(),n.createElementBlock("span",QE,"상속")):n.createCommentVNode("",!0)],10,JE))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",ek,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",tk,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!f.value.size,onClick:X},null,8,["disabled"])]),n.createElementVNode("div",nk,[n.createElementVNode("div",ok,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",ik,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(ee,M)=>(n.openBlock(),n.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",ak,[n.createTextVNode(n.toDisplayString(y(ee.columnRef)),1),b(ee.columnRef)?(n.openBlock(),n.createElementBlock("span",lk,"상속")):n.createCommentVNode("",!0)]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":ee.descending,"onUpdate:modelValue":oe=>H(M,oe)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",rk,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:M===0,onClick:oe=>A(M,-1)},"↑",8,sk),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:M===s.value.columns.length-1,onClick:oe=>A(M,1)},"↓",8,ck),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:oe=>B(M)},"✕",8,dk)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",uk,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",fk,"인덱스를 선택하거나 추가하세요."))],8,BE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-bb582869"]]),pk={class:"em-op-src"},hk={class:"em-op-src__actions"},du=ze(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",pk,[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",hk,[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-2150d2fc"]]),yk=["disabled"],gk={class:"em-ow__toolbar"},bk={class:"em-ow__count"},_k={class:"em-ow__scroll"},Ek={class:"em-ow__table"},kk={class:"c-del"},wk={key:0},vk=ze(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(y=>y.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(y){return y==="none"?"(없음)":y}const c=y=>y;function d(y,b){a.value&&o.updateOperation(a.value.modelId,y.modelId,b)}function u(y,b,g){d(y,{description:{...y.description,[b]:g}})}function f(y){return y.personalInfoAttributeType??"none"}function m(y,b){d(y,{personalInfoAttributeType:b==="none"?void 0:b})}function p(y){i.openModal({component:du,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:b=>d(y,{sourceCode:b})}})}return(y,b)=>{var g,E;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",gk,[n.createElementVNode("span",bk,"오퍼레이션 ("+n.toDisplayString(((g=a.value.operations)==null?void 0:g.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:b[0]||(b[0]=$=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",_k,[n.createElementVNode("table",Ek,[b[2]||(b[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??[],$=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:$.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${$.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":$.name,"onUpdate:modelValue":w=>d($,{name:w})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":$.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":w=>w&&d($,{visibility:w})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${$.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((h=$.description)==null?void 0:h.ko)??"","onUpdate:modelValue":w=>u($,"ko",w)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f($),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":w=>w&&m($,w)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:$.sourceCode?"본문 ●":"본문",onClick:w=>p($)},null,8,["caption","onClick"])]),n.createElementVNode("td",kk,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>n.unref(o).removeOperation(a.value.modelId,$.modelId)},null,8,["onClick"])])])}),128)),(E=a.value.operations)!=null&&E.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",wk,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,yk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),Nk={class:"em-detail__tabs"},$k=["onClick"],Ik={key:0,class:"em-detail__narrow"},Sk=ze(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",Nk,[(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,$k)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createElementBlock("div",Ik,[n.createVNode(ru,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):r.value==="columns"?(n.openBlock(),n.createBlock(ME,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(mk,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(vk,{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-e761e204"]]);function Qi(e,t,o){e.openModal({component:Sk,bind:{controller:n.markRaw(t),entityId:o}})}const uu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function xk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=De(),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=De();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=De()}for(const a of t.indexes??[]){a.modelId=De();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const Ck=220;function Rk(e,t){let i=-1/0;for(const l of e.entityLayouts)i=Math.max(i,l.geo.location.x+(l.geo.size.width||Ck));for(const l of e.groupLayouts)i=Math.max(i,l.geo.location.x+l.geo.size.width);let a=1/0;for(const l of t.entityLayouts)a=Math.min(a,l.geo.location.x);for(const l of t.groupLayouts)a=Math.min(a,l.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const zl=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),gn=Symbol("editorController");function fu(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ea(e,t){const o=[];for(const i of t.remove)o.push(Tn(e,i));for(const i of t.update)o.push(on(e,i.attributeId,i.patch));for(const i of t.add)o.push(At(e,i));return o}function jn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Wn(e,t){const o=[];for(const[i,a]of dp(e,t,De))o.push(...ea(i,a));return o}function mu(e,t,o){const i=new Set(o.remove);return jn(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 Ul(e,t){const o=co(e,t,De),i=ea(t,o),a=mu(e,t,o);return i.push(...Wn(a,t)),i}function pu(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:De()}))}function Vk(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((p,y)=>Math.max(p,y.order),-1)+1,f=new Set(o.attributes.map(p=>p.name));let m="id";for(let p=2;f.has(m);p++)m=`id${p}`;a={modelId:De(),name:m,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:m.toLowerCase(),dataType:"BIGINT"}]},i.push(At(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 m=e.associations.find(g=>g.modelId===f.embedded.associationRef);if(!m)continue;const p=m.end1.entityRef===u.modelId,y=p?m.end1:m.end2,b=p?m.end2:m.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:m.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:t,multiplicity:b.multiplicity,navigable:b.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(m=>m.ownerId===u.modelId).map(m=>m.dispId));return f.size?{...u,attributes:u.attributes.filter(m=>!f.has(m.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(m=>m.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=co(r,t,De);for(const u of l){const f=s.add.find(m=>{var p;return((p=m.derivedFrom)==null?void 0:p.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(Tn(u.ownerId,u.dispId)),i.push(ui(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ea(t,s));const c=mu(r,t,s);return i.push(...Wn(c,t)),i}function Ak(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(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var w;return((w=h.embedded)==null?void 0:w.associationRef)===l.modelId}))continue;const u=De(),f=d.attributes.reduce((h,w)=>Math.max(h,w.order),-1)+1,m=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;m.has(y);h++)y=`${p}${h}`;const b=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),g={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:b,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(At(c,g));const E=r?"end2":"end1",$=r?"end1":"end2";i.push(ui(l.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[$]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Tk(e=fu(),t={}){var Oe,We;const o=n.reactive(e);let i=new Ka(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.reservedWords),f=n.ref(t.selectableDataTypes),m=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),y=n.ref(!1),b=n.ref(!1),g=n.ref(!1),E=n.ref(0),$=n.ref(null);let h=0;const w=I=>{if(t.onNotice){t.onNotice(I);return}$.value={text:I,id:++h}},X=n.ref(((Oe=t.meta)==null?void 0:Oe.schemaVersion)??1),B=n.ref(((We=t.meta)==null?void 0:We.opWriteEnabled)??!1),H=n.computed(()=>X.value>=2&&B.value),A=t.historyTransport,S=n.computed(()=>H.value&&A!==void 0),L=t.restoreTransport,ee=n.ref(0),M=n.computed(()=>H.value&&_.value&&L!==void 0);async function oe(I){if(!L||!_.value)return{ok:!1,reason:"unavailable"};const O=await L(I);return O.ok&&ee.value++,O}const _=n.ref(!(X.value>=2&&B.value===!1)),Y=n.ref("LOGICAL_PHYSICAL"),T=n.ref("straight"),W=n.ref(!0),Q=n.ref(!0),te=n.ref(null),C=n.computed(()=>{var I;return((I=te.value)==null?void 0:I.kind)==="attribute"?{entityId:te.value.entityId,attrId:te.value.anchor}:null}),Z=n.computed(()=>{var I;return((I=te.value)==null?void 0:I.kind)==="attribute"?te.value.ids:[]}),le=n.computed(()=>{var I,O;return((I=te.value)==null?void 0:I.kind)==="entity"?te.value.id:((O=te.value)==null?void 0:O.kind)==="attribute"?te.value.entityId:null}),pe=n.ref(null);let be=0;const de=n.ref(null),me=n.ref(null);let ye=t.meta;function ve(){i.onChange(()=>{y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,E.value++})}ve();let Ce=null,Se=null;function ge(){Se==null||Se(),Se=null,Ce=null}function J(){if(ge(),!H.value||!t.opTransport)return;const I=new Us({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:O=>{_.value=!1,me.value=O},onError:t.onOpError});I.seed((ye==null?void 0:ye.revSeed)??{}),Se=I.attach(i),Ce=I}J();const q=n.computed(()=>hr(o.logical,o.layout)),v=n.computed(()=>({reservedWords:u.value,selectableDataTypes:f.value,largeEntityThreshold:m.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:a.value,superClassCatalog:s.value})),V=n.computed(()=>Tr(o.logical,v.value)),j=n.computed(()=>{const I=new Map;for(const O of V.value){if(!O.targetRef)continue;const re=I.get(O.targetRef);re?re.push(O):I.set(O.targetRef,[O])}return I}),D=I=>{_.value&&i.execute(I)},K=I=>o.layout.entityLayouts.some(O=>O.entityRef===I&&!!O.locked),he=I=>o.layout.groupLayouts.some(O=>O.groupRef===I&&!!O.locked),we=I=>{const O=o.logical.associations.find(re=>re.modelId===I);return!!O&&(K(O.end1.entityRef)||K(O.end2.entityRef))},$e=(I,O,re)=>{if(K(I))return;const ue=on(I,O,re),z=jn(o.logical,I,k=>k.map(F=>F.modelId===O?{...F,...re}:F)),U=Wn(z,I);D(U.length?Ye("속성 수정",[ue,...U]):ue)};function ke(I){const O=I.map(ne=>o.layout.entityLayouts.find(ce=>ce.entityRef===ne)).filter(ne=>!!ne);if(!O.length)return{location:{x:40,y:40},size:{width:400,height:300}};let re=1/0,ue=1/0,z=-1/0,U=-1/0;for(const ne of O){const ce=ne.geo.size.width||220,N=ne.geo.size.height||140;re=Math.min(re,ne.geo.location.x),ue=Math.min(ue,ne.geo.location.y),z=Math.max(z,ne.geo.location.x+ce),U=Math.max(U,ne.geo.location.y+N)}const k=40,F=28;return{location:{x:re-k,y:ue-k-F},size:{width:z-re+k*2,height:U-ue+k*2+F}}}function Re(I,O,re){var ne;const ue=o.layout.groupLayouts.find(ce=>ce.groupRef===I),z=(ue==null?void 0:ue.geo.location)??O,U=O.x-z.x,k=O.y-z.y,F=[cs(I,O),...re.map(ce=>An(ce.id,ce.location))];if(U||k){const ce=new Set(((ne=o.logical.groups.find(N=>N.modelId===I))==null?void 0:ne.memberEntityRefs)??[]);for(const N of o.logical.associations){if(!ce.has(N.end1.entityRef)||!ce.has(N.end2.entityRef))continue;const x=o.layout.associationLayouts.find(ie=>ie.associationRef===N.modelId);x&&x.waypoints.length&&F.push(Ns(N.modelId,U,k))}for(const N of(ue==null?void 0:ue.memberNoteRefs)??[]){const x=o.layout.notes.find(ie=>ie.modelId===N);x&&F.push(so(N,{x:x.geo.location.x+U,y:x.geo.location.y+k}))}}return F}const Ae={state:o,resolved:q,issues:V,issuesByRef:j,flagEntitiesWithoutRelations:p,canUndo:y,canRedo:b,dirty:g,revision:E,notice:$,editable:_,schemaVersion:X,opWriteEnabled:B,opMode:H,opConflict:me,historyTransport:A,historyAvailable:S,restoreTransport:L,restoreAvailable:M,restoreToSeq:oe,reloadRequest:ee,displayMode:Y,routingMode:T,showGrid:W,showMinimap:Q,selection:te,selectedAttr:C,selectedAttrIds:Z,inspectedEntityId:le,focusRequest:pe,clipboard:de,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,superClassCatalog:s,languages:c,userLanguage:d,selectableDataTypes:f,setEditable(I){_.value=I&&H.value},setEmbeddableCatalog(I){a.value=I},setGroupCodeCatalog(I){l.value=I},setPredefinedCustomTypeCatalog(I){r.value=I},setSuperClassCatalog(I){s.value=I},selectAttribute(I,O,re="replace"){const ue=te.value,z=(ue==null?void 0:ue.kind)==="attribute"&&ue.entityId===I;if(re==="replace"||!z){te.value={kind:"attribute",entityId:I,ids:[O],anchor:O};return}if(re==="toggle"){const x=ue.ids.includes(O),ie=x?ue.ids.filter(G=>G!==O):[...ue.ids,O];if(!ie.length){te.value=null;return}const R=x&&ue.anchor===O?ie[ie.length-1]:x?ue.anchor:O;te.value={kind:"attribute",entityId:I,ids:ie,anchor:R};return}const U=o.logical.entities.find(x=>x.modelId===I),k=[...(U==null?void 0:U.attributes)??[]].sort((x,ie)=>x.order-ie.order).map(x=>x.modelId),F=k.indexOf(ue.anchor),ne=k.indexOf(O);if(F<0||ne<0){te.value={kind:"attribute",entityId:I,ids:[O],anchor:O};return}const[ce,N]=F<=ne?[F,ne]:[ne,F];te.value={kind:"attribute",entityId:I,ids:k.slice(ce,N+1),anchor:ue.anchor}},moveAttributeFocus(I){const O=te.value;if((O==null?void 0:O.kind)!=="attribute")return!1;const re=o.logical.entities.find(k=>k.modelId===O.entityId);if(!re||!re.attributes.length)return!1;const ue=re.attributes.findIndex(k=>k.modelId===O.anchor);if(ue<0)return!1;const z=Math.min(Math.max(ue+I,0),re.attributes.length-1);if(z===ue)return!0;const U=re.attributes[z].modelId;return te.value={kind:"attribute",entityId:O.entityId,ids:[U],anchor:U},!0},nudgeSelectedAttributes(I){const O=te.value;if((O==null?void 0:O.kind)!=="attribute")return!1;const re=o.logical.entities.find(x=>x.modelId===O.entityId);if(!re)return!1;const ue=re.attributes,z=new Set(O.ids),U=ue.map((x,ie)=>z.has(x.modelId)?ie:-1).filter(x=>x>=0);if(!U.length)return!1;const k=Math.min(...U),F=ue.filter(x=>!z.has(x.modelId)),ne=ue.slice(0,k).filter(x=>!z.has(x.modelId)).length;let ce;if(I<0){if(ne<=0)return!0;ce=ne-1}else{if(F.length-ne<=0)return!0;ce=ne+1}if(K(O.entityId))return!0;const N=ue.filter(x=>z.has(x.modelId)).map(x=>x.modelId);return D(Xa(O.entityId,N,ce)),!0},deleteSelection(){if(!_.value)return!1;const I=te.value;if(!I)return!1;if(I.kind==="attribute"){if(K(I.entityId))return!1;const O=I.ids;if(!O.length)return!1;O.length===1?Ae.removeAttribute(I.entityId,O[0]):Ae.removeAttributes(I.entityId,O)}else if(I.kind==="entity"){if(K(I.id))return!1;Ae.removeEntity(I.id)}else if(I.kind==="note")Ae.removeNote(I.id);else if(I.kind==="group"){if(he(I.id))return!1;Ae.removeGroup(I.id)}else Ae.removeAssociation(I.id);return te.value=null,!0},nudgeNodes(I,O,re){if(!I.length||O===0&&re===0)return!1;const ue=new Set(o.logical.entities.map(ce=>ce.modelId)),z=new Set(o.logical.groups.map(ce=>ce.modelId)),U=new Set(o.layout.notes.map(ce=>ce.modelId)),k=new Set;for(const ce of I){if(!z.has(ce))continue;const N=o.logical.groups.find(x=>x.modelId===ce);for(const x of(N==null?void 0:N.memberEntityRefs)??[])k.add(x)}const F=[],ne=[];for(const ce of I)if(z.has(ce)){if(he(ce))continue;const N=o.layout.groupLayouts.find(G=>G.groupRef===ce);if(!N)continue;const x=o.logical.groups.find(G=>G.modelId===ce),ie=((x==null?void 0:x.memberEntityRefs)??[]).map(G=>{var se;const P=((se=o.layout.entityLayouts.find(Ne=>Ne.entityRef===G))==null?void 0:se.geo.location)??{x:0,y:0};return{id:G,location:{x:P.x+O,y:P.y+re}}}),R={x:N.geo.location.x+O,y:N.geo.location.y+re};F.push(Ye("그룹 이동",Re(ce,R,ie))),ne.push("g:"+ce)}else if(ue.has(ce)){if(k.has(ce)||K(ce))continue;const N=o.layout.entityLayouts.find(x=>x.entityRef===ce);if(!N)continue;F.push(An(ce,{x:N.geo.location.x+O,y:N.geo.location.y+re})),ne.push("e:"+ce)}else if(U.has(ce)){const N=o.layout.notes.find(x=>x.modelId===ce);if(!N)continue;F.push(so(ce,{x:N.geo.location.x+O,y:N.geo.location.y+re})),ne.push("n:"+ce)}return F.length?(D(Ye("이동",F,"nudge:"+ne.sort().join(","))),!0):!1},requestFocus(I){pe.value={id:I,nonce:++be}},undo:()=>{_.value&&i.undo()},redo:()=>{_.value&&i.redo()},markSaved:()=>{_.value&&(Ce==null||Ce.flush(),i.markSavePoint())},loadDiagram(I,O){ge(),o.logical=I.logical,o.layout=I.layout,i=new Ka(o),ve(),X.value=(O==null?void 0:O.schemaVersion)??1,B.value=(O==null?void 0:O.opWriteEnabled)??!1,_.value=!(X.value>=2&&B.value===!1),ye=O,me.value=null,te.value=null,y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,J()},flush(){Ce==null||Ce.flush()},whenOpsSettled(){return(Ce==null?void 0:Ce.whenSettled())??Promise.resolve()},addEntity(I="NewEntity",O={x:80,y:80}){const re=De(),ue={modelId:re,name:I,stereotype:"JPA_ENTITY",table:{physicalName:I.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return D(li(ue,{location:{...O},size:{width:220,height:140}})),re},renameEntity(I,O){K(I)||D(ts(I,O))},updateEntity(I,O){if(K(I))return;const re=es(I,O),ue=o.logical.entities.find(k=>k.modelId===I),z=O.stereotype==="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype!=="JPA_EMBEDDABLE",U=!!O.stereotype&&O.stereotype!=="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype==="JPA_EMBEDDABLE";if(z&&ue){const k=ue.attributes.filter(x=>x.identifier&&!x.derivedFrom).map(x=>on(I,x.modelId,{identifier:!1})),F=jn({...o.logical,entities:o.logical.entities.map(x=>x.modelId===I?{...x,stereotype:"JPA_EMBEDDABLE"}:x)},I,x=>x.map(ie=>ie.identifier&&!ie.derivedFrom?{...ie,identifier:!1}:ie)),ne=Ul(F,I),ce=Ak(o.logical,I),N=[re,...k,...ne,...ce];D(N.length>1?Ye("임베더블 변환",N):re);return}if(U){const k=Vk(o.logical,I),F=[re,...k];D(F.length>1?Ye("엔터티 전환",F):re);return}D(re)},moveEntity(I,O){K(I)||D(An(I,O))},resizeEntity(I,O){K(I)||D(ns(I,O))},removeEntity(I){K(I)||D(Qr(I))},setEntitySwatch(I,O){D(os(I,O))},setEntityCollapsed(I,O){D(is(I,O))},setEntityLocked(I,O){D(as(I,O))},isEntityLocked(I){return K(I)},collapseAll(){D(qa(!0))},expandAll(){D(qa(!1))},setAttributeSwatch(I,O,re){D(ri(I,O,re))},dragGroup(I,O,re){he(I)||D(Ye("그룹 이동",Re(I,O,re)))},resizeGroup(I,O){he(I)||D(ds(I,O))},setGroupSwatch(I,O){D(us(I,O))},setGroupLocked(I,O){D(fs(I,O))},isGroupLocked(I){return he(I)},updateGroup(I,O){he(I)||D(ls(I,O))},createGroup(I,O){if(!I.length)return null;const re=[];for(const U of o.logical.groups)for(const k of I)U.memberEntityRefs.includes(k)&&re.push(ci(U.modelId,k));const ue=De(),z={modelId:ue,name:O?{ko:O}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...I]};return re.push(si(z,ke(I))),D(Ye("그룹 생성",re)),te.value=null,ue},addEmptyGroup(I,O){const re=De();return D(si({modelId:re,name:O?{ko:O}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...I},size:{width:360,height:260}})),re},removeGroup(I){he(I)||D(rs(I))},dropEntity(I,O,re){var U;if(K(I))return;const ue=((U=o.logical.groups.find(k=>k.memberEntityRefs.includes(I)))==null?void 0:U.modelId)??null,z=[An(I,O)];ue!==re&&(ue&&z.push(ci(ue,I)),re&&z.push(ss(re,I))),D(Ye("이동",z))},ungroupEntity(I){const O=o.logical.groups.find(re=>re.memberEntityRefs.includes(I));O&&D(ci(O.modelId,I))},dropNote(I,O,re){var U;const ue=((U=o.layout.groupLayouts.find(k=>{var F;return(F=k.memberNoteRefs)==null?void 0:F.includes(I)}))==null?void 0:U.groupRef)??null,z=[so(I,O)];ue!==re&&(ue&&z.push(Ts(ue,I)),re&&z.push(As(re,I))),D(Ye("이동",z))},addPredefinedEmbed(I,O){if(K(I))return;const re=a.value.find(ne=>ne.type===O),ue=o.logical.entities.find(ne=>ne.modelId===I);if(!re||!ue)return;const z=ue.attributes.reduce((ne,ce)=>Math.max(ne,ce.order),-1)+1,U=De(),k=re.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),F={modelId:U,name:re.defaultName,type:re.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:z,dbAttrs:k};return D(At(I,F)),U},addAttribute(I,O={}){if(K(I))return O.modelId??"";const re=o.logical.entities.find(N=>N.modelId===I),ue=re?re.attributes.length:0,z=O.modelId??De(),U=O.name??`field${ue}`,k={modelId:z,name:U,type:O.type??Ba,attrType:O.attrType??"NORMAL",identifier:O.identifier??!1,notNull:O.notNull??!1,order:ue,dbAttrs:O.dbAttrs??[{modelId:De(),physicalName:U,dataType:"VARCHAR",length:255}],...O},F=At(I,k),ne=jn(o.logical,I,N=>[...N,k]),ce=Wn(ne,I);return D(ce.length?Ye("속성 추가",[F,...ce]):F),z},addDivider(I){if(K(I))return"";const O=o.logical.entities.find(U=>U.modelId===I),re=O?O.attributes.length:0,ue=De();return D(At(I,{modelId:ue,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:re,dbAttrs:[]})),ue},updateAttribute(I,O,re){$e(I,O,re)},setAttributeGroupCode(I,O,re){$e(I,O,{groupCode:re,type:re?Nn:Ba})},setEmbedColumns(I,O,re){var ne,ce;if(K(I))return;const ue=on(I,O,{dbAttrs:re}),z=(ne=o.logical.entities.find(N=>N.modelId===I))==null?void 0:ne.attributes.find(N=>N.modelId===O),U=(ce=z==null?void 0:z.embedded)==null?void 0:ce.associationRef,k=U?o.logical.associations.find(N=>N.modelId===U):void 0,F=[];k&&U&&(k.end1.legacyEmbedRaw&&F.push(Mn(U,"end1",{legacyEmbedRaw:void 0})),k.end2.legacyEmbedRaw&&F.push(Mn(U,"end2",{legacyEmbedRaw:void 0}))),D(F.length?Ye("임베드 컬럼 수정",[ue,...F]):ue)},removeAttribute(I,O){if(K(I))return;if(hi(o.logical,I,O)){w(uu);return}const re=Tn(I,O),ue=jn(o.logical,I,U=>U.filter(k=>k.modelId!==O)),z=Wn(ue,I);D(z.length?Ye("속성 삭제",[re,...z]):re)},removeAttributes(I,O){var F;if(!O.length||K(I))return;const re=O.filter(ne=>!hi(o.logical,I,ne));if(re.length<O.length&&w(uu),!re.length)return;const ue=re.map(ne=>Tn(I,ne)),z=new Set(re),U=jn(o.logical,I,ne=>ne.filter(ce=>!z.has(ce.modelId))),k=[...ue,...Wn(U,I)];D(k.length===1?k[0]:Ye("속성 삭제",k)),((F=te.value)==null?void 0:F.kind)==="attribute"&&te.value.entityId===I&&(te.value=null)},setAttributeSwatches(I,O,re){O.length&&(O.length===1?D(ri(I,O[0],re)):D(Ye("속성 색상",O.map(ue=>ri(I,ue,re)))))},reorderAttributes(I,O,re){!O.length||K(I)||D(Xa(I,O,re))},addIndex(I,O){K(I)||D(_s(I,O))},updateIndex(I,O,re){K(I)||D(Es(I,O,re))},removeIndex(I,O){K(I)||D(ks(I,O))},addOperation(I,O={}){var k;if(K(I))return O.modelId??"";const re=o.logical.entities.find(F=>F.modelId===I),ue=((k=re==null?void 0:re.operations)==null?void 0:k.length)??0,z=O.modelId??De(),U={modelId:z,name:O.name??`method${ue}`,visibility:O.visibility??"PACKAGE",order:ue,...O};return D(ms(I,U)),z},updateOperation(I,O,re){K(I)||D(ps(I,O,re))},removeOperation(I,O){K(I)||D(hs(I,O))},reorderOperations(I,O,re){!O.length||K(I)||D(ys(I,O,re))},setOperationSwatch(I,O,re){D(gs(I,O,re))},addAssociation(I,O,re,ue){if(K(I)||K(O))return"";const z=De(),U={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:re},end2:{entityRef:O,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},k={...o.logical,associations:[...o.logical.associations,U]},F=co(k,O,De),ne=F.add[0];ne&&(U.end2.attributeRef=ne.modelId);const ce={associationRef:z,waypoints:[],sourceColumnRef:re,targetColumnRef:(ne==null?void 0:ne.modelId)??ue},N=di(U,ce),x=ea(O,F);return D(x.length?Ye("관계 추가",[N,...x]):N),z},addEmbedAssociation(I,O){if(K(I))return;const re=o.logical.entities.find(se=>se.modelId===I),ue=o.logical.entities.find(se=>se.modelId===O);if(!re||!ue||ue.stereotype!=="JPA_EMBEDDABLE")return;const z=De(),U=De(),k=De(),F=re.attributes.reduce((se,Ne)=>Math.max(se,Ne.order),-1)+1,ne=pu(ue),ce=se=>se&&se.charAt(0).toLowerCase()+se.slice(1),N=new Set(re.attributes.map(se=>se.name)),x=ce(ue.name);let ie=x;for(let se=2;N.has(ie);se++)ie=`${x}${se}`;const R={modelId:U,name:ie,type:ue.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:F,dbAttrs:ne,embedded:{associationRef:z,embeddableRef:O}},G={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:k},end2:{entityRef:O,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:U}},P={associationRef:z,waypoints:[],sourceColumnRef:U,targetColumnRef:void 0};return D(Ye("임베드 추가",[At(I,R),di(G,P)])),z},setEmbedCollectionMode(I,O){if(we(I))return;const re=o.logical.associations.find(ce=>ce.modelId===I);if(!re)return;let ue,z;for(const ce of o.logical.entities){const N=ce.attributes.find(x=>{var ie;return((ie=x.embedded)==null?void 0:ie.associationRef)===I&&x.attrType==="EMBED_OWN"});if(N){ue=ce.modelId,z=N;break}}if(!ue||!z)return;const U=z.embedded.embeddableRef,k=re.end2.entityRef===U?"end2":"end1",F=re[k],ne=F.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(O==="COLLECTION"?ne:!ne))if(O==="COLLECTION")D(Ye("임베드 컬렉션 전환",[on(ue,z.modelId,{dbAttrs:[]}),Mn(I,k,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...F.jpa,collectionType:"LIST"}})]));else{const ce=o.logical.entities.find(N=>N.modelId===U);if(!ce)return;D(Ye("임베드 단일 전환",[on(ue,z.modelId,{dbAttrs:pu(ce)}),Mn(I,k,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...F.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(I){if(we(I))return;const O=o.logical.associations.find(k=>k.modelId===I),re=bs(I);if(!O){D(re);return}for(const k of o.logical.entities){const F=k.attributes.find(ne=>{var ce;return((ce=ne.embedded)==null?void 0:ce.associationRef)===I});if(F){D(Ye("임베드 삭제",[re,Tn(k.modelId,F.modelId)]));return}}const ue=O.end2.entityRef,z={...o.logical,associations:o.logical.associations.filter(k=>k.modelId!==I)},U=Ul(z,ue);D(U.length?Ye("관계 삭제",[re,...U]):re)},setAssociationIdentifying(I,O){if(we(I))return;const re=o.logical.associations.find(F=>F.modelId===I),ue=ui(I,{identifying:O});if(!re||re.identifying===O){D(ue);return}const z=re.end2.entityRef,U={...o.logical,associations:o.logical.associations.map(F=>F.modelId===I?{...F,identifying:O}:F)},k=Ul(U,z);D(k.length?Ye("식별 관계 변경",[ue,...k]):ue)},updateAssociationEnd(I,O,re){we(I)||D(Mn(I,O,re))},moveWaypoint(I,O,re){D(ws(I,O,re))},addWaypoint(I,O,re){D(Is(I,O,re))},removeWaypoint(I,O){D(vs(I,O))},clearWaypoints(I){D($s(I))},addNote(I="메모",O={x:80,y:80}){const re=De();return D(Ss({modelId:re,memo:I,geo:{location:{...O},size:{width:200,height:120}}})),re},removeNote(I){D(xs(I))},moveNote(I,O){D(so(I,O))},resizeNote(I,O){D(Cs(I,O))},setNoteMemo(I,O){D(Rs(I,O))},setNoteSwatch(I,O){D(Vs(I,O))},addNoteConnection(I,O){D(Ms(I,O))},removeNoteConnection(I,O){D(Bs(I,O))},moveNoteConnectionWaypoint(I,O,re,ue){D(Os(I,O,re,ue))},addNoteConnectionWaypoint(I,O,re,ue){D(Ds(I,O,re,ue))},removeNoteConnectionWaypoint(I,O,re){D(Ls(I,O,re))},clearNoteConnectionWaypoints(I,O){D(Ps(I,O))},autoLayout(){const I=br(o.logical,o.layout);I.length&&D(Ye("자동 배치",I.map(O=>An(O.id,O.location))))},copy(){const I=te.value;if((I==null?void 0:I.kind)==="attribute"){const U=o.logical.entities.find(F=>F.modelId===I.entityId);if(!U)return;const k=[...U.attributes].sort((F,ne)=>F.order-ne.order).filter(F=>I.ids.includes(F.modelId));if(!k.length)return;de.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:k}));return}const O=le.value;if(!O)return;const re=o.logical.entities.find(U=>U.modelId===O),ue=o.layout.entityLayouts.find(U=>U.entityRef===O);if(!re)return;const z=(ue==null?void 0:ue.geo)??{location:{x:80,y:80},size:{width:220,height:140}};de.value=JSON.parse(JSON.stringify({kind:"entity",entity:re,geo:z}))},paste(){if(!_.value)return;const I=de.value;if(!I)return;if(I.kind==="attribute"){const ue=le.value;if(!ue)return;const z=o.logical.entities.find(N=>N.modelId===ue);if(!z)return;const U=new Set(z.attributes.map(N=>N.name)),k=new Set(z.attributes.flatMap(N=>N.dbAttrs.map(x=>x.physicalName))),F=z.attributes.length,ne=[],ce=I.attributes.map((N,x)=>{const ie=JSON.parse(JSON.stringify(N));ie.modelId=De();for(const R of ie.dbAttrs)R.modelId=De();U.has(ie.name)&&(ie.name=`${ie.name}_copy`);for(const R of ie.dbAttrs)R.physicalName&&k.has(R.physicalName)&&(R.physicalName=`${R.physicalName}_copy`);return ie.order=F+x,ne.push(ie.modelId),At(ue,ie)});D(ce.length===1?ce[0]:Ye("속성 붙여넣기",ce)),te.value={kind:"attribute",entityId:ue,ids:ne,anchor:ne[ne.length-1]};return}const O=xk(I.entity),re={location:{x:I.geo.location.x+40,y:I.geo.location.y+40},size:{...I.geo.size}};D(li(O,re)),te.value={kind:"entity",id:O.modelId}},importEntities(I,O,re){if(!_.value)return;const ue=Yr(I,O,{existing:o.logical,includeRelated:re==null?void 0:re.includeRelated});if(ue.logical.entities.length===0)return;const z=Rk(o.layout,ue.layout),U=new Map(ue.layout.entityLayouts.map(N=>[N.entityRef,N])),k=new Map(ue.layout.associationLayouts.map(N=>[N.associationRef,N])),F=new Map(ue.layout.groupLayouts.map(N=>[N.groupRef,N])),ne=[];let ce=80;for(const N of ue.logical.entities){const x=U.get(N.modelId),ie=x?{location:zl(x.geo.location,z),size:{...x.geo.size}}:{location:{x:ce+=40,y:80},size:{width:220,height:140}};let R;if(x){const{entityRef:G,geo:P,locked:se,...Ne}=x;R=Ne}ne.push(li(N,ie,R))}for(const N of ue.logical.associations){const x=k.get(N.modelId),ie=x?{...x,waypoints:x.waypoints.map(R=>zl(R,z))}:{associationRef:N.modelId,waypoints:[]};ne.push(di(N,ie))}for(const N of ue.logical.groups){const x=F.get(N.modelId),ie=x?{location:zl(x.geo.location,z),size:{...x.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let R;if(x){const{groupRef:G,geo:P,locked:se,memberNoteRefs:Ne,...fe}=x;R=fe}ne.push(si(N,ie,R))}D(Ye("다이어그램 가져오기",ne)),te.value={kind:"entity",id:ue.logical.entities[0].modelId}}};return Ae}const ta=Symbol("groupHover"),hu=Symbol("groupDrag"),Kn=Symbol("relationHighlight"),Mk={key:0,class:"em-sel","aria-hidden":"true"},Bk=["title","aria-expanded","disabled"],Ok={class:"em-entity__stereotype"},Dk={key:1,class:"em-entity__name"},Lk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Pk=["onPointerdown"],zk={key:1,class:"em-entity__divider-label"},Uk=["title"],Fk={class:"em-key-slot"},Hk={class:"em-key-slot"},Gk={key:0,class:"em-entity__type"},Yk=["onClick"],jk={class:"em-entity__attrname"},Wk={class:"em-entity__type"},Kk=["data-op"],qk=["onPointerdown"],Xk={class:"em-entity__op-vis","aria-hidden":"true"},Zk=["title"],Jk={key:4,class:"em-entity__footer"},yu=ze(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(gn,null),i=ae.useModal();function a(){o&&Qi(i,o,t.id)}const l=n.inject(ta,null),r=n.inject(Kn,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)),m=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="entity"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>{var k;return o&&((k=o.selectedAttr.value)==null?void 0:k.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),g=n.computed(()=>b.value.size>0);function E(k,F){const ne=F.shiftKey?"range":F.metaKey||F.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,k.modelId,ne)}const $=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!p.value),h=n.computed(()=>t.data.entity),w=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),X=n.computed(()=>t.data.collapsed??!1),B=n.computed(()=>t.data.locked??!1);function H(){s.value&&(o==null||o.setEntityCollapsed(t.id,!X.value))}const A=n.computed(()=>w.value==="PHYSICAL"||w.value==="LOGICAL_PHYSICAL"),S=n.computed(()=>{const k=w.value==="PHYSICAL"||w.value==="LOGICAL_PHYSICAL",F={};for(const ne of h.value.attributes){const ce=ne.attrType.startsWith("RELATION")&&ne.dbAttrs.length>0;F[ne.modelId]={pk:ne.identifier,fk:ce&&k,required:ne.notNull&&!ne.identifier}}return F});function L(k){if(!k)return"";const F=[];return k.pk&&k.fk?F.push("PFK (식별 외래키)"):k.pk?F.push("PK (기본키)"):k.fk&&F.push("FK (외래키)"),k.required&&F.push("필수 (NOT NULL)"),F.join(" · ")}const ee=n.computed(()=>{const k=Dl(at(t.data.style)),F={};return k&&(F["--em-header-bg"]=k.bar,F["--em-header-fg"]=k.barOn),F});function M(k){var F,ne;return(ne=Dl(at((F=t.data.attributeStyles)==null?void 0:F[k.modelId])))==null?void 0:ne.text}const oe=n.computed(()=>[...h.value.operations??[]].sort((k,F)=>k.order-F.order)),_=n.computed(()=>w.value==="CLASS"&&oe.value.length>0),Y={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function T(k){return k?Y[k]:"~"}function W(k){var F,ne;return(ne=Dl(at((F=t.data.operationStyles)==null?void 0:F[k.modelId])))==null?void 0:ne.text}function Q(k,F,ne){switch(w.value){case"CLASS":return[{text:k}];case"PHYSICAL":return[{text:ne||k}];case"LOGICAL":return[F?{text:F}:{text:"(논리명)",missing:!0}];default:{const ce=F?{text:F}:{text:"(논리명)",missing:!0};return ne?[ce,{text:` · ${ne}`}]:[ce]}}}function te(k){var F,ne,ce;return C(k)?[{text:k.name}]:Q(k.name,(ne=(F=k.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko,((ce=k.dbAttrs[0])==null?void 0:ce.physicalName)??"")}function C(k){return k.attrType.startsWith("EMBED")&&k.dbAttrs.length>0}function Z(k){return k.attrType==="DIVIDER"}function le(k){if(k.attrType!=="EMBED_PREDEF")return k.dbAttrs;const F=o==null?void 0:o.embeddableCatalog.value.find(ce=>ce.type===k.type);if(!F)return k.dbAttrs;const ne=Qt(In(h.value,(o==null?void 0:o.state.logical.entities)??[]));return k.dbAttrs.map((ce,N)=>{const x=F.fields[N],ie=Sn(ce,ne);return ie?{...ce,physicalName:ie.physicalName,logicalName:ce.logicalName??(x==null?void 0:x.logicalName),dataType:ce.dataType||(x==null?void 0:x.dataType)||""}:x?{...ce,physicalName:ce.physicalName||x.physicalName,logicalName:ce.logicalName??x.logicalName,dataType:ce.dataType||x.dataType,length:ce.length??x.length}:ce})}function pe(k){var F;return Q(k.physicalName,(F=k.logicalName)==null?void 0:F.ko,k.physicalName)}function be(k){const F=Oa(k,(o==null?void 0:o.state.logical.associations)??[]);return Da(w.value,k,F)}const de=n.computed(()=>{var k,F,ne;return Q(h.value.name,(F=(k=h.value.table)==null?void 0:k.logicalName)==null?void 0:F.ko,((ne=h.value.table)==null?void 0:ne.physicalName)??"")}),me=n.ref(!1),ye=n.ref(""),ve=n.ref(null);async function Ce(){var k,F;s.value&&(ye.value=h.value.name,me.value=!0,await n.nextTick(),(k=ve.value)==null||k.focus(),(F=ve.value)==null||F.select())}function Se(){if(!me.value)return;me.value=!1;const k=ye.value.trim();k&&k!==h.value.name&&(o==null||o.renameEntity(t.id,k))}function ge(){o==null||o.addAttribute(t.id)}function J(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:q,findNode:v}=Pe(),V=n.ref(null),j=n.computed(()=>{const k=V.value??t.data.size;return k?{width:`${k.width}px`,minHeight:`${k.height}px`}:void 0});let D=null;function K(k){var ce,N,x;if(!s.value)return;k.stopPropagation();const F=(ce=v(t.id))==null?void 0:ce.dimensions,ne=q({x:k.clientX,y:k.clientY});D={fx:ne.x,fy:ne.y,w:(F==null?void 0:F.width)??((N=t.data.size)==null?void 0:N.width)??200,h:(F==null?void 0:F.height)??((x=t.data.size)==null?void 0:x.height)??120},k.target.setPointerCapture(k.pointerId)}function he(k){if(!D)return;const F=q({x:k.clientX,y:k.clientY});V.value={width:Math.max(40,D.w+(F.x-D.fx)),height:Math.max(40,D.h+(F.y-D.fy))}}function we(k){var F,ne,ce;if(D&&V.value&&o){const N=(F=v(t.id))==null?void 0:F.dimensions;o.resizeEntity(t.id,{width:Math.round((N==null?void 0:N.width)??V.value.width),height:Math.round((N==null?void 0:N.height)??V.value.height)})}D=null,V.value=null,(ce=(ne=k.target).releasePointerCapture)==null||ce.call(ne,k.pointerId)}const $e=n.ref(null),ke=n.ref(null);function Re(k,F){if(!s.value)return;F.stopPropagation(),F.preventDefault();const ne=b.value,ce=ne.has(k.modelId)?new Set(ne):new Set([k.modelId]);ke.value={ids:ce,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId)}function Ae(k){if(!ke.value||!$e.value)return;const F=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!F.length)return;let ne=F.length;for(let x=0;x<F.length;x++){const ie=F[x].getBoundingClientRect();if(k.clientY<ie.top+ie.height/2){ne=x;break}}const ce=F[F.length-1],N=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;ke.value={...ke.value,dropIndex:ne,lineY:N}}function Oe(){const k=ke.value;if(ke.value=null,!k||k.dropIndex<0)return;const F=h.value.attributes,ne=F.filter(R=>k.ids.has(R.modelId)).map(R=>R.modelId),ce=F.filter((R,G)=>k.ids.has(R.modelId)&&G<k.dropIndex).length,N=k.dropIndex-ce,x=F.filter(R=>!k.ids.has(R.modelId)).map(R=>R.modelId);[...x.slice(0,N),...ne,...x.slice(N)].join(",")!==F.map(R=>R.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,ne,N))}function We(){ke.value=null}const I=n.ref(null),O=n.ref(null);function re(k,F){s.value&&(F.stopPropagation(),F.preventDefault(),O.value={id:k.modelId,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId))}function ue(k){if(!O.value||!I.value)return;const F=Array.from(I.value.querySelectorAll(".em-entity__op-row"));if(!F.length)return;let ne=F.length;for(let x=0;x<F.length;x++){const ie=F[x].getBoundingClientRect();if(k.clientY<ie.top+ie.height/2){ne=x;break}}const ce=F[F.length-1],N=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;O.value={...O.value,dropIndex:ne,lineY:N}}function z(){const k=O.value;if(O.value=null,!k||k.dropIndex<0)return;const ne=oe.value.findIndex(N=>N.modelId===k.id);if(ne<0)return;const ce=k.dropIndex-(ne<k.dropIndex?1:0);ce!==ne&&(o==null||o.reorderOperations(t.id,[k.id],ce))}function U(){O.value=null}return(k,F)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":m.value,"is-dimmed":$.value,"is-selected":p.value,"is-multi-selected":y.value,"has-focused-attr":g.value,"is-locked":B.value}]),style:n.normalizeStyle(j.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[p.value?(n.openBlock(),n.createElementBlock("div",Mk,[...F[7]||(F[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(ee.value),onDblclick:n.withModifiers(Ce,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:X.value?"펼치기":"접기","aria-expanded":!X.value,disabled:!s.value,onClick:n.withModifiers(H,["stop"]),onPointerdown:F[0]||(F[0]=n.withModifiers(()=>{},["stop"])),onDblclick:F[1]||(F[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(X.value?"▸":"▾"),41,Bk),n.createElementVNode("span",Ok,"«"+n.toDisplayString(h.value.stereotype)+"»",1),me.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ve,"onUpdate:modelValue":F[2]||(F[2]=ne=>ye.value=ne),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Se,["enter"]),F[3]||(F[3]=n.withKeys(ne=>me.value=!1,["esc"]))],onBlur:Se,onPointerdown:F[4]||(F[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",Dk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(de.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("span",{key:ce,class:n.normalizeClass({"em-entity__missing":ne.missing})},n.toDisplayString(ne.text),3))),128))])),B.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),X.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[ke.value&&ke.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ke.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.attributes,ne=>{var ce,N,x,ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ne.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(ne.modelId),"is-dragging":(ce=ke.value)==null?void 0:ce.ids.has(ne.modelId),"is-embed":C(ne),"is-divider":Z(ne),nodrag:Z(ne)&&s.value}]),"data-attr":ne.modelId,onClick:n.withModifiers(R=>E(ne,R),["stop"]),onPointerdown:R=>Z(ne)?Re(ne,R):void 0,onPointermove:R=>Z(ne)?Ae(R):void 0,onPointerup:R=>Z(ne)?Oe():void 0,onPointercancel:R=>Z(ne)?We():void 0},[s.value&&!Z(ne)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:R=>Re(ne,R),onPointermove:Ae,onPointerup:Oe,onPointercancel:We,onClick:F[5]||(F[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Pk)):n.createCommentVNode("",!0),Z(ne)?(n.openBlock(),n.createElementBlock("span",zk,n.toDisplayString(ne.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(mn),{id:`l:${ne.modelId}`,type:"target",position:n.unref(xe).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:L(S.value[ne.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Fk,[(N=S.value[ne.modelId])!=null&&N.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(x=S.value[ne.modelId])!=null&&x.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Hk,[C(ne)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(ie=S.value[ne.modelId])!=null&&ie.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Uk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:M(ne)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te(ne),(R,G)=>(n.openBlock(),n.createElementBlock("span",{key:G,class:n.normalizeClass({"em-entity__missing":R.missing})},n.toDisplayString(R.text),3))),128))],4),be(ne)?(n.openBlock(),n.createElementBlock("span",Gk,n.toDisplayString(be(ne)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(mn),{id:`r:${ne.modelId}`,type:"source",position:n.unref(xe).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Lk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C(ne)&&A.value?le(ne):[],R=>(n.openBlock(),n.createElementBlock("li",{key:`${ne.modelId}:${R.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(ne.modelId)}]),onClick:n.withModifiers(G=>E(ne,G),["stop"])},[F[8]||(F[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",jk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(R),(G,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":G.missing})},n.toDisplayString(G.text),3))),128))]),n.createElementVNode("span",Wk,n.toDisplayString(R.dataType),1)],10,Yk))),128))],64)}),128))],512)),!X.value&&_.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:I,class:"em-entity__ops"},[O.value&&O.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${O.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,ne=>{var ce;return n.openBlock(),n.createElementBlock("li",{key:ne.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ce=O.value)==null?void 0:ce.id)===ne.modelId}]),"data-op":ne.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:N=>re(ne,N),onPointermove:ue,onPointerup:z,onPointercancel:U,onClick:F[6]||(F[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,qk)):n.createCommentVNode("",!0),n.createElementVNode("span",Xk,n.toDisplayString(T(ne.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:W(ne)})},n.toDisplayString(ne.name)+"()",5)],10,Kk)}),128))],512)):oe.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${oe.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(oe.value.length)+"개",1)],8,Zk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Jk,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ge},"+ 속성"),F[9]||(F[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:J},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!me.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:K,onPointermove:he,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),Qk={key:0,class:"em-sel","aria-hidden":"true"},ew={class:"em-group__label"},tw={class:"em-group__name"},nw={key:0,class:"em-group__pkg"},ow={key:1,class:"em-group__flag"},gu=ze(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>at(t.data.style)),l=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),r=n.inject(gn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var S;return!!t.id&&((S=r==null?void 0:r.selection.value)==null?void 0:S.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(ta,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),m=n.inject(Kn,null);function p(){t.id&&(m==null||m.setGroupHover(t.id))}function y(){m==null||m.setGroupHover(null)}const b=n.computed(()=>!!m&&m.hoverGroupId.value===t.id),g=n.computed(()=>!!m&&m.hoverGroupId.value!==null&&m.hoverGroupId.value!==t.id),{screenToFlowCoordinate:E,findNode:$}=Pe();let h=null,w=null;function X(S){var M;if(!t.id||!s.value)return;S.stopPropagation();const L=((M=$(t.id))==null?void 0:M.dimensions)??{width:400,height:300},ee=E({x:S.clientX,y:S.clientY});h={fx:ee.x,fy:ee.y,w:L.width,h:L.height},S.target.setPointerCapture(S.pointerId)}function B(S){if(!h||!t.id)return;const L=E({x:S.clientX,y:S.clientY});w={width:Math.max(160,h.w+(L.x-h.fx)),height:Math.max(120,h.h+(L.y-h.fy))};const ee=$(t.id);ee&&(ee.style={width:`${w.width}px`,height:`${w.height}px`})}function H(S){var L,ee;h&&w&&t.id&&r&&r.resizeGroup(t.id,w),h=null,w=null,(ee=(L=S.target).releasePointerCapture)==null||ee.call(L,S.pointerId)}const A=n.computed(()=>{const S=o.value.name;return(S==null?void 0:S.ko)||(S==null?void 0:S.en)||(S==null?void 0:S.ja)||(S==null?void 0:S.zh)||o.value.packageName||"그룹"});return(S,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":b.value,"is-dimmed":g.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:y},[c.value?(n.openBlock(),n.createElementBlock("div",Qk,[...L[0]||(L[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",ew,[n.createElementVNode("span",tw,n.toDisplayString(A.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",nw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",ow,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)]),s.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:X,onPointermove:B,onPointerup:H},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),iw={key:0,class:"em-sel","aria-hidden":"true"},aw={key:2,class:"em-note__text"},bu=ze(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(gn,null),i=n.inject(ta,null),a=n.inject(Kn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>at(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 m=n.computed(()=>{var _;return((_=a==null?void 0:a.source.value)==null?void 0:_.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!m.value),y=n.computed(()=>{var _;return((_=o==null?void 0:o.selection.value)==null?void 0:_.kind)==="note"&&o.selection.value.id===t.id}),b=n.computed(()=>!!t.selected&&!y.value),g=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.value),E=[{id:"n-top",pos:xe.Top},{id:"n-right",pos:xe.Right},{id:"n-bottom",pos:xe.Bottom},{id:"n-left",pos:xe.Left}],$=n.ref(!1),h=n.ref(""),w=n.ref(null);async function X(){var _;r.value&&(h.value=l.value.memo,$.value=!0,await n.nextTick(),(_=w.value)==null||_.focus())}function B(){$.value&&($.value=!1,h.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:H,findNode:A}=Pe();let S=null,L=null;function ee(_){var W;if(!r.value)return;_.stopPropagation();const Y=((W=A(t.id))==null?void 0:W.dimensions)??l.value.geo.size,T=H({x:_.clientX,y:_.clientY});S={fx:T.x,fy:T.y,w:Y.width,h:Y.height},_.target.setPointerCapture(_.pointerId)}function M(_){if(!S)return;const Y=H({x:_.clientX,y:_.clientY});L={width:Math.max(140,S.w+(Y.x-S.fx)),height:Math.max(60,S.h+(Y.y-S.fy))};const T=A(t.id);T&&(T.style={width:`${L.width}px`,height:`${L.height}px`})}function oe(_){var Y,T;S&&L&&o&&o.resizeNote(t.id,L),S=null,L=null,(T=(Y=_.target).releasePointerCapture)==null||T.call(Y,_.pointerId)}return(_,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":m.value,"is-related":p.value,"is-dimmed":g.value,"is-selected":y.value,"is-multi-selected":b.value}]),style:n.normalizeStyle(c.value),onDblclick:X,onPointerdown:d,onMouseenter:u,onMouseleave:f},[y.value?(n.openBlock(),n.createElementBlock("div",iw,[...Y[4]||(Y[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),$.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:w,"onUpdate:modelValue":Y[0]||(Y[0]=T=>h.value=T),class:"em-note__edit nodrag",onBlur:B,onKeydown:Y[1]||(Y[1]=n.withKeys(T=>$.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",aw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(E,T=>n.createVNode(n.unref(mn),{id:T.id,key:T.id,type:"source",position:T.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!$.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ee,onPointermove:M,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),lw=20,rw=22,sw=7,cw=22,_u=31,Eu=7,dw=20,ku=11,wu=11,uw=_u+Eu;function fw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function mw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function na(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 vu(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function oa(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Nu(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:vu(e,t);return[oa(o,a,l-Math.PI/2),oa(o,a,l+Math.PI/2)]}function $u(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 Iu(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=na(e,t,lw),[d,u]=Nu(e,t,c,rw);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}),fw(o.multiplicity)){const f=na(e,t,_u);l.push({cx:f.x,cy:f.y,r:Eu})}if(mw(o.multiplicity)){const f=na(e,t,sw),[m,p]=Nu(e,t,f,cw);a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:a,circles:l,polygons:r}}let s=e;if(o.composition){const c=na(e,t,dw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=vu(e,t),f=oa(d,ku/2,u-Math.PI/2),m=oa(d,ku/2,u+Math.PI/2);r.push({points:[e,f,c,m]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=$u(s,c,wu,!0),u=$u(s,c,wu,!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 Su=200,xu=120,Fl=24;function Cu(e){var a,l;if(!e)return{x:0,y:0,width:Su,height:xu};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Su,i=((l=e.dimensions)==null?void 0:l.height)||xu;return{x:t.x,y:t.y,width:o,height:i}}function Ru(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vu(e){const t=n.computed(()=>Cu(e.sourceNode())),o=n.computed(()=>Cu(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,y;const d=t.value,u=d.x+d.width;let f=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,m=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(m-f)<Fl){const b=(f+m)/2;f=b-Fl/2,m=b+Fl/2}return{source:{x:u,y:f},target:{x:u,y:m}}}),l=n.computed(()=>e.waypoints()[0]??Ru(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Ru(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?xa(t.value,d,l.value.x):Sa(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?xa(o.value,d,r.value.x):Sa(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 Hl=Symbol("waypointController"),pw=["d"],hw=["d"],yw=["d"],gw=["x1","y1","x2","y2"],bw=["cx","cy","r"],_w=["x","y"],Ew=["x","y"],kw=["cx","cy","onDblclick"],ww=["x","y","onPointerdown","onDblclick"],Au=ze(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Hl),a=n.inject(gn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(hu,null),s=n.inject(Kn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var ge;return((ge=a==null?void 0:a.selection.value)==null?void 0:ge.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 ge=r==null?void 0:r.value;if(!ge||!a)return null;const J=a.resolved.value.entities,q=V=>{var j;return(j=J.find(D=>D.entity.modelId===V))==null?void 0:j.groupRef},v=t.data.association;return q(v.end1.entityRef)===ge.groupId&&q(v.end2.entityRef)===ge.groupId?{dx:ge.dx,dy:ge.dy}:null}),m=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),y=n.ref({x:0,y:0}),b=n.computed(()=>{const ge=f.value;return m.value.map((J,q)=>q===p.value?y.value:ge?{x:J.x+ge.dx,y:J.y+ge.dy}:J)}),g=n.computed(()=>{var ge;return!!((ge=t.sourceNode.data)!=null&&ge.collapsed)}),E=n.computed(()=>{var ge;return!!((ge=t.targetNode.data)!=null&&ge.collapsed)}),{source:$,target:h,sourceSide:w,targetSide:X,isSelf:B}=Vu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>b.value,sourceRowY:()=>t.data.sourceColumnRef&&!g.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!E.value?t.targetY:void 0}),H=uw+4,A=n.computed(()=>B.value?gr($.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Na($.value,w.value,b.value,h.value,X.value,H):Ia($.value,b.value,h.value)),S=n.computed(()=>B.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?$a($.value,w.value,b.value,h.value,X.value,H):Ca($.value,b.value,h.value).map((ge,J)=>({point:ge,segIndex:J}))),L=n.computed(()=>B.value||!l.value?[]:b.value);function ee(ge){switch(ge){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 M(ge,J){p.value=ge,y.value={...m.value[ge]},J.target.setPointerCapture(J.pointerId),J.stopPropagation()}function oe(ge){if(p.value<0)return;const J=o({x:ge.clientX,y:ge.clientY});y.value={x:J.x,y:J.y}}function _(ge){var J,q;p.value>=0&&i&&i.movePoint(t.id,p.value,{...y.value}),p.value=-1,(q=(J=ge.target).releasePointerCapture)==null||q.call(J,ge.pointerId)}function Y(ge,J){J.stopPropagation(),i==null||i.removePoint(t.id,ge)}function T(ge,J){if(!i)return;const q=o({x:J.clientX,y:J.clientY});i.insertPoint(t.id,ge,{x:q.x,y:q.y})}const W=n.computed(()=>ee(t.data.association.end1.multiplicity)),Q=n.computed(()=>ee(t.data.association.end2.multiplicity)),te=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),C=n.computed(()=>te.value==="class"),Z=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ge=Qn(w.value);return{x:$.value.x+ge.x*10,y:$.value.y+ge.y*10}}return b.value[0]??h.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const J=Qn(X.value);return{x:h.value.x+J.x*10,y:h.value.y+J.y*10}}const ge=b.value;return ge[ge.length-1]??$.value}),pe=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end1.multiplicity,navigable:ge.end1.navigable,composition:ge.end1.composition,otherNavigable:ge.end2.navigable}}),be=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end2.multiplicity,navigable:ge.end2.navigable,composition:ge.end2.composition,otherNavigable:ge.end1.navigable}}),de=n.computed(()=>Iu($.value,Z.value,pe.value,te.value)),me=n.computed(()=>Iu(h.value,le.value,be.value,te.value)),ye=n.computed(()=>[...de.value.lines,...me.value.lines]),ve=n.computed(()=>[...de.value.circles,...me.value.circles]),Ce=n.computed(()=>[...de.value.polygons,...me.value.polygons].map(ge=>`M${ge.points.map(J=>`${J.x},${J.y}`).join(" L")} Z`)),Se=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ge,J)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:A.value,fill:"none",class:"em-edge__hit"},null,8,pw),n.createElementVNode("path",{d:A.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,hw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ce.value,(q,v)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${v}`,d:q,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Se.value])},null,10,yw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.value,(q,v)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${v}`,x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,gw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(q,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${v}`,cx:q.cx,cy:q.cy,r:q.r,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,bw))),128)),C.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref($).x+8,y:n.unref($).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,_w),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(Q.value),11,Ew)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S.value,(q,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${v}`,cx:q.point.x,cy:q.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(V=>T(q.segIndex,V),["stop"])},null,42,kw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(L.value,(q,v)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${v}`,x:q.x-5,y:q.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:V=>M(v,V),onPointermove:oe,onPointerup:_,onDblclick:V=>Y(v,V)},null,42,ww))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Lt=(e=>(e.Lines="lines",e.Dots="dots",e))(Lt||{});const Tu=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]}`})},Mu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Lt.Lines+"",Lt.Dots+"";const vw={[Lt.Dots]:"#81818a",[Lt.Lines]:"#eee"},Nw=["id","x","y","width","height","patternTransform"],$w={key:2,height:"100",width:"100"},Iw=["fill"],Sw=["x","y","fill"],xw={name:"Background",compatConfig:{MODE:3}},Cw=n.defineComponent({...xw,props:{id:{},variant:{default:()=>Lt.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}=Pe(),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,m]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[f*r||1+d[0]/2,m*r||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),l=n.toRef(()=>e.color||e.patternColor||vw[e.variant||Lt.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(Lt).Lines?(n.openBlock(),n.createBlock(n.unref(Tu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Lt).Dots?(n.openBlock(),n.createBlock(n.unref(Mu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",$w,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Iw)])):n.createCommentVNode("",!0)])],8,Nw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Sw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Rw={name:"ControlButton",compatConfig:{MODE:3}},Vw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Aw={type:"button",class:"vue-flow__controls-button"};function Tw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Aw,[n.renderSlot(e.$slots,"default")])}const bn=Vw(Rw,[["render",Tw]]),Mw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Bw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Ow(e,t){return n.openBlock(),n.createElementBlock("svg",Mw,Bw)}const Dw={render:Ow},Lw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Pw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function zw(e,t){return n.openBlock(),n.createElementBlock("svg",Lw,Pw)}const Uw={render:zw},Fw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Hw=[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 Gw(e,t){return n.openBlock(),n.createElementBlock("svg",Fw,Hw)}const Yw={render:Gw},jw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Ww=[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 Kw(e,t){return n.openBlock(),n.createElementBlock("svg",jw,Ww)}const qw={render:Kw},Xw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Zw=[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 Jw(e,t){return n.openBlock(),n.createElementBlock("svg",Xw,Zw)}const Qw={render:Jw},ev={name:"Controls",compatConfig:{MODE:3}},tv=n.defineComponent({...ev,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>ld.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}=Pe(),m=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=f.value);function b(){r(),t("zoomIn")}function g(){s(),t("zoomOut")}function E(){c(e.fitViewParams),t("fitView")}function $(){l(!m.value),t("interactionChange",!m.value)}return(h,w)=>(n.openBlock(),n.createBlock(n.unref(iu),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(bn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Dw))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(bn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Uw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(bn,{class:"vue-flow__controls-fitview",onClick:E},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Yw))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(bn,{key:0,class:"vue-flow__controls-interactive",onClick:$},{default:n.withCtx(()=>[m.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Qw))))]):n.createCommentVNode("",!0),m.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(qw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var nv={value:()=>{}};function Gl(){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 ia(o)}function ia(e){this._=e}function ov(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}})}ia.prototype=Gl.prototype={constructor:ia,on:function(e,t){var o=this._,i=ov(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=iv(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]=Bu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Bu(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 ia(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 iv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Bu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=nv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Yl="http://www.w3.org/1999/xhtml";const Ou={svg:"http://www.w3.org/2000/svg",xhtml:Yl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function aa(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ou.hasOwnProperty(t)?{space:Ou[t],local:e}:e}function av(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Yl&&t.documentElement.namespaceURI===Yl?t.createElement(e):t.createElementNS(o,e)}}function lv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Du(e){var t=aa(e);return(t.local?lv:av)(t)}function rv(){}function jl(e){return e==null?rv:function(){return this.querySelector(e)}}function sv(e){typeof e!="function"&&(e=jl(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 ft(i,this._parents)}function cv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dv(){return[]}function Lu(e){return e==null?dv:function(){return this.querySelectorAll(e)}}function uv(e){return function(){return cv(e.apply(this,arguments))}}function fv(e){typeof e=="function"?e=uv(e):e=Lu(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 ft(i,a)}function Pu(e){return function(){return this.matches(e)}}function zu(e){return function(t){return t.matches(e)}}var mv=Array.prototype.find;function pv(e){return function(){return mv.call(this.children,e)}}function hv(){return this.firstElementChild}function yv(e){return this.select(e==null?hv:pv(typeof e=="function"?e:zu(e)))}var gv=Array.prototype.filter;function bv(){return Array.from(this.children)}function _v(e){return function(){return gv.call(this.children,e)}}function Ev(e){return this.selectAll(e==null?bv:_v(typeof e=="function"?e:zu(e)))}function kv(e){typeof e!="function"&&(e=Pu(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 ft(i,this._parents)}function Uu(e){return new Array(e.length)}function wv(){return new ft(this._enter||this._groups.map(Uu),this._parents)}function la(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}la.prototype={constructor:la,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 vv(e){return function(){return e}}function Nv(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 la(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function $v(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,m=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(m[s]=p=r.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<f;++s)p=r.call(e,l[s],s,l)+"",(c=d.get(p))?(i[s]=c,c.__data__=l[s],d.delete(p)):o[s]=new la(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(m[s])===c&&(a[s]=c)}function Iv(e){return e.__data__}function Sv(e,t){if(!arguments.length)return Array.from(this,Iv);var o=t?$v:Nv,i=this._parents,a=this._groups;typeof e!="function"&&(e=vv(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],m=f.length,p=xv(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),g=r[d]=new Array(y),E=c[d]=new Array(m);o(u,f,b,g,E,p,t);for(var $=0,h=0,w,X;$<y;++$)if(w=b[$]){for($>=h&&(h=$+1);!(X=g[h])&&++h<y;);w._next=X||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function xv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cv(){return new ft(this._exit||this._groups.map(Uu),this._parents)}function Rv(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 Vv(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,m=s[c]=new Array(f),p,y=0;y<f;++y)(p=d[y]||u[y])&&(m[y]=p);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function Av(){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 Tv(e){e||(e=Mv);function t(f,m){return f&&m?e(f.__data__,m.__data__):!f-!m}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 ft(a,this._parents).order()}function Mv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Bv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ov(){return Array.from(this)}function Dv(){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 Lv(){let e=0;for(const t of this)++e;return e}function Pv(){return!this.node()}function zv(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 Uv(e){return function(){this.removeAttribute(e)}}function Fv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hv(e,t){return function(){this.setAttribute(e,t)}}function Gv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Yv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function jv(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 Wv(e,t){var o=aa(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?Fv:Uv:typeof t=="function"?o.local?jv:Yv:o.local?Gv:Hv)(o,t))}function Fu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Kv(e){return function(){this.style.removeProperty(e)}}function qv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Xv(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Zv(e,t,o){return arguments.length>1?this.each((t==null?Kv:typeof t=="function"?Xv:qv)(e,t,o??"")):qn(this.node(),e)}function qn(e,t){return e.style.getPropertyValue(t)||Fu(e).getComputedStyle(e,null).getPropertyValue(t)}function Jv(e){return function(){delete this[e]}}function Qv(e,t){return function(){this[e]=t}}function eN(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function tN(e,t){return arguments.length>1?this.each((t==null?Jv:typeof t=="function"?eN:Qv)(e,t)):this.node()[e]}function Hu(e){return e.trim().split(/^|\s+/)}function Wl(e){return e.classList||new Gu(e)}function Gu(e){this._node=e,this._names=Hu(e.getAttribute("class")||"")}Gu.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 Yu(e,t){for(var o=Wl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function ju(e,t){for(var o=Wl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function nN(e){return function(){Yu(this,e)}}function oN(e){return function(){ju(this,e)}}function iN(e,t){return function(){(t.apply(this,arguments)?Yu:ju)(this,e)}}function aN(e,t){var o=Hu(e+"");if(arguments.length<2){for(var i=Wl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?iN:t?nN:oN)(o,t))}function lN(){this.textContent=""}function rN(e){return function(){this.textContent=e}}function sN(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cN(e){return arguments.length?this.each(e==null?lN:(typeof e=="function"?sN:rN)(e)):this.node().textContent}function dN(){this.innerHTML=""}function uN(e){return function(){this.innerHTML=e}}function fN(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function mN(e){return arguments.length?this.each(e==null?dN:(typeof e=="function"?fN:uN)(e)):this.node().innerHTML}function pN(){this.nextSibling&&this.parentNode.appendChild(this)}function hN(){return this.each(pN)}function yN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gN(){return this.each(yN)}function bN(e){var t=typeof e=="function"?e:Du(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _N(){return null}function EN(e,t){var o=typeof e=="function"?e:Du(e),i=t==null?_N:typeof t=="function"?t:jl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function kN(){var e=this.parentNode;e&&e.removeChild(this)}function wN(){return this.each(kN)}function vN(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function NN(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $N(e){return this.select(e?NN:vN)}function IN(e){return arguments.length?this.property("__data__",e):this.node().__data__}function SN(e){return function(t){e.call(this,t,this.__data__)}}function xN(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 CN(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 RN(e,t,o){return function(){var i=this.__on,a,l=SN(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 VN(e,t,o){var i=xN(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?RN:CN,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Wu(e,t,o){var i=Fu(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 AN(e,t){return function(){return Wu(this,e,t)}}function TN(e,t){return function(){return Wu(this,e,t.apply(this,arguments))}}function MN(e,t){return this.each((typeof t=="function"?TN:AN)(e,t))}function*BN(){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 Ku=[null];function ft(e,t){this._groups=e,this._parents=t}function Vo(){return new ft([[document.documentElement]],Ku)}function ON(){return this}ft.prototype=Vo.prototype={constructor:ft,select:sv,selectAll:fv,selectChild:yv,selectChildren:Ev,filter:kv,data:Sv,enter:wv,exit:Cv,join:Rv,merge:Vv,selection:ON,order:Av,sort:Tv,call:Bv,nodes:Ov,node:Dv,size:Lv,empty:Pv,each:zv,attr:Wv,style:Zv,property:tN,classed:aN,text:cN,html:mN,raise:hN,lower:gN,append:bN,insert:EN,remove:wN,clone:$N,datum:IN,on:VN,dispatch:MN,[Symbol.iterator]:BN};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],Ku)}function DN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=DN(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 Kl={capture:!0,passive:!1};function ql(e){e.preventDefault(),e.stopImmediatePropagation()}function LN(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",ql,Kl);"onselectstart"in t?o.on("selectstart.drag",ql,Kl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function PN(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",ql,Kl),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 Xl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function qu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Ao(){}var To=.7,ra=1/To,Xn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zN=/^#([0-9a-f]{3,8})$/,UN=new RegExp(`^rgb\\(${Xn},${Xn},${Xn}\\)$`),FN=new RegExp(`^rgb\\(${xt},${xt},${xt}\\)$`),HN=new RegExp(`^rgba\\(${Xn},${Xn},${Xn},${Mo}\\)$`),GN=new RegExp(`^rgba\\(${xt},${xt},${xt},${Mo}\\)$`),YN=new RegExp(`^hsl\\(${Mo},${xt},${xt}\\)$`),jN=new RegExp(`^hsla\\(${Mo},${xt},${xt},${Mo}\\)$`),Xu={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};Xl(Ao,Bo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zu,formatHex:Zu,formatHex8:WN,formatHsl:KN,formatRgb:Ju,toString:Ju});function Zu(){return this.rgb().formatHex()}function WN(){return this.rgb().formatHex8()}function KN(){return of(this).formatHsl()}function Ju(){return this.rgb().formatRgb()}function Bo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=zN.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Qu(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?sa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?sa(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=UN.exec(e))?new ct(t[1],t[2],t[3],1):(t=FN.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HN.exec(e))?sa(t[1],t[2],t[3],t[4]):(t=GN.exec(e))?sa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=YN.exec(e))?nf(t[1],t[2]/100,t[3]/100,1):(t=jN.exec(e))?nf(t[1],t[2]/100,t[3]/100,t[4]):Xu.hasOwnProperty(e)?Qu(Xu[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function Qu(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function sa(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function qN(e){return e instanceof Ao||(e=Bo(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Zl(e,t,o,i){return arguments.length===1?qN(e):new ct(e,t,o,i??1)}function ct(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Xl(ct,Zl,qu(Ao,{brighter(e){return e=e==null?ra:Math.pow(ra,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ct(_n(this.r),_n(this.g),_n(this.b),ca(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:ef,formatHex:ef,formatHex8:XN,formatRgb:tf,toString:tf}));function ef(){return`#${En(this.r)}${En(this.g)}${En(this.b)}`}function XN(){return`#${En(this.r)}${En(this.g)}${En(this.b)}${En((isNaN(this.opacity)?1:this.opacity)*255)}`}function tf(){const e=ca(this.opacity);return`${e===1?"rgb(":"rgba("}${_n(this.r)}, ${_n(this.g)}, ${_n(this.b)}${e===1?")":`, ${e})`}`}function ca(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function En(e){return e=_n(e),(e<16?"0":"")+e.toString(16)}function nf(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,o,i)}function of(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof Ao||(e=Bo(e)),!e)return new bt;if(e instanceof bt)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 bt(r,s,c,e.opacity)}function ZN(e,t,o,i){return arguments.length===1?of(e):new bt(e,t,o,i??1)}function bt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Xl(bt,ZN,qu(Ao,{brighter(e){return e=e==null?ra:Math.pow(ra,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new bt(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 ct(Jl(e>=240?e-240:e+120,a,i),Jl(e,a,i),Jl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(af(this.h),da(this.s),da(this.l),ca(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=ca(this.opacity);return`${e===1?"hsl(":"hsla("}${af(this.h)}, ${da(this.s)*100}%, ${da(this.l)*100}%${e===1?")":`, ${e})`}`}}));function af(e){return e=(e||0)%360,e<0?e+360:e}function da(e){return Math.max(0,Math.min(1,e||0))}function Jl(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 lf=e=>()=>e;function JN(e,t){return function(o){return e+o*t}}function QN(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 e$(e){return(e=+e)==1?rf:function(t,o){return o-t?QN(t,o,e):lf(isNaN(t)?o:t)}}function rf(e,t){var o=t-e;return o?JN(e,o):lf(isNaN(e)?t:e)}const sf=(function e(t){var o=e$(t);function i(a,l){var r=o((a=Zl(a)).r,(l=Zl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=rf(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 Ql=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,er=new RegExp(Ql.source,"g");function t$(e){return function(){return e}}function n$(e){return function(t){return e(t)+""}}function o$(e,t){var o=Ql.lastIndex=er.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Ql.exec(e))&&(a=er.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=er.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?n$(c[0].x):t$(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 cf=180/Math.PI,tr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function df(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)*cf,skewX:Math.atan(c)*cf,scaleX:r,scaleY:s}}var ua;function i$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?tr:df(t.a,t.b,t.c,t.d,t.e,t.f)}function a$(e){return e==null||(ua||(ua=document.createElementNS("http://www.w3.org/2000/svg","g")),ua.setAttribute("transform",e),!(e=ua.transform.baseVal.consolidate()))?tr:(e=e.matrix,df(e.a,e.b,e.c,e.d,e.e,e.f))}function uf(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,m,p,y){if(d!==f||u!==m){var b=p.push("translate(",null,t,null,o);y.push({i:b-4,x:Zt(d,f)},{i:b-2,x:Zt(u,m)})}else(f||m)&&p.push("translate("+f+t+m+o)}function r(d,u,f,m){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),m.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,m){d!==u?m.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,m,p,y){if(d!==f||u!==m){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Zt(d,f)},{i:b-2,x:Zt(u,m)})}else(f!==1||m!==1)&&p.push(a(p)+"scale("+f+","+m+")")}return function(d,u){var f=[],m=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,m),r(d.rotate,u.rotate,f,m),s(d.skewX,u.skewX,f,m),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,m),d=u=null,function(p){for(var y=-1,b=m.length,g;++y<b;)f[(g=m[y]).i]=g.x(p);return f.join("")}}}var l$=uf(i$,"px, ","px)","deg)"),r$=uf(a$,", ",")",")"),s$=1e-12;function ff(e){return((e=Math.exp(e))+1/e)/2}function c$(e){return((e=Math.exp(e))-1/e)/2}function d$(e){return((e=Math.exp(2*e))-1)/(e+1)}const u$=(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],m=r[2],p=u-s,y=f-c,b=p*p+y*y,g,E;if(b<s$)E=Math.log(m/d)/t,g=function(H){return[s+H*p,c+H*y,d*Math.exp(t*H*E)]};else{var $=Math.sqrt(b),h=(m*m-d*d+i*b)/(2*d*o*$),w=(m*m-d*d-i*b)/(2*m*o*$),X=Math.log(Math.sqrt(h*h+1)-h),B=Math.log(Math.sqrt(w*w+1)-w);E=(B-X)/t,g=function(H){var A=H*E,S=ff(X),L=d/(o*$)*(S*d$(t*A+X)-c$(X));return[s+L*p,c+L*y,d*S/ff(t*A+X)]}}return g.duration=E*1e3*t/Math.SQRT2,g}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 Zn=0,Oo=0,Do=0,mf=1e3,fa,Lo,ma=0,kn=0,pa=0,Po=typeof performance=="object"&&performance.now?performance:Date,pf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nr(){return kn||(pf(f$),kn=Po.now()+pa)}function f$(){kn=0}function ha(){this._call=this._time=this._next=null}ha.prototype=hf.prototype={constructor:ha,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?nr():+o)+(t==null?0:+t),!this._next&&Lo!==this&&(Lo?Lo._next=this:fa=this,Lo=this),this._call=e,this._time=o,or()},stop:function(){this._call&&(this._call=null,this._time=1/0,or())}};function hf(e,t,o){var i=new ha;return i.restart(e,t,o),i}function m$(){nr(),++Zn;for(var e=fa,t;e;)(t=kn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Zn}function yf(){kn=(ma=Po.now())+pa,Zn=Oo=0;try{m$()}finally{Zn=0,h$(),kn=0}}function p$(){var e=Po.now(),t=e-ma;t>mf&&(pa-=t,ma=e)}function h$(){for(var e,t=fa,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:fa=o);Lo=e,or(i)}function or(e){if(!Zn){Oo&&(Oo=clearTimeout(Oo));var t=e-kn;t>24?(e<1/0&&(Oo=setTimeout(yf,e-Po.now()-pa)),Do&&(Do=clearInterval(Do))):(Do||(ma=Po.now(),Do=setInterval(p$,mf)),Zn=1,pf(yf))}}function gf(e,t,o){var i=new ha;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var y$=Gl("start","end","cancel","interrupt"),g$=[],bf=0,_f=1,ir=2,ya=3,Ef=4,ar=5,ga=6;function ba(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;b$(e,o,{name:t,index:i,group:a,on:y$,tween:g$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:bf})}function lr(e,t){var o=_t(e,t);if(o.state>bf)throw new Error("too late; already scheduled");return o}function Ct(e,t){var o=_t(e,t);if(o.state>ya)throw new Error("too late; already running");return o}function _t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function b$(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=hf(l,0,o.time);function l(d){o.state=_f,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,m,p;if(o.state!==_f)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===ya)return gf(r);p.state===Ef?(p.state=ga,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=ga,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(gf(function(){o.state===ya&&(o.state=Ef,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ir,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ir){for(o.state=ya,a=new Array(m=o.tween.length),u=0,f=-1;u<m;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++f]=p);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=ar,1),f=-1,m=a.length;++f<m;)a[f].call(e,u);o.state===ar&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ga,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function _a(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>ir&&i.state<ar,i.state=ga,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function _$(e){return this.each(function(){_a(this,e)})}function E$(e,t){var o,i;return function(){var a=Ct(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 k$(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Ct(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 w$(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=_t(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?E$:k$)(o,e,t))}function rr(e,t,o){var i=e._id;return e.each(function(){var a=Ct(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return _t(a,i).value[t]}}function kf(e,t){var o;return(typeof t=="number"?Zt:t instanceof Bo?sf:(o=Bo(t))?(t=o,sf):o$)(e,t)}function v$(e){return function(){this.removeAttribute(e)}}function N$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $$(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 I$(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 S$(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 x$(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 C$(e,t){var o=aa(e),i=o==="transform"?r$:kf;return this.attrTween(e,typeof t=="function"?(o.local?x$:S$)(o,i,rr(this,"attr."+e,t)):t==null?(o.local?N$:v$)(o):(o.local?I$:$$)(o,i,t))}function R$(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function V$(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function A$(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&V$(e,l)),o}return a._value=t,a}function T$(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&R$(e,l)),o}return a._value=t,a}function M$(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=aa(e);return this.tween(o,(i.local?A$:T$)(i,t))}function B$(e,t){return function(){lr(this,e).delay=+t.apply(this,arguments)}}function O$(e,t){return t=+t,function(){lr(this,e).delay=t}}function D$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?B$:O$)(t,e)):_t(this.node(),t).delay}function L$(e,t){return function(){Ct(this,e).duration=+t.apply(this,arguments)}}function P$(e,t){return t=+t,function(){Ct(this,e).duration=t}}function z$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?L$:P$)(t,e)):_t(this.node(),t).duration}function U$(e,t){if(typeof t!="function")throw new Error;return function(){Ct(this,e).ease=t}}function F$(e){var t=this._id;return arguments.length?this.each(U$(t,e)):_t(this.node(),t).ease}function H$(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Ct(this,e).ease=o}}function G$(e){if(typeof e!="function")throw new Error;return this.each(H$(this._id,e))}function Y$(e){typeof e!="function"&&(e=Pu(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 Pt(i,this._parents,this._name,this._id)}function j$(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),m,p=0;p<u;++p)(m=c[p]||d[p])&&(f[p]=m);for(;s<i;++s)r[s]=t[s];return new Pt(r,this._parents,this._name,this._id)}function W$(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 K$(e,t,o){var i,a,l=W$(t)?lr:Ct;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function q$(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(K$(o,e,t))}function X$(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Z$(){return this.on("end.remove",X$(this._id))}function J$(e){var t=this._name,o=this._id;typeof e!="function"&&(e=jl(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,m=0;m<c;++m)(u=s[m])&&(f=e.call(u,u.__data__,m,s))&&("__data__"in u&&(f.__data__=u.__data__),d[m]=f,ba(d[m],t,o,m,d,_t(u,o)));return new Pt(l,this._parents,t,o)}function Q$(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Lu(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 m=e.call(u,u.__data__,f,c),p,y=_t(u,o),b=0,g=m.length;b<g;++b)(p=m[b])&&ba(p,t,o,b,m,y);l.push(m),r.push(u)}return new Pt(l,r,t,o)}var eI=Vo.prototype.constructor;function tI(){return new eI(this._groups,this._parents)}function nI(e,t){var o,i,a;return function(){var l=qn(this,e),r=(this.style.removeProperty(e),qn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function wf(e){return function(){this.style.removeProperty(e)}}function oI(e,t,o){var i,a=o+"",l;return function(){var r=qn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function iI(e,t,o){var i,a,l;return function(){var r=qn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),qn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function aI(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Ct(this,e),d=c.on,u=c.value[l]==null?s||(s=wf(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function lI(e,t,o){var i=(e+="")=="transform"?l$:kf;return t==null?this.styleTween(e,nI(e,i)).on("end.style."+e,wf(e)):typeof t=="function"?this.styleTween(e,iI(e,i,rr(this,"style."+e,t))).each(aI(this._id,e)):this.styleTween(e,oI(e,i,t),o).on("end.style."+e,null)}function rI(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function sI(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&rI(e,r,o)),i}return l._value=t,l}function cI(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,sI(e,t,o??""))}function dI(e){return function(){this.textContent=e}}function uI(e){return function(){var t=e(this);this.textContent=t??""}}function fI(e){return this.tween("text",typeof e=="function"?uI(rr(this,"text",e)):dI(e==null?"":e+""))}function mI(e){return function(t){this.textContent=e.call(this,t)}}function pI(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&mI(a)),t}return i._value=e,i}function hI(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,pI(e))}function yI(){for(var e=this._name,t=this._id,o=vf(),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=_t(c,t);ba(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Pt(i,this._parents,e,o)}function gI(){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=Ct(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 bI=0;function Pt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function vf(){return++bI}var zt=Vo.prototype;Pt.prototype={constructor:Pt,select:J$,selectAll:Q$,selectChild:zt.selectChild,selectChildren:zt.selectChildren,filter:Y$,merge:j$,selection:tI,transition:yI,call:zt.call,nodes:zt.nodes,node:zt.node,size:zt.size,empty:zt.empty,each:zt.each,on:q$,attr:C$,attrTween:M$,style:lI,styleTween:cI,text:fI,textTween:hI,remove:Z$,tween:w$,delay:D$,duration:z$,ease:F$,easeVarying:G$,end:gI,[Symbol.iterator]:zt[Symbol.iterator]};function _I(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var EI={time:null,delay:0,duration:250,ease:_I};function kI(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 wI(e){var t,o;e instanceof Pt?(t=e._id,e=e._name):(t=vf(),(o=EI).time=nr(),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])&&ba(c,e,t,d,r,o||kI(c,t));return new Pt(i,this._parents,e,t)}Vo.prototype.interrupt=_$,Vo.prototype.transition=wI;const Ea=e=>()=>e;function vI(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 Ut(e,t,o){this.k=e,this.x=t,this.y=o}Ut.prototype={constructor:Ut,scale:function(e){return e===1?this:new Ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ut(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 sr=new Ut(1,0,0);Ut.prototype;function cr(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function NI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function $I(){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 Nf(){return this.__zoom||sr}function II(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function SI(){return navigator.maxTouchPoints||"ontouchstart"in this}function xI(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 CI(){var e=NI,t=$I,o=xI,i=II,a=SI,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=u$,d=Gl("start","zoom","end"),u,f,m,p=500,y=150,b=0,g=10;function E(_){_.property("__zoom",Nf).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",ee).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(_,Y,T,W){var Q=_.selection?_.selection():_;Q.property("__zoom",Nf),_!==Q?X(_,Y,T,W):Q.interrupt().each(function(){B(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},E.scaleBy=function(_,Y,T,W){E.scaleTo(_,function(){var Q=this.__zoom.k,te=typeof Y=="function"?Y.apply(this,arguments):Y;return Q*te},T,W)},E.scaleTo=function(_,Y,T,W){E.transform(_,function(){var Q=t.apply(this,arguments),te=this.__zoom,C=T==null?w(Q):typeof T=="function"?T.apply(this,arguments):T,Z=te.invert(C),le=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h($(te,le),C,Z),Q,r)},T,W)},E.translateBy=function(_,Y,T,W){E.transform(_,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),r)},null,W)},E.translateTo=function(_,Y,T,W,Q){E.transform(_,function(){var te=t.apply(this,arguments),C=this.__zoom,Z=W==null?w(te):typeof W=="function"?W.apply(this,arguments):W;return o(sr.translate(Z[0],Z[1]).scale(C.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof T=="function"?-T.apply(this,arguments):-T),te,r)},W,Q)};function $(_,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===_.k?_:new Ut(Y,_.x,_.y)}function h(_,Y,T){var W=Y[0]-T[0]*_.k,Q=Y[1]-T[1]*_.k;return W===_.x&&Q===_.y?_:new Ut(_.k,W,Q)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function X(_,Y,T,W){_.on("start.zoom",function(){B(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,te=arguments,C=B(Q,te).event(W),Z=t.apply(Q,te),le=T==null?w(Z):typeof T=="function"?T.apply(Q,te):T,pe=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),be=Q.__zoom,de=typeof Y=="function"?Y.apply(Q,te):Y,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new Ut(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}C.zoom(null,ye)}})}function B(_,Y,T){return!T&&_.__zooming||new H(_,Y)}function H(_,Y){this.that=_,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,Y),this.taps=0}H.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,Y){return this.mouse&&_!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var Y=qt(this.that).datum();d.call(_,this.that,new vI(_,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),Y)}};function A(_,...Y){if(!e.apply(this,arguments))return;var T=B(this,Y).event(_),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),te=Xt(_);if(T.wheel)(T.mouse[0][0]!==te[0]||T.mouse[0][1]!==te[1])&&(T.mouse[1]=W.invert(T.mouse[0]=te)),clearTimeout(T.wheel);else{if(W.k===Q)return;T.mouse=[te,W.invert(te)],_a(this),T.start()}zo(_),T.wheel=setTimeout(C,y),T.zoom("mouse",o(h($(W,Q),T.mouse[0],T.mouse[1]),T.extent,r));function C(){T.wheel=null,T.end()}}function S(_,...Y){if(m||!e.apply(this,arguments))return;var T=_.currentTarget,W=B(this,Y,!0).event(_),Q=qt(_.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),te=Xt(_,T),C=_.clientX,Z=_.clientY;LN(_.view),cr(_),W.mouse=[te,this.__zoom.invert(te)],_a(this),W.start();function le(be){if(zo(be),!W.moved){var de=be.clientX-C,me=be.clientY-Z;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Xt(be,T),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),PN(be.view,W.moved),zo(be),W.event(be).end()}}function L(_,...Y){if(e.apply(this,arguments)){var T=this.__zoom,W=Xt(_.changedTouches?_.changedTouches[0]:_,this),Q=T.invert(W),te=T.k*(_.shiftKey?.5:2),C=o(h($(T,te),W,Q),t.apply(this,Y),r);zo(_),s>0?qt(this).transition().duration(s).call(X,C,W,_):qt(this).call(E.transform,C,W,_)}}function ee(_,...Y){if(e.apply(this,arguments)){var T=_.touches,W=T.length,Q=B(this,Y,_.changedTouches.length===W).event(_),te,C,Z,le;for(cr(_),C=0;C<W;++C)Z=T[C],le=Xt(Z,this),le=[le,this.__zoom.invert(le),Z.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,te=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},p)),_a(this),Q.start())}}function M(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C,Z,le;for(zo(_),te=0;te<Q;++te)C=W[te],Z=Xt(C,this),T.touch0&&T.touch0[2]===C.identifier?T.touch0[0]=Z:T.touch1&&T.touch1[2]===C.identifier&&(T.touch1[0]=Z);if(C=T.that.__zoom,T.touch1){var pe=T.touch0[0],be=T.touch0[1],de=T.touch1[0],me=T.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;C=$(C,Math.sqrt(ye/ve)),Z=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(T.touch0)Z=T.touch0[0],le=T.touch0[1];else return;T.zoom("touch",o(h(C,Z,le),T.extent,r))}}function oe(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C;for(cr(_),m&&clearTimeout(m),m=setTimeout(function(){m=null},p),te=0;te<Q;++te)C=W[te],T.touch0&&T.touch0[2]===C.identifier?delete T.touch0:T.touch1&&T.touch1[2]===C.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(C=Xt(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<g)){var Z=qt(this).on("dblclick.zoom");Z&&Z.apply(this,arguments)}}}return E.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:Ea(+_),E):i},E.filter=function(_){return arguments.length?(e=typeof _=="function"?_:Ea(!!_),E):e},E.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:Ea(!!_),E):a},E.extent=function(_){return arguments.length?(t=typeof _=="function"?_:Ea([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),E):t},E.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],E):[l[0],l[1]]},E.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],E):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},E.constrain=function(_){return arguments.length?(o=_,E):o},E.duration=function(_){return arguments.length?(s=+_,E):s},E.interpolate=function(_){return arguments.length?(c=_,E):c},E.on=function(){var _=d.on.apply(d,arguments);return _===d?E:_},E.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,E):Math.sqrt(b)},E.tapDistance=function(_){return arguments.length?(g=+_,E):g},E}const $f=Symbol("MiniMapSlots"),RI=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],VI={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},AI=n.defineComponent({...VI,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($f),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,m)=>!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,RI))],64)):n.createCommentVNode("",!0)}}),TI=["width","height","viewBox","aria-labelledby"],MI=["id"],BI=["d","fill","stroke","stroke-width"],OI={name:"MiniMap",compatConfig:{MODE:3}},DI=n.defineComponent({...OI,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:m,d3Zoom:p,getNodesInitialized:y}=Pe(),b=n.ref();n.provide($f,o);const g=n.toRef(()=>{var Q;return e.width??((Q=i.style)==null?void 0:Q.width)??a}),E=n.toRef(()=>{var Q;return e.height??((Q=i.style)==null?void 0:Q.height)??l}),$=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),w=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),X=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),B=n.computed(()=>vl(y.value.filter(Q=>!Q.hidden))),H=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})),A=n.computed(()=>y.value&&y.value.length?f0(B.value,H.value):H.value),S=n.computed(()=>{const Q=A.value.width/g.value,te=A.value.height/E.value;return Math.max(Q,te)}),L=n.computed(()=>{const Q=S.value*g.value,te=S.value*E.value,C=e.offsetScale*S.value;return{offset:C,x:A.value.x-(Q-A.value.width)/2-C,y:A.value.y-(te-A.value.height)/2-C,width:Q+C*2,height:te+C*2}}),ee=n.computed(()=>!L.value.x||!L.value.y?"":`
|
|
38
|
+
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 Qe extends Error{constructor(t,...o){var i;super((i=Td[t])==null?void 0:i.call(Td,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Rl(e){return"clientX"in e}function $0(e){return"sourceEvent"in e}function St(e,t){const o=Rl(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 Vo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function I0(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 ji(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const S0=()=>!0;function Vl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function x0(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())Fi(a,Ui(l))>0&&i.push(l);return i}const C0=250;function R0(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=x0(e,o,t+C0);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}=Gn(d,f,f.position,!0),y=Math.sqrt((p-e.x)**2+(m-e.y)**2);y>t||(y<s?(r=[{...f,x:p,y:m}],s=y):y===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 Md(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=S0},u,f,p,m){const y=l==="target",b=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:g,y:E}=St(e),N=r.elementFromPoint(g,E),h=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:b,k={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const q=Bd(void 0,h),B=h.getAttribute("data-nodeid"),H=h.getAttribute("data-handleid"),A=h.classList.contains("connectable"),S=h.classList.contains("connectableend");if(!B||!q)return k;const L={source:y?B:i,sourceHandle:y?H:a,target:y?i:B,targetHandle:y?a:H};k.connection=L;const M=A&&S&&(o===Dt.Strict?y&&q==="source"||!y&&q==="target":B!==i||H!==a);k.isValid=M&&d(L,{nodes:f,edges:u,sourceNode:p(L.source),targetNode:p(L.target)}),k.toHandle=Od(B,q,H,m,o,!0)}return k}function Bd(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function V0(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function A0(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Od(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Dt.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,...Gn(d,f,f.position,!0)}:f}const Al={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},T0=["production","prod"];function Ao(e,...t){Dd()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Dd(){return!T0.includes(process.env.NODE_ENV||"")}function Ld(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,...Hi(r)}}):null}function Tl(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 Xe(e){return typeof n.unref(e)<"u"}function M0(e,t,o,i){if(!e||!e.source||!e.target)return o(new Qe(qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Yt(e)?a=e:a={...e,id:gd(e)},a=hd(a,void 0,i),p0(a,t)?!1:a}function B0(e,t,o,i,a){if(!t.source||!t.target)return a(new Qe(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Qe(qe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?gd(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Pd(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!un(r)){o(new Qe(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=u0(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 Qe(qe.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 zd(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 Ml(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}`;zd("source",c,u,e,a,r),zd("target",c,d,e,l,s)}}function Ud(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Bl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Yt(d)?d:M0(d,s,a,l);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){a(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Qe(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new Qe(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){a(new Qe(qe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...hd(u,m,l),sourceNode:f,targetNode:p})}return c}const Fd=Symbol("vueFlow"),Hd=Symbol("nodeId"),Gd=Symbol("nodeRef"),O0=Symbol("edgeId"),D0=Symbol("edgeRef"),Wi=Symbol("slots");function Yd(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:y,nodesSelectionActive:b,selectNodesOnDrag:g,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:h,emits:k}=Pe(),{onStart:q,onDrag:B,onStop:H,onClick:A,el:S,disabled:L,id:ee,selectable:M,dragHandle:oe}=e,_=n.shallowRef(!1);let Y=[],T,W=null,Q={x:void 0,y:void 0},te={x:0,y:0},C=null,Z=!1,le=!1,pe=0,be=!1;const de=z0(),me=({x:J,y:X})=>{Q={x:J,y:X};let v=!1;if(Y=Y.map(V=>{const j={x:J-V.distance.x,y:X-V.distance.y},{computedPosition:D}=Cl(V,o.value?ji(j,i.value):j,k.error,r.value,V.parentNode?m(V.parentNode):void 0);return v=v||V.position.x!==D.x||V.position.y!==D.y,V.position=D,V}),le=le||v,!!v&&(h(Y,!0,!0),_.value=!0,C)){const[V,j]=xl({id:ee,dragItems:Y,findNode:m});B({event:C,node:V,nodes:j})}},ye=()=>{if(!W)return;const[J,X]=Nd(te,W,u.value);if(J!==0||X!==0){const v={x:(Q.x??0)-J/c.value.zoom,y:(Q.y??0)-X/c.value.zoom};p({x:J,y:X})&&me(v)}pe=requestAnimationFrame(ye)},ve=(J,X)=>{Z=!0;const v=m(ee);!g.value&&!y.value&&v&&(v.selected||E()),v&&n.toValue(M)&&g.value&&Tl(v,y.value,N,E,b,!1,X);const V=de(J.sourceEvent);if(Q=V,Y=_0(l.value,f.value,V,ee),Y.length){const[j,D]=xl({id:ee,dragItems:Y,findNode:m});q({event:J.sourceEvent,node:j,nodes:D})}},Ce=(J,X)=>{var v;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(le=!1,s.value===0&&ve(J,X),Q=de(J.sourceEvent),W=((v=t.value)==null?void 0:v.getBoundingClientRect())||null,te=St(J.sourceEvent,W))},Se=(J,X)=>{const v=de(J.sourceEvent);if(!be&&Z&&d.value&&(be=!0,ye()),!Z){const V=v.xSnapped-(Q.x??0),j=v.ySnapped-(Q.y??0);Math.sqrt(V*V+j*j)>s.value&&ve(J,X)}(Q.x!==v.xSnapped||Q.y!==v.ySnapped)&&Y.length&&Z&&(C=J.sourceEvent,te=St(J.sourceEvent,W),me(v))},ge=J=>{let X=!1;if(!Z&&!_.value&&!y.value){const v=J.sourceEvent,V=de(v),j=V.xSnapped-(Q.x??0),D=V.ySnapped-(Q.y??0),K=Math.sqrt(j*j+D*D);K!==0&&K<=s.value&&(A==null||A(v),X=!0)}if(Y.length&&!X){le&&(h(Y,!1,!1),le=!1);const[v,V]=xl({id:ee,dragItems:Y,findNode:m});H({event:J.sourceEvent,node:v,nodes:V})}Y=[],_.value=!1,be=!1,Z=!1,Q={x:void 0,y:void 0},cancelAnimationFrame(pe)};return n.watch([()=>n.toValue(L),S],([J,X],v,V)=>{if(X){const j=ht(X);J||(T=dg().on("start",D=>Ce(D,X)).on("drag",D=>Se(D,X)).on("end",D=>ge(D)).filter(D=>{const K=D.target,he=n.toValue(oe);return!D.button&&(!a.value||!Rd(K,`.${a.value}`,X)&&(!he||Rd(K,he,X)))}),j.call(T)),V(()=>{j.on(".drag",null),T&&(T.on("start",null),T.on("drag",null),T.on("end",null))})}}),_}function L0(){return{doubleClick:Ie(),click:Ie(),mouseEnter:Ie(),mouseMove:Ie(),mouseLeave:Ie(),contextMenu:Ie(),updateStart:Ie(),update:Ie(),updateEnd:Ie()}}function P0(e,t){const o=L0();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 z0(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Pe();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=$0(a)?a.sourceEvent:a,{x:c,y:d}=St(s,r),u=Co({x:c,y:d},e.value),{x:f,y:p}=o.value?ji(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function Ki(){return!0}function jd({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:y,autoPanSpeed:b,findNode:g,panBy:E,startConnection:N,updateConnection:h,endConnection:k,emits:q,viewport:B,edges:H,nodes:A,isValidConnection:S,nodeLookup:L}=Pe();let ee=null,M=!1,oe=null;function _(T){var W;const Q=n.toValue(o)==="target",te=Rl(T),C=pd(T.target),Z=T.currentTarget;if(Z&&(te&&T.button===0||!te)){let le=function(ke){v=St(ke,ge),me=R0(Co(v,B.value,!1,[1,1]),u.value,L.value,D),V||(j(),V=!0);const Re=Md(ke,{handle:me,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:Q?"target":"source",isValidConnection:de,doc:C,lib:"vue",flowId:s,nodeLookup:L.value},H.value,A.value,g,L.value);oe=Re.handleDomNode,ee=Re.connection,M=A0(!!me,Re.isValid);const Ae={...$e,isValid:M,to:Re.toHandle&&M?xo({x:Re.toHandle.x,y:Re.toHandle.y},B.value):v,toHandle:Re.toHandle,toPosition:M&&Re.toHandle?Re.toHandle.position:Al[D.position],toNode:Re.toHandle?L.value.get(Re.toHandle.nodeId):null};if(M&&me&&($e!=null&&$e.toHandle)&&Ae.toHandle&&$e.toHandle.type===Ae.toHandle.type&&$e.toHandle.nodeId===Ae.toHandle.nodeId&&$e.toHandle.id===Ae.toHandle.id&&$e.to.x===Ae.to.x&&$e.to.y===Ae.to.y)return;const Oe=me??Re.toHandle;if(h(Oe&&M?xo({x:Oe.x,y:Oe.y},B.value):v,Oe,V0(!!Oe,M)),$e=Ae,!me&&!M&&!oe)return Vl(X);ee&&ee.source!==ee.target&&oe&&(Vl(X),X=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!M),oe.classList.toggle("vue-flow__handle-valid",!!M))},pe=function(ke){"touches"in ke&&ke.touches.length>0||((me||oe)&&ee&&M&&(l?l(ke,ee):q.connect(ee)),q.connectEnd(ke),a&&(r==null||r(ke)),Vl(X),cancelAnimationFrame(ye),k(ke),V=!1,M=!1,ee=null,oe=null,C.removeEventListener("mousemove",le),C.removeEventListener("mouseup",pe),C.removeEventListener("touchmove",le),C.removeEventListener("touchend",pe))};const be=g(n.toValue(t));let de=n.toValue(i)||S.value||Ki;!de&&be&&(de=(Q?be.isValidSourcePos:be.isValidTargetPos)||Ki);let me,ye=0;const{x:ve,y:Ce}=St(T),Se=Bd(n.toValue(a),Z),ge=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!ge||!Se)return;const J=Od(n.toValue(t),Se,n.toValue(e),L.value,d.value);if(!J)return;let X,v=St(T,ge),V=!1;const j=()=>{if(!y.value)return;const[ke,Re]=Nd(v,ge,b.value);E({x:ke,y:Re}),ye=requestAnimationFrame(j)},D={...J,nodeId:n.toValue(t),type:Se,position:J.position},K=L.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Gn(K,D,xe.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:K,to:v,toHandle:null,toPosition:Al[D.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Se,position:(Z==null?void 0:Z.getAttribute("data-handlepos"))||xe.Top,...v},{x:ve-ge.left,y:Ce-ge.top}),q.connectStart({event:T,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Se});let $e=we;C.addEventListener("mousemove",le),C.addEventListener("mouseup",pe),C.addEventListener("touchmove",le),C.addEventListener("touchend",pe)}}function Y(T){var W,Q;if(!f.value)return;const te=n.toValue(o)==="target";if(!p.value){q.clickConnectStart({event:T,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:xe.Top,...St(T)},void 0,!0);return}let C=n.toValue(i)||S.value||Ki;const Z=g(n.toValue(t));if(!C&&Z&&(C=(te?Z.isValidSourcePos:Z.isValidTargetPos)||Ki),Z&&(typeof Z.connectable>"u"?m.value:Z.connectable)===!1)return;const le=pd(T.target),pe=Md(T,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:xe.Top,...St(T)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:C,doc:le,lib:"vue",flowId:s,nodeLookup:L.value},H.value,A.value,g,L.value),be=((W=pe.connection)==null?void 0:W.source)===((Q=pe.connection)==null?void 0:Q.target);pe.isValid&&pe.connection&&!be&&q.connect(pe.connection),q.clickConnectEnd(T),k(T,!0)}return{handlePointerDown:_,handleClick:Y}}function U0(){return n.inject(Hd,"")}function Wd(e){const t=e??U0()??"",o=n.inject(Gd,n.ref(null)),{findNode:i,edges:a,emits:l}=Pe(),r=i(t);return r||l.error(new Qe(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>fn([r],a.value))}}function F0(){return{doubleClick:Ie(),click:Ie(),mouseEnter:Ie(),mouseMove:Ie(),mouseLeave:Ie(),contextMenu:Ie(),dragStart:Ie(),drag:Ie(),dragStop:Ie()}}function H0(e,t){const o=F0();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 Kd(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Pe();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,y=c.y*f*p,b=[];for(const g of e.value)if(g.draggable||r&&typeof g.draggable>"u"){const E={x:g.computedPosition.x+m,y:g.computedPosition.y+y},{position:N}=Cl(g,E,s.error,t.value,g.parentNode?i(g.parentNode):void 0);b.push({id:g.id,position:N,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(b,!0,!1)}}const qi=.1,G0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return Ao("Viewport not initialized yet."),Promise.resolve(!1)}const Y0={zoomIn:Kt,zoomOut:Kt,zoomTo:Kt,fitView:Kt,setCenter:Kt,fitBounds:Kt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kt,setTransform:Kt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function j0(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?_o:Vi).scaleBy(Ol(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}=md({x:-i,y:-a},e.translateExtent),f=Un.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?_o:Vi).transform(Ol(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"?_o:Vi).scaleTo(Ol(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:qi,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=$l(s),{x:d,y:u,zoom:f}=kd(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??qi);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:qi})=>{const{x:r,y:s,zoom:c}=kd(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??qi);return o(r,s,c,l)},project:a=>Co(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 Co(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 xo(s,e.viewport)}return{x:0,y:0}}}:Y0)}function Ol(e,t=0,o=G0,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function W0(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,g,E=!!(o.nodes.value.length||o.edges.value.length);b=On([e.modelValue,()=>{var N,h;return(h=(N=e.modelValue)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setElements(N),!g&&!E&&N.length?E=!0:g==null||g.resume())}),g=On([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,h])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...N,...h],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let b,g,E=!!o.nodes.value.length;b=On([e.nodes,()=>{var N,h;return(h=(N=e.nodes)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setNodes(N),!g&&!E&&N.length?E=!0:g==null||g.resume())}),g=On([o.nodes,()=>o.nodes.value.length],([N])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...N],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let b,g,E=!!o.edges.value.length;b=On([e.edges,()=>{var N,h;return(h=(N=e.edges)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(g==null||g.pause(),o.setEdges(N),!g&&!E&&N.length?E=!0:g==null||g.resume())}),g=On([o.edges,()=>o.edges.value.length],([N])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...N],n.nextTick(()=>{b==null||b.resume()}))},{immediate:E}),n.onScopeDispose(()=>{b==null||b.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Xe(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Xe(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Xe(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Xe(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Xe(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const b=async g=>{let E=g;typeof t.autoConnect=="function"&&(E=await t.autoConnect(g)),E!==!1&&o.addEdges([E])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(g,E,N)=>{g?o.onConnect(b):o.hooks.value.connect.off(b),N(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},m=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(t)){const E=g;if(!b.includes(E)){const N=n.toRef(()=>t[E]),h=o[E];n.isRef(h)&&i.run(()=>{n.watch(N,k=>{Xe(k)&&(h.value=k)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function K0(){return{edgesChange:Ie(),nodesChange:Ie(),nodeDoubleClick:Ie(),nodeClick:Ie(),nodeMouseEnter:Ie(),nodeMouseMove:Ie(),nodeMouseLeave:Ie(),nodeContextMenu:Ie(),nodeDragStart:Ie(),nodeDrag:Ie(),nodeDragStop:Ie(),nodesInitialized:Ie(),miniMapNodeClick:Ie(),miniMapNodeDoubleClick:Ie(),miniMapNodeMouseEnter:Ie(),miniMapNodeMouseMove:Ie(),miniMapNodeMouseLeave:Ie(),connect:Ie(),connectStart:Ie(),connectEnd:Ie(),clickConnectStart:Ie(),clickConnectEnd:Ie(),paneReady:Ie(),init:Ie(),move:Ie(),moveStart:Ie(),moveEnd:Ie(),selectionDragStart:Ie(),selectionDrag:Ie(),selectionDragStop:Ie(),selectionContextMenu:Ie(),selectionStart:Ie(),selectionEnd:Ie(),viewportChangeStart:Ie(),viewportChange:Ie(),viewportChangeEnd:Ie(),paneScroll:Ie(),paneClick:Ie(),paneContextMenu:Ie(),paneMouseEnter:Ie(),paneMouseMove:Ie(),paneMouseLeave:Ie(),edgeContextMenu:Ie(),edgeMouseEnter:Ie(),edgeMouseMove:Ie(),edgeMouseLeave:Ie(),edgeDoubleClick:Ie(),edgeClick:Ie(),edgeUpdateStart:Ie(),edgeUpdate:Ie(),edgeUpdateEnd:Ie(),updateNodeInternals:Ie(),error:Ie(e=>Ao(e.message))}}function q0(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),mo(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),mo(l.removeHasEmitListeners)}});function i(a){var l;const r=X0(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function X0(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function qd(){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:wl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:$o.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:cn.Bezier,style:{}},connectionMode:Dt.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:Vo()?"Meta":"Control",zoomActivationKeyCode:Vo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:K0(),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 Z0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function J0(e,t,o){const i=j0(e),a=v=>{const V=v??[];e.hooks.updateNodeInternals.trigger(V)},l=v=>m0(v,e.nodes,e.edges),r=v=>f0(v,e.nodes,e.edges),s=v=>fn(v,e.edges),c=({id:v,type:V,nodeId:j})=>{var D;const K=v?`-${V}-${v}`:`-${V}`;return Array.from(((D=e.connectionLookup.get(`${j}${K}`))==null?void 0:D.values())??[])},d=v=>{if(v)return t.value.get(v)},u=v=>{if(v)return o.value.get(v)},f=(v,V,j)=>{var D,K;const he=[];for(const we of v){const $e={id:we.id,type:"position",dragging:j,from:we.from};if(V&&($e.position=we.position,we.parentNode)){const ke=d(we.parentNode);$e.position={x:$e.position.x-(((D=ke==null?void 0:ke.computedPosition)==null?void 0:D.x)??0),y:$e.position.y-(((K=ke==null?void 0:ke.computedPosition)==null?void 0:K.y)??0)}}he.push($e)}he!=null&&he.length&&e.hooks.nodesChange.trigger(he)},p=v=>{if(!e.vueFlowRef)return;const V=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!V)return;const j=window.getComputedStyle(V),{m22:D}=new window.DOMMatrixReadOnly(j.transform),K=[];for(const he of v){const we=he,$e=d(we.id);if($e){const ke=Hi(we.nodeElement);if(!!(ke.width&&ke.height&&($e.dimensions.width!==ke.width||$e.dimensions.height!==ke.height||we.forceUpdate))){const Ae=we.nodeElement.getBoundingClientRect();$e.dimensions=ke,$e.handleBounds.source=Ld("source",we.nodeElement,Ae,D,$e.id),$e.handleBounds.target=Ld("target",we.nodeElement,Ae,D,$e.id),K.push({id:$e.id,type:"dimensions",dimensions:ke})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),K.length&&e.hooks.nodesChange.trigger(K)},m=(v,V)=>{const j=new Set,D=new Set;for(const we of v)un(we)?j.add(we.id):Yt(we)&&D.add(we.id);const K=Wt(t.value,j,!0),he=Wt(o.value,D);if(e.multiSelectionActive){for(const we of j)K.push(jt(we,V));for(const we of D)he.push(jt(we,V))}K.length&&e.hooks.nodesChange.trigger(K),he.length&&e.hooks.edgesChange.trigger(he)},y=v=>{if(e.multiSelectionActive){const V=v.map(j=>jt(j.id,!0));e.hooks.nodesChange.trigger(V);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(v.map(V=>V.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},b=v=>{if(e.multiSelectionActive){const V=v.map(j=>jt(j.id,!0));e.hooks.edgesChange.trigger(V);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(v.map(V=>V.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},g=v=>{m(v,!0)},E=v=>{const j=(v||e.nodes).map(D=>(D.selected=!1,jt(D.id,!1)));e.hooks.nodesChange.trigger(j)},N=v=>{const j=(v||e.edges).map(D=>(D.selected=!1,jt(D.id,!1)));e.hooks.edgesChange.trigger(j)},h=v=>{if(!v||!v.length)return m([],!1);const V=v.reduce((j,D)=>{const K=jt(D.id,!1);return un(D)?j.nodes.push(K):j.edges.push(K),j},{nodes:[],edges:[]});V.nodes.length&&e.hooks.nodesChange.trigger(V.nodes),V.edges.length&&e.hooks.edgesChange.trigger(V.edges)},k=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([v,e.maxZoom]),e.minZoom=v},q=v=>{var V;(V=e.d3Zoom)==null||V.scaleExtent([e.minZoom,v]),e.maxZoom=v},B=v=>{var V;(V=e.d3Zoom)==null||V.translateExtent(v),e.translateExtent=v},H=v=>{e.nodeExtent=v,a()},A=v=>{var V;(V=e.d3Zoom)==null||V.clickDistance(v)},S=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},L=v=>{const V=v instanceof Function?v(e.nodes):v;!e.initialized&&!V.length||(e.nodes=Pd(V,d,e.hooks.error.trigger))},ee=v=>{const V=v instanceof Function?v(e.edges):v;if(!e.initialized&&!V.length)return;const j=Bl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Ml(e.connectionLookup,o.value,j),e.edges=j},M=v=>{const V=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!V.length||(L(V.filter(un)),ee(V.filter(Yt)))},oe=v=>{let V=v instanceof Function?v(e.nodes):v;V=Array.isArray(V)?V:[V];const j=Pd(V,d,e.hooks.error.trigger),D=[];for(const K of j)D.push(Id(K));D.length&&e.hooks.nodesChange.trigger(D)},_=v=>{let V=v instanceof Function?v(e.edges):v;V=Array.isArray(V)?V:[V];const j=Bl(V,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),D=[];for(const K of j)D.push(Id(K));D.length&&e.hooks.edgesChange.trigger(D)},Y=(v,V=!0,j=!1)=>{const D=v instanceof Function?v(e.nodes):v,K=Array.isArray(D)?D:[D],he=[],we=[];function $e(Re){const Ae=s(Re);for(const Oe of Ae)(!Xe(Oe.deletable)||Oe.deletable)&&we.push(xd(Oe.id,Oe.source,Oe.target,Oe.sourceHandle,Oe.targetHandle))}function ke(Re){const Ae=[];for(const Oe of e.nodes)Oe.parentNode===Re&&Ae.push(Oe);if(Ae.length){for(const Oe of Ae)he.push(Sd(Oe.id));V&&$e(Ae);for(const Oe of Ae)ke(Oe.id)}}for(const Re of K){const Ae=typeof Re=="string"?d(Re):Re;Ae&&(Xe(Ae.deletable)&&!Ae.deletable||(he.push(Sd(Ae.id)),V&&$e([Ae]),j&&ke(Ae.id)))}we.length&&e.hooks.edgesChange.trigger(we),he.length&&e.hooks.nodesChange.trigger(he)},T=v=>{const V=v instanceof Function?v(e.edges):v,j=Array.isArray(V)?V:[V],D=[];for(const K of j){const he=typeof K=="string"?u(K):K;he&&(Xe(he.deletable)&&!he.deletable||D.push(xd(typeof K=="string"?K:K.id,he.source,he.target,he.sourceHandle,he.targetHandle)))}e.hooks.edgesChange.trigger(D)},W=(v,V,j=!0)=>{const D=u(v.id);if(!D)return!1;const K=e.edges.indexOf(D),he=B0(v,V,D,j,e.hooks.error.trigger);if(he){const[we]=Bl([he],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map(($e,ke)=>ke===K?we:$e),Ml(e.connectionLookup,o.value,[we]),we}return!1},Q=(v,V,j={replace:!1})=>{const D=u(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=j.replace?K:{...D.data,...K}},te=v=>$d(v,e.nodes),C=v=>{const V=$d(v,e.edges);return Ml(e.connectionLookup,o.value,V),V},Z=(v,V,j={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;j.replace?e.nodes.splice(e.nodes.indexOf(D),1,K):Object.assign(D,K)},le=(v,V,j={replace:!1})=>{const D=d(v);if(!D)return;const K=typeof V=="function"?V(D):V;D.data=j.replace?K:{...D.data,...K}},pe=(v,V,j=!1)=>{j?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,V&&(e.connectionPosition=V)},be=(v,V=null,j=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=V,e.connectionStatus=j)},de=(v,V)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,V?e.connectionClickStartHandle=null:e.connectionStartHandle=null},me=v=>{const V=d0(v),j=V?null:So(v)?v:d(v.id);return!V&&!j?[null,null,V]:[V?v:Ui(j),j,V]},ye=(v,V=!0,j=e.nodes)=>{const[D,K,he]=me(v);if(!D)return[];const we=[];for(const $e of j||e.nodes){if(!he&&($e.id===K.id||!$e.computedPosition))continue;const ke=Ui($e),Re=Fi(ke,D);(V&&Re>0||Re>=ke.width*ke.height||Re>=Number(D.width)*Number(D.height))&&we.push($e)}return we},ve=(v,V,j=!0)=>{const[D]=me(v);if(!D)return!1;const K=Fi(D,V);return j&&K>0||K>=Number(D.width)*Number(D.height)},Ce=v=>{const{viewport:V,dimensions:j,d3Zoom:D,d3Selection:K,translateExtent:he}=e;if(!D||!K||!v.x&&!v.y)return!1;const we=Un.translate(V.x+v.x,V.y+v.y).scale(V.zoom),$e=[[0,0],[j.width,j.height]],ke=D.constrain()(we,$e,he),Re=e.viewport.x!==ke.x||e.viewport.y!==ke.y||e.viewport.zoom!==ke.k;return D.transform(K,ke),Re},Se=v=>{const V=v instanceof Function?v(e):v,j=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(V.defaultEdgeOptions)&&(e.defaultEdgeOptions=V.defaultEdgeOptions);const D=V.modelValue||V.nodes||V.edges?[]:void 0;D&&(V.modelValue&&D.push(...V.modelValue),V.nodes&&D.push(...V.nodes),V.edges&&D.push(...V.edges),M(D));const K=()=>{Xe(V.maxZoom)&&q(V.maxZoom),Xe(V.minZoom)&&k(V.minZoom),Xe(V.translateExtent)&&B(V.translateExtent)};for(const he of Object.keys(V)){const we=he,$e=V[we];![...Z0,...j].includes(we)&&Xe($e)&&(e[we]=$e)}tl(()=>e.d3Zoom).not.toBeNull().then(K),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:M,setNodes:L,setEdges:ee,addNodes:oe,addEdges:_,removeNodes:Y,removeEdges:T,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:Q,updateNode:Z,updateNodeData:le,applyEdgeChanges:C,applyNodeChanges:te,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:k,setMaxZoom:q,setTranslateExtent:B,setNodeExtent:H,setPaneClickDistance:A,removeSelectedElements:h,removeSelectedNodes:E,removeSelectedEdges:N,startConnection:pe,updateConnection:be,endConnection:de,setInteractive:S,setState:Se,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ve,panBy:Ce,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,V)=>i.value.zoomTo(v,V),setViewport:(v,V)=>i.value.setViewport(v,V),setTransform:(v,V)=>i.value.setTransform(v,V),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,V,j)=>i.value.setCenter(v,V,j),fitBounds:(v,V)=>i.value.fitBounds(v,V),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],V=[];for(const j of e.nodes){const{computedPosition:D,handleBounds:K,selected:he,dimensions:we,isParent:$e,resizing:ke,dragging:Re,events:Ae,...Oe}=j;v.push(Oe)}for(const j of e.edges){const{selected:D,sourceNode:K,targetNode:he,events:we,...$e}=j;V.push($e)}return JSON.parse(JSON.stringify({nodes:v,edges:V,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(V=>{const{nodes:j,edges:D,position:K,zoom:he,viewport:we}=v;j&&L(j),D&&ee(D);const[$e,ke]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:K??[null,null];if($e&&ke){const Re=(we==null?void 0:we.zoom)||he||e.viewport.zoom;return tl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:$e,y:ke,zoom:Re}).then(()=>{V(!0)})})}else V(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const v=qd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const V=Un.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(dn(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),j=e.viewportRef.getBoundingClientRect(),D=[[0,0],[j.width,j.height]],K=e.d3Zoom.constrain()(V,D,v.translateExtent);e.d3Zoom.transform(e.d3Selection,K)}Se(v)},$destroy:()=>{}}}const Q0=["data-id","data-handleid","data-nodeid","data-handlepos"],e1={name:"Handle",compatConfig:{MODE:3}},mn=n.defineComponent({...e1,props:{id:{default:null},type:{},position:{default:()=>xe.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}=Pe(),{id:m,node:y,nodeEl:b,connectedEdges:g}=Wd(),E=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=n.toRef(()=>{var ee,M,oe,_,Y,T;return((ee=r.value)==null?void 0:ee.nodeId)===m&&((M=r.value)==null?void 0:M.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((_=c.value)==null?void 0:_.nodeId)===m&&((Y=c.value)==null?void 0:Y.id)===e.id&&((T=c.value)==null?void 0:T.type)===i.value}),q=n.toRef(()=>{var ee,M,oe;return((ee=s.value)==null?void 0:ee.nodeId)===m&&((M=s.value)==null?void 0:M.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:B,handleClick:H}=jd({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),A=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(ee=>{const M=ee[`${i.value}Handle`];return ee[i.value]!==m?!1:M?M===e.id:!0}):typeof e.connectable=="number"?g.value.filter(ee=>{const M=ee[`${i.value}Handle`];return ee[i.value]!==m?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var ee;if(!y.dimensions.width||!y.dimensions.height)return;const M=(ee=y.handleBounds[i.value])==null?void 0:ee.find(te=>te.id===e.id);if(!d.value||M)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!E.value||!oe||!e.id)return;const _=b.value.getBoundingClientRect(),Y=E.value.getBoundingClientRect(),T=window.getComputedStyle(oe),{m22:W}=new window.DOMMatrixReadOnly(T.transform),Q={id:e.id,position:e.position,x:(Y.left-_.left)/W,y:(Y.top-_.top)/W,type:i.value,nodeId:m,...Hi(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],Q]});function S(ee){const M=Rl(ee);A.value&&N.value&&(M&&ee.button===0||!M)&&B(ee)}function L(ee){!m||!s.value&&!N.value||A.value&&H(ee)}return t({handleClick:H,handlePointerDown:B,onClick:L,onPointerDown:S}),(ee,M)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":ee.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${ee.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:A.value,connecting:q.value,connectablestart:N.value,connectableend:h.value,connectionindicator:A.value&&(N.value&&!k.value||h.value&&k.value)}]]),onMousedown:S,onTouchstartPassive:S,onClick:L},[n.renderSlot(ee.$slots,"default",{id:ee.id})],42,Q0))}}),Xi=function({sourcePosition:e=xe.Bottom,targetPosition:t=xe.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(mn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(mn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Xi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Xi.inheritAttrs=!1,Xi.compatConfig={MODE:3};const t1=Xi,Zi=function({targetPosition:e=xe.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(mn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Zi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Zi.inheritAttrs=!1,Zi.compatConfig={MODE:3};const n1=Zi,Ji=function({sourcePosition:e=xe.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(mn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ji.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ji.inheritAttrs=!1,Ji.compatConfig={MODE:3};const o1=Ji,i1=["transform"],a1=["width","height","x","y","rx","ry"],l1=["y"],r1={name:"EdgeText",compatConfig:{MODE:3}},s1=n.defineComponent({...r1,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,a1)):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,l1)],8,i1))}}),c1=["id","d","marker-end","marker-start"],d1=["d","stroke-width"],u1={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Qi=n.defineComponent({...u1,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,c1),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,d1)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(s1,{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 Xd({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 Zd({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 ea(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Jd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case xe.Left:r=t-ea(t-i,l),s=o;break;case xe.Right:r=t+ea(i-t,l),s=o;break;case xe.Top:r=t,s=o-ea(o-a,l);break;case xe.Bottom:r=t,s=o+ea(a-o,l);break}return[r,s]}function Qd(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top,curvature:s=.25}=e,[c,d]=Jd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Jd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[p,m,y,b]=Zd({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,y,b]}function eu({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case xe.Left:case xe.Right:l=.5*(t+i),r=o;break;case xe.Top:case xe.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function tu(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top}=e,[s,c]=eu({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=eu({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,p,m,y]=Zd({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,y]}const nu={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}};function f1({source:e,sourcePosition:t=xe.Bottom,target:o}){return t===xe.Left||t===xe.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 ou(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function m1({source:e,sourcePosition:t=xe.Bottom,target:o,targetPosition:i=xe.Top,center:a,offset:l}){const r=nu[t],s=nu[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=f1({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,y,b;const g={x:0,y:0},E={x:0,y:0},[N,h,k,q]=Xd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){y=a.x??N,b=a.y??h;const H=[{x:y,y:c.y},{x:y,y:d.y}],A=[{x:c.x,y:b},{x:d.x,y:b}];r[f]===p?m=f==="x"?H:A:m=f==="x"?A:H}else{const H=[{x:c.x,y:d.y}],A=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?A:H:m=r.y===p?H:A,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const _=Math.min(l-1,l-oe);r[f]===p?g[f]=(c[f]>e[f]?-1:1)*_:E[f]=(d[f]>o[f]?-1:1)*_}}if(t!==i){const oe=f==="x"?"y":"x",_=r[f]===s[oe],Y=c[oe]>d[oe],T=c[oe]<d[oe];(r[f]===1&&(!_&&Y||_&&T)||r[f]!==1&&(!_&&T||_&&Y))&&(m=f==="x"?H:A)}const S={x:c.x+g.x,y:c.y+g.y},L={x:d.x+E.x,y:d.y+E.y},ee=Math.max(Math.abs(S.x-m[0].x),Math.abs(L.x-m[0].x)),M=Math.max(Math.abs(S.y-m[0].y),Math.abs(L.y-m[0].y));ee>=M?(y=(S.x+L.x)/2,b=m[0].y):(y=m[0].x,b=(S.y+L.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...m,{x:d.x+E.x,y:d.y+E.y},o],y,b,k,q]}function p1(e,t,o,i){const a=Math.min(ou(e,t)/2,ou(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 Dl(e){const{sourceX:t,sourceY:o,sourcePosition:i=xe.Bottom,targetX:a,targetY:l,targetPosition:r=xe.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,y,b]=m1({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((E,N,h)=>{let k;return h>0&&h<f.length-1?k=p1(f[h-1],N,f[h+1],s):k=`${h===0?"M":"L"}${N.x} ${N.y}`,E+=k,E},""),p,m,y,b]}function h1(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Xd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const y1=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]=h1(e);return n.h(Qi,{path:o,labelX:i,labelY:a,...t,...e})}}}),iu=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]=Dl({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Qi,{path:o,labelX:i,labelY:a,...t,...e})}}}),g1=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(iu,{...e,...t,borderRadius:0})}}),b1=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]=Qd({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Qi,{path:o,labelX:i,labelY:a,...t,...e})}}}),_1=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]=tu({...e,sourcePosition:e.sourcePosition??xe.Bottom,targetPosition:e.targetPosition??xe.Top});return n.h(Qi,{path:o,labelX:i,labelY:a,...t,...e})}}}),E1={input:o1,default:t1,output:n1},k1={default:b1,straight:y1,step:g1,smoothstep:iu,simplebezier:_1};function w1(e,t,o){const i=n.computed(()=>b=>t.value.get(b)),a=n.computed(()=>b=>o.value.get(b)),l=n.computed(()=>{const b={...k1,...e.edgeTypes},g=Object.keys(b);for(const E of e.edges)E.type&&!g.includes(E.type)&&(b[E.type]=E.type);return b}),r=n.computed(()=>{const b={...E1,...e.nodeTypes},g=Object.keys(b);for(const E of e.nodes)E.type&&!g.includes(E.type)&&(b[E.type]=E.type);return b}),s=n.computed(()=>e.onlyRenderVisibleElements?Ed(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 b=[];for(const g of e.edges){const E=t.value.get(g.source),N=t.value.get(g.target);v0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(g)}return b}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const b=[];for(const g of e.nodes)g.selected&&b.push(g);return b}),f=n.computed(()=>{const b=[];for(const g of e.edges)g.selected&&b.push(g);return b}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const b=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&b.push(g);return b}),y=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:y}}class pn{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)??pn.instance;return pn.instance=i??new pn,o&&(o.config.globalProperties.$vueFlowStorage=pn.instance),pn.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=qd(),a=n.reactive(i),l={};for(const[p,m]of Object.entries(a.hooks)){const y=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;l[y]=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=w1(a,s,c),u=J0(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,..._h(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 Pe(e){const t=pn.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(Fd,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 y=g=>{d.applyNodeChanges(g)},b=g=>{d.applyEdgeChanges(g)};f?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),m(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),mo(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Ao(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(Fd,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Qe(qe.USEVUEFLOW_OPTIONS))}return s}function v1(e){const{emits:t,dimensions:o}=Pe();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=Hi(e.value);(s.width===0||s.height===0)&&t.error(new Qe(qe.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 N1={name:"UserSelection",compatConfig:{MODE:3}},$1=n.defineComponent({...N1,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))}}),I1=["tabIndex"],S1={name:"NodesSelection",compatConfig:{MODE:3}},x1=n.defineComponent({...S1,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Pe(),s=Kd(),c=n.ref(null),d=Yd({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;l.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>$l(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(y){t.selectionContextMenu({event:y,nodes:i.value})}function m(y){l.value||Fn[y.key]&&(y.preventDefault(),s({x:Fn[y.key].x,y:Fn[y.key].y},y.shiftKey))}return(y,b)=>!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,I1)],6)):n.createCommentVNode("",!0)}});function C1(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const R1={name:"Pane",compatConfig:{MODE:3}},V1=n.defineComponent({...R1,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:y,deleteKeyCode:b,multiSelectionKeyCode:g,multiSelectionActive:E,edgeLookup:N,nodeLookup:h,connectionLookup:k,defaultEdgeOptions:q,connectionStartHandle:B,panOnDrag:H}=Pe(),A=n.shallowRef(null),S=n.shallowRef(new Set),L=n.shallowRef(new Set),ee=n.shallowRef(null),M=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>B.value!==null);let _=!1,Y=!1;const T=Io(b,{actInsideInputWithModifier:!1}),W=Io(g);n.watch(T,de=>{de&&(p(f.value),m(u.value),d.value=!1)}),n.watch(W,de=>{E.value=de});function Q(de,me){return ye=>{ye.target===me&&(de==null||de(ye))}}function te(de){if(_||oe.value){_=!1;return}a.paneClick(de),r(),d.value=!1}function C(de){var me;if(Array.isArray(H.value)&&((me=H.value)!=null&&me.includes(2))){de.preventDefault();return}a.paneContextMenu(de)}function Z(de){a.paneScroll(de)}function le(de){var me,ye,ve;if(ee.value=((me=t.value)==null?void 0:me.getBoundingClientRect())??null,!c.value||!e.isSelecting||de.button!==0||de.target!==A.value||!ee.value)return;(ve=(ye=de.target)==null?void 0:ye.setPointerCapture)==null||ve.call(ye,de.pointerId);const{x:Ce,y:Se}=C1(de,ee.value);Y=!0,_=!1,r(),s.value={width:0,height:0,startX:Ce,startY:Se,x:Ce,y:Se},a.selectionStart(de)}function pe(de){var me;if(!ee.value||!s.value)return;_=!0;const{x:ye,y:ve}=St(de,ee.value),{startX:Ce=0,startY:Se=0}=s.value,ge={startX:Ce,startY:Se,x:ye<Ce?ye:Ce,y:ve<Se?ve:Se,width:Math.abs(ye-Ce),height:Math.abs(ve-Se)},J=S.value,X=L.value;S.value=new Set(Ed(o.value,ge,i.value,y.value===wl.Partial,!0).map(V=>V.id)),L.value=new Set;const v=((me=q.value)==null?void 0:me.selectable)??!0;for(const V of S.value){const j=k.value.get(V);if(j)for(const{edgeId:D}of j.values()){const K=N.value.get(D);K&&(K.selectable??v)&&L.value.add(D)}}if(!Ud(J,S.value)){const V=Wt(h.value,S.value,!0);a.nodesChange(V)}if(!Ud(X,L.value)){const V=Wt(N.value,L.value);a.edgesChange(V)}s.value=ge,l.value=!0,d.value=!1}function be(de){var me;de.button!==0||!Y||((me=de.target)==null||me.releasePointerCapture(de.pointerId),!l.value&&s.value&&de.target===A.value&&te(de),l.value=!1,s.value=null,d.value=S.value.size>0,a.selectionEnd(de),e.selectionKeyPressed&&(_=!1),Y=!1)}return(de,me)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:A,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:de.isSelecting}]),onClick:me[0]||(me[0]=ye=>M.value?void 0:Q(te,A.value)(ye)),onContextmenu:me[1]||(me[1]=ye=>Q(C,A.value)(ye)),onWheelPassive:me[2]||(me[2]=ye=>Q(Z,A.value)(ye)),onPointerenter:me[3]||(me[3]=ye=>M.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:me[4]||(me[4]=ye=>M.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:me[5]||(me[5]=ye=>M.value?pe(ye):n.unref(a).paneMouseMove(ye)),onPointerup:me[6]||(me[6]=ye=>M.value?be(ye):void 0),onPointerleave:me[7]||(me[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(de.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock($1,{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(x1,{key:1})):n.createCommentVNode("",!0)],34))}}),A1={name:"Transform",compatConfig:{MODE:3}},T1=n.defineComponent({...A1,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Pe(),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))}}),M1={name:"Viewport",compatConfig:{MODE:3}},B1=n.defineComponent({...M1,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:y,preventScrolling:b,noWheelClassName:g,noPanClassName:E,emits:N,connectionStartHandle:h,userSelectionActive:k,paneDragging:q,d3Zoom:B,d3Selection:H,d3ZoomHandler:A,viewport:S,viewportRef:L,paneClickDistance:ee}=Pe();v1(L);const M=n.shallowRef(!1),oe=n.shallowRef(!1);let _=null,Y=!1,T=0,W={x:0,y:0,zoom:0};const Q=Io(s),te=Io(r),C=Io(l),Z=n.toRef(()=>(!te.value||te.value&&r.value===!0)&&(Q.value||f.value)),le=n.toRef(()=>Q.value||c.value),pe=n.toRef(()=>r.value===!0&&Z.value!==!0),be=n.toRef(()=>te.value&&r.value!==!0||k.value||pe.value),de=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!L.value){Ao("Viewport element is missing");return}const Se=L.value,ge=Se.getBoundingClientRect(),J=o0().clickDistance(ee.value).scaleExtent([t.value,o.value]).translateExtent(a.value),X=ht(Se).call(J),v=X.on("wheel.zoom"),V=Un.translate(i.value.x??0,i.value.y??0).scale(dn(i.value.zoom??1,t.value,o.value)),j=[[0,0],[ge.width,ge.height]],D=J.constrain()(V,j,a.value);J.transform(X,D),J.wheelDelta(Il),B.value=J,H.value=X,A.value=v,S.value={x:D.x,y:D.y,zoom:D.k},J.on("start",K=>{var he;if(!K.sourceEvent)return null;T=K.sourceEvent.button,M.value=!0;const we=ve(K.transform);((he=K.sourceEvent)==null?void 0:he.type)==="mousedown"&&(q.value=!0),W=we,N.viewportChangeStart(we),N.moveStart({event:K,flowTransform:we})}),J.on("end",K=>{if(!K.sourceEvent)return null;if(M.value=!1,q.value=!1,me(Z.value,T??0)&&!Y&&N.paneContextMenu(K.sourceEvent),Y=!1,ye(W,K.transform)){const he=ve(K.transform);W=he,N.viewportChangeEnd(he),N.moveEnd({event:K,flowTransform:he})}}),J.filter(K=>{var he;const we=C.value||y.value,$e=m.value&&K.ctrlKey,ke=K.button,Re=K.type==="wheel";if(ke===1&&K.type==="mousedown"&&(Ce(K,"vue-flow__node")||Ce(K,"vue-flow__edge")))return!0;if(!Z.value&&!we&&!le.value&&!p.value&&!m.value||k.value||de.value&&!Re||!p.value&&K.type==="dblclick"||Ce(K,g.value)&&Re||Ce(K,E.value)&&(!Re||le.value&&Re&&!C.value)||!m.value&&K.ctrlKey&&Re||!we&&!le.value&&!$e&&Re)return!1;if(!m&&K.type==="touchstart"&&((he=K.touches)==null?void 0:he.length)>1)return K.preventDefault(),!1;if(!Z.value&&(K.type==="mousedown"||K.type==="touchstart")||pe.value&&Array.isArray(f.value)&&f.value.includes(0)&&ke===0||Array.isArray(f.value)&&!f.value.includes(ke)&&(K.type==="mousedown"||K.type==="touchstart"))return!1;const Ae=Array.isArray(f.value)&&f.value.includes(ke)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!ke||ke<=1;return(!K.ctrlKey||Q.value||Re)&&Ae}),n.watch([k,Z],()=>{k.value&&!M.value?J.on("zoom",null):k.value||J.on("zoom",K=>{S.value={x:K.transform.x,y:K.transform.y,zoom:K.transform.k};const he=ve(K.transform);Y=me(Z.value,T??0),N.viewportChange(he),N.move({event:K,flowTransform:he})})},{immediate:!0}),n.watch([k,le,d,C,m,b,g],()=>{le.value&&!C.value&&!k.value?X.on("wheel.zoom",K=>{if(Ce(K,g.value))return!1;const he=C.value||y.value,we=m.value&&K.ctrlKey;if(!(!b.value||le.value||he||we))return!1;K.preventDefault(),K.stopImmediatePropagation();const ke=X.property("__zoom").k||1,Re=Vo();if(!Q.value&&K.ctrlKey&&m.value&&Re){const O=vt(K),re=Il(K),ue=ke*2**re;J.scaleTo(X,ue,O,K);return}const Ae=K.deltaMode===1?20:1;let Oe=d.value===$o.Vertical?0:K.deltaX*Ae,We=d.value===$o.Horizontal?0:K.deltaY*Ae;!Re&&K.shiftKey&&d.value!==$o.Vertical&&!Oe&&We&&(Oe=We,We=0),J.translateBy(X,-(Oe/ke)*u.value,-(We/ke)*u.value);const I=ve(X.property("__zoom"));_&&clearTimeout(_),oe.value?(N.move({event:K,flowTransform:I}),N.viewportChange(I),_=setTimeout(()=>{N.moveEnd({event:K,flowTransform:I}),N.viewportChangeEnd(I),oe.value=!1},150)):(oe.value=!0,N.moveStart({event:K,flowTransform:I}),N.viewportChangeStart(I))},{passive:!1}):typeof v<"u"&&X.on("wheel.zoom",function(K,he){const we=!b.value&&K.type==="wheel"&&!K.ctrlKey,$e=C.value||y.value,ke=m.value&&K.ctrlKey;if(!$e&&!c.value&&!ke&&K.type==="wheel"||we||Ce(K,g.value))return null;K.preventDefault(),v.call(this,K,he)},{passive:!1})},{immediate:!0})});function me(Se,ge){return ge===2&&Array.isArray(Se)&&Se.includes(2)}function ye(Se,ge){return Se.x!==ge.x&&!Number.isNaN(ge.x)||Se.y!==ge.y&&!Number.isNaN(ge.y)||Se.zoom!==ge.k&&!Number.isNaN(ge.k)}function ve(Se){return{x:Se.x,y:Se.y,zoom:Se.k}}function Ce(Se,ge){return Se.target.closest(`.${ge}`)}return(Se,ge)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:L,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(V1,{"is-selecting":be.value,"selection-key-pressed":n.unref(te),class:n.normalizeClass({connecting:de.value,dragging:n.unref(q),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(T1,null,{default:n.withCtx(()=>[n.renderSlot(Se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),O1=["id"],D1=["id"],L1=["id"],P1={name:"A11yDescriptions",compatConfig:{MODE:3}},z1=n.defineComponent({...P1,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(dd)}-${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,O1),n.createElementVNode("div",{id:`${n.unref(ud)}-${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,D1),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(c0)}-${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,L1))],64))}});function U1(){const e=Pe();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function F1(e,t,o){return o===xe.Left?e-t:o===xe.Right?e+t:e}function H1(e,t,o){return o===xe.Top?e-t:o===xe.Bottom?e+t:e}const Ll=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=xe.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:F1(t,e,i),cy:H1(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Ll.props=["radius","centerX","centerY","position","type"],Ll.compatConfig={MODE:3};const au=Ll,G1=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:y,elementsSelectable:b,edgesUpdatable:g,edgesFocusable:E,hooks:N}=Pe(),h=n.computed(()=>u(e.id)),{emit:k,on:q}=P0(h.value,l),B=n.inject(Wi),H=n.getCurrentInstance(),A=n.ref(!1),S=n.ref(!1),L=n.ref(""),ee=n.ref(null),M=n.ref("source"),oe=n.ref(null),_=n.toRef(()=>typeof h.value.selectable>"u"?b.value:h.value.selectable),Y=n.toRef(()=>typeof h.value.updatable>"u"?g.value:h.value.updatable),T=n.toRef(()=>typeof h.value.focusable>"u"?E.value:h.value.focusable);n.provide(O0,e.id),n.provide(D0,oe);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),Q=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),te=n.computed(()=>{const V=h.value.type||"default",j=B==null?void 0:B[`edge-${V}`];if(j)return j;let D=h.value.template??c.value[V];if(typeof D=="string"&&H){const K=Object.keys(H.appContext.components);K&&K.includes(V)&&(D=n.resolveComponent(V,!1))}return D&&typeof D!="string"?D:(l.error(new Qe(qe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:C}=jd({nodeId:L,handleId:ee,type:M,isValidConnection:p,edgeUpdaterType:M,onEdgeUpdate:pe,onEdgeUpdateEnd:be});return()=>{const V=f(h.value.source),j=f(h.value.target),D="pathOptions"in h.value?h.value.pathOptions:{};if(!V&&!j)return l.error(new Qe(qe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!V)return l.error(new Qe(qe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!j)return l.error(new Qe(qe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||V.hidden||j.hidden)return null;let K;i.value===Dt.Strict?K=V.handleBounds.source:K=[...V.handleBounds.source||[],...V.handleBounds.target||[]];const he=Ad(K,h.value.sourceHandle);let we;i.value===Dt.Strict?we=j.handleBounds.target:we=[...j.handleBounds.target||[],...j.handleBounds.source||[]];const $e=Ad(we,h.value.targetHandle),ke=(he==null?void 0:he.position)||xe.Bottom,Re=($e==null?void 0:$e.position)||xe.Top,{x:Ae,y:Oe}=Gn(V,he,ke),{x:We,y:I}=Gn(j,$e,Re);return h.value.sourceX=Ae,h.value.sourceY=Oe,h.value.targetX=We,h.value.targetY=I,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${te.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:A.value,selected:h.value.selected,animated:h.value.animated,inactive:!_.value&&!N.value.edgeClick.hasListeners()}],tabIndex:T.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":T.value?`${ud}-${t}`:void 0,"aria-roledescription":"edge",role:T.value?"group":"img",...h.value.domAttributes,onClick:me,onContextmenu:ye,onDblclick:ve,onMouseenter:Ce,onMousemove:Se,onMouseleave:ge,onKeyDown:T.value?v:void 0},[S.value?null:n.h(te.value===!1?c.value.default:te.value,{id:e.id,sourceNode:V,targetNode:j,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...q},style:Q.value,markerStart:`url('#${Ro(h.value.markerStart,t)}')`,markerEnd:`url('#${Ro(h.value.markerEnd,t)}')`,sourcePosition:ke,targetPosition:Re,sourceX:Ae,sourceY:Oe,targetX:We,targetY:I,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...D}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:J,onMouseenter:Z,onMouseout:le},n.h(au,{position:ke,centerX:Ae,centerY:Oe,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:X,onMouseenter:Z,onMouseout:le},n.h(au,{position:Re,centerX:We,centerY:I,radius:a.value,type:"target","data-type":"target"}))]:null]])};function Z(){A.value=!0}function le(){A.value=!1}function pe(V,j){k.update({event:V,edge:h.value,connection:j})}function be(V){k.updateEnd({event:V,edge:h.value}),S.value=!1}function de(V,j){V.button===0&&(S.value=!0,L.value=j?h.value.target:h.value.source,ee.value=(j?h.value.targetHandle:h.value.sourceHandle)??null,M.value=j?"target":"source",k.updateStart({event:V,edge:h.value}),C(V))}function me(V){var j;const D={event:V,edge:h.value};_.value&&(r.value=!1,h.value.selected&&m.value?(d([h.value]),(j=oe.value)==null||j.blur()):o([h.value])),k.click(D)}function ye(V){k.contextMenu({event:V,edge:h.value})}function ve(V){k.doubleClick({event:V,edge:h.value})}function Ce(V){k.mouseEnter({event:V,edge:h.value})}function Se(V){k.mouseMove({event:V,edge:h.value})}function ge(V){k.mouseLeave({event:V,edge:h.value})}function J(V){de(V,!0)}function X(V){de(V,!1)}function v(V){var j;!y.value&&fd.includes(V.key)&&_.value&&(V.key==="Escape"?((j=oe.value)==null||j.blur(),d([u(e.id)])):o([u(e.id)]))}}}),Y1=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}=Pe(),p=(e=n.inject(Wi))==null?void 0:e["connection-line"],m=n.computed(()=>{var N;return f((N=i.value)==null?void 0:N.nodeId)}),y=n.computed(()=>{var N;return f((N=a.value)==null?void 0:N.nodeId)??null}),b=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),g=n.computed(()=>c.value.markerStart?`url(#${Ro(c.value.markerStart,t)})`:""),E=n.computed(()=>c.value.markerEnd?`url(#${Ro(c.value.markerEnd,t)})`:"");return()=>{var N,h,k;if(!m.value||!i.value)return null;const q=i.value.id,B=i.value.type,H=m.value.handleBounds;let A=(H==null?void 0:H[B])??[];if(o.value===Dt.Loose){const Q=(H==null?void 0:H[B==="source"?"target":"source"])??[];A=[...A,...Q]}if(!A)return null;const S=(q?A.find(Q=>Q.id===q):A[0])??null,L=(S==null?void 0:S.position)??xe.Top,{x:ee,y:M}=Gn(m.value,S,L);let oe=null;y.value&&(o.value===Dt.Strict?oe=((N=y.value.handleBounds[B==="source"?"target":"source"])==null?void 0:N.find(Q=>{var te;return Q.id===((te=a.value)==null?void 0:te.id)}))||null:oe=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(Q=>{var te;return Q.id===((te=a.value)==null?void 0:te.id)}))||null);const _=((k=a.value)==null?void 0:k.position)??(L?Al[L]:null);if(!L||!_)return null;const Y=r.value??c.value.type??cn.Bezier;let T="";const W={sourceX:ee,sourceY:M,sourcePosition:L,targetX:b.value.x,targetY:b.value.y,targetPosition:_};return Y===cn.Bezier?[T]=Qd(W):Y===cn.Step?[T]=Dl({...W,borderRadius:0}):Y===cn.SmoothStep?[T]=Dl(W):Y===cn.SimpleBezier?[T]=tu(W):T=`M${ee},${M} ${b.value.x},${b.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:ee,sourceY:M,sourcePosition:L,targetX:b.value.x,targetY:b.value.y,targetPosition:_,sourceNode:m.value,sourceHandle:S,targetNode:y.value,targetHandle:oe,markerEnd:E.value,markerStart:g.value,connectionStatus:d.value}):n.h("path",{d:T,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":E.value,"marker-start":g.value})))}}}),j1=["id","markerWidth","markerHeight","markerUnits","orient"],W1={name:"MarkerType",compatConfig:{MODE:3}},K1=n.defineComponent({...W1,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(vl).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(vl).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,j1))}}),q1={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},X1={name:"MarkerDefinitions",compatConfig:{MODE:3}},Z1=n.defineComponent({...X1,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Pe(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=Ro(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",q1,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(K1,{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))])]))}}),J1={name:"Edges",compatConfig:{MODE:3}},Q1=n.defineComponent({...J1,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Pe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Z1),(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(N0)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(G1),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(Y1))],64))}}),e_=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:y,ariaLiveMessage:b,snapToGrid:g,snapGrid:E,nodeDragThreshold:N,nodesDraggable:h,elementsSelectable:k,nodesConnectable:q,nodesFocusable:B,hooks:H}=Pe(),A=n.ref(null);n.provide(Gd,A),n.provide(Hd,e.id);const S=n.inject(Wi),L=n.getCurrentInstance(),ee=Kd(),{node:M,parentNode:oe}=Wd(e.id),{emit:_,on:Y}=H0(M,r),T=n.toRef(()=>typeof M.draggable>"u"?h.value:M.draggable),W=n.toRef(()=>typeof M.selectable>"u"?k.value:M.selectable),Q=n.toRef(()=>typeof M.connectable>"u"?q.value:M.connectable),te=n.toRef(()=>typeof M.focusable>"u"?B.value:M.focusable),C=n.computed(()=>W.value||T.value||H.value.nodeClick.hasListeners()||H.value.nodeDoubleClick.hasListeners()||H.value.nodeMouseEnter.hasListeners()||H.value.nodeMouseMove.hasListeners()||H.value.nodeMouseLeave.hasListeners()),Z=n.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),le=n.computed(()=>{const j=M.type||"default",D=S==null?void 0:S[`node-${j}`];if(D)return D;let K=M.template||f.value[j];if(typeof K=="string"&&L){const he=Object.keys(L.appContext.components);he&&he.includes(j)&&(K=n.resolveComponent(j,!1))}return K&&typeof K!="string"?K:(r.error(new Qe(qe.NODE_TYPE_MISSING,K)),!1)}),pe=Yd({id:e.id,el:A,disabled:()=>!T.value,selectable:W,dragHandle:()=>M.dragHandle,onStart(j){_.dragStart(j)},onDrag(j){_.drag(j)},onStop(j){_.dragStop(j)},onClick(j){v(j)}}),be=n.computed(()=>M.class instanceof Function?M.class(M):M.class),de=n.computed(()=>{const j=(M.style instanceof Function?M.style(M):M.style)||{},D=M.width instanceof Function?M.width(M):M.width,K=M.height instanceof Function?M.height(M):M.height;return!j.width&&D&&(j.width=typeof D=="string"?D:`${D}px`),!j.height&&K&&(j.height=typeof K=="string"?K:`${K}px`),j}),me=n.toRef(()=>Number(M.zIndex??de.value.zIndex??0));return u(j=>{(j.includes(e.id)||!j.length)&&ve()}),n.onMounted(()=>{n.watch(()=>M.hidden,(j=!1,D,K)=>{!j&&A.value&&(e.resizeObserver.observe(A.value),K(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),n.watch([()=>M.position.x,()=>M.position.y,()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.x},()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.y},()=>{var j;return(j=oe.value)==null?void 0:j.computedPosition.z},me,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var j;return(j=oe.value)==null?void 0:j.dimensions.height},()=>{var j;return(j=oe.value)==null?void 0:j.dimensions.width}],([j,D,K,he,we,$e])=>{const ke={x:j,y:D,z:$e+(m.value&&M.selected?1e3:0)};typeof K<"u"&&typeof he<"u"?M.computedPosition=b0({x:K,y:he,z:we},ke):M.computedPosition=ke},{flush:"post",immediate:!0}),n.watch([()=>M.extent,p],([j,D],[K,he])=>{(j!==K||D!==he)&&ye()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?tl(()=>Z).toBe(!0).then(ye):ye(),()=>M.hidden?null:n.h("div",{ref:A,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":M.type||"default"}`,{[o.value]:T.value,dragging:pe==null?void 0:pe.value,draggable:T.value,selected:M.selected,selectable:W.value,parent:M.isParent},be.value],style:{visibility:Z.value?"visible":"hidden",zIndex:M.computedPosition.z??me.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:C.value?"all":"none",...de.value},tabIndex:te.value?0:void 0,role:te.value?"group":void 0,"aria-describedby":y.value?void 0:`${dd}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:Ce,onMousemove:Se,onMouseleave:ge,onContextmenu:J,onClick:v,onDblclick:X,onKeydown:V},[n.h(le.value===!1?f.value.default:le.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...Y},selected:M.selected,resizing:M.resizing,dragging:pe.value,connectable:Q.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??me.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:ve})]);function ye(){const j=M.computedPosition,{computedPosition:D,position:K}=Cl(M,g.value?ji(j,E.value):j,r.error,p.value,oe.value);(M.computedPosition.x!==D.x||M.computedPosition.y!==D.y)&&(M.computedPosition={...M.computedPosition,...D}),(M.position.x!==K.x||M.position.y!==K.y)&&(M.position=K)}function ve(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function Ce(j){pe!=null&&pe.value||_.mouseEnter({event:j,node:M})}function Se(j){pe!=null&&pe.value||_.mouseMove({event:j,node:M})}function ge(j){pe!=null&&pe.value||_.mouseLeave({event:j,node:M})}function J(j){return _.contextMenu({event:j,node:M})}function X(j){return _.doubleClick({event:j,node:M})}function v(j){W.value&&(!i.value||!T.value||N.value>0)&&Tl(M,l.value,c,s,a,!1,A.value),_.click({event:j,node:M})}function V(j){if(!(Nl(j)||y.value))if(fd.includes(j.key)&&W.value){const D=j.key==="Escape";Tl(M,l.value,c,s,a,D,A.value)}else T.value&&M.selected&&Fn[j.key]&&(j.preventDefault(),b.value=`Moved selected node ${j.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,ee({x:Fn[j.key].x,y:Fn[j.key].y},j.shiftKey))}}});function t_(e={includeHiddenNodes:!1}){const{nodes:t}=Pe();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 n_={class:"vue-flow__nodes vue-flow__container"},o_={name:"Nodes",compatConfig:{MODE:3}},i_=n.defineComponent({...o_,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Pe(),a=t_(),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",n_,[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(e_),{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 a_(){const{emits:e}=Pe();n.onMounted(()=>{if(Dd()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Qe(qe.MISSING_STYLES))}})}const l_=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),r_={name:"VueFlow",compatConfig:{MODE:3}},s_=n.defineComponent({...r_,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=nl(i,"modelValue",o),r=nl(i,"nodes",o),s=nl(i,"edges",o),c=Pe(i),d=W0({modelValue:l,nodes:r,edges:s},i,c);return q0(o,c.hooks),U1(),a_(),n.provide(Wi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(B1,null,{default:n.withCtx(()=>[n.createVNode(Q1),l_,n.createVNode(i_),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(z1)],512))}}),c_={name:"Panel",compatConfig:{MODE:3}},lu=n.defineComponent({...c_,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Pe(),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))}}),hn=["red","amber","green","teal","blue","indigo","violet","pink"],ru={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function d_(e){return typeof e=="string"&&e in ru}const u_={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},f_=.15;function m_(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 p_(e){if(typeof e!="string")return null;const t=m_(e);if(!t||t.s<f_)return null;let o=null,i=1/0;for(const a of hn){const l=Math.abs(t.h-u_[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function at(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(d_(t))return t;const o=e==null?void 0:e.properties;return p_((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Pl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const h_={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)"},y_={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 su(e,t=!1){return e?t?y_[e]:h_[e]:null}function Yn(e){return ru[e]}function jn(e){return`var(--em-swatch-${e}-bar)`}const g_=["width","height","innerHTML"],b_=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"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(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,g_))}}),ze=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=ze(b_,[["__scopeId","data-v-92c1dba8"]]),__={class:"em-inline-issue__msgs"},yn=ze(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(Ve,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",__,[(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"]]),E_={class:"em-mlang"},k_={class:"em-mlang__tabs",role:"tablist"},w_=["aria-selected","onClick"],v_={key:0,class:"em-mlang__dot"},zl=ze(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",E_,[n.createElementVNode("div",k_,[(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",v_,"•")):n.createCommentVNode("",!0)],10,w_))),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"]]),N_=["disabled"],$_={class:"em-panel__sub-label"},I_={class:"em-field"},S_={class:"em-field"},x_={class:"em-field"},C_={class:"em-class"},R_={class:"em-field"},V_={class:"em-field"},A_={class:"em-field"},T_={class:"em-field"},M_={class:"em-multilang"},B_={class:"em-multilang"},O_={class:"em-jpa"},D_={class:"em-field"},L_={class:"em-field"},P_={class:"em-field"},z_={class:"em-swatch"},U_={class:"em-swatch__row"},F_=["title","onClick"],cu=ze(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,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(M=>M.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(M=>M.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var M;return at(((M=r.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=M=>M;function p(M){return M==="inherit"?"기본(따름)":M}function m(M){l.value&&a.updateEntity(l.value.modelId,M)}function y(M,oe,_){var T;const Y=((T=l.value)==null?void 0:T.table)??{physicalName:""};m(M==="physicalName"?{table:{...Y,physicalName:_}}:{table:{...Y,logicalName:{...Y.logicalName,[oe]:_}}})}function b(M){m({description:Object.keys(M).length?M:void 0})}function g(M,oe){var _;m({jpaAttrs:{...(_=l.value)==null?void 0:_.jpaAttrs,[M]:oe}})}function E(M,oe){g(M,oe)}const N=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),h=n.computed(()=>{var M,oe;return!((oe=(M=l.value)==null?void 0:M.jpaAttrs)!=null&&oe.useDiscriminator)});function k(M){g("discriminatorType",M==="inherit"?void 0:M)}function q(M){m({hasPersonalInfo:M})}function B(M){m({superClass:M.trim()||void 0})}function H(M){m({schema:M.trim()||void 0})}function A(M){m({abstractClass:M})}const S=n.computed(()=>{var M,oe;return((oe=(M=l.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function L(M){const oe=M.split(",").map(_=>_.trim()).filter(Boolean);m({declarationOfInterfaces:oe.length?oe:void 0})}function ee(M){l.value&&a.setEntitySwatch(l.value.modelId,M)}return(M,oe)=>{var _,Y,T;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:oe[0]||(oe[0]=W=>i("toggle"))},[n.createElementVNode("span",$_,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||l.value.name||"엔티티"),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(yn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",I_,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=W=>m({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",S_,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=W=>m({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",x_,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=W=>m({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",C_,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",R_,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=W=>B(W))},null,8,["model-value"])]),n.createElementVNode("label",V_,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":S.value,"onUpdate:modelValue":oe[5]||(oe[5]=W=>L(W))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=W=>A(W))},null,8,["model-value"])]),n.createElementVNode("label",A_,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-table",width:"100%","model-value":((_=l.value.table)==null?void 0:_.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",T_,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=W=>H(W))},null,8,["model-value"])]),n.createElementVNode("fieldset",M_,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var Q,te;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":((te=(Q=l.value.table)==null?void 0:Q.logicalName)==null?void 0:te[W])??"","onUpdate:modelValue":C=>y("logicalName",W,C)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",B_,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(zl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",O_,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var Q;return n.createVNode(n.unref(ae.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((Q=l.value.jpaAttrs)!=null&&Q[W.key]),"onUpdate:modelValue":te=>E(W.key,te)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",D_,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:h.value,"model-value":((Y=l.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=W=>g("discriminatorColumnName",W.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",L_,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ae.BSSelect),{disabled:h.value,"model-value":N.value,items:u,"value-provider":f,"label-provider":p,"onUpdate:modelValue":oe[10]||(oe[10]=W=>W&&k(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",P_,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(T=l.value.jpaAttrs)==null?void 0:T.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=W=>g("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":!!l.value.hasPersonalInfo,"onUpdate:modelValue":q},null,8,["model-value"]),n.createElementVNode("fieldset",z_,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",U_,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:oe[12]||(oe[12]=W=>ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(jn)(W)}),title:n.unref(Yn)(W),onClick:Q=>ee(W)},null,14,F_))),128))])])],64)):n.createCommentVNode("",!0)],8,N_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),du=["ko","en","ja","zh"];function H_(e){if(e)for(const t of du){const o=e[t];if(o)return o}}function Ul(e){const t=H_(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function G_(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:du.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const Y_=["aria-expanded"],j_=["aria-selected","onClick","onMouseenter"],W_={key:0,class:"gcc__opt gcc__opt--empty"},uu=ze(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(A=>A.groupCode===o.modelValue)),p=n.computed(()=>f.value?Ul(f.value):"");n.watch(p,A=>{c.value||(s.value=A)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:G_(o.items,s.value));function y(){var S;const A=(S=a.value)==null?void 0:S.getBoundingClientRect();A&&(u.value={left:`${A.left}px`,top:`${A.bottom}px`,width:`${A.width}px`})}function b(){c.value=!0,y(),d.value=Math.max(0,m.value.findIndex(A=>A.groupCode===o.modelValue)),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),document.addEventListener("mousedown",H)}function g(){c.value=!1,window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),document.removeEventListener("mousedown",H)}n.onBeforeUnmount(g);function E(){b(),n.nextTick(()=>{var A;return(A=l.value)==null?void 0:A.select()})}function N(){c.value||b(),d.value=0}function h(A){i("update:modelValue",A.groupCode),s.value=Ul(A),g()}function k(){i("update:modelValue",void 0),s.value="",g()}function q(){s.value.trim()===""?k():(s.value=p.value,g())}function B(A){var S;if(A.key==="ArrowDown")c.value||b(),d.value=Math.min(d.value+1,m.value.length-1),A.preventDefault();else if(A.key==="ArrowUp")d.value=Math.max(d.value-1,0),A.preventDefault();else if(A.key==="Enter"){const L=m.value[d.value];L&&h(L),A.preventDefault()}else A.key==="Escape"&&(s.value=p.value,g(),(S=l.value)==null||S.blur())}function H(A){var L,ee;const S=A.target;!((L=a.value)!=null&&L.contains(S))&&!((ee=r.value)!=null&&ee.contains(S))&&q()}return(A,S)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=L=>s.value=L),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:E,onInput:N,onKeydown:B},null,40,Y_),[[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:S[1]||(S[1]=n.withModifiers(()=>{},["prevent"])),onClick:k},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(L,ee)=>(n.openBlock(),n.createElementBlock("li",{key:L.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":ee===d.value,"is-selected":L.groupCode===e.modelValue}]),role:"option","aria-selected":L.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=n.withModifiers(()=>{},["prevent"])),onClick:M=>h(L),onMouseenter:M=>d.value=ee},n.toDisplayString(n.unref(Ul)(L)),43,j_))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",W_,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),K_=["disabled"],q_={class:"em-aw__toolbar"},X_={class:"em-aw__count"},Z_={class:"em-aw__scroll"},J_={class:"em-aw__table"},Q_={class:"c-del"},eE={class:"c-expand"},tE=["title","onClick","onKeydown"],nE={class:"c-constraints"},oE={class:"em-aw__cflags"},iE=["title"],aE={colspan:"8"},lE={class:"em-aw__detail"},rE={class:"em-aw__dgroup"},sE={class:"em-aw__df"},cE={class:"em-aw__df"},dE={class:"em-aw__df"},uE={class:"em-aw__dgroup"},fE={class:"em-aw__dgroup"},mE={class:"em-aw__df"},pE={key:0,class:"em-aw__df"},hE={class:"em-aw__df"},yE={class:"c-expand"},gE={class:"em-aw__caret is-static","aria-hidden":"true"},bE={class:"c-del"},_E={class:"c-expand"},EE=["title","onClick","onKeydown"],kE={class:"em-aw__embed-label"},wE={class:"em-aw__ro"},vE={class:"em-aw__ro"},NE={class:"c-constraints"},$E={class:"em-aw__ro"},IE={key:0,class:"em-aw__detail-row em-aw__embed-detail"},SE={colspan:"8"},xE={class:"em-aw__detail"},CE={class:"em-aw__dgroup"},RE={key:0,class:"em-aw__df"},VE={class:"em-aw__df"},AE={class:"em-aw__df"},TE={key:0},ME=6,BE=5,OE="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ta="__OWN__",DE=ze(n.defineComponent({__name:"EntityAttributesWide",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(()=>{var z;return((z=i.value)==null?void 0:z.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var z;return(((z=i.value)==null?void 0:z.attributes)??[]).filter(U=>U.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(z){return s.value.has(z)}function d(z){const U=new Set(s.value);U.has(z)?U.delete(z):U.add(z),s.value=U}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(z){return z==="none"?"(없음)":z}const p=z=>z;function m(z,U){i.value&&o.updateAttribute(i.value.modelId,z.modelId,U)}function y(z){return!!i.value&&!!bi(o.state.logical,i.value.modelId,z.modelId)}function b(z,U){m(z,{naturalId:U||void 0,naturalIdMutable:U?z.naturalIdMutable:void 0})}function g(){return{naturalId:void 0,naturalIdMutable:void 0}}function E(z,U){m(z,{identifier:U,...U?g():{}})}function N(z,U){m(z,{transient:U||void 0,...U?g():{}})}function h(z){return!!z.transient}const k=z=>z.value,q=z=>z.label;function B(z,U){if(!U)return;const w=oe.value.find(F=>F.type===U);if(w){const F=z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"};m(z,{type:U,customType:void 0,dbAttrs:[{...F,dataType:w.dataType,length:w.length,scale:w.scale}]});return}m(z,U===Et?{type:U}:{type:U,customType:void 0})}function H(z,U){m(z,{customType:U.trim()===""?void 0:U})}function A(z,U){const F={...z.dbAttrs[0]??{modelId:z.modelId+".c",physicalName:z.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!io.has(F.dataType)&&(F.scale=void 0),m(z,{dbAttrs:[F]})}function S(z){var U;return io.has(((U=z.dbAttrs[0])==null?void 0:U.dataType)??"")}function L(z,U,w){var F;A(z,{logicalName:{...(F=z.dbAttrs[0])==null?void 0:F.logicalName,[U]:w}})}function ee(z){return z.personalInfoAttributeType??"none"}function M(z,U){m(z,{personalInfoAttributeType:U==="none"?void 0:U})}const oe=n.computed(()=>o.predefinedCustomTypeCatalog.value),_=n.computed(()=>o.embeddableCatalog.value);function Y(z){var U,w;return((U=z.label)==null?void 0:U.ko)??((w=z.label)==null?void 0:w.en)??z.type}function T(z){!z||!i.value||o.addPredefinedEmbed(i.value.modelId,z)}const W=n.computed(()=>o.groupCodeCatalog.value);function Q(z){var U;return((U=W.value.find(w=>w.groupCode===z.groupCode))==null?void 0:U.codes)??[]}function te(z){return["none",...Q(z)]}function C(z){return z==="none"?"none":z.code}function Z(z){var w,F;if(z==="none")return"(없음)";const U=((w=z.label)==null?void 0:w.ko)??((F=z.label)==null?void 0:F.en);return U?`${z.code} (${U})`:z.code}function le(z,U){i.value&&o.setAttributeGroupCode(i.value.modelId,z.modelId,U)}function pe(z,U){m(z,{defaultValue:U==="none"?void 0:U})}function be(z,U){m(z,{defaultValue:U.trim()===""?void 0:U})}function de(z){return z.attrType.startsWith("EMBED")&&z.dbAttrs.length>0}function me(z,U,w){const F=z.dbAttrs.map((ne,ce)=>{if(ce!==U)return ne;const $={...ne,...w};for(const x of Object.keys(w))w[x]===void 0&&delete $[x];return $});i.value&&o.setEmbedColumns(i.value.modelId,z.modelId,F)}function ye(z,U,w,F){var ne;me(z,U,{logicalName:{...(ne=z.dbAttrs[U])==null?void 0:ne.logicalName,[w]:F}})}function ve(z,U){var ne,ce,$;if(z.attrType==="EMBED_PREDEF"){const x=(ne=o.embeddableCatalog.value.find(ie=>ie.type===z.type))==null?void 0:ne.fields[U];return x?{name:x.name,physicalName:x.physicalName,dataType:x.dataType,length:x.length,shareable:x.shareable,logicalName:x.logicalName}:void 0}const w=(ce=z.embedded)==null?void 0:ce.embeddableRef;if(!w)return;const F=($=o.state.logical.entities.find(x=>x.modelId===w))==null?void 0:$.attributes.flatMap(x=>x.dbAttrs)[U];return F?{physicalName:F.physicalName,dataType:F.dataType,length:F.length,scale:F.scale,logicalName:F.logicalName}:void 0}function Ce(z,U){var w,F;return((w=ve(z,U))==null?void 0:w.dataType)||((F=z.dbAttrs[U])==null?void 0:F.dataType)||""}function Se(z,U){var w,F;return((w=ve(z,U))==null?void 0:w.length)??((F=z.dbAttrs[U])==null?void 0:F.length)}function ge(z,U){var w,F;return((w=ve(z,U))==null?void 0:w.scale)??((F=z.dbAttrs[U])==null?void 0:F.scale)}const J=["inherit","true","false"];function X(z){return z==="inherit"?"기본(따름)":z}function v(z){return(z==null?void 0:z.updatable)===void 0?"inherit":z.updatable?"true":"false"}function V(z,U,w){me(z,U,{updatable:w==="inherit"?void 0:w==="true"})}function j(z,U){A(z,{updatable:U==="inherit"?void 0:U==="true"})}const D=["inherit","true","false"];function K(z){return z==="inherit"?"기본(따름)":z}function he(z){return(z==null?void 0:z.insertable)===void 0?"inherit":z.insertable?"true":"false"}function we(z,U,w){me(z,U,{insertable:w==="inherit"?void 0:w==="true"})}function $e(z,U){A(z,{insertable:U==="inherit"?void 0:U==="true"})}const ke=n.computed(()=>i.value?ni(i.value,o.state.logical.entities):[]),Re=n.computed(()=>Qt(ke.value.flatMap(z=>z.attributes.flatMap(U=>U.dbAttrs)))),Ae=n.computed(()=>ke.value.flatMap(z=>z.attributes.filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>{var w;return{modelId:U.dbAttrs[0].modelId,physical:U.dbAttrs[0].physicalName||U.name,isCurrency:U.type==="Currency",ownerName:z.modelId===((w=i.value)==null?void 0:w.modelId)?void 0:z.name}})));function Oe(){const z=[...Ae.value].sort((U,w)=>Number(w.isCurrency)-Number(U.isCurrency));return[ta,...z.map(U=>U.modelId)]}function We(z){if(z===ta)return"전용 컬럼(OWN)";const U=Ae.value.find(F=>F.modelId===z);return U?`↗ ${U.ownerName?`${U.ownerName}.`:""}${U.physical} (${U.isCurrency?"통화":"공유"})`:z}function I(z){return(z==null?void 0:z.sharedColumnRef)??ta}function O(z,U,w){me(z,U,{sharedColumnRef:w===ta?void 0:w})}function re(z){return(z==null?void 0:z.sharedColumnRef)!=null}function ue(z){var U;return((U=Sn(z,Re.value))==null?void 0:U.physicalName)??""}return(z,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",q_,[n.createElementVNode("span",X_,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:U[0]||(U[0]=w=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"구분선",onClick:U[1]||(U[1]=w=>n.unref(o).addDivider(i.value.modelId))}),_.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:_.value,"value-provider":w=>w.type,"label-provider":Y,"onUpdate:modelValue":T},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",Z_,[n.createElementVNode("table",J_,[U[21]||(U[21]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-expand"}),n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-type"},"타입"),n.createElementVNode("th",{class:"c-logical"},"논리명"),n.createElementVNode("th",{class:"c-col"},"컬럼(물리)"),n.createElementVNode("th",{class:"c-dtype"},"dataType"),n.createElementVNode("th",{class:"c-len"},"len"),n.createElementVNode("th",{class:"c-constraints"},"제약"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,w=>{var F,ne,ce,$,x,ie,R,G,P,se,Ne;return n.openBlock(),n.createElementBlock(n.Fragment,{key:w.modelId},[w.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(w.modelId)}])},[U[2]||(U[2]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-divlabel-${w.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":w.name,"onUpdate:modelValue":fe=>m(w,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:ME,class:"em-aw__divider-note"},"── 시각 구획 ──"),n.createElementVNode("td",Q_,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])])],2)):de(w)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(w.modelId)}])},[n.createElementVNode("td",yE,[n.createElementVNode("span",gE,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${w.modelId}`,width:"100%",placeholder:"이름","model-value":w.name,"onUpdate:modelValue":fe=>m(w,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-type-${w.modelId}`,width:"100%",disabled:"","model-value":w.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:BE,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(w.dbAttrs.length)+"개",1),n.createElementVNode("td",bE,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(w.dbAttrs,(fe,Me)=>{var Le,Fe,et,je,Ke,Rt,Jt;return n.openBlock(),n.createElementBlock(n.Fragment,{key:fe.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(fe.modelId)}])},[n.createElementVNode("td",_E,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(fe.modelId)}]),role:"button",tabindex:"0",title:c(fe.modelId)?"오버라이드 접기":"오버라이드 펼치기",onClick:_e=>d(fe.modelId),onKeydown:[n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(_e=>d(fe.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,EE)]),n.createElementVNode("td",kE,"↳ "+n.toDisplayString(((Le=ve(w,Me))==null?void 0:Le.name)??((Fe=ve(w,Me))==null?void 0:Fe.physicalName)??`컬럼 ${Me+1}`),1),U[13]||(U[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-logical-${fe.modelId}`,width:"100%",placeholder:((je=(et=ve(w,Me))==null?void 0:et.logicalName)==null?void 0:je.ko)??"논리명","model-value":((Ke=fe.logicalName)==null?void 0:Ke.ko)??"","onUpdate:modelValue":_e=>ye(w,Me,"ko",_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-embed-col-${fe.modelId}`,width:"100%",disabled:re(fe),placeholder:((Rt=ve(w,Me))==null?void 0:Rt.physicalName)??"컬럼","model-value":re(fe)?ue(fe):fe.physicalName,"onUpdate:modelValue":_e=>me(w,Me,{physicalName:_e})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(yn,{controller:n.unref(o),"ref-id":fe.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",wE,n.toDisplayString(Ce(w,Me)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",vE,n.toDisplayString(Se(w,Me)??""),1)]),n.createElementVNode("td",NE,[n.createElementVNode("span",$E,n.toDisplayString(ge(w,Me)!=null?`scale ${ge(w,Me)}`:""),1)]),U[14]||(U[14]=n.createElementVNode("td",null,null,-1))],2),c(fe.modelId)?(n.openBlock(),n.createElementBlock("tr",IE,[U[19]||(U[19]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",SE,[n.createElementVNode("div",xE,[n.createElementVNode("fieldset",CE,[U[18]||(U[18]=n.createElementVNode("legend",null,"컬럼 오버라이드",-1)),(Jt=ve(w,Me))!=null&&Jt.shareable?(n.openBlock(),n.createElementBlock("label",RE,[U[15]||(U[15]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":I(fe),items:Oe(),"value-provider":p,"label-provider":We,"onUpdate:modelValue":_e=>_e&&O(w,Me,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",VE,[U[16]||(U[16]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":he(fe),items:D,"value-provider":p,"label-provider":K,"onUpdate:modelValue":_e=>_e&&we(w,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",AE,[U[17]||(U[17]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:re(fe),"model-value":re(fe)?"false":v(fe),items:J,"value-provider":p,"label-provider":X,"onUpdate:modelValue":_e=>_e&&V(w,Me,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":l.value.has(w.modelId),"em-aw__open":c(w.modelId)})},[n.createElementVNode("td",eE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(w.modelId)}]),role:"button",tabindex:"0",title:c(w.modelId)?"상세 접기":"상세 펼치기",onClick:fe=>d(w.modelId),onKeydown:[n.withKeys(n.withModifiers(fe=>d(w.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(fe=>d(w.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,tE)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-name-${w.modelId}`,width:"100%",placeholder:"이름","model-value":w.name,"onUpdate:modelValue":fe=>m(w,{name:fe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-type-${w.modelId}`,width:"100%",placeholder:"타입",disabled:!!w.groupCode,items:n.unref(Tr)(w.type,oe.value),"value-provider":k,"label-provider":q,"model-value":w.type,"onUpdate:modelValue":fe=>B(w,fe)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),w.type===n.unref(Et)?(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:0,name:`aw-customtype-${w.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":w.customType??"","onUpdate:modelValue":fe=>H(w,fe)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-logical-${w.modelId}`,width:"100%",placeholder:"논리명","model-value":((ne=(F=w.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko)??"","onUpdate:modelValue":fe=>L(w,"ko",fe)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`aw-col-${w.modelId}`,width:"100%",placeholder:"컬럼",disabled:h(w),"model-value":((ce=w.dbAttrs[0])==null?void 0:ce.physicalName)??"","onUpdate:modelValue":fe=>A(w,{physicalName:fe})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(yn,{controller:n.unref(o),"ref-id":($=w.dbAttrs[0])==null?void 0:$.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{name:`aw-dtype-${w.modelId}`,width:"100%",placeholder:"dataType",disabled:h(w),items:n.unref(Vr)(((x=w.dbAttrs[0])==null?void 0:x.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":p,"label-provider":n.unref(Da),"model-value":((ie=w.dbAttrs[0])==null?void 0:ie.dataType)??"","onUpdate:modelValue":fe=>fe&&A(w,{dataType:fe})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-len-${w.modelId}`,width:"100%",placeholder:"len",disabled:h(w),"model-value":(R=w.dbAttrs[0])==null?void 0:R.length,"onUpdate:modelValue":fe=>A(w,{length:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",nE,[n.createElementVNode("div",oE,[n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-pk-${w.modelId}`,label:"PK","model-value":w.identifier,disabled:a.value||h(w),"onUpdate:modelValue":fe=>E(w,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nn-${w.modelId}`,label:"NN","model-value":w.notNull,disabled:h(w),"onUpdate:modelValue":fe=>m(w,{notNull:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-uq-${w.modelId}`,label:"UQ","model-value":!!((G=w.dbAttrs[0])!=null&&G.unique),disabled:h(w),"onUpdate:modelValue":fe=>A(w,{unique:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(w)?OE:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:fe=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])],8,iE)],2),c(w.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":l.value.has(w.modelId)}])},[U[12]||(U[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",aE,[n.createElementVNode("div",lE,[n.createElementVNode("fieldset",rE,[U[6]||(U[6]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",sE,[U[3]||(U[3]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(ae.BSNumberInput),{name:`aw-scale-${w.modelId}`,width:"72px",placeholder:"scale",disabled:h(w)||!S(w),"model-value":(P=w.dbAttrs[0])==null?void 0:P.scale,"onUpdate:modelValue":fe=>A(w,{scale:fe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-ai-${w.modelId}`,label:"Auto Increment","model-value":!!((se=w.dbAttrs[0])!=null&&se.autoIncrement),disabled:h(w)||!w.identifier,"onUpdate:modelValue":fe=>A(w,{autoIncrement:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",cE,[U[4]||(U[4]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-ins-${w.modelId}`,width:"110px",disabled:h(w),"model-value":he(w.dbAttrs[0]),items:D,"value-provider":p,"label-provider":K,"onUpdate:modelValue":fe=>fe&&$e(w,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",dE,[U[5]||(U[5]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{name:`aw-upd-${w.modelId}`,width:"110px",disabled:h(w),"model-value":v(w.dbAttrs[0]),items:J,"value-provider":p,"label-provider":X,"onUpdate:modelValue":fe=>fe&&j(w,fe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",uE,[U[7]||(U[7]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-tr-${w.modelId}`,label:"@Transient","model-value":!!w.transient,disabled:w.identifier,"onUpdate:modelValue":fe=>N(w,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-nid-${w.modelId}`,label:"@NaturalId","model-value":!!w.naturalId,disabled:w.identifier||h(w),"onUpdate:modelValue":fe=>b(w,fe)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${w.modelId}`,label:"mutable","model-value":!!w.naturalIdMutable,disabled:h(w)||!w.naturalId,"onUpdate:modelValue":fe=>m(w,{naturalIdMutable:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`aw-mv-${w.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ne=w.dbAttrs[0])!=null&&Ne.multiValue),disabled:h(w),"onUpdate:modelValue":fe=>A(w,{multiValue:fe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",fE,[U[11]||(U[11]=n.createElementVNode("legend",null,"의미",-1)),n.createElementVNode("label",mE,[U[8]||(U[8]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"150px","model-value":ee(w),items:u,"value-provider":p,"label-provider":f,"onUpdate:modelValue":fe=>fe&&M(w,fe)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",pE,[U[9]||(U[9]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(uu,{"model-value":w.groupCode,items:W.value,"onUpdate:modelValue":fe=>le(w,fe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",hE,[U[10]||(U[10]=n.createElementVNode("span",null,"기본값",-1)),Q(w).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"150px","model-value":w.defaultValue??"none",items:te(w),"value-provider":C,"label-provider":Z,"onUpdate:modelValue":fe=>fe&&pe(w,fe)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`aw-default-${w.modelId}`,width:"150px",placeholder:"기본값","model-value":w.defaultValue??"","onUpdate:modelValue":fe=>be(w,fe)},null,8,["name","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",TE,[...U[20]||(U[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,K_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-e52d4460"]]),LE=["disabled"],PE={class:"em-idxw__list"},zE={class:"em-idxw__list-head"},UE=["onClick"],FE={class:"em-idxw__item-name"},HE={key:0,class:"em-idxw__badge"},GE={class:"em-idxw__item-cnt"},YE={key:0,class:"em-idxw__empty"},jE={key:0,class:"em-idxw__edit"},WE={class:"em-idxw__form"},KE={class:"em-field em-idxw__name"},qE={class:"em-field"},XE=["value"],ZE={class:"em-idxw__transfer"},JE={class:"em-idxw__pane"},QE={class:"em-idxw__pane-head"},ek={class:"em-idxw__cols"},tk=["onClick"],nk={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},ok={key:0,class:"em-idxw__empty"},ik={class:"em-idxw__arrows"},ak={class:"em-idxw__pane"},lk={class:"em-idxw__pane-head"},rk={class:"em-idxw__cols"},sk={class:"em-idxw__col-name"},ck={key:0,class:"em-idxw__inh",title:"슈퍼클래스 상속 컬럼"},dk={class:"em-idxw__col-ops"},uk=["disabled","onClick"],fk=["disabled","onClick"],mk=["onClick"],pk={key:0,class:"em-idxw__empty"},hk={key:1,class:"em-idxw__edit em-idxw__edit--empty"},yk=ze(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(S=>S.modelId===t.entityId)??null),a=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.indexes)??[]}),l=n.computed(()=>{var S;return((S=i.value)==null?void 0:S.attributes)??[]}),r=n.ref(null);n.watch(a,S=>{var L;S.some(ee=>ee.modelId===r.value)||(r.value=((L=S[0])==null?void 0:L.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(S=>S.modelId===r.value)??null),c=n.computed(()=>i.value?no(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(L=>L.columnRef))??[])}),u=n.computed(()=>[...l.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:p(S),inherited:!1})),...c.value.filter(S=>!d.value.has(S.modelId)).map(S=>({ref:S.modelId,label:m(S),inherited:!0}))]),f=n.ref(new Set);n.watch(r,()=>f.value=new Set);function p(S){var ee;const L=(ee=S.dbAttrs[0])==null?void 0:ee.physicalName;return L&&L!==S.name?`${S.name} (${L})`:S.name}function m(S){return S.physicalName&&S.physicalName!==S.field?`${S.field} (${S.physicalName})`:S.field}function y(S){const L=l.value.find(M=>M.modelId===S);if(L)return p(L);const ee=c.value.find(M=>M.modelId===S);return ee?m(ee):S}function b(S){return to(S)}function g(S,L){i.value&&o.updateIndex(i.value.modelId,S,L)}function E(){var L;if(!i.value)return;const S=De();o.addIndex(i.value.modelId,{modelId:S,name:`idx_${(((L=i.value.indexes)==null?void 0:L.length)??0)+1}`,unique:!1,columns:[]}),r.value=S}function N(S){i.value&&o.removeIndex(i.value.modelId,S)}function h(S){s.value&&g(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function k(S){const L=new Set(f.value);L.has(S)?L.delete(S):L.add(S),f.value=L}function q(){const S=s.value;if(!S||!f.value.size)return;const L=[...f.value].map(ee=>({columnRef:ee,descending:!1}));g(S.modelId,{columns:[...S.columns,...L]}),f.value=new Set}function B(S){const L=s.value;L&&g(L.modelId,{columns:L.columns.filter((ee,M)=>M!==S)})}function H(S,L){const ee=s.value;ee&&g(ee.modelId,{columns:ee.columns.map((M,oe)=>oe===S?{...M,descending:L}:M)})}function A(S,L){const ee=s.value;if(!ee)return;const M=S+L;if(M<0||M>=ee.columns.length)return;const oe=[...ee.columns];[oe[S],oe[M]]=[oe[M],oe[S]],g(ee.modelId,{columns:oe})}return(S,L)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",PE,[n.createElementVNode("div",zE,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:E})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,ee=>(n.openBlock(),n.createElementBlock("li",{key:ee.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":ee.modelId===r.value}]),onClick:M=>r.value=ee.modelId},[n.createElementVNode("span",FE,n.toDisplayString(ee.name||"(이름 없음)"),1),ee.unique?(n.openBlock(),n.createElementBlock("span",HE,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",GE,n.toDisplayString(ee.columns.length),1)],10,UE))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",YE,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",jE,[n.createElementVNode("div",WE,[n.createElementVNode("label",KE,[L[4]||(L[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":L[0]||(L[0]=ee=>g(s.value.modelId,{name:ee}))},null,8,["model-value"]),n.createVNode(yn,{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":L[1]||(L[1]=ee=>g(s.value.modelId,{unique:ee}))},null,8,["model-value"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:L[2]||(L[2]=ee=>N(s.value.modelId))})]),n.createElementVNode("label",qE,[L[5]||(L[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:L[3]||(L[3]=ee=>h(ee.target.value))},null,40,XE)]),n.createElementVNode("div",ZE,[n.createElementVNode("div",JE,[n.createElementVNode("div",QE,"가용 컬럼 ("+n.toDisplayString(u.value.length)+")",1),n.createElementVNode("ul",ek,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,ee=>(n.openBlock(),n.createElementBlock("li",{key:ee.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":f.value.has(ee.ref)}]),onClick:M=>k(ee.ref)},[n.createTextVNode(n.toDisplayString(ee.label),1),ee.inherited?(n.openBlock(),n.createElementBlock("span",nk,"상속")):n.createCommentVNode("",!0)],10,tk))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",ok,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",ik,[n.createVNode(n.unref(ae.BSButton),{caption:"추가 →",disabled:!f.value.size,onClick:q},null,8,["disabled"])]),n.createElementVNode("div",ak,[n.createElementVNode("div",lk,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",rk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(ee,M)=>(n.openBlock(),n.createElementBlock("li",{key:M,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",sk,[n.createTextVNode(n.toDisplayString(y(ee.columnRef)),1),b(ee.columnRef)?(n.openBlock(),n.createElementBlock("span",ck,"상속")):n.createCommentVNode("",!0)]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idxw-desc-${M}`,class:"em-check",label:"DESC","model-value":ee.descending,"onUpdate:modelValue":oe=>H(M,oe)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",dk,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:M===0,onClick:oe=>A(M,-1)},"↑",8,uk),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:M===s.value.columns.length-1,onClick:oe=>A(M,1)},"↓",8,fk),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:oe=>B(M)},"✕",8,mk)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",pk,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",hk,"인덱스를 선택하거나 추가하세요."))],8,LE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-bb582869"]]),gk={class:"em-op-src"},bk={class:"em-op-src__actions"},fu=ze(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",gk,[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",bk,[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-2150d2fc"]]),_k=["disabled"],Ek={class:"em-ow__toolbar"},kk={class:"em-ow__count"},wk={class:"em-ow__scroll"},vk={class:"em-ow__table"},Nk={class:"c-del"},$k={key:0},Ik=ze(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(y=>y.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(y){return y==="none"?"(없음)":y}const c=y=>y;function d(y,b){a.value&&o.updateOperation(a.value.modelId,y.modelId,b)}function u(y,b,g){d(y,{description:{...y.description,[b]:g}})}function f(y){return y.personalInfoAttributeType??"none"}function p(y,b){d(y,{personalInfoAttributeType:b==="none"?void 0:b})}function m(y){i.openModal({component:fu,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:b=>d(y,{sourceCode:b})}})}return(y,b)=>{var g,E;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Ek,[n.createElementVNode("span",kk,"오퍼레이션 ("+n.toDisplayString(((g=a.value.operations)==null?void 0:g.length)??0)+")",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:b[0]||(b[0]=N=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",wk,[n.createElementVNode("table",vk,[b[2]||(b[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??[],N=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":N.name,"onUpdate:modelValue":k=>d(N,{name:k})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":k=>k&&d(N,{visibility:k})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((h=N.description)==null?void 0:h.ko)??"","onUpdate:modelValue":k=>u(N,"ko",k)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":f(N),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":k=>k&&p(N,k)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:N.sourceCode?"본문 ●":"본문",onClick:k=>m(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",Nk,[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:k=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(E=a.value.operations)!=null&&E.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",$k,[...b[1]||(b[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,_k)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),Sk={class:"em-detail__tabs"},xk=["onClick"],Ck={key:0,class:"em-detail__narrow"},Rk=ze(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",Sk,[(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,xk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createElementBlock("div",Ck,[n.createVNode(cu,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):r.value==="columns"?(n.openBlock(),n.createBlock(DE,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(yk,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(Ik,{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-e761e204"]]);function na(e,t,o){e.openModal({component:Rk,bind:{controller:n.markRaw(t),entityId:o}})}const mu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function Vk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=De(),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=De();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=De()}for(const a of t.indexes??[]){a.modelId=De();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const Ak=220;function Tk(e,t){let i=-1/0;for(const l of e.entityLayouts)i=Math.max(i,l.geo.location.x+(l.geo.size.width||Ak));for(const l of e.groupLayouts)i=Math.max(i,l.geo.location.x+l.geo.size.width);let a=1/0;for(const l of t.entityLayouts)a=Math.min(a,l.geo.location.x);for(const l of t.groupLayouts)a=Math.min(a,l.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const Fl=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),gn=Symbol("editorController");function pu(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function oa(e,t){const o=[];for(const i of t.remove)o.push(Mn(e,i));for(const i of t.update)o.push(on(e,i.attributeId,i.patch));for(const i of t.add)o.push(At(e,i));return o}function Wn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Kn(e,t){const o=[];for(const[i,a]of mp(e,t,De))o.push(...oa(i,a));return o}function hu(e,t,o){const i=new Set(o.remove);return Wn(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 Hl(e,t){const o=fo(e,t,De),i=oa(t,o),a=hu(e,t,o);return i.push(...Kn(a,t)),i}function yu(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:De()}))}function Mk(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,y)=>Math.max(m,y.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:De(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(At(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(g=>g.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,y=m?p.end1:p.end2,b=m?p.end2:p.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:t,multiplicity:b.multiplicity,navigable:b.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=fo(r,t,De);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(Mn(u.ownerId,u.dispId)),i.push(pi(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...oa(t,s));const c=hu(r,t,s);return i.push(...Kn(c,t)),i}function Bk(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(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var k;return((k=h.embedded)==null?void 0:k.associationRef)===l.modelId}))continue;const u=De(),f=d.attributes.reduce((h,k)=>Math.max(h,k.order),-1)+1,p=new Set(d.attributes.map(h=>h.name)),m=a(o.name);let y=m;for(let h=2;p.has(y);h++)y=`${m}${h}`;const b=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),g={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:b,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(At(c,g));const E=r?"end2":"end1",N=r?"end1":"end2";i.push(pi(l.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Ok(e=pu(),t={}){var Oe,We;const o=n.reactive(e);let i=new Xa(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.reservedWords),f=n.ref(t.selectableDataTypes),p=n.ref(t.largeEntityThreshold),m=n.ref(t.flagEntitiesWithoutRelations??!1),y=n.ref(!1),b=n.ref(!1),g=n.ref(!1),E=n.ref(0),N=n.ref(null);let h=0;const k=I=>{if(t.onNotice){t.onNotice(I);return}N.value={text:I,id:++h}},q=n.ref(((Oe=t.meta)==null?void 0:Oe.schemaVersion)??1),B=n.ref(((We=t.meta)==null?void 0:We.opWriteEnabled)??!1),H=n.computed(()=>q.value>=2&&B.value),A=t.historyTransport,S=n.computed(()=>H.value&&A!==void 0),L=t.restoreTransport,ee=n.ref(0),M=n.computed(()=>H.value&&_.value&&L!==void 0);async function oe(I){if(!L||!_.value)return{ok:!1,reason:"unavailable"};const O=await L(I);return O.ok&&ee.value++,O}const _=n.ref(!(q.value>=2&&B.value===!1)),Y=n.ref("LOGICAL_PHYSICAL"),T=n.ref("straight"),W=n.ref(!0),Q=n.ref(!0),te=n.ref(null),C=n.computed(()=>{var I;return((I=te.value)==null?void 0:I.kind)==="attribute"?{entityId:te.value.entityId,attrId:te.value.anchor}:null}),Z=n.computed(()=>{var I;return((I=te.value)==null?void 0:I.kind)==="attribute"?te.value.ids:[]}),le=n.computed(()=>{var I,O;return((I=te.value)==null?void 0:I.kind)==="entity"?te.value.id:((O=te.value)==null?void 0:O.kind)==="attribute"?te.value.entityId:null}),pe=n.ref(null);let be=0;const de=n.ref(null),me=n.ref(null);let ye=t.meta;function ve(){i.onChange(()=>{y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,E.value++})}ve();let Ce=null,Se=null;function ge(){Se==null||Se(),Se=null,Ce=null}function J(){if(ge(),!H.value||!t.opTransport)return;const I=new Hs({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:O=>{_.value=!1,me.value=O},onError:t.onOpError});I.seed((ye==null?void 0:ye.revSeed)??{}),Se=I.attach(i),Ce=I}J();const X=n.computed(()=>gr(o.logical,o.layout)),v=n.computed(()=>({reservedWords:u.value,selectableDataTypes:f.value,largeEntityThreshold:p.value,flagEntitiesWithoutRelations:m.value,embeddableCatalog:a.value,superClassCatalog:s.value})),V=n.computed(()=>Br(o.logical,v.value)),j=n.computed(()=>{const I=new Map;for(const O of V.value){if(!O.targetRef)continue;const re=I.get(O.targetRef);re?re.push(O):I.set(O.targetRef,[O])}return I}),D=I=>{_.value&&i.execute(I)},K=I=>o.layout.entityLayouts.some(O=>O.entityRef===I&&!!O.locked),he=I=>o.layout.groupLayouts.some(O=>O.groupRef===I&&!!O.locked),we=I=>{const O=o.logical.associations.find(re=>re.modelId===I);return!!O&&(K(O.end1.entityRef)||K(O.end2.entityRef))},$e=(I,O,re)=>{if(K(I))return;const ue=on(I,O,re),z=Wn(o.logical,I,w=>w.map(F=>F.modelId===O?{...F,...re}:F)),U=Kn(z,I);D(U.length?Ye("속성 수정",[ue,...U]):ue)};function ke(I){const O=I.map(ne=>o.layout.entityLayouts.find(ce=>ce.entityRef===ne)).filter(ne=>!!ne);if(!O.length)return{location:{x:40,y:40},size:{width:400,height:300}};let re=1/0,ue=1/0,z=-1/0,U=-1/0;for(const ne of O){const ce=ne.geo.size.width||220,$=ne.geo.size.height||140;re=Math.min(re,ne.geo.location.x),ue=Math.min(ue,ne.geo.location.y),z=Math.max(z,ne.geo.location.x+ce),U=Math.max(U,ne.geo.location.y+$)}const w=40,F=28;return{location:{x:re-w,y:ue-w-F},size:{width:z-re+w*2,height:U-ue+w*2+F}}}function Re(I,O,re){var ne;const ue=o.layout.groupLayouts.find(ce=>ce.groupRef===I),z=(ue==null?void 0:ue.geo.location)??O,U=O.x-z.x,w=O.y-z.y,F=[us(I,O),...re.map(ce=>Tn(ce.id,ce.location))];if(U||w){const ce=new Set(((ne=o.logical.groups.find($=>$.modelId===I))==null?void 0:ne.memberEntityRefs)??[]);for(const $ of o.logical.associations){if(!ce.has($.end1.entityRef)||!ce.has($.end2.entityRef))continue;const x=o.layout.associationLayouts.find(ie=>ie.associationRef===$.modelId);x&&x.waypoints.length&&F.push(Is($.modelId,U,w))}for(const $ of(ue==null?void 0:ue.memberNoteRefs)??[]){const x=o.layout.notes.find(ie=>ie.modelId===$);x&&F.push(uo($,{x:x.geo.location.x+U,y:x.geo.location.y+w}))}}return F}const Ae={state:o,resolved:X,issues:V,issuesByRef:j,flagEntitiesWithoutRelations:m,canUndo:y,canRedo:b,dirty:g,revision:E,notice:N,editable:_,schemaVersion:q,opWriteEnabled:B,opMode:H,opConflict:me,historyTransport:A,historyAvailable:S,restoreTransport:L,restoreAvailable:M,restoreToSeq:oe,reloadRequest:ee,displayMode:Y,routingMode:T,showGrid:W,showMinimap:Q,selection:te,selectedAttr:C,selectedAttrIds:Z,inspectedEntityId:le,focusRequest:pe,clipboard:de,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,superClassCatalog:s,languages:c,userLanguage:d,selectableDataTypes:f,setEditable(I){_.value=I&&H.value},setEmbeddableCatalog(I){a.value=I},setGroupCodeCatalog(I){l.value=I},setPredefinedCustomTypeCatalog(I){r.value=I},setSuperClassCatalog(I){s.value=I},selectAttribute(I,O,re="replace"){const ue=te.value,z=(ue==null?void 0:ue.kind)==="attribute"&&ue.entityId===I;if(re==="replace"||!z){te.value={kind:"attribute",entityId:I,ids:[O],anchor:O};return}if(re==="toggle"){const x=ue.ids.includes(O),ie=x?ue.ids.filter(G=>G!==O):[...ue.ids,O];if(!ie.length){te.value=null;return}const R=x&&ue.anchor===O?ie[ie.length-1]:x?ue.anchor:O;te.value={kind:"attribute",entityId:I,ids:ie,anchor:R};return}const U=o.logical.entities.find(x=>x.modelId===I),w=[...(U==null?void 0:U.attributes)??[]].sort((x,ie)=>x.order-ie.order).map(x=>x.modelId),F=w.indexOf(ue.anchor),ne=w.indexOf(O);if(F<0||ne<0){te.value={kind:"attribute",entityId:I,ids:[O],anchor:O};return}const[ce,$]=F<=ne?[F,ne]:[ne,F];te.value={kind:"attribute",entityId:I,ids:w.slice(ce,$+1),anchor:ue.anchor}},moveAttributeFocus(I){const O=te.value;if((O==null?void 0:O.kind)!=="attribute")return!1;const re=o.logical.entities.find(w=>w.modelId===O.entityId);if(!re||!re.attributes.length)return!1;const ue=re.attributes.findIndex(w=>w.modelId===O.anchor);if(ue<0)return!1;const z=Math.min(Math.max(ue+I,0),re.attributes.length-1);if(z===ue)return!0;const U=re.attributes[z].modelId;return te.value={kind:"attribute",entityId:O.entityId,ids:[U],anchor:U},!0},nudgeSelectedAttributes(I){const O=te.value;if((O==null?void 0:O.kind)!=="attribute")return!1;const re=o.logical.entities.find(x=>x.modelId===O.entityId);if(!re)return!1;const ue=re.attributes,z=new Set(O.ids),U=ue.map((x,ie)=>z.has(x.modelId)?ie:-1).filter(x=>x>=0);if(!U.length)return!1;const w=Math.min(...U),F=ue.filter(x=>!z.has(x.modelId)),ne=ue.slice(0,w).filter(x=>!z.has(x.modelId)).length;let ce;if(I<0){if(ne<=0)return!0;ce=ne-1}else{if(F.length-ne<=0)return!0;ce=ne+1}if(K(O.entityId))return!0;const $=ue.filter(x=>z.has(x.modelId)).map(x=>x.modelId);return D(Ja(O.entityId,$,ce)),!0},deleteSelection(){if(!_.value)return!1;const I=te.value;if(!I)return!1;if(I.kind==="attribute"){if(K(I.entityId))return!1;const O=I.ids;if(!O.length)return!1;O.length===1?Ae.removeAttribute(I.entityId,O[0]):Ae.removeAttributes(I.entityId,O)}else if(I.kind==="entity"){if(K(I.id))return!1;Ae.removeEntity(I.id)}else if(I.kind==="note")Ae.removeNote(I.id);else if(I.kind==="group"){if(he(I.id))return!1;Ae.removeGroup(I.id)}else Ae.removeAssociation(I.id);return te.value=null,!0},nudgeNodes(I,O,re){if(!I.length||O===0&&re===0)return!1;const ue=new Set(o.logical.entities.map(ce=>ce.modelId)),z=new Set(o.logical.groups.map(ce=>ce.modelId)),U=new Set(o.layout.notes.map(ce=>ce.modelId)),w=new Set;for(const ce of I){if(!z.has(ce))continue;const $=o.logical.groups.find(x=>x.modelId===ce);for(const x of($==null?void 0:$.memberEntityRefs)??[])w.add(x)}const F=[],ne=[];for(const ce of I)if(z.has(ce)){if(he(ce))continue;const $=o.layout.groupLayouts.find(G=>G.groupRef===ce);if(!$)continue;const x=o.logical.groups.find(G=>G.modelId===ce),ie=((x==null?void 0:x.memberEntityRefs)??[]).map(G=>{var se;const P=((se=o.layout.entityLayouts.find(Ne=>Ne.entityRef===G))==null?void 0:se.geo.location)??{x:0,y:0};return{id:G,location:{x:P.x+O,y:P.y+re}}}),R={x:$.geo.location.x+O,y:$.geo.location.y+re};F.push(Ye("그룹 이동",Re(ce,R,ie))),ne.push("g:"+ce)}else if(ue.has(ce)){if(w.has(ce)||K(ce))continue;const $=o.layout.entityLayouts.find(x=>x.entityRef===ce);if(!$)continue;F.push(Tn(ce,{x:$.geo.location.x+O,y:$.geo.location.y+re})),ne.push("e:"+ce)}else if(U.has(ce)){const $=o.layout.notes.find(x=>x.modelId===ce);if(!$)continue;F.push(uo(ce,{x:$.geo.location.x+O,y:$.geo.location.y+re})),ne.push("n:"+ce)}return F.length?(D(Ye("이동",F,"nudge:"+ne.sort().join(","))),!0):!1},requestFocus(I){pe.value={id:I,nonce:++be}},undo:()=>{_.value&&i.undo()},redo:()=>{_.value&&i.redo()},markSaved:()=>{_.value&&(Ce==null||Ce.flush(),i.markSavePoint())},loadDiagram(I,O){ge(),o.logical=I.logical,o.layout=I.layout,i=new Xa(o),ve(),q.value=(O==null?void 0:O.schemaVersion)??1,B.value=(O==null?void 0:O.opWriteEnabled)??!1,_.value=!(q.value>=2&&B.value===!1),ye=O,me.value=null,te.value=null,y.value=i.canUndo,b.value=i.canRedo,g.value=i.isDirty,J()},flush(){Ce==null||Ce.flush()},whenOpsSettled(){return(Ce==null?void 0:Ce.whenSettled())??Promise.resolve()},addEntity(I="NewEntity",O={x:80,y:80}){const re=De(),ue={modelId:re,name:I,stereotype:"JPA_ENTITY",table:{physicalName:I.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return D(ci(ue,{location:{...O},size:{width:220,height:140}})),re},renameEntity(I,O){K(I)||D(os(I,O))},updateEntity(I,O){if(K(I))return;const re=ns(I,O),ue=o.logical.entities.find(w=>w.modelId===I),z=O.stereotype==="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype!=="JPA_EMBEDDABLE",U=!!O.stereotype&&O.stereotype!=="JPA_EMBEDDABLE"&&!!ue&&ue.stereotype==="JPA_EMBEDDABLE";if(z&&ue){const w=ue.attributes.filter(x=>x.identifier&&!x.derivedFrom).map(x=>on(I,x.modelId,{identifier:!1})),F=Wn({...o.logical,entities:o.logical.entities.map(x=>x.modelId===I?{...x,stereotype:"JPA_EMBEDDABLE"}:x)},I,x=>x.map(ie=>ie.identifier&&!ie.derivedFrom?{...ie,identifier:!1}:ie)),ne=Hl(F,I),ce=Bk(o.logical,I),$=[re,...w,...ne,...ce];D($.length>1?Ye("임베더블 변환",$):re);return}if(U){const w=Mk(o.logical,I),F=[re,...w];D(F.length>1?Ye("엔터티 전환",F):re);return}D(re)},moveEntity(I,O){K(I)||D(Tn(I,O))},resizeEntity(I,O){K(I)||D(is(I,O))},removeEntity(I){K(I)||D(ts(I))},setEntitySwatch(I,O){D(as(I,O))},setEntityCollapsed(I,O){D(ls(I,O))},setEntityLocked(I,O){D(rs(I,O))},isEntityLocked(I){return K(I)},collapseAll(){D(Za(!0))},expandAll(){D(Za(!1))},setAttributeSwatch(I,O,re){D(di(I,O,re))},dragGroup(I,O,re){he(I)||D(Ye("그룹 이동",Re(I,O,re)))},resizeGroup(I,O){he(I)||D(fs(I,O))},setGroupSwatch(I,O){D(ms(I,O))},setGroupLocked(I,O){D(ps(I,O))},isGroupLocked(I){return he(I)},updateGroup(I,O){he(I)||D(ss(I,O))},createGroup(I,O){if(!I.length)return null;const re=[];for(const U of o.logical.groups)for(const w of I)U.memberEntityRefs.includes(w)&&re.push(fi(U.modelId,w));const ue=De(),z={modelId:ue,name:O?{ko:O}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...I]};return re.push(ui(z,ke(I))),D(Ye("그룹 생성",re)),te.value=null,ue},addEmptyGroup(I,O){const re=De();return D(ui({modelId:re,name:O?{ko:O}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...I},size:{width:360,height:260}})),re},removeGroup(I){he(I)||D(cs(I))},dropEntity(I,O,re){var U;if(K(I))return;const ue=((U=o.logical.groups.find(w=>w.memberEntityRefs.includes(I)))==null?void 0:U.modelId)??null,z=[Tn(I,O)];ue!==re&&(ue&&z.push(fi(ue,I)),re&&z.push(ds(re,I))),D(Ye("이동",z))},ungroupEntity(I){const O=o.logical.groups.find(re=>re.memberEntityRefs.includes(I));O&&D(fi(O.modelId,I))},dropNote(I,O,re){var U;const ue=((U=o.layout.groupLayouts.find(w=>{var F;return(F=w.memberNoteRefs)==null?void 0:F.includes(I)}))==null?void 0:U.groupRef)??null,z=[uo(I,O)];ue!==re&&(ue&&z.push(Bs(ue,I)),re&&z.push(Ms(re,I))),D(Ye("이동",z))},addPredefinedEmbed(I,O){if(K(I))return;const re=a.value.find(ne=>ne.type===O),ue=o.logical.entities.find(ne=>ne.modelId===I);if(!re||!ue)return;const z=ue.attributes.reduce((ne,ce)=>Math.max(ne,ce.order),-1)+1,U=De(),w=re.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),F={modelId:U,name:re.defaultName,type:re.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:z,dbAttrs:w};return D(At(I,F)),U},addAttribute(I,O={}){if(K(I))return O.modelId??"";const re=o.logical.entities.find($=>$.modelId===I),ue=re?re.attributes.length:0,z=O.modelId??De(),U=O.name??`field${ue}`,w={modelId:z,name:U,type:O.type??La,attrType:O.attrType??"NORMAL",identifier:O.identifier??!1,notNull:O.notNull??!1,order:ue,dbAttrs:O.dbAttrs??[{modelId:De(),physicalName:U,dataType:"VARCHAR",length:255}],...O},F=At(I,w),ne=Wn(o.logical,I,$=>[...$,w]),ce=Kn(ne,I);return D(ce.length?Ye("속성 추가",[F,...ce]):F),z},addDivider(I){if(K(I))return"";const O=o.logical.entities.find(U=>U.modelId===I),re=O?O.attributes.length:0,ue=De();return D(At(I,{modelId:ue,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:re,dbAttrs:[]})),ue},updateAttribute(I,O,re){$e(I,O,re)},setAttributeGroupCode(I,O,re){$e(I,O,{groupCode:re,type:re?Nn:La})},setEmbedColumns(I,O,re){var ne,ce;if(K(I))return;const ue=on(I,O,{dbAttrs:re}),z=(ne=o.logical.entities.find($=>$.modelId===I))==null?void 0:ne.attributes.find($=>$.modelId===O),U=(ce=z==null?void 0:z.embedded)==null?void 0:ce.associationRef,w=U?o.logical.associations.find($=>$.modelId===U):void 0,F=[];w&&U&&(w.end1.legacyEmbedRaw&&F.push(Bn(U,"end1",{legacyEmbedRaw:void 0})),w.end2.legacyEmbedRaw&&F.push(Bn(U,"end2",{legacyEmbedRaw:void 0}))),D(F.length?Ye("임베드 컬럼 수정",[ue,...F]):ue)},removeAttribute(I,O){if(K(I))return;if(bi(o.logical,I,O)){k(mu);return}const re=Mn(I,O),ue=Wn(o.logical,I,U=>U.filter(w=>w.modelId!==O)),z=Kn(ue,I);D(z.length?Ye("속성 삭제",[re,...z]):re)},removeAttributes(I,O){var F;if(!O.length||K(I))return;const re=O.filter(ne=>!bi(o.logical,I,ne));if(re.length<O.length&&k(mu),!re.length)return;const ue=re.map(ne=>Mn(I,ne)),z=new Set(re),U=Wn(o.logical,I,ne=>ne.filter(ce=>!z.has(ce.modelId))),w=[...ue,...Kn(U,I)];D(w.length===1?w[0]:Ye("속성 삭제",w)),((F=te.value)==null?void 0:F.kind)==="attribute"&&te.value.entityId===I&&(te.value=null)},setAttributeSwatches(I,O,re){O.length&&(O.length===1?D(di(I,O[0],re)):D(Ye("속성 색상",O.map(ue=>di(I,ue,re)))))},reorderAttributes(I,O,re){!O.length||K(I)||D(Ja(I,O,re))},addIndex(I,O){K(I)||D(ks(I,O))},updateIndex(I,O,re){K(I)||D(ws(I,O,re))},removeIndex(I,O){K(I)||D(vs(I,O))},addOperation(I,O={}){var w;if(K(I))return O.modelId??"";const re=o.logical.entities.find(F=>F.modelId===I),ue=((w=re==null?void 0:re.operations)==null?void 0:w.length)??0,z=O.modelId??De(),U={modelId:z,name:O.name??`method${ue}`,visibility:O.visibility??"PACKAGE",order:ue,...O};return D(hs(I,U)),z},updateOperation(I,O,re){K(I)||D(ys(I,O,re))},removeOperation(I,O){K(I)||D(gs(I,O))},reorderOperations(I,O,re){!O.length||K(I)||D(bs(I,O,re))},setOperationSwatch(I,O,re){D(_s(I,O,re))},addAssociation(I,O,re,ue){if(K(I)||K(O))return"";const z=De(),U={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:re},end2:{entityRef:O,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},w={...o.logical,associations:[...o.logical.associations,U]},F=fo(w,O,De),ne=F.add[0];ne&&(U.end2.attributeRef=ne.modelId);const ce={associationRef:z,waypoints:[],sourceColumnRef:re,targetColumnRef:(ne==null?void 0:ne.modelId)??ue},$=mi(U,ce),x=oa(O,F);return D(x.length?Ye("관계 추가",[$,...x]):$),z},addEmbedAssociation(I,O){if(K(I))return;const re=o.logical.entities.find(se=>se.modelId===I),ue=o.logical.entities.find(se=>se.modelId===O);if(!re||!ue||ue.stereotype!=="JPA_EMBEDDABLE")return;const z=De(),U=De(),w=De(),F=re.attributes.reduce((se,Ne)=>Math.max(se,Ne.order),-1)+1,ne=yu(ue),ce=se=>se&&se.charAt(0).toLowerCase()+se.slice(1),$=new Set(re.attributes.map(se=>se.name)),x=ce(ue.name);let ie=x;for(let se=2;$.has(ie);se++)ie=`${x}${se}`;const R={modelId:U,name:ie,type:ue.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:F,dbAttrs:ne,embedded:{associationRef:z,embeddableRef:O}},G={modelId:z,end1:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:w},end2:{entityRef:O,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:U}},P={associationRef:z,waypoints:[],sourceColumnRef:U,targetColumnRef:void 0};return D(Ye("임베드 추가",[At(I,R),mi(G,P)])),z},setEmbedCollectionMode(I,O){if(we(I))return;const re=o.logical.associations.find(ce=>ce.modelId===I);if(!re)return;let ue,z;for(const ce of o.logical.entities){const $=ce.attributes.find(x=>{var ie;return((ie=x.embedded)==null?void 0:ie.associationRef)===I&&x.attrType==="EMBED_OWN"});if($){ue=ce.modelId,z=$;break}}if(!ue||!z)return;const U=z.embedded.embeddableRef,w=re.end2.entityRef===U?"end2":"end1",F=re[w],ne=F.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(O==="COLLECTION"?ne:!ne))if(O==="COLLECTION")D(Ye("임베드 컬렉션 전환",[on(ue,z.modelId,{dbAttrs:[]}),Bn(I,w,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...F.jpa,collectionType:"LIST"}})]));else{const ce=o.logical.entities.find($=>$.modelId===U);if(!ce)return;D(Ye("임베드 단일 전환",[on(ue,z.modelId,{dbAttrs:yu(ce)}),Bn(I,w,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...F.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(I){if(we(I))return;const O=o.logical.associations.find(w=>w.modelId===I),re=Es(I);if(!O){D(re);return}for(const w of o.logical.entities){const F=w.attributes.find(ne=>{var ce;return((ce=ne.embedded)==null?void 0:ce.associationRef)===I});if(F){D(Ye("임베드 삭제",[re,Mn(w.modelId,F.modelId)]));return}}const ue=O.end2.entityRef,z={...o.logical,associations:o.logical.associations.filter(w=>w.modelId!==I)},U=Hl(z,ue);D(U.length?Ye("관계 삭제",[re,...U]):re)},setAssociationIdentifying(I,O){if(we(I))return;const re=o.logical.associations.find(F=>F.modelId===I),ue=pi(I,{identifying:O});if(!re||re.identifying===O){D(ue);return}const z=re.end2.entityRef,U={...o.logical,associations:o.logical.associations.map(F=>F.modelId===I?{...F,identifying:O}:F)},w=Hl(U,z);D(w.length?Ye("식별 관계 변경",[ue,...w]):ue)},updateAssociationEnd(I,O,re){we(I)||D(Bn(I,O,re))},moveWaypoint(I,O,re){D(Ns(I,O,re))},addWaypoint(I,O,re){D(xs(I,O,re))},removeWaypoint(I,O){D($s(I,O))},clearWaypoints(I){D(Ss(I))},addNote(I="메모",O={x:80,y:80}){const re=De();return D(Cs({modelId:re,memo:I,geo:{location:{...O},size:{width:200,height:120}}})),re},removeNote(I){D(Rs(I))},moveNote(I,O){D(uo(I,O))},resizeNote(I,O){D(Vs(I,O))},setNoteMemo(I,O){D(As(I,O))},setNoteSwatch(I,O){D(Ts(I,O))},addNoteConnection(I,O){D(Os(I,O))},removeNoteConnection(I,O){D(Ds(I,O))},moveNoteConnectionWaypoint(I,O,re,ue){D(Ls(I,O,re,ue))},addNoteConnectionWaypoint(I,O,re,ue){D(Ps(I,O,re,ue))},removeNoteConnectionWaypoint(I,O,re){D(zs(I,O,re))},clearNoteConnectionWaypoints(I,O){D(Us(I,O))},autoLayout(){const I=Er(o.logical,o.layout);I.length&&D(Ye("자동 배치",I.map(O=>Tn(O.id,O.location))))},copy(){const I=te.value;if((I==null?void 0:I.kind)==="attribute"){const U=o.logical.entities.find(F=>F.modelId===I.entityId);if(!U)return;const w=[...U.attributes].sort((F,ne)=>F.order-ne.order).filter(F=>I.ids.includes(F.modelId));if(!w.length)return;de.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:w}));return}const O=le.value;if(!O)return;const re=o.logical.entities.find(U=>U.modelId===O),ue=o.layout.entityLayouts.find(U=>U.entityRef===O);if(!re)return;const z=(ue==null?void 0:ue.geo)??{location:{x:80,y:80},size:{width:220,height:140}};de.value=JSON.parse(JSON.stringify({kind:"entity",entity:re,geo:z}))},paste(){if(!_.value)return;const I=de.value;if(!I)return;if(I.kind==="attribute"){const ue=le.value;if(!ue)return;const z=o.logical.entities.find($=>$.modelId===ue);if(!z)return;const U=new Set(z.attributes.map($=>$.name)),w=new Set(z.attributes.flatMap($=>$.dbAttrs.map(x=>x.physicalName))),F=z.attributes.length,ne=[],ce=I.attributes.map(($,x)=>{const ie=JSON.parse(JSON.stringify($));ie.modelId=De();for(const R of ie.dbAttrs)R.modelId=De();U.has(ie.name)&&(ie.name=`${ie.name}_copy`);for(const R of ie.dbAttrs)R.physicalName&&w.has(R.physicalName)&&(R.physicalName=`${R.physicalName}_copy`);return ie.order=F+x,ne.push(ie.modelId),At(ue,ie)});D(ce.length===1?ce[0]:Ye("속성 붙여넣기",ce)),te.value={kind:"attribute",entityId:ue,ids:ne,anchor:ne[ne.length-1]};return}const O=Vk(I.entity),re={location:{x:I.geo.location.x+40,y:I.geo.location.y+40},size:{...I.geo.size}};D(ci(O,re)),te.value={kind:"entity",id:O.modelId}},importEntities(I,O,re){if(!_.value)return;const ue=Wr(I,O,{existing:o.logical,includeRelated:re==null?void 0:re.includeRelated});if(ue.logical.entities.length===0)return;const z=Tk(o.layout,ue.layout),U=new Map(ue.layout.entityLayouts.map($=>[$.entityRef,$])),w=new Map(ue.layout.associationLayouts.map($=>[$.associationRef,$])),F=new Map(ue.layout.groupLayouts.map($=>[$.groupRef,$])),ne=[];let ce=80;for(const $ of ue.logical.entities){const x=U.get($.modelId),ie=x?{location:Fl(x.geo.location,z),size:{...x.geo.size}}:{location:{x:ce+=40,y:80},size:{width:220,height:140}};let R;if(x){const{entityRef:G,geo:P,locked:se,...Ne}=x;R=Ne}ne.push(ci($,ie,R))}for(const $ of ue.logical.associations){const x=w.get($.modelId),ie=x?{...x,waypoints:x.waypoints.map(R=>Fl(R,z))}:{associationRef:$.modelId,waypoints:[]};ne.push(mi($,ie))}for(const $ of ue.logical.groups){const x=F.get($.modelId),ie=x?{location:Fl(x.geo.location,z),size:{...x.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let R;if(x){const{groupRef:G,geo:P,locked:se,memberNoteRefs:Ne,...fe}=x;R=fe}ne.push(ui($,ie,R))}D(Ye("다이어그램 가져오기",ne)),te.value={kind:"entity",id:ue.logical.entities[0].modelId}}};return Ae}const ia=Symbol("groupHover"),gu=Symbol("groupDrag"),qn=Symbol("relationHighlight"),Dk={key:0,class:"em-sel","aria-hidden":"true"},Lk=["title","aria-expanded","disabled"],Pk={class:"em-entity__stereotype"},zk={key:1,class:"em-entity__name"},Uk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Fk=["onPointerdown"],Hk={key:1,class:"em-entity__divider-label"},Gk=["title"],Yk={class:"em-key-slot"},jk={class:"em-key-slot"},Wk={key:0,class:"em-entity__type"},Kk=["onClick"],qk={class:"em-entity__attrname"},Xk={class:"em-entity__type"},Zk=["data-op"],Jk=["onPointerdown"],Qk={class:"em-entity__op-vis","aria-hidden":"true"},ew=["title"],tw={key:4,class:"em-entity__footer"},bu=ze(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(gn,null),i=ae.useModal();function a(){o&&na(i,o,t.id)}const l=n.inject(ia,null),r=n.inject(qn,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 w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="entity"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!m.value),b=n.computed(()=>{var w;return o&&((w=o.selectedAttr.value)==null?void 0:w.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),g=n.computed(()=>b.value.size>0);function E(w,F){const ne=F.shiftKey?"range":F.metaKey||F.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,w.modelId,ne)}const N=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),h=n.computed(()=>t.data.entity),k=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),q=n.computed(()=>t.data.collapsed??!1),B=n.computed(()=>t.data.locked??!1);function H(){s.value&&(o==null||o.setEntityCollapsed(t.id,!q.value))}const A=n.computed(()=>k.value==="PHYSICAL"||k.value==="LOGICAL_PHYSICAL"),S=n.computed(()=>{const w=k.value==="PHYSICAL"||k.value==="LOGICAL_PHYSICAL",F={};for(const ne of h.value.attributes){const ce=ne.attrType.startsWith("RELATION")&&ne.dbAttrs.length>0;F[ne.modelId]={pk:ne.identifier,fk:ce&&w,required:ne.notNull&&!ne.identifier}}return F});function L(w){if(!w)return"";const F=[];return w.pk&&w.fk?F.push("PFK (식별 외래키)"):w.pk?F.push("PK (기본키)"):w.fk&&F.push("FK (외래키)"),w.required&&F.push("필수 (NOT NULL)"),F.join(" · ")}const ee=n.computed(()=>{const w=Pl(at(t.data.style)),F={};return w&&(F["--em-header-bg"]=w.bar,F["--em-header-fg"]=w.barOn),F});function M(w){var F,ne;return(ne=Pl(at((F=t.data.attributeStyles)==null?void 0:F[w.modelId])))==null?void 0:ne.text}const oe=n.computed(()=>[...h.value.operations??[]].sort((w,F)=>w.order-F.order)),_=n.computed(()=>k.value==="CLASS"&&oe.value.length>0),Y={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function T(w){return w?Y[w]:"~"}function W(w){var F,ne;return(ne=Pl(at((F=t.data.operationStyles)==null?void 0:F[w.modelId])))==null?void 0:ne.text}function Q(w,F,ne){switch(k.value){case"CLASS":return[{text:w}];case"PHYSICAL":return[{text:ne||w}];case"LOGICAL":return[F?{text:F}:{text:"(논리명)",missing:!0}];default:{const ce=F?{text:F}:{text:"(논리명)",missing:!0};return ne?[ce,{text:` · ${ne}`}]:[ce]}}}function te(w){var F,ne,ce;return C(w)?[{text:w.name}]:Q(w.name,(ne=(F=w.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:ne.ko,((ce=w.dbAttrs[0])==null?void 0:ce.physicalName)??"")}function C(w){return w.attrType.startsWith("EMBED")&&w.dbAttrs.length>0}function Z(w){return w.attrType==="DIVIDER"}function le(w){if(w.attrType!=="EMBED_PREDEF")return w.dbAttrs;const F=o==null?void 0:o.embeddableCatalog.value.find(ce=>ce.type===w.type);if(!F)return w.dbAttrs;const ne=Qt(In(h.value,(o==null?void 0:o.state.logical.entities)??[]));return w.dbAttrs.map((ce,$)=>{const x=F.fields[$],ie=Sn(ce,ne);return ie?{...ce,physicalName:ie.physicalName,logicalName:ce.logicalName??(x==null?void 0:x.logicalName),dataType:ce.dataType||(x==null?void 0:x.dataType)||""}:x?{...ce,physicalName:ce.physicalName||x.physicalName,logicalName:ce.logicalName??x.logicalName,dataType:ce.dataType||x.dataType,length:ce.length??x.length}:ce})}function pe(w){var F;return Q(w.physicalName,(F=w.logicalName)==null?void 0:F.ko,w.physicalName)}function be(w){const F=Pa(w,(o==null?void 0:o.state.logical.associations)??[]);return za(k.value,w,F)}const de=n.computed(()=>{var w,F,ne;return Q(h.value.name,(F=(w=h.value.table)==null?void 0:w.logicalName)==null?void 0:F.ko,((ne=h.value.table)==null?void 0:ne.physicalName)??"")}),me=n.ref(!1),ye=n.ref(""),ve=n.ref(null);async function Ce(){var w,F;s.value&&(ye.value=h.value.name,me.value=!0,await n.nextTick(),(w=ve.value)==null||w.focus(),(F=ve.value)==null||F.select())}function Se(){if(!me.value)return;me.value=!1;const w=ye.value.trim();w&&w!==h.value.name&&(o==null||o.renameEntity(t.id,w))}function ge(){o==null||o.addAttribute(t.id)}function J(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:X,findNode:v}=Pe(),V=n.ref(null),j=n.computed(()=>{const w=V.value??t.data.size;return w?{width:`${w.width}px`,minHeight:`${w.height}px`}:void 0});let D=null;function K(w){var ce,$,x;if(!s.value)return;w.stopPropagation();const F=(ce=v(t.id))==null?void 0:ce.dimensions,ne=X({x:w.clientX,y:w.clientY});D={fx:ne.x,fy:ne.y,w:(F==null?void 0:F.width)??(($=t.data.size)==null?void 0:$.width)??200,h:(F==null?void 0:F.height)??((x=t.data.size)==null?void 0:x.height)??120},w.target.setPointerCapture(w.pointerId)}function he(w){if(!D)return;const F=X({x:w.clientX,y:w.clientY});V.value={width:Math.max(40,D.w+(F.x-D.fx)),height:Math.max(40,D.h+(F.y-D.fy))}}function we(w){var F,ne,ce;if(D&&V.value&&o){const $=(F=v(t.id))==null?void 0:F.dimensions;o.resizeEntity(t.id,{width:Math.round(($==null?void 0:$.width)??V.value.width),height:Math.round(($==null?void 0:$.height)??V.value.height)})}D=null,V.value=null,(ce=(ne=w.target).releasePointerCapture)==null||ce.call(ne,w.pointerId)}const $e=n.ref(null),ke=n.ref(null);function Re(w,F){if(!s.value)return;F.stopPropagation(),F.preventDefault();const ne=b.value,ce=ne.has(w.modelId)?new Set(ne):new Set([w.modelId]);ke.value={ids:ce,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId)}function Ae(w){if(!ke.value||!$e.value)return;const F=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!F.length)return;let ne=F.length;for(let x=0;x<F.length;x++){const ie=F[x].getBoundingClientRect();if(w.clientY<ie.top+ie.height/2){ne=x;break}}const ce=F[F.length-1],$=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;ke.value={...ke.value,dropIndex:ne,lineY:$}}function Oe(){const w=ke.value;if(ke.value=null,!w||w.dropIndex<0)return;const F=h.value.attributes,ne=F.filter(R=>w.ids.has(R.modelId)).map(R=>R.modelId),ce=F.filter((R,G)=>w.ids.has(R.modelId)&&G<w.dropIndex).length,$=w.dropIndex-ce,x=F.filter(R=>!w.ids.has(R.modelId)).map(R=>R.modelId);[...x.slice(0,$),...ne,...x.slice($)].join(",")!==F.map(R=>R.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,ne,$))}function We(){ke.value=null}const I=n.ref(null),O=n.ref(null);function re(w,F){s.value&&(F.stopPropagation(),F.preventDefault(),O.value={id:w.modelId,dropIndex:-1,lineY:0},F.target.setPointerCapture(F.pointerId))}function ue(w){if(!O.value||!I.value)return;const F=Array.from(I.value.querySelectorAll(".em-entity__op-row"));if(!F.length)return;let ne=F.length;for(let x=0;x<F.length;x++){const ie=F[x].getBoundingClientRect();if(w.clientY<ie.top+ie.height/2){ne=x;break}}const ce=F[F.length-1],$=ne<F.length?F[ne].offsetTop:ce.offsetTop+ce.offsetHeight;O.value={...O.value,dropIndex:ne,lineY:$}}function z(){const w=O.value;if(O.value=null,!w||w.dropIndex<0)return;const ne=oe.value.findIndex($=>$.modelId===w.id);if(ne<0)return;const ce=w.dropIndex-(ne<w.dropIndex?1:0);ce!==ne&&(o==null||o.reorderOperations(t.id,[w.id],ce))}function U(){O.value=null}return(w,F)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":N.value,"is-selected":m.value,"is-multi-selected":y.value,"has-focused-attr":g.value,"is-locked":B.value}]),style:n.normalizeStyle(j.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",Dk,[...F[7]||(F[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(ee.value),onDblclick:n.withModifiers(Ce,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:q.value?"펼치기":"접기","aria-expanded":!q.value,disabled:!s.value,onClick:n.withModifiers(H,["stop"]),onPointerdown:F[0]||(F[0]=n.withModifiers(()=>{},["stop"])),onDblclick:F[1]||(F[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(q.value?"▸":"▾"),41,Lk),n.createElementVNode("span",Pk,"«"+n.toDisplayString(h.value.stereotype)+"»",1),me.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ve,"onUpdate:modelValue":F[2]||(F[2]=ne=>ye.value=ne),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Se,["enter"]),F[3]||(F[3]=n.withKeys(ne=>me.value=!1,["esc"]))],onBlur:Se,onPointerdown:F[4]||(F[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",zk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(de.value,(ne,ce)=>(n.openBlock(),n.createElementBlock("span",{key:ce,class:n.normalizeClass({"em-entity__missing":ne.missing})},n.toDisplayString(ne.text),3))),128))])),B.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),q.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[ke.value&&ke.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ke.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.attributes,ne=>{var ce,$,x,ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ne.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(ne.modelId),"is-dragging":(ce=ke.value)==null?void 0:ce.ids.has(ne.modelId),"is-embed":C(ne),"is-divider":Z(ne),nodrag:Z(ne)&&s.value}]),"data-attr":ne.modelId,onClick:n.withModifiers(R=>E(ne,R),["stop"]),onPointerdown:R=>Z(ne)?Re(ne,R):void 0,onPointermove:R=>Z(ne)?Ae(R):void 0,onPointerup:R=>Z(ne)?Oe():void 0,onPointercancel:R=>Z(ne)?We():void 0},[s.value&&!Z(ne)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:R=>Re(ne,R),onPointermove:Ae,onPointerup:Oe,onPointercancel:We,onClick:F[5]||(F[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Fk)):n.createCommentVNode("",!0),Z(ne)?(n.openBlock(),n.createElementBlock("span",Hk,n.toDisplayString(ne.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(mn),{id:`l:${ne.modelId}`,type:"target",position:n.unref(xe).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:L(S.value[ne.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Yk,[($=S.value[ne.modelId])!=null&&$.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(x=S.value[ne.modelId])!=null&&x.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",jk,[C(ne)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(ie=S.value[ne.modelId])!=null&&ie.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Gk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:M(ne)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te(ne),(R,G)=>(n.openBlock(),n.createElementBlock("span",{key:G,class:n.normalizeClass({"em-entity__missing":R.missing})},n.toDisplayString(R.text),3))),128))],4),be(ne)?(n.openBlock(),n.createElementBlock("span",Wk,n.toDisplayString(be(ne)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(mn),{id:`r:${ne.modelId}`,type:"source",position:n.unref(xe).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Uk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C(ne)&&A.value?le(ne):[],R=>(n.openBlock(),n.createElementBlock("li",{key:`${ne.modelId}:${R.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(ne.modelId)}]),onClick:n.withModifiers(G=>E(ne,G),["stop"])},[F[8]||(F[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",qk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe(R),(G,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":G.missing})},n.toDisplayString(G.text),3))),128))]),n.createElementVNode("span",Xk,n.toDisplayString(R.dataType),1)],10,Kk))),128))],64)}),128))],512)),!q.value&&_.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:I,class:"em-entity__ops"},[O.value&&O.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${O.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,ne=>{var ce;return n.openBlock(),n.createElementBlock("li",{key:ne.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ce=O.value)==null?void 0:ce.id)===ne.modelId}]),"data-op":ne.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:$=>re(ne,$),onPointermove:ue,onPointerup:z,onPointercancel:U,onClick:F[6]||(F[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Jk)):n.createCommentVNode("",!0),n.createElementVNode("span",Qk,n.toDisplayString(T(ne.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:W(ne)})},n.toDisplayString(ne.name)+"()",5)],10,Zk)}),128))],512)):oe.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${oe.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(oe.value.length)+"개",1)],8,ew)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",tw,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ge},"+ 속성"),F[9]||(F[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:J},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!me.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:K,onPointermove:he,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3a3c0b9d"]]),nw={key:0,class:"em-sel","aria-hidden":"true"},ow={class:"em-group__label"},iw={class:"em-group__name"},aw={key:0,class:"em-group__pkg"},lw={key:1,class:"em-group__flag"},_u=ze(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>at(t.data.style)),l=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),r=n.inject(gn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var S;return!!t.id&&((S=r==null?void 0:r.selection.value)==null?void 0:S.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(ia,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),p=n.inject(qn,null);function m(){t.id&&(p==null||p.setGroupHover(t.id))}function y(){p==null||p.setGroupHover(null)}const b=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),g=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:E,findNode:N}=Pe();let h=null,k=null;function q(S){var M;if(!t.id||!s.value)return;S.stopPropagation();const L=((M=N(t.id))==null?void 0:M.dimensions)??{width:400,height:300},ee=E({x:S.clientX,y:S.clientY});h={fx:ee.x,fy:ee.y,w:L.width,h:L.height},S.target.setPointerCapture(S.pointerId)}function B(S){if(!h||!t.id)return;const L=E({x:S.clientX,y:S.clientY});k={width:Math.max(160,h.w+(L.x-h.fx)),height:Math.max(120,h.h+(L.y-h.fy))};const ee=N(t.id);ee&&(ee.style={width:`${k.width}px`,height:`${k.height}px`})}function H(S){var L,ee;h&&k&&t.id&&r&&r.resizeGroup(t.id,k),h=null,k=null,(ee=(L=S.target).releasePointerCapture)==null||ee.call(L,S.pointerId)}const A=n.computed(()=>{const S=o.value.name;return(S==null?void 0:S.ko)||(S==null?void 0:S.en)||(S==null?void 0:S.ja)||(S==null?void 0:S.zh)||o.value.packageName||"그룹"});return(S,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":b.value,"is-dimmed":g.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:y},[c.value?(n.openBlock(),n.createElementBlock("div",nw,[...L[0]||(L[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",ow,[n.createElementVNode("span",iw,n.toDisplayString(A.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",aw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",lw,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)]),s.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:q,onPointermove:B,onPointerup:H},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),rw={key:0,class:"em-sel","aria-hidden":"true"},sw={key:2,class:"em-note__text"},Eu=ze(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(gn,null),i=n.inject(ia,null),a=n.inject(qn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>at(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),y=n.computed(()=>{var _;return((_=o==null?void 0:o.selection.value)==null?void 0:_.kind)==="note"&&o.selection.value.id===t.id}),b=n.computed(()=>!!t.selected&&!y.value),g=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.value),E=[{id:"n-top",pos:xe.Top},{id:"n-right",pos:xe.Right},{id:"n-bottom",pos:xe.Bottom},{id:"n-left",pos:xe.Left}],N=n.ref(!1),h=n.ref(""),k=n.ref(null);async function q(){var _;r.value&&(h.value=l.value.memo,N.value=!0,await n.nextTick(),(_=k.value)==null||_.focus())}function B(){N.value&&(N.value=!1,h.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:H,findNode:A}=Pe();let S=null,L=null;function ee(_){var W;if(!r.value)return;_.stopPropagation();const Y=((W=A(t.id))==null?void 0:W.dimensions)??l.value.geo.size,T=H({x:_.clientX,y:_.clientY});S={fx:T.x,fy:T.y,w:Y.width,h:Y.height},_.target.setPointerCapture(_.pointerId)}function M(_){if(!S)return;const Y=H({x:_.clientX,y:_.clientY});L={width:Math.max(140,S.w+(Y.x-S.fx)),height:Math.max(60,S.h+(Y.y-S.fy))};const T=A(t.id);T&&(T.style={width:`${L.width}px`,height:`${L.height}px`})}function oe(_){var Y,T;S&&L&&o&&o.resizeNote(t.id,L),S=null,L=null,(T=(Y=_.target).releasePointerCapture)==null||T.call(Y,_.pointerId)}return(_,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":m.value,"is-dimmed":g.value,"is-selected":y.value,"is-multi-selected":b.value}]),style:n.normalizeStyle(c.value),onDblclick:q,onPointerdown:d,onMouseenter:u,onMouseleave:f},[y.value?(n.openBlock(),n.createElementBlock("div",rw,[...Y[4]||(Y[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),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":Y[0]||(Y[0]=T=>h.value=T),class:"em-note__edit nodrag",onBlur:B,onKeydown:Y[1]||(Y[1]=n.withKeys(T=>N.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",sw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(E,T=>n.createVNode(n.unref(mn),{id:T.id,key:T.id,type:"source",position:T.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ee,onPointermove:M,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),cw=20,dw=22,uw=7,fw=22,ku=31,wu=7,mw=20,vu=11,Nu=11,pw=ku+wu;function hw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function yw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function aa(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 $u(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function la(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Iu(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:$u(e,t);return[la(o,a,l-Math.PI/2),la(o,a,l+Math.PI/2)]}function Su(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 xu(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=aa(e,t,cw),[d,u]=Iu(e,t,c,dw);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}),hw(o.multiplicity)){const f=aa(e,t,ku);l.push({cx:f.x,cy:f.y,r:wu})}if(yw(o.multiplicity)){const f=aa(e,t,uw),[p,m]=Iu(e,t,f,fw);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=aa(e,t,mw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=$u(e,t),f=la(d,vu/2,u-Math.PI/2),p=la(d,vu/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=Su(s,c,Nu,!0),u=Su(s,c,Nu,!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 Cu=200,Ru=120,Gl=24;function Vu(e){var a,l;if(!e)return{x:0,y:0,width:Cu,height:Ru};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Cu,i=((l=e.dimensions)==null?void 0:l.height)||Ru;return{x:t.x,y:t.y,width:o,height:i}}function Au(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Tu(e){const t=n.computed(()=>Vu(e.sourceNode())),o=n.computed(()=>Vu(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,y;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=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(p-f)<Gl){const b=(f+p)/2;f=b-Gl/2,p=b+Gl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),l=n.computed(()=>e.waypoints()[0]??Au(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Au(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Va(t.value,d,l.value.x):Ra(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Va(o.value,d,r.value.x):Ra(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 Yl=Symbol("waypointController"),gw=["d"],bw=["d"],_w=["d"],Ew=["x1","y1","x2","y2"],kw=["cx","cy","r"],ww=["x","y"],vw=["x","y"],Nw=["cx","cy","onDblclick"],$w=["x","y","onPointerdown","onDblclick"],Mu=ze(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Yl),a=n.inject(gn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(gu,null),s=n.inject(qn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var ge;return((ge=a==null?void 0:a.selection.value)==null?void 0:ge.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 ge=r==null?void 0:r.value;if(!ge||!a)return null;const J=a.resolved.value.entities,X=V=>{var j;return(j=J.find(D=>D.entity.modelId===V))==null?void 0:j.groupRef},v=t.data.association;return X(v.end1.entityRef)===ge.groupId&&X(v.end2.entityRef)===ge.groupId?{dx:ge.dx,dy:ge.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),y=n.ref({x:0,y:0}),b=n.computed(()=>{const ge=f.value;return p.value.map((J,X)=>X===m.value?y.value:ge?{x:J.x+ge.dx,y:J.y+ge.dy}:J)}),g=n.computed(()=>{var ge;return!!((ge=t.sourceNode.data)!=null&&ge.collapsed)}),E=n.computed(()=>{var ge;return!!((ge=t.targetNode.data)!=null&&ge.collapsed)}),{source:N,target:h,sourceSide:k,targetSide:q,isSelf:B}=Tu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>b.value,sourceRowY:()=>t.data.sourceColumnRef&&!g.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!E.value?t.targetY:void 0}),H=pw+4,A=n.computed(()=>B.value?_r(N.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Sa(N.value,k.value,b.value,h.value,q.value,H):Ca(N.value,b.value,h.value)),S=n.computed(()=>B.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?xa(N.value,k.value,b.value,h.value,q.value,H):Aa(N.value,b.value,h.value).map((ge,J)=>({point:ge,segIndex:J}))),L=n.computed(()=>B.value||!l.value?[]:b.value);function ee(ge){switch(ge){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 M(ge,J){m.value=ge,y.value={...p.value[ge]},J.target.setPointerCapture(J.pointerId),J.stopPropagation()}function oe(ge){if(m.value<0)return;const J=o({x:ge.clientX,y:ge.clientY});y.value={x:J.x,y:J.y}}function _(ge){var J,X;m.value>=0&&i&&i.movePoint(t.id,m.value,{...y.value}),m.value=-1,(X=(J=ge.target).releasePointerCapture)==null||X.call(J,ge.pointerId)}function Y(ge,J){J.stopPropagation(),i==null||i.removePoint(t.id,ge)}function T(ge,J){if(!i)return;const X=o({x:J.clientX,y:J.clientY});i.insertPoint(t.id,ge,{x:X.x,y:X.y})}const W=n.computed(()=>ee(t.data.association.end1.multiplicity)),Q=n.computed(()=>ee(t.data.association.end2.multiplicity)),te=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),C=n.computed(()=>te.value==="class"),Z=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ge=eo(k.value);return{x:N.value.x+ge.x*10,y:N.value.y+ge.y*10}}return b.value[0]??h.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const J=eo(q.value);return{x:h.value.x+J.x*10,y:h.value.y+J.y*10}}const ge=b.value;return ge[ge.length-1]??N.value}),pe=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end1.multiplicity,navigable:ge.end1.navigable,composition:ge.end1.composition,otherNavigable:ge.end2.navigable}}),be=n.computed(()=>{const ge=t.data.association;return{multiplicity:ge.end2.multiplicity,navigable:ge.end2.navigable,composition:ge.end2.composition,otherNavigable:ge.end1.navigable}}),de=n.computed(()=>xu(N.value,Z.value,pe.value,te.value)),me=n.computed(()=>xu(h.value,le.value,be.value,te.value)),ye=n.computed(()=>[...de.value.lines,...me.value.lines]),ve=n.computed(()=>[...de.value.circles,...me.value.circles]),Ce=n.computed(()=>[...de.value.polygons,...me.value.polygons].map(ge=>`M${ge.points.map(J=>`${J.x},${J.y}`).join(" L")} Z`)),Se=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ge,J)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:A.value,fill:"none",class:"em-edge__hit"},null,8,gw),n.createElementVNode("path",{d:A.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,bw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ce.value,(X,v)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${v}`,d:X,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Se.value])},null,10,_w))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.value,(X,v)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${v}`,x1:X.x1,y1:X.y1,x2:X.x2,y2:X.y2,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,Ew))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(X,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${v}`,cx:X.cx,cy:X.cy,r:X.r,class:n.normalizeClass(["em-edge__marker",Se.value])},null,10,kw))),128)),C.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,ww),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(Q.value),11,vw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(S.value,(X,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${v}`,cx:X.point.x,cy:X.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(V=>T(X.segIndex,V),["stop"])},null,42,Nw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(L.value,(X,v)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${v}`,x:X.x-5,y:X.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:V=>M(v,V),onPointermove:oe,onPointerup:_,onDblclick:V=>Y(v,V)},null,42,$w))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Lt=(e=>(e.Lines="lines",e.Dots="dots",e))(Lt||{});const Bu=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]}`})},Ou=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Lt.Lines+"",Lt.Dots+"";const Iw={[Lt.Dots]:"#81818a",[Lt.Lines]:"#eee"},Sw=["id","x","y","width","height","patternTransform"],xw={key:2,height:"100",width:"100"},Cw=["fill"],Rw=["x","y","fill"],Vw={name:"Background",compatConfig:{MODE:3}},Aw=n.defineComponent({...Vw,props:{id:{},variant:{default:()=>Lt.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}=Pe(),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||Iw[e.variant||Lt.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(Lt).Lines?(n.openBlock(),n.createBlock(n.unref(Bu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Lt).Dots?(n.openBlock(),n.createBlock(n.unref(Ou),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",xw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Cw)])):n.createCommentVNode("",!0)])],8,Sw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Rw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Tw={name:"ControlButton",compatConfig:{MODE:3}},Mw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Bw={type:"button",class:"vue-flow__controls-button"};function Ow(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Bw,[n.renderSlot(e.$slots,"default")])}const bn=Mw(Tw,[["render",Ow]]),Dw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Lw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Pw(e,t){return n.openBlock(),n.createElementBlock("svg",Dw,Lw)}const zw={render:Pw},Uw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Fw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Hw(e,t){return n.openBlock(),n.createElementBlock("svg",Uw,Fw)}const Gw={render:Hw},Yw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},jw=[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 Ww(e,t){return n.openBlock(),n.createElementBlock("svg",Yw,jw)}const Kw={render:Ww},qw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Xw=[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 Zw(e,t){return n.openBlock(),n.createElementBlock("svg",qw,Xw)}const Jw={render:Zw},Qw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ev=[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 tv(e,t){return n.openBlock(),n.createElementBlock("svg",Qw,ev)}const nv={render:tv},ov={name:"Controls",compatConfig:{MODE:3}},iv=n.defineComponent({...ov,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>sd.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}=Pe(),p=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=f.value);function b(){r(),t("zoomIn")}function g(){s(),t("zoomOut")}function E(){c(e.fitViewParams),t("fitView")}function N(){l(!p.value),t("interactionChange",!p.value)}return(h,k)=>(n.openBlock(),n.createBlock(n.unref(lu),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(bn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(zw))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(bn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Gw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(bn,{class:"vue-flow__controls-fitview",onClick:E},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Kw))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(bn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[p.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(nv))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Jw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var av={value:()=>{}};function jl(){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 ra(o)}function ra(e){this._=e}function lv(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}})}ra.prototype=jl.prototype={constructor:ra,on:function(e,t){var o=this._,i=lv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=rv(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]=Du(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Du(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 ra(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 rv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Du(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=av,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Wl="http://www.w3.org/1999/xhtml";const Lu={svg:"http://www.w3.org/2000/svg",xhtml:Wl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sa(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Lu.hasOwnProperty(t)?{space:Lu[t],local:e}:e}function sv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Wl&&t.documentElement.namespaceURI===Wl?t.createElement(e):t.createElementNS(o,e)}}function cv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pu(e){var t=sa(e);return(t.local?cv:sv)(t)}function dv(){}function Kl(e){return e==null?dv:function(){return this.querySelector(e)}}function uv(e){typeof e!="function"&&(e=Kl(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 ft(i,this._parents)}function fv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function mv(){return[]}function zu(e){return e==null?mv:function(){return this.querySelectorAll(e)}}function pv(e){return function(){return fv(e.apply(this,arguments))}}function hv(e){typeof e=="function"?e=pv(e):e=zu(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 ft(i,a)}function Uu(e){return function(){return this.matches(e)}}function Fu(e){return function(t){return t.matches(e)}}var yv=Array.prototype.find;function gv(e){return function(){return yv.call(this.children,e)}}function bv(){return this.firstElementChild}function _v(e){return this.select(e==null?bv:gv(typeof e=="function"?e:Fu(e)))}var Ev=Array.prototype.filter;function kv(){return Array.from(this.children)}function wv(e){return function(){return Ev.call(this.children,e)}}function vv(e){return this.selectAll(e==null?kv:wv(typeof e=="function"?e:Fu(e)))}function Nv(e){typeof e!="function"&&(e=Uu(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 ft(i,this._parents)}function Hu(e){return new Array(e.length)}function $v(){return new ft(this._enter||this._groups.map(Hu),this._parents)}function ca(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ca.prototype={constructor:ca,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 Iv(e){return function(){return e}}function Sv(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 ca(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function xv(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 ca(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Cv(e){return e.__data__}function Rv(e,t){if(!arguments.length)return Array.from(this,Cv);var o=t?xv:Sv,i=this._parents,a=this._groups;typeof e!="function"&&(e=Iv(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=Vv(e.call(u,u&&u.__data__,d,i)),y=m.length,b=s[d]=new Array(y),g=r[d]=new Array(y),E=c[d]=new Array(p);o(u,f,b,g,E,m,t);for(var N=0,h=0,k,q;N<y;++N)if(k=b[N]){for(N>=h&&(h=N+1);!(q=g[h])&&++h<y;);k._next=q||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function Vv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Av(){return new ft(this._exit||this._groups.map(Hu),this._parents)}function Tv(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 Mv(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,y=0;y<f;++y)(m=d[y]||u[y])&&(p[y]=m);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function Bv(){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 Ov(e){e||(e=Dv);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 ft(a,this._parents).order()}function Dv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Lv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Pv(){return Array.from(this)}function zv(){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 Uv(){let e=0;for(const t of this)++e;return e}function Fv(){return!this.node()}function Hv(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 Gv(e){return function(){this.removeAttribute(e)}}function Yv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jv(e,t){return function(){this.setAttribute(e,t)}}function Wv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Kv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function qv(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 Xv(e,t){var o=sa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Yv:Gv:typeof t=="function"?o.local?qv:Kv:o.local?Wv:jv)(o,t))}function Gu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Zv(e){return function(){this.style.removeProperty(e)}}function Jv(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 eN(e,t,o){return arguments.length>1?this.each((t==null?Zv:typeof t=="function"?Qv:Jv)(e,t,o??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Gu(e).getComputedStyle(e,null).getPropertyValue(t)}function tN(e){return function(){delete this[e]}}function nN(e,t){return function(){this[e]=t}}function oN(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function iN(e,t){return arguments.length>1?this.each((t==null?tN:typeof t=="function"?oN:nN)(e,t)):this.node()[e]}function Yu(e){return e.trim().split(/^|\s+/)}function ql(e){return e.classList||new ju(e)}function ju(e){this._node=e,this._names=Yu(e.getAttribute("class")||"")}ju.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 Wu(e,t){for(var o=ql(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Ku(e,t){for(var o=ql(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function aN(e){return function(){Wu(this,e)}}function lN(e){return function(){Ku(this,e)}}function rN(e,t){return function(){(t.apply(this,arguments)?Wu:Ku)(this,e)}}function sN(e,t){var o=Yu(e+"");if(arguments.length<2){for(var i=ql(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?rN:t?aN:lN)(o,t))}function cN(){this.textContent=""}function dN(e){return function(){this.textContent=e}}function uN(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function fN(e){return arguments.length?this.each(e==null?cN:(typeof e=="function"?uN:dN)(e)):this.node().textContent}function mN(){this.innerHTML=""}function pN(e){return function(){this.innerHTML=e}}function hN(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function yN(e){return arguments.length?this.each(e==null?mN:(typeof e=="function"?hN:pN)(e)):this.node().innerHTML}function gN(){this.nextSibling&&this.parentNode.appendChild(this)}function bN(){return this.each(gN)}function _N(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function EN(){return this.each(_N)}function kN(e){var t=typeof e=="function"?e:Pu(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wN(){return null}function vN(e,t){var o=typeof e=="function"?e:Pu(e),i=t==null?wN:typeof t=="function"?t:Kl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function NN(){var e=this.parentNode;e&&e.removeChild(this)}function $N(){return this.each(NN)}function IN(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SN(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xN(e){return this.select(e?SN:IN)}function CN(e){return arguments.length?this.property("__data__",e):this.node().__data__}function RN(e){return function(t){e.call(this,t,this.__data__)}}function VN(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 AN(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 TN(e,t,o){return function(){var i=this.__on,a,l=RN(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 MN(e,t,o){var i=VN(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?TN:AN,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function qu(e,t,o){var i=Gu(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 BN(e,t){return function(){return qu(this,e,t)}}function ON(e,t){return function(){return qu(this,e,t.apply(this,arguments))}}function DN(e,t){return this.each((typeof t=="function"?ON:BN)(e,t))}function*LN(){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 Xu=[null];function ft(e,t){this._groups=e,this._parents=t}function To(){return new ft([[document.documentElement]],Xu)}function PN(){return this}ft.prototype=To.prototype={constructor:ft,select:uv,selectAll:hv,selectChild:_v,selectChildren:vv,filter:Nv,data:Rv,enter:$v,exit:Av,join:Tv,merge:Mv,selection:PN,order:Bv,sort:Ov,call:Lv,nodes:Pv,node:zv,size:Uv,empty:Fv,each:Hv,attr:Xv,style:eN,property:iN,classed:sN,text:fN,html:yN,raise:bN,lower:EN,append:kN,insert:vN,remove:$N,clone:xN,datum:CN,on:MN,dispatch:DN,[Symbol.iterator]:LN};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],Xu)}function zN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=zN(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 Xl={capture:!0,passive:!1};function Zl(e){e.preventDefault(),e.stopImmediatePropagation()}function UN(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Zl,Xl);"onselectstart"in t?o.on("selectstart.drag",Zl,Xl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function FN(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Zl,Xl),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 Jl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Zu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Mo(){}var Bo=.7,da=1/Bo,Zn="\\s*([+-]?\\d+)\\s*",Oo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",HN=/^#([0-9a-f]{3,8})$/,GN=new RegExp(`^rgb\\(${Zn},${Zn},${Zn}\\)$`),YN=new RegExp(`^rgb\\(${xt},${xt},${xt}\\)$`),jN=new RegExp(`^rgba\\(${Zn},${Zn},${Zn},${Oo}\\)$`),WN=new RegExp(`^rgba\\(${xt},${xt},${xt},${Oo}\\)$`),KN=new RegExp(`^hsl\\(${Oo},${xt},${xt}\\)$`),qN=new RegExp(`^hsla\\(${Oo},${xt},${xt},${Oo}\\)$`),Ju={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};Jl(Mo,Do,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qu,formatHex:Qu,formatHex8:XN,formatHsl:ZN,formatRgb:ef,toString:ef});function Qu(){return this.rgb().formatHex()}function XN(){return this.rgb().formatHex8()}function ZN(){return lf(this).formatHsl()}function ef(){return this.rgb().formatRgb()}function Do(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=HN.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?tf(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?ua(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ua(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=GN.exec(e))?new ct(t[1],t[2],t[3],1):(t=YN.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jN.exec(e))?ua(t[1],t[2],t[3],t[4]):(t=WN.exec(e))?ua(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=KN.exec(e))?af(t[1],t[2]/100,t[3]/100,1):(t=qN.exec(e))?af(t[1],t[2]/100,t[3]/100,t[4]):Ju.hasOwnProperty(e)?tf(Ju[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function tf(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function ua(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function JN(e){return e instanceof Mo||(e=Do(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Ql(e,t,o,i){return arguments.length===1?JN(e):new ct(e,t,o,i??1)}function ct(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Jl(ct,Ql,Zu(Mo,{brighter(e){return e=e==null?da:Math.pow(da,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Bo:Math.pow(Bo,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ct(_n(this.r),_n(this.g),_n(this.b),fa(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:nf,formatHex:nf,formatHex8:QN,formatRgb:of,toString:of}));function nf(){return`#${En(this.r)}${En(this.g)}${En(this.b)}`}function QN(){return`#${En(this.r)}${En(this.g)}${En(this.b)}${En((isNaN(this.opacity)?1:this.opacity)*255)}`}function of(){const e=fa(this.opacity);return`${e===1?"rgb(":"rgba("}${_n(this.r)}, ${_n(this.g)}, ${_n(this.b)}${e===1?")":`, ${e})`}`}function fa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function En(e){return e=_n(e),(e<16?"0":"")+e.toString(16)}function af(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new bt(e,t,o,i)}function lf(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof Mo||(e=Do(e)),!e)return new bt;if(e instanceof bt)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 bt(r,s,c,e.opacity)}function e$(e,t,o,i){return arguments.length===1?lf(e):new bt(e,t,o,i??1)}function bt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Jl(bt,e$,Zu(Mo,{brighter(e){return e=e==null?da:Math.pow(da,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Bo:Math.pow(Bo,e),new bt(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 ct(er(e>=240?e-240:e+120,a,i),er(e,a,i),er(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt(rf(this.h),ma(this.s),ma(this.l),fa(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=fa(this.opacity);return`${e===1?"hsl(":"hsla("}${rf(this.h)}, ${ma(this.s)*100}%, ${ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function rf(e){return e=(e||0)%360,e<0?e+360:e}function ma(e){return Math.max(0,Math.min(1,e||0))}function er(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 sf=e=>()=>e;function t$(e,t){return function(o){return e+o*t}}function n$(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 o$(e){return(e=+e)==1?cf:function(t,o){return o-t?n$(t,o,e):sf(isNaN(t)?o:t)}}function cf(e,t){var o=t-e;return o?t$(e,o):sf(isNaN(e)?t:e)}const df=(function e(t){var o=o$(t);function i(a,l){var r=o((a=Ql(a)).r,(l=Ql(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=cf(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 tr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nr=new RegExp(tr.source,"g");function i$(e){return function(){return e}}function a$(e){return function(t){return e(t)+""}}function l$(e,t){var o=tr.lastIndex=nr.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=tr.exec(e))&&(a=nr.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=nr.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?a$(c[0].x):i$(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 uf=180/Math.PI,or={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ff(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)*uf,skewX:Math.atan(c)*uf,scaleX:r,scaleY:s}}var pa;function r$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?or:ff(t.a,t.b,t.c,t.d,t.e,t.f)}function s$(e){return e==null||(pa||(pa=document.createElementNS("http://www.w3.org/2000/svg","g")),pa.setAttribute("transform",e),!(e=pa.transform.baseVal.consolidate()))?or:(e=e.matrix,ff(e.a,e.b,e.c,e.d,e.e,e.f))}function mf(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,y){if(d!==f||u!==p){var b=m.push("translate(",null,t,null,o);y.push({i:b-4,x:Zt(d,f)},{i:b-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,y){if(d!==f||u!==p){var b=m.push(a(m)+"scale(",null,",",null,")");y.push({i:b-4,x:Zt(d,f)},{i:b-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 y=-1,b=p.length,g;++y<b;)f[(g=p[y]).i]=g.x(m);return f.join("")}}}var c$=mf(r$,"px, ","px)","deg)"),d$=mf(s$,", ",")",")"),u$=1e-12;function pf(e){return((e=Math.exp(e))+1/e)/2}function f$(e){return((e=Math.exp(e))-1/e)/2}function m$(e){return((e=Math.exp(2*e))-1)/(e+1)}const p$=(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,y=f-c,b=m*m+y*y,g,E;if(b<u$)E=Math.log(p/d)/t,g=function(H){return[s+H*m,c+H*y,d*Math.exp(t*H*E)]};else{var N=Math.sqrt(b),h=(p*p-d*d+i*b)/(2*d*o*N),k=(p*p-d*d-i*b)/(2*p*o*N),q=Math.log(Math.sqrt(h*h+1)-h),B=Math.log(Math.sqrt(k*k+1)-k);E=(B-q)/t,g=function(H){var A=H*E,S=pf(q),L=d/(o*N)*(S*m$(t*A+q)-f$(q));return[s+L*m,c+L*y,d*S/pf(t*A+q)]}}return g.duration=E*1e3*t/Math.SQRT2,g}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 Jn=0,Lo=0,Po=0,hf=1e3,ha,zo,ya=0,kn=0,ga=0,Uo=typeof performance=="object"&&performance.now?performance:Date,yf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ir(){return kn||(yf(h$),kn=Uo.now()+ga)}function h$(){kn=0}function ba(){this._call=this._time=this._next=null}ba.prototype=gf.prototype={constructor:ba,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ir():+o)+(t==null?0:+t),!this._next&&zo!==this&&(zo?zo._next=this:ha=this,zo=this),this._call=e,this._time=o,ar()},stop:function(){this._call&&(this._call=null,this._time=1/0,ar())}};function gf(e,t,o){var i=new ba;return i.restart(e,t,o),i}function y$(){ir(),++Jn;for(var e=ha,t;e;)(t=kn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jn}function bf(){kn=(ya=Uo.now())+ga,Jn=Lo=0;try{y$()}finally{Jn=0,b$(),kn=0}}function g$(){var e=Uo.now(),t=e-ya;t>hf&&(ga-=t,ya=e)}function b$(){for(var e,t=ha,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:ha=o);zo=e,ar(i)}function ar(e){if(!Jn){Lo&&(Lo=clearTimeout(Lo));var t=e-kn;t>24?(e<1/0&&(Lo=setTimeout(bf,e-Uo.now()-ga)),Po&&(Po=clearInterval(Po))):(Po||(ya=Uo.now(),Po=setInterval(g$,hf)),Jn=1,yf(bf))}}function _f(e,t,o){var i=new ba;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var _$=jl("start","end","cancel","interrupt"),E$=[],Ef=0,kf=1,lr=2,_a=3,wf=4,rr=5,Ea=6;function ka(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;k$(e,o,{name:t,index:i,group:a,on:_$,tween:E$,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Ef})}function sr(e,t){var o=_t(e,t);if(o.state>Ef)throw new Error("too late; already scheduled");return o}function Ct(e,t){var o=_t(e,t);if(o.state>_a)throw new Error("too late; already running");return o}function _t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function k$(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=gf(l,0,o.time);function l(d){o.state=kf,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!==kf)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===_a)return _f(r);m.state===wf?(m.state=Ea,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Ea,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(_f(function(){o.state===_a&&(o.state=wf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=lr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===lr){for(o.state=_a,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=rr,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===rr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ea,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function wa(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>lr&&i.state<rr,i.state=Ea,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function w$(e){return this.each(function(){wa(this,e)})}function v$(e,t){var o,i;return function(){var a=Ct(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 N$(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Ct(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 $$(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=_t(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?v$:N$)(o,e,t))}function cr(e,t,o){var i=e._id;return e.each(function(){var a=Ct(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return _t(a,i).value[t]}}function vf(e,t){var o;return(typeof t=="number"?Zt:t instanceof Do?df:(o=Do(t))?(t=o,df):l$)(e,t)}function I$(e){return function(){this.removeAttribute(e)}}function S$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function x$(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 C$(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 R$(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 V$(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 A$(e,t){var o=sa(e),i=o==="transform"?d$:vf;return this.attrTween(e,typeof t=="function"?(o.local?V$:R$)(o,i,cr(this,"attr."+e,t)):t==null?(o.local?S$:I$)(o):(o.local?C$:x$)(o,i,t))}function T$(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function M$(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function B$(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&M$(e,l)),o}return a._value=t,a}function O$(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&T$(e,l)),o}return a._value=t,a}function D$(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=sa(e);return this.tween(o,(i.local?B$:O$)(i,t))}function L$(e,t){return function(){sr(this,e).delay=+t.apply(this,arguments)}}function P$(e,t){return t=+t,function(){sr(this,e).delay=t}}function z$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?L$:P$)(t,e)):_t(this.node(),t).delay}function U$(e,t){return function(){Ct(this,e).duration=+t.apply(this,arguments)}}function F$(e,t){return t=+t,function(){Ct(this,e).duration=t}}function H$(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?U$:F$)(t,e)):_t(this.node(),t).duration}function G$(e,t){if(typeof t!="function")throw new Error;return function(){Ct(this,e).ease=t}}function Y$(e){var t=this._id;return arguments.length?this.each(G$(t,e)):_t(this.node(),t).ease}function j$(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Ct(this,e).ease=o}}function W$(e){if(typeof e!="function")throw new Error;return this.each(j$(this._id,e))}function K$(e){typeof e!="function"&&(e=Uu(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 Pt(i,this._parents,this._name,this._id)}function q$(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 Pt(r,this._parents,this._name,this._id)}function X$(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 Z$(e,t,o){var i,a,l=X$(t)?sr:Ct;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function J$(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(Z$(o,e,t))}function Q$(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function eI(){return this.on("end.remove",Q$(this._id))}function tI(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Kl(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,ka(d[p],t,o,p,d,_t(u,o)));return new Pt(l,this._parents,t,o)}function nI(e){var t=this._name,o=this._id;typeof e!="function"&&(e=zu(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,y=_t(u,o),b=0,g=p.length;b<g;++b)(m=p[b])&&ka(m,t,o,b,p,y);l.push(p),r.push(u)}return new Pt(l,r,t,o)}var oI=To.prototype.constructor;function iI(){return new oI(this._groups,this._parents)}function aI(e,t){var o,i,a;return function(){var l=Xn(this,e),r=(this.style.removeProperty(e),Xn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Nf(e){return function(){this.style.removeProperty(e)}}function lI(e,t,o){var i,a=o+"",l;return function(){var r=Xn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function rI(e,t,o){var i,a,l;return function(){var r=Xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function sI(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Ct(this,e),d=c.on,u=c.value[l]==null?s||(s=Nf(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function cI(e,t,o){var i=(e+="")=="transform"?c$:vf;return t==null?this.styleTween(e,aI(e,i)).on("end.style."+e,Nf(e)):typeof t=="function"?this.styleTween(e,rI(e,i,cr(this,"style."+e,t))).each(sI(this._id,e)):this.styleTween(e,lI(e,i,t),o).on("end.style."+e,null)}function dI(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function uI(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&dI(e,r,o)),i}return l._value=t,l}function fI(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,uI(e,t,o??""))}function mI(e){return function(){this.textContent=e}}function pI(e){return function(){var t=e(this);this.textContent=t??""}}function hI(e){return this.tween("text",typeof e=="function"?pI(cr(this,"text",e)):mI(e==null?"":e+""))}function yI(e){return function(t){this.textContent=e.call(this,t)}}function gI(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&yI(a)),t}return i._value=e,i}function bI(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,gI(e))}function _I(){for(var e=this._name,t=this._id,o=$f(),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=_t(c,t);ka(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Pt(i,this._parents,e,o)}function EI(){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=Ct(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 kI=0;function Pt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function $f(){return++kI}var zt=To.prototype;Pt.prototype={constructor:Pt,select:tI,selectAll:nI,selectChild:zt.selectChild,selectChildren:zt.selectChildren,filter:K$,merge:q$,selection:iI,transition:_I,call:zt.call,nodes:zt.nodes,node:zt.node,size:zt.size,empty:zt.empty,each:zt.each,on:J$,attr:A$,attrTween:D$,style:cI,styleTween:fI,text:hI,textTween:bI,remove:eI,tween:$$,delay:z$,duration:H$,ease:Y$,easeVarying:W$,end:EI,[Symbol.iterator]:zt[Symbol.iterator]};function wI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vI={time:null,delay:0,duration:250,ease:wI};function NI(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 $I(e){var t,o;e instanceof Pt?(t=e._id,e=e._name):(t=$f(),(o=vI).time=ir(),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])&&ka(c,e,t,d,r,o||NI(c,t));return new Pt(i,this._parents,e,t)}To.prototype.interrupt=w$,To.prototype.transition=$I;const va=e=>()=>e;function II(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 Ut(e,t,o){this.k=e,this.x=t,this.y=o}Ut.prototype={constructor:Ut,scale:function(e){return e===1?this:new Ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ut(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 dr=new Ut(1,0,0);Ut.prototype;function ur(e){e.stopImmediatePropagation()}function Fo(e){e.preventDefault(),e.stopImmediatePropagation()}function SI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function xI(){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 If(){return this.__zoom||dr}function CI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function RI(){return navigator.maxTouchPoints||"ontouchstart"in this}function VI(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 AI(){var e=SI,t=xI,o=VI,i=CI,a=RI,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=p$,d=jl("start","zoom","end"),u,f,p,m=500,y=150,b=0,g=10;function E(_){_.property("__zoom",If).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",L).filter(a).on("touchstart.zoom",ee).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(_,Y,T,W){var Q=_.selection?_.selection():_;Q.property("__zoom",If),_!==Q?q(_,Y,T,W):Q.interrupt().each(function(){B(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},E.scaleBy=function(_,Y,T,W){E.scaleTo(_,function(){var Q=this.__zoom.k,te=typeof Y=="function"?Y.apply(this,arguments):Y;return Q*te},T,W)},E.scaleTo=function(_,Y,T,W){E.transform(_,function(){var Q=t.apply(this,arguments),te=this.__zoom,C=T==null?k(Q):typeof T=="function"?T.apply(this,arguments):T,Z=te.invert(C),le=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(te,le),C,Z),Q,r)},T,W)},E.translateBy=function(_,Y,T,W){E.transform(_,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),r)},null,W)},E.translateTo=function(_,Y,T,W,Q){E.transform(_,function(){var te=t.apply(this,arguments),C=this.__zoom,Z=W==null?k(te):typeof W=="function"?W.apply(this,arguments):W;return o(dr.translate(Z[0],Z[1]).scale(C.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof T=="function"?-T.apply(this,arguments):-T),te,r)},W,Q)};function N(_,Y){return Y=Math.max(l[0],Math.min(l[1],Y)),Y===_.k?_:new Ut(Y,_.x,_.y)}function h(_,Y,T){var W=Y[0]-T[0]*_.k,Q=Y[1]-T[1]*_.k;return W===_.x&&Q===_.y?_:new Ut(_.k,W,Q)}function k(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function q(_,Y,T,W){_.on("start.zoom",function(){B(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,te=arguments,C=B(Q,te).event(W),Z=t.apply(Q,te),le=T==null?k(Z):typeof T=="function"?T.apply(Q,te):T,pe=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),be=Q.__zoom,de=typeof Y=="function"?Y.apply(Q,te):Y,me=c(be.invert(le).concat(pe/be.k),de.invert(le).concat(pe/de.k));return function(ye){if(ye===1)ye=de;else{var ve=me(ye),Ce=pe/ve[2];ye=new Ut(Ce,le[0]-ve[0]*Ce,le[1]-ve[1]*Ce)}C.zoom(null,ye)}})}function B(_,Y,T){return!T&&_.__zooming||new H(_,Y)}function H(_,Y){this.that=_,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,Y),this.taps=0}H.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,Y){return this.mouse&&_!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var Y=qt(this.that).datum();d.call(_,this.that,new II(_,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),Y)}};function A(_,...Y){if(!e.apply(this,arguments))return;var T=B(this,Y).event(_),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,i.apply(this,arguments)))),te=Xt(_);if(T.wheel)(T.mouse[0][0]!==te[0]||T.mouse[0][1]!==te[1])&&(T.mouse[1]=W.invert(T.mouse[0]=te)),clearTimeout(T.wheel);else{if(W.k===Q)return;T.mouse=[te,W.invert(te)],wa(this),T.start()}Fo(_),T.wheel=setTimeout(C,y),T.zoom("mouse",o(h(N(W,Q),T.mouse[0],T.mouse[1]),T.extent,r));function C(){T.wheel=null,T.end()}}function S(_,...Y){if(p||!e.apply(this,arguments))return;var T=_.currentTarget,W=B(this,Y,!0).event(_),Q=qt(_.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",pe,!0),te=Xt(_,T),C=_.clientX,Z=_.clientY;UN(_.view),ur(_),W.mouse=[te,this.__zoom.invert(te)],wa(this),W.start();function le(be){if(Fo(be),!W.moved){var de=be.clientX-C,me=be.clientY-Z;W.moved=de*de+me*me>b}W.event(be).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Xt(be,T),W.mouse[1]),W.extent,r))}function pe(be){Q.on("mousemove.zoom mouseup.zoom",null),FN(be.view,W.moved),Fo(be),W.event(be).end()}}function L(_,...Y){if(e.apply(this,arguments)){var T=this.__zoom,W=Xt(_.changedTouches?_.changedTouches[0]:_,this),Q=T.invert(W),te=T.k*(_.shiftKey?.5:2),C=o(h(N(T,te),W,Q),t.apply(this,Y),r);Fo(_),s>0?qt(this).transition().duration(s).call(q,C,W,_):qt(this).call(E.transform,C,W,_)}}function ee(_,...Y){if(e.apply(this,arguments)){var T=_.touches,W=T.length,Q=B(this,Y,_.changedTouches.length===W).event(_),te,C,Z,le;for(ur(_),C=0;C<W;++C)Z=T[C],le=Xt(Z,this),le=[le,this.__zoom.invert(le),Z.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==le[2]&&(Q.touch1=le,Q.taps=0):(Q.touch0=le,te=!0,Q.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(Q.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),wa(this),Q.start())}}function M(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C,Z,le;for(Fo(_),te=0;te<Q;++te)C=W[te],Z=Xt(C,this),T.touch0&&T.touch0[2]===C.identifier?T.touch0[0]=Z:T.touch1&&T.touch1[2]===C.identifier&&(T.touch1[0]=Z);if(C=T.that.__zoom,T.touch1){var pe=T.touch0[0],be=T.touch0[1],de=T.touch1[0],me=T.touch1[1],ye=(ye=de[0]-pe[0])*ye+(ye=de[1]-pe[1])*ye,ve=(ve=me[0]-be[0])*ve+(ve=me[1]-be[1])*ve;C=N(C,Math.sqrt(ye/ve)),Z=[(pe[0]+de[0])/2,(pe[1]+de[1])/2],le=[(be[0]+me[0])/2,(be[1]+me[1])/2]}else if(T.touch0)Z=T.touch0[0],le=T.touch0[1];else return;T.zoom("touch",o(h(C,Z,le),T.extent,r))}}function oe(_,...Y){if(this.__zooming){var T=B(this,Y).event(_),W=_.changedTouches,Q=W.length,te,C;for(ur(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),te=0;te<Q;++te)C=W[te],T.touch0&&T.touch0[2]===C.identifier?delete T.touch0:T.touch1&&T.touch1[2]===C.identifier&&delete T.touch1;if(T.touch1&&!T.touch0&&(T.touch0=T.touch1,delete T.touch1),T.touch0)T.touch0[1]=this.__zoom.invert(T.touch0[0]);else if(T.end(),T.taps===2&&(C=Xt(C,this),Math.hypot(f[0]-C[0],f[1]-C[1])<g)){var Z=qt(this).on("dblclick.zoom");Z&&Z.apply(this,arguments)}}}return E.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:va(+_),E):i},E.filter=function(_){return arguments.length?(e=typeof _=="function"?_:va(!!_),E):e},E.touchable=function(_){return arguments.length?(a=typeof _=="function"?_:va(!!_),E):a},E.extent=function(_){return arguments.length?(t=typeof _=="function"?_:va([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),E):t},E.scaleExtent=function(_){return arguments.length?(l[0]=+_[0],l[1]=+_[1],E):[l[0],l[1]]},E.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],E):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},E.constrain=function(_){return arguments.length?(o=_,E):o},E.duration=function(_){return arguments.length?(s=+_,E):s},E.interpolate=function(_){return arguments.length?(c=_,E):c},E.on=function(){var _=d.on.apply(d,arguments);return _===d?E:_},E.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,E):Math.sqrt(b)},E.tapDistance=function(_){return arguments.length?(g=+_,E):g},E}const Sf=Symbol("MiniMapSlots"),TI=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],MI={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},BI=n.defineComponent({...MI,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(Sf),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,TI))],64)):n.createCommentVNode("",!0)}}),OI=["width","height","viewBox","aria-labelledby"],DI=["id"],LI=["d","fill","stroke","stroke-width"],PI={name:"MiniMap",compatConfig:{MODE:3}},zI=n.defineComponent({...PI,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:y}=Pe(),b=n.ref();n.provide(Sf,o);const g=n.toRef(()=>{var Q;return e.width??((Q=i.style)==null?void 0:Q.width)??a}),E=n.toRef(()=>{var Q;return e.height??((Q=i.style)==null?void 0:Q.height)??l}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),q=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),B=n.computed(()=>$l(y.value.filter(Q=>!Q.hidden))),H=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})),A=n.computed(()=>y.value&&y.value.length?h0(B.value,H.value):H.value),S=n.computed(()=>{const Q=A.value.width/g.value,te=A.value.height/E.value;return Math.max(Q,te)}),L=n.computed(()=>{const Q=S.value*g.value,te=S.value*E.value,C=e.offsetScale*S.value;return{offset:C,x:A.value.x-(Q-A.value.width)/2-C,y:A.value.y-(te-A.value.height)/2-C,width:Q+C*2,height:te+C*2}}),ee=n.computed(()=>!L.value.x||!L.value.y?"":`
|
|
36
39
|
M${L.value.x-L.value.offset},${L.value.y-L.value.offset}
|
|
37
40
|
h${L.value.width+L.value.offset*2}
|
|
38
41
|
v${L.value.height+L.value.offset*2}
|
|
@@ -45,5 +48,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
|
|
|
45
48
|
h${-(H.value.width-2*e.maskBorderRadius)}
|
|
46
49
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
47
50
|
v${-(H.value.height-2*e.maskBorderRadius)}
|
|
48
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(Q=>{if(b.value){const te=qt(b.value),C=pe=>{if(pe.sourceEvent.type!=="wheel"||!m.value||!p.value)return;const be=pe.sourceEvent.ctrlKey&&Co()?10:1,de=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,me=c.value.zoom*2**(de*be);p.value.scaleTo(m.value,me)},Z=pe=>{if(pe.sourceEvent.type!=="mousemove"||!m.value||!p.value)return;const be=S.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),de={x:c.value.x-pe.sourceEvent.movementX*be,y:c.value.y-pe.sourceEvent.movementY*be},me=[[0,0],[u.value.width,u.value.height]],ye=sr.translate(de.x,de.y).scale(c.value.zoom),ve=p.value.constrain()(ye,me,d.value);p.value.transform(m.value,ve)},le=CI().wheelDelta(pe=>Nl(pe)*(e.zoomStep/10)).on("zoom",e.pannable?Z:()=>{}).on("zoom.wheel",e.zoomable?C:()=>{});te.call(le),Q(()=>{te.on("zoom",null)})}},{flush:"post"});function M(Q){const[te,C]=Xt(Q);t("click",{event:Q,position:{x:te,y:C}})}function oe(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeClick(C),t("nodeClick",C)}function _(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeDoubleClick(C),t("nodeDblclick",C)}function Y(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseEnter(C),t("nodeMouseenter",C)}function T(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseMove(C),t("nodeMousemove",C)}function W(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseLeave(C),t("nodeMouseleave",C)}return(Q,te)=>(n.openBlock(),n.createBlock(n.unref(iu),{position:Q.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:Q.pannable,zoomable:Q.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:E.value,viewBox:[L.value.x,L.value.y,L.value.width,L.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:M},[Q.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(Q.ariaLabel),9,MI)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),C=>(n.openBlock(),n.createBlock(AI,{id:C.id,key:C.id,f:"",position:C.computedPosition,dimensions:C.dimensions,selected:C.selected,dragging:C.dragging,style:n.normalizeStyle(C.style),class:n.normalizeClass(X.value(C)),color:h.value(C),"border-radius":Q.nodeBorderRadius,"stroke-color":w.value(C),"stroke-width":Q.nodeStrokeWidth,"shape-rendering":n.unref($),type:C.type,hidden:C.hidden,onClick:Z=>oe(Z,C),onDblclick:Z=>_(Z,C),onMouseenter:Z=>Y(Z,C),onMousemove:Z=>T(Z,C),onMouseleave:Z=>W(Z,C)},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:ee.value,fill:Q.maskColor,stroke:Q.maskStrokeColor,"stroke-width":Q.maskStrokeWidth,"fill-rule":"evenodd"},null,8,BI)],8,TI))]),_:1},8,["position","class"]))}}),LI=["d"],PI=["cx","cy","onDblclick"],zI=["x","y","onPointerdown","onDblclick"],UI=ze(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Hl),a=n.inject(gn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Kn,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((A,S)=>S===d.value?u.value:A)),{source:m,target:p,sourceSide:y,targetSide:b}=Vu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),g=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Na(m.value,y.value,f.value,p.value,b.value):Ia(m.value,f.value,p.value)),E=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?$a(m.value,y.value,f.value,p.value,b.value):Ca(m.value,f.value,p.value).map((A,S)=>({point:A,segIndex:S})):[]),$=n.computed(()=>l.value?f.value:[]);function h(A,S){d.value=A,u.value={...c.value[A]},S.target.setPointerCapture(S.pointerId),S.stopPropagation()}function w(A){if(d.value<0)return;const S=o({x:A.clientX,y:A.clientY});u.value={x:S.x,y:S.y}}function X(A){var S,L;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(L=(S=A.target).releasePointerCapture)==null||L.call(S,A.pointerId)}function B(A,S){S.stopPropagation(),i==null||i.removePoint(t.id,A)}function H(A,S){if(!i)return;const L=o({x:S.clientX,y:S.clientY});i.insertPoint(t.id,A,{x:L.x,y:L.y})}return(A,S)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,LI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E.value,(L,ee)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${ee}`,cx:L.point.x,cy:L.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(M=>H(L.segIndex,M),["stop"])},null,42,PI))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($.value,(L,ee)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${ee}`,x:L.x-5,y:L.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>h(ee,M),onPointermove:w,onPointerup:X,onDblclick:M=>B(ee,M)},null,42,zI))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),FI=["data-theme"],HI={key:0,class:"em-ctx__sep",role:"separator"},GI={key:1,class:"em-ctx__swatches"},YI={class:"em-ctx__swatches-label"},jI={class:"em-ctx__chips"},WI=["onClick"],KI=["title","onClick"],qI=["disabled","onClick"],XI={class:"em-ctx__icon"},ZI={class:"em-ctx__caption"},JI=ze(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(p,y){var E;i.value=y,a.value=(E=p.target)!=null&&E.closest('[data-theme="dark"]')?"dark":void 0,r.x=p.clientX,r.y=p.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const b=l.value;if(!b)return;const g=b.getBoundingClientRect();r.x+g.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-g.width)),r.y+g.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-g.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(p){p.key==="Escape"&&(p.stopPropagation(),d())}function f(p){p.disabled||(p.handler(),d())}function m(p,y){p.onPick(y),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(p,y)=>(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:y[0]||(y[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(b,g)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:g},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",HI)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",GI,[n.createElementVNode("span",YI,n.toDisplayString(b.caption),1),n.createElementVNode("div",jI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:"없음",onClick:E=>m(b,null)},null,10,WI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),E=>(n.openBlock(),n.createElementBlock("button",{key:E,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===E}]),style:n.normalizeStyle({background:n.unref(Yn)(E)}),title:n.unref(Gn)(E),onClick:$=>m(b,E)},null,14,KI))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:E=>f(b)},[n.createElementVNode("span",XI,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",ZI,n.toDisplayString(b.caption),1)],10,qI))],64))),128))],36)],8,FI)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),dr=[".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 Jn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function QI(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function eS(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 y=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=t(y.left,y.top+y.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,m=0;const p=()=>{const y=d.trim();if(y){const b=t(f,(u+m)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(l,y),a.setEnd(l,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(p(),u=b.top,f=b.left,m=b.bottom,d=s[y]):(d+=s[y],m=Math.max(m,b.bottom))}return p(),c}function ka(e,t){const o=[];for(const i of e.querySelectorAll("*"))QI(i)&&(i.closest(dr)||Jn(i)&&o.push(...eS(i,t)));return o}function Uo(e){return Math.round(e*100)/100}function tS(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(dr)||!Jn(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="${Uo(l.x)}" y="${Uo(l.y)}" width="${Uo(r.x-l.x)}" height="${Uo(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 nS(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Jn(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=>Uo(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 If(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(dr)||!Jn(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 Fo(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 ur(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 oS(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!Jn(y))continue;const b=y.firstElementChild;if(b)if(p.type==="group"){const g=Fo(b,o);ur(s,g),i.push({...g,texts:[]});const E=b.querySelector(".em-group__label");E&&i.push({...Fo(E,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ka(b,o)})}else if(p.type==="note"){const g={...Fo(b,o),texts:ka(b,o),lines:If(b,b,o)};ur(s,g),l.push(g)}else{const g=Fo(b,o);ur(s,g);const E=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const $=b.querySelector(".em-entity__header");if($){const h=Fo($,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ka(b,o),lines:If(b,b,o),icons:tS(b,o)}),a.push({...g,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Jn(y))continue;const b=y.getAttribute("d");if(!b)continue;const g=getComputedStyle(y),E=g.strokeDasharray,$=nS(p);r.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:ka(p,o),markers:$.length?$: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 fr(e){return xr(oS(e))}function Sf(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function xf(e,t="diagram.svg"){const o=fr(e);Sf(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function iS(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function Cf(e,t="diagram.png",o=2){const i=fr(e),{w:a,h:l}=iS(i),r=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=l,await new Promise((f,m)=>{s.onload=()=>f(),s.onerror=()=>m(new Error("SVG 이미지 로드 실패")),s.src=r});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(l*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,l);const u=await new Promise(f=>c.toBlob(f,"image/png"));if(!u)throw new Error("PNG 변환 실패");Sf(u,t)}finally{URL.revokeObjectURL(r)}}const aS={class:"em-shortcuts"},lS={class:"em-shortcuts__title"},rS={class:"em-shortcuts__keys"},sS={class:"em-shortcuts__kbd"},cS={key:0,class:"em-shortcuts__plus"},dS={class:"em-shortcuts__desc"},uS={class:"em-shortcuts__actions"},Rf=ze(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ae.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",aS,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",lS,n.toDisplayString(s.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.items,c=>(n.openBlock(),n.createElementBlock("div",{key:c.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",rS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.keys,(d,u)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d+u},[n.createElementVNode("kbd",sS,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",cS,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",dS,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",uS,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function fS(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const mS={key:0,class:"em-canvas__empty","aria-hidden":"true"},pS={key:1,class:"em-canvas__empty-title"},hS={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},yS={class:"em-conflict-banner__body"},gS={class:"em-conflict-banner__title"},bS={class:"em-conflict-banner__detail"},_S={key:0,class:"em-toast",role:"status","aria-live":"polite"},mr="nc:",Vf=ze(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,N=>{N&&(l.value=N.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>fS(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(N){u.x=N.clientX,u.y=N.clientY}const m=n.ref(null);n.provide(ta,m);const p=n.ref(null);n.provide(hu,p);const y=n.ref(null),b=n.computed(()=>{const N=y.value,x=new Set;if(!N)return x;if(N.kind==="entity")x.add(N.id);else if(N.kind==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===N.id);for(const R of(ie==null?void 0:ie.group.memberEntityRefs)??[])x.add(R)}return x}),g=n.computed(()=>{const N=y.value,x=new Set(b.value),ie=new Set,R=new Set;if(!N)return{related:x,edges:ie,notes:R};if(N.kind==="note"){R.add(N.id);for(const P of i.resolved.value.noteConnections)P.noteRef===N.id&&x.add(P.targetRef);return{related:x,edges:ie,notes:R}}const G=b.value;if(!G.size)return{related:x,edges:ie,notes:R};for(const P of i.resolved.value.associations){const{end1:se,end2:Ne}=P.association;(G.has(se.entityRef)||G.has(Ne.entityRef))&&(ie.add(P.association.modelId),x.add(se.entityRef),x.add(Ne.entityRef))}for(const P of i.resolved.value.noteConnections)x.has(P.targetRef)&&R.add(P.noteRef);return{related:x,edges:ie,notes:R}});n.provide(Kn,{source:y,active:n.computed(()=>y.value!==null),primaryEntityIds:b,relatedEntityIds:n.computed(()=>g.value.related),relatedEdgeIds:n.computed(()=>g.value.edges),relatedNoteIds:n.computed(()=>g.value.notes),hoverGroupId:n.computed(()=>{var N;return((N=y.value)==null?void 0:N.kind)==="group"?y.value.id:null}),setEntityHover:N=>{p.value||d.value||(y.value=N?{kind:"entity",id:N}:null)},setGroupHover:N=>{p.value||d.value||(y.value=N?{kind:"group",id:N}:null)},setNoteHover:N=>{p.value||d.value||(y.value=N?{kind:"note",id:N}:null)}}),n.provide(gn,i);function E(N,x){return`${mr}${N}:${x}`}function $(N){if(!N.startsWith(mr))return null;const[x,ie]=N.slice(mr.length).split(":");return x&&ie?{noteRef:x,targetRef:ie}:null}n.provide(Hl,{points:N=>{var ie,R;const x=$(N);return x?((ie=i.resolved.value.noteConnections.find(G=>G.noteRef===x.noteRef&&G.targetRef===x.targetRef))==null?void 0:ie.waypoints)??[]:((R=i.resolved.value.associations.find(G=>G.association.modelId===N))==null?void 0:R.waypoints)??[]},movePoint:(N,x,ie)=>{const R=$(N);R?i.moveNoteConnectionWaypoint(R.noteRef,R.targetRef,x,ie):i.moveWaypoint(N,x,ie)},insertPoint:(N,x,ie)=>{const R=$(N);R?i.addNoteConnectionWaypoint(R.noteRef,R.targetRef,x,ie):i.addWaypoint(N,x,ie)},removePoint:(N,x)=>{const ie=$(N);ie?i.removeNoteConnectionWaypoint(ie.noteRef,ie.targetRef,x):i.removeWaypoint(N,x)}});const h=Pe(),{nodes:w,edges:X,findNode:B,findEdge:H,addNodes:A,addEdges:S,removeNodes:L,removeEdges:ee,fitView:M,setCenter:oe,getViewport:_,screenToFlowCoordinate:Y,getSelectedNodes:T,updateNodeInternals:W}=h,Q=n.ref(!1);async function te(N){Q.value=!0,await n.nextTick(),await new Promise(x=>requestAnimationFrame(()=>x(null)));try{return await N()}finally{Q.value=!1}}function C(){return te(()=>xf(h))}function Z(){return te(()=>Cf(h))}t({exportSvg:C,exportPng:Z});const le=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const N=_(),{width:x,height:ie}=h.dimensions.value;return{x:(x/2-N.x)/N.zoom,y:(ie/2-N.y)/N.zoom}}function be(){const N=pe();i.addEntity("NewEntity",{x:N.x,y:N.y})}function de(){const N=pe();i.addNote("메모",{x:N.x,y:N.y})}function me(N){for(const x of i.resolved.value.groups){const{location:ie,size:R}=x.geo;if(N.x>=ie.x&&N.x<=ie.x+R.width&&N.y>=ie.y&&N.y<=ie.y+R.height)return x.group.modelId}return null}function ye(){const N=i.resolved.value,x=new Map(N.groups.map(se=>[se.group.modelId,se.geo])),ie=new Set(N.groups.map(se=>se.group.modelId)),R=new Set([...ie,...N.entities.map(se=>se.entity.modelId),...N.notes.map(se=>se.note.modelId)]);for(const se of[...w.value])R.has(se.id)||L([se.id]);for(const se of N.groups){const Ne=se.group.modelId,fe={width:`${se.geo.size.width}px`,height:`${se.geo.size.height}px`},Me={group:se.group,style:se.style,locked:se.locked},Le=se.locked?!1:void 0,Fe=B(Ne);Fe?(Fe.position={...se.geo.location},Fe.data=Me,Fe.style=fe,Fe.draggable=Le):A([{id:Ne,type:"group",position:{...se.geo.location},draggable:Le,style:fe,data:Me}])}for(const se of N.entities){const Ne=se.entity.modelId,fe=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Me={entity:se.entity,displayMode:i.displayMode.value,collapsed:se.collapsed,locked:se.locked,groupRef:fe,size:se.geo.size,style:se.style,attributeStyles:se.attributeStyles,operationStyles:se.operationStyles},Le=se.locked?!1:void 0,Fe=fe?x.get(fe):void 0,et=Fe?{x:se.geo.location.x-Fe.location.x,y:se.geo.location.y-Fe.location.y}:{...se.geo.location},je=B(Ne);je?(je.position=et,je.data=Me,je.parentNode=fe,je.draggable=Le):A([{id:Ne,type:"entity",position:et,parentNode:fe,draggable:Le,data:Me}])}for(const se of N.notes){const Ne=se.note,fe=Ne.modelId,Me=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Le={note:Ne,groupRef:Me},Fe={width:`${Ne.geo.size.width}px`,height:`${Ne.geo.size.height}px`},et=Me?x.get(Me):void 0,je=et?{x:Ne.geo.location.x-et.location.x,y:Ne.geo.location.y-et.location.y}:{...Ne.geo.location},Ke=B(fe);Ke?(Ke.position=je,Ke.data=Le,Ke.style=Fe,Ke.parentNode=Me):A([{id:fe,type:"note",position:je,parentNode:Me,style:Fe,data:Le}])}const G=new Map(N.associations.map(se=>[se.association.modelId,se])),P=new Set(N.noteConnections.map(se=>E(se.noteRef,se.targetRef)));for(const se of[...X.value])!G.has(se.id)&&!P.has(se.id)&&ee([se.id]);for(const[se,Ne]of G){const fe={id:se,type:"association",source:Ne.association.end1.entityRef,target:Ne.association.end2.entityRef,sourceHandle:Ne.sourceColumnRef?`r:${Ne.sourceColumnRef}`:void 0,targetHandle:Ne.targetColumnRef?`l:${Ne.targetColumnRef}`:void 0,data:{association:Ne.association,sourceColumnRef:Ne.sourceColumnRef,targetColumnRef:Ne.targetColumnRef}},Me=H(se);Me?(Me.data=fe.data,Me.sourceHandle=fe.sourceHandle,Me.targetHandle=fe.targetHandle):S([fe])}for(const se of N.noteConnections){const Ne=E(se.noteRef,se.targetRef),fe={noteRef:se.noteRef,targetRef:se.targetRef},Me=H(Ne);Me?Me.data=fe:S([{id:Ne,type:"note-connection",source:se.noteRef,target:se.targetRef,data:fe}])}ve()}function ve(){n.nextTick(()=>requestAnimationFrame(()=>W()))}function Ce(){const N=T.value.map(ie=>ie.id);if(N.length)return N;const x=i.selection.value;return x&&(x.kind==="entity"||x.kind==="note"||x.kind==="group")?[x.id]:[]}function Se(N){var G;const x=N.target;if(x&&(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable))return;if(N.key==="?"){a.openModal({component:Rf}),N.preventDefault();return}if(!i.editable.value){(N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="c"&&(i.copy(),N.preventDefault());return}if(N.key==="Delete"||N.key==="Backspace"){i.deleteSelection()&&N.preventDefault();return}if(N.key==="ArrowUp"||N.key==="ArrowDown"||N.key==="ArrowLeft"||N.key==="ArrowRight"){if(((G=i.selection.value)==null?void 0:G.kind)==="attribute"){if(N.key==="ArrowUp"||N.key==="ArrowDown"){const fe=N.key==="ArrowDown"?1:-1;(N.altKey?i.nudgeSelectedAttributes(fe):i.moveAttributeFocus(fe))&&N.preventDefault()}return}const P=N.shiftKey?10:1,se=N.key==="ArrowLeft"?-P:N.key==="ArrowRight"?P:0,Ne=N.key==="ArrowUp"?-P:N.key==="ArrowDown"?P:0;i.nudgeNodes(Ce(),se,Ne)&&N.preventDefault();return}if(!(N.metaKey||N.ctrlKey))return;const R=N.key.toLowerCase();R==="c"?(i.copy(),N.preventDefault()):R==="v"?(i.paste(),N.preventDefault()):R==="z"&&(N.shiftKey?i.redo():i.undo(),N.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),M(),window.addEventListener("keydown",Se),window.addEventListener("pointerup",ge),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Se),window.removeEventListener("pointerup",ge),window.removeEventListener("pointermove",f)});function ge(){m.value=null}function J(){d.value=!0,y.value=null}function q(){var R;d.value=!1;const N=(R=document.elementFromPoint(u.x,u.y))==null?void 0:R.closest(".vue-flow__node"),x=N==null?void 0:N.dataset.id;if(!x){y.value=null;return}const ie=N.classList.contains("vue-flow__node-group")?"group":N.classList.contains("vue-flow__node-note")?"note":"entity";y.value={kind:ie,id:x}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ve),n.watch(()=>i.resolved.value,N=>{const x=y.value;if(!x)return;(x.kind==="entity"?N.entities.some(R=>R.entity.modelId===x.id):x.kind==="group"?N.groups.some(R=>R.group.modelId===x.id):N.notes.some(R=>R.note.modelId===x.id))||(y.value=null)});function v(N){const x=N.computedPosition??N.position,ie=N.dimensions??{width:0,height:0};return{x:x.x+ie.width/2,y:x.y+ie.height/2}}function V(N){const x=N.node;if(x){if(y.value=null,x.type==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===x.id);p.value=ie?{groupId:x.id,dx:x.position.x-ie.geo.location.x,dy:x.position.y-ie.geo.location.y}:null,m.value=null;return}if(x.type!=="entity"&&x.type!=="note"){m.value=null;return}m.value=me(v(x))}}function j(N){var R;m.value=null,p.value=null;const x=(R=N.nodes)!=null&&R.length?N.nodes:[N.node],ie=x.filter(G=>(G==null?void 0:G.type)==="group");if(ie.length){for(const G of ie){if(!G)continue;const P=i.resolved.value.entities.filter(se=>se.groupRef===G.id).map(se=>{const Ne=B(se.entity.modelId),fe=(Ne==null?void 0:Ne.computedPosition)??(Ne==null?void 0:Ne.position)??{x:0,y:0};return{id:se.entity.modelId,location:{x:fe.x,y:fe.y}}});i.dragGroup(G.id,{x:G.position.x,y:G.position.y},P)}return}for(const G of x){if(!G||G.type==="group")continue;const P=G.computedPosition??G.position,se=G.dimensions??{width:0,height:0},Ne={x:P.x+se.width/2,y:P.y+se.height/2};G.type==="note"?i.dropNote(G.id,{x:P.x,y:P.y},me(Ne)):i.dropEntity(G.id,{x:P.x,y:P.y},me(Ne))}}function D(N){var fe,Me,Le,Fe,et;if(!i.editable.value||!N.source||!N.target)return;const x=((fe=B(N.source))==null?void 0:fe.type)==="note",ie=((Me=B(N.target))==null?void 0:Me.type)==="note";if(x||ie){if(x&&ie)return;const je=x?N.source:N.target,Ke=x?N.target:N.source;((Le=B(Ke))==null?void 0:Le.type)==="entity"&&i.addNoteConnection(je,Ke);return}const R=je=>{var Ke;return(Ke=i.state.logical.entities.find(Rt=>Rt.modelId===je))==null?void 0:Ke.stereotype},G=R(N.source)==="JPA_EMBEDDABLE",P=R(N.target)==="JPA_EMBEDDABLE";if(G||P){if(G&&P)return;const je=G?N.source:N.target,Ke=G?N.target:N.source;i.addEmbedAssociation(Ke,je);return}const se=(Fe=N.sourceHandle)!=null&&Fe.startsWith("r:")?N.sourceHandle.slice(2):void 0,Ne=(et=N.targetHandle)!=null&&et.startsWith("l:")?N.targetHandle.slice(2):void 0;i.addAssociation(N.source,N.target,se,Ne)}const K=n.ref(null);function he(N,x){var R;const ie=i.state.layout.entityLayouts.find(G=>G.entityRef===N);return at((R=ie==null?void 0:ie.attributeStyles)==null?void 0:R[x])}function we(N,x){var R;const ie=i.state.layout.entityLayouts.find(G=>G.entityRef===N);return at((R=ie==null?void 0:ie.operationStyles)==null?void 0:R[x])}function $e(N){var x;return at((x=i.state.layout.groupLayouts.find(ie=>ie.groupRef===N))==null?void 0:x.style)}function ke(N){var x;return at((x=i.state.layout.notes.find(ie=>ie.modelId===N))==null?void 0:x.style)}function Re(N){var R,G;if(N.preventDefault(),!i.editable.value)return;const x=()=>Y({x:N.clientX,y:N.clientY}),ie=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const P=x();i.addEntity("NewEntity",{x:P.x,y:P.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const P=x();i.addNote("메모",{x:P.x,y:P.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const P=x();i.addEmptyGroup({x:P.x,y:P.y})}}];((R=i.clipboard.value)==null?void 0:R.kind)==="entity"&&ie.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ie.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(G=K.value)==null||G.open(N,ie)}function Ae({event:N,node:x}){var fe,Me,Le,Fe,et,je,Ke,Rt,Jt,_e,tt,Ho,Go,Yo,jo,Wo,Ko,qo;const ie=N;if(ie.preventDefault(),!i.editable.value){if(x.type==="group"||x.type==="note")return;const Be=(Me=(fe=ie.target)==null?void 0:fe.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(Be){const Ze=i.selection.value;(Ze==null?void 0:Ze.kind)==="attribute"&&Ze.entityId===x.id&&Ze.ids.includes(Be)||i.selectAttribute(x.id,Be);const wn=((Le=i.selection.value)==null?void 0:Le.kind)==="attribute"&&i.selection.value.entityId===x.id?[...i.selection.value.ids]:[Be];(Fe=K.value)==null||Fe.open(ie,[{caption:wn.length>1?`복사 (${wn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(et=K.value)==null||et.open(ie,[{caption:"상세 편집…",icon:"pencil",handler:()=>Qi(a,i,x.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.copy()}}]);return}if(x.type==="group"){const Be=i.isGroupLocked(x.id),Ze=[];Be||Ze.push({type:"swatches",caption:"색상",current:$e(x.id),onPick:ot=>i.setGroupSwatch(x.id,ot)},{type:"separator"}),Ze.push({caption:Be?"잠금 해제":"잠금",icon:Be?"unlock":"lock",handler:()=>i.setGroupLocked(x.id,!Be)}),Be||Ze.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(x.id)}),(je=K.value)==null||je.open(ie,Ze);return}if(x.type==="note"){(Ke=K.value)==null||Ke.open(ie,[{type:"swatches",caption:"색상",current:ke(x.id),onPick:Be=>i.setNoteSwatch(x.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(x.id)}]);return}const R=(Jt=(Rt=ie.target)==null?void 0:Rt.closest("[data-attr]"))==null?void 0:Jt.dataset.attr;if(R){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===x.id&&Be.ids.includes(R)||i.selectAttribute(x.id,R);const ot=((_e=i.selection.value)==null?void 0:_e.kind)==="attribute"&&i.selection.value.entityId===x.id?[...i.selection.value.ids]:[R];if(i.isEntityLocked(x.id)){(tt=K.value)==null||tt.open(ie,[{caption:ot.length>1?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const wn=ot.length>1,pr=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(x.id)},{type:"swatches",caption:wn?`색상 (${ot.length})`:"색상",current:wn?null:he(x.id,R),onPick:bR=>i.setAttributeSwatches(x.id,ot,bR)},{type:"separator"},{caption:wn?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Xo=i.clipboard.value;(Xo==null?void 0:Xo.kind)==="attribute"&&pr.push({caption:Xo.attributes.length>1?`속성 붙여넣기 (${Xo.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.paste()}}),pr.push({type:"separator"},{caption:wn?`속성 삭제 (${ot.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(x.id,ot)}),(Ho=K.value)==null||Ho.open(ie,pr);return}const G=(Yo=(Go=ie.target)==null?void 0:Go.closest("[data-op]"))==null?void 0:Yo.dataset.op;if(G){if(i.isEntityLocked(x.id))return;(jo=K.value)==null||jo.open(ie,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(x.id)},{type:"swatches",caption:"색상",current:we(x.id,G),onPick:Be=>i.setOperationSwatch(x.id,G,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(x.id,G)}]);return}const P=i.resolved.value.entities.find(Be=>Be.entity.modelId===x.id),se=!!(P!=null&&P.locked),Ne=[{caption:se?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Qi(a,i,x.id)}];if(!se){Ne.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(x.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(x.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Ze=T.value.filter(ot=>ot.type==="entity").map(ot=>ot.id);i.createGroup(Ze.includes(x.id)&&Ze.length?Ze:[x.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(x.id,x.id)});const Be=i.embeddableCatalog.value;if(Be.length){Ne.push({type:"separator"});for(const Ze of Be){const ot=((Wo=Ze.label)==null?void 0:Wo.ko)??((Ko=Ze.label)==null?void 0:Ko.en)??Ze.type;Ne.push({caption:`임베더블 추가: ${ot}`,icon:"link",handler:()=>i.addPredefinedEmbed(x.id,Ze.type)})}}}if(Ne.push({type:"separator"}),Ne.push({caption:P!=null&&P.collapsed?"펼치기":"접기",icon:P!=null&&P.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(x.id,!(P!=null&&P.collapsed))}),P!=null&&P.groupRef&&!se&&Ne.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(x.id)}),Ne.push({caption:se?"잠금 해제":"잠금",icon:se?"unlock":"lock",handler:()=>i.setEntityLocked(x.id,!se)}),Ne.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.copy()}}),!se){const Be=i.clipboard.value;(Be==null?void 0:Be.kind)==="attribute"&&Ne.push({caption:Be.attributes.length>1?`속성 붙여넣기 (${Be.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.paste()}}),Ne.push({type:"separator"}),Ne.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(x.id)})}(qo=K.value)==null||qo.open(ie,Ne)}function Oe({event:N,edge:x}){var G,P;const ie=N;if(ie.preventDefault(),!i.editable.value)return;const R=$(x.id);if(R){(G=K.value)==null||G.open(ie,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(R.noteRef,R.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(R.noteRef,R.targetRef)}]);return}(P=K.value)==null||P.open(ie,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(x.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(x.id)}])}function We(N){return N==="group"?"group":N==="note"?"note":"entity"}function I({node:N}){if(T.value.length>1){i.selection.value=null;return}i.selection.value={kind:We(N.type),id:N.id}}function O({nodes:N}){N.length>1&&(i.selection.value=null)}function re({edge:N}){const x=$(N.id);i.selection.value=x?{kind:"note",id:x.noteRef}:{kind:"association",id:N.id}}function ue(N){const x=i.selection.value;return!!x&&x.kind!=="attribute"&&x.id===N.id}function z(N){var x,ie;return ue(N)?N.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":N.type==="note"?"var(--em-note-soft)":N.type==="group"?lu(at((x=N.data)==null?void 0:x.style),!0)??"var(--em-mm-group)":lu(at((ie=N.data)==null?void 0:ie.style))??"var(--em-mm-entity)"}function U(N){return ue(N)?"var(--em-selection)":N.type==="note"?"var(--em-note-accent)":N.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function k(N,x){oe(N,x,{zoom:_().zoom,duration:350})}n.watch(()=>i.focusRequest.value,N=>{if(!N)return;const x=B(N.id);if(!x)return;const ie=x.computedPosition??x.position,R=x.dimensions??{width:0,height:0};k(ie.x+R.width/2,ie.y+R.height/2)});function F({position:N}){k(N.x,N.y)}function ne({node:N}){i.selection.value={kind:We(N.type),id:N.id};const x=N.computedPosition??N.position,ie=N.dimensions??{width:0,height:0};k(x.x+ie.width/2,x.y+ie.height/2)}function ce({node:N}){M({nodes:[N.id],duration:350,maxZoom:1.2,padding:.6})}return(N,x)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(a_),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!Q.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(Dt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:J,onMoveEnd:q,onConnect:D,onConnectStart:x[1]||(x[1]=ie=>c.value=!0),onConnectEnd:x[2]||(x[2]=ie=>c.value=!1),onNodeDrag:V,onNodeDragStop:j,onNodeClick:I,onEdgeClick:re,onSelectionChange:O,onPaneClick:x[3]||(x[3]=ie=>n.unref(i).selection.value=null),onPaneContextMenu:Re,onNodeContextMenu:Ae,onEdgeContextMenu:Oe},{"node-group":n.withCtx(ie=>[n.createVNode(gu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-entity":n.withCtx(ie=>[n.createVNode(yu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-note":n.withCtx(ie=>[n.createVNode(bu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-association":n.withCtx(ie=>[n.createVNode(Au,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-note-connection":n.withCtx(ie=>[n.createVNode(UI,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Cw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(tv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(bn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:be},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(bn),{title:"노트 추가",onClick:de},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(bn),{title:"자동 배치",onClick:x[0]||(x[0]=ie=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(DI),{key:1,pannable:"",width:224,height:160,"node-color":z,"node-stroke-color":U,"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:F,onNodeClick:ne,onNodeDblclick:ce})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",mS,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[x[4]||(x[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),x[5]||(x[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),x[6]||(x[6]=n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub"},[n.createTextVNode(" 단축키 도움말은 "),n.createElementVNode("kbd",null,"?"),n.createTextVNode(" 키 ")],-1))],64)):(n.openBlock(),n.createElementBlock("p",pS,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",hS,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",yS,[n.createElementVNode("strong",gS,n.toDisplayString(s.value.title),1),n.createElementVNode("span",bS,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(JI,{ref_key:"menuRef",ref:K},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",_S,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function wa(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function ES(e,t){const o=new Set,i=a=>{const l=!!a.matchText&&a.matchText.includes(t);let r=!1;for(const c of a.children)i(c)&&(r=!0);const s=l||r;return s&&o.add(a.key),s};return i(e),o}const kS={class:"em-explorer em-scroll-overlay"},wS={class:"em-explorer__search"},vS={key:0,class:"em-explorer__empty"},NS={class:"em-explorer__rows"},$S=["data-key","onClick","onDblclick"],IS=["onClick"],SS=["title"],xS={class:"em-key-slot"},CS={class:"em-key-slot"},RS={class:"em-explorer__label"},Af=ze(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var te;const B=i.resolved.value,H=i.displayMode.value,A=C=>{var Z,le,pe;return Jo(H,C.name,(le=(Z=C.table)==null?void 0:Z.logicalName)==null?void 0:le.ko,(pe=C.table)==null?void 0:pe.physicalName)},S=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",L=C=>{const Z=C.attrType.startsWith("RELATION")&&C.dbAttrs.length>0;return{icon:C.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:C.identifier,fk:Z&&S}}},ee=C=>C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0,M=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",oe=C=>{if(C.attrType!=="EMBED_PREDEF")return C.dbAttrs;const Z=i.embeddableCatalog.value.find(le=>le.type===C.type);return Z?C.dbAttrs.map((le,pe)=>{const be=Z.fields[pe];return be?{...le,physicalName:le.physicalName||be.physicalName,logicalName:le.logicalName??be.logicalName,dataType:le.dataType||be.dataType,length:le.length??be.length}:le}):C.dbAttrs},_=(C,Z)=>{var de,me,ye,ve,Ce,Se,ge,J,q;const le={entityId:Z,attrId:C.modelId};if(ee(C)){const v=Da(H,C);return{key:`attr:${C.modelId}`,label:C.name+(v?` : ${v}`:""),icon:"table",attrRef:le,focusId:Z,matchText:wa(C.name,(me=(de=C.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:me.ko,(ye=C.dbAttrs[0])==null?void 0:ye.physicalName),children:M?oe(C).map(V=>{var j,D;return{key:`attr:${C.modelId}:col:${V.modelId}`,label:Jo(H,V.physicalName,(j=V.logicalName)==null?void 0:j.ko,V.physicalName)+(V.dataType?` : ${V.dataType}`:""),icon:"field",attrRef:le,focusId:Z,matchText:wa(V.physicalName,(D=V.logicalName)==null?void 0:D.ko),children:[]}}):[]}}const pe=Oa(C,i.state.logical.associations),be=Da(H,C,pe);return{key:`attr:${C.modelId}`,label:Jo(H,C.name,(Ce=(ve=C.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:Ce.ko,(Se=C.dbAttrs[0])==null?void 0:Se.physicalName)+(be?` : ${be}`:""),...L(C),attrRef:le,focusId:Z,matchText:wa(C.name,(J=(ge=C.dbAttrs[0])==null?void 0:ge.logicalName)==null?void 0:J.ko,(q=C.dbAttrs[0])==null?void 0:q.physicalName),children:[]}},Y=C=>{var pe,be,de;const Z=C.entity,le=[...Z.attributes].sort((me,ye)=>me.order-ye.order);return{key:`entity:${Z.modelId}`,label:A(Z),icon:"table",selectKind:"entity",selectId:Z.modelId,focusId:Z.modelId,matchText:wa(Z.name,(be=(pe=Z.table)==null?void 0:pe.logicalName)==null?void 0:be.ko,(de=Z.table)==null?void 0:de.physicalName),children:le.map(me=>_(me,Z.modelId))}},T=new Map,W=[];for(const C of B.entities)if(C.groupRef){const Z=T.get(C.groupRef)??[];Z.push(C),T.set(C.groupRef,Z)}else W.push(C);const Q=[];for(const C of B.groups){const Z=C.group;Q.push({key:`group:${Z.modelId}`,label:((te=Z.name)==null?void 0:te.ko)||Z.packageName||"(그룹)",icon:"folder",focusId:Z.modelId,children:(T.get(Z.modelId)??[]).map(Y)})}for(const C of W)Q.push(Y(C));if(B.associations.length){const C=new Map(B.entities.map(Z=>[Z.entity.modelId,A(Z.entity)]));Q.push({key:"section:associations",label:`관계 (${B.associations.length})`,icon:"arrow-lr",children:B.associations.map(Z=>{const le=Z.association,pe=C.get(le.end1.entityRef)??le.end1.entityRef,be=C.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${pe} — ${be}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return B.notes.length&&Q.push({key:"section:notes",label:`노트 (${B.notes.length})`,icon:"note",children:B.notes.map(({note:C})=>{var Z;return{key:`note:${C.modelId}`,label:((Z=C.memo.split(`
|
|
49
|
-
`)[0])==null?void 0:Z.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:C.modelId,focusId:C.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:Q}});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 H=new Set(s.value);H.has(B)?H.delete(B):H.add(B),s.value=H}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),m=n.computed(()=>{const B=[];if(f.value){const A=ES(l.value,d.value.trim().toLowerCase()),S=(L,ee)=>{if(A.has(L.key)){B.push({node:L,depth:ee});for(const M of L.children)S(M,ee+1)}};return S(l.value,0),B}const H=(A,S)=>{if(B.push({node:A,depth:S}),!s.value.has(A.key))for(const L of A.children)H(L,S+1)};return H(l.value,0),B}),p=n.computed(()=>f.value&&m.value.length<=1);function y(B){var S;if(B.key!=="/"||B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;const H=B.target,A=H==null?void 0:H.tagName;A==="INPUT"||A==="TEXTAREA"||A==="SELECT"||H!=null&&H.isContentEditable||(B.preventDefault(),(S=u.value)==null||S.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const b=n.computed(()=>{const B=[],H=A=>{if(A.children.length){A.key!=="root"&&B.push(A.key);for(const S of A.children)H(S)}};return H(l.value),B}),g=n.computed(()=>!b.value.some(B=>s.value.has(B)));function E(){s.value=g.value?new Set(b.value):new Set}t({toggleAll:E,allExpanded:g,hasExpandable:n.computed(()=>b.value.length>0)});function $(B){const H=i.selection.value;return B.attrRef?(H==null?void 0:H.kind)==="attribute"&&H.entityId===B.attrRef.entityId&&H.ids.includes(B.attrRef.attrId):!!H&&H.kind!=="attribute"&&!!B.selectId&&B.selectKind===H.kind&&B.selectId===H.id}function h(B){const H=i.selection.value;return B.selectKind==="entity"&&(H==null?void 0:H.kind)==="attribute"&&H.entityId===B.selectId}function w(B,H){if(B.attrRef){const A=H.shiftKey?"range":H.metaKey||H.ctrlKey?"toggle":"replace";i.selectAttribute(B.attrRef.entityId,B.attrRef.attrId,A)}else B.selectKind&&B.selectId&&(i.selection.value={kind:B.selectKind,id:B.selectId});B.focusId&&i.requestFocus(B.focusId)}function X(B){B.selectKind==="entity"&&B.selectId&&Qi(a,i,B.selectId)}return(B,H)=>(n.openBlock(),n.createElementBlock("section",kS,[n.createElementVNode("div",wS,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":H[0]||(H[0]=A=>d.value=A),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:H[1]||(H[1]=n.withKeys(A=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:H[2]||(H[2]=A=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",vS,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",NS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,({node:A,depth:S})=>(n.openBlock(),n.createElementBlock("div",{key:A.key,class:n.normalizeClass(["em-explorer__row",{"is-active":$(A),"is-focus-parent":h(A),"is-selectable":!!A.selectKind||!!A.attrRef||!!A.focusId}]),"data-key":A.key,style:n.normalizeStyle({paddingLeft:4+S*14+"px"}),onClick:L=>w(A,L),onDblclick:L=>X(A)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!A.children.length,"is-open":!s.value.has(A.key)}]),onClick:n.withModifiers(L=>A.children.length&&c(A.key),["stop"])},[A.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,IS),A.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(A.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",xS,[A.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):A.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:A.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",CS,[A.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,SS)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:A.icon,size:15},null,8,["name"])),n.createElementVNode("span",RS,n.toDisplayString(A.label),1)],46,$S))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),VS={class:"em-text-export"},AS={key:0,class:"em-text-export__tabs",role:"tablist"},TS=["aria-selected","onClick"],MS={class:"em-text-export__pre"},BS={class:"em-text-export__actions"},OS=ze(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",VS,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",AS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(d,u)=>(n.openBlock(),n.createElementBlock("button",{key:d.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":u===i.value}]),"aria-selected":u===i.value,onClick:f=>i.value=u},n.toDisplayString(d.label),11,TS))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",MS,n.toDisplayString(a().content),1),n.createElementVNode("div",BS,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ae.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),DS={class:"em-toolbar"},LS={class:"em-toolbar__mode"},Tf=ze(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","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:p=>i.displayMode.value=p});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const p=i.resolved.value.entities;return p.length>0&&p.every(y=>y.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const p=i.state.logical;l.openModal({component:OS,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:vr(p),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:Va(p,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:Va(p,"class"),filename:"diagram.class.mmd"}]}})}function m(){l.openModal({component:Rf})}return(p,y)=>(n.openBlock(),n.createElementBlock("div",DS,[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:y[0]||(y[0]=b=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{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:y[1]||(y[1]=b=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),y[10]||(y[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",LS,[y[8]||(y[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":y[2]||(y[2]=b=>s.value=b),items:r,"value-provider":b=>b.v,"label-provider":b=>b.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(Ve,{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:y[3]||(y[3]=b=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{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:y[4]||(y[4]=b=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),y[11]||(y[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:y[5]||(y[5]=b=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:y[6]||(y[6]=b=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[y[9]||(y[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:y[7]||(y[7]=b=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:m},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),PS={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},zS=["title"],US=["disabled","aria-pressed"],FS=["disabled","aria-pressed"],HS=ze(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t;function a(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,r)=>e.frozen?(n.openBlock(),n.createElementBlock("div",PS,[n.createVNode(Ve,{name:"lock",size:14}),r[2]||(r[2]=n.createElementVNode("span",null,"편집 잠김 (충돌)",-1))])):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:"이 다이어그램은 조회 전용입니다"},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:r[0]||(r[0]=s=>a(!1))},[n.createVNode(Ve,{name:"eye",size:13}),r[3]||(r[3]=n.createElementVNode("span",null,"조회",-1))],10,US),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:r[1]||(r[1]=s=>a(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),r[4]||(r[4]=n.createElementVNode("span",null,"편집",-1))],10,FS)],10,zS))}}),[["__scopeId","data-v-44f7d737"]]),GS=["disabled"],YS={class:"em-panel__sub"},jS={class:"em-nav"},WS={key:0,class:"em-nav__divider","aria-hidden":"true"},KS={key:1},qS=["onClick","onKeydown"],XS={class:"em-nav__name"},ZS=["title"],JS={key:0,class:"em-panel__note"},QS=["data-attr-block"],ex={class:"em-attr__row"},tx=["title"],nx={key:0,class:"em-attr__row"},ox={class:"em-attr__row"},ix={class:"em-attr__row"},ax={class:"em-attr__flags"},lx={class:"em-attr__pii"},rx={class:"em-attr__pii"},sx={class:"em-attr__pii"},cx={key:0,class:"em-attr__pii em-attr__codetop"},dx={class:"em-multilang"},ux={key:2,class:"em-embed-cols"},fx={class:"em-embed-col__label"},mx={class:"em-attr__row"},px={class:"em-attr__row"},hx={key:0,class:"em-embed-upd"},yx={class:"em-embed-upd"},gx={class:"em-embed-upd"},bx={class:"em-swatch__row em-attr__swatch"},_x=["onClick"],Ex=["title","onClick"],kx={key:0,class:"em-attr__swatch-hint"},wx="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",va="__OWN__",vx=ze(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(R=>R.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(R=>R.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes.filter(G=>G.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),d=n.computed(()=>s.value.filter(R=>r.value.has(R.modelId)));function u(R){return{pk:R.identifier,fk:R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0,required:R.notNull&&!R.identifier}}function f(R){return!!i.value&&!!hi(o.state.logical,i.value.modelId,R.modelId)}function m(R){const G=u(R),P=[G.pk&&"PK",G.fk&&"FK",G.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function p(R,G){i.value&&o.selectAttribute(i.value.modelId,R.modelId,G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace")}const y=["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 b(R){return R==="none"?"(없음)":R}const g=R=>R;function E(R){var G,P;return at((P=(G=a.value)==null?void 0:G.attributeStyles)==null?void 0:P[R.modelId])}function $(R){return r.value.size>1&&r.value.has(R.modelId)}function h(R,G){if(!i.value)return;const P=$(R)?o.selectedAttrIds.value:[R.modelId];o.setAttributeSwatches(i.value.modelId,P,G)}function w(R,G){i.value&&o.updateAttribute(i.value.modelId,R.modelId,G)}function X(R,G){w(R,{naturalId:G||void 0,naturalIdMutable:G?R.naturalIdMutable:void 0})}function B(){return{naturalId:void 0,naturalIdMutable:void 0}}function H(R,G){w(R,{identifier:G,...G?B():{}})}function A(R,G){w(R,{transient:G||void 0,...G?B():{}})}function S(R){return!!R.transient}const L=R=>R.value,ee=R=>R.label;function M(R,G){if(!G)return;const P=C.value.find(se=>se.type===G);if(P){const se=R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"};w(R,{type:G,customType:void 0,dbAttrs:[{...se,dataType:P.dataType,length:P.length,scale:P.scale}]});return}w(R,G===Et?{type:G}:{type:G,customType:void 0})}function oe(R,G){w(R,{customType:G.trim()===""?void 0:G})}function _(R,G){const se={...R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"},...G};G.dataType!==void 0&&!oo.has(se.dataType)&&(se.scale=void 0),w(R,{dbAttrs:[se]})}function Y(R){var G;return oo.has(((G=R.dbAttrs[0])==null?void 0:G.dataType)??"")}function T(R,G,P){var se;_(R,{logicalName:{...(se=R.dbAttrs[0])==null?void 0:se.logicalName,[G]:P}})}function W(R,G){w(R,{description:Object.keys(G).length?G:void 0})}function Q(R){return R.personalInfoAttributeType??"none"}function te(R,G){w(R,{personalInfoAttributeType:G==="none"?void 0:G})}const C=n.computed(()=>o.predefinedCustomTypeCatalog.value),Z=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function pe(R){var G,P;return((G=R.label)==null?void 0:G.ko)??((P=R.label)==null?void 0:P.en)??R.type}function be(R){if(!R||!i.value)return;const G=o.addPredefinedEmbed(i.value.modelId,R);G&&o.selectAttribute(i.value.modelId,G),le.value=void 0}function de(){if(!i.value)return;const R=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,R)}const me=n.computed(()=>o.groupCodeCatalog.value);function ye(R){var G;return((G=me.value.find(P=>P.groupCode===R.groupCode))==null?void 0:G.codes)??[]}function ve(R){return["none",...ye(R)]}function Ce(R){return R==="none"?"none":R.code}function Se(R){var P,se;if(R==="none")return"(없음)";const G=((P=R.label)==null?void 0:P.ko)??((se=R.label)==null?void 0:se.en);return G?`${R.code} (${G})`:R.code}function ge(R,G){i.value&&o.setAttributeGroupCode(i.value.modelId,R.modelId,G)}function J(R,G){w(R,{defaultValue:G==="none"?void 0:G})}function q(R,G){w(R,{defaultValue:G.trim()===""?void 0:G})}function v(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function V(R,G,P){const se=R.dbAttrs.map((Ne,fe)=>{if(fe!==G)return Ne;const Me={...Ne,...P};for(const Le of Object.keys(P))P[Le]===void 0&&delete Me[Le];return Me});i.value&&o.setEmbedColumns(i.value.modelId,R.modelId,se)}function j(R,G,P,se){var Ne;V(R,G,{logicalName:{...(Ne=R.dbAttrs[G])==null?void 0:Ne.logicalName,[P]:se}})}function D(R,G){var Ne,fe,Me;if(R.attrType==="EMBED_PREDEF"){const Le=(Ne=o.embeddableCatalog.value.find(Fe=>Fe.type===R.type))==null?void 0:Ne.fields[G];return Le?{name:Le.name,physicalName:Le.physicalName,dataType:Le.dataType,length:Le.length,shareable:Le.shareable,logicalName:Le.logicalName}:void 0}const P=(fe=R.embedded)==null?void 0:fe.embeddableRef;if(!P)return;const se=(Me=o.state.logical.entities.find(Le=>Le.modelId===P))==null?void 0:Me.attributes.flatMap(Le=>Le.dbAttrs)[G];return se?{physicalName:se.physicalName,dataType:se.dataType,length:se.length,scale:se.scale,logicalName:se.logicalName}:void 0}function K(R,G){var P,se;return((P=D(R,G))==null?void 0:P.dataType)||((se=R.dbAttrs[G])==null?void 0:se.dataType)||""}function he(R,G){var P,se;return((P=D(R,G))==null?void 0:P.length)??((se=R.dbAttrs[G])==null?void 0:se.length)}function we(R,G){var P,se;return((P=D(R,G))==null?void 0:P.scale)??((se=R.dbAttrs[G])==null?void 0:se.scale)}const $e=["inherit","true","false"];function ke(R){return R==="inherit"?"기본(따름)":R}function Re(R){return(R==null?void 0:R.updatable)===void 0?"inherit":R.updatable?"true":"false"}function Ae(R,G,P){V(R,G,{updatable:P==="inherit"?void 0:P==="true"})}function Oe(R,G){_(R,{updatable:G==="inherit"?void 0:G==="true"})}const We=["inherit","true","false"];function I(R){return R==="inherit"?"기본(따름)":R}function O(R){return(R==null?void 0:R.insertable)===void 0?"inherit":R.insertable?"true":"false"}function re(R,G,P){V(R,G,{insertable:P==="inherit"?void 0:P==="true"})}function ue(R,G){_(R,{insertable:G==="inherit"?void 0:G==="true"})}const z=n.computed(()=>i.value?ei(i.value,o.state.logical.entities):[]),U=n.computed(()=>Qt(z.value.flatMap(R=>R.attributes.flatMap(G=>G.dbAttrs)))),k=n.computed(()=>z.value.flatMap(R=>R.attributes.filter(G=>G.attrType==="NORMAL"&&G.dbAttrs.length===1&&G.dbAttrs[0]).map(G=>{var P;return{modelId:G.dbAttrs[0].modelId,physical:G.dbAttrs[0].physicalName||G.name,isCurrency:G.type==="Currency",ownerName:R.modelId===((P=i.value)==null?void 0:P.modelId)?void 0:R.name}})));function F(){const R=[...k.value].sort((G,P)=>Number(P.isCurrency)-Number(G.isCurrency));return[va,...R.map(G=>G.modelId)]}function ne(R){if(R===va)return"전용 컬럼(OWN)";const G=k.value.find(se=>se.modelId===R);return G?`↗ ${G.ownerName?`${G.ownerName}.`:""}${G.physical} (${G.isCurrency?"통화":"공유"})`:R}function ce(R){return(R==null?void 0:R.sharedColumnRef)??va}function N(R,G,P){V(R,G,{sharedColumnRef:P===va?void 0:P})}function x(R){return(R==null?void 0:R.sharedColumnRef)!=null}function ie(R){var G;return((G=Sn(R,U.value))==null?void 0:G.physicalName)??""}return(R,G)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",YS,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:de}),Z.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:Z.value,"value-provider":P=>P.type,"label-provider":pe,"onUpdate:modelValue":be},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",jS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,P=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:P.modelId},[P.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",WS,[...G[0]||(G[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",KS,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:se=>p(P,se),onKeydown:[n.withKeys(n.withModifiers(se=>p(P,se),["prevent"]),["enter"]),n.withKeys(n.withModifiers(se=>p(P,se),["prevent"]),["space"])]},[n.createElementVNode("span",XS,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:m(P)},[u(P).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(P).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(P).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,ZS)],42,qS)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",JS," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var se,Ne,fe,Me,Le,Fe,et,je,Ke,Rt,Jt;return n.openBlock(),n.createElementBlock("div",{key:P.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(P.modelId)}]),"data-attr-block":P.modelId},[n.createElementVNode("div",ex,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":_e=>w(P,{name:_e})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(Vr)(P.type,C.value),"value-provider":L,"label-provider":ee,"model-value":P.type,"onUpdate:modelValue":_e=>M(P,_e)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?wx:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,tx)]),P.type===n.unref(Et)?(n.openBlock(),n.createElementBlock("div",nx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":_e=>oe(P,_e)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),v(P)?(n.openBlock(),n.createElementBlock("div",ux,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(_e,tt)=>{var Ho,Go,Yo,jo,Wo,Ko,qo;return n.openBlock(),n.createElementBlock("div",{key:_e.modelId,class:"em-embed-col"},[n.createElementVNode("span",fx,n.toDisplayString(((Ho=D(P,tt))==null?void 0:Ho.name)??((Go=D(P,tt))==null?void 0:Go.physicalName)??`컬럼 ${tt+1}`),1),n.createElementVNode("div",mx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${_e.modelId}`,width:"100%",disabled:x(_e),placeholder:((Yo=D(P,tt))==null?void 0:Yo.physicalName)??"컬럼","model-value":x(_e)?ie(_e):_e.physicalName,"onUpdate:modelValue":Be=>V(P,tt,{physicalName:Be})},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":K(P,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${_e.modelId}`,width:"48px",disabled:"","model-value":he(P,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${_e.modelId}`,width:"48px",disabled:"","model-value":we(P,tt)},null,8,["name","model-value"])]),n.createVNode(yn,{controller:n.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",px,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${_e.modelId}`,width:"100%",placeholder:((Wo=(jo=D(P,tt))==null?void 0:jo.logicalName)==null?void 0:Wo.ko)??"논리명","model-value":((Ko=_e.logicalName)==null?void 0:Ko.ko)??"","onUpdate:modelValue":Be=>j(P,tt,"ko",Be)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(qo=D(P,tt))!=null&&qo.shareable?(n.openBlock(),n.createElementBlock("label",hx,[G[7]||(G[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":ce(_e),items:F(),"value-provider":g,"label-provider":ne,"onUpdate:modelValue":Be=>Be&&N(P,tt,Be)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",yx,[G[8]||(G[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:x(_e),"model-value":x(_e)?"false":O(_e),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":Be=>Be&&re(P,tt,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",gx,[G[9]||(G[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:x(_e),"model-value":x(_e)?"false":Re(_e),items:$e,"value-provider":g,"label-provider":ke,"onUpdate:modelValue":Be=>Be&&Ae(P,tt,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",ox,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ne=(se=P.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:Ne.ko)??"","onUpdate:modelValue":_e=>T(P,"ko",_e)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",ix,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:S(P),"model-value":((fe=P.dbAttrs[0])==null?void 0:fe.physicalName)??"","onUpdate:modelValue":_e=>_(P,{physicalName:_e})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:S(P),items:n.unref(Cr)(((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(Ma),"model-value":((Le=P.dbAttrs[0])==null?void 0:Le.dataType)??"","onUpdate:modelValue":_e=>_e&&_(P,{dataType:_e})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:S(P),"model-value":(Fe=P.dbAttrs[0])==null?void 0:Fe.length,"onUpdate:modelValue":_e=>_(P,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:S(P)||!Y(P),"model-value":(et=P.dbAttrs[0])==null?void 0:et.scale,"onUpdate:modelValue":_e=>_(P,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(yn,{controller:n.unref(o),"ref-id":(je=P.dbAttrs[0])==null?void 0:je.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",ax,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||S(P),"onUpdate:modelValue":_e=>H(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:S(P),"onUpdate:modelValue":_e=>w(P,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ke=P.dbAttrs[0])!=null&&Ke.unique),disabled:S(P),"onUpdate:modelValue":_e=>_(P,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Rt=P.dbAttrs[0])!=null&&Rt.autoIncrement),disabled:S(P)||!P.identifier,"onUpdate:modelValue":_e=>_(P,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":_e=>A(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||S(P),"onUpdate:modelValue":_e=>X(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:S(P)||!P.naturalId,"onUpdate:modelValue":_e=>w(P,{naturalIdMutable:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((Jt=P.dbAttrs[0])!=null&&Jt.multiValue),disabled:S(P),"onUpdate:modelValue":_e=>_(P,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",lx,[G[1]||(G[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":O(P.dbAttrs[0]),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":_e=>_e&&ue(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",rx,[G[2]||(G[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":Re(P.dbAttrs[0]),items:$e,"value-provider":g,"label-provider":ke,"onUpdate:modelValue":_e=>_e&&Oe(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",sx,[G[3]||(G[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":Q(P),items:y,"value-provider":g,"label-provider":b,"onUpdate:modelValue":_e=>_e&&te(P,_e)},null,8,["model-value","onUpdate:modelValue"])]),me.value.length?(n.openBlock(),n.createElementBlock("label",cx,[G[4]||(G[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(cu,{"model-value":P.groupCode,items:me.value,"onUpdate:modelValue":_e=>ge(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!me.value.length}])},[G[5]||(G[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ve(P),"value-provider":Ce,"label-provider":Se,"onUpdate:modelValue":_e=>_e&&J(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":_e=>q(P,_e)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",dx,[G[6]||(G[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Ll,{multiline:"",name:`attr-desc-${P.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":_e=>W(P,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",bx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":E(P)===null}]),title:"없음",onClick:_e=>h(P,null)},"∅",10,_x),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),_e=>(n.openBlock(),n.createElementBlock("button",{key:_e,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":E(P)===_e}]),style:n.normalizeStyle({background:n.unref(Yn)(_e)}),title:n.unref(Gn)(_e),onClick:tt=>h(P,_e)},null,14,Ex))),128)),$(P)?(n.openBlock(),n.createElementBlock("span",kx,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,QS)}),128))],8,GS)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),Nx=["disabled"],$x={class:"em-panel__sub-label"},Ix={class:"em-attr__row"},Sx={class:"em-field em-idx-params"},xx=["value","onChange"],Cx=ze(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),r=n.computed(()=>l.value?to(l.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var b;return[...(((b=l.value)==null?void 0:b.attributes)??[]).map(g=>({value:g.modelId,label:g.name})),...r.value.map(g=>({value:g.modelId,label:`${g.field} (상속)`}))]});function c(){var g;if(!l.value)return;const b=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:De(),name:`idx_${(((g=l.value.indexes)==null?void 0:g.length)??0)+1}`,unique:!1,columns:b?[{columnRef:b.modelId,descending:!1}]:[]})}function d(b,g){l.value&&a.updateIndex(l.value.modelId,b,g)}function u(b){var E;const g=(E=l.value)==null?void 0:E.attributes[0];g&&d(b.modelId,{columns:[...b.columns,{columnRef:g.modelId,descending:!1}]})}function f(b,g,E){d(b.modelId,{columns:b.columns.map(($,h)=>h===g?{...$,columnRef:E}:$)})}function m(b,g,E){d(b.modelId,{columns:b.columns.map(($,h)=>h===g?{...$,descending:E}:$)})}function p(b,g){d(b.modelId,{columns:b.columns.filter((E,$)=>$!==g)})}function y(b,g){d(b.modelId,{parameters:g.trim()===""?void 0:g})}return(b,g)=>{var E;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:g[0]||(g[0]=$=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",$x,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{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(((E=l.value.indexes)==null?void 0:E.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(c,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],$=>(n.openBlock(),n.createElementBlock("div",{key:$.modelId,class:"em-attr"},[n.createElementVNode("div",Ix,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${$.modelId}`,width:"100%",placeholder:"인덱스명","model-value":$.name,"onUpdate:modelValue":h=>d($.modelId,{name:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${$.modelId}`,class:"em-check",label:"UQ","model-value":$.unique,"onUpdate:modelValue":h=>d($.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(l.value.modelId,$.modelId)},null,8,["onClick"])]),n.createVNode(yn,{controller:n.unref(a),"ref-id":$.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($.columns,(h,w)=>(n.openBlock(),n.createElementBlock("div",{key:w,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":X=>X.value,"label-provider":X=>X.label,"onUpdate:modelValue":X=>X&&f($,w,X)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${$.modelId}-desc-${w}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":X=>m($,w,X)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:X=>p($,w)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:h=>u($)},null,8,["onClick"]),n.createElementVNode("label",Sx,[g[1]||(g[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:$.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:h=>y($,h.target.value)},null,40,xx)])]))),128)):n.createCommentVNode("",!0)],8,Nx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8c0c5afc"]]),Rx=["disabled"],Vx={class:"em-panel__sub-label"},Ax={class:"em-attr__row"},Tx={class:"em-attr__row"},Mx={class:"em-multilang"},Bx={class:"em-attr__pii"},Ox={class:"em-swatch__row em-attr__swatch"},Dx=["onClick"],Lx=["title","onClick"],Px=ze(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ae.useModal(),r=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(h=>h.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?"(없음)":h}const f=h=>h;function m(h,w){r.value&&a.updateOperation(r.value.modelId,h.modelId,w)}function p(h,w){m(h,{description:Object.keys(w).length?w:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function b(h,w){m(h,{personalInfoAttributeType:w==="none"?void 0:w})}function g(h){var w,X;return at((X=(w=s.value)==null?void 0:w.operationStyles)==null?void 0:X[h.modelId])}function E(h,w){r.value&&a.setOperationSwatch(r.value.modelId,h.modelId,w)}function $(h){l.openModal({component:du,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:w=>m(h,{sourceCode:w})}})}return(h,w)=>{var X;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:w[1]||(w[1]=B=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",Vx,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{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(((X=r.value.operations)==null?void 0:X.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:w[0]||(w[0]=n.withModifiers(B=>n.unref(a).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],B=>(n.openBlock(),n.createElementBlock("div",{key:B.modelId,class:"em-attr"},[n.createElementVNode("div",Ax,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${B.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":B.name,"onUpdate:modelValue":H=>m(B,{name:H})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":B.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":H=>H&&m(B,{visibility:H})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:H=>n.unref(a).removeOperation(r.value.modelId,B.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Tx,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:B.sourceCode?"본문 편집 ●":"본문 편집",onClick:H=>$(B)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Mx,[w[2]||(w[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Ll,{multiline:"",name:`op-desc-${B.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":B.description,"onUpdate:modelValue":H=>p(B,H)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Bx,[w[3]||(w[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":y(B),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":H=>H&&b(B,H)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Ox,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(B)===null}]),title:"없음",onClick:H=>E(B,null)},"∅",10,Dx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),H=>(n.openBlock(),n.createElementBlock("button",{key:H,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(B)===H}]),style:n.normalizeStyle({background:n.unref(Yn)(H)}),title:n.unref(Gn)(H),onClick:A=>E(B,H)},null,14,Lx))),128))])]))),128)):n.createCommentVNode("",!0)],8,Rx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),zx={class:"em-panel__head"},Ux={class:"em-panel__head-row"},Fx={class:"em-panel__context"},Hx={key:0,class:"em-panel__lock"},Gx=["disabled"],Yx={key:0,class:"em-panel__note"},jx={key:1,class:"em-panel__note"},Wx={key:2,class:"em-jpa"},Kx={class:"em-field"},qx={class:"em-field"},Xx={key:0,class:"em-field"},Zx={class:"em-panel__sub"},Jx={class:"em-field"},Qx={class:"em-jpa"},eC={key:0,class:"em-panel__note"},tC={class:"em-jpa"},nC={class:"em-field"},oC={key:0,class:"em-panel__note"},iC={class:"em-field"},aC={class:"em-multilang"},lC={class:"em-field"},rC=["value"],sC={class:"em-field"},cC={class:"em-swatch"},dC={class:"em-swatch__row"},uC=["title","onClick"],fC={class:"em-panel__note"},mC={class:"em-field"},pC=["value"],hC={class:"em-swatch"},yC={class:"em-swatch__row"},gC=["title","onClick"],Mf=ze(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 J=r.value;return J?a.state.logical.entities.find(q=>q.modelId===J)??null:null}),c=n.computed(()=>{const J=l.value;if((J==null?void 0:J.kind)==="association"){const v=a.state.logical.associations.find(V=>V.modelId===J.id);return!!v&&(a.isEntityLocked(v.end1.entityRef)||a.isEntityLocked(v.end2.entityRef))}const q=r.value;return!!q&&a.isEntityLocked(q)}),d=n.computed(()=>{var J;return((J=a.selectedAttr.value)==null?void 0:J.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),m=n.ref({});n.watch(f,()=>{m.value={}});function p(J){return m.value[J]??f.value}function y(J){m.value={...m.value,[J]:!p(J)}}const b=n.computed(()=>{var v;const J=s.value;if(!J)return"엔티티";const q=(v=J.table)==null?void 0:v.physicalName;return q?`${J.name} (${q})`:J.name}),g=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="association"?a.state.logical.associations.find(q=>q.modelId===J.id)??null:null}),E=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="group"?a.state.logical.groups.find(q=>q.modelId===J.id)??null:null}),$=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="note"?a.state.layout.notes.find(q=>q.modelId===J.id)??null:null}),h=n.computed(()=>{var q,v;const J=(q=E.value)==null?void 0:q.name;return(J==null?void 0:J.ko)||(J==null?void 0:J.en)||(J==null?void 0:J.ja)||(J==null?void 0:J.zh)||((v=E.value)==null?void 0:v.packageName)||"그룹"}),w=n.computed(()=>{if(s.value){const J=u.value.size;if(J>1)return`엔티티 · ${s.value.name} › 속성 · ${J}개`;if(d.value){const q=s.value.attributes.find(v=>v.modelId===d.value);return(q==null?void 0:q.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(q==null?void 0:q.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const J=q=>{var v;return((v=a.state.logical.entities.find(V=>V.modelId===q))==null?void 0:v.name)??q};return`관계 · ${J(g.value.end1.entityRef)} — ${J(g.value.end2.entityRef)}`}return E.value?`그룹 · ${h.value}`:$.value?"노트":"선택된 항목 없음"}),X=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],B=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],H=["LIST","SET"],A=["inherit","LAZY","EAGER"],S=J=>J;function L(J){return J==="inherit"?"기본(따름)":J}const ee=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function M(J,q){g.value&&a.updateAssociationEnd(g.value.modelId,J,q)}function oe(J){g.value&&!ee.value&&a.setAssociationIdentifying(g.value.modelId,J)}function _(J){var q,v,V;return!!((V=(v=(q=g.value)==null?void 0:q[J].jpa)==null?void 0:v.cascadeTypes)!=null&&V.includes("ALL"))}function Y(J,q,v){var D,K;const V=(D=g.value)==null?void 0:D[J];if(q==="ALL"&&v){M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:["ALL"]}});return}const j=new Set(((K=V==null?void 0:V.jpa)==null?void 0:K.cascadeTypes)??[]);v?j.add(q):j.delete(q),M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:[...j]}})}function T(J,q){var V;const v=(V=g.value)==null?void 0:V[J];M(J,{jpa:{...v==null?void 0:v.jpa,...q}})}function W(J){var q,v;return((v=(q=g.value)==null?void 0:q[J].jpa)==null?void 0:v.fetchType)??"inherit"}function Q(J,q){T(J,{fetchType:q==="inherit"?void 0:q})}function te(J){var v;const q=(v=g.value)==null?void 0:v[J==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const C=n.computed(()=>{const J=g.value;if(!J)return null;for(const q of a.state.logical.entities){const v=q.attributes.find(D=>{var K;return((K=D.embedded)==null?void 0:K.associationRef)===J.modelId&&D.attrType==="EMBED_OWN"});if(!v)continue;const V=J.end2.entityRef===v.embedded.embeddableRef?"end2":"end1",j=J[V].jpa;return{which:V,isCollection:J[V].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(j==null?void 0:j.collectionType)??"LIST",collectionTable:(j==null?void 0:j.collectionTable)??"",orderColumn:(j==null?void 0:j.orderColumn)??""}}return null});function Z(J){g.value&&a.setEmbedCollectionMode(g.value.modelId,J?"COLLECTION":"SINGLE")}function le(J){const q=C.value;q&&T(q.which,J==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(J){const q=C.value;q&&T(q.which,{collectionTable:J.trim()||void 0})}function be(J){const q=C.value;q&&T(q.which,{orderColumn:J.trim()||void 0})}function de(J){E.value&&a.updateGroup(E.value.modelId,J)}function me(J,q){var v;de({name:{...(v=E.value)==null?void 0:v.name,[J]:q}})}const ye=n.computed(()=>{var J;return E.value?at((J=a.state.layout.groupLayouts.find(q=>q.groupRef===E.value.modelId))==null?void 0:J.style):null});function ve(J){E.value&&a.setGroupSwatch(E.value.modelId,J)}function Ce(J){$.value&&a.setNoteMemo($.value.modelId,J)}const Se=n.computed(()=>{var J;return at((J=$.value)==null?void 0:J.style)});function ge(J){$.value&&a.setNoteSwatch($.value.modelId,J)}return(J,q)=>(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:q[0]||(q[0]=(...v)=>e.startResize&&e.startResize(...v))},null,34),n.createElementVNode("header",zx,[n.createElementVNode("div",Ux,[q[13]||(q[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:q[1]||(q[1]=v=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",Fx,n.toDisplayString(w.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",Hx,[n.createVNode(Ve,{name:"lock",size:13}),q[14]||(q[14]=n.createElementVNode("span",null,"편집 잠김 — 이동·수정·삭제 차단",-1)),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:q[2]||(q[2]=v=>n.unref(a).setEntityLocked(r.value,!1))},"잠금 해제")):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(ru,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:b.value,onToggle:q[3]||(q[3]=v=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(vx,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Cx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:q[4]||(q[4]=v=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(Px,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:q[5]||(q[5]=v=>y("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:ee.value||!!C.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),ee.value?(n.openBlock(),n.createElementBlock("p",Yx,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):C.value?(n.openBlock(),n.createElementBlock("p",jx,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),C.value?(n.openBlock(),n.createElementBlock("fieldset",Wx,[q[18]||(q[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":C.value.isCollection,"onUpdate:modelValue":Z},null,8,["model-value"]),C.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",Kx,[q[15]||(q[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":C.value.collectionType,items:H,"value-provider":S,"label-provider":S,"onUpdate:modelValue":q[6]||(q[6]=v=>v&&le(v))},null,8,["model-value"])]),n.createElementVNode("label",qx,[q[16]||(q[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":C.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),C.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",Xx,[q[17]||(q[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":C.value.orderColumn,"onUpdate:modelValue":be},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),q[19]||(q[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],v=>{var V,j,D,K;return n.createElementVNode("div",{key:v,class:"em-end"},[n.createElementVNode("h4",Zx,n.toDisplayString(v)+" → "+n.toDisplayString(g.value[v].entityRef),1),n.createElementVNode("label",Jx,[q[20]||(q[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":g.value[v].multiplicity,items:X,"value-provider":S,"label-provider":S,disabled:((V=C.value)==null?void 0:V.which)===v,"onUpdate:modelValue":he=>M(v,{multiplicity:he})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-navigable`,class:"em-check",label:"navigable","model-value":g.value[v].navigable,"onUpdate:modelValue":he=>M(v,{navigable:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-composition`,class:"em-check",label:"composition","model-value":g.value[v].composition,"onUpdate:modelValue":he=>M(v,{composition:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",Qx,[q[21]||(q[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(B,he=>{var we,$e;return n.createVNode(n.unref(ae.BSCheckbox),{key:he,name:`${v}-cascade-${he}`,class:"em-check",label:he,"model-value":!!(($e=(we=g.value[v].jpa)==null?void 0:we.cascadeTypes)!=null&&$e.includes(he)),disabled:he!=="ALL"&&_(v),"onUpdate:modelValue":ke=>Y(v,he,ke)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),_(v)?(n.openBlock(),n.createElementBlock("p",eC,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",tC,[q[24]||(q[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",nC,[q[22]||(q[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":W(v),items:A,"value-provider":S,"label-provider":L,"onUpdate:modelValue":he=>he&&Q(v,he)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((j=g.value[v].jpa)!=null&&j.orphanRemoval),disabled:te(v),"onUpdate:modelValue":he=>T(v,{orphanRemoval:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),te(v)&&((D=g.value[v].jpa)!=null&&D.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",oC,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",iC,[q[23]||(q[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${v}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((K=g.value[v].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":he=>T(v,{orderBy:he.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),E.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",aC,[q[25]||(q[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,v=>{var V;return n.openBlock(),n.createElementBlock("label",{key:v,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(v),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${v}`,width:"100%","model-value":((V=E.value.name)==null?void 0:V[v])??"","onUpdate:modelValue":j=>me(v,j)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",lC,[q[26]||(q[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:E.value.description??"",rows:"3",onChange:q[7]||(q[7]=v=>de({description:v.target.value}))},null,40,rC)]),n.createElementVNode("label",sC,[q[27]||(q[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":E.value.packageName??"","onUpdate:modelValue":q[8]||(q[8]=v=>de({packageName:v}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":E.value.excludeDDLGeneration,"onUpdate:modelValue":q[9]||(q[9]=v=>de({excludeDDLGeneration:v}))},null,8,["model-value"]),n.createElementVNode("fieldset",cC,[q[28]||(q[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",dC,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:q[10]||(q[10]=v=>ve(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===v}]),style:n.normalizeStyle({background:n.unref(Yn)(v)}),title:n.unref(Gn)(v),onClick:V=>ve(v)},null,14,uC))),128))])]),n.createElementVNode("p",fC,"멤버 엔티티 "+n.toDisplayString(E.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),$.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",mC,[q[29]||(q[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:$.value.memo,rows:"6",onChange:q[11]||(q[11]=v=>Ce(v.target.value))},null,40,pC)]),n.createElementVNode("fieldset",hC,[q[30]||(q[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",yC,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:"없음",onClick:q[12]||(q[12]=v=>ge(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Se.value===v}]),style:n.normalizeStyle({background:n.unref(Yn)(v)}),title:n.unref(Gn)(v),onClick:V=>ge(v)},null,14,gC))),128))])])],64)):n.createCommentVNode("",!0)],8,Gx)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),bC={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function _C(e){const t=e.split("-")[1];return t?bC[t]??t:e}function EC(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const kC=["title"],wC=["title","onClick"],vC={key:0,class:"em-validation__body"},NC={class:"em-validation__opt"},$C={key:0,class:"em-validation__empty"},IC={key:1,class:"em-validation__empty"},SC={key:2,class:"em-validation__list"},xC=["onClick"],CC={class:"em-validation__item-msg"},RC={key:0,class:"em-validation__item-entity"},VC=["title"],AC=ze(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 b=new Map;for(const g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function l(b){const g=EC(b);if(!g)return null;const E=a.value.get(g);return E===void 0?null:E.trim()===""?"(이름 없음)":E}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 b={error:0,warning:0,info:0};for(const g of i.value)b[g.severity]++;return b}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,g)=>r[b.severity].order-r[g.severity].order)),u=n.computed(()=>d.value.map(b=>({issue:b,entityName:l(b),category:_C(b.ruleId)}))),f=n.ref(!1);function m(b){c.value[b]=!c.value[b]}function p(b){if(!f.value){f.value=!0;return}m(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,g)=>(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:g[1]||(g[1]=E=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),g[3]||(g[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,kC),n.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],E=>n.createElementVNode("button",{key:E,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:f.value?`${r[E].label} ${c.value[E]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:$=>p(E)},[n.createVNode(Ve,{name:r[E].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[E]),1)],10,wC)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",vC,[n.createElementVNode("label",NC,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=E=>n.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",$C,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",IC," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",SC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:E,entityName:$,category:h},w)=>(n.openBlock(),n.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${w}`,class:n.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:X=>y(E)},[n.createVNode(Ve,{name:r[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",CC,[$?(n.openBlock(),n.createElementBlock("span",RC,n.toDisplayString($),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(E.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},n.toDisplayString(h),9,VC)],10,xC))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),TC={class:"em-history"},MC={class:"em-history__head"},BC={class:"em-history__title"},OC={class:"em-history__head-actions"},DC=["disabled"],LC={class:"em-history__filters"},PC={class:"em-history__filter"},zC={class:"em-history__body"},UC={key:0,class:"em-history__empty"},FC={key:1,class:"em-history__empty is-error"},HC={key:2,class:"em-history__empty"},GC={key:3,class:"em-history__list"},YC=["onClick"],jC={class:"em-history__summary"},WC={class:"em-history__seq"},KC={class:"em-history__gmeta"},qC={class:"em-history__who"},XC={key:0,class:"em-history__time"},ZC={key:1,class:"em-history__restored-from"},JC={key:0,class:"em-history__detail"},QC={class:"em-history__action-head"},eR={class:"em-history__action-name"},tR={key:0,class:"em-history__fields"},nR={class:"em-history__fname"},oR={key:0,class:"em-history__old"},iR={class:"em-history__val"},aR={key:1,class:"em-history__restore"},lR=["disabled","onClick"],rR=["disabled"],sR=["onClick"],cR=ze(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(C){s.value=C instanceof Error?C.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,C=>{C&&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 m=n.computed(()=>new Map(a.state.logical.entities.map(C=>[C.modelId,C]))),p=n.computed(()=>new Map(a.state.logical.associations.map(C=>[C.modelId,C]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(C=>{var Z;return[C.modelId,C.packageName||((Z=C.name)==null?void 0:Z.ko)||C.modelId]})));function b(C){var be,de,me,ye,ve,Ce,Se;const Z=p.value.get(C);if(!Z)return"연관";if((be=Z.description)!=null&&be.trim())return Z.description.trim();const le=(ye=(me=m.value.get((de=Z.end1)==null?void 0:de.entityRef))==null?void 0:me.name)==null?void 0:ye.trim(),pe=(Se=(Ce=m.value.get((ve=Z.end2)==null?void 0:ve.entityRef))==null?void 0:Ce.name)==null?void 0:Se.trim();return le&&pe?`${le}→${pe}`:"연관"}function g(C){var Z,le,pe,be;if(C.kind==="entity")return((le=(Z=m.value.get(C.ref))==null?void 0:Z.name)==null?void 0:le.trim())||"(이름 없음)";if(C.kind==="attribute"||C.kind==="operation"||C.kind==="index"){const de=C.entityRef?m.value.get(C.entityRef):void 0,ye=((C.kind==="attribute"?de==null?void 0:de.attributes:C.kind==="operation"?de==null?void 0:de.operations:de==null?void 0:de.indexes)??[]).find(Ce=>Ce.modelId===C.ref),ve=(pe=de==null?void 0:de.name)==null?void 0:pe.trim();return`${ve?ve+".":""}${((be=ye==null?void 0:ye.name)==null?void 0:be.trim())||C.ref}`}return C.kind==="association"?b(C.ref):C.kind==="associationEnd"?`${b(C.ref)}(${C.end})`:C.kind==="group"?`그룹 ${y.value.get(C.ref)??C.ref}`:C.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},$={add:"추가",update:"수정",remove:"삭제"},h=n.ref("all"),w=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],X=n.computed({get:()=>h.value,set:C=>{C&&(h.value=C)}}),B=n.computed(()=>Zr(l.value)),H=n.computed(()=>B.value.length?B.value[0].seq:null),A=n.computed(()=>h.value==="all"?B.value:B.value.filter(C=>(C.kind??"edit")===h.value));function S(C){return C===void 0?"—":C===null?"(비움)":typeof C=="object"?JSON.stringify(C):String(C)}function L(C){const Z=g(C.subject);if(C.verb==="add")return`${Z} 추가`;if(C.verb==="remove")return`${Z} 삭제`;if(C.fields.length===1){const le=C.fields[0];return`${Z}.${le.field} ${le.oldValue!==void 0?S(le.oldValue)+"→":""}${S(le.value)}`}return`${Z} ${C.fields.length}개 변경`}function ee(C){return C.actions.length===0?"변경 없음":C.actions.length===1?L(C.actions[0]):`${L(C.actions[0])} 외 ${C.actions.length-1}건`}const M=n.ref(new Set);function oe(C){const Z=new Set(M.value);Z.has(C)?Z.delete(C):Z.add(C),M.value=Z}function _(C){if(C==null)return"";const Z=new Date(C);return isNaN(Z.getTime())?String(C):Z.toLocaleString()}function Y(C){const Z=C.author,le=C.origin;return Z&&le?`${Z}(${le})`:Z||(le?`(${le})`:"—")}const T=n.ref(null),W=n.ref(!1);function Q(C){T.value=C}async function te(C){W.value=!0;try{const Z=await a.restoreToSeq(C);Z.ok||(s.value=`복원 실패: ${Z.reason??"알 수 없음"}`)}finally{W.value=!1,T.value=null}}return(C,Z)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",TC,[n.createElementVNode("header",MC,[n.createElementVNode("div",BC,[n.createVNode(Ve,{name:"undo",size:15}),Z[4]||(Z[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",OC,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:Z[0]||(Z[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,DC),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:Z[1]||(Z[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",LC,[n.createElementVNode("label",PC,[Z[5]||(Z[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:X.value,"onUpdate:modelValue":Z[2]||(Z[2]=le=>X.value=le),items:w,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",zC,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",UC,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",FC,n.toDisplayString(s.value),1)):A.value.length===0?(n.openBlock(),n.createElementBlock("p",HC,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",GC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,le=>(n.openBlock(),n.createElementBlock("li",{key:le.seq,class:n.normalizeClass(["em-history__group",[`is-${le.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:pe=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":M.value.has(le.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${le.kind??"edit"}`])},n.toDisplayString(le.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",jC,n.toDisplayString(ee(le)),1),n.createElementVNode("span",WC,"#"+n.toDisplayString(le.seq),1)],8,YC),n.createElementVNode("div",KC,[n.createElementVNode("span",qC,n.toDisplayString(Y(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",XC,n.toDisplayString(_(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",ZC,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),M.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",JC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(pe,be)=>(n.openBlock(),n.createElementBlock("div",{key:be,class:"em-history__action"},[n.createElementVNode("div",QC,[n.createVNode(Ve,{name:E[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",eR,n.toDisplayString(g(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString($[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",tR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.fields,(de,me)=>(n.openBlock(),n.createElementBlock("li",{key:me,class:"em-history__field"},[n.createElementVNode("span",nR,n.toDisplayString(de.field),1),de.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",oR,n.toDisplayString(S(de.oldValue)),1)):n.createCommentVNode("",!0),de.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",iR,n.toDisplayString(S(de.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==H.value?(n.openBlock(),n.createElementBlock("div",aR,[T.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Z[6]||(Z[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:pe=>te(le.seq)},"복원",8,lR),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:Z[3]||(Z[3]=pe=>T.value=null)},"취소",8,rR)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>Q(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),Z[7]||(Z[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,sR))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function dR(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 Bf(e){const t=n.ref(dR(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 uR={class:"em-modeler"},fR={class:"em-modeler__body"},mR={class:"em-drawer__inner"},pR={class:"em-drawer__head"},hR={class:"em-drawer__actions"},yR=["title"],gR=ze(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}=Bf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Bf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(m,p)=>{var y,b,g;return n.openBlock(),n.createElementBlock("div",uR,[n.createVNode(Tf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=E=>{var $;return($=u.value)==null?void 0:$.exportSvg()}),onExportPng:p[1]||(p[1]=E=>{var $;return($=u.value)==null?void 0:$.exportPng()}),onToggleHistory:p[2]||(p[2]=E=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",fR,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",mR,[n.createElementVNode("header",pR,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",hR,[(y=f.value)!=null&&y.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(b=f.value)!=null&&b.allExpanded?"모두 접기":"모두 펼치기",onClick:p[3]||(p[3]=E=>{var $;return($=f.value)==null?void 0:$.toggleAll()})},[n.createVNode(Ve,{name:(g=f.value)!=null&&g.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,yR)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:p[4]||(p[4]=E=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Af,{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:p[5]||(p[5]=(...E)=>n.unref(r)&&n.unref(r)(...E))},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:p[6]||(p[6]=E=>t.value=!0)},[n.createVNode(Ve,{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(Vf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Mf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:p[7]||(p[7]=E=>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:p[8]||(p[8]=E=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(cR,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=E=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(AC,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=Vp,Ee.AssociationEdge=Au,Ee.CUSTOM_TYPE_VALUE=Et,Ee.CommandStack=Ka,Ee.DEFAULT_JAVA_TYPE=Ba,Ee.DiagramCanvas=Vf,Ee.DiagramExplorer=Af,Ee.EDITOR=gn,Ee.EditModeToggle=HS,Ee.EditorToolbar=Tf,Ee.EntityModeler=gR,Ee.EntityNode=yu,Ee.GROUP_CODE_ENUM_VALUE=Nn,Ee.GroupNode=gu,Ee.INHERITED_REF_PREFIX=Zo,Ee.JAVA_TYPES=Qo,Ee.NoteNode=bu,Ee.OpSyncAdapter=Us,Ee.PHYSICAL_NAME_MAX_LENGTH=La,Ee.PropertyPanel=Mf,Ee.RevCache=zs,Ee.SELECTABLE_JAVA_TYPES=Rr,Ee.SYMBOLIC_OP_KINDS=Fs,Ee.SYMBOLIC_OP_SCHEMA=Js,Ee.anchoredEdgePoint=xa,Ee.buildAgentBatch=Ap,Ee.buildDiagramSvg=fr,Ee.buildOrthogonalPath=Na,Ee.buildSelfLoopPath=gr,Ee.buildStraightPath=Ia,Ee.collectSharedColumns=In,Ee.commands=Qm,Ee.computeAutoLayout=br,Ee.createEditorController=Tk,Ee.defaultMermaidDialect=Hf,Ee.displayLabel=Jo,Ee.emptyState=fu,Ee.entityModelToMermaid=Va,Ee.entityModelToText=vr,Ee.estimateEntityHeight=Er,Ee.exportDiagramPng=Cf,Ee.exportDiagramSvg=xf,Ee.fromPersisted=jp,Ee.indexColumnsByModelId=Qt,Ee.isInheritedColumnRef=eo,Ee.javaTypeLabel=$n,Ee.makeInheritedColumnRef=kr,Ee.mergeDiagram=Yr,Ee.migrateLegacyMoney=Tm,Ee.newId=De,Ee.orthogonalMidpoints=$a,Ee.packEntityBoxes=Ff,Ee.parseInheritedColumnRef=Ra,Ee.physicalNameWarning=ti,Ee.projectActionLog=Zr,Ee.projectEntityAudit=qr,Ee.projectFieldAudit=Ft,Ee.projectInheritedColumns=to,Ee.rectExitPoint=Sa,Ee.renderDiagramSvg=xr,Ee.resolveDiagram=hr,Ee.resolveSharedColumn=Sn,Ee.resolveSymbolicOps=kp,Ee.restoreDeepEqual=Rn,Ee.scaffoldEntityJava=fm,Ee.segmentMidpoints=Ca,Ee.sharedColumnScopeEntities=ei,Ee.sideDir=Qn,Ee.synthesizeRestoreOps=Gm,Ee.toPersisted=lh,Ee.toPersistedV2=rh,Ee.validateModel=Tr,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));
|
|
51
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(Q=>{if(b.value){const te=qt(b.value),C=pe=>{if(pe.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const be=pe.sourceEvent.ctrlKey&&Vo()?10:1,de=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*e.zoomStep,me=c.value.zoom*2**(de*be);m.value.scaleTo(p.value,me)},Z=pe=>{if(pe.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const be=S.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),de={x:c.value.x-pe.sourceEvent.movementX*be,y:c.value.y-pe.sourceEvent.movementY*be},me=[[0,0],[u.value.width,u.value.height]],ye=dr.translate(de.x,de.y).scale(c.value.zoom),ve=m.value.constrain()(ye,me,d.value);m.value.transform(p.value,ve)},le=AI().wheelDelta(pe=>Il(pe)*(e.zoomStep/10)).on("zoom",e.pannable?Z:()=>{}).on("zoom.wheel",e.zoomable?C:()=>{});te.call(le),Q(()=>{te.on("zoom",null)})}},{flush:"post"});function M(Q){const[te,C]=Xt(Q);t("click",{event:Q,position:{x:te,y:C}})}function oe(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeClick(C),t("nodeClick",C)}function _(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeDoubleClick(C),t("nodeDblclick",C)}function Y(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseEnter(C),t("nodeMouseenter",C)}function T(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseMove(C),t("nodeMousemove",C)}function W(Q,te){const C={event:Q,node:te,connectedEdges:fn([te],s.value)};f.miniMapNodeMouseLeave(C),t("nodeMouseleave",C)}return(Q,te)=>(n.openBlock(),n.createBlock(n.unref(lu),{position:Q.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:Q.pannable,zoomable:Q.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:b,width:g.value,height:E.value,viewBox:[L.value.x,L.value.y,L.value.width,L.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:M},[Q.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(Q.ariaLabel),9,DI)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),C=>(n.openBlock(),n.createBlock(BI,{id:C.id,key:C.id,f:"",position:C.computedPosition,dimensions:C.dimensions,selected:C.selected,dragging:C.dragging,style:n.normalizeStyle(C.style),class:n.normalizeClass(q.value(C)),color:h.value(C),"border-radius":Q.nodeBorderRadius,"stroke-color":k.value(C),"stroke-width":Q.nodeStrokeWidth,"shape-rendering":n.unref(N),type:C.type,hidden:C.hidden,onClick:Z=>oe(Z,C),onDblclick:Z=>_(Z,C),onMouseenter:Z=>Y(Z,C),onMousemove:Z=>T(Z,C),onMouseleave:Z=>W(Z,C)},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:ee.value,fill:Q.maskColor,stroke:Q.maskStrokeColor,"stroke-width":Q.maskStrokeWidth,"fill-rule":"evenodd"},null,8,LI)],8,OI))]),_:1},8,["position","class"]))}}),UI=["d"],FI=["cx","cy","onDblclick"],HI=["x","y","onPointerdown","onDblclick"],GI=ze(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Pe(),i=n.inject(Yl),a=n.inject(gn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(qn,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((A,S)=>S===d.value?u.value:A)),{source:p,target:m,sourceSide:y,targetSide:b}=Tu({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),g=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Sa(p.value,y.value,f.value,m.value,b.value):Ca(p.value,f.value,m.value)),E=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?xa(p.value,y.value,f.value,m.value,b.value):Aa(p.value,f.value,m.value).map((A,S)=>({point:A,segIndex:S})):[]),N=n.computed(()=>l.value?f.value:[]);function h(A,S){d.value=A,u.value={...c.value[A]},S.target.setPointerCapture(S.pointerId),S.stopPropagation()}function k(A){if(d.value<0)return;const S=o({x:A.clientX,y:A.clientY});u.value={x:S.x,y:S.y}}function q(A){var S,L;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(L=(S=A.target).releasePointerCapture)==null||L.call(S,A.pointerId)}function B(A,S){S.stopPropagation(),i==null||i.removePoint(t.id,A)}function H(A,S){if(!i)return;const L=o({x:S.clientX,y:S.clientY});i.insertPoint(t.id,A,{x:L.x,y:L.y})}return(A,S)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,UI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(E.value,(L,ee)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${ee}`,cx:L.point.x,cy:L.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(M=>H(L.segIndex,M),["stop"])},null,42,FI))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(L,ee)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${ee}`,x:L.x-5,y:L.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>h(ee,M),onPointermove:k,onPointerup:q,onDblclick:M=>B(ee,M)},null,42,HI))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),YI=["data-theme"],jI={key:0,class:"em-ctx__sep",role:"separator"},WI={key:1,class:"em-ctx__swatches"},KI={class:"em-ctx__swatches-label"},qI={class:"em-ctx__chips"},XI=["onClick"],ZI=["title","onClick"],JI=["disabled","onClick"],QI={class:"em-ctx__icon"},eS={class:"em-ctx__caption"},tS=ze(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,y){var E;i.value=y,a.value=(E=m.target)!=null&&E.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 b=l.value;if(!b)return;const g=b.getBoundingClientRect();r.x+g.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-g.width)),r.y+g.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-g.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,y){m.onPick(y),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,y)=>(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:y[0]||(y[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(b,g)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:g},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",jI)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",WI,[n.createElementVNode("span",KI,n.toDisplayString(b.caption),1),n.createElementVNode("div",qI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:"없음",onClick:E=>p(b,null)},null,10,XI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),E=>(n.openBlock(),n.createElementBlock("button",{key:E,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===E}]),style:n.normalizeStyle({background:n.unref(jn)(E)}),title:n.unref(Yn)(E),onClick:N=>p(b,E)},null,14,ZI))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:E=>f(b)},[n.createElementVNode("span",QI,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",eS,n.toDisplayString(b.caption),1)],10,JI))],64))),128))],36)],8,YI)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),fr=[".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 Qn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function nS(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function oS(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 y=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const b=t(y.left,y.top+y.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const y=d.trim();if(y){const b=t(f,(u+p)/2);c.push({...i,x:b.x,y:b.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(l,y),a.setEnd(l,y+1);const b=a.getBoundingClientRect();u===null||Math.abs(b.top-u)>1?(m(),u=b.top,f=b.left,p=b.bottom,d=s[y]):(d+=s[y],p=Math.max(p,b.bottom))}return m(),c}function Na(e,t){const o=[];for(const i of e.querySelectorAll("*"))nS(i)&&(i.closest(fr)||Qn(i)&&o.push(...oS(i,t)));return o}function Ho(e){return Math.round(e*100)/100}function iS(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(fr)||!Qn(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="${Ho(l.x)}" y="${Ho(l.y)}" width="${Ho(r.x-l.x)}" height="${Ho(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 aS(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Qn(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=>Ho(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 xf(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(fr)||!Qn(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 Go(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 mr(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 lS(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,y)=>e.screenToFlowCoordinate({x:m,y}),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 y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!y||!Qn(y))continue;const b=y.firstElementChild;if(b)if(m.type==="group"){const g=Go(b,o);mr(s,g),i.push({...g,texts:[]});const E=b.querySelector(".em-group__label");E&&i.push({...Go(E,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Na(b,o)})}else if(m.type==="note"){const g={...Go(b,o),texts:Na(b,o),lines:xf(b,b,o)};mr(s,g),l.push(g)}else{const g=Go(b,o);mr(s,g);const E=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const N=b.querySelector(".em-entity__header");if(N){const h=Go(N,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Na(b,o),lines:xf(b,b,o),icons:iS(b,o)}),a.push({...g,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const y=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Qn(y))continue;const b=y.getAttribute("d");if(!b)continue;const g=getComputedStyle(y),E=g.strokeDasharray,N=aS(m);r.push({d:b,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:Na(m,o),markers:N.length?N: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 pr(e){return Rr(lS(e))}function Cf(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function Rf(e,t="diagram.svg"){const o=pr(e);Cf(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function rS(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function Vf(e,t="diagram.png",o=2){const i=pr(e),{w:a,h:l}=rS(i),r=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=l,await new Promise((f,p)=>{s.onload=()=>f(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=r});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(l*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,l);const u=await new Promise(f=>c.toBlob(f,"image/png"));if(!u)throw new Error("PNG 변환 실패");Cf(u,t)}finally{URL.revokeObjectURL(r)}}const sS={class:"em-shortcuts"},cS={class:"em-shortcuts__title"},dS={class:"em-shortcuts__keys"},uS={class:"em-shortcuts__kbd"},fS={key:0,class:"em-shortcuts__plus"},mS={class:"em-shortcuts__desc"},pS={class:"em-shortcuts__actions"},Af=ze(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ae.useModalHandle(),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",a=[{title:"편집",items:[{keys:[i,"Z"],desc:"실행 취소"},{keys:[i,"Shift","Z"],desc:"다시 실행"},{keys:[i,"C"],desc:"선택 복사"},{keys:[i,"V"],desc:"붙여넣기"},{keys:["Delete"],desc:"선택 항목 삭제 (Backspace 동일)"}]},{title:"이동 · 정렬",items:[{keys:["←","↑","→","↓"],desc:"선택 노드 1px 이동"},{keys:["Shift","방향키"],desc:"선택 노드 10px 이동"},{keys:["↑","↓"],desc:"속성 선택 시 포커스 이동"},{keys:["Alt","↑","↓"],desc:"속성 순서 위/아래로"}]},{title:"기타",items:[{keys:["우클릭"],desc:"컨텍스트 메뉴 (엔티티·노트 추가 등)"},{keys:["Enter"],desc:"인라인 편집 확정"},{keys:["Esc"],desc:"편집·메뉴 닫기"},{keys:["?"],desc:"이 도움말 열기"}]}];return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",sS,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",cS,n.toDisplayString(s.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.items,c=>(n.openBlock(),n.createElementBlock("div",{key:c.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",dS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.keys,(d,u)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d+u},[n.createElementVNode("kbd",uS,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",fS,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",mS,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",pS,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function hS(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const yS={key:0,class:"em-canvas__empty","aria-hidden":"true"},gS={key:1,class:"em-canvas__empty-title"},bS={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},_S={class:"em-conflict-banner__body"},ES={class:"em-conflict-banner__title"},kS={class:"em-conflict-banner__detail"},wS={key:0,class:"em-toast",role:"status","aria-live":"polite"},hr="nc:",Tf=ze(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,$=>{$&&(l.value=$.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>hS(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f($){u.x=$.clientX,u.y=$.clientY}const p=n.ref(null);n.provide(ia,p);const m=n.ref(null);n.provide(gu,m);const y=n.ref(null),b=n.computed(()=>{const $=y.value,x=new Set;if(!$)return x;if($.kind==="entity")x.add($.id);else if($.kind==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===$.id);for(const R of(ie==null?void 0:ie.group.memberEntityRefs)??[])x.add(R)}return x}),g=n.computed(()=>{const $=y.value,x=new Set(b.value),ie=new Set,R=new Set;if(!$)return{related:x,edges:ie,notes:R};if($.kind==="note"){R.add($.id);for(const P of i.resolved.value.noteConnections)P.noteRef===$.id&&x.add(P.targetRef);return{related:x,edges:ie,notes:R}}const G=b.value;if(!G.size)return{related:x,edges:ie,notes:R};for(const P of i.resolved.value.associations){const{end1:se,end2:Ne}=P.association;(G.has(se.entityRef)||G.has(Ne.entityRef))&&(ie.add(P.association.modelId),x.add(se.entityRef),x.add(Ne.entityRef))}for(const P of i.resolved.value.noteConnections)x.has(P.targetRef)&&R.add(P.noteRef);return{related:x,edges:ie,notes:R}});n.provide(qn,{source:y,active:n.computed(()=>y.value!==null),primaryEntityIds:b,relatedEntityIds:n.computed(()=>g.value.related),relatedEdgeIds:n.computed(()=>g.value.edges),relatedNoteIds:n.computed(()=>g.value.notes),hoverGroupId:n.computed(()=>{var $;return(($=y.value)==null?void 0:$.kind)==="group"?y.value.id:null}),setEntityHover:$=>{m.value||d.value||(y.value=$?{kind:"entity",id:$}:null)},setGroupHover:$=>{m.value||d.value||(y.value=$?{kind:"group",id:$}:null)},setNoteHover:$=>{m.value||d.value||(y.value=$?{kind:"note",id:$}:null)}}),n.provide(gn,i);function E($,x){return`${hr}${$}:${x}`}function N($){if(!$.startsWith(hr))return null;const[x,ie]=$.slice(hr.length).split(":");return x&&ie?{noteRef:x,targetRef:ie}:null}n.provide(Yl,{points:$=>{var ie,R;const x=N($);return x?((ie=i.resolved.value.noteConnections.find(G=>G.noteRef===x.noteRef&&G.targetRef===x.targetRef))==null?void 0:ie.waypoints)??[]:((R=i.resolved.value.associations.find(G=>G.association.modelId===$))==null?void 0:R.waypoints)??[]},movePoint:($,x,ie)=>{const R=N($);R?i.moveNoteConnectionWaypoint(R.noteRef,R.targetRef,x,ie):i.moveWaypoint($,x,ie)},insertPoint:($,x,ie)=>{const R=N($);R?i.addNoteConnectionWaypoint(R.noteRef,R.targetRef,x,ie):i.addWaypoint($,x,ie)},removePoint:($,x)=>{const ie=N($);ie?i.removeNoteConnectionWaypoint(ie.noteRef,ie.targetRef,x):i.removeWaypoint($,x)}});const h=Pe(),{nodes:k,edges:q,findNode:B,findEdge:H,addNodes:A,addEdges:S,removeNodes:L,removeEdges:ee,fitView:M,setCenter:oe,getViewport:_,screenToFlowCoordinate:Y,getSelectedNodes:T,updateNodeInternals:W}=h,Q=n.ref(!1);async function te($){Q.value=!0,await n.nextTick(),await new Promise(x=>requestAnimationFrame(()=>x(null)));try{return await $()}finally{Q.value=!1}}function C(){return te(()=>Rf(h))}function Z(){return te(()=>Vf(h))}t({exportSvg:C,exportPng:Z});const le=n.computed(()=>i.resolved.value.entities.length===0);function pe(){const $=_(),{width:x,height:ie}=h.dimensions.value;return{x:(x/2-$.x)/$.zoom,y:(ie/2-$.y)/$.zoom}}function be(){const $=pe();i.addEntity("NewEntity",{x:$.x,y:$.y})}function de(){const $=pe();i.addNote("메모",{x:$.x,y:$.y})}function me($){for(const x of i.resolved.value.groups){const{location:ie,size:R}=x.geo;if($.x>=ie.x&&$.x<=ie.x+R.width&&$.y>=ie.y&&$.y<=ie.y+R.height)return x.group.modelId}return null}function ye(){const $=i.resolved.value,x=new Map($.groups.map(se=>[se.group.modelId,se.geo])),ie=new Set($.groups.map(se=>se.group.modelId)),R=new Set([...ie,...$.entities.map(se=>se.entity.modelId),...$.notes.map(se=>se.note.modelId)]);for(const se of[...k.value])R.has(se.id)||L([se.id]);for(const se of $.groups){const Ne=se.group.modelId,fe={width:`${se.geo.size.width}px`,height:`${se.geo.size.height}px`},Me={group:se.group,style:se.style,locked:se.locked},Le=se.locked?!1:void 0,Fe=B(Ne);Fe?(Fe.position={...se.geo.location},Fe.data=Me,Fe.style=fe,Fe.draggable=Le):A([{id:Ne,type:"group",position:{...se.geo.location},draggable:Le,style:fe,data:Me}])}for(const se of $.entities){const Ne=se.entity.modelId,fe=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Me={entity:se.entity,displayMode:i.displayMode.value,collapsed:se.collapsed,locked:se.locked,groupRef:fe,size:se.geo.size,style:se.style,attributeStyles:se.attributeStyles,operationStyles:se.operationStyles},Le=se.locked?!1:void 0,Fe=fe?x.get(fe):void 0,et=Fe?{x:se.geo.location.x-Fe.location.x,y:se.geo.location.y-Fe.location.y}:{...se.geo.location},je=B(Ne);je?(je.position=et,je.data=Me,je.parentNode=fe,je.draggable=Le):A([{id:Ne,type:"entity",position:et,parentNode:fe,draggable:Le,data:Me}])}for(const se of $.notes){const Ne=se.note,fe=Ne.modelId,Me=se.groupRef&&ie.has(se.groupRef)?se.groupRef:void 0,Le={note:Ne,groupRef:Me},Fe={width:`${Ne.geo.size.width}px`,height:`${Ne.geo.size.height}px`},et=Me?x.get(Me):void 0,je=et?{x:Ne.geo.location.x-et.location.x,y:Ne.geo.location.y-et.location.y}:{...Ne.geo.location},Ke=B(fe);Ke?(Ke.position=je,Ke.data=Le,Ke.style=Fe,Ke.parentNode=Me):A([{id:fe,type:"note",position:je,parentNode:Me,style:Fe,data:Le}])}const G=new Map($.associations.map(se=>[se.association.modelId,se])),P=new Set($.noteConnections.map(se=>E(se.noteRef,se.targetRef)));for(const se of[...q.value])!G.has(se.id)&&!P.has(se.id)&&ee([se.id]);for(const[se,Ne]of G){const fe={id:se,type:"association",source:Ne.association.end1.entityRef,target:Ne.association.end2.entityRef,sourceHandle:Ne.sourceColumnRef?`r:${Ne.sourceColumnRef}`:void 0,targetHandle:Ne.targetColumnRef?`l:${Ne.targetColumnRef}`:void 0,data:{association:Ne.association,sourceColumnRef:Ne.sourceColumnRef,targetColumnRef:Ne.targetColumnRef}},Me=H(se);Me?(Me.data=fe.data,Me.sourceHandle=fe.sourceHandle,Me.targetHandle=fe.targetHandle):S([fe])}for(const se of $.noteConnections){const Ne=E(se.noteRef,se.targetRef),fe={noteRef:se.noteRef,targetRef:se.targetRef},Me=H(Ne);Me?Me.data=fe:S([{id:Ne,type:"note-connection",source:se.noteRef,target:se.targetRef,data:fe}])}ve()}function ve(){n.nextTick(()=>requestAnimationFrame(()=>W()))}function Ce(){const $=T.value.map(ie=>ie.id);if($.length)return $;const x=i.selection.value;return x&&(x.kind==="entity"||x.kind==="note"||x.kind==="group")?[x.id]:[]}function Se($){var G;const x=$.target;if(x&&(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable))return;if($.key==="?"){a.openModal({component:Af}),$.preventDefault();return}if(!i.editable.value){($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="c"&&(i.copy(),$.preventDefault());return}if($.key==="Delete"||$.key==="Backspace"){i.deleteSelection()&&$.preventDefault();return}if($.key==="ArrowUp"||$.key==="ArrowDown"||$.key==="ArrowLeft"||$.key==="ArrowRight"){if(((G=i.selection.value)==null?void 0:G.kind)==="attribute"){if($.key==="ArrowUp"||$.key==="ArrowDown"){const fe=$.key==="ArrowDown"?1:-1;($.altKey?i.nudgeSelectedAttributes(fe):i.moveAttributeFocus(fe))&&$.preventDefault()}return}const P=$.shiftKey?10:1,se=$.key==="ArrowLeft"?-P:$.key==="ArrowRight"?P:0,Ne=$.key==="ArrowUp"?-P:$.key==="ArrowDown"?P:0;i.nudgeNodes(Ce(),se,Ne)&&$.preventDefault();return}if(!($.metaKey||$.ctrlKey))return;const R=$.key.toLowerCase();R==="c"?(i.copy(),$.preventDefault()):R==="v"?(i.paste(),$.preventDefault()):R==="z"&&($.shiftKey?i.redo():i.undo(),$.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),M(),window.addEventListener("keydown",Se),window.addEventListener("pointerup",ge),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Se),window.removeEventListener("pointerup",ge),window.removeEventListener("pointermove",f)});function ge(){p.value=null}function J(){d.value=!0,y.value=null}function X(){var R;d.value=!1;const $=(R=document.elementFromPoint(u.x,u.y))==null?void 0:R.closest(".vue-flow__node"),x=$==null?void 0:$.dataset.id;if(!x){y.value=null;return}const ie=$.classList.contains("vue-flow__node-group")?"group":$.classList.contains("vue-flow__node-note")?"note":"entity";y.value={kind:ie,id:x}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ve),n.watch(()=>i.resolved.value,$=>{const x=y.value;if(!x)return;(x.kind==="entity"?$.entities.some(R=>R.entity.modelId===x.id):x.kind==="group"?$.groups.some(R=>R.group.modelId===x.id):$.notes.some(R=>R.note.modelId===x.id))||(y.value=null)});function v($){const x=$.computedPosition??$.position,ie=$.dimensions??{width:0,height:0};return{x:x.x+ie.width/2,y:x.y+ie.height/2}}function V($){const x=$.node;if(x){if(y.value=null,x.type==="group"){const ie=i.resolved.value.groups.find(R=>R.group.modelId===x.id);m.value=ie?{groupId:x.id,dx:x.position.x-ie.geo.location.x,dy:x.position.y-ie.geo.location.y}:null,p.value=null;return}if(x.type!=="entity"&&x.type!=="note"){p.value=null;return}p.value=me(v(x))}}function j($){var R;p.value=null,m.value=null;const x=(R=$.nodes)!=null&&R.length?$.nodes:[$.node],ie=x.filter(G=>(G==null?void 0:G.type)==="group");if(ie.length){for(const G of ie){if(!G)continue;const P=i.resolved.value.entities.filter(se=>se.groupRef===G.id).map(se=>{const Ne=B(se.entity.modelId),fe=(Ne==null?void 0:Ne.computedPosition)??(Ne==null?void 0:Ne.position)??{x:0,y:0};return{id:se.entity.modelId,location:{x:fe.x,y:fe.y}}});i.dragGroup(G.id,{x:G.position.x,y:G.position.y},P)}return}for(const G of x){if(!G||G.type==="group")continue;const P=G.computedPosition??G.position,se=G.dimensions??{width:0,height:0},Ne={x:P.x+se.width/2,y:P.y+se.height/2};G.type==="note"?i.dropNote(G.id,{x:P.x,y:P.y},me(Ne)):i.dropEntity(G.id,{x:P.x,y:P.y},me(Ne))}}function D($){var fe,Me,Le,Fe,et;if(!i.editable.value||!$.source||!$.target)return;const x=((fe=B($.source))==null?void 0:fe.type)==="note",ie=((Me=B($.target))==null?void 0:Me.type)==="note";if(x||ie){if(x&&ie)return;const je=x?$.source:$.target,Ke=x?$.target:$.source;((Le=B(Ke))==null?void 0:Le.type)==="entity"&&i.addNoteConnection(je,Ke);return}const R=je=>{var Ke;return(Ke=i.state.logical.entities.find(Rt=>Rt.modelId===je))==null?void 0:Ke.stereotype},G=R($.source)==="JPA_EMBEDDABLE",P=R($.target)==="JPA_EMBEDDABLE";if(G||P){if(G&&P)return;const je=G?$.source:$.target,Ke=G?$.target:$.source;i.addEmbedAssociation(Ke,je);return}const se=(Fe=$.sourceHandle)!=null&&Fe.startsWith("r:")?$.sourceHandle.slice(2):void 0,Ne=(et=$.targetHandle)!=null&&et.startsWith("l:")?$.targetHandle.slice(2):void 0;i.addAssociation($.source,$.target,se,Ne)}const K=n.ref(null);function he($,x){var R;const ie=i.state.layout.entityLayouts.find(G=>G.entityRef===$);return at((R=ie==null?void 0:ie.attributeStyles)==null?void 0:R[x])}function we($,x){var R;const ie=i.state.layout.entityLayouts.find(G=>G.entityRef===$);return at((R=ie==null?void 0:ie.operationStyles)==null?void 0:R[x])}function $e($){var x;return at((x=i.state.layout.groupLayouts.find(ie=>ie.groupRef===$))==null?void 0:x.style)}function ke($){var x;return at((x=i.state.layout.notes.find(ie=>ie.modelId===$))==null?void 0:x.style)}function Re($){var R,G;if($.preventDefault(),!i.editable.value)return;const x=()=>Y({x:$.clientX,y:$.clientY}),ie=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const P=x();i.addEntity("NewEntity",{x:P.x,y:P.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const P=x();i.addNote("메모",{x:P.x,y:P.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const P=x();i.addEmptyGroup({x:P.x,y:P.y})}}];((R=i.clipboard.value)==null?void 0:R.kind)==="entity"&&ie.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ie.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(G=K.value)==null||G.open($,ie)}function Ae({event:$,node:x}){var fe,Me,Le,Fe,et,je,Ke,Rt,Jt,_e,tt,Yo,jo,Wo,Ko,qo,Xo,Zo;const ie=$;if(ie.preventDefault(),!i.editable.value){if(x.type==="group"||x.type==="note")return;const Be=(Me=(fe=ie.target)==null?void 0:fe.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(Be){const Ze=i.selection.value;(Ze==null?void 0:Ze.kind)==="attribute"&&Ze.entityId===x.id&&Ze.ids.includes(Be)||i.selectAttribute(x.id,Be);const wn=((Le=i.selection.value)==null?void 0:Le.kind)==="attribute"&&i.selection.value.entityId===x.id?[...i.selection.value.ids]:[Be];(Fe=K.value)==null||Fe.open(ie,[{caption:wn.length>1?`복사 (${wn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(et=K.value)==null||et.open(ie,[{caption:"상세 편집…",icon:"pencil",handler:()=>na(a,i,x.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.copy()}}]);return}if(x.type==="group"){const Be=i.isGroupLocked(x.id),Ze=[];Be||Ze.push({type:"swatches",caption:"색상",current:$e(x.id),onPick:ot=>i.setGroupSwatch(x.id,ot)},{type:"separator"}),Ze.push({caption:Be?"잠금 해제":"잠금",icon:Be?"unlock":"lock",handler:()=>i.setGroupLocked(x.id,!Be)}),Be||Ze.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(x.id)}),(je=K.value)==null||je.open(ie,Ze);return}if(x.type==="note"){(Ke=K.value)==null||Ke.open(ie,[{type:"swatches",caption:"색상",current:ke(x.id),onPick:Be=>i.setNoteSwatch(x.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(x.id)}]);return}const R=(Jt=(Rt=ie.target)==null?void 0:Rt.closest("[data-attr]"))==null?void 0:Jt.dataset.attr;if(R){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===x.id&&Be.ids.includes(R)||i.selectAttribute(x.id,R);const ot=((_e=i.selection.value)==null?void 0:_e.kind)==="attribute"&&i.selection.value.entityId===x.id?[...i.selection.value.ids]:[R];if(i.isEntityLocked(x.id)){(tt=K.value)==null||tt.open(ie,[{caption:ot.length>1?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const wn=ot.length>1,yr=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(x.id)},{type:"swatches",caption:wn?`색상 (${ot.length})`:"색상",current:wn?null:he(x.id,R),onPick:kR=>i.setAttributeSwatches(x.id,ot,kR)},{type:"separator"},{caption:wn?`복사 (${ot.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Jo=i.clipboard.value;(Jo==null?void 0:Jo.kind)==="attribute"&&yr.push({caption:Jo.attributes.length>1?`속성 붙여넣기 (${Jo.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.paste()}}),yr.push({type:"separator"},{caption:wn?`속성 삭제 (${ot.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(x.id,ot)}),(Yo=K.value)==null||Yo.open(ie,yr);return}const G=(Wo=(jo=ie.target)==null?void 0:jo.closest("[data-op]"))==null?void 0:Wo.dataset.op;if(G){if(i.isEntityLocked(x.id))return;(Ko=K.value)==null||Ko.open(ie,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(x.id)},{type:"swatches",caption:"색상",current:we(x.id,G),onPick:Be=>i.setOperationSwatch(x.id,G,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(x.id,G)}]);return}const P=i.resolved.value.entities.find(Be=>Be.entity.modelId===x.id),se=!!(P!=null&&P.locked),Ne=[{caption:se?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>na(a,i,x.id)}];if(!se){Ne.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(x.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(x.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Ze=T.value.filter(ot=>ot.type==="entity").map(ot=>ot.id);i.createGroup(Ze.includes(x.id)&&Ze.length?Ze:[x.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(x.id,x.id)});const Be=i.embeddableCatalog.value;if(Be.length){Ne.push({type:"separator"});for(const Ze of Be){const ot=((qo=Ze.label)==null?void 0:qo.ko)??((Xo=Ze.label)==null?void 0:Xo.en)??Ze.type;Ne.push({caption:`임베더블 추가: ${ot}`,icon:"link",handler:()=>i.addPredefinedEmbed(x.id,Ze.type)})}}}if(Ne.push({type:"separator"}),Ne.push({caption:P!=null&&P.collapsed?"펼치기":"접기",icon:P!=null&&P.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(x.id,!(P!=null&&P.collapsed))}),P!=null&&P.groupRef&&!se&&Ne.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(x.id)}),Ne.push({caption:se?"잠금 해제":"잠금",icon:se?"unlock":"lock",handler:()=>i.setEntityLocked(x.id,!se)}),Ne.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.copy()}}),!se){const Be=i.clipboard.value;(Be==null?void 0:Be.kind)==="attribute"&&Ne.push({caption:Be.attributes.length>1?`속성 붙여넣기 (${Be.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:x.id},i.paste()}}),Ne.push({type:"separator"}),Ne.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(x.id)})}(Zo=K.value)==null||Zo.open(ie,Ne)}function Oe({event:$,edge:x}){var G,P;const ie=$;if(ie.preventDefault(),!i.editable.value)return;const R=N(x.id);if(R){(G=K.value)==null||G.open(ie,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(R.noteRef,R.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(R.noteRef,R.targetRef)}]);return}(P=K.value)==null||P.open(ie,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(x.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(x.id)}])}function We($){return $==="group"?"group":$==="note"?"note":"entity"}function I({node:$}){if(T.value.length>1){i.selection.value=null;return}i.selection.value={kind:We($.type),id:$.id}}function O({nodes:$}){$.length>1&&(i.selection.value=null)}function re({edge:$}){const x=N($.id);i.selection.value=x?{kind:"note",id:x.noteRef}:{kind:"association",id:$.id}}function ue($){const x=i.selection.value;return!!x&&x.kind!=="attribute"&&x.id===$.id}function z($){var x,ie;return ue($)?$.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":$.type==="note"?"var(--em-note-soft)":$.type==="group"?su(at((x=$.data)==null?void 0:x.style),!0)??"var(--em-mm-group)":su(at((ie=$.data)==null?void 0:ie.style))??"var(--em-mm-entity)"}function U($){return ue($)?"var(--em-selection)":$.type==="note"?"var(--em-note-accent)":$.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function w($,x){oe($,x,{zoom:_().zoom,duration:350})}n.watch(()=>i.focusRequest.value,$=>{if(!$)return;const x=B($.id);if(!x)return;const ie=x.computedPosition??x.position,R=x.dimensions??{width:0,height:0};w(ie.x+R.width/2,ie.y+R.height/2)});function F({position:$}){w($.x,$.y)}function ne({node:$}){i.selection.value={kind:We($.type),id:$.id};const x=$.computedPosition??$.position,ie=$.dimensions??{width:0,height:0};w(x.x+ie.width/2,x.y+ie.height/2)}function ce({node:$}){M({nodes:[$.id],duration:350,maxZoom:1.2,padding:.6})}return($,x)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(s_),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!Q.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(Dt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:J,onMoveEnd:X,onConnect:D,onConnectStart:x[1]||(x[1]=ie=>c.value=!0),onConnectEnd:x[2]||(x[2]=ie=>c.value=!1),onNodeDrag:V,onNodeDragStop:j,onNodeClick:I,onEdgeClick:re,onSelectionChange:O,onPaneClick:x[3]||(x[3]=ie=>n.unref(i).selection.value=null),onPaneContextMenu:Re,onNodeContextMenu:Ae,onEdgeContextMenu:Oe},{"node-group":n.withCtx(ie=>[n.createVNode(_u,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-entity":n.withCtx(ie=>[n.createVNode(bu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"node-note":n.withCtx(ie=>[n.createVNode(Eu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-association":n.withCtx(ie=>[n.createVNode(Mu,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),"edge-note-connection":n.withCtx(ie=>[n.createVNode(GI,n.normalizeProps(n.guardReactiveProps(ie)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Aw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(iv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(bn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:be},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(bn),{title:"노트 추가",onClick:de},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(bn),{title:"자동 배치",onClick:x[0]||(x[0]=ie=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(zI),{key:1,pannable:"",width:224,height:160,"node-color":z,"node-stroke-color":U,"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:F,onNodeClick:ne,onNodeDblclick:ce})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",yS,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[x[4]||(x[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),x[5]||(x[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),x[6]||(x[6]=n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub"},[n.createTextVNode(" 단축키 도움말은 "),n.createElementVNode("kbd",null,"?"),n.createTextVNode(" 키 ")],-1))],64)):(n.openBlock(),n.createElementBlock("p",gS,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",bS,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",_S,[n.createElementVNode("strong",ES,n.toDisplayString(s.value.title),1),n.createElementVNode("span",kS,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(tS,{ref_key:"menuRef",ref:K},null,512),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",wS,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function $a(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function vS(e,t){const o=new Set,i=a=>{const l=!!a.matchText&&a.matchText.includes(t);let r=!1;for(const c of a.children)i(c)&&(r=!0);const s=l||r;return s&&o.add(a.key),s};return i(e),o}const NS={class:"em-explorer em-scroll-overlay"},$S={class:"em-explorer__search"},IS={key:0,class:"em-explorer__empty"},SS={class:"em-explorer__rows"},xS=["data-key","onClick","onDblclick"],CS=["onClick"],RS=["title"],VS={class:"em-key-slot"},AS={class:"em-key-slot"},TS={class:"em-explorer__label"},Mf=ze(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ae.useModal(),l=n.computed(()=>{var te;const B=i.resolved.value,H=i.displayMode.value,A=C=>{var Z,le,pe;return ei(H,C.name,(le=(Z=C.table)==null?void 0:Z.logicalName)==null?void 0:le.ko,(pe=C.table)==null?void 0:pe.physicalName)},S=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",L=C=>{const Z=C.attrType.startsWith("RELATION")&&C.dbAttrs.length>0;return{icon:C.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:C.identifier,fk:Z&&S}}},ee=C=>C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0,M=H==="PHYSICAL"||H==="LOGICAL_PHYSICAL",oe=C=>{if(C.attrType!=="EMBED_PREDEF")return C.dbAttrs;const Z=i.embeddableCatalog.value.find(le=>le.type===C.type);return Z?C.dbAttrs.map((le,pe)=>{const be=Z.fields[pe];return be?{...le,physicalName:le.physicalName||be.physicalName,logicalName:le.logicalName??be.logicalName,dataType:le.dataType||be.dataType,length:le.length??be.length}:le}):C.dbAttrs},_=(C,Z)=>{var de,me,ye,ve,Ce,Se,ge,J,X;const le={entityId:Z,attrId:C.modelId};if(ee(C)){const v=za(H,C);return{key:`attr:${C.modelId}`,label:C.name+(v?` : ${v}`:""),icon:"table",attrRef:le,focusId:Z,matchText:$a(C.name,(me=(de=C.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:me.ko,(ye=C.dbAttrs[0])==null?void 0:ye.physicalName),children:M?oe(C).map(V=>{var j,D;return{key:`attr:${C.modelId}:col:${V.modelId}`,label:ei(H,V.physicalName,(j=V.logicalName)==null?void 0:j.ko,V.physicalName)+(V.dataType?` : ${V.dataType}`:""),icon:"field",attrRef:le,focusId:Z,matchText:$a(V.physicalName,(D=V.logicalName)==null?void 0:D.ko),children:[]}}):[]}}const pe=Pa(C,i.state.logical.associations),be=za(H,C,pe);return{key:`attr:${C.modelId}`,label:ei(H,C.name,(Ce=(ve=C.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:Ce.ko,(Se=C.dbAttrs[0])==null?void 0:Se.physicalName)+(be?` : ${be}`:""),...L(C),attrRef:le,focusId:Z,matchText:$a(C.name,(J=(ge=C.dbAttrs[0])==null?void 0:ge.logicalName)==null?void 0:J.ko,(X=C.dbAttrs[0])==null?void 0:X.physicalName),children:[]}},Y=C=>{var pe,be,de;const Z=C.entity,le=[...Z.attributes].sort((me,ye)=>me.order-ye.order);return{key:`entity:${Z.modelId}`,label:A(Z),icon:"table",selectKind:"entity",selectId:Z.modelId,focusId:Z.modelId,matchText:$a(Z.name,(be=(pe=Z.table)==null?void 0:pe.logicalName)==null?void 0:be.ko,(de=Z.table)==null?void 0:de.physicalName),children:le.map(me=>_(me,Z.modelId))}},T=new Map,W=[];for(const C of B.entities)if(C.groupRef){const Z=T.get(C.groupRef)??[];Z.push(C),T.set(C.groupRef,Z)}else W.push(C);const Q=[];for(const C of B.groups){const Z=C.group;Q.push({key:`group:${Z.modelId}`,label:((te=Z.name)==null?void 0:te.ko)||Z.packageName||"(그룹)",icon:"folder",focusId:Z.modelId,children:(T.get(Z.modelId)??[]).map(Y)})}for(const C of W)Q.push(Y(C));if(B.associations.length){const C=new Map(B.entities.map(Z=>[Z.entity.modelId,A(Z.entity)]));Q.push({key:"section:associations",label:`관계 (${B.associations.length})`,icon:"arrow-lr",children:B.associations.map(Z=>{const le=Z.association,pe=C.get(le.end1.entityRef)??le.end1.entityRef,be=C.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${pe} — ${be}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return B.notes.length&&Q.push({key:"section:notes",label:`노트 (${B.notes.length})`,icon:"note",children:B.notes.map(({note:C})=>{var Z;return{key:`note:${C.modelId}`,label:((Z=C.memo.split(`
|
|
52
|
+
`)[0])==null?void 0:Z.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:C.modelId,focusId:C.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:Q}});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 H=new Set(s.value);H.has(B)?H.delete(B):H.add(B),s.value=H}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),p=n.computed(()=>{const B=[];if(f.value){const A=vS(l.value,d.value.trim().toLowerCase()),S=(L,ee)=>{if(A.has(L.key)){B.push({node:L,depth:ee});for(const M of L.children)S(M,ee+1)}};return S(l.value,0),B}const H=(A,S)=>{if(B.push({node:A,depth:S}),!s.value.has(A.key))for(const L of A.children)H(L,S+1)};return H(l.value,0),B}),m=n.computed(()=>f.value&&p.value.length<=1);function y(B){var S;if(B.key!=="/"||B.metaKey||B.ctrlKey||B.altKey||B.shiftKey)return;const H=B.target,A=H==null?void 0:H.tagName;A==="INPUT"||A==="TEXTAREA"||A==="SELECT"||H!=null&&H.isContentEditable||(B.preventDefault(),(S=u.value)==null||S.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const b=n.computed(()=>{const B=[],H=A=>{if(A.children.length){A.key!=="root"&&B.push(A.key);for(const S of A.children)H(S)}};return H(l.value),B}),g=n.computed(()=>!b.value.some(B=>s.value.has(B)));function E(){s.value=g.value?new Set(b.value):new Set}t({toggleAll:E,allExpanded:g,hasExpandable:n.computed(()=>b.value.length>0)});function N(B){const H=i.selection.value;return B.attrRef?(H==null?void 0:H.kind)==="attribute"&&H.entityId===B.attrRef.entityId&&H.ids.includes(B.attrRef.attrId):!!H&&H.kind!=="attribute"&&!!B.selectId&&B.selectKind===H.kind&&B.selectId===H.id}function h(B){const H=i.selection.value;return B.selectKind==="entity"&&(H==null?void 0:H.kind)==="attribute"&&H.entityId===B.selectId}function k(B,H){if(B.attrRef){const A=H.shiftKey?"range":H.metaKey||H.ctrlKey?"toggle":"replace";i.selectAttribute(B.attrRef.entityId,B.attrRef.attrId,A)}else B.selectKind&&B.selectId&&(i.selection.value={kind:B.selectKind,id:B.selectId});B.focusId&&i.requestFocus(B.focusId)}function q(B){B.selectKind==="entity"&&B.selectId&&na(a,i,B.selectId)}return(B,H)=>(n.openBlock(),n.createElementBlock("section",NS,[n.createElementVNode("div",$S,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":H[0]||(H[0]=A=>d.value=A),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:H[1]||(H[1]=n.withKeys(A=>d.value="",["esc"]))},null,544),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":"검색어 지우기",title:"지우기 (Esc)",onClick:H[2]||(H[2]=A=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("p",IS,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",SS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,({node:A,depth:S})=>(n.openBlock(),n.createElementBlock("div",{key:A.key,class:n.normalizeClass(["em-explorer__row",{"is-active":N(A),"is-focus-parent":h(A),"is-selectable":!!A.selectKind||!!A.attrRef||!!A.focusId}]),"data-key":A.key,style:n.normalizeStyle({paddingLeft:4+S*14+"px"}),onClick:L=>k(A,L),onDblclick:L=>q(A)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!A.children.length,"is-open":!s.value.has(A.key)}]),onClick:n.withModifiers(L=>A.children.length&&c(A.key),["stop"])},[A.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,CS),A.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(A.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",VS,[A.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):A.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:A.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",AS,[A.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,RS)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:A.icon,size:15},null,8,["name"])),n.createElementVNode("span",TS,n.toDisplayString(A.label),1)],46,xS))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),MS={class:"em-text-export"},BS={key:0,class:"em-text-export__tabs",role:"tablist"},OS=["aria-selected","onClick"],DS={class:"em-text-export__pre"},LS={class:"em-text-export__actions"},PS=ze(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ae.useModalHandle(),i=n.ref(0);function a(){return t.formats[i.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(a().content),ae.showNotification("클립보드에 복사되었습니다.","info")}catch{ae.showNotification("복사에 실패했습니다.","error")}}function r(){const s=a(),c=new Blob([s.content],{type:"text/plain;charset=utf-8"}),d=URL.createObjectURL(c);try{const u=document.createElement("a");u.href=d,u.download=s.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(d)}}return(s,c)=>(n.openBlock(),n.createBlock(n.unref(ae.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",MS,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",BS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(d,u)=>(n.openBlock(),n.createElementBlock("button",{key:d.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":u===i.value}]),"aria-selected":u===i.value,onClick:f=>i.value=u},n.toDisplayString(d.label),11,OS))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",DS,n.toDisplayString(a().content),1),n.createElementVNode("div",LS,[n.createVNode(n.unref(ae.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ae.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),zS={class:"em-toolbar"},US={class:"em-toolbar__mode"},Bf=ze(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","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(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(y=>y.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const m=i.state.logical;l.openModal({component:PS,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:$r(m),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:Ma(m,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:Ma(m,"class"),filename:"diagram.class.mmd"}]}})}function p(){l.openModal({component:Af})}return(m,y)=>(n.openBlock(),n.createElementBlock("div",zS,[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:y[0]||(y[0]=b=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{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:y[1]||(y[1]=b=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),y[10]||(y[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",US,[y[8]||(y[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:s.value,"onUpdate:modelValue":y[2]||(y[2]=b=>s.value=b),items:r,"value-provider":b=>b.v,"label-provider":b=>b.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(Ve,{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:y[3]||(y[3]=b=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{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:y[4]||(y[4]=b=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),y[11]||(y[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"내보내기 (텍스트 · Mermaid)",onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:y[5]||(y[5]=b=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:y[6]||(y[6]=b=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[y[9]||(y[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:y[7]||(y[7]=b=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),FS={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},HS=["title"],GS=["disabled","aria-pressed"],YS=["disabled","aria-pressed"],jS=ze(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t;function a(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,r)=>e.frozen?(n.openBlock(),n.createElementBlock("div",FS,[n.createVNode(Ve,{name:"lock",size:14}),r[2]||(r[2]=n.createElementVNode("span",null,"편집 잠김 (충돌)",-1))])):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:"이 다이어그램은 조회 전용입니다"},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:r[0]||(r[0]=s=>a(!1))},[n.createVNode(Ve,{name:"eye",size:13}),r[3]||(r[3]=n.createElementVNode("span",null,"조회",-1))],10,GS),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:r[1]||(r[1]=s=>a(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),r[4]||(r[4]=n.createElementVNode("span",null,"편집",-1))],10,YS)],10,HS))}}),[["__scopeId","data-v-44f7d737"]]),WS=["disabled"],KS={class:"em-panel__sub"},qS={class:"em-nav"},XS={key:0,class:"em-nav__divider","aria-hidden":"true"},ZS={key:1},JS=["onClick","onKeydown"],QS={class:"em-nav__name"},ex=["title"],tx={key:0,class:"em-panel__note"},nx=["data-attr-block"],ox={class:"em-attr__row"},ix=["title"],ax={key:0,class:"em-attr__row"},lx={class:"em-attr__row"},rx={class:"em-attr__row"},sx={class:"em-attr__flags"},cx={class:"em-attr__pii"},dx={class:"em-attr__pii"},ux={class:"em-attr__pii"},fx={key:0,class:"em-attr__pii em-attr__codetop"},mx={class:"em-multilang"},px={key:2,class:"em-embed-cols"},hx={class:"em-embed-col__label"},yx={class:"em-attr__row"},gx={class:"em-attr__row"},bx={key:0,class:"em-embed-upd"},_x={class:"em-embed-upd"},Ex={class:"em-embed-upd"},kx={class:"em-swatch__row em-attr__swatch"},wx=["onClick"],vx=["title","onClick"],Nx={key:0,class:"em-attr__swatch-hint"},$x="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Ia="__OWN__",Ix=ze(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(R=>R.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(R=>R.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes.filter(G=>G.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var R;return((R=i.value)==null?void 0:R.attributes)??[]}),d=n.computed(()=>s.value.filter(R=>r.value.has(R.modelId)));function u(R){return{pk:R.identifier,fk:R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0,required:R.notNull&&!R.identifier}}function f(R){return!!i.value&&!!bi(o.state.logical,i.value.modelId,R.modelId)}function p(R){const G=u(R),P=[G.pk&&"PK",G.fk&&"FK",G.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function m(R,G){i.value&&o.selectAttribute(i.value.modelId,R.modelId,G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace")}const y=["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 b(R){return R==="none"?"(없음)":R}const g=R=>R;function E(R){var G,P;return at((P=(G=a.value)==null?void 0:G.attributeStyles)==null?void 0:P[R.modelId])}function N(R){return r.value.size>1&&r.value.has(R.modelId)}function h(R,G){if(!i.value)return;const P=N(R)?o.selectedAttrIds.value:[R.modelId];o.setAttributeSwatches(i.value.modelId,P,G)}function k(R,G){i.value&&o.updateAttribute(i.value.modelId,R.modelId,G)}function q(R,G){k(R,{naturalId:G||void 0,naturalIdMutable:G?R.naturalIdMutable:void 0})}function B(){return{naturalId:void 0,naturalIdMutable:void 0}}function H(R,G){k(R,{identifier:G,...G?B():{}})}function A(R,G){k(R,{transient:G||void 0,...G?B():{}})}function S(R){return!!R.transient}const L=R=>R.value,ee=R=>R.label;function M(R,G){if(!G)return;const P=C.value.find(se=>se.type===G);if(P){const se=R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"};k(R,{type:G,customType:void 0,dbAttrs:[{...se,dataType:P.dataType,length:P.length,scale:P.scale}]});return}k(R,G===Et?{type:G}:{type:G,customType:void 0})}function oe(R,G){k(R,{customType:G.trim()===""?void 0:G})}function _(R,G){const se={...R.dbAttrs[0]??{modelId:R.modelId+".c",physicalName:R.name,dataType:"VARCHAR"},...G};G.dataType!==void 0&&!io.has(se.dataType)&&(se.scale=void 0),k(R,{dbAttrs:[se]})}function Y(R){var G;return io.has(((G=R.dbAttrs[0])==null?void 0:G.dataType)??"")}function T(R,G,P){var se;_(R,{logicalName:{...(se=R.dbAttrs[0])==null?void 0:se.logicalName,[G]:P}})}function W(R,G){k(R,{description:Object.keys(G).length?G:void 0})}function Q(R){return R.personalInfoAttributeType??"none"}function te(R,G){k(R,{personalInfoAttributeType:G==="none"?void 0:G})}const C=n.computed(()=>o.predefinedCustomTypeCatalog.value),Z=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function pe(R){var G,P;return((G=R.label)==null?void 0:G.ko)??((P=R.label)==null?void 0:P.en)??R.type}function be(R){if(!R||!i.value)return;const G=o.addPredefinedEmbed(i.value.modelId,R);G&&o.selectAttribute(i.value.modelId,G),le.value=void 0}function de(){if(!i.value)return;const R=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,R)}const me=n.computed(()=>o.groupCodeCatalog.value);function ye(R){var G;return((G=me.value.find(P=>P.groupCode===R.groupCode))==null?void 0:G.codes)??[]}function ve(R){return["none",...ye(R)]}function Ce(R){return R==="none"?"none":R.code}function Se(R){var P,se;if(R==="none")return"(없음)";const G=((P=R.label)==null?void 0:P.ko)??((se=R.label)==null?void 0:se.en);return G?`${R.code} (${G})`:R.code}function ge(R,G){i.value&&o.setAttributeGroupCode(i.value.modelId,R.modelId,G)}function J(R,G){k(R,{defaultValue:G==="none"?void 0:G})}function X(R,G){k(R,{defaultValue:G.trim()===""?void 0:G})}function v(R){return R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0}function V(R,G,P){const se=R.dbAttrs.map((Ne,fe)=>{if(fe!==G)return Ne;const Me={...Ne,...P};for(const Le of Object.keys(P))P[Le]===void 0&&delete Me[Le];return Me});i.value&&o.setEmbedColumns(i.value.modelId,R.modelId,se)}function j(R,G,P,se){var Ne;V(R,G,{logicalName:{...(Ne=R.dbAttrs[G])==null?void 0:Ne.logicalName,[P]:se}})}function D(R,G){var Ne,fe,Me;if(R.attrType==="EMBED_PREDEF"){const Le=(Ne=o.embeddableCatalog.value.find(Fe=>Fe.type===R.type))==null?void 0:Ne.fields[G];return Le?{name:Le.name,physicalName:Le.physicalName,dataType:Le.dataType,length:Le.length,shareable:Le.shareable,logicalName:Le.logicalName}:void 0}const P=(fe=R.embedded)==null?void 0:fe.embeddableRef;if(!P)return;const se=(Me=o.state.logical.entities.find(Le=>Le.modelId===P))==null?void 0:Me.attributes.flatMap(Le=>Le.dbAttrs)[G];return se?{physicalName:se.physicalName,dataType:se.dataType,length:se.length,scale:se.scale,logicalName:se.logicalName}:void 0}function K(R,G){var P,se;return((P=D(R,G))==null?void 0:P.dataType)||((se=R.dbAttrs[G])==null?void 0:se.dataType)||""}function he(R,G){var P,se;return((P=D(R,G))==null?void 0:P.length)??((se=R.dbAttrs[G])==null?void 0:se.length)}function we(R,G){var P,se;return((P=D(R,G))==null?void 0:P.scale)??((se=R.dbAttrs[G])==null?void 0:se.scale)}const $e=["inherit","true","false"];function ke(R){return R==="inherit"?"기본(따름)":R}function Re(R){return(R==null?void 0:R.updatable)===void 0?"inherit":R.updatable?"true":"false"}function Ae(R,G,P){V(R,G,{updatable:P==="inherit"?void 0:P==="true"})}function Oe(R,G){_(R,{updatable:G==="inherit"?void 0:G==="true"})}const We=["inherit","true","false"];function I(R){return R==="inherit"?"기본(따름)":R}function O(R){return(R==null?void 0:R.insertable)===void 0?"inherit":R.insertable?"true":"false"}function re(R,G,P){V(R,G,{insertable:P==="inherit"?void 0:P==="true"})}function ue(R,G){_(R,{insertable:G==="inherit"?void 0:G==="true"})}const z=n.computed(()=>i.value?ni(i.value,o.state.logical.entities):[]),U=n.computed(()=>Qt(z.value.flatMap(R=>R.attributes.flatMap(G=>G.dbAttrs)))),w=n.computed(()=>z.value.flatMap(R=>R.attributes.filter(G=>G.attrType==="NORMAL"&&G.dbAttrs.length===1&&G.dbAttrs[0]).map(G=>{var P;return{modelId:G.dbAttrs[0].modelId,physical:G.dbAttrs[0].physicalName||G.name,isCurrency:G.type==="Currency",ownerName:R.modelId===((P=i.value)==null?void 0:P.modelId)?void 0:R.name}})));function F(){const R=[...w.value].sort((G,P)=>Number(P.isCurrency)-Number(G.isCurrency));return[Ia,...R.map(G=>G.modelId)]}function ne(R){if(R===Ia)return"전용 컬럼(OWN)";const G=w.value.find(se=>se.modelId===R);return G?`↗ ${G.ownerName?`${G.ownerName}.`:""}${G.physical} (${G.isCurrency?"통화":"공유"})`:R}function ce(R){return(R==null?void 0:R.sharedColumnRef)??Ia}function $(R,G,P){V(R,G,{sharedColumnRef:P===Ia?void 0:P})}function x(R){return(R==null?void 0:R.sharedColumnRef)!=null}function ie(R){var G;return((G=Sn(R,U.value))==null?void 0:G.physicalName)??""}return(R,G)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",KS,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:de}),Z.value.length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:Z.value,"value-provider":P=>P.type,"label-provider":pe,"onUpdate:modelValue":be},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",qS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,P=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:P.modelId},[P.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",XS,[...G[0]||(G[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",ZS,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:se=>m(P,se),onKeydown:[n.withKeys(n.withModifiers(se=>m(P,se),["prevent"]),["enter"]),n.withKeys(n.withModifiers(se=>m(P,se),["prevent"]),["space"])]},[n.createElementVNode("span",QS,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:p(P)},[u(P).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(P).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(P).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,ex)],42,JS)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",tx," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var se,Ne,fe,Me,Le,Fe,et,je,Ke,Rt,Jt;return n.openBlock(),n.createElementBlock("div",{key:P.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(P.modelId)}]),"data-attr-block":P.modelId},[n.createElementVNode("div",ox,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":_e=>k(P,{name:_e})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(Tr)(P.type,C.value),"value-provider":L,"label-provider":ee,"model-value":P.type,"onUpdate:modelValue":_e=>M(P,_e)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?$x:void 0},[n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,ix)]),P.type===n.unref(Et)?(n.openBlock(),n.createElementBlock("div",ax,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":_e=>oe(P,_e)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),v(P)?(n.openBlock(),n.createElementBlock("div",px,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(_e,tt)=>{var Yo,jo,Wo,Ko,qo,Xo,Zo;return n.openBlock(),n.createElementBlock("div",{key:_e.modelId,class:"em-embed-col"},[n.createElementVNode("span",hx,n.toDisplayString(((Yo=D(P,tt))==null?void 0:Yo.name)??((jo=D(P,tt))==null?void 0:jo.physicalName)??`컬럼 ${tt+1}`),1),n.createElementVNode("div",yx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-col-${_e.modelId}`,width:"100%",disabled:x(_e),placeholder:((Wo=D(P,tt))==null?void 0:Wo.physicalName)??"컬럼","model-value":x(_e)?ie(_e):_e.physicalName,"onUpdate:modelValue":Be=>V(P,tt,{physicalName:Be})},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":K(P,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-len-${_e.modelId}`,width:"48px",disabled:"","model-value":he(P,tt)},null,8,["name","model-value"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`embed-scale-${_e.modelId}`,width:"48px",disabled:"","model-value":we(P,tt)},null,8,["name","model-value"])]),n.createVNode(yn,{controller:n.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",gx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`embed-logical-${_e.modelId}`,width:"100%",placeholder:((qo=(Ko=D(P,tt))==null?void 0:Ko.logicalName)==null?void 0:qo.ko)??"논리명","model-value":((Xo=_e.logicalName)==null?void 0:Xo.ko)??"","onUpdate:modelValue":Be=>j(P,tt,"ko",Be)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Zo=D(P,tt))!=null&&Zo.shareable?(n.openBlock(),n.createElementBlock("label",bx,[G[7]||(G[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px","model-value":ce(_e),items:F(),"value-provider":g,"label-provider":ne,"onUpdate:modelValue":Be=>Be&&$(P,tt,Be)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",_x,[G[8]||(G[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:x(_e),"model-value":x(_e)?"false":O(_e),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":Be=>Be&&re(P,tt,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Ex,[G[9]||(G[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"110px",disabled:x(_e),"model-value":x(_e)?"false":Re(_e),items:$e,"value-provider":g,"label-provider":ke,"onUpdate:modelValue":Be=>Be&&Ae(P,tt,Be)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",lx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ne=(se=P.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:Ne.ko)??"","onUpdate:modelValue":_e=>T(P,"ko",_e)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",rx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:S(P),"model-value":((fe=P.dbAttrs[0])==null?void 0:fe.physicalName)??"","onUpdate:modelValue":_e=>_(P,{physicalName:_e})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:S(P),items:n.unref(Vr)(((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(Da),"model-value":((Le=P.dbAttrs[0])==null?void 0:Le.dataType)??"","onUpdate:modelValue":_e=>_e&&_(P,{dataType:_e})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:S(P),"model-value":(Fe=P.dbAttrs[0])==null?void 0:Fe.length,"onUpdate:modelValue":_e=>_(P,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:S(P)||!Y(P),"model-value":(et=P.dbAttrs[0])==null?void 0:et.scale,"onUpdate:modelValue":_e=>_(P,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(yn,{controller:n.unref(o),"ref-id":(je=P.dbAttrs[0])==null?void 0:je.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",sx,[n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||S(P),"onUpdate:modelValue":_e=>H(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:S(P),"onUpdate:modelValue":_e=>k(P,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ke=P.dbAttrs[0])!=null&&Ke.unique),disabled:S(P),"onUpdate:modelValue":_e=>_(P,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Rt=P.dbAttrs[0])!=null&&Rt.autoIncrement),disabled:S(P)||!P.identifier,"onUpdate:modelValue":_e=>_(P,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":_e=>A(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||S(P),"onUpdate:modelValue":_e=>q(P,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:S(P)||!P.naturalId,"onUpdate:modelValue":_e=>k(P,{naturalIdMutable:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((Jt=P.dbAttrs[0])!=null&&Jt.multiValue),disabled:S(P),"onUpdate:modelValue":_e=>_(P,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",cx,[G[1]||(G[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":O(P.dbAttrs[0]),items:We,"value-provider":g,"label-provider":I,"onUpdate:modelValue":_e=>_e&&ue(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",dx,[G[2]||(G[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%",disabled:S(P),"model-value":Re(P.dbAttrs[0]),items:$e,"value-provider":g,"label-provider":ke,"onUpdate:modelValue":_e=>_e&&Oe(P,_e)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",ux,[G[3]||(G[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":Q(P),items:y,"value-provider":g,"label-provider":b,"onUpdate:modelValue":_e=>_e&&te(P,_e)},null,8,["model-value","onUpdate:modelValue"])]),me.value.length?(n.openBlock(),n.createElementBlock("label",fx,[G[4]||(G[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(uu,{"model-value":P.groupCode,items:me.value,"onUpdate:modelValue":_e=>ge(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!me.value.length}])},[G[5]||(G[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ae.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ve(P),"value-provider":Ce,"label-provider":Se,"onUpdate:modelValue":_e=>_e&&J(P,_e)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ae.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":_e=>X(P,_e)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",mx,[G[6]||(G[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(zl,{multiline:"",name:`attr-desc-${P.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":_e=>W(P,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",kx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":E(P)===null}]),title:"없음",onClick:_e=>h(P,null)},"∅",10,wx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),_e=>(n.openBlock(),n.createElementBlock("button",{key:_e,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":E(P)===_e}]),style:n.normalizeStyle({background:n.unref(jn)(_e)}),title:n.unref(Yn)(_e),onClick:tt=>h(P,_e)},null,14,vx))),128)),N(P)?(n.openBlock(),n.createElementBlock("span",Nx,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,nx)}),128))],8,WS)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4d527728"]]),Sx=["disabled"],xx={class:"em-panel__sub-label"},Cx={class:"em-attr__row"},Rx={class:"em-field em-idx-params"},Vx=["value","onChange"],Ax=ze(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),r=n.computed(()=>l.value?no(l.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var b;return[...(((b=l.value)==null?void 0:b.attributes)??[]).map(g=>({value:g.modelId,label:g.name})),...r.value.map(g=>({value:g.modelId,label:`${g.field} (상속)`}))]});function c(){var g;if(!l.value)return;const b=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:De(),name:`idx_${(((g=l.value.indexes)==null?void 0:g.length)??0)+1}`,unique:!1,columns:b?[{columnRef:b.modelId,descending:!1}]:[]})}function d(b,g){l.value&&a.updateIndex(l.value.modelId,b,g)}function u(b){var E;const g=(E=l.value)==null?void 0:E.attributes[0];g&&d(b.modelId,{columns:[...b.columns,{columnRef:g.modelId,descending:!1}]})}function f(b,g,E){d(b.modelId,{columns:b.columns.map((N,h)=>h===g?{...N,columnRef:E}:N)})}function p(b,g,E){d(b.modelId,{columns:b.columns.map((N,h)=>h===g?{...N,descending:E}:N)})}function m(b,g){d(b.modelId,{columns:b.columns.filter((E,N)=>N!==g)})}function y(b,g){d(b.modelId,{parameters:g.trim()===""?void 0:g})}return(b,g)=>{var E;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:g[0]||(g[0]=N=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",xx,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{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(((E=l.value.indexes)==null?void 0:E.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(c,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],N=>(n.openBlock(),n.createElementBlock("div",{key:N.modelId,class:"em-attr"},[n.createElementVNode("div",Cx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`idx-name-${N.modelId}`,width:"100%",placeholder:"인덱스명","model-value":N.name,"onUpdate:modelValue":h=>d(N.modelId,{name:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-uq-${N.modelId}`,class:"em-check",label:"UQ","model-value":N.unique,"onUpdate:modelValue":h=>d(N.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(l.value.modelId,N.modelId)},null,8,["onClick"])]),n.createVNode(yn,{controller:n.unref(a),"ref-id":N.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.columns,(h,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(ae.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":q=>q.value,"label-provider":q=>q.label,"onUpdate:modelValue":q=>q&&f(N,k,q)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`idx-${N.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":q=>p(N,k,q)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"−",onClick:q=>m(N,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"컬럼",onClick:h=>u(N)},null,8,["onClick"]),n.createElementVNode("label",Rx,[g[1]||(g[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:N.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:h=>y(N,h.target.value)},null,40,Vx)])]))),128)):n.createCommentVNode("",!0)],8,Sx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8c0c5afc"]]),Tx=["disabled"],Mx={class:"em-panel__sub-label"},Bx={class:"em-attr__row"},Ox={class:"em-attr__row"},Dx={class:"em-multilang"},Lx={class:"em-attr__pii"},Px={class:"em-swatch__row em-attr__swatch"},zx=["onClick"],Ux=["title","onClick"],Fx=ze(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=ae.useModal(),r=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(h=>h.entityRef===r.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?"(없음)":h}const f=h=>h;function p(h,k){r.value&&a.updateOperation(r.value.modelId,h.modelId,k)}function m(h,k){p(h,{description:Object.keys(k).length?k:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function b(h,k){p(h,{personalInfoAttributeType:k==="none"?void 0:k})}function g(h){var k,q;return at((q=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:q[h.modelId])}function E(h,k){r.value&&a.setOperationSwatch(r.value.modelId,h.modelId,k)}function N(h){l.openModal({component:fu,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:k=>p(h,{sourceCode:k})}})}return(h,k)=>{var q;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=B=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",Mx,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{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(((q=r.value.operations)==null?void 0:q.length)??0)+") ",1)]),n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:"추가",onClick:k[0]||(k[0]=n.withModifiers(B=>n.unref(a).addOperation(r.value.modelId),["stop"]))})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.operations??[],B=>(n.openBlock(),n.createElementBlock("div",{key:B.modelId,class:"em-attr"},[n.createElementVNode("div",Bx,[n.createVNode(n.unref(ae.BSTextInput),{class:"grow",name:`op-name-${B.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":B.name,"onUpdate:modelValue":H=>p(B,{name:H})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSSelect),{width:"96px","model-value":B.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":H=>H&&p(B,{visibility:H})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:H=>n.unref(a).removeOperation(r.value.modelId,B.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Ox,[n.createVNode(n.unref(ae.BSButton),{variant:"text",caption:B.sourceCode?"본문 편집 ●":"본문 편집",onClick:H=>N(B)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Dx,[k[2]||(k[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(zl,{multiline:"",name:`op-desc-${B.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":B.description,"onUpdate:modelValue":H=>m(B,H)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Lx,[k[3]||(k[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ae.BSSelect),{width:"100%","model-value":y(B),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":H=>H&&b(B,H)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Px,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(B)===null}]),title:"없음",onClick:H=>E(B,null)},"∅",10,zx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),H=>(n.openBlock(),n.createElementBlock("button",{key:H,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(B)===H}]),style:n.normalizeStyle({background:n.unref(jn)(H)}),title:n.unref(Yn)(H),onClick:A=>E(B,H)},null,14,Ux))),128))])]))),128)):n.createCommentVNode("",!0)],8,Tx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),Hx={class:"em-panel__head"},Gx={class:"em-panel__head-row"},Yx={class:"em-panel__context"},jx={key:0,class:"em-panel__lock"},Wx=["disabled"],Kx={key:0,class:"em-panel__note"},qx={key:1,class:"em-panel__note"},Xx={key:2,class:"em-jpa"},Zx={class:"em-field"},Jx={class:"em-field"},Qx={key:0,class:"em-field"},eC={class:"em-panel__sub"},tC={class:"em-field"},nC={class:"em-jpa"},oC={key:0,class:"em-panel__note"},iC={class:"em-jpa"},aC={class:"em-field"},lC={key:0,class:"em-panel__note"},rC={class:"em-field"},sC={class:"em-multilang"},cC={class:"em-field"},dC=["value"],uC={class:"em-field"},fC={class:"em-swatch"},mC={class:"em-swatch__row"},pC=["title","onClick"],hC={class:"em-panel__note"},yC={class:"em-field"},gC=["value"],bC={class:"em-swatch"},_C={class:"em-swatch__row"},EC=["title","onClick"],Of=ze(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 J=r.value;return J?a.state.logical.entities.find(X=>X.modelId===J)??null:null}),c=n.computed(()=>{const J=l.value;if((J==null?void 0:J.kind)==="association"){const v=a.state.logical.associations.find(V=>V.modelId===J.id);return!!v&&(a.isEntityLocked(v.end1.entityRef)||a.isEntityLocked(v.end2.entityRef))}const X=r.value;return!!X&&a.isEntityLocked(X)}),d=n.computed(()=>{var J;return((J=a.selectedAttr.value)==null?void 0:J.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),p=n.ref({});n.watch(f,()=>{p.value={}});function m(J){return p.value[J]??f.value}function y(J){p.value={...p.value,[J]:!m(J)}}const b=n.computed(()=>{var v;const J=s.value;if(!J)return"엔티티";const X=(v=J.table)==null?void 0:v.physicalName;return X?`${J.name} (${X})`:J.name}),g=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="association"?a.state.logical.associations.find(X=>X.modelId===J.id)??null:null}),E=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="group"?a.state.logical.groups.find(X=>X.modelId===J.id)??null:null}),N=n.computed(()=>{const J=l.value;return(J==null?void 0:J.kind)==="note"?a.state.layout.notes.find(X=>X.modelId===J.id)??null:null}),h=n.computed(()=>{var X,v;const J=(X=E.value)==null?void 0:X.name;return(J==null?void 0:J.ko)||(J==null?void 0:J.en)||(J==null?void 0:J.ja)||(J==null?void 0:J.zh)||((v=E.value)==null?void 0:v.packageName)||"그룹"}),k=n.computed(()=>{if(s.value){const J=u.value.size;if(J>1)return`엔티티 · ${s.value.name} › 속성 · ${J}개`;if(d.value){const X=s.value.attributes.find(v=>v.modelId===d.value);return(X==null?void 0:X.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(X==null?void 0:X.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const J=X=>{var v;return((v=a.state.logical.entities.find(V=>V.modelId===X))==null?void 0:v.name)??X};return`관계 · ${J(g.value.end1.entityRef)} — ${J(g.value.end2.entityRef)}`}return E.value?`그룹 · ${h.value}`:N.value?"노트":"선택된 항목 없음"}),q=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],B=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],H=["LIST","SET"],A=["inherit","LAZY","EAGER"],S=J=>J;function L(J){return J==="inherit"?"기본(따름)":J}const ee=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function M(J,X){g.value&&a.updateAssociationEnd(g.value.modelId,J,X)}function oe(J){g.value&&!ee.value&&a.setAssociationIdentifying(g.value.modelId,J)}function _(J){var X,v,V;return!!((V=(v=(X=g.value)==null?void 0:X[J].jpa)==null?void 0:v.cascadeTypes)!=null&&V.includes("ALL"))}function Y(J,X,v){var D,K;const V=(D=g.value)==null?void 0:D[J];if(X==="ALL"&&v){M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:["ALL"]}});return}const j=new Set(((K=V==null?void 0:V.jpa)==null?void 0:K.cascadeTypes)??[]);v?j.add(X):j.delete(X),M(J,{jpa:{...V==null?void 0:V.jpa,cascadeTypes:[...j]}})}function T(J,X){var V;const v=(V=g.value)==null?void 0:V[J];M(J,{jpa:{...v==null?void 0:v.jpa,...X}})}function W(J){var X,v;return((v=(X=g.value)==null?void 0:X[J].jpa)==null?void 0:v.fetchType)??"inherit"}function Q(J,X){T(J,{fetchType:X==="inherit"?void 0:X})}function te(J){var v;const X=(v=g.value)==null?void 0:v[J==="end1"?"end2":"end1"];return(X==null?void 0:X.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(X==null?void 0:X.multiplicity)==="ONE_OR_MORE_INSTANCES"}const C=n.computed(()=>{const J=g.value;if(!J)return null;for(const X of a.state.logical.entities){const v=X.attributes.find(D=>{var K;return((K=D.embedded)==null?void 0:K.associationRef)===J.modelId&&D.attrType==="EMBED_OWN"});if(!v)continue;const V=J.end2.entityRef===v.embedded.embeddableRef?"end2":"end1",j=J[V].jpa;return{which:V,isCollection:J[V].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(j==null?void 0:j.collectionType)??"LIST",collectionTable:(j==null?void 0:j.collectionTable)??"",orderColumn:(j==null?void 0:j.orderColumn)??""}}return null});function Z(J){g.value&&a.setEmbedCollectionMode(g.value.modelId,J?"COLLECTION":"SINGLE")}function le(J){const X=C.value;X&&T(X.which,J==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function pe(J){const X=C.value;X&&T(X.which,{collectionTable:J.trim()||void 0})}function be(J){const X=C.value;X&&T(X.which,{orderColumn:J.trim()||void 0})}function de(J){E.value&&a.updateGroup(E.value.modelId,J)}function me(J,X){var v;de({name:{...(v=E.value)==null?void 0:v.name,[J]:X}})}const ye=n.computed(()=>{var J;return E.value?at((J=a.state.layout.groupLayouts.find(X=>X.groupRef===E.value.modelId))==null?void 0:J.style):null});function ve(J){E.value&&a.setGroupSwatch(E.value.modelId,J)}function Ce(J){N.value&&a.setNoteMemo(N.value.modelId,J)}const Se=n.computed(()=>{var J;return at((J=N.value)==null?void 0:J.style)});function ge(J){N.value&&a.setNoteSwatch(N.value.modelId,J)}return(J,X)=>(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:X[0]||(X[0]=(...v)=>e.startResize&&e.startResize(...v))},null,34),n.createElementVNode("header",Hx,[n.createElementVNode("div",Gx,[X[13]||(X[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:X[1]||(X[1]=v=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",Yx,n.toDisplayString(k.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",jx,[n.createVNode(Ve,{name:"lock",size:13}),X[14]||(X[14]=n.createElementVNode("span",null,"편집 잠김 — 이동·수정·삭제 차단",-1)),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:X[2]||(X[2]=v=>n.unref(a).setEntityLocked(r.value,!1))},"잠금 해제")):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(cu,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:b.value,onToggle:X[3]||(X[3]=v=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(Ix,{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,collapsible:"",collapsed:m("index"),onToggle:X[4]||(X[4]=v=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(Fx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:X[5]||(X[5]=v=>y("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:ee.value||!!C.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),ee.value?(n.openBlock(),n.createElementBlock("p",Kx,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):C.value?(n.openBlock(),n.createElementBlock("p",qx,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),C.value?(n.openBlock(),n.createElementBlock("fieldset",Xx,[X[18]||(X[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ae.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":C.value.isCollection,"onUpdate:modelValue":Z},null,8,["model-value"]),C.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",Zx,[X[15]||(X[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":C.value.collectionType,items:H,"value-provider":S,"label-provider":S,"onUpdate:modelValue":X[6]||(X[6]=v=>v&&le(v))},null,8,["model-value"])]),n.createElementVNode("label",Jx,[X[16]||(X[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":C.value.collectionTable,"onUpdate:modelValue":pe},null,8,["model-value"])]),C.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",Qx,[X[17]||(X[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":C.value.orderColumn,"onUpdate:modelValue":be},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),X[19]||(X[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],v=>{var V,j,D,K;return n.createElementVNode("div",{key:v,class:"em-end"},[n.createElementVNode("h4",eC,n.toDisplayString(v)+" → "+n.toDisplayString(g.value[v].entityRef),1),n.createElementVNode("label",tC,[X[20]||(X[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":g.value[v].multiplicity,items:q,"value-provider":S,"label-provider":S,disabled:((V=C.value)==null?void 0:V.which)===v,"onUpdate:modelValue":he=>M(v,{multiplicity:he})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-navigable`,class:"em-check",label:"navigable","model-value":g.value[v].navigable,"onUpdate:modelValue":he=>M(v,{navigable:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-composition`,class:"em-check",label:"composition","model-value":g.value[v].composition,"onUpdate:modelValue":he=>M(v,{composition:he})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",nC,[X[21]||(X[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(B,he=>{var we,$e;return n.createVNode(n.unref(ae.BSCheckbox),{key:he,name:`${v}-cascade-${he}`,class:"em-check",label:he,"model-value":!!(($e=(we=g.value[v].jpa)==null?void 0:we.cascadeTypes)!=null&&$e.includes(he)),disabled:he!=="ALL"&&_(v),"onUpdate:modelValue":ke=>Y(v,he,ke)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),_(v)?(n.openBlock(),n.createElementBlock("p",oC,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",iC,[X[24]||(X[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",aC,[X[22]||(X[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ae.BSSelect),{"model-value":W(v),items:A,"value-provider":S,"label-provider":L,"onUpdate:modelValue":he=>he&&Q(v,he)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:`${v}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((j=g.value[v].jpa)!=null&&j.orphanRemoval),disabled:te(v),"onUpdate:modelValue":he=>T(v,{orphanRemoval:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),te(v)&&((D=g.value[v].jpa)!=null&&D.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",lC,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",rC,[X[23]||(X[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:`${v}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((K=g.value[v].jpa)==null?void 0:K.orderBy)??"","onUpdate:modelValue":he=>T(v,{orderBy:he.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),E.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",sC,[X[25]||(X[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,v=>{var V;return n.openBlock(),n.createElementBlock("label",{key:v,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(v),1),n.createVNode(n.unref(ae.BSTextInput),{name:`grp-name-${v}`,width:"100%","model-value":((V=E.value.name)==null?void 0:V[v])??"","onUpdate:modelValue":j=>me(v,j)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",cC,[X[26]||(X[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:E.value.description??"",rows:"3",onChange:X[7]||(X[7]=v=>de({description:v.target.value}))},null,40,dC)]),n.createElementVNode("label",uC,[X[27]||(X[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ae.BSTextInput),{name:"grp-package",width:"100%","model-value":E.value.packageName??"","onUpdate:modelValue":X[8]||(X[8]=v=>de({packageName:v}))},null,8,["model-value"])]),n.createVNode(n.unref(ae.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":E.value.excludeDDLGeneration,"onUpdate:modelValue":X[9]||(X[9]=v=>de({excludeDDLGeneration:v}))},null,8,["model-value"]),n.createElementVNode("fieldset",fC,[X[28]||(X[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",mC,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:X[10]||(X[10]=v=>ve(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===v}]),style:n.normalizeStyle({background:n.unref(jn)(v)}),title:n.unref(Yn)(v),onClick:V=>ve(v)},null,14,pC))),128))])]),n.createElementVNode("p",hC,"멤버 엔티티 "+n.toDisplayString(E.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",yC,[X[29]||(X[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:X[11]||(X[11]=v=>Ce(v.target.value))},null,40,gC)]),n.createElementVNode("fieldset",bC,[X[30]||(X[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",_C,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:"없음",onClick:X[12]||(X[12]=v=>ge(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(hn),v=>(n.openBlock(),n.createElementBlock("button",{key:v,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Se.value===v}]),style:n.normalizeStyle({background:n.unref(jn)(v)}),title:n.unref(Yn)(v),onClick:V=>ge(v)},null,14,EC))),128))])])],64)):n.createCommentVNode("",!0)],8,Wx)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),kC={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function wC(e){const t=e.split("-")[1];return t?kC[t]??t:e}function vC(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const NC=["title"],$C=["title","onClick"],IC={key:0,class:"em-validation__body"},SC={class:"em-validation__opt"},xC={key:0,class:"em-validation__empty"},CC={key:1,class:"em-validation__empty"},RC={key:2,class:"em-validation__list"},VC=["onClick"],AC={class:"em-validation__item-msg"},TC={key:0,class:"em-validation__item-entity"},MC=["title"],BC=ze(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 b=new Map;for(const g of o.state.logical.entities)b.set(g.modelId,g.name);return b});function l(b){const g=vC(b);if(!g)return null;const E=a.value.get(g);return E===void 0?null:E.trim()===""?"(이름 없음)":E}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 b={error:0,warning:0,info:0};for(const g of i.value)b[g.severity]++;return b}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,g)=>r[b.severity].order-r[g.severity].order)),u=n.computed(()=>d.value.map(b=>({issue:b,entityName:l(b),category:wC(b.ruleId)}))),f=n.ref(!1);function p(b){c.value[b]=!c.value[b]}function m(b){if(!f.value){f.value=!0;return}p(b)}function y(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,g)=>(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:g[1]||(g[1]=E=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),g[3]||(g[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,NC),n.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],E=>n.createElementVNode("button",{key:E,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:f.value?`${r[E].label} ${c.value[E]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:N=>m(E)},[n.createVNode(Ve,{name:r[E].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[E]),1)],10,$C)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",IC,[n.createElementVNode("label",SC,[n.createVNode(n.unref(ae.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=E=>n.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",xC,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",CC," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",RC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:E,entityName:N,category:h},k)=>(n.openBlock(),n.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${k}`,class:n.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:q=>y(E)},[n.createVNode(Ve,{name:r[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",AC,[N?(n.openBlock(),n.createElementBlock("span",TC,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(E.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},n.toDisplayString(h),9,MC)],10,VC))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),OC={class:"em-history"},DC={class:"em-history__head"},LC={class:"em-history__title"},PC={class:"em-history__head-actions"},zC=["disabled"],UC={class:"em-history__filters"},FC={class:"em-history__filter"},HC={class:"em-history__body"},GC={key:0,class:"em-history__empty"},YC={key:1,class:"em-history__empty is-error"},jC={key:2,class:"em-history__empty"},WC={key:3,class:"em-history__list"},KC=["onClick"],qC={class:"em-history__summary"},XC={class:"em-history__seq"},ZC={class:"em-history__gmeta"},JC={class:"em-history__who"},QC={key:0,class:"em-history__time"},eR={key:1,class:"em-history__restored-from"},tR={key:0,class:"em-history__detail"},nR={class:"em-history__action-head"},oR={class:"em-history__action-name"},iR={key:0,class:"em-history__fields"},aR={class:"em-history__fname"},lR={key:0,class:"em-history__old"},rR={class:"em-history__val"},sR={key:1,class:"em-history__restore"},cR=["disabled","onClick"],dR=["disabled"],uR=["onClick"],fR=ze(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(C){s.value=C instanceof Error?C.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,C=>{C&&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(C=>[C.modelId,C]))),m=n.computed(()=>new Map(a.state.logical.associations.map(C=>[C.modelId,C]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(C=>{var Z;return[C.modelId,C.packageName||((Z=C.name)==null?void 0:Z.ko)||C.modelId]})));function b(C){var be,de,me,ye,ve,Ce,Se;const Z=m.value.get(C);if(!Z)return"연관";if((be=Z.description)!=null&&be.trim())return Z.description.trim();const le=(ye=(me=p.value.get((de=Z.end1)==null?void 0:de.entityRef))==null?void 0:me.name)==null?void 0:ye.trim(),pe=(Se=(Ce=p.value.get((ve=Z.end2)==null?void 0:ve.entityRef))==null?void 0:Ce.name)==null?void 0:Se.trim();return le&&pe?`${le}→${pe}`:"연관"}function g(C){var Z,le,pe,be;if(C.kind==="entity")return((le=(Z=p.value.get(C.ref))==null?void 0:Z.name)==null?void 0:le.trim())||"(이름 없음)";if(C.kind==="attribute"||C.kind==="operation"||C.kind==="index"){const de=C.entityRef?p.value.get(C.entityRef):void 0,ye=((C.kind==="attribute"?de==null?void 0:de.attributes:C.kind==="operation"?de==null?void 0:de.operations:de==null?void 0:de.indexes)??[]).find(Ce=>Ce.modelId===C.ref),ve=(pe=de==null?void 0:de.name)==null?void 0:pe.trim();return`${ve?ve+".":""}${((be=ye==null?void 0:ye.name)==null?void 0:be.trim())||C.ref}`}return C.kind==="association"?b(C.ref):C.kind==="associationEnd"?`${b(C.ref)}(${C.end})`:C.kind==="group"?`그룹 ${y.value.get(C.ref)??C.ref}`:C.ref}const E={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"추가",update:"수정",remove:"삭제"},h=n.ref("all"),k=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],q=n.computed({get:()=>h.value,set:C=>{C&&(h.value=C)}}),B=n.computed(()=>Qr(l.value)),H=n.computed(()=>B.value.length?B.value[0].seq:null),A=n.computed(()=>h.value==="all"?B.value:B.value.filter(C=>(C.kind??"edit")===h.value));function S(C){return C===void 0?"—":C===null?"(비움)":typeof C=="object"?JSON.stringify(C):String(C)}function L(C){const Z=g(C.subject);if(C.verb==="add")return`${Z} 추가`;if(C.verb==="remove")return`${Z} 삭제`;if(C.fields.length===1){const le=C.fields[0];return`${Z}.${le.field} ${le.oldValue!==void 0?S(le.oldValue)+"→":""}${S(le.value)}`}return`${Z} ${C.fields.length}개 변경`}function ee(C){return C.actions.length===0?"변경 없음":C.actions.length===1?L(C.actions[0]):`${L(C.actions[0])} 외 ${C.actions.length-1}건`}const M=n.ref(new Set);function oe(C){const Z=new Set(M.value);Z.has(C)?Z.delete(C):Z.add(C),M.value=Z}function _(C){if(C==null)return"";const Z=new Date(C);return isNaN(Z.getTime())?String(C):Z.toLocaleString()}function Y(C){const Z=C.author,le=C.origin;return Z&&le?`${Z}(${le})`:Z||(le?`(${le})`:"—")}const T=n.ref(null),W=n.ref(!1);function Q(C){T.value=C}async function te(C){W.value=!0;try{const Z=await a.restoreToSeq(C);Z.ok||(s.value=`복원 실패: ${Z.reason??"알 수 없음"}`)}finally{W.value=!1,T.value=null}}return(C,Z)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",OC,[n.createElementVNode("header",DC,[n.createElementVNode("div",LC,[n.createVNode(Ve,{name:"undo",size:15}),Z[4]||(Z[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",PC,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:Z[0]||(Z[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,zC),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:Z[1]||(Z[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",UC,[n.createElementVNode("label",FC,[Z[5]||(Z[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ae.BSSelect),{modelValue:q.value,"onUpdate:modelValue":Z[2]||(Z[2]=le=>q.value=le),items:k,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",HC,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",GC,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",YC,n.toDisplayString(s.value),1)):A.value.length===0?(n.openBlock(),n.createElementBlock("p",jC,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",WC,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,le=>(n.openBlock(),n.createElementBlock("li",{key:le.seq,class:n.normalizeClass(["em-history__group",[`is-${le.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:pe=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":M.value.has(le.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${le.kind??"edit"}`])},n.toDisplayString(le.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",qC,n.toDisplayString(ee(le)),1),n.createElementVNode("span",XC,"#"+n.toDisplayString(le.seq),1)],8,KC),n.createElementVNode("div",ZC,[n.createElementVNode("span",JC,n.toDisplayString(Y(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",QC,n.toDisplayString(_(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",eR,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),M.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",tR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(pe,be)=>(n.openBlock(),n.createElementBlock("div",{key:be,class:"em-history__action"},[n.createElementVNode("div",nR,[n.createVNode(Ve,{name:E[pe.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",oR,n.toDisplayString(g(pe.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${pe.verb}`])},n.toDisplayString(N[pe.verb]),3)]),pe.fields.length?(n.openBlock(),n.createElementBlock("ul",iR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.fields,(de,me)=>(n.openBlock(),n.createElementBlock("li",{key:me,class:"em-history__field"},[n.createElementVNode("span",aR,n.toDisplayString(de.field),1),de.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",lR,n.toDisplayString(S(de.oldValue)),1)):n.createCommentVNode("",!0),de.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",rR,n.toDisplayString(S(de.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==H.value?(n.openBlock(),n.createElementBlock("div",sR,[T.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[Z[6]||(Z[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:pe=>te(le.seq)},"복원",8,cR),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:Z[3]||(Z[3]=pe=>T.value=null)},"취소",8,dR)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:pe=>Q(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),Z[7]||(Z[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,uR))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function mR(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 Df(e){const t=n.ref(mR(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 pR={class:"em-modeler"},hR={class:"em-modeler__body"},yR={class:"em-drawer__inner"},gR={class:"em-drawer__head"},bR={class:"em-drawer__actions"},_R=["title"],ER=ze(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}=Df({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Df({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(p,m)=>{var y,b,g;return n.openBlock(),n.createElementBlock("div",pR,[n.createVNode(Bf,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=E=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onExportPng:m[1]||(m[1]=E=>{var N;return(N=u.value)==null?void 0:N.exportPng()}),onToggleHistory:m[2]||(m[2]=E=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",hR,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",yR,[n.createElementVNode("header",gR,[m[10]||(m[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",bR,[(y=f.value)!=null&&y.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(b=f.value)!=null&&b.allExpanded?"모두 접기":"모두 펼치기",onClick:m[3]||(m[3]=E=>{var N;return(N=f.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(g=f.value)!=null&&g.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,_R)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[4]||(m[4]=E=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Mf,{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[5]||(m[5]=(...E)=>n.unref(r)&&n.unref(r)(...E))},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[6]||(m[6]=E=>t.value=!0)},[n.createVNode(Ve,{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(Tf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Of,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[7]||(m[7]=E=>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[8]||(m[8]=E=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(fR,{controller:e.controller,open:i.value,onClose:m[9]||(m[9]=E=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(BC,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=Mp,Ee.AssociationEdge=Mu,Ee.CUSTOM_TYPE_VALUE=Et,Ee.CommandStack=Xa,Ee.DEFAULT_JAVA_TYPE=La,Ee.DiagramCanvas=Tf,Ee.DiagramExplorer=Mf,Ee.EDITOR=gn,Ee.EditModeToggle=jS,Ee.EditorToolbar=Bf,Ee.EntityModeler=ER,Ee.EntityNode=bu,Ee.GROUP_CODE_ENUM_VALUE=Nn,Ee.GroupNode=_u,Ee.INHERITED_REF_PREFIX=Qo,Ee.JAVA_TYPES=ti,Ee.NoteNode=Eu,Ee.OpSyncAdapter=Hs,Ee.PHYSICAL_NAME_MAX_LENGTH=Ua,Ee.PropertyPanel=Of,Ee.RevCache=Fs,Ee.SELECTABLE_JAVA_TYPES=Ar,Ee.SYMBOLIC_OP_KINDS=Gs,Ee.SYMBOLIC_OP_SCHEMA=ec,Ee.anchoredEdgePoint=Va,Ee.buildAgentBatch=Bp,Ee.buildDiagramSvg=pr,Ee.buildOrthogonalPath=Sa,Ee.buildSelfLoopPath=_r,Ee.buildStraightPath=Ca,Ee.collectSharedColumns=In,Ee.commands=np,Ee.computeAutoLayout=Er,Ee.createEditorController=Ok,Ee.defaultMermaidDialect=Yf,Ee.displayLabel=ei,Ee.emptyState=pu,Ee.entityModelToMermaid=Ma,Ee.entityModelToText=$r,Ee.estimateEntityHeight=wr,Ee.exportDiagramPng=Vf,Ee.exportDiagramSvg=Rf,Ee.fromPersisted=qp,Ee.indexColumnsByModelId=Qt,Ee.isInheritedColumnRef=to,Ee.javaTypeLabel=$n,Ee.makeInheritedColumnRef=vr,Ee.mergeDiagram=Wr,Ee.migrateLegacyMoney=Om,Ee.newId=De,Ee.orthogonalMidpoints=xa,Ee.packEntityBoxes=Gf,Ee.parseInheritedColumnRef=Ta,Ee.physicalNameWarning=oi,Ee.projectActionLog=Qr,Ee.projectEntityAudit=Zr,Ee.projectFieldAudit=Ft,Ee.projectInheritedColumns=no,Ee.rectExitPoint=Ra,Ee.renderDiagramSvg=Rr,Ee.resolveDiagram=gr,Ee.resolveSharedColumn=Sn,Ee.resolveSymbolicOps=Np,Ee.restoreDeepEqual=Vn,Ee.scaffoldEntityJava=pm,Ee.segmentMidpoints=Aa,Ee.sharedColumnScopeEntities=ni,Ee.sideDir=eo,Ee.synthesizeRestoreOps=Wm,Ee.toPersisted=ch,Ee.toPersistedV2=dh,Ee.validateModel=Br,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));
|