@g1cloud/entity-modeler-next 5.0.0-alpha.13 → 5.0.0-alpha.14
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/mermaid.d.ts +6 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +9567 -9101
- package/dist/entity-modeler.umd.cjs +13 -11
- package/dist/index.d.ts +2 -1
- package/dist/view/DiagramCanvas.vue.d.ts +2 -0
- package/dist/view/EditModeToggle.vue.d.ts +1 -0
- package/dist/view/EditorToolbar.vue.d.ts +2 -0
- package/dist/view/ShortcutHelpModal.vue.d.ts +2 -0
- package/dist/view/{EntityTextPreview.vue.d.ts → TextExportModal.vue.d.ts} +9 -1
- package/dist/view/explorerFilter.d.ts +20 -0
- package/dist/view/exportImage.d.ts +14 -0
- package/dist/view/opConflictNotice.d.ts +12 -0
- package/package.json +1 -1
- package/dist/view/exportSvg.d.ts +0 -7
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`).trim()}const Xu=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function rt(e){return e.replace(Xu,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ce(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Xl(e){return`<text ${[`x="${Ce(e.x)}"`,`y="${Ce(e.y)}"`,`fill="${rt(e.fill)}"`,`font-size="${Ce(e.fontSize)}"`,e.fontFamily?`font-family="${rt(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${rt(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${rt(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${rt(e.text)}</text>`}function ju(e){return`<line x1="${Ce(e.x1)}" y1="${Ce(e.y)}" x2="${Ce(e.x2)}" y2="${Ce(e.y)}" stroke="${rt(e.stroke)}" stroke-width="${Ce(e.strokeWidth??1)}" />`}function Zu(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 Ju(e,t,o,i,a){return[`M${Ce(e+a.tl)},${Ce(t)}`,`L${Ce(e+o-a.tr)},${Ce(t)}`,a.tr?`Q${Ce(e+o)},${Ce(t)} ${Ce(e+o)},${Ce(t+a.tr)}`:"",`L${Ce(e+o)},${Ce(t+i-a.br)}`,a.br?`Q${Ce(e+o)},${Ce(t+i)} ${Ce(e+o-a.br)},${Ce(t+i)}`:"",`L${Ce(e+a.bl)},${Ce(t+i)}`,a.bl?`Q${Ce(e)},${Ce(t+i)} ${Ce(e)},${Ce(t+i-a.bl)}`:"",`L${Ce(e)},${Ce(t+a.tl)}`,a.tl?`Q${Ce(e)},${Ce(t)} ${Ce(e+a.tl)},${Ce(t)}`:"","Z"].filter(Boolean).join(" ")}function da(e){const t=Zu(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${rt(e.fill)}"`,`stroke="${rt(e.stroke)}"`,`stroke-width="${Ce(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${rt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ce(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Ju(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Ce(e.x)}" y="${Ce(e.y)}" width="${Ce(e.w)}" height="${Ce(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(ju(r));for(const r of e.texts)l.push(Xl(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Qu(e){const o=[`<path ${[`d="${rt(e.d)}"`,'fill="none"',`stroke="${rt(e.stroke)}"`,`stroke-width="${Ce(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${rt(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Xl(i));return`<g>${o.join("")}</g>`}function jl(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Ce(t)}" y="${Ce(o)}" width="${Ce(i)}" height="${Ce(a)}" fill="${rt(e.background)}" />`);for(const r of e.groups)l.push(da(r));for(const r of e.edges)l.push(Qu(r));for(const r of e.entities)l.push(da(r));for(const r of e.notes)l.push(da(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ce(t)} ${Ce(o)} ${Ce(i)} ${Ce(a)}" width="${Ce(i)}" height="${Ce(a)}">`+l.join("")+"</svg>"}const ef=["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"],tf=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"]),nf=ef.filter(e=>!tf.has(e)),of={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ua(e){return of[e]??e}const af=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Po=new Set(["NUMERIC","DECIMAL"]);function Zl(e,t=nf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Lt="CustomType",Yn="GroupCodeEnum",fa="String",ma=[{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:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Yn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Lt,label:"CustomType"}],lf=new Map(ma.map(e=>[e.value,e.label]));function wn(e){return lf.get(e)??e}const rf=new Set([Yn,"CustomMoneyType"]),Jl=ma.filter(e=>!rf.has(e.value)).map(e=>e.value===Lt?{...e,label:"CustomType (사용자정의)"}:e);function Ql(e,t=[]){const o=t.map(a=>{var r,s;const l=((r=a.label)==null?void 0:r.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:l?`${a.type} (${l})`:a.type}}),i=[...Jl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wn(e)},...i]:i}function sf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function er(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 pa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wn(t.type)}>`:sf(t)?wn(t.type):e==="CLASS"?t.type===Lt&&t.customType||wn(t.type):ua(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Wn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function zo(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 ha=63;function Uo(e){if(!e)return null;const t=e.length;return t<=ha?null:`물리명이 ${ha}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function tr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function dt(e){return!e||e.trim()===""}function Kn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function cf(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,a=2,l=new Map,r=[],s=[],c=new Set,d=u=>{l.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=l.get(f)??o;if(p===o)d(f);else if(p===i){const m=r.slice(r.indexOf(f)),h=[...m].sort().join(" ");c.has(h)||(c.add(h),s.push(m))}}r.pop(),l.set(u,a)};for(const u of e.entities)(l.get(u.modelId)??o)===o&&d(u.modelId);return s}function df(e,t,o,i,a){var l,r,s,c,d;if(!dt(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 ya(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 nr(e,t){var l,r,s;const o=[];for(const c of ya(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(h=>h.attrType!=="DIVIDER");if(dt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),dt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const h of d.filter(_=>_.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${h.name}"`});for(const h of d.filter(_=>_.identifier&&_.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of d)if(!h.identifier)for(const _ of h.dbAttrs)!_.autoIncrement&&dt(_.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`채번(${_.autoIncrement?"auto increment":`시퀀스 "${_.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${h.name}"에 설정되어 있습니다`});for(const h of d.filter(_=>_.naturalId&&_.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${h.name}"`});for(const h of d.filter(_=>_.naturalId&&_.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${h.name}"`});for(const h of d.filter(_=>_.naturalId&&!_.notNull&&!_.identifier&&!_.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${h.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const h of ya(d,_=>_.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${h.name}"`});for(const h of d)dt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),f=d.flatMap(h=>h.dbAttrs.map((_,b)=>({col:_,name:df(h,_,b,e,t)})).filter(_=>_.col.sharedColumnRef==null));for(const h of ya(f,_=>_.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${h.name}"`});for(const h of u){const _=Uo(h.physicalName);_&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:_}),t!=null&&t.reservedWords&&!dt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${h.physicalName}"`}),t!=null&&t.selectableDataTypes&&!dt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${h.dataType}"`}),!dt(h.dataType)&&af.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:c.modelId,message:`${h.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const h=Wn(d.flatMap(_=>_.dbAttrs));for(const _ of d){if(_.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(g=>g.type===_.type);b&&_.dbAttrs.forEach((g,I)=>{if(g.sharedColumnRef==null)return;const y=b.fields[I],N=h.get(g.sharedColumnRef);if(!y||!N)return;(N.dataType!==y.dataType||(N.length??null)!==(y.length??null)||(N.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${tr(N)})이 ${y.name??"컬럼"} 정의(${tr(y)})와 다릅니다`})})}}for(const h of d){const _=h.dbAttrs[0];if(!(_!=null&&_.multiValue))continue;h.type===Yn&&_.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${h.type||"타입 미지정"} / ${_.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const p=(s=c.table)==null?void 0:s.physicalName,m=Uo(p);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!dt(p)&&t.reservedWords.has(p.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${p}"`});for(const h of c.indexes??[]){const _=Uo(h.name);_&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:_}),t!=null&&t.reservedWords&&!dt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${h.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){Kn(c.end1.multiplicity)&&Kn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],p=f.includes("ALL"),m=f.includes("REMOVE");p&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||p)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${p?"ALL":"REMOVE"}와 의미가 겹칩니다`}),Kn(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&Kn(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!Kn(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of cf(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!dt(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Me(){return crypto.randomUUID()}const uf="CustomMoneyType",ff="Money";function mf(e){return!(e.type!==uf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function pf(e){const t=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:ff,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function hf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>mf(r)?(a=!0,t=!0,pf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function ga(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 Zt(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 Jt(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 yf(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 gf=new Set(["attributes","operations","indexes","rev"]),bf=new Set(["end1","end2","rev"]),_f=new Set(["memberEntityRefs","rev"]),or=new Set(["modelId"]),wf=new Set(["modelId","columns"]),vf=new Set([]);function kf(e,t,o,i){const a=Jt(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=Zt(s,c,or);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Jt(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=Zt(s,c,or);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Jt(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=Zt(s,c,wf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Ef(e,t,o){const i=Jt(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:ga(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,gf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),kf(r.modelId,r,s,o)}const a=Jt(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:ga(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,bf);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Zt(r[d]??{},s[d]??{},vf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Jt(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:ga(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,_f);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=yf(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 Ho(e,t,o,i,a,l,r){const s=Jt(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 Nf(e,t,o){Ho(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Ho(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Ho(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Ho(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function $f(e,t){const o=[];return Ef(e.logical,t.logical,o),Nf(e.layout,t.layout,o),o}function xf(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 If={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 Sf{constructor(t){Ye(this,"out",[]);Ye(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({...qn(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({...qn(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({...qn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...qn(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({...qn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function qn(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 gt(e,t,o,i){if(o==null||typeof o!="object")return;const a=If[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Qt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ba(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Pt(e,t){var l,r,s,c,d,u,f,p;const o=xf(t),i=new Sf(t.field),a=[...e].sort((m,h)=>m.seq-h.seq);for(const m of a)for(const h of m.ops)switch(o){case"entity":if(h.entityRef!==t.entityRef)break;h.kind==="entity.add"?gt(i,m,h.value,"entity"):h.kind==="entity.update"?Qt(i,m,h.patch):h.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const _=ba((l=h.value)==null?void 0:l.attributes,t.attributeRef);_&>(i,m,_,"attribute")}else h.kind==="attribute.add"&&((r=h.value)==null?void 0:r.modelId)===t.attributeRef?gt(i,m,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===t.attributeRef?Qt(i,m,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===t.attributeRef||h.kind==="entity.remove")&&i.remove(m);break;case"operation":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const _=ba((s=h.value)==null?void 0:s.operations,t.operationRef);_&>(i,m,_,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===t.operationRef?gt(i,m,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===t.operationRef?Qt(i,m,h.patch):(h.kind==="operation.remove"&&h.operationRef===t.operationRef||h.kind==="entity.remove")&&i.remove(m);break;case"index":if(h.entityRef!==t.entityRef)break;if(h.kind==="entity.add"){const _=ba((d=h.value)==null?void 0:d.indexes,t.indexRef);_&>(i,m,_,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===t.indexRef?gt(i,m,h.value,"index"):h.kind==="index.update"&&h.indexRef===t.indexRef?Qt(i,m,h.patch):(h.kind==="index.remove"&&h.indexRef===t.indexRef||h.kind==="entity.remove")&&i.remove(m);break;case"association":if(h.associationRef!==t.associationRef)break;h.kind==="association.add"?gt(i,m,h.value,"association"):h.kind==="association.update"?Qt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(h.associationRef!==t.associationRef)break;if(h.kind==="association.add"){const _=(f=h.value)==null?void 0:f[t.end];gt(i,m,_,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===t.end?Qt(i,m,h.patch):h.kind==="association.remove"&&i.remove(m);break;case"group":if(h.groupRef!==t.groupRef)break;if(h.kind==="group.add"){gt(i,m,h.value,"group");const _=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(_))for(const b of _)i.member(m,b,!1)}else h.kind==="group.update"?Qt(i,m,h.patch):h.kind==="group.remove"?i.remove(m):h.kind==="group.addMember"&&h.entityRef!=null?i.member(m,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(m,h.entityRef,!0);break}return i.result()}function Cf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function kn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Rf(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;kn(c==null?void 0:c.attributes,o),kn(c==null?void 0:c.operations,i),kn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?kn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?kn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?kn([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 Fo(e,t){return e.map(o=>({...o,subject:t}))}function ir(e,t){const o=e.filter(s=>s.ops.some(c=>Cf(c,t))),{attributes:i,operations:a,indexes:l}=Rf(o,t),r=[...Fo(Pt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Fo(Pt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Fo(Pt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Fo(Pt(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 ar(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Vf(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 Af(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 Tf(e){const{entities:t,associations:o,groups:i}=Af(e),a=[];for(const l of t)for(const r of ir(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Pt(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Pt(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Pt(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function lr(e){const t=Tf(e),o=Vf(e),i=new Map;for(const r of t){const s=ar(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=ar(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 _a{constructor(t){Ye(this,"undoStack",[]);Ye(this,"redoStack",[]);Ye(this,"savePoint",null);Ye(this,"listeners",new Set);Ye(this,"commandListeners",new Set);Ye(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 rr(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 ut(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function ze(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function It(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 wa(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=rr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=je(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function sr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=rr(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 cr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=ze(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(ze(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 dr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=ze(i,e);o=a.name,a.name=t},invert(i){ze(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 En(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 ur(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 Xn(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 fr(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=Xn(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 mr(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 pr(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 va(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 Go(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=Xn(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 ka(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function hr(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 yr(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 gr(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 Yo(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 br(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 _r(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 wr(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=Xn(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 vr(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 St(e,t){return{label:`속성 추가: ${t.name}`,apply(o){ze(o,e).attributes.push(t)},invert(o){const i=ze(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 en(e,t,o){const i={},a=l=>{const r=ze(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 Nn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=ze(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&&ze(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 Ea(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=ze(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&&ze(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=ze(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 kr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=ze(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=ze(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 Er(e,t,o){const i={},a=l=>{var s;const r=(s=ze(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 Nr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=ze(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=ze(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 $r(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=ze(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=ze(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(ze(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 xr(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=Xn(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 Na(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 Ir(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 Wo(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 $n(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 Sr(e,t){return{label:"인덱스 추가",apply(o){const i=ze(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=ze(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 Cr(e,t,o){const i={},a=l=>{var s;const r=(s=ze(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 Rr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=ze(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&&ze(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 bt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),jn=(e,t)=>{var o;return((o=ut(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Vr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=ut(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=ut(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=jn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[bt(e,l)],invert:[bt(e,r)]}}}}function Ar(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=ut(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=ut(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=jn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[bt(e,a)],invert:[bt(e,l)]}}}}function Tr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=ut(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=ut(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[bt(e,jn(a,e))],invert:[bt(e,i??[])]}}}}function Mr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=ut(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=ut(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[bt(e,jn(o,e))],invert:[bt(e,t??[])]}}}}function Br(e,t,o){return{label:"waypoint 추가",apply(i){const a=ut(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=ut(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=jn(i,e),l=a.slice();return l.splice(t,1),{forward:[bt(e,a)],invert:[bt(e,l)]}}}}function Dr(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 Or(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 Zn(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 Lr(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 Pr(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 zr(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=Xn(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 Ur(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 Hr(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 zt=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Ko=(e,t,o)=>{var i;return((i=It(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Fr(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 Gr(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 Yr(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=It(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=It(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Ko(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[zt(e,t,r)],invert:[zt(e,t,s)]}}}}function Wr(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=It(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=It(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Ko(a,e,t),r=l.slice();return r.splice(o,1),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function Kr(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=It(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=It(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Ko(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function qr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=It(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=It(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[zt(e,t,Ko(i,e,t))],invert:[zt(e,t,o??[])]}}}}function Ue(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(l=>{if(!l.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${l.label}`);return l.emitOps(i)});return{forward:a.flatMap(l=>l.forward),invert:a.slice().reverse().flatMap(l=>l.invert)}}}}const Mf=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Na,addAttribute:St,addEntity:wa,addEntityToGroup:gr,addGroup:ka,addIndex:Sr,addNote:Dr,addNoteConnection:Fr,addNoteConnectionWaypoint:Wr,addNoteToGroup:Ur,addOperation:kr,addWaypoint:Br,clearNoteConnectionWaypoints:qr,clearWaypoints:Mr,composite:Ue,moveEntity:En,moveGroup:br,moveNote:Zn,moveNoteConnectionWaypoint:Yr,moveWaypoint:Vr,removeAssociation:Ir,removeAttribute:Nn,removeEntity:sr,removeEntityFromGroup:Yo,removeGroup:yr,removeIndex:Rr,removeNote:Or,removeNoteConnection:Gr,removeNoteConnectionWaypoint:Kr,removeNoteFromGroup:Hr,removeOperation:Nr,removeWaypoint:Ar,renameEntity:dr,reorderAttributes:Ea,reorderOperations:$r,resizeEntity:ur,resizeGroup:_r,resizeNote:Lr,setAllEntitiesCollapsed:va,setAttributeSwatch:Go,setEntityCollapsed:mr,setEntityLocked:pr,setEntitySwatch:fr,setGroupLocked:vr,setGroupSwatch:wr,setNoteMemo:Pr,setNoteSwatch:zr,setOperationSwatch:xr,translateWaypoints:Tr,updateAssociation:Wo,updateAssociationEnd:$n,updateAttribute:en,updateEntity:cr,updateGroup:hr,updateIndex:Cr,updateOperation:Er},Symbol.toStringTag,{value:"Module"}));class Xr{constructor(){Ye(this,"revs",new Map);Ye(this,"layoutVersion",0);Ye(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 jr{constructor(t){Ye(this,"cache",new Xr);Ye(this,"newClientOpId");Ye(this,"debounceMs");Ye(this,"emissions",new WeakMap);Ye(this,"open",null);Ye(this,"debounceHandle",null);Ye(this,"queue",[]);Ye(this,"sending",!1);Ye(this,"_frozen",!1);Ye(this,"stack",null);Ye(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Me,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 Zr=["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"],Jr=()=>crypto.randomUUID(),Bf=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Df=e=>e&&e[0].toLowerCase()+e.slice(1),Of=e=>e&&e[0].toUpperCase()+e.slice(1),Lf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Pf(e,t){return Df(e)+Of(t)}function zf(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=Pf(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:Lf(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const qo=(e,t)=>`${e}::${t}`,Xo=e=>e??void 0;function Uf(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||Xo(s.length)!==Xo(l.length)||Xo(s.scale)!==Xo(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 Hf(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 Jn(e,t,o=Jr){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=>zf(e,f)),s=new Map(r.map(f=>[qo(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[qo(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=qo(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=qo(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(Hf(f,u++,o));else{const h=Uf(m,f,o);h&&i.update.push({attributeId:m.modelId,patch:h})}}return i}function Ff(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 Gf(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function Yf(e,t,o=Jr){const i=new Map,a=Gf(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=Jn(a,d,o);if(Bf(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(p=>p.modelId===d);f&&Ff(f,u),l.has(d)||r.push(d)}}return i}function jo(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 Wf(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 Kf(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 Qr(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function ot(e,t){const o=Wf(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 qf(e,t){const o=Kf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Xf(e,t){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 es(e,t){const o=Xf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function jf(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Zf(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Jf(e,t){const o=jf(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 Qf(e,t){const o=Zf(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 ts(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 ns(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),u=[];let f=!1;for(const p of t.fields){const m=d.get(p.name);if(m!=null&&m.sharedColumnPhysicalName){const h={ref:m.sharedColumnPhysicalName,by:"physicalName"},_=es(i,h);if(!_.ok){r.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:h}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:h,matches:_.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,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:u}}function os(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 is(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=es(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 em(e,t,o={}){const i=o.mkId??Me,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,h,_;switch(f.kind){case"entity.add":{const b=i(),g={modelId:b,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}}:{}},I={ref:f.spec.name};let y=!1;for(const[U,X]of(f.spec.attributes??[]).entries()){if(X.type==="GroupCodeEnum"&&!X.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:I,handle:{ref:X.name}}),y=!0;continue}const K=l(X.type);if(K){const W=ns(X,K,U,g,p,I,s,i);W?g.attributes.push(W):y=!0}else(m=X.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:p,entity:I,handle:{ref:X.name}}),y=!0):g.attributes.push(ts(X,U,i))}const N=(f.spec.operations??[]).map((U,X)=>os(U,X,i));N.length&&(g.operations=N);const q=[];for(const U of f.spec.indexes??[]){const X=is(g,U,p,I,s,i);X?q.push(X):y=!0}if(q.length&&(g.indexes=q),y)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:g});break}case"entity.update":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:f.patch});break}case"entity.remove":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.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 g=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,g+1);const I=l(f.spec.type);let y;if(I)y=ns(f.spec,I,g,b.value,p,f.entity,s,i);else if((h=f.spec.embeddableOverrides)!=null&&h.length){s.push({code:"embeddable-type-unresolved",opIndex:p,entity:f.entity,handle:{ref:f.spec.name}});break}else y=ts(f.spec,g,i);if(!y)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:y});break}case"attribute.update":case"attribute.remove":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}const g=qf(b.value,f.attribute);if(!g.ok){s.push(g.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:g.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:g.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:g.value.modelId});break}case"association.add":{const b=ot(e,f.spec.from),g=ot(e,f.spec.to);if(b.ok||s.push(it(b.reason,p,f.spec.from,b.matches,u)),g.ok||s.push(it(g.reason,p,f.spec.to,g.matches,u)),!b.ok||!g.ok)break;if(f.spec.identifying&&b.value.modelId===g.value.modelId){s.push({code:"self-identifying",opIndex:p,handle:{from:f.spec.from,to:f.spec.to}});break}const I=i(),y={modelId:I,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:g.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},N={...e,associations:[...e.associations,y]},q=Jn(N,g.value.modelId,i);q.add[0]&&(y.end2.attributeRef=q.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:I,value:y});for(const U of q.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:g.value.modelId,entityRef:g.value.modelId,value:U});break}case"association.remove":{const b=ot(e,f.association.from),g=ot(e,f.association.to);if(b.ok||s.push(it(b.reason,p,f.association.from,b.matches,u)),g.ok||s.push(it(g.reason,p,f.association.to,g.matches,u)),!b.ok||!g.ok)break;const I=Qr(e,b.value.modelId,g.value.modelId);if(I.length!==1){s.push(I.length===0?{code:"association-not-found",opIndex:p,handle:f.association}:{code:"association-ambiguous",opIndex:p,handle:f.association,matches:I.map(y=>y.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:I[0].modelId});break}case"association.update":{const b=as(e,f.association,p,s,u);if(!b)break;r.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:f.patch});break}case"associationEnd.update":{const b=as(e,f.association,p,s,u);if(!b)break;const g=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:g,patch:f.patch});break}case"index.add":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}const g=is(b.value,f.spec,p,f.entity,s,i);if(!g)break;r.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:g.modelId,value:g});break}case"index.update":case"index.remove":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}const g=Jf(b.value,f.index);if(!g.ok){s.push(g.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:g.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:b.value.modelId,entityRef:b.value.modelId,indexRef:g.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:g.value.modelId});break}case"operation.add":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}const g=d.get(b.value.modelId)??((_=b.value.operations)==null?void 0:_.length)??0;d.set(b.value.modelId,g+1);const I=os(f.spec,g,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:I.modelId,value:I});break}case"operation.update":case"operation.remove":{const b=ot(e,f.entity);if(!b.ok){s.push(it(b.reason,p,f.entity,b.matches,u));break}const g=Qf(b.value,f.operation);if(!g.ok){s.push(g.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:g.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:g.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:g.value.modelId});break}case"group.add":{const b=[];let g=!1;for(const N of f.spec.members){const q=ot(e,N);if(!q.ok){s.push(it(q.reason,p,N,q.matches,u)),g=!0;continue}b.push(q.value.modelId)}if(g)break;const I=i(),y={modelId:I,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...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:I,value:y});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function it(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 as(e,t,o,i,a){const l=ot(e,t.from),r=ot(e,t.to);if(l.ok||i.push(it(l.reason,o,t.from,l.matches,a)),r.ok||i.push(it(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=Qr(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 ls={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},tm={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},nm={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},Zo={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},om={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:{...Zo,description:"속성 설명(다국어)."},columnLogicalName:{...Zo,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},rs={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},im={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...rs,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...rs,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},am={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ls,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},lm={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Zo,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},rm={type:"object",properties:{name:{...Zo,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},sm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function et(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const cm={"entity.add":et("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":et("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":et("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":et("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":et("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":et("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":et("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":et("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":et("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":et("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":et("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":et("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":et("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":et("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":et("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":et("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":et("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},ss={anyOf:Zr.map(e=>cm[e])},dm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ls,assocHandle:tm,entitySpec:nm,attrSpec:om,assocSpec:im,indexSpec:am,operationSpec:lm,groupSpec:rm,patch:sm,symbolicOp:ss}};function um(e,t,o,i={}){const a=i.mkClientOpId??Me,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 cs={location:{x:0,y:0},size:{width:220,height:140}};function ds(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 fm=/^[-=_*~\s]{3,}$/;function mm(e){return e.attrType&&e.attrType!=="NORMAL"||!fm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function pm(e,t){return e.attrType==="DIVIDER"||mm(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,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(ds)}}function hm(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 ym(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 gm(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(pm),operations:(t=e.operations)==null?void 0:t.map(hm),indexes:(o=e.indexes)==null?void 0:o.map(ym),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function bm(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??{...cs},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 us(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 $a(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:us(e)}}function _m(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:$a(e.end1),end2:$a(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 fs(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ms(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ps(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 hs(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(ds)}}function wm(e,t,o){var b,g;const i=fs(e.end1.attribute),a=fs(e.end2.attribute);if(i===a)return _m(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(g=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:g.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((I,y)=>Math.max(I,y.order),-1)+1:s.order??0,p={...hs(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=(I,y)=>({entityRef:I.endModel.refId,multiplicity:I.multiplicity,navigable:I.navigable,composition:I.composition,attributeRef:y?d:p.modelId,legacyNavRaw:y?void 0:I.attribute,jpa:us(I)}),h={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h.end1.attributeRef,targetColumnRef:h.end2.attributeRef,style:e.style};return{assoc:h,layout:_}}function vm(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 km(e,t,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,l=i?e.end2:e.end1,r=a.attribute,s=t.get(l.endModel.refId),c=s?s.attributes.reduce((_,b)=>Math.max(_,b.order),-1)+1:r.order??0,d={...hs(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(_=>vm(_,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...$a(_),legacyEmbedRaw:_.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 Em(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 ys(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=Em(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 Nm(e){return(e.schemaVersion??1)>=2&&"logical"in e?$m(e):xm(e)}function $m(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function xm(e){var g,I;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,N)=>{o.push(gm(y));const q=bm(y);q.geo={location:{x:q.geo.location.x+N.x,y:q.geo.location.y+N.y},size:q.geo.size},i.push(q);for(const U of y.ownedAssociations??[])c.push(U)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const N=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:N.map(U=>U.modelId)});const q=((g=y.geo)==null?void 0:g.location)??u;if(y.geo){const U=(y.notes??[]).map(X=>X.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,locked:y.locked,memberNoteRefs:U.length?U:void 0})}for(const U of N)d(U,q);for(const U of y.notes??[])f.push(ys(U,q))}const p=new Map(o.map(y=>[y.modelId,y])),m=new Map,h=new Map;for(const y of o)for(const N of y.attributes)for(const q of N.dbAttrs)m.set(q.modelId,N.modelId),h.set(q.modelId,q);for(const y of c)for(const N of[y.end1,y.end2]){const q=N.attribute;if(q&&(((I=q.dbAttrs)==null?void 0:I.length)??0)>0)for(const U of q.dbAttrs)U.modelId&&m.set(U.modelId,q.modelId)}for(const y of c){const N=ms(y.end1.attribute),q=ms(y.end2.attribute),U=ps(y.end1)||ps(y.end2),{assoc:X,layout:K}=N!==q||U?km(y,p,h):wm(y,p,m);a.push(X),l.push(K)}const _={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>ys(y)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:b}}function gs(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 Im(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(gs),style:t}}function Sm(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 Cm(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 Ut(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 Rm(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{...gs(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function Vm(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 Am(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 Tm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function Mm(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:Tm(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 Bm(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var h;return((h=m.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,l=t.logical.entities.find(f=>f.modelId===a);if(!l)return;const r=l.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,p)=>Mm(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:Ut(e.end1,c?s:u),end2:Ut(e.end2,c?u:s)}}function Dm(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:Ut(e.end1,e.end1.legacyEmbedRaw),end2:Ut(e.end2,e.end2.legacyEmbedRaw)};const a=Bm(e,t,i);if(a)return a;const l=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(l!==r){const s=l?e.end1:e.end2,c=l?e.end2:e.end1,d=t.logical.entities.find(h=>h.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(h=>h.modelId===s.attributeRef),f=t.logical.entities.find(h=>h.modelId===c.entityRef),p=u?Rm(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ut(e.end1,l?m:p),end2:Ut(e.end2,r?m:p)}}return{...i,end1:Ut(e.end1),end2:Ut(e.end2)}}function bs(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)??{...cs},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 Im(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 Sm(p,(m=l==null?void 0:l.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>Dm(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Cm),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 Om(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=>_s(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>bs(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 _s(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 Lm(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Vm(e),l=Am(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=>bs(s,e,a,l)),groups:e.logical.groups.map(s=>Om(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>_s(s))}}function Pm(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 Qn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ct(e){return typeof e=="function"?e():n.unref(e)}const zm=typeof window<"u"&&typeof document<"u",Um=e=>typeof e<"u",Hm=Object.prototype.toString,Fm=e=>Hm.call(e)==="[object Object]",Gm=()=>{};function Ym(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 ws=e=>e();function Wm(e=ws){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 vs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Km(e,t,o={}){const{eventFilter:i=ws,...a}=o;return n.watch(e,Ym(i,t),a)}function xn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=Wm(i);return{stop:Km(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function qm(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=Ct(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 xa(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:h,throwOnTimeout:_}={}){let b=null;const I=[new Promise(y=>{b=n.watch(e,N=>{f(N)!==t&&(b==null||b(),y(N))},{flush:p,deep:m,immediate:!0})})];return h!=null&&I.push(vs(h,_).then(()=>Ct(e)).finally(()=>b==null?void 0:b())),Promise.race(I)}function i(f,p){if(!n.isRef(f))return o(N=>N===f,p);const{flush:m="sync",deep:h=!1,timeout:_,throwOnTimeout:b}=p??{};let g=null;const y=[new Promise(N=>{g=n.watch([e,f],([q,U])=>{t!==(q===U)&&(g==null||g(),N(q))},{flush:m,deep:h,immediate:!0})})];return _!=null&&y.push(vs(_,b).then(()=>Ct(e)).finally(()=>(g==null||g(),Ct(e)))),Promise.race(y)}function a(f){return o(p=>!!p,f)}function l(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,p){return o(m=>{const h=Array.from(m);return h.includes(f)||h.includes(Ct(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(Ct(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return xa(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return xa(e,!t)}}}function Ia(e){return xa(e)}function Xm(e){var t;const o=Ct(e);return(t=o==null?void 0:o.$el)!=null?t:o}const ks=zm?window:void 0;function Es(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=ks):[t,o,i,a]=e,!t)return Gm;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(()=>[Xm(t),Ct(a)],([u,f])=>{if(r(),!u)return;const p=Fm(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(h=>s(u,m,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Qn(d),d}function jm(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ns(...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=ks,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=jm(t);return Es(a,l,u=>{u.repeat&&Ct(s)||c(u)&&o(u)},r)}function Zm(e){return JSON.parse(JSON.stringify(e))}function Sa(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),h=o||(m==null?void 0:m.emit)||((a=m==null?void 0:m.$emit)==null?void 0:a.bind(m))||((r=(l=m==null?void 0:m.proxy)==null?void 0:l.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let _=d;t||(t="modelValue"),_=_||`update:${t.toString()}`;const b=y=>s?typeof s=="function"?s(y):Zm(y):y,g=()=>Um(e[t])?b(e[t]):f,I=y=>{p?p(y)&&h(_,y):h(_,y)};if(c){const y=g(),N=n.ref(y);let q=!1;return n.watch(()=>e[t],U=>{q||(q=!0,N.value=b(U),n.nextTick(()=>q=!1))}),n.watch(N,U=>{!q&&(U!==e[t]||u)&&I(U)},{deep:u}),N}else return n.computed({get(){return g()},set(y){I(y)}})}var Jm={value:()=>{}};function Jo(){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 Qo(o)}function Qo(e){this._=e}function Qm(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}})}Qo.prototype=Jo.prototype={constructor:Qo,on:function(e,t){var o=this._,i=Qm(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=ep(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]=$s(o[a],e.name,t);else if(t==null)for(a in o)o[a]=$s(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 Qo(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 ep(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function $s(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Jm,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Ca="http://www.w3.org/1999/xhtml";const xs={svg:"http://www.w3.org/2000/svg",xhtml:Ca,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ei(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),xs.hasOwnProperty(t)?{space:xs[t],local:e}:e}function tp(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Ca&&t.documentElement.namespaceURI===Ca?t.createElement(e):t.createElementNS(o,e)}}function np(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Is(e){var t=ei(e);return(t.local?np:tp)(t)}function op(){}function Ra(e){return e==null?op:function(){return this.querySelector(e)}}function ip(e){typeof e!="function"&&(e=Ra(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 st(i,this._parents)}function ap(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lp(){return[]}function Ss(e){return e==null?lp:function(){return this.querySelectorAll(e)}}function rp(e){return function(){return ap(e.apply(this,arguments))}}function sp(e){typeof e=="function"?e=rp(e):e=Ss(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 st(i,a)}function Cs(e){return function(){return this.matches(e)}}function Rs(e){return function(t){return t.matches(e)}}var cp=Array.prototype.find;function dp(e){return function(){return cp.call(this.children,e)}}function up(){return this.firstElementChild}function fp(e){return this.select(e==null?up:dp(typeof e=="function"?e:Rs(e)))}var mp=Array.prototype.filter;function pp(){return Array.from(this.children)}function hp(e){return function(){return mp.call(this.children,e)}}function yp(e){return this.selectAll(e==null?pp:hp(typeof e=="function"?e:Rs(e)))}function gp(e){typeof e!="function"&&(e=Cs(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new st(i,this._parents)}function Vs(e){return new Array(e.length)}function bp(){return new st(this._enter||this._groups.map(Vs),this._parents)}function ti(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ti.prototype={constructor:ti,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 _p(e){return function(){return e}}function wp(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 ti(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function vp(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 ti(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function kp(e){return e.__data__}function Ep(e,t){if(!arguments.length)return Array.from(this,kp);var o=t?vp:wp,i=this._parents,a=this._groups;typeof e!="function"&&(e=_p(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=Np(e.call(u,u&&u.__data__,d,i)),h=m.length,_=s[d]=new Array(h),b=r[d]=new Array(h),g=c[d]=new Array(p);o(u,f,_,b,g,m,t);for(var I=0,y=0,N,q;I<h;++I)if(N=_[I]){for(I>=y&&(y=I+1);!(q=b[y])&&++y<h;);N._next=q||null}}return r=new st(r,i),r._enter=s,r._exit=c,r}function Np(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $p(){return new st(this._exit||this._groups.map(Vs),this._parents)}function xp(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 Ip(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new st(s,this._parents)}function Sp(){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 Cp(e){e||(e=Rp);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 st(a,this._parents).order()}function Rp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Vp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ap(){return Array.from(this)}function Tp(){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 Mp(){let e=0;for(const t of this)++e;return e}function Bp(){return!this.node()}function Dp(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 Op(e){return function(){this.removeAttribute(e)}}function Lp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pp(e,t){return function(){this.setAttribute(e,t)}}function zp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Up(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Hp(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Fp(e,t){var o=ei(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?Lp:Op:typeof t=="function"?o.local?Hp:Up:o.local?zp:Pp)(o,t))}function As(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Gp(e){return function(){this.style.removeProperty(e)}}function Yp(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Wp(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Kp(e,t,o){return arguments.length>1?this.each((t==null?Gp:typeof t=="function"?Wp:Yp)(e,t,o??"")):In(this.node(),e)}function In(e,t){return e.style.getPropertyValue(t)||As(e).getComputedStyle(e,null).getPropertyValue(t)}function qp(e){return function(){delete this[e]}}function Xp(e,t){return function(){this[e]=t}}function jp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Zp(e,t){return arguments.length>1?this.each((t==null?qp:typeof t=="function"?jp:Xp)(e,t)):this.node()[e]}function Ts(e){return e.trim().split(/^|\s+/)}function Va(e){return e.classList||new Ms(e)}function Ms(e){this._node=e,this._names=Ts(e.getAttribute("class")||"")}Ms.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 Bs(e,t){for(var o=Va(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Ds(e,t){for(var o=Va(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Jp(e){return function(){Bs(this,e)}}function Qp(e){return function(){Ds(this,e)}}function eh(e,t){return function(){(t.apply(this,arguments)?Bs:Ds)(this,e)}}function th(e,t){var o=Ts(e+"");if(arguments.length<2){for(var i=Va(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?eh:t?Jp:Qp)(o,t))}function nh(){this.textContent=""}function oh(e){return function(){this.textContent=e}}function ih(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ah(e){return arguments.length?this.each(e==null?nh:(typeof e=="function"?ih:oh)(e)):this.node().textContent}function lh(){this.innerHTML=""}function rh(e){return function(){this.innerHTML=e}}function sh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function ch(e){return arguments.length?this.each(e==null?lh:(typeof e=="function"?sh:rh)(e)):this.node().innerHTML}function dh(){this.nextSibling&&this.parentNode.appendChild(this)}function uh(){return this.each(dh)}function fh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mh(){return this.each(fh)}function ph(e){var t=typeof e=="function"?e:Is(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function hh(){return null}function yh(e,t){var o=typeof e=="function"?e:Is(e),i=t==null?hh:typeof t=="function"?t:Ra(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function gh(){var e=this.parentNode;e&&e.removeChild(this)}function bh(){return this.each(gh)}function _h(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function wh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vh(e){return this.select(e?wh:_h)}function kh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Eh(e){return function(t){e.call(this,t,this.__data__)}}function Nh(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 $h(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 xh(e,t,o){return function(){var i=this.__on,a,l=Eh(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 Ih(e,t,o){var i=Nh(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?xh:$h,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Os(e,t,o){var i=As(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 Sh(e,t){return function(){return Os(this,e,t)}}function Ch(e,t){return function(){return Os(this,e,t.apply(this,arguments))}}function Rh(e,t){return this.each((typeof t=="function"?Ch:Sh)(e,t))}function*Vh(){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 Ls=[null];function st(e,t){this._groups=e,this._parents=t}function eo(){return new st([[document.documentElement]],Ls)}function Ah(){return this}st.prototype=eo.prototype={constructor:st,select:ip,selectAll:sp,selectChild:fp,selectChildren:yp,filter:gp,data:Ep,enter:bp,exit:$p,join:xp,merge:Ip,selection:Ah,order:Sp,sort:Cp,call:Vp,nodes:Ap,node:Tp,size:Mp,empty:Bp,each:Dp,attr:Fp,style:Kp,property:Zp,classed:th,text:ah,html:ch,raise:uh,lower:mh,append:ph,insert:yh,remove:bh,clone:vh,datum:kh,on:Ih,dispatch:Rh,[Symbol.iterator]:Vh};function ft(e){return typeof e=="string"?new st([[document.querySelector(e)]],[document.documentElement]):new st([[e]],Ls)}function Th(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _t(e,t){if(e=Th(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 Mh={passive:!1},to={capture:!0,passive:!1};function Aa(e){e.stopImmediatePropagation()}function Sn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ps(e){var t=e.document.documentElement,o=ft(e).on("dragstart.drag",Sn,to);"onselectstart"in t?o.on("selectstart.drag",Sn,to):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zs(e,t){var o=e.document.documentElement,i=ft(e).on("dragstart.drag",null);t&&(i.on("click.drag",Sn,to),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 Ta(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}})}Ta.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bh(e){return!e.ctrlKey&&!e.button}function Dh(){return this.parentNode}function Oh(e,t){return t??{x:e.x,y:e.y}}function Lh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ph(){var e=Bh,t=Dh,o=Oh,i=Lh,a={},l=Jo("start","drag","end"),r=0,s,c,d,u,f=0;function p(N){N.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",g,Mh).on("touchend.drag touchcancel.drag",I).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,q){if(!(u||!e.call(this,N,q))){var U=y(this,t.call(this,N,q),N,q,"mouse");U&&(ft(N.view).on("mousemove.drag",h,to).on("mouseup.drag",_,to),Ps(N.view),Aa(N),d=!1,s=N.clientX,c=N.clientY,U("start",N))}}function h(N){if(Sn(N),!d){var q=N.clientX-s,U=N.clientY-c;d=q*q+U*U>f}a.mouse("drag",N)}function _(N){ft(N.view).on("mousemove.drag mouseup.drag",null),zs(N.view,d),Sn(N),a.mouse("end",N)}function b(N,q){if(e.call(this,N,q)){var U=N.changedTouches,X=t.call(this,N,q),K=U.length,W,ne;for(W=0;W<K;++W)(ne=y(this,X,N,q,U[W].identifier,U[W]))&&(Aa(N),ne("start",N,U[W]))}}function g(N){var q=N.changedTouches,U=q.length,X,K;for(X=0;X<U;++X)(K=a[q[X].identifier])&&(Sn(N),K("drag",N,q[X]))}function I(N){var q=N.changedTouches,U=q.length,X,K;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),X=0;X<U;++X)(K=a[q[X].identifier])&&(Aa(N),K("end",N,q[X]))}function y(N,q,U,X,K,W){var ne=l.copy(),re=_t(W||U,q),L,Q,v;if((v=o.call(N,new Ta("beforestart",{sourceEvent:U,target:p,identifier:K,active:r,x:re[0],y:re[1],dx:0,dy:0,dispatch:ne}),X))!=null)return L=v.x-re[0]||0,Q=v.y-re[1]||0,function T($,P,H){var te=re,M;switch($){case"start":a[K]=T,M=r++;break;case"end":delete a[K],--r;case"drag":re=_t(H||P,q),M=r;break}ne.call($,N,new Ta($,{sourceEvent:P,subject:v,target:p,identifier:K,active:M,x:re[0]+L,y:re[1]+Q,dx:re[0]-te[0],dy:re[1]-te[1],dispatch:ne}),X)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ni(!!N),p):e},p.container=function(N){return arguments.length?(t=typeof N=="function"?N:ni(N),p):t},p.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ni(N),p):o},p.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ni(!!N),p):i},p.on=function(){var N=l.on.apply(l,arguments);return N===l?p:N},p.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,p):Math.sqrt(f)},p}function Ma(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Us(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function no(){}var oo=.7,oi=1/oo,Cn="\\s*([+-]?\\d+)\\s*",io="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zh=/^#([0-9a-f]{3,8})$/,Uh=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),Hh=new RegExp(`^rgb\\(${wt},${wt},${wt}\\)$`),Fh=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${io}\\)$`),Gh=new RegExp(`^rgba\\(${wt},${wt},${wt},${io}\\)$`),Yh=new RegExp(`^hsl\\(${io},${wt},${wt}\\)$`),Wh=new RegExp(`^hsla\\(${io},${wt},${wt},${io}\\)$`),Hs={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};Ma(no,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fs,formatHex:Fs,formatHex8:Kh,formatHsl:qh,formatRgb:Gs,toString:Gs});function Fs(){return this.rgb().formatHex()}function Kh(){return this.rgb().formatHex8()}function qh(){return Xs(this).formatHsl()}function Gs(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=zh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ys(t):o===3?new at(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=Uh.exec(e))?new at(t[1],t[2],t[3],1):(t=Hh.exec(e))?new at(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Fh.exec(e))?ii(t[1],t[2],t[3],t[4]):(t=Gh.exec(e))?ii(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Yh.exec(e))?qs(t[1],t[2]/100,t[3]/100,1):(t=Wh.exec(e))?qs(t[1],t[2]/100,t[3]/100,t[4]):Hs.hasOwnProperty(e)?Ys(Hs[e]):e==="transparent"?new at(NaN,NaN,NaN,0):null}function Ys(e){return new at(e>>16&255,e>>8&255,e&255,1)}function ii(e,t,o,i){return i<=0&&(e=t=o=NaN),new at(e,t,o,i)}function Xh(e){return e instanceof no||(e=tn(e)),e?(e=e.rgb(),new at(e.r,e.g,e.b,e.opacity)):new at}function Ba(e,t,o,i){return arguments.length===1?Xh(e):new at(e,t,o,i??1)}function at(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Ma(at,Ba,Us(no,{brighter(e){return e=e==null?oi:Math.pow(oi,e),new at(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new at(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new at(nn(this.r),nn(this.g),nn(this.b),ai(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:Ws,formatHex:Ws,formatHex8:jh,formatRgb:Ks,toString:Ks}));function Ws(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function jh(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ks(){const e=ai(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function ai(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function on(e){return e=nn(e),(e<16?"0":"")+e.toString(16)}function qs(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new mt(e,t,o,i)}function Xs(e){if(e instanceof mt)return new mt(e.h,e.s,e.l,e.opacity);if(e instanceof no||(e=tn(e)),!e)return new mt;if(e instanceof mt)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 mt(r,s,c,e.opacity)}function Zh(e,t,o,i){return arguments.length===1?Xs(e):new mt(e,t,o,i??1)}function mt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Ma(mt,Zh,Us(no,{brighter(e){return e=e==null?oi:Math.pow(oi,e),new mt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new mt(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 at(Da(e>=240?e-240:e+120,a,i),Da(e,a,i),Da(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new mt(js(this.h),li(this.s),li(this.l),ai(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=ai(this.opacity);return`${e===1?"hsl(":"hsla("}${js(this.h)}, ${li(this.s)*100}%, ${li(this.l)*100}%${e===1?")":`, ${e})`}`}}));function js(e){return e=(e||0)%360,e<0?e+360:e}function li(e){return Math.max(0,Math.min(1,e||0))}function Da(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 Oa=e=>()=>e;function Jh(e,t){return function(o){return e+o*t}}function Qh(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 ey(e){return(e=+e)==1?Zs:function(t,o){return o-t?Qh(t,o,e):Oa(isNaN(t)?o:t)}}function Zs(e,t){var o=t-e;return o?Jh(e,o):Oa(isNaN(e)?t:e)}const ri=(function e(t){var o=ey(t);function i(a,l){var r=o((a=Ba(a)).r,(l=Ba(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Zs(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 ty(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 ny(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function oy(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]=ao(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 iy(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function vt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function ay(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]=ao(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var La=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pa=new RegExp(La.source,"g");function ly(e){return function(){return e}}function ry(e){return function(t){return e(t)+""}}function Js(e,t){var o=La.lastIndex=Pa.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=La.exec(e))&&(a=Pa.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:vt(i,a)})),o=Pa.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?ry(c[0].x):ly(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 ao(e,t){var o=typeof t,i;return t==null||o==="boolean"?Oa(t):(o==="number"?vt:o==="string"?(i=tn(t))?(t=i,ri):Js:t instanceof tn?ri:t instanceof Date?iy:ny(t)?ty:Array.isArray(t)?oy:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ay:vt)(e,t)}var Qs=180/Math.PI,za={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ec(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)*Qs,skewX:Math.atan(c)*Qs,scaleX:r,scaleY:s}}var si;function sy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?za:ec(t.a,t.b,t.c,t.d,t.e,t.f)}function cy(e){return e==null||(si||(si=document.createElementNS("http://www.w3.org/2000/svg","g")),si.setAttribute("transform",e),!(e=si.transform.baseVal.consolidate()))?za:(e=e.matrix,ec(e.a,e.b,e.c,e.d,e.e,e.f))}function tc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);h.push({i:_-4,x:vt(d,f)},{i:_-2,x:vt(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:vt(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:vt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var _=m.push(a(m)+"scale(",null,",",null,")");h.push({i:_-4,x:vt(d,f)},{i:_-2,x:vt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,_=p.length,b;++h<_;)f[(b=p[h]).i]=b.x(m);return f.join("")}}}var dy=tc(sy,"px, ","px)","deg)"),uy=tc(cy,", ",")",")"),fy=1e-12;function nc(e){return((e=Math.exp(e))+1/e)/2}function my(e){return((e=Math.exp(e))-1/e)/2}function py(e){return((e=Math.exp(2*e))-1)/(e+1)}const ci=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,_=m*m+h*h,b,g;if(_<fy)g=Math.log(p/d)/t,b=function(X){return[s+X*m,c+X*h,d*Math.exp(t*X*g)]};else{var I=Math.sqrt(_),y=(p*p-d*d+i*_)/(2*d*o*I),N=(p*p-d*d-i*_)/(2*p*o*I),q=Math.log(Math.sqrt(y*y+1)-y),U=Math.log(Math.sqrt(N*N+1)-N);g=(U-q)/t,b=function(X){var K=X*g,W=nc(q),ne=d/(o*I)*(W*py(t*K+q)-my(q));return[s+ne*m,c+ne*h,d*W/nc(t*K+q)]}}return b.duration=g*1e3*t/Math.SQRT2,b}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 Rn=0,lo=0,ro=0,oc=1e3,di,so,ui=0,an=0,fi=0,co=typeof performance=="object"&&performance.now?performance:Date,ic=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ua(){return an||(ic(hy),an=co.now()+fi)}function hy(){an=0}function mi(){this._call=this._time=this._next=null}mi.prototype=ac.prototype={constructor:mi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ua():+o)+(t==null?0:+t),!this._next&&so!==this&&(so?so._next=this:di=this,so=this),this._call=e,this._time=o,Ha()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ha())}};function ac(e,t,o){var i=new mi;return i.restart(e,t,o),i}function yy(){Ua(),++Rn;for(var e=di,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rn}function lc(){an=(ui=co.now())+fi,Rn=lo=0;try{yy()}finally{Rn=0,by(),an=0}}function gy(){var e=co.now(),t=e-ui;t>oc&&(fi-=t,ui=e)}function by(){for(var e,t=di,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:di=o);so=e,Ha(i)}function Ha(e){if(!Rn){lo&&(lo=clearTimeout(lo));var t=e-an;t>24?(e<1/0&&(lo=setTimeout(lc,e-co.now()-fi)),ro&&(ro=clearInterval(ro))):(ro||(ui=co.now(),ro=setInterval(gy,oc)),Rn=1,ic(lc))}}function rc(e,t,o){var i=new mi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var _y=Jo("start","end","cancel","interrupt"),wy=[],sc=0,cc=1,Fa=2,pi=3,dc=4,Ga=5,hi=6;function yi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;vy(e,o,{name:t,index:i,group:a,on:_y,tween:wy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:sc})}function Ya(e,t){var o=pt(e,t);if(o.state>sc)throw new Error("too late; already scheduled");return o}function kt(e,t){var o=pt(e,t);if(o.state>pi)throw new Error("too late; already running");return o}function pt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function vy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=ac(l,0,o.time);function l(d){o.state=cc,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!==cc)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===pi)return rc(r);m.state===dc?(m.state=hi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=hi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(rc(function(){o.state===pi&&(o.state=dc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Fa,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Fa){for(o.state=pi,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=Ga,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Ga&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=hi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function gi(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>Fa&&i.state<Ga,i.state=hi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function ky(e){return this.each(function(){gi(this,e)})}function Ey(e,t){var o,i;return function(){var a=kt(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 Ny(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=kt(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 $y(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=pt(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?Ey:Ny)(o,e,t))}function Wa(e,t,o){var i=e._id;return e.each(function(){var a=kt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return pt(a,i).value[t]}}function uc(e,t){var o;return(typeof t=="number"?vt:t instanceof tn?ri:(o=tn(t))?(t=o,ri):Js)(e,t)}function xy(e){return function(){this.removeAttribute(e)}}function Iy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sy(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 Cy(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 Ry(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 Vy(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 Ay(e,t){var o=ei(e),i=o==="transform"?uy:uc;return this.attrTween(e,typeof t=="function"?(o.local?Vy:Ry)(o,i,Wa(this,"attr."+e,t)):t==null?(o.local?Iy:xy)(o):(o.local?Cy:Sy)(o,i,t))}function Ty(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function My(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function By(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&My(e,l)),o}return a._value=t,a}function Dy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Ty(e,l)),o}return a._value=t,a}function Oy(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=ei(e);return this.tween(o,(i.local?By:Dy)(i,t))}function Ly(e,t){return function(){Ya(this,e).delay=+t.apply(this,arguments)}}function Py(e,t){return t=+t,function(){Ya(this,e).delay=t}}function zy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ly:Py)(t,e)):pt(this.node(),t).delay}function Uy(e,t){return function(){kt(this,e).duration=+t.apply(this,arguments)}}function Hy(e,t){return t=+t,function(){kt(this,e).duration=t}}function Fy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uy:Hy)(t,e)):pt(this.node(),t).duration}function Gy(e,t){if(typeof t!="function")throw new Error;return function(){kt(this,e).ease=t}}function Yy(e){var t=this._id;return arguments.length?this.each(Gy(t,e)):pt(this.node(),t).ease}function Wy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;kt(this,e).ease=o}}function Ky(e){if(typeof e!="function")throw new Error;return this.each(Wy(this._id,e))}function qy(e){typeof e!="function"&&(e=Cs(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 Rt(i,this._parents,this._name,this._id)}function Xy(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 Rt(r,this._parents,this._name,this._id)}function jy(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 Zy(e,t,o){var i,a,l=jy(t)?Ya:kt;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Jy(e,t){var o=this._id;return arguments.length<2?pt(this.node(),o).on.on(e):this.each(Zy(o,e,t))}function Qy(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function eg(){return this.on("end.remove",Qy(this._id))}function tg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Ra(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,yi(d[p],t,o,p,d,pt(u,o)));return new Rt(l,this._parents,t,o)}function ng(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Ss(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=pt(u,o),_=0,b=p.length;_<b;++_)(m=p[_])&&yi(m,t,o,_,p,h);l.push(p),r.push(u)}return new Rt(l,r,t,o)}var og=eo.prototype.constructor;function ig(){return new og(this._groups,this._parents)}function ag(e,t){var o,i,a;return function(){var l=In(this,e),r=(this.style.removeProperty(e),In(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function fc(e){return function(){this.style.removeProperty(e)}}function lg(e,t,o){var i,a=o+"",l;return function(){var r=In(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function rg(e,t,o){var i,a,l;return function(){var r=In(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),In(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function sg(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=kt(this,e),d=c.on,u=c.value[l]==null?s||(s=fc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function cg(e,t,o){var i=(e+="")=="transform"?dy:uc;return t==null?this.styleTween(e,ag(e,i)).on("end.style."+e,fc(e)):typeof t=="function"?this.styleTween(e,rg(e,i,Wa(this,"style."+e,t))).each(sg(this._id,e)):this.styleTween(e,lg(e,i,t),o).on("end.style."+e,null)}function dg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function ug(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&dg(e,r,o)),i}return l._value=t,l}function fg(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,ug(e,t,o??""))}function mg(e){return function(){this.textContent=e}}function pg(e){return function(){var t=e(this);this.textContent=t??""}}function hg(e){return this.tween("text",typeof e=="function"?pg(Wa(this,"text",e)):mg(e==null?"":e+""))}function yg(e){return function(t){this.textContent=e.call(this,t)}}function gg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&yg(a)),t}return i._value=e,i}function bg(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,gg(e))}function _g(){for(var e=this._name,t=this._id,o=mc(),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=pt(c,t);yi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Rt(i,this._parents,e,o)}function wg(){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=kt(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 vg=0;function Rt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function mc(){return++vg}var Vt=eo.prototype;Rt.prototype={constructor:Rt,select:tg,selectAll:ng,selectChild:Vt.selectChild,selectChildren:Vt.selectChildren,filter:qy,merge:Xy,selection:ig,transition:_g,call:Vt.call,nodes:Vt.nodes,node:Vt.node,size:Vt.size,empty:Vt.empty,each:Vt.each,on:Jy,attr:Ay,attrTween:Oy,style:cg,styleTween:fg,text:hg,textTween:bg,remove:eg,tween:$y,delay:zy,duration:Fy,ease:Yy,easeVarying:Ky,end:wg,[Symbol.iterator]:Vt[Symbol.iterator]};function kg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eg={time:null,delay:0,duration:250,ease:kg};function Ng(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 $g(e){var t,o;e instanceof Rt?(t=e._id,e=e._name):(t=mc(),(o=Eg).time=Ua(),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])&&yi(c,e,t,d,r,o||Ng(c,t));return new Rt(i,this._parents,e,t)}eo.prototype.interrupt=ky,eo.prototype.transition=$g;const bi=e=>()=>e;function xg(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 At(e,t,o){this.k=e,this.x=t,this.y=o}At.prototype={constructor:At,scale:function(e){return e===1?this:new At(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new At(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 Vn=new At(1,0,0);At.prototype;function Ka(e){e.stopImmediatePropagation()}function uo(e){e.preventDefault(),e.stopImmediatePropagation()}function Ig(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Sg(){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 pc(){return this.__zoom||Vn}function Cg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Rg(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vg(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 Ag(){var e=Ig,t=Sg,o=Vg,i=Cg,a=Rg,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ci,d=Jo("start","zoom","end"),u,f,p,m=500,h=150,_=0,b=10;function g(v){v.property("__zoom",pc).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(v,T,$,P){var H=v.selection?v.selection():v;H.property("__zoom",pc),v!==H?q(v,T,$,P):H.interrupt().each(function(){U(this,arguments).event(P).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(v,T,$,P){g.scaleTo(v,function(){var H=this.__zoom.k,te=typeof T=="function"?T.apply(this,arguments):T;return H*te},$,P)},g.scaleTo=function(v,T,$,P){g.transform(v,function(){var H=t.apply(this,arguments),te=this.__zoom,M=$==null?N(H):typeof $=="function"?$.apply(this,arguments):$,ee=te.invert(M),le=typeof T=="function"?T.apply(this,arguments):T;return o(y(I(te,le),M,ee),H,r)},$,P)},g.translateBy=function(v,T,$,P){g.transform(v,function(){return o(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),r)},null,P)},g.translateTo=function(v,T,$,P,H){g.transform(v,function(){var te=t.apply(this,arguments),M=this.__zoom,ee=P==null?N(te):typeof P=="function"?P.apply(this,arguments):P;return o(Vn.translate(ee[0],ee[1]).scale(M.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof $=="function"?-$.apply(this,arguments):-$),te,r)},P,H)};function I(v,T){return T=Math.max(l[0],Math.min(l[1],T)),T===v.k?v:new At(T,v.x,v.y)}function y(v,T,$){var P=T[0]-$[0]*v.k,H=T[1]-$[1]*v.k;return P===v.x&&H===v.y?v:new At(v.k,P,H)}function N(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function q(v,T,$,P){v.on("start.zoom",function(){U(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){U(this,arguments).event(P).end()}).tween("zoom",function(){var H=this,te=arguments,M=U(H,te).event(P),ee=t.apply(H,te),le=$==null?N(ee):typeof $=="function"?$.apply(H,te):$,me=Math.max(ee[1][0]-ee[0][0],ee[1][1]-ee[0][1]),ye=H.__zoom,ce=typeof T=="function"?T.apply(H,te):T,ue=c(ye.invert(le).concat(me/ye.k),ce.invert(le).concat(me/ce.k));return function(he){if(he===1)he=ce;else{var ve=ue(he),Se=me/ve[2];he=new At(Se,le[0]-ve[0]*Se,le[1]-ve[1]*Se)}M.zoom(null,he)}})}function U(v,T,$){return!$&&v.__zooming||new X(v,T)}function X(v,T){this.that=v,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,T),this.taps=0}X.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,T){return this.mouse&&v!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var T=ft(this.that).datum();d.call(v,this.that,new xg(v,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),T)}};function K(v,...T){if(!e.apply(this,arguments))return;var $=U(this,T).event(v),P=this.__zoom,H=Math.max(l[0],Math.min(l[1],P.k*Math.pow(2,i.apply(this,arguments)))),te=_t(v);if($.wheel)($.mouse[0][0]!==te[0]||$.mouse[0][1]!==te[1])&&($.mouse[1]=P.invert($.mouse[0]=te)),clearTimeout($.wheel);else{if(P.k===H)return;$.mouse=[te,P.invert(te)],gi(this),$.start()}uo(v),$.wheel=setTimeout(M,h),$.zoom("mouse",o(y(I(P,H),$.mouse[0],$.mouse[1]),$.extent,r));function M(){$.wheel=null,$.end()}}function W(v,...T){if(p||!e.apply(this,arguments))return;var $=v.currentTarget,P=U(this,T,!0).event(v),H=ft(v.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),te=_t(v,$),M=v.clientX,ee=v.clientY;Ps(v.view),Ka(v),P.mouse=[te,this.__zoom.invert(te)],gi(this),P.start();function le(ye){if(uo(ye),!P.moved){var ce=ye.clientX-M,ue=ye.clientY-ee;P.moved=ce*ce+ue*ue>_}P.event(ye).zoom("mouse",o(y(P.that.__zoom,P.mouse[0]=_t(ye,$),P.mouse[1]),P.extent,r))}function me(ye){H.on("mousemove.zoom mouseup.zoom",null),zs(ye.view,P.moved),uo(ye),P.event(ye).end()}}function ne(v,...T){if(e.apply(this,arguments)){var $=this.__zoom,P=_t(v.changedTouches?v.changedTouches[0]:v,this),H=$.invert(P),te=$.k*(v.shiftKey?.5:2),M=o(y(I($,te),P,H),t.apply(this,T),r);uo(v),s>0?ft(this).transition().duration(s).call(q,M,P,v):ft(this).call(g.transform,M,P,v)}}function re(v,...T){if(e.apply(this,arguments)){var $=v.touches,P=$.length,H=U(this,T,v.changedTouches.length===P).event(v),te,M,ee,le;for(Ka(v),M=0;M<P;++M)ee=$[M],le=_t(ee,this),le=[le,this.__zoom.invert(le),ee.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,te=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),gi(this),H.start())}}function L(v,...T){if(this.__zooming){var $=U(this,T).event(v),P=v.changedTouches,H=P.length,te,M,ee,le;for(uo(v),te=0;te<H;++te)M=P[te],ee=_t(M,this),$.touch0&&$.touch0[2]===M.identifier?$.touch0[0]=ee:$.touch1&&$.touch1[2]===M.identifier&&($.touch1[0]=ee);if(M=$.that.__zoom,$.touch1){var me=$.touch0[0],ye=$.touch0[1],ce=$.touch1[0],ue=$.touch1[1],he=(he=ce[0]-me[0])*he+(he=ce[1]-me[1])*he,ve=(ve=ue[0]-ye[0])*ve+(ve=ue[1]-ye[1])*ve;M=I(M,Math.sqrt(he/ve)),ee=[(me[0]+ce[0])/2,(me[1]+ce[1])/2],le=[(ye[0]+ue[0])/2,(ye[1]+ue[1])/2]}else if($.touch0)ee=$.touch0[0],le=$.touch0[1];else return;$.zoom("touch",o(y(M,ee,le),$.extent,r))}}function Q(v,...T){if(this.__zooming){var $=U(this,T).event(v),P=v.changedTouches,H=P.length,te,M;for(Ka(v),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),te=0;te<H;++te)M=P[te],$.touch0&&$.touch0[2]===M.identifier?delete $.touch0:$.touch1&&$.touch1[2]===M.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(M=_t(M,this),Math.hypot(f[0]-M[0],f[1]-M[1])<b)){var ee=ft(this).on("dblclick.zoom");ee&&ee.apply(this,arguments)}}}return g.wheelDelta=function(v){return arguments.length?(i=typeof v=="function"?v:bi(+v),g):i},g.filter=function(v){return arguments.length?(e=typeof v=="function"?v:bi(!!v),g):e},g.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:bi(!!v),g):a},g.extent=function(v){return arguments.length?(t=typeof v=="function"?v:bi([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),g):t},g.scaleExtent=function(v){return arguments.length?(l[0]=+v[0],l[1]=+v[1],g):[l[0],l[1]]},g.translateExtent=function(v){return arguments.length?(r[0][0]=+v[0][0],r[1][0]=+v[1][0],r[0][1]=+v[0][1],r[1][1]=+v[1][1],g):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},g.constrain=function(v){return arguments.length?(o=v,g):o},g.duration=function(v){return arguments.length?(s=+v,g):s},g.interpolate=function(v){return arguments.length?(c=v,g):c},g.on=function(){var v=d.on.apply(d,arguments);return v===d?g:v},g.clickDistance=function(v){return arguments.length?(_=(v=+v)*v,g):Math.sqrt(_)},g.tapDistance=function(v){return arguments.length?(b=+v,g):b},g}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),qa=(e=>(e.Partial="partial",e.Full="full",e))(qa||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Tt=(e=>(e.Strict="strict",e.Loose="loose",e))(Tt||{}),Xa=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Xa||{}),fo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(fo||{}),hc=(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))(hc||{});const Tg=["INPUT","SELECT","TEXTAREA"],Mg=typeof document<"u"?document:null;function ja(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 Tg.includes(i==null?void 0:i.nodeName)||a||!!l}function Bg(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function yc(e,t,o,i){const a=t.replace("+",`
|
|
1
|
+
(function(ve,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):(ve=typeof globalThis<"u"?globalThis:ve||self,n(ve.EntityModeler={},ve.Vue,ve.OpenBlueseaCore))})(this,(function(ve,n,ie){"use strict";var QS=Object.defineProperty;var eC=(ve,n,ie)=>n in ve?QS(ve,n,{enumerable:!0,configurable:!0,writable:!0,value:ie}):ve[n]=ie;var We=(ve,n,ie)=>eC(ve,typeof n!="symbol"?n+"":n,ie);const nf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function of(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 jl(e,t,o={}){const i={...nf,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),l=new Map(e.associations.map(g=>[g.modelId,g])),r=new Map(t.entityLayouts.map(g=>[g.entityRef,g])),s=new Map(t.associationLayouts.map(g=>[g.associationRef,g])),c=t.entityLayouts.map(g=>g.entityRef).filter(g=>!a.has(g)),d=t.associationLayouts.map(g=>g.associationRef).filter(g=>!l.has(g)),u=new Map;for(const g of e.groups)for(const N of g.memberEntityRefs)u.set(N,g.modelId);const f=new Map;for(const g of t.groupLayouts)for(const N of g.memberNoteRefs??[])f.set(N,g.groupRef);let h=0;const m=e.entities.map(g=>{const N=u.get(g.modelId),te=r.get(g.modelId);if(te){const O={location:{x:te.geo.location.x,y:te.geo.location.y},size:{width:te.geo.size.width,height:te.geo.size.height}};return{entity:g,geo:O,collapsed:te.collapsed??!1,locked:te.locked??!1,groupRef:N,style:te.style,attributeStyles:te.attributeStyles,operationStyles:te.operationStyles}}const S=of(h++,i);return{entity:g,geo:S,collapsed:!1,locked:!1,groupRef:N}}),p=new Map(t.groupLayouts.map(g=>[g.groupRef,g])),y=e.groups.map(g=>{const N=p.get(g.modelId),te=N?{location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:te,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),b=e.associations.map(g=>{const N=s.get(g.modelId);return{association:g,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),_=t.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:f.get(g.modelId)})),A=[];for(const g of t.notes)for(const N of g.connections??[])a.has(N.targetRef)&&A.push({noteRef:g.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(te=>({x:te.x,y:te.y}))});return{entities:m,associations:b,groups:y,notes:_,noteConnections:A,prunedEntityRefs:c,prunedAssociationRefs:d}}function Wn(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 wn=.5;function Zl(e,t,o,i,a,l){const r=Wn(t),s=Wn(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 h=e;const m=(b,_)=>{(Math.abs(b.x-h.x)>=wn||Math.abs(b.y-h.y)>=wn)&&(f.push({a:h,b,seg:_}),h=b)};m(c,0);let p=r.x!==0,y=c;for(let b=1;b<u.length;b++){const _=u[b],A=b<=o.length?b-1:o.length,g=Math.abs(_.x-y.x)<wn,N=Math.abs(_.y-y.y)<wn;g&&N||(g?(m(_,A),p=!1):N?(m(_,A),p=!0):p?(m({x:y.x,y:_.y},A),m(_,A),p=!0):(m({x:_.x,y:y.y},A),m(_,A),p=!1),y=_)}return m(i,o.length),f}function da(e,t,o,i,a,l=20){const r=Zl(e,t,o,i,a,l);let s=`M ${ot(e.x)},${ot(e.y)}`;for(const c of r)s+=` L ${ot(c.b.x)},${ot(c.b.y)}`;return s}const af=14;function ua(e,t,o,i,a,l=20){return Zl(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=af).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function ot(e){return Math.round(e*100)/100}const lf=36;function Jl(e,t,o=lf){const i=Math.max(e.x,t.x)+o;return`M ${ot(e.x)},${ot(e.y)} L ${ot(i)},${ot(e.y)} L ${ot(i)},${ot(t.y)} L ${ot(t.x)},${ot(t.y)}`}function fa(e,t,o){const i=[e,...t,o];let a=`M ${ot(i[0].x)},${ot(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${ot(i[l].x)},${ot(i[l].y)}`;return a}function rf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ma(e,t){const o=rf(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<wn&&Math.abs(r)<wn)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 pa(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 ha(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 sf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ql(e,t,o={}){const i={...sf,...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),h=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 p=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((y,b)=>{const _=b%p,A=Math.floor(b/p);l.push({id:y,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+A*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 h=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);l.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+m*i.cellHeight}})}),l}const er={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function tr(e,t={}){const o={...er,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function cf(e,t={}){const o={...er,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=tr(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}}})}function Fo(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 or(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,p)=>m.order-p.order);for(const m of f){if(m.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const p=m.dbAttrs[0],y=p!=null&&p.length?`(${p.length}${p.scale!=null?`,${p.scale}`:""})`:"",b=p?` → ${p.physicalName} ${p.dataType}${y}`:"",_=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",p!=null&&p.unique?"UNIQUE":"",p!=null&&p.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${m.name}: ${m.type}${b}${_.length?` {${_.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const p=m.columns.map(y=>`${o.get(y.columnRef)??y.columnRef}${y.descending?" DESC":""}`).join(", ");a.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${p}`)}const h=[...c.operations??[]].sort((m,p)=>m.order-p.order);for(const m of h){const p=m.visibility?` {${m.visibility}}`:"",y=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${p}${y}`)}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 df(e){return e==="CLASS"?"class":"er"}function ya(e,t){return t==="class"?hf(e):ff(e)}function Kn(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function ga(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=Kn(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 uf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function ar(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 lr(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 ff(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=Kn((d==null?void 0:d.dataType)||c.type,"unknown"),f=Kn((d==null?void 0:d.physicalName)||c.name,"col"),h=[c.identifier?"PK":"",uf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),m=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",p=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,y=ga([p,m].filter(Boolean).join(" ")),b=[` ${u} ${f}`];h&&b.push(h);let _=b.join(" ");y&&(_+=` "${y}"`),o.push(_)}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=`${lr(l.end1.multiplicity,"left")}--${lr(l.end2.multiplicity,"right")}`,d=ga(l.description);o.push(` ${r} ${c} ${s} : "${d}"`)}return o.join(`
|
|
3
|
+
`)}function mf(e){return e&&e!=="UNDEFINED"?e:null}function pf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function hf(e){const t=ir(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),l=[],r=mf(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(` +${pf(c.type)} ${Kn(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))l.push(` +${Kn(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=yf(i),s=ga(i.description),c=` ${a} "${ar(i.end1.multiplicity)}" ${r} "${ar(i.end2.multiplicity)}" ${l}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function yf(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}const gf=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function dt(e){return e.replace(gf,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rr(e){return`<text ${[`x="${Ae(e.x)}"`,`y="${Ae(e.y)}"`,`fill="${dt(e.fill)}"`,`font-size="${Ae(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 bf(e){return`<line x1="${Ae(e.x1)}" y1="${Ae(e.y)}" x2="${Ae(e.x2)}" y2="${Ae(e.y)}" stroke="${dt(e.stroke)}" stroke-width="${Ae(e.strokeWidth??1)}" />`}function _f(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 kf(e,t,o,i,a){return[`M${Ae(e+a.tl)},${Ae(t)}`,`L${Ae(e+o-a.tr)},${Ae(t)}`,a.tr?`Q${Ae(e+o)},${Ae(t)} ${Ae(e+o)},${Ae(t+a.tr)}`:"",`L${Ae(e+o)},${Ae(t+i-a.br)}`,a.br?`Q${Ae(e+o)},${Ae(t+i)} ${Ae(e+o-a.br)},${Ae(t+i)}`:"",`L${Ae(e+a.bl)},${Ae(t+i)}`,a.bl?`Q${Ae(e)},${Ae(t+i)} ${Ae(e)},${Ae(t+i-a.bl)}`:"",`L${Ae(e)},${Ae(t+a.tl)}`,a.tl?`Q${Ae(e)},${Ae(t)} ${Ae(e+a.tl)},${Ae(t)}`:"","Z"].filter(Boolean).join(" ")}function ba(e){const t=_f(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${dt(e.fill)}"`,`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${dt(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ae(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${kf(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Ae(e.x)}" y="${Ae(e.y)}" width="${Ae(e.w)}" height="${Ae(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(bf(r));for(const r of e.texts)l.push(rr(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function wf(e){const o=[`<path ${[`d="${dt(e.d)}"`,'fill="none"',`stroke="${dt(e.stroke)}"`,`stroke-width="${Ae(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(rr(i));return`<g>${o.join("")}</g>`}function sr(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Ae(t)}" y="${Ae(o)}" width="${Ae(i)}" height="${Ae(a)}" fill="${dt(e.background)}" />`);for(const r of e.groups)l.push(ba(r));for(const r of e.edges)l.push(wf(r));for(const r of e.entities)l.push(ba(r));for(const r of e.notes)l.push(ba(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ae(t)} ${Ae(o)} ${Ae(i)} ${Ae(a)}" width="${Ae(i)}" height="${Ae(a)}">`+l.join("")+"</svg>"}const Ef=["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"],vf=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"]),Nf=Ef.filter(e=>!vf.has(e)),$f={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function _a(e){return $f[e]??e}const xf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Go=new Set(["NUMERIC","DECIMAL"]);function cr(e,t=Nf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const zt="CustomType",qn="GroupCodeEnum",ka="String",wa=[{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:"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:qn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:zt,label:"CustomType"}],If=new Map(wa.map(e=>[e.value,e.label]));function En(e){return If.get(e)??e}const Sf=new Set([qn,"CustomMoneyType"]),dr=wa.filter(e=>!Sf.has(e.value)).map(e=>e.value===zt?{...e,label:"CustomType (사용자정의)"}:e);function ur(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=[...dr,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:En(e)},...i]:i}function Cf(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function fr(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 Ea(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${En(t.type)}>`:Cf(t)?En(t.type):e==="CLASS"?t.type===zt&&t.customType||En(t.type):_a(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Xn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Yo(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 va=63;function Wo(e){if(!e)return null;const t=e.length;return t<=va?null:`물리명이 ${va}자를 초과했습니다 (${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 jn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Rf(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 h=l.get(f)??o;if(h===o)d(f);else if(h===i){const m=r.slice(r.indexOf(f)),p=[...m].sort().join(" ");c.has(p)||(c.add(p),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 Vf(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(h=>h.modelId===u))==null?void 0:d.attributes.flatMap(h=>h.dbAttrs)[o];return(f==null?void 0:f.physicalName)??""}return t.physicalName??""}function Na(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 pr(e,t){var l,r,s;const o=[];for(const c of Na(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(p=>p.attrType!=="DIVIDER");if(mt(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(p=>p.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),mt((l=c.table)==null?void 0:l.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const p of d.filter(y=>y.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.identifier&&y.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d)if(!p.identifier)for(const y of p.dbAttrs)!y.autoIncrement&&mt(y.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`채번(${y.autoIncrement?"auto increment":`시퀀스 "${y.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(y=>y.naturalId&&y.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&y.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "${p.name}"`});for(const p of d.filter(y=>y.naturalId&&!y.notNull&&!y.identifier&&!y.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "${p.name}"`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const p of Na(d,y=>y.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${p.name}"`});for(const p of d)mt(p.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:p.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(p=>p.dbAttrs).filter(p=>p.sharedColumnRef==null),f=d.flatMap(p=>p.dbAttrs.map((y,b)=>({col:y,name:Vf(p,y,b,e,t)})).filter(y=>y.col.sharedColumnRef==null));for(const p of Na(f,y=>y.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:p.col.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${p.name}"`});for(const p of u){const y=Wo(p.physicalName);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.physicalName)&&t.reservedWords.has(p.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${p.physicalName}"`}),t!=null&&t.selectableDataTypes&&!mt(p.dataType)&&!t.selectableDataTypes.has(p.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${p.dataType}"`}),!mt(p.dataType)&&xf.has(p.dataType)&&!p.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:`${p.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const p=Xn(d.flatMap(y=>y.dbAttrs));for(const y of d){if(y.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===y.type);b&&y.dbAttrs.forEach((_,A)=>{if(_.sharedColumnRef==null)return;const g=b.fields[A],N=p.get(_.sharedColumnRef);if(!g||!N)return;(N.dataType!==g.dataType||(N.length??null)!==(g.length??null)||(N.scale??null)!==(g.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${mr(N)})이 ${g.name??"컬럼"} 정의(${mr(g)})와 다릅니다`})})}}for(const p of d){const y=p.dbAttrs[0];if(!(y!=null&&y.multiValue))continue;p.type===qn&&y.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:y.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${y.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Wo(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!mt(h)&&t.reservedWords.has(h.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${h}"`});for(const p of c.indexes??[]){const y=Wo(p.name);y&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:y}),t!=null&&t.reservedWords&&!mt(p.name)&&t.reservedWords.has(p.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${p.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){jn(c.end1.multiplicity)&&jn(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],h=f.includes("ALL"),m=f.includes("REMOVE");h&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||h)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${h?"ALL":"REMOVE"}와 의미가 겹칩니다`}),jn(c[d].multiplicity)&&u.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다`}),u.orphanRemoval&&jn(c[d==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다`}),!jn(c[d].multiplicity)&&(u.collectionType||u.collectionTable||u.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다`}),u.collectionType==="SET"&&u.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다`})}}const a=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of Rf(e)){const d=[...c,c[0]].map(u=>a.get(u)??u).join(" → ");for(const u of c)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:u,message:`식별 관계 사이클입니다 (PK 무한 의존): ${d}`})}if(t!=null&&t.flagEntitiesWithoutRelations){const c=new Set;for(const u of e.associations)c.add(u.end1.entityRef),c.add(u.end2.entityRef);const d=new Map(e.entities.map(u=>[u.name,u.modelId]));for(const u of e.entities){for(const f of u.attributes)f.embedded&&(c.add(u.modelId),c.add(f.embedded.embeddableRef));if(!mt(u.superClass)){c.add(u.modelId);const f=d.get(u.superClass);f&&c.add(f)}}for(const u of e.entities)c.has(u.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:u.modelId,message:"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)"})}return o}function Oe(){return crypto.randomUUID()}const Af="CustomMoneyType",Tf="Money";function Mf(e){return!(e.type!==Af||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Bf(e){const t=e.dbAttrs[0]??{modelId:Oe(),physicalName:"",dataType:""},o={modelId:Oe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Tf,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Df(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>Mf(r)?(a=!0,t=!0,Bf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function $a(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 Zt(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 Jt(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 Of(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 Lf=new Set(["attributes","operations","indexes","rev"]),Pf=new Set(["end1","end2","rev"]),zf=new Set(["memberEntityRefs","rev"]),hr=new Set(["modelId"]),Uf=new Set(["modelId","columns"]),Hf=new Set([]);function Ff(e,t,o,i){const a=Jt(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=Zt(s,c,hr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=Jt(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=Zt(s,c,hr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=Jt(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=Zt(s,c,Uf);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Gf(e,t,o){const i=Jt(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:$a(r)});for(const{cur:r,tgt:s}of i.common){const c=Zt(r,s,Lf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),Ff(r.modelId,r,s,o)}const a=Jt(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:$a(r)});for(const{cur:r,tgt:s}of a.common){const c=Zt(r,s,Pf);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Zt(r[d]??{},s[d]??{},Hf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=Jt(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:$a(r)});for(const{cur:r,tgt:s}of l.common){const c=Zt(r,s,zf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=Of(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 Ko(e,t,o,i,a,l,r){const s=Jt(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 Yf(e,t,o){Ko(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Ko(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Ko(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Ko(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Wf(e,t){const o=[];return Gf(e.logical,t.logical,o),Yf(e.layout,t.layout,o),o}function Kf(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 qf={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 Xf{constructor(t){We(this,"out",[]);We(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({...Zn(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({...Zn(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...Zn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...Zn(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({...Zn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Zn(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function kt(e,t,o,i){if(o==null||typeof o!="object")return;const a=qf[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function Qt(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function xa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ut(e,t){var l,r,s,c,d,u,f,h;const o=Kf(t),i=new Xf(t.field),a=[...e].sort((m,p)=>m.seq-p.seq);for(const m of a)for(const p of m.ops)switch(o){case"entity":if(p.entityRef!==t.entityRef)break;p.kind==="entity.add"?kt(i,m,p.value,"entity"):p.kind==="entity.update"?Qt(i,m,p.patch):p.kind==="entity.remove"&&i.remove(m);break;case"attribute":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((l=p.value)==null?void 0:l.attributes,t.attributeRef);y&&kt(i,m,y,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?kt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?Qt(i,m,p.patch):(p.kind==="attribute.remove"&&p.attributeRef===t.attributeRef||p.kind==="entity.remove")&&i.remove(m);break;case"operation":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((s=p.value)==null?void 0:s.operations,t.operationRef);y&&kt(i,m,y,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?kt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?Qt(i,m,p.patch):(p.kind==="operation.remove"&&p.operationRef===t.operationRef||p.kind==="entity.remove")&&i.remove(m);break;case"index":if(p.entityRef!==t.entityRef)break;if(p.kind==="entity.add"){const y=xa((d=p.value)==null?void 0:d.indexes,t.indexRef);y&&kt(i,m,y,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?kt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?Qt(i,m,p.patch):(p.kind==="index.remove"&&p.indexRef===t.indexRef||p.kind==="entity.remove")&&i.remove(m);break;case"association":if(p.associationRef!==t.associationRef)break;p.kind==="association.add"?kt(i,m,p.value,"association"):p.kind==="association.update"?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"associationEnd":if(p.associationRef!==t.associationRef)break;if(p.kind==="association.add"){const y=(f=p.value)==null?void 0:f[t.end];kt(i,m,y,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?Qt(i,m,p.patch):p.kind==="association.remove"&&i.remove(m);break;case"group":if(p.groupRef!==t.groupRef)break;if(p.kind==="group.add"){kt(i,m,p.value,"group");const y=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(y))for(const b of y)i.member(m,b,!1)}else p.kind==="group.update"?Qt(i,m,p.patch):p.kind==="group.remove"?i.remove(m):p.kind==="group.addMember"&&p.entityRef!=null?i.member(m,p.entityRef,!1):p.kind==="group.removeMember"&&p.entityRef!=null&&i.member(m,p.entityRef,!0);break}return i.result()}function jf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Nn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Zf(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;Nn(c==null?void 0:c.attributes,o),Nn(c==null?void 0:c.operations,i),Nn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?Nn([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?Nn([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?Nn([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 qo(e,t){return e.map(o=>({...o,subject:t}))}function yr(e,t){const o=e.filter(s=>s.ops.some(c=>jf(c,t))),{attributes:i,operations:a,indexes:l}=Zf(o,t),r=[...qo(Ut(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...qo(Ut(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...qo(Ut(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...qo(Ut(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 gr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Jf(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 Qf(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 em(e){const{entities:t,associations:o,groups:i}=Qf(e),a=[];for(const l of t)for(const r of yr(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ut(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ut(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ut(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function br(e){const t=em(e),o=Jf(e),i=new Map;for(const r of t){const s=gr(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=gr(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 Ia{constructor(t){We(this,"undoStack",[]);We(this,"redoStack",[]);We(this,"savePoint",null);We(this,"listeners",new Set);We(this,"commandListeners",new Set);We(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 _r(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Ze(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 He(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function Ct(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 Sa(e,t){return{label:`엔티티 추가: ${e.name}`,apply(o){o.logical.entities.push(e),o.layout.entityLayouts.push({entityRef:e.modelId,geo:t})},invert(o){const i=_r(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=Ze(o,e.modelId);a>=0&&o.layout.entityLayouts.splice(a,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function kr(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=_r(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=Ze(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(h=>h.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 wr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=He(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(He(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 Er(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=He(i,e);o=a.name,a.name=t},invert(i){He(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 $n(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=Ze(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=Ze(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 vr(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Ze(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=Ze(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 Jn(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 Nr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=Ze(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=i.layout.entityLayouts[a];o=l.style,l.style=Jn(l.style,t)},invert(i){const a=Ze(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Ze(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 $r(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Ze(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=Ze(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 xr(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Ze(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=Ze(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 Ca(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 Xo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=Ze(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.attributeStyles;const s={...r.attributeStyles},c=Jn(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ze(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=Ze(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 Ra(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(l=>l.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const a=o.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);a>=0&&o.layout.groupLayouts.splice(a,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Ir(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 Sr(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 Cr(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 jo(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 Rr(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 Vr(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 Ar(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=Jn(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 Tr(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 Rt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){He(o,e).attributes.push(t)},invert(o){const i=He(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 en(e,t,o){const i={},a=l=>{const r=He(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 xn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=He(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&&He(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 Va(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=He(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,h)=>f.order=h)},invert(a){i&&He(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=He(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 Mr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=He(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=He(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 Br(e,t,o){const i={},a=l=>{var s;const r=(s=He(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 Dr(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=He(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=He(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 Or(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=He(a,e),r=l.operations??[];i=r.map(h=>({...h}));const s=new Set(t),c=r.filter(h=>s.has(h.modelId)),d=r.filter(h=>!s.has(h.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((h,m)=>h.order=m),l.operations=r},invert(a){if(!i)return;const l=He(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(He(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 Lr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=Ze(a,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=a.layout.entityLayouts[l];i=r.operationStyles;const s={...r.operationStyles},c=Jn(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(a){const l=Ze(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=Ze(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 Aa(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 Pr(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 Zo(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 In(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 zr(e,t){return{label:"인덱스 추가",apply(o){const i=He(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=He(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 Ur(e,t,o){const i={},a=l=>{var s;const r=(s=He(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 Hr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=He(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&&He(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}}),Qn=(e,t)=>{var o;return((o=pt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Fr(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=Qn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[wt(e,l)],invert:[wt(e,r)]}}}}function Gr(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=Qn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function Yr(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,Qn(a,e))],invert:[wt(e,i??[])]}}}}function Wr(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,Qn(o,e))],invert:[wt(e,t??[])]}}}}function Kr(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=Qn(i,e),l=a.slice();return l.splice(t,1),{forward:[wt(e,a)],invert:[wt(e,l)]}}}}function qr(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 Xr(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 eo(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 jr(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 Zr(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 Jr(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=Jn(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 Qr(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 es(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}}),Jo=(e,t,o)=>{var i;return((i=Ct(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function ts(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 ns(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=Ct(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=Ct(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Jo(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 is(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=Ct(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=Ct(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function as(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=Ct(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=Ct(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Jo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Ht(e,t,l)],invert:[Ht(e,t,r)]}}}}function ls(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Ct(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=Ct(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Ht(e,t,Jo(i,e,t))],invert:[Ht(e,t,o??[])]}}}}function Fe(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 tm=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Aa,addAttribute:Rt,addEntity:Sa,addEntityToGroup:Cr,addGroup:Ra,addIndex:zr,addNote:qr,addNoteConnection:ts,addNoteConnectionWaypoint:is,addNoteToGroup:Qr,addOperation:Mr,addWaypoint:Kr,clearNoteConnectionWaypoints:ls,clearWaypoints:Wr,composite:Fe,moveEntity:$n,moveGroup:Rr,moveNote:eo,moveNoteConnectionWaypoint:os,moveWaypoint:Fr,removeAssociation:Pr,removeAttribute:xn,removeEntity:kr,removeEntityFromGroup:jo,removeGroup:Sr,removeIndex:Hr,removeNote:Xr,removeNoteConnection:ns,removeNoteConnectionWaypoint:as,removeNoteFromGroup:es,removeOperation:Dr,removeWaypoint:Gr,renameEntity:Er,reorderAttributes:Va,reorderOperations:Or,resizeEntity:vr,resizeGroup:Vr,resizeNote:jr,setAllEntitiesCollapsed:Ca,setAttributeSwatch:Xo,setEntityCollapsed:$r,setEntityLocked:xr,setEntitySwatch:Nr,setGroupLocked:Tr,setGroupSwatch:Ar,setNoteMemo:Zr,setNoteSwatch:Jr,setOperationSwatch:Lr,translateWaypoints:Yr,updateAssociation:Zo,updateAssociationEnd:In,updateAttribute:en,updateEntity:wr,updateGroup:Ir,updateIndex:Ur,updateOperation:Br},Symbol.toStringTag,{value:"Module"}));class rs{constructor(){We(this,"revs",new Map);We(this,"layoutVersion",0);We(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 ss{constructor(t){We(this,"cache",new rs);We(this,"newClientOpId");We(this,"debounceMs");We(this,"emissions",new WeakMap);We(this,"open",null);We(this,"debounceHandle",null);We(this,"queue",[]);We(this,"sending",!1);We(this,"_frozen",!1);We(this,"stack",null);We(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Oe,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 cs=["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"],ds=()=>crypto.randomUUID(),nm=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,om=e=>e&&e[0].toLowerCase()+e.slice(1),im=e=>e&&e[0].toUpperCase()+e.slice(1),am=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function lm(e,t){return om(e)+im(t)}function rm(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=lm(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:am(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Qo=(e,t)=>`${e}::${t}`,ei=e=>e??void 0;function sm(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||ei(s.length)!==ei(l.length)||ei(s.scale)!==ei(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 cm(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 to(e,t,o=ds){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=>rm(e,f)),s=new Map(r.map(f=>[Qo(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Qo(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=Qo(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}let u=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of r){const h=Qo(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(cm(f,u++,o));else{const p=sm(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function dm(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 um(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function fm(e,t,o=ds){const i=new Map,a=um(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=to(a,d,o);if(nm(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&dm(f,u),l.has(d)||r.push(d)}}return i}function ti(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 mm(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 pm(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 us(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function at(e,t){const o=mm(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 hm(e,t){const o=pm(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 ym(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 fs(e,t){const o=ym(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 gm(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function bm(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function _m(e,t){const o=gm(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 km(e,t){const o=bm(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 ms(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 ps(e,t,o,i,a,l,r,s){const c=s(),d=new Map((e.embeddableOverrides??[]).map(h=>[h.field,h])),u=[];let f=!1;for(const h of t.fields){const m=d.get(h.name);if(m!=null&&m.sharedColumnPhysicalName){const p={ref:m.sharedColumnPhysicalName,by:"physicalName"},y=fs(i,p);if(!y.ok){r.push(y.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:a,entity:l,handle:p}:{code:"shared-column-target-ambiguous",opIndex:a,entity:l,handle:p,matches:y.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:y.value.modelId});continue}u.push({modelId:s(),physicalName:(m==null?void 0:m.physicalName)??"",dataType:"",...m!=null&&m.length?{length:m.length}:{},...m!=null&&m.scale?{scale:m.scale}:{},...(m==null?void 0:m.insertable)!=null?{insertable:m.insertable}:{},...(m==null?void 0:m.updatable)!=null?{updatable:m.updatable}:{}})}return f?null:{modelId:c,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:u}}function hs(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 ys(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=fs(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 wm(e,t,o={}){const i=o.mkId??Oe,a=o.embeddableCatalog??[],l=f=>a.find(h=>h.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,h)=>{var m,p,y;switch(f.kind){case"entity.add":{const b=i(),_={modelId:b,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}}:{}},A={ref:f.spec.name};let g=!1;for(const[S,O]of(f.spec.attributes??[]).entries()){if(O.type==="GroupCodeEnum"&&!O.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0;continue}const z=l(O.type);if(z){const F=ps(O,z,S,_,h,A,s,i);F?_.attributes.push(F):g=!0}else(m=O.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:A,handle:{ref:O.name}}),g=!0):_.attributes.push(ms(O,S,i))}const N=(f.spec.operations??[]).map((S,O)=>hs(S,O,i));N.length&&(_.operations=N);const te=[];for(const S of f.spec.indexes??[]){const O=ys(_,S,h,A,s,i);O?te.push(O):g=!0}if(te.length&&(_.indexes=te),g)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:f.patch});break}case"entity.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}r.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}const _=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,_+1);const A=l(f.spec.type);let g;if(A)g=ps(f.spec,A,_,b.value,h,f.entity,s,i);else if((p=f.spec.embeddableOverrides)!=null&&p.length){s.push({code:"embeddable-type-unresolved",opIndex:h,entity:f.entity,handle:{ref:f.spec.name}});break}else g=ms(f.spec,_,i);if(!g)break;r.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:g});break}case"attribute.update":case"attribute.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=hm(b.value,f.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:h,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:h,entity:f.entity,handle:f.attribute,matches:_.matches});break}f.kind==="attribute.update"?r.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId,patch:f.patch}):r.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const b=at(e,f.spec.from),_=at(e,f.spec.to);if(b.ok||s.push(lt(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.spec.to,_.matches,u)),!b.ok||!_.ok)break;if(f.spec.identifying&&b.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:h,handle:{from:f.spec.from,to:f.spec.to}});break}const A=i(),g={modelId:A,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},N={...e,associations:[...e.associations,g]},te=to(N,_.value.modelId,i);te.add[0]&&(g.end2.attributeRef=te.add[0].modelId),r.push({kind:"association.add",casUnit:"logical",associationRef:A,value:g});for(const S of te.add)r.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:S});break}case"association.remove":{const b=at(e,f.association.from),_=at(e,f.association.to);if(b.ok||s.push(lt(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(lt(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const A=us(e,b.value.modelId,_.value.modelId);if(A.length!==1){s.push(A.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:A.map(g=>g.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:A[0].modelId});break}case"association.update":{const b=gs(e,f.association,h,s,u);if(!b)break;r.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:f.patch});break}case"associationEnd.update":{const b=gs(e,f.association,h,s,u);if(!b)break;const _=f.end==="from"?"end1":"end2";r.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:_,patch:f.patch});break}case"index.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=ys(b.value,f.spec,h,f.entity,s,i);if(!_)break;r.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=_m(b.value,f.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:h,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:h,entity:f.entity,handle:f.index,matches:_.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:h,entity:f.entity,handle:f.index});break}r.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId,patch:f.patch})}else r.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((y=b.value.operations)==null?void 0:y.length)??0;d.set(b.value.modelId,_+1);const A=hs(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:A.modelId,value:A});break}case"operation.update":case"operation.remove":{const b=at(e,f.entity);if(!b.ok){s.push(lt(b.reason,h,f.entity,b.matches,u));break}const _=km(b.value,f.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:h,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:h,entity:f.entity,handle:f.operation,matches:_.matches});break}f.kind==="operation.update"?r.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId,patch:f.patch}):r.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:_.value.modelId});break}case"group.add":{const b=[];let _=!1;for(const N of f.spec.members){const te=at(e,N);if(!te.ok){s.push(lt(te.reason,h,N,te.matches,u)),_=!0;continue}b.push(te.value.modelId)}if(_)break;const A=i(),g={modelId:A,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...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:A,value:g});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function lt(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 gs(e,t,o,i,a){const l=at(e,t.from),r=at(e,t.to);if(l.ok||i.push(lt(l.reason,o,t.from,l.matches,a)),r.ok||i.push(lt(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=us(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 bs={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Em={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},vm={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},ni={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Nm={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:{...ni,description:"속성 설명(다국어)."},columnLogicalName:{...ni,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},_s={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},$m={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{..._s,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{..._s,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},xm={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...bs,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},Im={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...ni,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Sm={type:"object",properties:{name:{...ni,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},Cm={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function tt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Rm={"entity.add":tt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":tt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":tt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":tt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":tt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":tt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":tt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":tt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":tt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":tt("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":tt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":tt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":tt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":tt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":tt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":tt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":tt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},ks={anyOf:cs.map(e=>Rm[e])},Vm={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:bs,assocHandle:Em,entitySpec:vm,attrSpec:Nm,assocSpec:$m,indexSpec:xm,operationSpec:Im,groupSpec:Sm,patch:Cm,symbolicOp:ks}};function Am(e,t,o,i={}){const a=i.mkClientOpId??Oe,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 ws={location:{x:0,y:0},size:{width:220,height:140}};function Es(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 Tm=/^[-=_*~\s]{3,}$/;function Mm(e){return e.attrType&&e.attrType!=="NORMAL"||!Tm.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Bm(e,t){return e.attrType==="DIVIDER"||Mm(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,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(Es)}}function Dm(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 Om(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 Lm(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(Bm),operations:(t=e.operations)==null?void 0:t.map(Dm),indexes:(o=e.indexes)==null?void 0:o.map(Om),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Pm(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??{...ws},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 vs(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 Ta(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:vs(e)}}function zm(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ta(e.end1),end2:Ta(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 Ns(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function $s(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xs(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 Is(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(Es)}}function Um(e,t,o){var b,_;const i=Ns(e.end1.attribute),a=Ns(e.end2.attribute);if(i===a)return zm(e);const l=i?e.end1:e.end2,r=i?e.end2:e.end1,s=l.attribute,c=(_=(b=s.dbAttrs)==null?void 0:b[0])==null?void 0:_.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce((A,g)=>Math.max(A,g.order),-1)+1:s.order??0,h={...Is(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(A,g)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:g?d:h.modelId,legacyNavRaw:g?void 0:A.attribute,jpa:vs(A)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},y={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:y}}function Hm(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 Fm(e,t,o){var p;const i=((p=e.end1.attribute)==null?void 0:p.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((y,b)=>Math.max(y,b.order),-1)+1:r.order??0,d={...Is(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(y=>Hm(y,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=y=>({...Ta(y),legacyEmbedRaw:y.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Gm(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 Ss(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=Gm(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 Ym(e){return(e.schemaVersion??1)>=2&&"logical"in e?Wm(e):Km(e)}function Wm(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:h,...m}=f;return h!=null&&(o[f.modelId]=h),m},a=e.logical.entities.map(i),l=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:l,groups:r},layout:{...c,diagramId:c.diagramId??t,logicalModelRef:c.logicalModelRef??t}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Km(e){var _,A;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(g,N)=>{o.push(Lm(g));const te=Pm(g);te.geo={location:{x:te.geo.location.x+N.x,y:te.geo.location.y+N.y},size:te.geo.size},i.push(te);for(const S of g.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const g of e.entities??[])d(g,u);const f=[];for(const g of e.groups??[]){const N=g.entities??[];r.push({modelId:g.modelId,name:g.name,description:g.description,packageName:g.packageName,excludeDDLGeneration:g.excludeDDLGeneration??!1,memberEntityRefs:N.map(S=>S.modelId)});const te=((_=g.geo)==null?void 0:_.location)??u;if(g.geo){const S=(g.notes??[]).map(O=>O.modelId);s.push({groupRef:g.modelId,geo:g.geo,style:g.style,locked:g.locked,memberNoteRefs:S.length?S:void 0})}for(const S of N)d(S,te);for(const S of g.notes??[])f.push(Ss(S,te))}const h=new Map(o.map(g=>[g.modelId,g])),m=new Map,p=new Map;for(const g of o)for(const N of g.attributes)for(const te of N.dbAttrs)m.set(te.modelId,N.modelId),p.set(te.modelId,te);for(const g of c)for(const N of[g.end1,g.end2]){const te=N.attribute;if(te&&(((A=te.dbAttrs)==null?void 0:A.length)??0)>0)for(const S of te.dbAttrs)S.modelId&&m.set(S.modelId,te.modelId)}for(const g of c){const N=$s(g.end1.attribute),te=$s(g.end2.attribute),S=xs(g.end1)||xs(g.end2),{assoc:O,layout:z}=N!==te||S?Fm(g,h,p):Um(g,h,m);a.push(O),l.push(z)}const y={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(g=>Ss(g)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:y,meta:b}}function Cs(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 qm(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(Cs),style:t}}function Xm(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 jm(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 Ft(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 Zm(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{...Cs(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function Jm(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 Qm(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 ep(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function tp(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:ep(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 np(e,t,o){let i;for(const f of t.logical.entities){const h=f.attributes.find(m=>{var p;return((p=m.embedded)==null?void 0:p.associationRef)===e.modelId});if(h){i=h;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,h)=>tp(f,r[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ft(e.end1,c?s:u),end2:Ft(e.end2,c?u:s)}}function op(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:Ft(e.end1,e.end1.legacyEmbedRaw),end2:Ft(e.end2,e.end2.legacyEmbedRaw)};const a=np(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(p=>p.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(p=>p.modelId===s.attributeRef),f=t.logical.entities.find(p=>p.modelId===c.entityRef),h=u?Zm(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ft(e.end1,l?m:h),end2:Ft(e.end2,r?m:h)}}return{...i,end1:Ft(e.end1),end2:Ft(e.end2)}}function Rs(e,t,o,i,a={x:0,y:0}){var u,f;const l=t.layout.entityLayouts.find(h=>h.entityRef===e.modelId),r=t.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>t.layout.associationLayouts.find(m=>m.associationRef===h),c=(l==null?void 0:l.geo)??{...ws},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var m;return qm(h,(m=l==null?void 0:l.attributeStyles)==null?void 0:m[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var m;return Xm(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>op(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(jm),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 ip(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=>Vs(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>Rs(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 Vs(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 ap(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Jm(e),l=Qm(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=>Rs(s,e,a,l)),groups:e.logical.groups.map(s=>ip(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Vs(s))}}function lp(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 no(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Vt(e){return typeof e=="function"?e():n.unref(e)}const rp=typeof window<"u"&&typeof document<"u",sp=e=>typeof e<"u",cp=Object.prototype.toString,dp=e=>cp.call(e)==="[object Object]",up=()=>{};function fp(e,t){function o(...i){return new Promise((a,l)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(l)})}return o}const As=e=>e();function mp(e=As){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...l)=>{t.value&&e(...l)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function Ts(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function pp(e,t,o={}){const{eventFilter:i=As,...a}=o;return n.watch(e,fp(i,t),a)}function Sn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=mp(i);return{stop:pp(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function hp(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=Vt(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 Ma(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:y}={}){let b=null;const A=[new Promise(g=>{b=n.watch(e,N=>{f(N)!==t&&(b==null||b(),g(N))},{flush:h,deep:m,immediate:!0})})];return p!=null&&A.push(Ts(p,y).then(()=>Vt(e)).finally(()=>b==null?void 0:b())),Promise.race(A)}function i(f,h){if(!n.isRef(f))return o(N=>N===f,h);const{flush:m="sync",deep:p=!1,timeout:y,throwOnTimeout:b}=h??{};let _=null;const g=[new Promise(N=>{_=n.watch([e,f],([te,S])=>{t!==(te===S)&&(_==null||_(),N(te))},{flush:m,deep:p,immediate:!0})})];return y!=null&&g.push(Ts(y,b).then(()=>Vt(e)).finally(()=>(_==null||_(),Vt(e)))),Promise.race(g)}function a(f){return o(h=>!!h,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,h){return o(m=>{const p=Array.from(m);return p.includes(f)||p.includes(Vt(f))},h)}function d(f){return u(1,f)}function u(f=1,h){let m=-1;return o(()=>(m+=1,m>=f),h)}return Array.isArray(Vt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Ma(e,!t)}}}function Ba(e){return Ma(e)}function yp(e){var t;const o=Vt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Ms=rp?window:void 0;function Bs(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Ms):[t,o,i,a]=e,!t)return up;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const l=[],r=()=>{l.forEach(u=>u()),l.length=0},s=(u,f,h,m)=>(u.addEventListener(f,h,m),()=>u.removeEventListener(f,h,m)),c=n.watch(()=>[yp(t),Vt(a)],([u,f])=>{if(r(),!u)return;const h=dp(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return no(d),d}function gp(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ds(...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=Ms,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=gp(t);return Bs(a,l,u=>{u.repeat&&Vt(s)||c(u)&&o(u)},r)}function bp(e){return JSON.parse(JSON.stringify(e))}function Da(e,t,o,i={}){var a,l,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:h}=i,m=n.getCurrentInstance(),p=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 y=d;t||(t="modelValue"),y=y||`update:${t.toString()}`;const b=g=>s?typeof s=="function"?s(g):bp(g):g,_=()=>sp(e[t])?b(e[t]):f,A=g=>{h?h(g)&&p(y,g):p(y,g)};if(c){const g=_(),N=n.ref(g);let te=!1;return n.watch(()=>e[t],S=>{te||(te=!0,N.value=b(S),n.nextTick(()=>te=!1))}),n.watch(N,S=>{!te&&(S!==e[t]||u)&&A(S)},{deep:u}),N}else return n.computed({get(){return _()},set(g){A(g)}})}var _p={value:()=>{}};function oi(){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 ii(o)}function ii(e){this._=e}function kp(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}})}ii.prototype=oi.prototype={constructor:ii,on:function(e,t){var o=this._,i=kp(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=wp(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]=Os(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Os(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 ii(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 wp(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Os(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=_p,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Oa="http://www.w3.org/1999/xhtml";const Ls={svg:"http://www.w3.org/2000/svg",xhtml:Oa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ai(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Ls.hasOwnProperty(t)?{space:Ls[t],local:e}:e}function Ep(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Oa&&t.documentElement.namespaceURI===Oa?t.createElement(e):t.createElementNS(o,e)}}function vp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ps(e){var t=ai(e);return(t.local?vp:Ep)(t)}function Np(){}function La(e){return e==null?Np:function(){return this.querySelector(e)}}function $p(e){typeof e!="function"&&(e=La(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 xp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ip(){return[]}function zs(e){return e==null?Ip:function(){return this.querySelectorAll(e)}}function Sp(e){return function(){return xp(e.apply(this,arguments))}}function Cp(e){typeof e=="function"?e=Sp(e):e=zs(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 Us(e){return function(){return this.matches(e)}}function Hs(e){return function(t){return t.matches(e)}}var Rp=Array.prototype.find;function Vp(e){return function(){return Rp.call(this.children,e)}}function Ap(){return this.firstElementChild}function Tp(e){return this.select(e==null?Ap:Vp(typeof e=="function"?e:Hs(e)))}var Mp=Array.prototype.filter;function Bp(){return Array.from(this.children)}function Dp(e){return function(){return Mp.call(this.children,e)}}function Op(e){return this.selectAll(e==null?Bp:Dp(typeof e=="function"?e:Hs(e)))}function Lp(e){typeof e!="function"&&(e=Us(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 Fs(e){return new Array(e.length)}function Pp(){return new ut(this._enter||this._groups.map(Fs),this._parents)}function li(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}li.prototype={constructor:li,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 zp(e){return function(){return e}}function Up(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 li(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Hp(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[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 li(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Fp(e){return e.__data__}function Gp(e,t){if(!arguments.length)return Array.from(this,Fp);var o=t?Hp:Up,i=this._parents,a=this._groups;typeof e!="function"&&(e=zp(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],h=f.length,m=Yp(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ut(r,i),r._enter=s,r._exit=c,r}function Yp(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wp(){return new ut(this._exit||this._groups.map(Fs),this._parents)}function Kp(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 qp(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,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ut(s,this._parents)}function Xp(){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 jp(e){e||(e=Zp);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}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 Zp(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Jp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qp(){return Array.from(this)}function eh(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var r=i[a];if(r)return r}return null}function th(){let e=0;for(const t of this)++e;return e}function nh(){return!this.node()}function oh(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 ih(e){return function(){this.removeAttribute(e)}}function ah(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lh(e,t){return function(){this.setAttribute(e,t)}}function rh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sh(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function ch(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 dh(e,t){var o=ai(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?ah:ih:typeof t=="function"?o.local?ch:sh:o.local?rh:lh)(o,t))}function Gs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uh(e){return function(){this.style.removeProperty(e)}}function fh(e,t,o){return function(){this.style.setProperty(e,t,o)}}function mh(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function ph(e,t,o){return arguments.length>1?this.each((t==null?uh:typeof t=="function"?mh:fh)(e,t,o??"")):Cn(this.node(),e)}function Cn(e,t){return e.style.getPropertyValue(t)||Gs(e).getComputedStyle(e,null).getPropertyValue(t)}function hh(e){return function(){delete this[e]}}function yh(e,t){return function(){this[e]=t}}function gh(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function bh(e,t){return arguments.length>1?this.each((t==null?hh:typeof t=="function"?gh:yh)(e,t)):this.node()[e]}function Ys(e){return e.trim().split(/^|\s+/)}function Pa(e){return e.classList||new Ws(e)}function Ws(e){this._node=e,this._names=Ys(e.getAttribute("class")||"")}Ws.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 Ks(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function qs(e,t){for(var o=Pa(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function _h(e){return function(){Ks(this,e)}}function kh(e){return function(){qs(this,e)}}function wh(e,t){return function(){(t.apply(this,arguments)?Ks:qs)(this,e)}}function Eh(e,t){var o=Ys(e+"");if(arguments.length<2){for(var i=Pa(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?wh:t?_h:kh)(o,t))}function vh(){this.textContent=""}function Nh(e){return function(){this.textContent=e}}function $h(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function xh(e){return arguments.length?this.each(e==null?vh:(typeof e=="function"?$h:Nh)(e)):this.node().textContent}function Ih(){this.innerHTML=""}function Sh(e){return function(){this.innerHTML=e}}function Ch(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Rh(e){return arguments.length?this.each(e==null?Ih:(typeof e=="function"?Ch:Sh)(e)):this.node().innerHTML}function Vh(){this.nextSibling&&this.parentNode.appendChild(this)}function Ah(){return this.each(Vh)}function Th(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mh(){return this.each(Th)}function Bh(e){var t=typeof e=="function"?e:Ps(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Dh(){return null}function Oh(e,t){var o=typeof e=="function"?e:Ps(e),i=t==null?Dh:typeof t=="function"?t:La(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Lh(){var e=this.parentNode;e&&e.removeChild(this)}function Ph(){return this.each(Lh)}function zh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Uh(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hh(e){return this.select(e?Uh:zh)}function Fh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gh(e){return function(t){e.call(this,t,this.__data__)}}function Yh(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 Wh(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 Kh(e,t,o){return function(){var i=this.__on,a,l=Gh(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 qh(e,t,o){var i=Yh(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?Kh:Wh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Xs(e,t,o){var i=Gs(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Xh(e,t){return function(){return Xs(this,e,t)}}function jh(e,t){return function(){return Xs(this,e,t.apply(this,arguments))}}function Zh(e,t){return this.each((typeof t=="function"?jh:Xh)(e,t))}function*Jh(){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 js=[null];function ut(e,t){this._groups=e,this._parents=t}function oo(){return new ut([[document.documentElement]],js)}function Qh(){return this}ut.prototype=oo.prototype={constructor:ut,select:$p,selectAll:Cp,selectChild:Tp,selectChildren:Op,filter:Lp,data:Gp,enter:Pp,exit:Wp,join:Kp,merge:qp,selection:Qh,order:Xp,sort:jp,call:Jp,nodes:Qp,node:eh,size:th,empty:nh,each:oh,attr:dh,style:ph,property:bh,classed:Eh,text:xh,html:Rh,raise:Ah,lower:Mh,append:Bh,insert:Oh,remove:Ph,clone:Hh,datum:Fh,on:qh,dispatch:Zh,[Symbol.iterator]:Jh};function ht(e){return typeof e=="string"?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],js)}function ey(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Et(e,t){if(e=ey(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 ty={passive:!1},io={capture:!0,passive:!1};function za(e){e.stopImmediatePropagation()}function Rn(e){e.preventDefault(),e.stopImmediatePropagation()}function Zs(e){var t=e.document.documentElement,o=ht(e).on("dragstart.drag",Rn,io);"onselectstart"in t?o.on("selectstart.drag",Rn,io):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Js(e,t){var o=e.document.documentElement,i=ht(e).on("dragstart.drag",null);t&&(i.on("click.drag",Rn,io),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 ri=e=>()=>e;function Ua(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}})}Ua.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ny(e){return!e.ctrlKey&&!e.button}function oy(){return this.parentNode}function iy(e,t){return t??{x:e.x,y:e.y}}function ay(){return navigator.maxTouchPoints||"ontouchstart"in this}function ly(){var e=ny,t=oy,o=iy,i=ay,a={},l=oi("start","drag","end"),r=0,s,c,d,u,f=0;function h(N){N.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,ty).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(N,te){if(!(u||!e.call(this,N,te))){var S=g(this,t.call(this,N,te),N,te,"mouse");S&&(ht(N.view).on("mousemove.drag",p,io).on("mouseup.drag",y,io),Zs(N.view),za(N),d=!1,s=N.clientX,c=N.clientY,S("start",N))}}function p(N){if(Rn(N),!d){var te=N.clientX-s,S=N.clientY-c;d=te*te+S*S>f}a.mouse("drag",N)}function y(N){ht(N.view).on("mousemove.drag mouseup.drag",null),Js(N.view,d),Rn(N),a.mouse("end",N)}function b(N,te){if(e.call(this,N,te)){var S=N.changedTouches,O=t.call(this,N,te),z=S.length,F,ne;for(F=0;F<z;++F)(ne=g(this,O,N,te,S[F].identifier,S[F]))&&(za(N),ne("start",N,S[F]))}}function _(N){var te=N.changedTouches,S=te.length,O,z;for(O=0;O<S;++O)(z=a[te[O].identifier])&&(Rn(N),z("drag",N,te[O]))}function A(N){var te=N.changedTouches,S=te.length,O,z;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),O=0;O<S;++O)(z=a[te[O].identifier])&&(za(N),z("end",N,te[O]))}function g(N,te,S,O,z,F){var ne=l.copy(),re=Et(F||S,te),L,oe,k;if((k=o.call(N,new Ua("beforestart",{sourceEvent:S,target:h,identifier:z,active:r,x:re[0],y:re[1],dx:0,dy:0,dispatch:ne}),O))!=null)return L=k.x-re[0]||0,oe=k.y-re[1]||0,function W(R,G,H){var ae=re,v;switch(R){case"start":a[z]=W,v=r++;break;case"end":delete a[z],--r;case"drag":re=Et(H||G,te),v=r;break}ne.call(R,N,new Ua(R,{sourceEvent:G,subject:k,target:h,identifier:z,active:v,x:re[0]+L,y:re[1]+oe,dx:re[0]-ae[0],dy:re[1]-ae[1],dispatch:ne}),O)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ri(!!N),h):e},h.container=function(N){return arguments.length?(t=typeof N=="function"?N:ri(N),h):t},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ri(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ri(!!N),h):i},h.on=function(){var N=l.on.apply(l,arguments);return N===l?h:N},h.clickDistance=function(N){return arguments.length?(f=(N=+N)*N,h):Math.sqrt(f)},h}function Ha(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Qs(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function ao(){}var lo=.7,si=1/lo,Vn="\\s*([+-]?\\d+)\\s*",ro="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ry=/^#([0-9a-f]{3,8})$/,sy=new RegExp(`^rgb\\(${Vn},${Vn},${Vn}\\)$`),cy=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),dy=new RegExp(`^rgba\\(${Vn},${Vn},${Vn},${ro}\\)$`),uy=new RegExp(`^rgba\\(${vt},${vt},${vt},${ro}\\)$`),fy=new RegExp(`^hsl\\(${ro},${vt},${vt}\\)$`),my=new RegExp(`^hsla\\(${ro},${vt},${vt},${ro}\\)$`),ec={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};Ha(ao,tn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tc,formatHex:tc,formatHex8:py,formatHsl:hy,formatRgb:nc,toString:nc});function tc(){return this.rgb().formatHex()}function py(){return this.rgb().formatHex8()}function hy(){return rc(this).formatHsl()}function nc(){return this.rgb().formatRgb()}function tn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=ry.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?ci(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?ci(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=sy.exec(e))?new st(t[1],t[2],t[3],1):(t=cy.exec(e))?new st(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dy.exec(e))?ci(t[1],t[2],t[3],t[4]):(t=uy.exec(e))?ci(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fy.exec(e))?lc(t[1],t[2]/100,t[3]/100,1):(t=my.exec(e))?lc(t[1],t[2]/100,t[3]/100,t[4]):ec.hasOwnProperty(e)?oc(ec[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 ci(e,t,o,i){return i<=0&&(e=t=o=NaN),new st(e,t,o,i)}function yy(e){return e instanceof ao||(e=tn(e)),e?(e=e.rgb(),new st(e.r,e.g,e.b,e.opacity)):new st}function Fa(e,t,o,i){return arguments.length===1?yy(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}Ha(st,Fa,Qs(ao,{brighter(e){return e=e==null?si:Math.pow(si,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lo:Math.pow(lo,e),new st(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new st(nn(this.r),nn(this.g),nn(this.b),di(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:ic,formatHex:ic,formatHex8:gy,formatRgb:ac,toString:ac}));function ic(){return`#${on(this.r)}${on(this.g)}${on(this.b)}`}function gy(){return`#${on(this.r)}${on(this.g)}${on(this.b)}${on((isNaN(this.opacity)?1:this.opacity)*255)}`}function ac(){const e=di(this.opacity);return`${e===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${e===1?")":`, ${e})`}`}function di(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function on(e){return e=nn(e),(e<16?"0":"")+e.toString(16)}function lc(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 rc(e){if(e instanceof yt)return new yt(e.h,e.s,e.l,e.opacity);if(e instanceof ao||(e=tn(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 by(e,t,o,i){return arguments.length===1?rc(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}Ha(yt,by,Qs(ao,{brighter(e){return e=e==null?si:Math.pow(si,e),new yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lo:Math.pow(lo,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(Ga(e>=240?e-240:e+120,a,i),Ga(e,a,i),Ga(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new yt(sc(this.h),ui(this.s),ui(this.l),di(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=di(this.opacity);return`${e===1?"hsl(":"hsla("}${sc(this.h)}, ${ui(this.s)*100}%, ${ui(this.l)*100}%${e===1?")":`, ${e})`}`}}));function sc(e){return e=(e||0)%360,e<0?e+360:e}function ui(e){return Math.max(0,Math.min(1,e||0))}function Ga(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 Ya=e=>()=>e;function _y(e,t){return function(o){return e+o*t}}function ky(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 wy(e){return(e=+e)==1?cc:function(t,o){return o-t?ky(t,o,e):Ya(isNaN(t)?o:t)}}function cc(e,t){var o=t-e;return o?_y(e,o):Ya(isNaN(e)?t:e)}const fi=(function e(t){var o=wy(t);function i(a,l){var r=o((a=Fa(a)).r,(l=Fa(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=cc(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 Ey(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 vy(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ny(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]=so(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 $y(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Nt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function xy(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]=so(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var Wa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ka=new RegExp(Wa.source,"g");function Iy(e){return function(){return e}}function Sy(e){return function(t){return e(t)+""}}function dc(e,t){var o=Wa.lastIndex=Ka.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Wa.exec(e))&&(a=Ka.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:Nt(i,a)})),o=Ka.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Sy(c[0].x):Iy(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 so(e,t){var o=typeof t,i;return t==null||o==="boolean"?Ya(t):(o==="number"?Nt:o==="string"?(i=tn(t))?(t=i,fi):dc:t instanceof tn?fi:t instanceof Date?$y:vy(t)?Ey:Array.isArray(t)?Ny:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?xy:Nt)(e,t)}var uc=180/Math.PI,qa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fc(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)*uc,skewX:Math.atan(c)*uc,scaleX:r,scaleY:s}}var mi;function Cy(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qa:fc(t.a,t.b,t.c,t.d,t.e,t.f)}function Ry(e){return e==null||(mi||(mi=document.createElementNS("http://www.w3.org/2000/svg","g")),mi.setAttribute("transform",e),!(e=mi.transform.baseVal.consolidate()))?qa:(e=e.matrix,fc(e.a,e.b,e.c,e.d,e.e,e.f))}function mc(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:Nt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:Nt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:Nt(d,f)},{i:y-2,x:Nt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Vy=mc(Cy,"px, ","px)","deg)"),Ay=mc(Ry,", ",")",")"),Ty=1e-12;function pc(e){return((e=Math.exp(e))+1/e)/2}function My(e){return((e=Math.exp(e))-1/e)/2}function By(e){return((e=Math.exp(2*e))-1)/(e+1)}const pi=(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],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<Ty)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=pc(te),ne=d/(o*A)*(F*By(t*z+te)-My(te));return[s+ne*m,c+ne*p,d*F/pc(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}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 An=0,co=0,uo=0,hc=1e3,hi,fo,yi=0,an=0,gi=0,mo=typeof performance=="object"&&performance.now?performance:Date,yc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xa(){return an||(yc(Dy),an=mo.now()+gi)}function Dy(){an=0}function bi(){this._call=this._time=this._next=null}bi.prototype=gc.prototype={constructor:bi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Xa():+o)+(t==null?0:+t),!this._next&&fo!==this&&(fo?fo._next=this:hi=this,fo=this),this._call=e,this._time=o,ja()},stop:function(){this._call&&(this._call=null,this._time=1/0,ja())}};function gc(e,t,o){var i=new bi;return i.restart(e,t,o),i}function Oy(){Xa(),++An;for(var e=hi,t;e;)(t=an-e._time)>=0&&e._call.call(void 0,t),e=e._next;--An}function bc(){an=(yi=mo.now())+gi,An=co=0;try{Oy()}finally{An=0,Py(),an=0}}function Ly(){var e=mo.now(),t=e-yi;t>hc&&(gi-=t,yi=e)}function Py(){for(var e,t=hi,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:hi=o);fo=e,ja(i)}function ja(e){if(!An){co&&(co=clearTimeout(co));var t=e-an;t>24?(e<1/0&&(co=setTimeout(bc,e-mo.now()-gi)),uo&&(uo=clearInterval(uo))):(uo||(yi=mo.now(),uo=setInterval(Ly,hc)),An=1,yc(bc))}}function _c(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 zy=oi("start","end","cancel","interrupt"),Uy=[],kc=0,wc=1,Za=2,_i=3,Ec=4,Ja=5,ki=6;function wi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Hy(e,o,{name:t,index:i,group:a,on:zy,tween:Uy,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:kc})}function Qa(e,t){var o=gt(e,t);if(o.state>kc)throw new Error("too late; already scheduled");return o}function $t(e,t){var o=gt(e,t);if(o.state>_i)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 Hy(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=gc(l,0,o.time);function l(d){o.state=wc,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==wc)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===_i)return _c(r);m.state===Ec?(m.state=ki,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=ki,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(_c(function(){o.state===_i&&(o.state=Ec,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Za,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Za){for(o.state=_i,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++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=Ja,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Ja&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=ki,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ei(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>Za&&i.state<Ja,i.state=ki,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Fy(e){return this.each(function(){Ei(this,e)})}function Gy(e,t){var o,i;return function(){var a=$t(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 Yy(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=$t(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 Wy(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?Gy:Yy)(o,e,t))}function el(e,t,o){var i=e._id;return e.each(function(){var a=$t(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return gt(a,i).value[t]}}function vc(e,t){var o;return(typeof t=="number"?Nt:t instanceof tn?fi:(o=tn(t))?(t=o,fi):dc)(e,t)}function Ky(e){return function(){this.removeAttribute(e)}}function qy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xy(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 jy(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 Zy(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 Jy(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 Qy(e,t){var o=ai(e),i=o==="transform"?Ay:vc;return this.attrTween(e,typeof t=="function"?(o.local?Jy:Zy)(o,i,el(this,"attr."+e,t)):t==null?(o.local?qy:Ky)(o):(o.local?jy:Xy)(o,i,t))}function eg(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function tg(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function ng(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&tg(e,l)),o}return a._value=t,a}function og(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&eg(e,l)),o}return a._value=t,a}function ig(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=ai(e);return this.tween(o,(i.local?ng:og)(i,t))}function ag(e,t){return function(){Qa(this,e).delay=+t.apply(this,arguments)}}function lg(e,t){return t=+t,function(){Qa(this,e).delay=t}}function rg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ag:lg)(t,e)):gt(this.node(),t).delay}function sg(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function cg(e,t){return t=+t,function(){$t(this,e).duration=t}}function dg(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?sg:cg)(t,e)):gt(this.node(),t).duration}function ug(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function fg(e){var t=this._id;return arguments.length?this.each(ug(t,e)):gt(this.node(),t).ease}function mg(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function pg(e){if(typeof e!="function")throw new Error;return this.each(mg(this._id,e))}function hg(e){typeof e!="function"&&(e=Us(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 At(i,this._parents,this._name,this._id)}function yg(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),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new At(r,this._parents,this._name,this._id)}function gg(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 bg(e,t,o){var i,a,l=gg(t)?Qa:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function _g(e,t){var o=this._id;return arguments.length<2?gt(this.node(),o).on.on(e):this.each(bg(o,e,t))}function kg(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function wg(){return this.on("end.remove",kg(this._id))}function Eg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=La(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,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,wi(d[h],t,o,h,d,gt(u,o)));return new At(l,this._parents,t,o)}function vg(e){var t=this._name,o=this._id;typeof e!="function"&&(e=zs(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 h=e.call(u,u.__data__,f,c),m,p=gt(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&wi(m,t,o,y,h,p);l.push(h),r.push(u)}return new At(l,r,t,o)}var Ng=oo.prototype.constructor;function $g(){return new Ng(this._groups,this._parents)}function xg(e,t){var o,i,a;return function(){var l=Cn(this,e),r=(this.style.removeProperty(e),Cn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Nc(e){return function(){this.style.removeProperty(e)}}function Ig(e,t,o){var i,a=o+"",l;return function(){var r=Cn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Sg(e,t,o){var i,a,l;return function(){var r=Cn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Cn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Cg(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=$t(this,e),d=c.on,u=c.value[l]==null?s||(s=Nc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Rg(e,t,o){var i=(e+="")=="transform"?Vy:vc;return t==null?this.styleTween(e,xg(e,i)).on("end.style."+e,Nc(e)):typeof t=="function"?this.styleTween(e,Sg(e,i,el(this,"style."+e,t))).each(Cg(this._id,e)):this.styleTween(e,Ig(e,i,t),o).on("end.style."+e,null)}function Vg(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Ag(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Vg(e,r,o)),i}return l._value=t,l}function Tg(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,Ag(e,t,o??""))}function Mg(e){return function(){this.textContent=e}}function Bg(e){return function(){var t=e(this);this.textContent=t??""}}function Dg(e){return this.tween("text",typeof e=="function"?Bg(el(this,"text",e)):Mg(e==null?"":e+""))}function Og(e){return function(t){this.textContent=e.call(this,t)}}function Lg(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Og(a)),t}return i._value=e,i}function Pg(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,Lg(e))}function zg(){for(var e=this._name,t=this._id,o=$c(),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);wi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new At(i,this._parents,e,o)}function Ug(){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=$t(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 Hg=0;function At(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function $c(){return++Hg}var Tt=oo.prototype;At.prototype={constructor:At,select:Eg,selectAll:vg,selectChild:Tt.selectChild,selectChildren:Tt.selectChildren,filter:hg,merge:yg,selection:$g,transition:zg,call:Tt.call,nodes:Tt.nodes,node:Tt.node,size:Tt.size,empty:Tt.empty,each:Tt.each,on:_g,attr:Qy,attrTween:ig,style:Rg,styleTween:Tg,text:Dg,textTween:Pg,remove:wg,tween:Wy,delay:rg,duration:dg,ease:fg,easeVarying:pg,end:Ug,[Symbol.iterator]:Tt[Symbol.iterator]};function Fg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Gg={time:null,delay:0,duration:250,ease:Fg};function Yg(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 Wg(e){var t,o;e instanceof At?(t=e._id,e=e._name):(t=$c(),(o=Gg).time=Xa(),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])&&wi(c,e,t,d,r,o||Yg(c,t));return new At(i,this._parents,e,t)}oo.prototype.interrupt=Fy,oo.prototype.transition=Wg;const vi=e=>()=>e;function Kg(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 Mt(e,t,o){this.k=e,this.x=t,this.y=o}Mt.prototype={constructor:Mt,scale:function(e){return e===1?this:new Mt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Mt(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 Tn=new Mt(1,0,0);Mt.prototype;function tl(e){e.stopImmediatePropagation()}function po(e){e.preventDefault(),e.stopImmediatePropagation()}function qg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Xg(){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 xc(){return this.__zoom||Tn}function jg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zg(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jg(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 Qg(){var e=qg,t=Xg,o=Jg,i=jg,a=Zg,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=pi,d=oi("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",xc).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",xc),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(this,arguments).event(G).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},_.scaleBy=function(k,W,R,G){_.scaleTo(k,function(){var H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,r)},R,G)},_.translateBy=function(k,W,R,G){_.transform(k,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),r)},null,G)},_.translateTo=function(k,W,R,G,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Tn.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Mt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Mt(k.k,G,H)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function te(k,W,R,G){k.on("start.zoom",function(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Mt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,W){return this.mouse&&k!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var W=ht(this.that).datum();d.call(k,this.that,new Kg(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Et(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],Ei(this),R.start()}po(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=ht(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Et(k,R),v=k.clientX,q=k.clientY;Zs(k.view),tl(k),G.mouse=[ae,this.__zoom.invert(ae)],Ei(this),G.start();function le(he){if(po(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Et(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),Js(he.view,G.moved),po(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Et(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);po(k),s>0?ht(this).transition().duration(s).call(te,v,G,k):ht(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(tl(k),v=0;v<G;++v)q=R[v],le=Et(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),Ei(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(po(k),ae=0;ae<H;++ae)v=G[ae],q=Et(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(tl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(v=Et(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=ht(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:vi(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:vi(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:vi(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:vi([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}var Se=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Se||{}),nl=(e=>(e.Partial="partial",e.Full="full",e))(nl||{}),ln=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ln||{}),Bt=(e=>(e.Strict="strict",e.Loose="loose",e))(Bt||{}),ol=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ol||{}),ho=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ho||{}),Ic=(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))(Ic||{});const eb=["INPUT","SELECT","TEXTAREA"],tb=typeof document<"u"?document:null;function il(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 eb.includes(i==null?void 0:i.nodeName)||a||!!l}function nb(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Sc(e,t,o,i){const a=t.replace("+",`
|
|
3
5
|
`).replace(`
|
|
4
6
|
|
|
5
7
|
`,`
|
|
6
8
|
+`).split(`
|
|
7
|
-
`).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function Dg(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=Og(o.code,e);return Array.isArray(e)?e.some(a=>yc(o[i],a,t,o.type==="keyup")):yc(o[i],e,t,o.type==="keyup")}}function Og(e,t){return t.includes(e)?"code":"key"}function mo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??Mg),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}),Es(["blur","contextmenu"],s),Ns((...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=Bg(d),(!a||a&&!p)&&ja(d))return;const _=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Ns((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&ja(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"?Dg(d,l):d}return i}const gc="vue-flow__node-desc",bc="vue-flow__edge-desc",Lg="vue-flow__aria-live",_c=["Enter"," ","Escape"],An={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function _i(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function wi(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 vi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function wc(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function vc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Ht(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function sn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Ht(e)}function po(e){return sn(e)&&"computedPosition"in e}function ki(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Pg(e){return ki(e.width)&&ki(e.height)&&ki(e.x)&&ki(e.y)}function zg(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:Ke(e.data)?e.data:{},events:n.markRaw(Ke(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function kc(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:Ke(e.data)?e.data:{},events:n.markRaw(Ke(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 Ec(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 Ug(...e){if(e.length===3){const[l,r,s]=e;return Ec(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ht(l)&&l.source===i).map(l=>o.find(r=>sn(r)&&r.id===l.target))}function Hg(...e){if(e.length===3){const[l,r,s]=e;return Ec(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ht(l)&&l.target===i).map(l=>o.find(r=>sn(r)&&r.id===l.source))}function Nc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Fg(e,t){return t.some(o=>Ht(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 ho({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function yo({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?Ni(s,r):s}function $c(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 Ei({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function xc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function Gg(e,t){return xc($c(Ei(e),Ei(t)))}function Za(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=$c(t,Ei({...i.computedPosition,...i.dimensions}))}return xc(t)}function Ic(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...yo(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=wi(l,_i(s)),h=f===null||p===null,_=i&&m>0,b=(f??0)*(p??0);(h||_||m>=b||s.dragging)&&r.push(s)}return r}function cn(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 Tn(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 _o(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Yg(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Tn(e,o),a=Tn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Tn(e.top??e.y??0,o),a=Tn(e.bottom??e.y??0,o),l=Tn(e.left??e.x??0,t),r=Tn(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 Wg(e,t,o,i,a,l){const{x:r,y:s}=ho(e,{x:t,y:o,zoom:i}),{x:c,y:d}=ho({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 Sc(e,t,o,i,a,l=.1){const r=Yg(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,h=o/2-p*u,_=Wg(e,m,h,u,t,o),b={left:Math.min(_.left-r.left,0),top:Math.min(_.top-r.top,0),right:Math.min(_.right-r.right,0),bottom:Math.min(_.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:h-b.top+b.bottom,zoom:u}}function Kg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Cc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Cc(o,t):!1}function go(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Ja(e){const t=e.ctrlKey&&bo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Rc(e,t,o){return e<t?rn(Math.abs(e-t),1,t)/t:e>o?-rn(Math.abs(e-o),1,t)/t:0}function Vc(e,t,o=15,i=40){const a=Rc(e.x,i,t.width-i)*o,l=Rc(e.y,i,t.height-i)*o;return[a,l]}function Qa(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 Ac(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(po(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&&po(c)&&Qa(r,c)}break;case"dimensions":if(po(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&&po(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Qa(r,c):n.nextTick(()=>{Qa(r,c)}))}break}return t}function Ft(e,t){return{id:e,type:"select",selected:t}}function Tc(e){return{item:e,type:"add"}}function Mc(e){return{id:e,type:"remove"}}function Bc(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Gt(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(Ft(l.id,r)))}return i}const Dc=()=>{};function Ne(e){const t=new Set;let o=Dc,i=()=>!1;const a=()=>t.size>0||i(),l=p=>{o=p},r=()=>{o=Dc},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return Qn(m),{off:m}},off:d,trigger:p=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(h=>h(p)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Oc(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 qg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Cc(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 el({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 Lc(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 Xg(e,t,o){const[i,a,l,r]=typeof e!="string"?Lc(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 jg(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=Xg(a,e,i);l&&(a=l)}else t(new Ze(We.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]=Lc(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 Zg({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function tl(e,t,o,i,a){const l=Zg(e.dimensions,jg(e,o,i,a)),r=wc(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 Mn(e,t,o=$e.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??tb(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case $e.Top:return{x:a+r/2,y:l};case $e.Right:return{x:a+r,y:l+s/2};case $e.Bottom:return{x:a+r/2,y:l+s};case $e.Left:return{x:a,y:l+s/2}}}function Pc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Jg({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=Ei({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 Qg(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 We=(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))(We||{});const zc={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
|
|
9
|
+
`).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 ob(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=ib(o.code,e);return Array.isArray(e)?e.some(a=>Sc(o[i],a,t,o.type==="keyup")):Sc(o[i],e,t,o.type==="keyup")}}function ib(e,t){return t.includes(e)?"code":"key"}function yo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??tb),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}),Bs(["blur","contextmenu"],s),Ds((...d)=>r(...d),d=>{var u,f;const h=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=nb(d),(!a||a&&!h)&&il(d))return;const y=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Ds((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&il(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"?ob(d,l):d}return i}const Cc="vue-flow__node-desc",Rc="vue-flow__edge-desc",ab="vue-flow__aria-live",Vc=["Enter"," ","Escape"],Mn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ni(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function $i(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 xi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function rn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Ac(e,t){return{x:rn(e.x,t[0][0],t[1][0]),y:rn(e.y,t[0][1],t[1][1])}}function Tc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Gt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function sn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Gt(e)}function go(e){return sn(e)&&"computedPosition"in e}function Ii(e){return!Number.isNaN(e)&&Number.isFinite(e)}function lb(e){return Ii(e.width)&&Ii(e.height)&&Ii(e.x)&&Ii(e.y)}function rb(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 Mc(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 Bc(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 sb(...e){if(e.length===3){const[l,r,s]=e;return Bc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.source===i).map(l=>o.find(r=>sn(r)&&r.id===l.target))}function cb(...e){if(e.length===3){const[l,r,s]=e;return Bc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Gt(l)&&l.target===i).map(l=>o.find(r=>sn(r)&&r.id===l.source))}function Dc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function db(e,t){return t.some(o=>Gt(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 bo({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function _o({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?Ci(s,r):s}function Oc(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 Si({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Lc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function ub(e,t){return Lc(Oc(Si(e),Si(t)))}function al(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=Oc(t,Si({...i.computedPosition,...i.dimensions}))}return Lc(t)}function Pc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={..._o(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,h=c.height??s.height??null;if(a&&!d||u)continue;const m=$i(l,Ni(s)),p=f===null||h===null,y=i&&m>0,b=(f??0)*(h??0);(p||y||m>=b||s.dragging)&&r.push(s)}return r}function cn(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 Bn(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 Eo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function fb(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=Bn(e,o),a=Bn(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Bn(e.top??e.y??0,o),a=Bn(e.bottom??e.y??0,o),l=Bn(e.left??e.x??0,t),r=Bn(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 mb(e,t,o,i,a,l){const{x:r,y:s}=bo(e,{x:t,y:o,zoom:i}),{x:c,y:d}=bo({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 zc(e,t,o,i,a,l=.1){const r=fb(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=rn(d,i,a),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*u,p=o/2-h*u,y=mb(e,m,p,u,t,o),b={left:Math.min(y.left-r.left,0),top:Math.min(y.top-r.top,0),right:Math.min(y.right-r.right,0),bottom:Math.min(y.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function pb(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Uc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Uc(o,t):!1}function ko(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function ll(e){const t=e.ctrlKey&&wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Hc(e,t,o){return e<t?rn(Math.abs(e-t),1,t)/t:e>o?-rn(Math.abs(e-o),1,t)/t:0}function Fc(e,t,o=15,i=40){const a=Hc(e.x,i,t.width-i)*o,l=Hc(e.y,i,t.height-i)*o;return[a,l]}function rl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+i}px`}else a.height+=i;if(e.position.x<0){const l=Math.abs(e.position.x);if(t.position.x=t.position.x-l,typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+l}px`}else a.width+=l;e.position.x=0}if(e.position.y<0){const l=Math.abs(e.position.y);if(t.position.y=t.position.y-l,typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+l}px`}else a.height+=l;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=l=>{const r=t.style;return{...r(l),...a}}:t.style={...t.style,...a}}}}function Gc(e,t){var o,i;const a=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of a)if(r.type==="add")t.findIndex(c=>c.id===r.item.id)===-1&&t.push(r.item);else if(r.type==="remove"){const s=t.findIndex(c=>c.id===r.id);s!==-1&&t.splice(s,1)}const l=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(go(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&&go(c)&&rl(r,c)}break;case"dimensions":if(go(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&&go(c)&&(!!c.dimensions.width&&!!c.dimensions.height?rl(r,c):n.nextTick(()=>{rl(r,c)}))}break}return t}function Yt(e,t){return{id:e,type:"select",selected:t}}function Yc(e){return{item:e,type:"add"}}function Wc(e){return{id:e,type:"remove"}}function Kc(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(Yt(l.id,r)))}return i}const qc=()=>{};function $e(e){const t=new Set;let o=qc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=qc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return no(m),{off:m}},off:d,trigger:h=>{const m=[o];return a()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(p=>p(h)))},hasListeners:a,listeners:t,setEmitter:l,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function Xc(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 hb(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Uc(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 sl({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 jc(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 yb(e,t,o){const[i,a,l,r]=typeof e!="string"?jc(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 gb(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=yb(a,e,i);l&&(a=l)}else t(new Je(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]=jc(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 bb({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=bb(e.dimensions,gb(e,o,i,a)),r=Ac(t,l);return{position:{x:r.x-((a==null?void 0:a.computedPosition.x)||0),y:r.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:r}}function Dn(e,t,o=Se.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??Eb(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Se.Top:return{x:a+r/2,y:l};case Se.Right:return{x:a+r,y:l+s/2};case Se.Bottom:return{x:a+r/2,y:l+s};case Se.Left:return{x:a,y:l+s/2}}}function Zc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function _b({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=Si({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)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*h)>0}function kb(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 Jc={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
8
10
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
9
11
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
10
12
|
Node: ${e}
|
|
@@ -24,18 +26,18 @@ Edge: ${e}
|
|
|
24
26
|
Source: ${t}
|
|
25
27
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
26
28
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
27
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Ze extends Error{constructor(t,...o){var i;super((i=zc[t])==null?void 0:i.call(zc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function nl(e){return"clientX"in e}function eb(e){return"sourceEvent"in e}function Et(e,t){const o=nl(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 bo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function tb(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 Ni(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const nb=()=>!0;function ol(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function ob(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())wi(a,_i(l))>0&&i.push(l);return i}const ib=250;function ab(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=ob(e,o,t+ib);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}=Mn(d,f,f.position,!0),h=Math.sqrt((p-e.x)**2+(m-e.y)**2);h>t||(h<s?(r=[{...f,x:p,y:m}],s=h):h===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function Uc(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=nb},u,f,p,m){const h=l==="target",_=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:b,y:g}=Et(e),I=r.elementFromPoint(b,g),y=I!=null&&I.classList.contains(`${s}-flow__handle`)?I:_,N={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const q=Hc(void 0,y),U=y.getAttribute("data-nodeid"),X=y.getAttribute("data-handleid"),K=y.classList.contains("connectable"),W=y.classList.contains("connectableend");if(!U||!q)return N;const ne={source:h?U:i,sourceHandle:h?X:a,target:h?i:U,targetHandle:h?a:X};N.connection=ne;const L=K&&W&&(o===Tt.Strict?h&&q==="source"||!h&&q==="target":U!==i||X!==a);N.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:p(ne.source),targetNode:p(ne.target)}),N.toHandle=Fc(U,q,X,m,o,!0)}return N}function Hc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function lb(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function rb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Fc(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Tt.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,...Mn(d,f,f.position,!0)}:f}const il={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},sb=["production","prod"];function _o(e,...t){Gc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Gc(){return!sb.includes(process.env.NODE_ENV||"")}function Yc(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,...vi(r)}}):null}function al(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 Ke(e){return typeof n.unref(e)<"u"}function cb(e,t,o,i){if(!e||!e.source||!e.target)return o(new Ze(We.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Ht(e)?a=e:a={...e,id:Nc(e)},a=kc(a,void 0,i),Fg(a,t)?!1:a}function db(e,t,o,i,a){if(!t.source||!t.target)return a(new Ze(We.EDGE_INVALID,e.id)),!1;if(!o)return a(new Ze(We.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?Nc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Wc(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Ze(We.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=zg(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 Ze(We.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 Kc(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 ll(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}`;Kc("source",c,u,e,a,r),Kc("target",c,d,e,l,s)}}function qc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function rl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Ht(d)?d:cb(d,s,a,l);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){a(new Ze(We.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Ze(We.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new Ze(We.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){a(new Ze(We.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...kc(u,m,l),sourceNode:f,targetNode:p})}return c}const Xc=Symbol("vueFlow"),jc=Symbol("nodeId"),Zc=Symbol("nodeRef"),ub=Symbol("edgeId"),fb=Symbol("edgeRef"),$i=Symbol("slots");function Jc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:l,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:h,nodesSelectionActive:_,selectNodesOnDrag:b,removeSelectedElements:g,addSelectedNodes:I,updateNodePositions:y,emits:N}=Oe(),{onStart:q,onDrag:U,onStop:X,onClick:K,el:W,disabled:ne,id:re,selectable:L,dragHandle:Q}=e,v=n.shallowRef(!1);let T=[],$,P=null,H={x:void 0,y:void 0},te={x:0,y:0},M=null,ee=!1,le=!1,me=0,ye=!1;const ce=hb(),ue=({x:j,y:Y})=>{H={x:j,y:Y};let E=!1;if(T=T.map(A=>{const R={x:j-A.distance.x,y:Y-A.distance.y},{computedPosition:G}=tl(A,o.value?Ni(R,i.value):R,N.error,r.value,A.parentNode?m(A.parentNode):void 0);return E=E||A.position.x!==G.x||A.position.y!==G.y,A.position=G,A}),le=le||E,!!E&&(y(T,!0,!0),v.value=!0,M)){const[A,R]=el({id:re,dragItems:T,findNode:m});U({event:M,node:A,nodes:R})}},he=()=>{if(!P)return;const[j,Y]=Vc(te,P,u.value);if(j!==0||Y!==0){const E={x:(H.x??0)-j/c.value.zoom,y:(H.y??0)-Y/c.value.zoom};p({x:j,y:Y})&&ue(E)}me=requestAnimationFrame(he)},ve=(j,Y)=>{ee=!0;const E=m(re);!b.value&&!h.value&&E&&(E.selected||g()),E&&n.toValue(L)&&b.value&&al(E,h.value,I,g,_,!1,Y);const A=ce(j.sourceEvent);if(H=A,T=qg(l.value,f.value,A,re),T.length){const[R,G]=el({id:re,dragItems:T,findNode:m});q({event:j.sourceEvent,node:R,nodes:G})}},Se=(j,Y)=>{var E;j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||(le=!1,s.value===0&&ve(j,Y),H=ce(j.sourceEvent),P=((E=t.value)==null?void 0:E.getBoundingClientRect())||null,te=Et(j.sourceEvent,P))},Ie=(j,Y)=>{const E=ce(j.sourceEvent);if(!ye&&ee&&d.value&&(ye=!0,he()),!ee){const A=E.xSnapped-(H.x??0),R=E.ySnapped-(H.y??0);Math.sqrt(A*A+R*R)>s.value&&ve(j,Y)}(H.x!==E.xSnapped||H.y!==E.ySnapped)&&T.length&&ee&&(M=j.sourceEvent,te=Et(j.sourceEvent,P),ue(E))},pe=j=>{let Y=!1;if(!ee&&!v.value&&!h.value){const E=j.sourceEvent,A=ce(E),R=A.xSnapped-(H.x??0),G=A.ySnapped-(H.y??0),J=Math.sqrt(R*R+G*G);J!==0&&J<=s.value&&(K==null||K(E),Y=!0)}if(T.length&&!Y){le&&(y(T,!1,!1),le=!1);const[E,A]=el({id:re,dragItems:T,findNode:m});X({event:j.sourceEvent,node:E,nodes:A})}T=[],v.value=!1,ye=!1,ee=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(ne),W],([j,Y],E,A)=>{if(Y){const R=ft(Y);j||($=Ph().on("start",G=>Se(G,Y)).on("drag",G=>Ie(G,Y)).on("end",G=>pe(G)).filter(G=>{const J=G.target,fe=n.toValue(Q);return!G.button&&(!a.value||!Oc(J,`.${a.value}`,Y)&&(!fe||Oc(J,fe,Y)))}),R.call($)),A(()=>{R.on(".drag",null),$&&($.on("start",null),$.on("drag",null),$.on("end",null))})}}),v}function mb(){return{doubleClick:Ne(),click:Ne(),mouseEnter:Ne(),mouseMove:Ne(),mouseLeave:Ne(),contextMenu:Ne(),updateStart:Ne(),update:Ne(),updateEnd:Ne()}}function pb(e,t){const o=mb();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 hb(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Oe();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=eb(a)?a.sourceEvent:a,{x:c,y:d}=Et(s,r),u=yo({x:c,y:d},e.value),{x:f,y:p}=o.value?Ni(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function xi(){return!0}function Qc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:l,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:_,findNode:b,panBy:g,startConnection:I,updateConnection:y,endConnection:N,emits:q,viewport:U,edges:X,nodes:K,isValidConnection:W,nodeLookup:ne}=Oe();let re=null,L=!1,Q=null;function v($){var P;const H=n.toValue(o)==="target",te=nl($),M=vc($.target),ee=$.currentTarget;if(ee&&(te&&$.button===0||!te)){let le=function(be){E=Et(be,pe),ue=ab(yo(E,U.value,!1,[1,1]),u.value,ne.value,G),A||(R(),A=!0);const xe=Uc(be,{handle:ue,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:ce,doc:M,lib:"vue",flowId:s,nodeLookup:ne.value},X.value,K.value,b,ne.value);Q=xe.handleDomNode,re=xe.connection,L=rb(!!ue,xe.isValid);const Ve={...ke,isValid:L,to:xe.toHandle&&L?ho({x:xe.toHandle.x,y:xe.toHandle.y},U.value):E,toHandle:xe.toHandle,toPosition:L&&xe.toHandle?xe.toHandle.position:il[G.position],toNode:xe.toHandle?ne.value.get(xe.toHandle.nodeId):null};if(L&&ue&&(ke!=null&&ke.toHandle)&&Ve.toHandle&&ke.toHandle.type===Ve.toHandle.type&&ke.toHandle.nodeId===Ve.toHandle.nodeId&&ke.toHandle.id===Ve.toHandle.id&&ke.to.x===Ve.to.x&&ke.to.y===Ve.to.y)return;const Te=ue??xe.toHandle;if(y(Te&&L?ho({x:Te.x,y:Te.y},U.value):E,Te,lb(!!Te,L)),ke=Ve,!ue&&!L&&!Q)return ol(Y);re&&re.source!==re.target&&Q&&(ol(Y),Y=Q,Q.classList.add("connecting","vue-flow__handle-connecting"),Q.classList.toggle("valid",!!L),Q.classList.toggle("vue-flow__handle-valid",!!L))},me=function(be){"touches"in be&&be.touches.length>0||((ue||Q)&&re&&L&&(l?l(be,re):q.connect(re)),q.connectEnd(be),a&&(r==null||r(be)),ol(Y),cancelAnimationFrame(he),N(be),A=!1,L=!1,re=null,Q=null,M.removeEventListener("mousemove",le),M.removeEventListener("mouseup",me),M.removeEventListener("touchmove",le),M.removeEventListener("touchend",me))};const ye=b(n.toValue(t));let ce=n.toValue(i)||W.value||xi;!ce&&ye&&(ce=(H?ye.isValidSourcePos:ye.isValidTargetPos)||xi);let ue,he=0;const{x:ve,y:Se}=Et($),Ie=Hc(n.toValue(a),ee),pe=(P=c.value)==null?void 0:P.getBoundingClientRect();if(!pe||!Ie)return;const j=Fc(n.toValue(t),Ie,n.toValue(e),ne.value,d.value);if(!j)return;let Y,E=Et($,pe),A=!1;const R=()=>{if(!h.value)return;const[be,xe]=Vc(E,pe,_.value);g({x:be,y:xe}),he=requestAnimationFrame(R)},G={...j,nodeId:n.toValue(t),type:Ie,position:j.position},J=ne.value.get(n.toValue(t)),_e={inProgress:!0,isValid:null,from:Mn(J,G,$e.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:J,to:E,toHandle:null,toPosition:il[G.position],toNode:null};I({nodeId:n.toValue(t),id:n.toValue(e),type:Ie,position:(ee==null?void 0:ee.getAttribute("data-handlepos"))||$e.Top,...E},{x:ve-pe.left,y:Se-pe.top}),q.connectStart({event:$,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ie});let ke=_e;M.addEventListener("mousemove",le),M.addEventListener("mouseup",me),M.addEventListener("touchmove",le),M.addEventListener("touchend",me)}}function T($){var P,H;if(!f.value)return;const te=n.toValue(o)==="target";if(!p.value){q.clickConnectStart({event:$,nodeId:n.toValue(t),handleId:n.toValue(e)}),I({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:$e.Top,...Et($)},void 0,!0);return}let M=n.toValue(i)||W.value||xi;const ee=b(n.toValue(t));if(!M&&ee&&(M=(te?ee.isValidSourcePos:ee.isValidTargetPos)||xi),ee&&(typeof ee.connectable>"u"?m.value:ee.connectable)===!1)return;const le=vc($.target),me=Uc($,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:$e.Top,...Et($)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:M,doc:le,lib:"vue",flowId:s,nodeLookup:ne.value},X.value,K.value,b,ne.value),ye=((P=me.connection)==null?void 0:P.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!ye&&q.connect(me.connection),q.clickConnectEnd($),N($,!0)}return{handlePointerDown:v,handleClick:T}}function yb(){return n.inject(jc,"")}function ed(e){const t=e??yb()??"",o=n.inject(Zc,n.ref(null)),{findNode:i,edges:a,emits:l}=Oe(),r=i(t);return r||l.error(new Ze(We.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>cn([r],a.value))}}function gb(){return{doubleClick:Ne(),click:Ne(),mouseEnter:Ne(),mouseMove:Ne(),mouseLeave:Ne(),contextMenu:Ne(),dragStart:Ne(),drag:Ne(),dragStop:Ne()}}function bb(e,t){const o=gb();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 td(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Oe();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,p=d?4:1,m=c.x*u*p,h=c.y*f*p,_=[];for(const b of e.value)if(b.draggable||r&&typeof b.draggable>"u"){const g={x:b.computedPosition.x+m,y:b.computedPosition.y+h},{position:I}=tl(b,g,s.error,t.value,b.parentNode?i(b.parentNode):void 0);_.push({id:b.id,position:I,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(_,!0,!1)}}const Ii=.1,_b=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Yt(){return _o("Viewport not initialized yet."),Promise.resolve(!1)}const wb={zoomIn:Yt,zoomOut:Yt,zoomTo:Yt,fitView:Yt,setCenter:Yt,fitBounds:Yt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Yt,setTransform:Yt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ao:ci).scaleBy(sl(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}=wc({x:-i,y:-a},e.translateExtent),f=Vn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?ao:ci).transform(sl(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"?ao:ci).scaleTo(sl(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:Ii,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=Za(s),{x:d,y:u,zoom:f}=Sc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ii);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:Ii})=>{const{x:r,y:s,zoom:c}=Sc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ii);return o(r,s,c,l)},project:a=>yo(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 yo(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 ho(s,e.viewport)}return{x:0,y:0}}}:wb)}function sl(e,t=0,o=_b,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function kb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let _,b,g=!!(o.nodes.value.length||o.edges.value.length);_=xn([e.modelValue,()=>{var I,y;return(y=(I=e.modelValue)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(b==null||b.pause(),o.setElements(I),!b&&!g&&I.length?g=!0:b==null||b.resume())}),b=xn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([I,y])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...I,...y],n.nextTick(()=>{_==null||_.resume()}))},{immediate:g}),n.onScopeDispose(()=>{_==null||_.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let _,b,g=!!o.nodes.value.length;_=xn([e.nodes,()=>{var I,y;return(y=(I=e.nodes)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(b==null||b.pause(),o.setNodes(I),!b&&!g&&I.length?g=!0:b==null||b.resume())}),b=xn([o.nodes,()=>o.nodes.value.length],([I])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...I],n.nextTick(()=>{_==null||_.resume()}))},{immediate:g}),n.onScopeDispose(()=>{_==null||_.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let _,b,g=!!o.edges.value.length;_=xn([e.edges,()=>{var I,y;return(y=(I=e.edges)==null?void 0:I.value)==null?void 0:y.length}],([I])=>{I&&Array.isArray(I)&&(b==null||b.pause(),o.setEdges(I),!b&&!g&&I.length?g=!0:b==null||b.resume())}),b=xn([o.edges,()=>o.edges.value.length],([I])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...I],n.nextTick(()=>{_==null||_.resume()}))},{immediate:g}),n.onScopeDispose(()=>{_==null||_.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&Ke(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&Ke(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&Ke(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&Ke(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{Ke(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async b=>{let g=b;typeof t.autoConnect=="function"&&(g=await t.autoConnect(b)),g!==!1&&o.addEdges([g])};n.watch(()=>t.autoConnect,()=>{Ke(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,g,I)=>{b?o.onConnect(_):o.hooks.value.connect.off(_),I(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const g=b;if(!_.includes(g)){const I=n.toRef(()=>t[g]),y=o[g];n.isRef(y)&&i.run(()=>{n.watch(I,N=>{Ke(N)&&(y.value=N)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function Eb(){return{edgesChange:Ne(),nodesChange:Ne(),nodeDoubleClick:Ne(),nodeClick:Ne(),nodeMouseEnter:Ne(),nodeMouseMove:Ne(),nodeMouseLeave:Ne(),nodeContextMenu:Ne(),nodeDragStart:Ne(),nodeDrag:Ne(),nodeDragStop:Ne(),nodesInitialized:Ne(),miniMapNodeClick:Ne(),miniMapNodeDoubleClick:Ne(),miniMapNodeMouseEnter:Ne(),miniMapNodeMouseMove:Ne(),miniMapNodeMouseLeave:Ne(),connect:Ne(),connectStart:Ne(),connectEnd:Ne(),clickConnectStart:Ne(),clickConnectEnd:Ne(),paneReady:Ne(),init:Ne(),move:Ne(),moveStart:Ne(),moveEnd:Ne(),selectionDragStart:Ne(),selectionDrag:Ne(),selectionDragStop:Ne(),selectionContextMenu:Ne(),selectionStart:Ne(),selectionEnd:Ne(),viewportChangeStart:Ne(),viewportChange:Ne(),viewportChangeEnd:Ne(),paneScroll:Ne(),paneClick:Ne(),paneContextMenu:Ne(),paneMouseEnter:Ne(),paneMouseMove:Ne(),paneMouseLeave:Ne(),edgeContextMenu:Ne(),edgeMouseEnter:Ne(),edgeMouseMove:Ne(),edgeMouseLeave:Ne(),edgeDoubleClick:Ne(),edgeClick:Ne(),edgeUpdateStart:Ne(),edgeUpdate:Ne(),edgeUpdateEnd:Ne(),updateNodeInternals:Ne(),error:Ne(e=>_o(e.message))}}function Nb(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),Qn(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),Qn(l.removeHasEmitListeners)}});function i(a){var l;const r=$b(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function $b(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function nd(){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:qa.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:fo.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:ln.Bezier,style:{}},connectionMode:Tt.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:bo()?"Meta":"Control",zoomActivationKeyCode:bo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Eb(),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 xb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Ib(e,t,o){const i=vb(e),a=E=>{const A=E??[];e.hooks.updateNodeInternals.trigger(A)},l=E=>Hg(E,e.nodes,e.edges),r=E=>Ug(E,e.nodes,e.edges),s=E=>cn(E,e.edges),c=({id:E,type:A,nodeId:R})=>{var G;const J=E?`-${A}-${E}`:`-${A}`;return Array.from(((G=e.connectionLookup.get(`${R}${J}`))==null?void 0:G.values())??[])},d=E=>{if(E)return t.value.get(E)},u=E=>{if(E)return o.value.get(E)},f=(E,A,R)=>{var G,J;const fe=[];for(const _e of E){const ke={id:_e.id,type:"position",dragging:R,from:_e.from};if(A&&(ke.position=_e.position,_e.parentNode)){const be=d(_e.parentNode);ke.position={x:ke.position.x-(((G=be==null?void 0:be.computedPosition)==null?void 0:G.x)??0),y:ke.position.y-(((J=be==null?void 0:be.computedPosition)==null?void 0:J.y)??0)}}fe.push(ke)}fe!=null&&fe.length&&e.hooks.nodesChange.trigger(fe)},p=E=>{if(!e.vueFlowRef)return;const A=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!A)return;const R=window.getComputedStyle(A),{m22:G}=new window.DOMMatrixReadOnly(R.transform),J=[];for(const fe of E){const _e=fe,ke=d(_e.id);if(ke){const be=vi(_e.nodeElement);if(!!(be.width&&be.height&&(ke.dimensions.width!==be.width||ke.dimensions.height!==be.height||_e.forceUpdate))){const Ve=_e.nodeElement.getBoundingClientRect();ke.dimensions=be,ke.handleBounds.source=Yc("source",_e.nodeElement,Ve,G,ke.id),ke.handleBounds.target=Yc("target",_e.nodeElement,Ve,G,ke.id),J.push({id:ke.id,type:"dimensions",dimensions:be})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},m=(E,A)=>{const R=new Set,G=new Set;for(const _e of E)sn(_e)?R.add(_e.id):Ht(_e)&&G.add(_e.id);const J=Gt(t.value,R,!0),fe=Gt(o.value,G);if(e.multiSelectionActive){for(const _e of R)J.push(Ft(_e,A));for(const _e of G)fe.push(Ft(_e,A))}J.length&&e.hooks.nodesChange.trigger(J),fe.length&&e.hooks.edgesChange.trigger(fe)},h=E=>{if(e.multiSelectionActive){const A=E.map(R=>Ft(R.id,!0));e.hooks.nodesChange.trigger(A);return}e.hooks.nodesChange.trigger(Gt(t.value,new Set(E.map(A=>A.id)),!0)),e.hooks.edgesChange.trigger(Gt(o.value))},_=E=>{if(e.multiSelectionActive){const A=E.map(R=>Ft(R.id,!0));e.hooks.edgesChange.trigger(A);return}e.hooks.edgesChange.trigger(Gt(o.value,new Set(E.map(A=>A.id)))),e.hooks.nodesChange.trigger(Gt(t.value,new Set,!0))},b=E=>{m(E,!0)},g=E=>{const R=(E||e.nodes).map(G=>(G.selected=!1,Ft(G.id,!1)));e.hooks.nodesChange.trigger(R)},I=E=>{const R=(E||e.edges).map(G=>(G.selected=!1,Ft(G.id,!1)));e.hooks.edgesChange.trigger(R)},y=E=>{if(!E||!E.length)return m([],!1);const A=E.reduce((R,G)=>{const J=Ft(G.id,!1);return sn(G)?R.nodes.push(J):R.edges.push(J),R},{nodes:[],edges:[]});A.nodes.length&&e.hooks.nodesChange.trigger(A.nodes),A.edges.length&&e.hooks.edgesChange.trigger(A.edges)},N=E=>{var A;(A=e.d3Zoom)==null||A.scaleExtent([E,e.maxZoom]),e.minZoom=E},q=E=>{var A;(A=e.d3Zoom)==null||A.scaleExtent([e.minZoom,E]),e.maxZoom=E},U=E=>{var A;(A=e.d3Zoom)==null||A.translateExtent(E),e.translateExtent=E},X=E=>{e.nodeExtent=E,a()},K=E=>{var A;(A=e.d3Zoom)==null||A.clickDistance(E)},W=E=>{e.nodesDraggable=E,e.nodesConnectable=E,e.elementsSelectable=E},ne=E=>{const A=E instanceof Function?E(e.nodes):E;!e.initialized&&!A.length||(e.nodes=Wc(A,d,e.hooks.error.trigger))},re=E=>{const A=E instanceof Function?E(e.edges):E;if(!e.initialized&&!A.length)return;const R=rl(A,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ll(e.connectionLookup,o.value,R),e.edges=R},L=E=>{const A=E instanceof Function?E([...e.nodes,...e.edges]):E;!e.initialized&&!A.length||(ne(A.filter(sn)),re(A.filter(Ht)))},Q=E=>{let A=E instanceof Function?E(e.nodes):E;A=Array.isArray(A)?A:[A];const R=Wc(A,d,e.hooks.error.trigger),G=[];for(const J of R)G.push(Tc(J));G.length&&e.hooks.nodesChange.trigger(G)},v=E=>{let A=E instanceof Function?E(e.edges):E;A=Array.isArray(A)?A:[A];const R=rl(A,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),G=[];for(const J of R)G.push(Tc(J));G.length&&e.hooks.edgesChange.trigger(G)},T=(E,A=!0,R=!1)=>{const G=E instanceof Function?E(e.nodes):E,J=Array.isArray(G)?G:[G],fe=[],_e=[];function ke(xe){const Ve=s(xe);for(const Te of Ve)(!Ke(Te.deletable)||Te.deletable)&&_e.push(Bc(Te.id,Te.source,Te.target,Te.sourceHandle,Te.targetHandle))}function be(xe){const Ve=[];for(const Te of e.nodes)Te.parentNode===xe&&Ve.push(Te);if(Ve.length){for(const Te of Ve)fe.push(Mc(Te.id));A&&ke(Ve);for(const Te of Ve)be(Te.id)}}for(const xe of J){const Ve=typeof xe=="string"?d(xe):xe;Ve&&(Ke(Ve.deletable)&&!Ve.deletable||(fe.push(Mc(Ve.id)),A&&ke([Ve]),R&&be(Ve.id)))}_e.length&&e.hooks.edgesChange.trigger(_e),fe.length&&e.hooks.nodesChange.trigger(fe)},$=E=>{const A=E instanceof Function?E(e.edges):E,R=Array.isArray(A)?A:[A],G=[];for(const J of R){const fe=typeof J=="string"?u(J):J;fe&&(Ke(fe.deletable)&&!fe.deletable||G.push(Bc(typeof J=="string"?J:J.id,fe.source,fe.target,fe.sourceHandle,fe.targetHandle)))}e.hooks.edgesChange.trigger(G)},P=(E,A,R=!0)=>{const G=u(E.id);if(!G)return!1;const J=e.edges.indexOf(G),fe=db(E,A,G,R,e.hooks.error.trigger);if(fe){const[_e]=rl([fe],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ke,be)=>be===J?_e:ke),ll(e.connectionLookup,o.value,[_e]),_e}return!1},H=(E,A,R={replace:!1})=>{const G=u(E);if(!G)return;const J=typeof A=="function"?A(G):A;G.data=R.replace?J:{...G.data,...J}},te=E=>Ac(E,e.nodes),M=E=>{const A=Ac(E,e.edges);return ll(e.connectionLookup,o.value,A),A},ee=(E,A,R={replace:!1})=>{const G=d(E);if(!G)return;const J=typeof A=="function"?A(G):A;R.replace?e.nodes.splice(e.nodes.indexOf(G),1,J):Object.assign(G,J)},le=(E,A,R={replace:!1})=>{const G=d(E);if(!G)return;const J=typeof A=="function"?A(G):A;G.data=R.replace?J:{...G.data,...J}},me=(E,A,R=!1)=>{R?e.connectionClickStartHandle=E:e.connectionStartHandle=E,e.connectionEndHandle=null,e.connectionStatus=null,A&&(e.connectionPosition=A)},ye=(E,A=null,R=null)=>{e.connectionStartHandle&&(e.connectionPosition=E,e.connectionEndHandle=A,e.connectionStatus=R)},ce=(E,A)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,A?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ue=E=>{const A=Pg(E),R=A?null:po(E)?E:d(E.id);return!A&&!R?[null,null,A]:[A?E:_i(R),R,A]},he=(E,A=!0,R=e.nodes)=>{const[G,J,fe]=ue(E);if(!G)return[];const _e=[];for(const ke of R||e.nodes){if(!fe&&(ke.id===J.id||!ke.computedPosition))continue;const be=_i(ke),xe=wi(be,G);(A&&xe>0||xe>=be.width*be.height||xe>=Number(G.width)*Number(G.height))&&_e.push(ke)}return _e},ve=(E,A,R=!0)=>{const[G]=ue(E);if(!G)return!1;const J=wi(G,A);return R&&J>0||J>=Number(G.width)*Number(G.height)},Se=E=>{const{viewport:A,dimensions:R,d3Zoom:G,d3Selection:J,translateExtent:fe}=e;if(!G||!J||!E.x&&!E.y)return!1;const _e=Vn.translate(A.x+E.x,A.y+E.y).scale(A.zoom),ke=[[0,0],[R.width,R.height]],be=G.constrain()(_e,ke,fe),xe=e.viewport.x!==be.x||e.viewport.y!==be.y||e.viewport.zoom!==be.k;return G.transform(J,be),xe},Ie=E=>{const A=E instanceof Function?E(e):E,R=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ke(A.defaultEdgeOptions)&&(e.defaultEdgeOptions=A.defaultEdgeOptions);const G=A.modelValue||A.nodes||A.edges?[]:void 0;G&&(A.modelValue&&G.push(...A.modelValue),A.nodes&&G.push(...A.nodes),A.edges&&G.push(...A.edges),L(G));const J=()=>{Ke(A.maxZoom)&&q(A.maxZoom),Ke(A.minZoom)&&N(A.minZoom),Ke(A.translateExtent)&&U(A.translateExtent)};for(const fe of Object.keys(A)){const _e=fe,ke=A[_e];![...xb,...R].includes(_e)&&Ke(ke)&&(e[_e]=ke)}Ia(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:L,setNodes:ne,setEdges:re,addNodes:Q,addEdges:v,removeNodes:T,removeEdges:$,findNode:d,findEdge:u,updateEdge:P,updateEdgeData:H,updateNode:ee,updateNodeData:le,applyEdgeChanges:M,applyNodeChanges:te,addSelectedElements:b,addSelectedNodes:h,addSelectedEdges:_,setMinZoom:N,setMaxZoom:q,setTranslateExtent:U,setNodeExtent:X,setPaneClickDistance:K,removeSelectedElements:y,removeSelectedNodes:g,removeSelectedEdges:I,startConnection:me,updateConnection:ye,endConnection:ce,setInteractive:W,setState:Ie,getIntersectingNodes:he,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ve,panBy:Se,fitView:E=>i.value.fitView(E),zoomIn:E=>i.value.zoomIn(E),zoomOut:E=>i.value.zoomOut(E),zoomTo:(E,A)=>i.value.zoomTo(E,A),setViewport:(E,A)=>i.value.setViewport(E,A),setTransform:(E,A)=>i.value.setTransform(E,A),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(E,A,R)=>i.value.setCenter(E,A,R),fitBounds:(E,A)=>i.value.fitBounds(E,A),project:E=>i.value.project(E),screenToFlowCoordinate:E=>i.value.screenToFlowCoordinate(E),flowToScreenCoordinate:E=>i.value.flowToScreenCoordinate(E),toObject:()=>{const E=[],A=[];for(const R of e.nodes){const{computedPosition:G,handleBounds:J,selected:fe,dimensions:_e,isParent:ke,resizing:be,dragging:xe,events:Ve,...Te}=R;E.push(Te)}for(const R of e.edges){const{selected:G,sourceNode:J,targetNode:fe,events:_e,...ke}=R;A.push(ke)}return JSON.parse(JSON.stringify({nodes:E,edges:A,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:E=>new Promise(A=>{const{nodes:R,edges:G,position:J,zoom:fe,viewport:_e}=E;R&&ne(R),G&&re(G);const[ke,be]=_e!=null&&_e.x&&(_e!=null&&_e.y)?[_e.x,_e.y]:J??[null,null];if(ke&&be){const xe=(_e==null?void 0:_e.zoom)||fe||e.viewport.zoom;return Ia(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ke,y:be,zoom:xe}).then(()=>{A(!0)})})}else A(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const E=nd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const A=Vn.translate(E.defaultViewport.x??0,E.defaultViewport.y??0).scale(rn(E.defaultViewport.zoom??1,E.minZoom,E.maxZoom)),R=e.viewportRef.getBoundingClientRect(),G=[[0,0],[R.width,R.height]],J=e.d3Zoom.constrain()(A,G,E.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}Ie(E)},$destroy:()=>{}}}const Sb=["data-id","data-handleid","data-nodeid","data-handlepos"],Cb={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...Cb,props:{id:{default:null},type:{},position:{default:()=>$e.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose: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}=Oe(),{id:m,node:h,nodeEl:_,connectedEdges:b}=ed(),g=n.ref(),I=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=n.toRef(()=>{var re,L,Q,v,T,$;return((re=r.value)==null?void 0:re.nodeId)===m&&((L=r.value)==null?void 0:L.id)===e.id&&((Q=r.value)==null?void 0:Q.type)===i.value||((v=c.value)==null?void 0:v.nodeId)===m&&((T=c.value)==null?void 0:T.id)===e.id&&(($=c.value)==null?void 0:$.type)===i.value}),q=n.toRef(()=>{var re,L,Q;return((re=s.value)==null?void 0:re.nodeId)===m&&((L=s.value)==null?void 0:L.id)===e.id&&((Q=s.value)==null?void 0:Q.type)===i.value}),{handlePointerDown:U,handleClick:X}=Qc({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),K=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}):typeof e.connectable=="number"?b.value.filter(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,b.value):Ke(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var re;if(!h.dimensions.width||!h.dimensions.height)return;const L=(re=h.handleBounds[i.value])==null?void 0:re.find(te=>te.id===e.id);if(!d.value||L)return;const Q=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!g.value||!Q||!e.id)return;const v=_.value.getBoundingClientRect(),T=g.value.getBoundingClientRect(),$=window.getComputedStyle(Q),{m22:P}=new window.DOMMatrixReadOnly($.transform),H={id:e.id,position:e.position,x:(T.left-v.left)/P,y:(T.top-v.top)/P,type:i.value,nodeId:m,...vi(g.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],H]});function W(re){const L=nl(re);K.value&&I.value&&(L&&re.button===0||!L)&&U(re)}function ne(re){!m||!s.value&&!I.value||K.value&&X(re)}return t({handleClick:X,handlePointerDown:U,onClick:ne,onPointerDown:W}),(re,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:g,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":re.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${re.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:K.value,connecting:q.value,connectablestart:I.value,connectableend:y.value,connectionindicator:K.value&&(I.value&&!N.value||y.value&&N.value)}]]),onMousedown:W,onTouchstartPassive:W,onClick:ne},[n.renderSlot(re.$slots,"default",{id:re.id})],42,Sb))}}),Si=function({sourcePosition:e=$e.Bottom,targetPosition:t=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(dn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(dn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Si.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Si.inheritAttrs=!1,Si.compatConfig={MODE:3};const Rb=Si,Ci=function({targetPosition:e=$e.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(dn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Ci.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ci.inheritAttrs=!1,Ci.compatConfig={MODE:3};const Vb=Ci,Ri=function({sourcePosition:e=$e.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(dn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ri.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ri.inheritAttrs=!1,Ri.compatConfig={MODE:3};const Ab=Ri,Tb=["transform"],Mb=["width","height","x","y","rx","ry"],Bb=["y"],Db={name:"EdgeText",compatConfig:{MODE:3}},Ob=n.defineComponent({...Db,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,Mb)):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,Bb)],8,Tb))}}),Lb=["id","d","marker-end","marker-start"],Pb=["d","stroke-width"],zb={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Vi=n.defineComponent({...zb,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,Lb),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,Pb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(Ob,{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 od({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 id({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 Ai(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ad({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case $e.Left:r=t-Ai(t-i,l),s=o;break;case $e.Right:r=t+Ai(i-t,l),s=o;break;case $e.Top:r=t,s=o-Ai(o-a,l);break;case $e.Bottom:r=t,s=o+Ai(a-o,l);break}return[r,s]}function ld(e){const{sourceX:t,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:l,targetPosition:r=$e.Top,curvature:s=.25}=e,[c,d]=ad({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=ad({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[p,m,h,_]=id({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${a},${l}`,p,m,h,_]}function rd({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case $e.Left:case $e.Right:l=.5*(t+i),r=o;break;case $e.Top:case $e.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function sd(e){const{sourceX:t,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:l,targetPosition:r=$e.Top}=e,[s,c]=rd({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=rd({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,p,m,h]=id({sourceX:t,sourceY:o,targetX:a,targetY:l,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${l}`,f,p,m,h]}const cd={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function Ub({source:e,sourcePosition:t=$e.Bottom,target:o}){return t===$e.Left||t===$e.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function dd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Hb({source:e,sourcePosition:t=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:l}){const r=cd[t],s=cd[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=Ub({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,h,_;const b={x:0,y:0},g={x:0,y:0},[I,y,N,q]=od({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){h=a.x??I,_=a.y??y;const X=[{x:h,y:c.y},{x:h,y:d.y}],K=[{x:c.x,y:_},{x:d.x,y:_}];r[f]===p?m=f==="x"?X:K:m=f==="x"?K:X}else{const X=[{x:c.x,y:d.y}],K=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?K:X:m=r.y===p?X:K,t===i){const Q=Math.abs(e[f]-o[f]);if(Q<=l){const v=Math.min(l-1,l-Q);r[f]===p?b[f]=(c[f]>e[f]?-1:1)*v:g[f]=(d[f]>o[f]?-1:1)*v}}if(t!==i){const Q=f==="x"?"y":"x",v=r[f]===s[Q],T=c[Q]>d[Q],$=c[Q]<d[Q];(r[f]===1&&(!v&&T||v&&$)||r[f]!==1&&(!v&&$||v&&T))&&(m=f==="x"?X:K)}const W={x:c.x+b.x,y:c.y+b.y},ne={x:d.x+g.x,y:d.y+g.y},re=Math.max(Math.abs(W.x-m[0].x),Math.abs(ne.x-m[0].x)),L=Math.max(Math.abs(W.y-m[0].y),Math.abs(ne.y-m[0].y));re>=L?(h=(W.x+ne.x)/2,_=m[0].y):(h=m[0].x,_=(W.y+ne.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...m,{x:d.x+g.x,y:d.y+g.y},o],h,_,N,q]}function Fb(e,t,o,i){const a=Math.min(dd(e,t)/2,dd(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 cl(e){const{sourceX:t,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:l,targetPosition:r=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,h,_]=Hb({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((g,I,y)=>{let N;return y>0&&y<f.length-1?N=Fb(f[y-1],I,f[y+1],s):N=`${y===0?"M":"L"}${I.x} ${I.y}`,g+=N,g},""),p,m,h,_]}function Gb(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=od({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const Yb=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]=Gb(e);return n.h(Vi,{path:o,labelX:i,labelY:a,...t,...e})}}}),ud=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]=cl({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return n.h(Vi,{path:o,labelX:i,labelY:a,...t,...e})}}}),Wb=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(ud,{...e,...t,borderRadius:0})}}),Kb=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=ld({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return n.h(Vi,{path:o,labelX:i,labelY:a,...t,...e})}}}),qb=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]=sd({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return n.h(Vi,{path:o,labelX:i,labelY:a,...t,...e})}}}),Xb={input:Ab,default:Rb,output:Vb},jb={default:Kb,straight:Yb,step:Wb,smoothstep:ud,simplebezier:qb};function Zb(e,t,o){const i=n.computed(()=>_=>t.value.get(_)),a=n.computed(()=>_=>o.value.get(_)),l=n.computed(()=>{const _={...jb,...e.edgeTypes},b=Object.keys(_);for(const g of e.edges)g.type&&!b.includes(g.type)&&(_[g.type]=g.type);return _}),r=n.computed(()=>{const _={...Xb,...e.nodeTypes},b=Object.keys(_);for(const g of e.nodes)g.type&&!b.includes(g.type)&&(_[g.type]=g.type);return _}),s=n.computed(()=>e.onlyRenderVisibleElements?Ic(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 _=[];for(const b of e.edges){const g=t.value.get(b.source),I=t.value.get(b.target);Jg({sourcePos:g.computedPosition||{x:0,y:0},targetPos:I.computedPosition||{x:0,y:0},sourceWidth:g.dimensions.width,sourceHeight:g.dimensions.height,targetWidth:I.dimensions.width,targetHeight:I.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(b)}return _}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const _=[];for(const b of e.nodes)b.selected&&_.push(b);return _}),f=n.computed(()=>{const _=[];for(const b of e.edges)b.selected&&_.push(b);return _}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const _=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&_.push(b);return _}),h=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:l,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:h}}class un{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)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.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=nd(),a=n.reactive(i),l={};for(const[p,m]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;l[h]=m.on}const r={};for(const[p,m]of Object.entries(a.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of a.nodes)p.set(m.id,m);return p}),c=n.computed(()=>{const p=new Map;for(const m of a.edges)p.set(m.id,m);return p}),d=Zb(a,s,c),u=Ib(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...qm(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 Oe(e){const t=un.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(Xc,null);typeof c<"u"&&c!==null&&(!r||c.id===r)&&(s=c)}if(s||r&&(s=t.get(r)),!s||r&&s.id!==r){const c=l??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,p,m)=>{const h=b=>{d.applyNodeChanges(b)},_=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(h),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)),m(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),Qn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():_o(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(Xc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Ze(We.USEVUEFLOW_OPTIONS))}return s}function Jb(e){const{emits:t,dimensions:o}=Oe();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=vi(e.value);(s.width===0||s.height===0)&&t.error(new Ze(We.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 Qb={name:"UserSelection",compatConfig:{MODE:3}},e0=n.defineComponent({...Qb,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))}}),t0=["tabIndex"],n0={name:"NodesSelection",compatConfig:{MODE:3}},o0=n.defineComponent({...n0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Oe(),s=td(),c=n.ref(null),d=Jc({el:c,onStart(h){t.selectionDragStart(h),t.nodeDragStart(h)},onDrag(h){t.selectionDrag(h),t.nodeDrag(h)},onStop(h){t.selectionDragStop(h),t.nodeDragStop(h)}});n.onMounted(()=>{var h;l.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=n.computed(()=>Za(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){t.selectionContextMenu({event:h,nodes:i.value})}function m(h){l.value||An[h.key]&&(h.preventDefault(),s({x:An[h.key].x,y:An[h.key].y},h.shiftKey))}return(h,_)=>!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,t0)],6)):n.createCommentVNode("",!0)}});function i0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const a0={name:"Pane",compatConfig:{MODE:3}},l0=n.defineComponent({...a0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:l,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:h,deleteKeyCode:_,multiSelectionKeyCode:b,multiSelectionActive:g,edgeLookup:I,nodeLookup:y,connectionLookup:N,defaultEdgeOptions:q,connectionStartHandle:U,panOnDrag:X}=Oe(),K=n.shallowRef(null),W=n.shallowRef(new Set),ne=n.shallowRef(new Set),re=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),Q=n.toRef(()=>U.value!==null);let v=!1,T=!1;const $=mo(_,{actInsideInputWithModifier:!1}),P=mo(b);n.watch($,ce=>{ce&&(p(f.value),m(u.value),d.value=!1)}),n.watch(P,ce=>{g.value=ce});function H(ce,ue){return he=>{he.target===ue&&(ce==null||ce(he))}}function te(ce){if(v||Q.value){v=!1;return}a.paneClick(ce),r(),d.value=!1}function M(ce){var ue;if(Array.isArray(X.value)&&((ue=X.value)!=null&&ue.includes(2))){ce.preventDefault();return}a.paneContextMenu(ce)}function ee(ce){a.paneScroll(ce)}function le(ce){var ue,he,ve;if(re.value=((ue=t.value)==null?void 0:ue.getBoundingClientRect())??null,!c.value||!e.isSelecting||ce.button!==0||ce.target!==K.value||!re.value)return;(ve=(he=ce.target)==null?void 0:he.setPointerCapture)==null||ve.call(he,ce.pointerId);const{x:Se,y:Ie}=i0(ce,re.value);T=!0,v=!1,r(),s.value={width:0,height:0,startX:Se,startY:Ie,x:Se,y:Ie},a.selectionStart(ce)}function me(ce){var ue;if(!re.value||!s.value)return;v=!0;const{x:he,y:ve}=Et(ce,re.value),{startX:Se=0,startY:Ie=0}=s.value,pe={startX:Se,startY:Ie,x:he<Se?he:Se,y:ve<Ie?ve:Ie,width:Math.abs(he-Se),height:Math.abs(ve-Ie)},j=W.value,Y=ne.value;W.value=new Set(Ic(o.value,pe,i.value,h.value===qa.Partial,!0).map(A=>A.id)),ne.value=new Set;const E=((ue=q.value)==null?void 0:ue.selectable)??!0;for(const A of W.value){const R=N.value.get(A);if(R)for(const{edgeId:G}of R.values()){const J=I.value.get(G);J&&(J.selectable??E)&&ne.value.add(G)}}if(!qc(j,W.value)){const A=Gt(y.value,W.value,!0);a.nodesChange(A)}if(!qc(Y,ne.value)){const A=Gt(I.value,ne.value);a.edgesChange(A)}s.value=pe,l.value=!0,d.value=!1}function ye(ce){var ue;ce.button!==0||!T||((ue=ce.target)==null||ue.releasePointerCapture(ce.pointerId),!l.value&&s.value&&ce.target===K.value&&te(ce),l.value=!1,s.value=null,d.value=W.value.size>0,a.selectionEnd(ce),e.selectionKeyPressed&&(v=!1),T=!1)}return(ce,ue)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:K,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:ce.isSelecting}]),onClick:ue[0]||(ue[0]=he=>L.value?void 0:H(te,K.value)(he)),onContextmenu:ue[1]||(ue[1]=he=>H(M,K.value)(he)),onWheelPassive:ue[2]||(ue[2]=he=>H(ee,K.value)(he)),onPointerenter:ue[3]||(ue[3]=he=>L.value?void 0:n.unref(a).paneMouseEnter(he)),onPointerdown:ue[4]||(ue[4]=he=>L.value?le(he):n.unref(a).paneMouseMove(he)),onPointermove:ue[5]||(ue[5]=he=>L.value?me(he):n.unref(a).paneMouseMove(he)),onPointerup:ue[6]||(ue[6]=he=>L.value?ye(he):void 0),onPointerleave:ue[7]||(ue[7]=he=>n.unref(a).paneMouseLeave(he))},[n.renderSlot(ce.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(e0,{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(o0,{key:1})):n.createCommentVNode("",!0)],34))}}),r0={name:"Transform",compatConfig:{MODE:3}},s0=n.defineComponent({...r0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Oe(),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))}}),c0={name:"Viewport",compatConfig:{MODE:3}},d0=n.defineComponent({...c0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:l,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:h,preventScrolling:_,noWheelClassName:b,noPanClassName:g,emits:I,connectionStartHandle:y,userSelectionActive:N,paneDragging:q,d3Zoom:U,d3Selection:X,d3ZoomHandler:K,viewport:W,viewportRef:ne,paneClickDistance:re}=Oe();Jb(ne);const L=n.shallowRef(!1),Q=n.shallowRef(!1);let v=null,T=!1,$=0,P={x:0,y:0,zoom:0};const H=mo(s),te=mo(r),M=mo(l),ee=n.toRef(()=>(!te.value||te.value&&r.value===!0)&&(H.value||f.value)),le=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&ee.value!==!0),ye=n.toRef(()=>te.value&&r.value!==!0||N.value||me.value),ce=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!ne.value){_o("Viewport element is missing");return}const Ie=ne.value,pe=Ie.getBoundingClientRect(),j=Ag().clickDistance(re.value).scaleExtent([t.value,o.value]).translateExtent(a.value),Y=ft(Ie).call(j),E=Y.on("wheel.zoom"),A=Vn.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),R=[[0,0],[pe.width,pe.height]],G=j.constrain()(A,R,a.value);j.transform(Y,G),j.wheelDelta(Ja),U.value=j,X.value=Y,K.value=E,W.value={x:G.x,y:G.y,zoom:G.k},j.on("start",J=>{var fe;if(!J.sourceEvent)return null;$=J.sourceEvent.button,L.value=!0;const _e=ve(J.transform);((fe=J.sourceEvent)==null?void 0:fe.type)==="mousedown"&&(q.value=!0),P=_e,I.viewportChangeStart(_e),I.moveStart({event:J,flowTransform:_e})}),j.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,q.value=!1,ue(ee.value,$??0)&&!T&&I.paneContextMenu(J.sourceEvent),T=!1,he(P,J.transform)){const fe=ve(J.transform);P=fe,I.viewportChangeEnd(fe),I.moveEnd({event:J,flowTransform:fe})}}),j.filter(J=>{var fe;const _e=M.value||h.value,ke=m.value&&J.ctrlKey,be=J.button,xe=J.type==="wheel";if(be===1&&J.type==="mousedown"&&(Se(J,"vue-flow__node")||Se(J,"vue-flow__edge")))return!0;if(!ee.value&&!_e&&!le.value&&!p.value&&!m.value||N.value||ce.value&&!xe||!p.value&&J.type==="dblclick"||Se(J,b.value)&&xe||Se(J,g.value)&&(!xe||le.value&&xe&&!M.value)||!m.value&&J.ctrlKey&&xe||!_e&&!le.value&&!ke&&xe)return!1;if(!m&&J.type==="touchstart"&&((fe=J.touches)==null?void 0:fe.length)>1)return J.preventDefault(),!1;if(!ee.value&&(J.type==="mousedown"||J.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&be===0||Array.isArray(f.value)&&!f.value.includes(be)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Ve=Array.isArray(f.value)&&f.value.includes(be)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!be||be<=1;return(!J.ctrlKey||H.value||xe)&&Ve}),n.watch([N,ee],()=>{N.value&&!L.value?j.on("zoom",null):N.value||j.on("zoom",J=>{W.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const fe=ve(J.transform);T=ue(ee.value,$??0),I.viewportChange(fe),I.move({event:J,flowTransform:fe})})},{immediate:!0}),n.watch([N,le,d,M,m,_,b],()=>{le.value&&!M.value&&!N.value?Y.on("wheel.zoom",J=>{if(Se(J,b.value))return!1;const fe=M.value||h.value,_e=m.value&&J.ctrlKey;if(!(!_.value||le.value||fe||_e))return!1;J.preventDefault(),J.stopImmediatePropagation();const be=Y.property("__zoom").k||1,xe=bo();if(!H.value&&J.ctrlKey&&m.value&&xe){const S=_t(J),D=Ja(J),O=be*2**D;j.scaleTo(Y,O,S,J);return}const Ve=J.deltaMode===1?20:1;let Te=d.value===fo.Vertical?0:J.deltaX*Ve,x=d.value===fo.Horizontal?0:J.deltaY*Ve;!xe&&J.shiftKey&&d.value!==fo.Vertical&&!Te&&x&&(Te=x,x=0),j.translateBy(Y,-(Te/be)*u.value,-(x/be)*u.value);const B=ve(Y.property("__zoom"));v&&clearTimeout(v),Q.value?(I.move({event:J,flowTransform:B}),I.viewportChange(B),v=setTimeout(()=>{I.moveEnd({event:J,flowTransform:B}),I.viewportChangeEnd(B),Q.value=!1},150)):(Q.value=!0,I.moveStart({event:J,flowTransform:B}),I.viewportChangeStart(B))},{passive:!1}):typeof E<"u"&&Y.on("wheel.zoom",function(J,fe){const _e=!_.value&&J.type==="wheel"&&!J.ctrlKey,ke=M.value||h.value,be=m.value&&J.ctrlKey;if(!ke&&!c.value&&!be&&J.type==="wheel"||_e||Se(J,b.value))return null;J.preventDefault(),E.call(this,J,fe)},{passive:!1})},{immediate:!0})});function ue(Ie,pe){return pe===2&&Array.isArray(Ie)&&Ie.includes(2)}function he(Ie,pe){return Ie.x!==pe.x&&!Number.isNaN(pe.x)||Ie.y!==pe.y&&!Number.isNaN(pe.y)||Ie.zoom!==pe.k&&!Number.isNaN(pe.k)}function ve(Ie){return{x:Ie.x,y:Ie.y,zoom:Ie.k}}function Se(Ie,pe){return Ie.target.closest(`.${pe}`)}return(Ie,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(l0,{"is-selecting":ye.value,"selection-key-pressed":n.unref(te),class:n.normalizeClass({connecting:ce.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(s0,null,{default:n.withCtx(()=>[n.renderSlot(Ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),u0=["id"],f0=["id"],m0=["id"],p0={name:"A11yDescriptions",compatConfig:{MODE:3}},h0=n.defineComponent({...p0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Oe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(gc)}-${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,u0),n.createElementVNode("div",{id:`${n.unref(bc)}-${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,f0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(Lg)}-${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,m0))],64))}});function y0(){const e=Oe();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function g0(e,t,o){return o===$e.Left?e-t:o===$e.Right?e+t:e}function b0(e,t,o){return o===$e.Top?e-t:o===$e.Bottom?e+t:e}const dl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=$e.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:g0(t,e,i),cy:b0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};dl.props=["radius","centerX","centerY","position","type"],dl.compatConfig={MODE:3};const fd=dl,_0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:l,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:h,elementsSelectable:_,edgesUpdatable:b,edgesFocusable:g,hooks:I}=Oe(),y=n.computed(()=>u(e.id)),{emit:N,on:q}=pb(y.value,l),U=n.inject($i),X=n.getCurrentInstance(),K=n.ref(!1),W=n.ref(!1),ne=n.ref(""),re=n.ref(null),L=n.ref("source"),Q=n.ref(null),v=n.toRef(()=>typeof y.value.selectable>"u"?_.value:y.value.selectable),T=n.toRef(()=>typeof y.value.updatable>"u"?b.value:y.value.updatable),$=n.toRef(()=>typeof y.value.focusable>"u"?g.value:y.value.focusable);n.provide(ub,e.id),n.provide(fb,Q);const P=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),H=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),te=n.computed(()=>{const A=y.value.type||"default",R=U==null?void 0:U[`edge-${A}`];if(R)return R;let G=y.value.template??c.value[A];if(typeof G=="string"&&X){const J=Object.keys(X.appContext.components);J&&J.includes(A)&&(G=n.resolveComponent(A,!1))}return G&&typeof G!="string"?G:(l.error(new Ze(We.EDGE_TYPE_MISSING,G)),!1)}),{handlePointerDown:M}=Qc({nodeId:ne,handleId:re,type:L,isValidConnection:p,edgeUpdaterType:L,onEdgeUpdate:me,onEdgeUpdateEnd:ye});return()=>{const A=f(y.value.source),R=f(y.value.target),G="pathOptions"in y.value?y.value.pathOptions:{};if(!A&&!R)return l.error(new Ze(We.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!A)return l.error(new Ze(We.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!R)return l.error(new Ze(We.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||A.hidden||R.hidden)return null;let J;i.value===Tt.Strict?J=A.handleBounds.source:J=[...A.handleBounds.source||[],...A.handleBounds.target||[]];const fe=Pc(J,y.value.sourceHandle);let _e;i.value===Tt.Strict?_e=R.handleBounds.target:_e=[...R.handleBounds.target||[],...R.handleBounds.source||[]];const ke=Pc(_e,y.value.targetHandle),be=(fe==null?void 0:fe.position)||$e.Bottom,xe=(ke==null?void 0:ke.position)||$e.Top,{x:Ve,y:Te}=Mn(A,fe,be),{x,y:B}=Mn(R,ke,xe);return y.value.sourceX=Ve,y.value.sourceY=Te,y.value.targetX=x,y.value.targetY=B,n.h("g",{ref:Q,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${te.value===!1?"default":y.value.type||"default"}`,s.value,P.value,{updating:K.value,selected:y.value.selected,animated:y.value.animated,inactive:!v.value&&!I.value.edgeClick.hasListeners()}],tabIndex:$.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":$.value?`${bc}-${t}`:void 0,"aria-roledescription":"edge",role:$.value?"group":"img",...y.value.domAttributes,onClick:ue,onContextmenu:he,onDblclick:ve,onMouseenter:Se,onMousemove:Ie,onMouseleave:pe,onKeyDown:$.value?E:void 0},[W.value?null:n.h(te.value===!1?c.value.default:te.value,{id:e.id,sourceNode:A,targetNode:R,source:y.value.source,target:y.value.target,type:y.value.type,updatable:T.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...q},style:H.value,markerStart:`url('#${go(y.value.markerStart,t)}')`,markerEnd:`url('#${go(y.value.markerEnd,t)}')`,sourcePosition:be,targetPosition:xe,sourceX:Ve,sourceY:Te,targetX:x,targetY:B,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...G}),[T.value==="source"||T.value===!0?[n.h("g",{onMousedown:j,onMouseenter:ee,onMouseout:le},n.h(fd,{position:be,centerX:Ve,centerY:Te,radius:a.value,type:"source","data-type":"source"}))]:null,T.value==="target"||T.value===!0?[n.h("g",{onMousedown:Y,onMouseenter:ee,onMouseout:le},n.h(fd,{position:xe,centerX:x,centerY:B,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ee(){K.value=!0}function le(){K.value=!1}function me(A,R){N.update({event:A,edge:y.value,connection:R})}function ye(A){N.updateEnd({event:A,edge:y.value}),W.value=!1}function ce(A,R){A.button===0&&(W.value=!0,ne.value=R?y.value.target:y.value.source,re.value=(R?y.value.targetHandle:y.value.sourceHandle)??null,L.value=R?"target":"source",N.updateStart({event:A,edge:y.value}),M(A))}function ue(A){var R;const G={event:A,edge:y.value};v.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(R=Q.value)==null||R.blur()):o([y.value])),N.click(G)}function he(A){N.contextMenu({event:A,edge:y.value})}function ve(A){N.doubleClick({event:A,edge:y.value})}function Se(A){N.mouseEnter({event:A,edge:y.value})}function Ie(A){N.mouseMove({event:A,edge:y.value})}function pe(A){N.mouseLeave({event:A,edge:y.value})}function j(A){ce(A,!0)}function Y(A){ce(A,!1)}function E(A){var R;!h.value&&_c.includes(A.key)&&v.value&&(A.key==="Escape"?((R=Q.value)==null||R.blur(),d([u(e.id)])):o([u(e.id)]))}}}),w0=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}=Oe(),p=(e=n.inject($i))==null?void 0:e["connection-line"],m=n.computed(()=>{var I;return f((I=i.value)==null?void 0:I.nodeId)}),h=n.computed(()=>{var I;return f((I=a.value)==null?void 0:I.nodeId)??null}),_=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${go(c.value.markerStart,t)})`:""),g=n.computed(()=>c.value.markerEnd?`url(#${go(c.value.markerEnd,t)})`:"");return()=>{var I,y,N;if(!m.value||!i.value)return null;const q=i.value.id,U=i.value.type,X=m.value.handleBounds;let K=(X==null?void 0:X[U])??[];if(o.value===Tt.Loose){const H=(X==null?void 0:X[U==="source"?"target":"source"])??[];K=[...K,...H]}if(!K)return null;const W=(q?K.find(H=>H.id===q):K[0])??null,ne=(W==null?void 0:W.position)??$e.Top,{x:re,y:L}=Mn(m.value,W,ne);let Q=null;h.value&&(o.value===Tt.Strict?Q=((I=h.value.handleBounds[U==="source"?"target":"source"])==null?void 0:I.find(H=>{var te;return H.id===((te=a.value)==null?void 0:te.id)}))||null:Q=((y=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:y.find(H=>{var te;return H.id===((te=a.value)==null?void 0:te.id)}))||null);const v=((N=a.value)==null?void 0:N.position)??(ne?il[ne]:null);if(!ne||!v)return null;const T=r.value??c.value.type??ln.Bezier;let $="";const P={sourceX:re,sourceY:L,sourcePosition:ne,targetX:_.value.x,targetY:_.value.y,targetPosition:v};return T===ln.Bezier?[$]=ld(P):T===ln.Step?[$]=cl({...P,borderRadius:0}):T===ln.SmoothStep?[$]=cl(P):T===ln.SimpleBezier?[$]=sd(P):$=`M${re},${L} ${_.value.x},${_.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:re,sourceY:L,sourcePosition:ne,targetX:_.value.x,targetY:_.value.y,targetPosition:v,sourceNode:m.value,sourceHandle:W,targetNode:h.value,targetHandle:Q,markerEnd:g.value,markerStart:b.value,connectionStatus:d.value}):n.h("path",{d:$,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":g.value,"marker-start":b.value})))}}}),v0=["id","markerWidth","markerHeight","markerUnits","orient"],k0={name:"MarkerType",compatConfig:{MODE:3}},E0=n.defineComponent({...k0,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(Xa).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(Xa).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,v0))}}),N0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},$0={name:"MarkerDefinitions",compatConfig:{MODE:3}},x0=n.defineComponent({...$0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Oe(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=go(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",N0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(E0,{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))])]))}}),I0={name:"Edges",compatConfig:{MODE:3}},S0=n.defineComponent({...I0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Oe();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(x0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),r=>(n.openBlock(),n.createElementBlock("svg",{key:r.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(Qg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(_0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(w0))],64))}}),C0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:h,ariaLiveMessage:_,snapToGrid:b,snapGrid:g,nodeDragThreshold:I,nodesDraggable:y,elementsSelectable:N,nodesConnectable:q,nodesFocusable:U,hooks:X}=Oe(),K=n.ref(null);n.provide(Zc,K),n.provide(jc,e.id);const W=n.inject($i),ne=n.getCurrentInstance(),re=td(),{node:L,parentNode:Q}=ed(e.id),{emit:v,on:T}=bb(L,r),$=n.toRef(()=>typeof L.draggable>"u"?y.value:L.draggable),P=n.toRef(()=>typeof L.selectable>"u"?N.value:L.selectable),H=n.toRef(()=>typeof L.connectable>"u"?q.value:L.connectable),te=n.toRef(()=>typeof L.focusable>"u"?U.value:L.focusable),M=n.computed(()=>P.value||$.value||X.value.nodeClick.hasListeners()||X.value.nodeDoubleClick.hasListeners()||X.value.nodeMouseEnter.hasListeners()||X.value.nodeMouseMove.hasListeners()||X.value.nodeMouseLeave.hasListeners()),ee=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),le=n.computed(()=>{const R=L.type||"default",G=W==null?void 0:W[`node-${R}`];if(G)return G;let J=L.template||f.value[R];if(typeof J=="string"&&ne){const fe=Object.keys(ne.appContext.components);fe&&fe.includes(R)&&(J=n.resolveComponent(R,!1))}return J&&typeof J!="string"?J:(r.error(new Ze(We.NODE_TYPE_MISSING,J)),!1)}),me=Jc({id:e.id,el:K,disabled:()=>!$.value,selectable:P,dragHandle:()=>L.dragHandle,onStart(R){v.dragStart(R)},onDrag(R){v.drag(R)},onStop(R){v.dragStop(R)},onClick(R){E(R)}}),ye=n.computed(()=>L.class instanceof Function?L.class(L):L.class),ce=n.computed(()=>{const R=(L.style instanceof Function?L.style(L):L.style)||{},G=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!R.width&&G&&(R.width=typeof G=="string"?G:`${G}px`),!R.height&&J&&(R.height=typeof J=="string"?J:`${J}px`),R}),ue=n.toRef(()=>Number(L.zIndex??ce.value.zIndex??0));return u(R=>{(R.includes(e.id)||!R.length)&&ve()}),n.onMounted(()=>{n.watch(()=>L.hidden,(R=!1,G,J)=>{!R&&K.value&&(e.resizeObserver.observe(K.value),J(()=>{K.value&&e.resizeObserver.unobserve(K.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var R;return(R=Q.value)==null?void 0:R.computedPosition.x},()=>{var R;return(R=Q.value)==null?void 0:R.computedPosition.y},()=>{var R;return(R=Q.value)==null?void 0:R.computedPosition.z},ue,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var R;return(R=Q.value)==null?void 0:R.dimensions.height},()=>{var R;return(R=Q.value)==null?void 0:R.dimensions.width}],([R,G,J,fe,_e,ke])=>{const be={x:R,y:G,z:ke+(m.value&&L.selected?1e3:0)};typeof J<"u"&&typeof fe<"u"?L.computedPosition=Kg({x:J,y:fe,z:_e},be):L.computedPosition=be},{flush:"post",immediate:!0}),n.watch([()=>L.extent,p],([R,G],[J,fe])=>{(R!==J||G!==fe)&&he()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Ia(()=>ee).toBe(!0).then(he):he(),()=>L.hidden?null:n.h("div",{ref:K,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":L.type||"default"}`,{[o.value]:$.value,dragging:me==null?void 0:me.value,draggable:$.value,selected:L.selected,selectable:P.value,parent:L.isParent},ye.value],style:{visibility:ee.value?"visible":"hidden",zIndex:L.computedPosition.z??ue.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:M.value?"all":"none",...ce.value},tabIndex:te.value?0:void 0,role:te.value?"group":void 0,"aria-describedby":h.value?void 0:`${gc}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Se,onMousemove:Ie,onMouseleave:pe,onContextmenu:j,onClick:E,onDblclick:Y,onKeydown:A},[n.h(le.value===!1?f.value.default:le.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...T},selected:L.selected,resizing:L.resizing,dragging:me.value,connectable:H.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??ue.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:ve})]);function he(){const R=L.computedPosition,{computedPosition:G,position:J}=tl(L,b.value?Ni(R,g.value):R,r.error,p.value,Q.value);(L.computedPosition.x!==G.x||L.computedPosition.y!==G.y)&&(L.computedPosition={...L.computedPosition,...G}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function ve(){K.value&&d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])}function Se(R){me!=null&&me.value||v.mouseEnter({event:R,node:L})}function Ie(R){me!=null&&me.value||v.mouseMove({event:R,node:L})}function pe(R){me!=null&&me.value||v.mouseLeave({event:R,node:L})}function j(R){return v.contextMenu({event:R,node:L})}function Y(R){return v.doubleClick({event:R,node:L})}function E(R){P.value&&(!i.value||!$.value||I.value>0)&&al(L,l.value,c,s,a,!1,K.value),v.click({event:R,node:L})}function A(R){if(!(ja(R)||h.value))if(_c.includes(R.key)&&P.value){const G=R.key==="Escape";al(L,l.value,c,s,a,G,K.value)}else $.value&&L.selected&&An[R.key]&&(R.preventDefault(),_.value=`Moved selected node ${R.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,re({x:An[R.key].x,y:An[R.key].y},R.shiftKey))}}});function R0(e={includeHiddenNodes:!1}){const{nodes:t}=Oe();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 V0={class:"vue-flow__nodes vue-flow__container"},A0={name:"Nodes",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Oe(),a=R0(),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",V0,[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(C0),{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 M0(){const{emits:e}=Oe();n.onMounted(()=>{if(Gc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ze(We.MISSING_STYLES))}})}const B0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),D0={name:"VueFlow",compatConfig:{MODE:3}},O0=n.defineComponent({...D0,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=Sa(i,"modelValue",o),r=Sa(i,"nodes",o),s=Sa(i,"edges",o),c=Oe(i),d=kb({modelValue:l,nodes:r,edges:s},i,c);return Nb(o,c.hooks),y0(),M0(),n.provide($i,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(d0,null,{default:n.withCtx(()=>[n.createVNode(S0),B0,n.createVNode(T0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(h0)],512))}}),L0={name:"Panel",compatConfig:{MODE:3}},md=n.defineComponent({...L0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Oe(),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))}}),fn=["red","amber","green","teal","blue","indigo","violet","pink"],pd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function P0(e){return typeof e=="string"&&e in pd}const z0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},U0=.15;function H0(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 F0(e){if(typeof e!="string")return null;const t=H0(e);if(!t||t.s<U0)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-z0[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function nt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(P0(t))return t;const o=e==null?void 0:e.properties;return F0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function ul(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const G0={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)"},Y0={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 hd(e,t=!1){return e?t?Y0[e]:G0[e]:null}function Bn(e){return pd[e]}function Dn(e){return`var(--em-swatch-${e}-bar)`}const W0=["width","height","innerHTML"],K0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',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"/>'};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,W0))}}),Pe=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Re=Pe(K0,[["__scopeId","data-v-5256c2f6"]]),q0={class:"em-inline-issue__msgs"},mn=Pe(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(Re,{name:o[a.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",q0,[(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"]]),X0={class:"em-mlang"},j0={class:"em-mlang__tabs",role:"tablist"},Z0=["aria-selected","onClick"],J0={key:0,class:"em-mlang__dot"},fl=Pe(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",X0,[n.createElementVNode("div",j0,[(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",J0,"•")):n.createCommentVNode("",!0)],10,Z0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.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(ie.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"]]),Q0=["disabled"],e1={class:"em-panel__sub-label"},t1={class:"em-field"},n1={class:"em-field"},o1={class:"em-field"},i1={class:"em-class"},a1={class:"em-field"},l1={class:"em-field"},r1={class:"em-field"},s1={class:"em-field"},c1={class:"em-multilang"},d1={class:"em-multilang"},u1={class:"em-jpa"},f1={class:"em-field"},m1={class:"em-field"},p1={class:"em-field"},h1={class:"em-swatch"},y1={class:"em-swatch__row"},g1=["title","onClick"],yd=Pe(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(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return nt(((L=r.value)==null?void 0:L.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=L=>L;function p(L){return L==="inherit"?"기본(따름)":L}function m(L){l.value&&a.updateEntity(l.value.modelId,L)}function h(L,Q,v){var $;const T=(($=l.value)==null?void 0:$.table)??{physicalName:""};m(L==="physicalName"?{table:{...T,physicalName:v}}:{table:{...T,logicalName:{...T.logicalName,[Q]:v}}})}function _(L){m({description:Object.keys(L).length?L:void 0})}function b(L,Q){var v;m({jpaAttrs:{...(v=l.value)==null?void 0:v.jpaAttrs,[L]:Q}})}function g(L,Q){b(L,Q)}const I=n.computed(()=>{var L,Q;return((Q=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:Q.discriminatorType)??"inherit"}),y=n.computed(()=>{var L,Q;return!((Q=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&Q.useDiscriminator)});function N(L){b("discriminatorType",L==="inherit"?void 0:L)}function q(L){m({hasPersonalInfo:L})}function U(L){m({superClass:L.trim()||void 0})}function X(L){m({schema:L.trim()||void 0})}function K(L){m({abstractClass:L})}const W=n.computed(()=>{var L,Q;return((Q=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:Q.join(", "))??""});function ne(L){const Q=L.split(",").map(v=>v.trim()).filter(Boolean);m({declarationOfInterfaces:Q.length?Q:void 0})}function re(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,Q)=>{var v,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:Q[0]||(Q[0]=P=>i("toggle"))},[n.createElementVNode("span",e1,[n.createVNode(Re,{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(mn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",t1,[Q[13]||(Q[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":Q[1]||(Q[1]=P=>m({name:P}))},null,8,["model-value"])]),n.createElementVNode("label",n1,[Q[14]||(Q[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":Q[2]||(Q[2]=P=>m({stereotype:P}))},null,8,["model-value"])]),n.createElementVNode("label",o1,[Q[15]||(Q[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":Q[3]||(Q[3]=P=>m({packageName:P}))},null,8,["model-value"])]),n.createElementVNode("fieldset",i1,[Q[18]||(Q[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",a1,[Q[16]||(Q[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":Q[4]||(Q[4]=P=>U(P))},null,8,["model-value"])]),n.createElementVNode("label",l1,[Q[17]||(Q[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":W.value,"onUpdate:modelValue":Q[5]||(Q[5]=P=>ne(P))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":Q[6]||(Q[6]=P=>K(P))},null,8,["model-value"])]),n.createElementVNode("label",r1,[Q[19]||(Q[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((v=l.value.table)==null?void 0:v.physicalName)??"","onUpdate:modelValue":Q[7]||(Q[7]=P=>h("physicalName",null,P))},null,8,["model-value"])]),n.createElementVNode("label",s1,[Q[20]||(Q[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":Q[8]||(Q[8]=P=>X(P))},null,8,["model-value"])]),n.createElementVNode("fieldset",c1,[Q[21]||(Q[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,P=>{var H,te;return n.openBlock(),n.createElementBlock("label",{key:P,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(P),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${P}`,width:"100%","model-value":((te=(H=l.value.table)==null?void 0:H.logicalName)==null?void 0:te[P])??"","onUpdate:modelValue":M=>h("logicalName",P,M)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",d1,[Q[22]||(Q[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(fl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":_},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",u1,[Q[26]||(Q[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,P=>{var H;return n.createVNode(n.unref(ie.BSCheckbox),{key:P.key,name:`jpa-${P.key}`,class:"em-check",label:P.label,"model-value":!!((H=l.value.jpaAttrs)!=null&&H[P.key]),"onUpdate:modelValue":te=>g(P.key,te)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",f1,[Q[23]||(Q[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((T=l.value.jpaAttrs)==null?void 0:T.discriminatorColumnName)??"","onUpdate:modelValue":Q[9]||(Q[9]=P=>b("discriminatorColumnName",P.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",m1,[Q[24]||(Q[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:y.value,"model-value":I.value,items:u,"value-provider":f,"label-provider":p,"onUpdate:modelValue":Q[10]||(Q[10]=P=>P&&N(P))},null,8,["disabled","model-value"])]),n.createElementVNode("label",p1,[Q[25]||(Q[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":($=l.value.jpaAttrs)==null?void 0:$.discriminatorLength,"onUpdate:modelValue":Q[11]||(Q[11]=P=>b("discriminatorLength",P||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.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",h1,[Q[27]||(Q[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",y1,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:Q[12]||(Q[12]=P=>re(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),P=>(n.openBlock(),n.createElementBlock("button",{key:P,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===P}]),style:n.normalizeStyle({background:n.unref(Dn)(P)}),title:n.unref(Bn)(P),onClick:H=>re(P)},null,14,g1))),128))])])],64)):n.createCommentVNode("",!0)],8,Q0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),gd=["ko","en","ja","zh"];function b1(e){if(e)for(const t of gd){const o=e[t];if(o)return o}}function ml(e){const t=b1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function _1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:gd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const w1=["aria-expanded"],v1=["aria-selected","onClick","onMouseenter"],k1={key:0,class:"gcc__opt gcc__opt--empty"},bd=Pe(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(K=>K.groupCode===o.modelValue)),p=n.computed(()=>f.value?ml(f.value):"");n.watch(p,K=>{c.value||(s.value=K)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:_1(o.items,s.value));function h(){var W;const K=(W=a.value)==null?void 0:W.getBoundingClientRect();K&&(u.value={left:`${K.left}px`,top:`${K.bottom}px`,width:`${K.width}px`})}function _(){c.value=!0,h(),d.value=Math.max(0,m.value.findIndex(K=>K.groupCode===o.modelValue)),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),document.addEventListener("mousedown",X)}function b(){c.value=!1,window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),document.removeEventListener("mousedown",X)}n.onBeforeUnmount(b);function g(){_(),n.nextTick(()=>{var K;return(K=l.value)==null?void 0:K.select()})}function I(){c.value||_(),d.value=0}function y(K){i("update:modelValue",K.groupCode),s.value=ml(K),b()}function N(){i("update:modelValue",void 0),s.value="",b()}function q(){s.value.trim()===""?N():(s.value=p.value,b())}function U(K){var W;if(K.key==="ArrowDown")c.value||_(),d.value=Math.min(d.value+1,m.value.length-1),K.preventDefault();else if(K.key==="ArrowUp")d.value=Math.max(d.value-1,0),K.preventDefault();else if(K.key==="Enter"){const ne=m.value[d.value];ne&&y(ne),K.preventDefault()}else K.key==="Escape"&&(s.value=p.value,b(),(W=l.value)==null||W.blur())}function X(K){var ne,re;const W=K.target;!((ne=a.value)!=null&&ne.contains(W))&&!((re=r.value)!=null&&re.contains(W))&&q()}return(K,W)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":W[0]||(W[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:g,onInput:I,onKeydown:U},null,40,w1),[[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:W[1]||(W[1]=n.withModifiers(()=>{},["prevent"])),onClick:N},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(ne,re)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":re===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:W[2]||(W[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>y(ne),onMouseenter:L=>d.value=re},n.toDisplayString(n.unref(ml)(ne)),43,v1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",k1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),E1=["disabled"],N1={class:"em-aw__toolbar"},$1={class:"em-aw__count"},x1={class:"em-aw__scroll"},I1={class:"em-aw__table"},S1={key:0,class:"c-code"},C1=["colspan"],R1={class:"c-del"},V1={class:"c-flag"},A1={class:"c-flag"},T1={class:"c-flag"},M1={class:"c-flag"},B1={class:"c-flag"},D1={class:"c-flag"},O1={class:"c-flag"},L1={class:"c-flag"},P1={key:0},z1=["title"],U1=["colspan"],H1={class:"c-del"},F1={class:"em-aw__embed-label"},G1={class:"em-aw__ro"},Y1={class:"em-aw__ro"},W1={class:"em-aw__ro"},K1={class:"em-aw__ro"},q1={colspan:"8"},X1=["colspan"],j1={key:0},Z1="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Ti="__OWN__",J1=Pe(n.defineComponent({__name:"EntityAttributesWide",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.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var S;return(((S=i.value)==null?void 0:S.attributes)??[]).filter(D=>D.attrType!=="DIVIDER").length}),s=n.computed(()=>T.value.length?19:18),c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(S){return S==="none"?"(없음)":S}const u=S=>S;function f(S,D){i.value&&o.updateAttribute(i.value.modelId,S.modelId,D)}function p(S){return!!i.value&&!!jo(o.state.logical,i.value.modelId,S.modelId)}function m(S,D){f(S,{naturalId:D||void 0,naturalIdMutable:D?S.naturalIdMutable:void 0})}function h(){return{naturalId:void 0,naturalIdMutable:void 0}}function _(S,D){f(S,{identifier:D,...D?h():{}})}function b(S,D){f(S,{transient:D||void 0,...D?h():{}})}function g(S){return!!S.transient}const I=S=>S.value,y=S=>S.label;function N(S,D){if(!D)return;const O=re.value.find(de=>de.type===D);if(O){const de=S.dbAttrs[0]??{modelId:S.modelId+".c",physicalName:S.name,dataType:"VARCHAR"};f(S,{type:D,customType:void 0,dbAttrs:[{...de,dataType:O.dataType,length:O.length,scale:O.scale}]});return}f(S,D===Lt?{type:D}:{type:D,customType:void 0})}function q(S,D){f(S,{customType:D.trim()===""?void 0:D})}function U(S,D){const de={...S.dbAttrs[0]??{modelId:S.modelId+".c",physicalName:S.name,dataType:"VARCHAR"},...D};D.dataType!==void 0&&!Po.has(de.dataType)&&(de.scale=void 0),f(S,{dbAttrs:[de]})}function X(S){var D;return Po.has(((D=S.dbAttrs[0])==null?void 0:D.dataType)??"")}function K(S,D,O){var de;U(S,{logicalName:{...(de=S.dbAttrs[0])==null?void 0:de.logicalName,[D]:O}})}function W(S){return S.personalInfoAttributeType??"none"}function ne(S,D){f(S,{personalInfoAttributeType:D==="none"?void 0:D})}const re=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function Q(S){var D,O;return((D=S.label)==null?void 0:D.ko)??((O=S.label)==null?void 0:O.en)??S.type}function v(S){!S||!i.value||o.addPredefinedEmbed(i.value.modelId,S)}const T=n.computed(()=>o.groupCodeCatalog.value);function $(S){var D;return((D=T.value.find(O=>O.groupCode===S.groupCode))==null?void 0:D.codes)??[]}function P(S){return["none",...$(S)]}function H(S){return S==="none"?"none":S.code}function te(S){var O,de;if(S==="none")return"(없음)";const D=((O=S.label)==null?void 0:O.ko)??((de=S.label)==null?void 0:de.en);return D?`${S.code} (${D})`:S.code}function M(S,D){i.value&&o.setAttributeGroupCode(i.value.modelId,S.modelId,D)}function ee(S,D){f(S,{defaultValue:D==="none"?void 0:D})}function le(S,D){f(S,{defaultValue:D.trim()===""?void 0:D})}function me(S){return S.attrType.startsWith("EMBED")&&S.dbAttrs.length>0}function ye(S,D,O){const de=S.dbAttrs.map((ge,w)=>{if(w!==D)return ge;const k={...ge,...O};for(const C of Object.keys(O))O[C]===void 0&&delete k[C];return k});i.value&&o.setEmbedColumns(i.value.modelId,S.modelId,de)}function ce(S,D,O,de){var ge;ye(S,D,{logicalName:{...(ge=S.dbAttrs[D])==null?void 0:ge.logicalName,[O]:de}})}function ue(S,D){var ge,w,k;if(S.attrType==="EMBED_PREDEF"){const C=(ge=o.embeddableCatalog.value.find(Z=>Z.type===S.type))==null?void 0:ge.fields[D];return C?{name:C.name,physicalName:C.physicalName,dataType:C.dataType,length:C.length,shareable:C.shareable,logicalName:C.logicalName}:void 0}const O=(w=S.embedded)==null?void 0:w.embeddableRef;if(!O)return;const de=(k=o.state.logical.entities.find(C=>C.modelId===O))==null?void 0:k.attributes.flatMap(C=>C.dbAttrs)[D];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function he(S,D){var O,de;return((O=ue(S,D))==null?void 0:O.dataType)||((de=S.dbAttrs[D])==null?void 0:de.dataType)||""}function ve(S,D){var O,de;return((O=ue(S,D))==null?void 0:O.length)??((de=S.dbAttrs[D])==null?void 0:de.length)}function Se(S,D){var O,de;return((O=ue(S,D))==null?void 0:O.scale)??((de=S.dbAttrs[D])==null?void 0:de.scale)}const Ie=["inherit","true","false"];function pe(S){return S==="inherit"?"기본(따름)":S}function j(S){return(S==null?void 0:S.updatable)===void 0?"inherit":S.updatable?"true":"false"}function Y(S,D,O){ye(S,D,{updatable:O==="inherit"?void 0:O==="true"})}function E(S,D){U(S,{updatable:D==="inherit"?void 0:D==="true"})}const A=["inherit","true","false"];function R(S){return S==="inherit"?"기본(따름)":S}function G(S){return(S==null?void 0:S.insertable)===void 0?"inherit":S.insertable?"true":"false"}function J(S,D,O){ye(S,D,{insertable:O==="inherit"?void 0:O==="true"})}function fe(S,D){U(S,{insertable:D==="inherit"?void 0:D==="true"})}const _e=n.computed(()=>{var S;return Wn(((S=i.value)==null?void 0:S.attributes.flatMap(D=>D.dbAttrs))??[])}),ke=n.computed(()=>{var S;return(((S=i.value)==null?void 0:S.attributes)??[]).filter(D=>D.attrType==="NORMAL"&&D.dbAttrs.length===1&&D.dbAttrs[0]).map(D=>({modelId:D.dbAttrs[0].modelId,label:D.dbAttrs[0].physicalName||D.name}))});function be(){return[Ti,...ke.value.map(S=>S.modelId)]}function xe(S){if(S===Ti)return"전용 컬럼(OWN)";const D=ke.value.find(O=>O.modelId===S);return D?`↗ ${D.label} (공유)`:S}function Ve(S){return(S==null?void 0:S.sharedColumnRef)??Ti}function Te(S,D,O){ye(S,D,{sharedColumnRef:O===Ti?void 0:O})}function x(S){return(S==null?void 0:S.sharedColumnRef)!=null}function B(S){var D;return((D=zo(S,_e.value))==null?void 0:D.physicalName)??""}return(S,D)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",N1,[n.createElementVNode("span",$1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:D[0]||(D[0]=O=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:D[1]||(D[1]=O=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":O=>O.type,"label-provider":Q,"onUpdate:modelValue":v},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",x1,[n.createElementVNode("table",I1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[D[2]||(D[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),D[3]||(D[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),D[4]||(D[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),D[5]||(D[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),D[6]||(D[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),D[7]||(D[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),D[8]||(D[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),D[9]||(D[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),D[10]||(D[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),D[11]||(D[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),D[12]||(D[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),D[13]||(D[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),D[14]||(D[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),D[15]||(D[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),D[16]||(D[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),D[17]||(D[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),D[18]||(D[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),D[19]||(D[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),T.value.length?(n.openBlock(),n.createElementBlock("th",S1,"코드그룹")):n.createCommentVNode("",!0),D[20]||(D[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),D[21]||(D[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,O=>{var de,ge,w,k,C,Z,ae,se,V,z,F;return n.openBlock(),n.createElementBlock(n.Fragment,{key:O.modelId},[O.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(O.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${O.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":O.name,"onUpdate:modelValue":oe=>f(O,{name:oe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,C1),n.createElementVNode("td",R1,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:oe=>n.unref(o).removeAttribute(i.value.modelId,O.modelId)},null,8,["onClick"])])],2)):me(O)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(O.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${O.modelId}`,width:"100%",placeholder:"이름","model-value":O.name,"onUpdate:modelValue":oe=>f(O,{name:oe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${O.modelId}`,width:"100%",disabled:"","model-value":O.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:T.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(O.dbAttrs.length)+"개",9,U1),n.createElementVNode("td",H1,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:oe=>n.unref(o).removeAttribute(i.value.modelId,O.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O.dbAttrs,(oe,Ae)=>{var Le,He,Be,Fe,xt,Xt,jt;return n.openBlock(),n.createElementBlock("tr",{key:oe.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",F1,"↳ "+n.toDisplayString(((Le=ue(O,Ae))==null?void 0:Le.name)??((He=ue(O,Ae))==null?void 0:He.physicalName)??`컬럼 ${Ae+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",G1,n.toDisplayString(he(O,Ae)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${oe.modelId}`,width:"100%",placeholder:((Fe=(Be=ue(O,Ae))==null?void 0:Be.logicalName)==null?void 0:Fe.ko)??"논리명","model-value":((xt=oe.logicalName)==null?void 0:xt.ko)??"","onUpdate:modelValue":Je=>ce(O,Ae,"ko",Je)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${oe.modelId}`,width:"100%",disabled:x(oe),placeholder:((Xt=ue(O,Ae))==null?void 0:Xt.physicalName)??"컬럼","model-value":x(oe)?B(oe):oe.physicalName,"onUpdate:modelValue":Je=>ye(O,Ae,{physicalName:Je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":oe.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",Y1,n.toDisplayString(he(O,Ae)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",W1,n.toDisplayString(ve(O,Ae)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",K1,n.toDisplayString(Se(O,Ae)??""),1)]),n.createElementVNode("td",q1,[(jt=ue(O,Ae))!=null&&jt.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Ve(oe),items:be(),"value-provider":u,"label-provider":xe,"onUpdate:modelValue":Je=>Je&&Te(O,Ae,Je)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:x(oe),"model-value":x(oe)?"false":G(oe),items:A,"value-provider":u,"label-provider":R,"onUpdate:modelValue":Je=>Je&&J(O,Ae,Je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:x(oe),"model-value":x(oe)?"false":j(oe),items:Ie,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":Je=>Je&&Y(O,Ae,Je)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:T.value.length?4:3},null,8,X1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(O.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${O.modelId}`,width:"100%",placeholder:"이름","model-value":O.name,"onUpdate:modelValue":oe=>f(O,{name:oe})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${O.modelId}`,width:"100%",placeholder:"타입",disabled:!!O.groupCode,items:n.unref(Ql)(O.type,re.value),"value-provider":I,"label-provider":y,"model-value":O.type,"onUpdate:modelValue":oe=>N(O,oe)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),O.type===n.unref(Lt)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${O.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":O.customType??"","onUpdate:modelValue":oe=>q(O,oe)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${O.modelId}`,width:"100%",placeholder:"논리명","model-value":((ge=(de=O.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:ge.ko)??"","onUpdate:modelValue":oe=>K(O,"ko",oe)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${O.modelId}`,width:"100%",placeholder:"컬럼",disabled:g(O),"model-value":((w=O.dbAttrs[0])==null?void 0:w.physicalName)??"","onUpdate:modelValue":oe=>U(O,{physicalName:oe})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(k=O.dbAttrs[0])==null?void 0:k.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${O.modelId}`,width:"100%",placeholder:"dataType",disabled:g(O),items:n.unref(Zl)(((C=O.dbAttrs[0])==null?void 0:C.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(ua),"model-value":((Z=O.dbAttrs[0])==null?void 0:Z.dataType)??"","onUpdate:modelValue":oe=>oe&&U(O,{dataType:oe})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${O.modelId}`,width:"100%",placeholder:"len",disabled:g(O),"model-value":(ae=O.dbAttrs[0])==null?void 0:ae.length,"onUpdate:modelValue":oe=>U(O,{length:oe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${O.modelId}`,width:"100%",placeholder:"scale",disabled:g(O)||!X(O),"model-value":(se=O.dbAttrs[0])==null?void 0:se.scale,"onUpdate:modelValue":oe=>U(O,{scale:oe||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",V1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${O.modelId}`,"model-value":O.identifier,disabled:a.value||g(O),"onUpdate:modelValue":oe=>_(O,oe)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",A1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${O.modelId}`,"model-value":O.notNull,disabled:g(O),"onUpdate:modelValue":oe=>f(O,{notNull:oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",T1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${O.modelId}`,"model-value":!!((V=O.dbAttrs[0])!=null&&V.unique),disabled:g(O),"onUpdate:modelValue":oe=>U(O,{unique:oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",M1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${O.modelId}`,"model-value":!!((z=O.dbAttrs[0])!=null&&z.autoIncrement),disabled:g(O)||!O.identifier,"onUpdate:modelValue":oe=>U(O,{autoIncrement:oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",B1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${O.modelId}`,"model-value":!!O.transient,disabled:O.identifier,"onUpdate:modelValue":oe=>b(O,oe)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",D1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${O.modelId}`,"model-value":!!O.naturalId,disabled:O.identifier||g(O),"onUpdate:modelValue":oe=>m(O,oe)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",O1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${O.modelId}`,"model-value":!!O.naturalIdMutable,disabled:g(O)||!O.naturalId,"onUpdate:modelValue":oe=>f(O,{naturalIdMutable:oe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",L1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${O.modelId}`,"model-value":!!((F=O.dbAttrs[0])!=null&&F.multiValue),disabled:g(O),"onUpdate:modelValue":oe=>U(O,{multiValue:oe||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${O.modelId}`,width:"100%",disabled:g(O),"model-value":G(O.dbAttrs[0]),items:A,"value-provider":u,"label-provider":R,"onUpdate:modelValue":oe=>oe&&fe(O,oe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${O.modelId}`,width:"100%",disabled:g(O),"model-value":j(O.dbAttrs[0]),items:Ie,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":oe=>oe&&E(O,oe)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":W(O),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":oe=>oe&&ne(O,oe)},null,8,["model-value","onUpdate:modelValue"])]),T.value.length?(n.openBlock(),n.createElementBlock("td",P1,[n.createVNode(bd,{"model-value":O.groupCode,items:T.value,"onUpdate:modelValue":oe=>M(O,oe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[$(O).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":O.defaultValue??"none",items:P(O),"value-provider":H,"label-provider":te,"onUpdate:modelValue":oe=>oe&&ee(O,oe)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${O.modelId}`,width:"100%",placeholder:"기본값","model-value":O.defaultValue??"","onUpdate:modelValue":oe=>le(O,oe)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:p(O)?Z1:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:oe=>n.unref(o).removeAttribute(i.value.modelId,O.modelId)},null,8,["onClick"])],8,z1)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",j1,[...D[22]||(D[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,E1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7e02965"]]),Q1=["disabled"],e_={class:"em-idxw__list"},t_={class:"em-idxw__list-head"},n_=["onClick"],o_={class:"em-idxw__item-name"},i_={key:0,class:"em-idxw__badge"},a_={class:"em-idxw__item-cnt"},l_={key:0,class:"em-idxw__empty"},r_={key:0,class:"em-idxw__edit"},s_={class:"em-idxw__form"},c_={class:"em-field em-idxw__name"},d_={class:"em-field"},u_=["value"],f_={class:"em-idxw__transfer"},m_={class:"em-idxw__pane"},p_={class:"em-idxw__pane-head"},h_={class:"em-idxw__cols"},y_=["onClick"],g_={key:0,class:"em-idxw__empty"},b_={class:"em-idxw__arrows"},__={class:"em-idxw__pane"},w_={class:"em-idxw__pane-head"},v_={class:"em-idxw__cols"},k_={class:"em-idxw__col-name"},E_={class:"em-idxw__col-ops"},N_=["disabled","onClick"],$_=["disabled","onClick"],x_=["onClick"],I_={key:0,class:"em-idxw__empty"},S_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},C_=Pe(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(U=>U.modelId===t.entityId)??null),a=n.computed(()=>{var U;return((U=i.value)==null?void 0:U.indexes)??[]}),l=n.computed(()=>{var U;return((U=i.value)==null?void 0:U.attributes)??[]}),r=n.ref(null);n.watch(a,U=>{var X;U.some(K=>K.modelId===r.value)||(r.value=((X=U[0])==null?void 0:X.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(U=>U.modelId===r.value)??null),c=n.computed(()=>{var U;return new Set(((U=s.value)==null?void 0:U.columns.map(X=>X.columnRef))??[])}),d=n.computed(()=>l.value.filter(U=>!c.value.has(U.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(U){var K;const X=(K=U.dbAttrs[0])==null?void 0:K.physicalName;return X&&X!==U.name?`${U.name} (${X})`:U.name}function p(U){const X=l.value.find(K=>K.modelId===U);return X?f(X):U}function m(U,X){i.value&&o.updateIndex(i.value.modelId,U,X)}function h(){var X;if(!i.value)return;const U=Me();o.addIndex(i.value.modelId,{modelId:U,name:`idx_${(((X=i.value.indexes)==null?void 0:X.length)??0)+1}`,unique:!1,columns:[]}),r.value=U}function _(U){i.value&&o.removeIndex(i.value.modelId,U)}function b(U){s.value&&m(s.value.modelId,{parameters:U.trim()===""?void 0:U})}function g(U){const X=new Set(u.value);X.has(U)?X.delete(U):X.add(U),u.value=X}function I(){const U=s.value;if(!U||!u.value.size)return;const X=[...u.value].map(K=>({columnRef:K,descending:!1}));m(U.modelId,{columns:[...U.columns,...X]}),u.value=new Set}function y(U){const X=s.value;X&&m(X.modelId,{columns:X.columns.filter((K,W)=>W!==U)})}function N(U,X){const K=s.value;K&&m(K.modelId,{columns:K.columns.map((W,ne)=>ne===U?{...W,descending:X}:W)})}function q(U,X){const K=s.value;if(!K)return;const W=U+X;if(W<0||W>=K.columns.length)return;const ne=[...K.columns];[ne[U],ne[W]]=[ne[W],ne[U]],m(K.modelId,{columns:ne})}return(U,X)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",e_,[n.createElementVNode("div",t_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:h})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,K=>(n.openBlock(),n.createElementBlock("li",{key:K.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":K.modelId===r.value}]),onClick:W=>r.value=K.modelId},[n.createElementVNode("span",o_,n.toDisplayString(K.name||"(이름 없음)"),1),K.unique?(n.openBlock(),n.createElementBlock("span",i_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",a_,n.toDisplayString(K.columns.length),1)],10,n_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",l_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",r_,[n.createElementVNode("div",s_,[n.createElementVNode("label",c_,[X[4]||(X[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":X[0]||(X[0]=K=>m(s.value.modelId,{name:K}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":X[1]||(X[1]=K=>m(s.value.modelId,{unique:K}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:X[2]||(X[2]=K=>_(s.value.modelId))})]),n.createElementVNode("label",d_,[X[5]||(X[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:X[3]||(X[3]=K=>b(K.target.value))},null,40,u_)]),n.createElementVNode("div",f_,[n.createElementVNode("div",m_,[n.createElementVNode("div",p_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",h_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,K=>(n.openBlock(),n.createElementBlock("li",{key:K.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(K.modelId)}]),onClick:W=>g(K.modelId)},n.toDisplayString(f(K)),11,y_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",g_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",b_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:I},null,8,["disabled"])]),n.createElementVNode("div",__,[n.createElementVNode("div",w_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",v_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(K,W)=>(n.openBlock(),n.createElementBlock("li",{key:W,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",k_,n.toDisplayString(p(K.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${W}`,class:"em-check",label:"DESC","model-value":K.descending,"onUpdate:modelValue":ne=>N(W,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",E_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:W===0,onClick:ne=>q(W,-1)},"↑",8,N_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:W===s.value.columns.length-1,onClick:ne=>q(W,1)},"↓",8,$_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>y(W)},"✕",8,x_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",I_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",S_,"인덱스를 선택하거나 추가하세요."))],8,Q1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),R_={class:"em-op-src"},V_={class:"em-op-src__actions"},_d=Pe(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",R_,[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",V_,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),A_=["disabled"],T_={class:"em-ow__toolbar"},M_={class:"em-ow__count"},B_={class:"em-ow__scroll"},D_={class:"em-ow__table"},O_={class:"c-del"},L_={key:0},P_=Pe(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(h=>h.modelId===t.entityId)??null),l=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(h){return h==="none"?"(없음)":h}const c=h=>h;function d(h,_){a.value&&o.updateOperation(a.value.modelId,h.modelId,_)}function u(h,_,b){d(h,{description:{...h.description,[_]:b}})}function f(h){return h.personalInfoAttributeType??"none"}function p(h,_){d(h,{personalInfoAttributeType:_==="none"?void 0:_})}function m(h){i.openModal({component:_d,bind:{operationName:h.name,sourceCode:h.sourceCode??"",onSave:_=>d(h,{sourceCode:_})}})}return(h,_)=>{var b,g;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",T_,[n.createElementVNode("span",M_,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:_[0]||(_[0]=I=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",B_,[n.createElementVNode("table",D_,[_[2]||(_[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??[],I=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:I.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${I.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":I.name,"onUpdate:modelValue":N=>d(I,{name:N})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":I.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":N=>N&&d(I,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${I.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=I.description)==null?void 0:y.ko)??"","onUpdate:modelValue":N=>u(I,"ko",N)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(I),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":N=>N&&p(I,N)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:I.sourceCode?"본문 ●":"본문",onClick:N=>m(I)},null,8,["caption","onClick"])]),n.createElementVNode("td",O_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>n.unref(o).removeOperation(a.value.modelId,I.modelId)},null,8,["onClick"])])])}),128)),(g=a.value.operations)!=null&&g.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",L_,[..._[1]||(_[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,A_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),z_={class:"em-detail__tabs"},U_=["onClick"],H_=Pe(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.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(ie.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",z_,[(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,U_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(yd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(J1,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(C_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(P_,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Mi(e,t,o){e.openModal({component:H_,bind:{controller:n.markRaw(t),entityId:o}})}const wd="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function F_(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Me(),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=Me();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Me()}for(const a of t.indexes??[]){a.modelId=Me();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function vd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Bi(e,t){const o=[];for(const i of t.remove)o.push(Nn(e,i));for(const i of t.update)o.push(en(e,i.attributeId,i.patch));for(const i of t.add)o.push(St(e,i));return o}function On(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function Ln(e,t){const o=[];for(const[i,a]of Yf(e,t,Me))o.push(...Bi(i,a));return o}function kd(e,t,o){const i=new Set(o.remove);return On(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 pl(e,t){const o=Jn(e,t,Me),i=Bi(t,o),a=kd(e,t,o);return i.push(...Ln(a,t)),i}function Ed(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Me()}))}function G_(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,h)=>Math.max(m,h.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;a={modelId:Me(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Me(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(St(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(b=>b.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,h=m?p.end1:p.end2,_=m?p.end2:p.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:h.multiplicity,navigable:h.navigable,composition:!1},end2:{entityRef:t,multiplicity:_.multiplicity,navigable:_.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=Jn(r,t,Me);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(Nn(u.ownerId,u.dispId)),i.push(Wo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Bi(t,s));const c=kd(r,t,s);return i.push(...Ln(c,t)),i}function Y_(e,t){const o=e.entities.find(l=>l.modelId===t);if(!o)return[];const i=[],a=l=>l&&l.charAt(0).toLowerCase()+l.slice(1);for(const l of e.associations){if(l.end1.entityRef===l.end2.entityRef)continue;const r=l.end1.entityRef===t,s=l.end2.entityRef===t;if(!r&&!s)continue;const c=r?l.end2.entityRef:l.end1.entityRef,d=e.entities.find(y=>y.modelId===c);if(!d||d.attributes.some(y=>{var N;return((N=y.embedded)==null?void 0:N.associationRef)===l.modelId}))continue;const u=Me(),f=d.attributes.reduce((y,N)=>Math.max(y,N.order),-1)+1,p=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let h=m;for(let y=2;p.has(h);y++)h=`${m}${y}`;const _=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Me()})),b={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:_,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(St(c,b));const g=r?"end2":"end1",I=r?"end1":"end2";i.push(Wo(l.modelId,{identifying:!1,[g]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[I]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function W_(e=vd(),t={}){var Ve,Te;const o=n.reactive(e);let i=new _a(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),h=n.ref(!1),_=n.ref(!1),b=n.ref(0),g=n.ref(null);let I=0;const y=x=>{if(t.onNotice){t.onNotice(x);return}g.value={text:x,id:++I}},N=n.ref(((Ve=t.meta)==null?void 0:Ve.schemaVersion)??1),q=n.ref(((Te=t.meta)==null?void 0:Te.opWriteEnabled)??!1),U=n.computed(()=>N.value>=2&&q.value),X=t.historyTransport,K=n.computed(()=>U.value&&X!==void 0),W=t.restoreTransport,ne=n.ref(0),re=n.computed(()=>U.value&&Q.value&&W!==void 0);async function L(x){if(!W||!Q.value)return{ok:!1,reason:"unavailable"};const B=await W(x);return B.ok&&ne.value++,B}const Q=n.ref(!(N.value>=2&&q.value===!1)),v=n.ref("LOGICAL_PHYSICAL"),T=n.ref("straight"),$=n.ref(!0),P=n.ref(!0),H=n.ref(null),te=n.computed(()=>{var x;return((x=H.value)==null?void 0:x.kind)==="attribute"?{entityId:H.value.entityId,attrId:H.value.anchor}:null}),M=n.computed(()=>{var x;return((x=H.value)==null?void 0:x.kind)==="attribute"?H.value.ids:[]}),ee=n.computed(()=>{var x,B;return((x=H.value)==null?void 0:x.kind)==="entity"?H.value.id:((B=H.value)==null?void 0:B.kind)==="attribute"?H.value.entityId:null}),le=n.ref(null);let me=0;const ye=n.ref(null),ce=n.ref(null);let ue=t.meta;function he(){i.onChange(()=>{m.value=i.canUndo,h.value=i.canRedo,_.value=i.isDirty,b.value++})}he();let ve=null,Se=null;function Ie(){Se==null||Se(),Se=null,ve=null}function pe(){if(Ie(),!U.value||!t.opTransport)return;const x=new jr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:B=>{Q.value=!1,ce.value=B},onError:t.onOpError});x.seed((ue==null?void 0:ue.revSeed)??{}),Se=x.attach(i),ve=x}pe();const j=n.computed(()=>Ul(o.logical,o.layout)),Y=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:a.value})),E=n.computed(()=>nr(o.logical,Y.value)),A=n.computed(()=>{const x=new Map;for(const B of E.value){if(!B.targetRef)continue;const S=x.get(B.targetRef);S?S.push(B):x.set(B.targetRef,[B])}return x}),R=x=>{Q.value&&i.execute(x)},G=x=>o.layout.entityLayouts.some(B=>B.entityRef===x&&!!B.locked),J=x=>o.layout.groupLayouts.some(B=>B.groupRef===x&&!!B.locked),fe=x=>{const B=o.logical.associations.find(S=>S.modelId===x);return!!B&&(G(B.end1.entityRef)||G(B.end2.entityRef))},_e=(x,B,S)=>{if(G(x))return;const D=en(x,B,S),O=On(o.logical,x,ge=>ge.map(w=>w.modelId===B?{...w,...S}:w)),de=Ln(O,x);R(de.length?Ue("속성 수정",[D,...de]):D)};function ke(x){const B=x.map(k=>o.layout.entityLayouts.find(C=>C.entityRef===k)).filter(k=>!!k);if(!B.length)return{location:{x:40,y:40},size:{width:400,height:300}};let S=1/0,D=1/0,O=-1/0,de=-1/0;for(const k of B){const C=k.geo.size.width||220,Z=k.geo.size.height||140;S=Math.min(S,k.geo.location.x),D=Math.min(D,k.geo.location.y),O=Math.max(O,k.geo.location.x+C),de=Math.max(de,k.geo.location.y+Z)}const ge=40,w=28;return{location:{x:S-ge,y:D-ge-w},size:{width:O-S+ge*2,height:de-D+ge*2+w}}}function be(x,B,S){var k;const D=o.layout.groupLayouts.find(C=>C.groupRef===x),O=(D==null?void 0:D.geo.location)??B,de=B.x-O.x,ge=B.y-O.y,w=[br(x,B),...S.map(C=>En(C.id,C.location))];if(de||ge){const C=new Set(((k=o.logical.groups.find(Z=>Z.modelId===x))==null?void 0:k.memberEntityRefs)??[]);for(const Z of o.logical.associations){if(!C.has(Z.end1.entityRef)||!C.has(Z.end2.entityRef))continue;const ae=o.layout.associationLayouts.find(se=>se.associationRef===Z.modelId);ae&&ae.waypoints.length&&w.push(Tr(Z.modelId,de,ge))}for(const Z of(D==null?void 0:D.memberNoteRefs)??[]){const ae=o.layout.notes.find(se=>se.modelId===Z);ae&&w.push(Zn(Z,{x:ae.geo.location.x+de,y:ae.geo.location.y+ge}))}}return w}const xe={state:o,resolved:j,issues:E,issuesByRef:A,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:h,dirty:_,revision:b,notice:g,editable:Q,schemaVersion:N,opWriteEnabled:q,opMode:U,opConflict:ce,historyTransport:X,historyAvailable:K,restoreTransport:W,restoreAvailable:re,restoreToSeq:L,reloadRequest:ne,displayMode:v,routingMode:T,showGrid:$,showMinimap:P,selection:H,selectedAttr:te,selectedAttrIds:M,inspectedEntityId:ee,focusRequest:le,clipboard:ye,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(x){Q.value=x&&U.value},setEmbeddableCatalog(x){a.value=x},setGroupCodeCatalog(x){l.value=x},setPredefinedCustomTypeCatalog(x){r.value=x},selectAttribute(x,B,S="replace"){const D=H.value,O=(D==null?void 0:D.kind)==="attribute"&&D.entityId===x;if(S==="replace"||!O){H.value={kind:"attribute",entityId:x,ids:[B],anchor:B};return}if(S==="toggle"){const ae=D.ids.includes(B),se=ae?D.ids.filter(z=>z!==B):[...D.ids,B];if(!se.length){H.value=null;return}const V=ae&&D.anchor===B?se[se.length-1]:ae?D.anchor:B;H.value={kind:"attribute",entityId:x,ids:se,anchor:V};return}const de=o.logical.entities.find(ae=>ae.modelId===x),ge=[...(de==null?void 0:de.attributes)??[]].sort((ae,se)=>ae.order-se.order).map(ae=>ae.modelId),w=ge.indexOf(D.anchor),k=ge.indexOf(B);if(w<0||k<0){H.value={kind:"attribute",entityId:x,ids:[B],anchor:B};return}const[C,Z]=w<=k?[w,k]:[k,w];H.value={kind:"attribute",entityId:x,ids:ge.slice(C,Z+1),anchor:D.anchor}},moveAttributeFocus(x){const B=H.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const S=o.logical.entities.find(ge=>ge.modelId===B.entityId);if(!S||!S.attributes.length)return!1;const D=S.attributes.findIndex(ge=>ge.modelId===B.anchor);if(D<0)return!1;const O=Math.min(Math.max(D+x,0),S.attributes.length-1);if(O===D)return!0;const de=S.attributes[O].modelId;return H.value={kind:"attribute",entityId:B.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(x){const B=H.value;if((B==null?void 0:B.kind)!=="attribute")return!1;const S=o.logical.entities.find(ae=>ae.modelId===B.entityId);if(!S)return!1;const D=S.attributes,O=new Set(B.ids),de=D.map((ae,se)=>O.has(ae.modelId)?se:-1).filter(ae=>ae>=0);if(!de.length)return!1;const ge=Math.min(...de),w=D.filter(ae=>!O.has(ae.modelId)),k=D.slice(0,ge).filter(ae=>!O.has(ae.modelId)).length;let C;if(x<0){if(k<=0)return!0;C=k-1}else{if(w.length-k<=0)return!0;C=k+1}if(G(B.entityId))return!0;const Z=D.filter(ae=>O.has(ae.modelId)).map(ae=>ae.modelId);return R(Ea(B.entityId,Z,C)),!0},deleteSelection(){if(!Q.value)return!1;const x=H.value;if(!x)return!1;if(x.kind==="attribute"){if(G(x.entityId))return!1;const B=x.ids;if(!B.length)return!1;B.length===1?xe.removeAttribute(x.entityId,B[0]):xe.removeAttributes(x.entityId,B)}else if(x.kind==="entity"){if(G(x.id))return!1;xe.removeEntity(x.id)}else if(x.kind==="note")xe.removeNote(x.id);else if(x.kind==="group"){if(J(x.id))return!1;xe.removeGroup(x.id)}else xe.removeAssociation(x.id);return H.value=null,!0},nudgeNodes(x,B,S){if(!x.length||B===0&&S===0)return!1;const D=new Set(o.logical.entities.map(C=>C.modelId)),O=new Set(o.logical.groups.map(C=>C.modelId)),de=new Set(o.layout.notes.map(C=>C.modelId)),ge=new Set;for(const C of x){if(!O.has(C))continue;const Z=o.logical.groups.find(ae=>ae.modelId===C);for(const ae of(Z==null?void 0:Z.memberEntityRefs)??[])ge.add(ae)}const w=[],k=[];for(const C of x)if(O.has(C)){if(J(C))continue;const Z=o.layout.groupLayouts.find(z=>z.groupRef===C);if(!Z)continue;const ae=o.logical.groups.find(z=>z.modelId===C),se=((ae==null?void 0:ae.memberEntityRefs)??[]).map(z=>{var oe;const F=((oe=o.layout.entityLayouts.find(Ae=>Ae.entityRef===z))==null?void 0:oe.geo.location)??{x:0,y:0};return{id:z,location:{x:F.x+B,y:F.y+S}}}),V={x:Z.geo.location.x+B,y:Z.geo.location.y+S};w.push(Ue("그룹 이동",be(C,V,se))),k.push("g:"+C)}else if(D.has(C)){if(ge.has(C)||G(C))continue;const Z=o.layout.entityLayouts.find(ae=>ae.entityRef===C);if(!Z)continue;w.push(En(C,{x:Z.geo.location.x+B,y:Z.geo.location.y+S})),k.push("e:"+C)}else if(de.has(C)){const Z=o.layout.notes.find(ae=>ae.modelId===C);if(!Z)continue;w.push(Zn(C,{x:Z.geo.location.x+B,y:Z.geo.location.y+S})),k.push("n:"+C)}return w.length?(R(Ue("이동",w,"nudge:"+k.sort().join(","))),!0):!1},requestFocus(x){le.value={id:x,nonce:++me}},undo:()=>{Q.value&&i.undo()},redo:()=>{Q.value&&i.redo()},markSaved:()=>{Q.value&&(ve==null||ve.flush(),i.markSavePoint())},loadDiagram(x,B){Ie(),o.logical=x.logical,o.layout=x.layout,i=new _a(o),he(),N.value=(B==null?void 0:B.schemaVersion)??1,q.value=(B==null?void 0:B.opWriteEnabled)??!1,Q.value=!(N.value>=2&&q.value===!1),ue=B,ce.value=null,H.value=null,m.value=i.canUndo,h.value=i.canRedo,_.value=i.isDirty,pe()},flush(){ve==null||ve.flush()},whenOpsSettled(){return(ve==null?void 0:ve.whenSettled())??Promise.resolve()},addEntity(x="NewEntity",B={x:80,y:80}){const S=Me(),D={modelId:S,name:x,stereotype:"JPA_ENTITY",table:{physicalName:x.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return R(wa(D,{location:{...B},size:{width:220,height:140}})),S},renameEntity(x,B){G(x)||R(dr(x,B))},updateEntity(x,B){if(G(x))return;const S=cr(x,B),D=o.logical.entities.find(ge=>ge.modelId===x),O=B.stereotype==="JPA_EMBEDDABLE"&&!!D&&D.stereotype!=="JPA_EMBEDDABLE",de=!!B.stereotype&&B.stereotype!=="JPA_EMBEDDABLE"&&!!D&&D.stereotype==="JPA_EMBEDDABLE";if(O&&D){const ge=D.attributes.filter(ae=>ae.identifier&&!ae.derivedFrom).map(ae=>en(x,ae.modelId,{identifier:!1})),w=On({...o.logical,entities:o.logical.entities.map(ae=>ae.modelId===x?{...ae,stereotype:"JPA_EMBEDDABLE"}:ae)},x,ae=>ae.map(se=>se.identifier&&!se.derivedFrom?{...se,identifier:!1}:se)),k=pl(w,x),C=Y_(o.logical,x),Z=[S,...ge,...k,...C];R(Z.length>1?Ue("임베더블 변환",Z):S);return}if(de){const ge=G_(o.logical,x),w=[S,...ge];R(w.length>1?Ue("엔터티 전환",w):S);return}R(S)},moveEntity(x,B){G(x)||R(En(x,B))},resizeEntity(x,B){G(x)||R(ur(x,B))},removeEntity(x){G(x)||R(sr(x))},setEntitySwatch(x,B){R(fr(x,B))},setEntityCollapsed(x,B){R(mr(x,B))},setEntityLocked(x,B){R(pr(x,B))},isEntityLocked(x){return G(x)},collapseAll(){R(va(!0))},expandAll(){R(va(!1))},setAttributeSwatch(x,B,S){R(Go(x,B,S))},dragGroup(x,B,S){J(x)||R(Ue("그룹 이동",be(x,B,S)))},resizeGroup(x,B){J(x)||R(_r(x,B))},setGroupSwatch(x,B){R(wr(x,B))},setGroupLocked(x,B){R(vr(x,B))},isGroupLocked(x){return J(x)},updateGroup(x,B){J(x)||R(hr(x,B))},createGroup(x,B){if(!x.length)return null;const S=[];for(const de of o.logical.groups)for(const ge of x)de.memberEntityRefs.includes(ge)&&S.push(Yo(de.modelId,ge));const D=Me(),O={modelId:D,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...x]};return S.push(ka(O,ke(x))),R(Ue("그룹 생성",S)),H.value=null,D},addEmptyGroup(x,B){const S=Me();return R(ka({modelId:S,name:B?{ko:B}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...x},size:{width:360,height:260}})),S},removeGroup(x){J(x)||R(yr(x))},dropEntity(x,B,S){var de;if(G(x))return;const D=((de=o.logical.groups.find(ge=>ge.memberEntityRefs.includes(x)))==null?void 0:de.modelId)??null,O=[En(x,B)];D!==S&&(D&&O.push(Yo(D,x)),S&&O.push(gr(S,x))),R(Ue("이동",O))},ungroupEntity(x){const B=o.logical.groups.find(S=>S.memberEntityRefs.includes(x));B&&R(Yo(B.modelId,x))},dropNote(x,B,S){var de;const D=((de=o.layout.groupLayouts.find(ge=>{var w;return(w=ge.memberNoteRefs)==null?void 0:w.includes(x)}))==null?void 0:de.groupRef)??null,O=[Zn(x,B)];D!==S&&(D&&O.push(Hr(D,x)),S&&O.push(Ur(S,x))),R(Ue("이동",O))},addPredefinedEmbed(x,B){if(G(x))return;const S=a.value.find(k=>k.type===B),D=o.logical.entities.find(k=>k.modelId===x);if(!S||!D)return;const O=D.attributes.reduce((k,C)=>Math.max(k,C.order),-1)+1,de=Me(),ge=S.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),w={modelId:de,name:S.defaultName,type:S.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:O,dbAttrs:ge};return R(St(x,w)),de},addAttribute(x,B={}){if(G(x))return B.modelId??"";const S=o.logical.entities.find(Z=>Z.modelId===x),D=S?S.attributes.length:0,O=B.modelId??Me(),de=B.name??`field${D}`,ge={modelId:O,name:de,type:B.type??fa,attrType:B.attrType??"NORMAL",identifier:B.identifier??!1,notNull:B.notNull??!1,order:D,dbAttrs:B.dbAttrs??[{modelId:Me(),physicalName:de,dataType:"VARCHAR",length:255}],...B},w=St(x,ge),k=On(o.logical,x,Z=>[...Z,ge]),C=Ln(k,x);return R(C.length?Ue("속성 추가",[w,...C]):w),O},addDivider(x){if(G(x))return"";const B=o.logical.entities.find(de=>de.modelId===x),S=B?B.attributes.length:0,D=Me();return R(St(x,{modelId:D,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:S,dbAttrs:[]})),D},updateAttribute(x,B,S){_e(x,B,S)},setAttributeGroupCode(x,B,S){_e(x,B,{groupCode:S,type:S?Yn:fa})},setEmbedColumns(x,B,S){var k,C;if(G(x))return;const D=en(x,B,{dbAttrs:S}),O=(k=o.logical.entities.find(Z=>Z.modelId===x))==null?void 0:k.attributes.find(Z=>Z.modelId===B),de=(C=O==null?void 0:O.embedded)==null?void 0:C.associationRef,ge=de?o.logical.associations.find(Z=>Z.modelId===de):void 0,w=[];ge&&de&&(ge.end1.legacyEmbedRaw&&w.push($n(de,"end1",{legacyEmbedRaw:void 0})),ge.end2.legacyEmbedRaw&&w.push($n(de,"end2",{legacyEmbedRaw:void 0}))),R(w.length?Ue("임베드 컬럼 수정",[D,...w]):D)},removeAttribute(x,B){if(G(x))return;if(jo(o.logical,x,B)){y(wd);return}const S=Nn(x,B),D=On(o.logical,x,de=>de.filter(ge=>ge.modelId!==B)),O=Ln(D,x);R(O.length?Ue("속성 삭제",[S,...O]):S)},removeAttributes(x,B){var w;if(!B.length||G(x))return;const S=B.filter(k=>!jo(o.logical,x,k));if(S.length<B.length&&y(wd),!S.length)return;const D=S.map(k=>Nn(x,k)),O=new Set(S),de=On(o.logical,x,k=>k.filter(C=>!O.has(C.modelId))),ge=[...D,...Ln(de,x)];R(ge.length===1?ge[0]:Ue("속성 삭제",ge)),((w=H.value)==null?void 0:w.kind)==="attribute"&&H.value.entityId===x&&(H.value=null)},setAttributeSwatches(x,B,S){B.length&&(B.length===1?R(Go(x,B[0],S)):R(Ue("속성 색상",B.map(D=>Go(x,D,S)))))},reorderAttributes(x,B,S){!B.length||G(x)||R(Ea(x,B,S))},addIndex(x,B){G(x)||R(Sr(x,B))},updateIndex(x,B,S){G(x)||R(Cr(x,B,S))},removeIndex(x,B){G(x)||R(Rr(x,B))},addOperation(x,B={}){var ge;if(G(x))return B.modelId??"";const S=o.logical.entities.find(w=>w.modelId===x),D=((ge=S==null?void 0:S.operations)==null?void 0:ge.length)??0,O=B.modelId??Me(),de={modelId:O,name:B.name??`method${D}`,visibility:B.visibility??"PACKAGE",order:D,...B};return R(kr(x,de)),O},updateOperation(x,B,S){G(x)||R(Er(x,B,S))},removeOperation(x,B){G(x)||R(Nr(x,B))},reorderOperations(x,B,S){!B.length||G(x)||R($r(x,B,S))},setOperationSwatch(x,B,S){R(xr(x,B,S))},addAssociation(x,B,S,D){if(G(x)||G(B))return"";const O=Me(),de={modelId:O,end1:{entityRef:x,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:S},end2:{entityRef:B,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},ge={...o.logical,associations:[...o.logical.associations,de]},w=Jn(ge,B,Me),k=w.add[0];k&&(de.end2.attributeRef=k.modelId);const C={associationRef:O,waypoints:[],sourceColumnRef:S,targetColumnRef:(k==null?void 0:k.modelId)??D},Z=Na(de,C),ae=Bi(B,w);return R(ae.length?Ue("관계 추가",[Z,...ae]):Z),O},addEmbedAssociation(x,B){if(G(x))return;const S=o.logical.entities.find(oe=>oe.modelId===x),D=o.logical.entities.find(oe=>oe.modelId===B);if(!S||!D||D.stereotype!=="JPA_EMBEDDABLE")return;const O=Me(),de=Me(),ge=Me(),w=S.attributes.reduce((oe,Ae)=>Math.max(oe,Ae.order),-1)+1,k=Ed(D),C=oe=>oe&&oe.charAt(0).toLowerCase()+oe.slice(1),Z=new Set(S.attributes.map(oe=>oe.name)),ae=C(D.name);let se=ae;for(let oe=2;Z.has(se);oe++)se=`${ae}${oe}`;const V={modelId:de,name:se,type:D.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:w,dbAttrs:k,embedded:{associationRef:O,embeddableRef:B}},z={modelId:O,end1:{entityRef:x,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:ge},end2:{entityRef:B,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},F={associationRef:O,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return R(Ue("임베드 추가",[St(x,V),Na(z,F)])),O},setEmbedCollectionMode(x,B){if(fe(x))return;const S=o.logical.associations.find(C=>C.modelId===x);if(!S)return;let D,O;for(const C of o.logical.entities){const Z=C.attributes.find(ae=>{var se;return((se=ae.embedded)==null?void 0:se.associationRef)===x&&ae.attrType==="EMBED_OWN"});if(Z){D=C.modelId,O=Z;break}}if(!D||!O)return;const de=O.embedded.embeddableRef,ge=S.end2.entityRef===de?"end2":"end1",w=S[ge],k=w.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(B==="COLLECTION"?k:!k))if(B==="COLLECTION")R(Ue("임베드 컬렉션 전환",[en(D,O.modelId,{dbAttrs:[]}),$n(x,ge,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...w.jpa,collectionType:"LIST"}})]));else{const C=o.logical.entities.find(Z=>Z.modelId===de);if(!C)return;R(Ue("임베드 단일 전환",[en(D,O.modelId,{dbAttrs:Ed(C)}),$n(x,ge,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...w.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(x){if(fe(x))return;const B=o.logical.associations.find(ge=>ge.modelId===x),S=Ir(x);if(!B){R(S);return}for(const ge of o.logical.entities){const w=ge.attributes.find(k=>{var C;return((C=k.embedded)==null?void 0:C.associationRef)===x});if(w){R(Ue("임베드 삭제",[S,Nn(ge.modelId,w.modelId)]));return}}const D=B.end2.entityRef,O={...o.logical,associations:o.logical.associations.filter(ge=>ge.modelId!==x)},de=pl(O,D);R(de.length?Ue("관계 삭제",[S,...de]):S)},setAssociationIdentifying(x,B){if(fe(x))return;const S=o.logical.associations.find(w=>w.modelId===x),D=Wo(x,{identifying:B});if(!S||S.identifying===B){R(D);return}const O=S.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(w=>w.modelId===x?{...w,identifying:B}:w)},ge=pl(de,O);R(ge.length?Ue("식별 관계 변경",[D,...ge]):D)},updateAssociationEnd(x,B,S){fe(x)||R($n(x,B,S))},moveWaypoint(x,B,S){R(Vr(x,B,S))},addWaypoint(x,B,S){R(Br(x,B,S))},removeWaypoint(x,B){R(Ar(x,B))},clearWaypoints(x){R(Mr(x))},addNote(x="메모",B={x:80,y:80}){const S=Me();return R(Dr({modelId:S,memo:x,geo:{location:{...B},size:{width:200,height:120}}})),S},removeNote(x){R(Or(x))},moveNote(x,B){R(Zn(x,B))},resizeNote(x,B){R(Lr(x,B))},setNoteMemo(x,B){R(Pr(x,B))},setNoteSwatch(x,B){R(zr(x,B))},addNoteConnection(x,B){R(Fr(x,B))},removeNoteConnection(x,B){R(Gr(x,B))},moveNoteConnectionWaypoint(x,B,S,D){R(Yr(x,B,S,D))},addNoteConnectionWaypoint(x,B,S,D){R(Wr(x,B,S,D))},removeNoteConnectionWaypoint(x,B,S){R(Kr(x,B,S))},clearNoteConnectionWaypoints(x,B){R(qr(x,B))},autoLayout(){const x=Gl(o.logical,o.layout);x.length&&R(Ue("자동 배치",x.map(B=>En(B.id,B.location))))},copy(){const x=H.value;if((x==null?void 0:x.kind)==="attribute"){const de=o.logical.entities.find(w=>w.modelId===x.entityId);if(!de)return;const ge=[...de.attributes].sort((w,k)=>w.order-k.order).filter(w=>x.ids.includes(w.modelId));if(!ge.length)return;ye.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:ge}));return}const B=ee.value;if(!B)return;const S=o.logical.entities.find(de=>de.modelId===B),D=o.layout.entityLayouts.find(de=>de.entityRef===B);if(!S)return;const O=(D==null?void 0:D.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ye.value=JSON.parse(JSON.stringify({kind:"entity",entity:S,geo:O}))},paste(){if(!Q.value)return;const x=ye.value;if(!x)return;if(x.kind==="attribute"){const D=ee.value;if(!D)return;const O=o.logical.entities.find(Z=>Z.modelId===D);if(!O)return;const de=new Set(O.attributes.map(Z=>Z.name)),ge=new Set(O.attributes.flatMap(Z=>Z.dbAttrs.map(ae=>ae.physicalName))),w=O.attributes.length,k=[],C=x.attributes.map((Z,ae)=>{const se=JSON.parse(JSON.stringify(Z));se.modelId=Me();for(const V of se.dbAttrs)V.modelId=Me();de.has(se.name)&&(se.name=`${se.name}_copy`);for(const V of se.dbAttrs)V.physicalName&&ge.has(V.physicalName)&&(V.physicalName=`${V.physicalName}_copy`);return se.order=w+ae,k.push(se.modelId),St(D,se)});R(C.length===1?C[0]:Ue("속성 붙여넣기",C)),H.value={kind:"attribute",entityId:D,ids:k,anchor:k[k.length-1]};return}const B=F_(x.entity),S={location:{x:x.geo.location.x+40,y:x.geo.location.y+40},size:{...x.geo.size}};R(wa(B,S)),H.value={kind:"entity",id:B.modelId}}};return xe}const Di=Symbol("groupHover"),Nd=Symbol("groupDrag"),Pn=Symbol("relationHighlight"),K_={key:0,class:"em-sel","aria-hidden":"true"},q_=["title","aria-expanded","disabled"],X_={class:"em-entity__stereotype"},j_={key:1,class:"em-entity__name"},Z_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],J_=["onPointerdown"],Q_={key:1,class:"em-entity__divider-label"},ew=["title"],tw={class:"em-key-slot"},nw={class:"em-key-slot"},ow={key:0,class:"em-entity__type"},iw=["onClick"],aw={class:"em-entity__attrname"},lw={class:"em-entity__type"},rw=["data-op"],sw=["onPointerdown"],cw={class:"em-entity__op-vis","aria-hidden":"true"},dw=["title"],uw={key:4,class:"em-entity__footer"},$d=Pe(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&Mi(i,o,t.id)}const l=n.inject(Di,null),r=n.inject(Pn,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}),h=n.computed(()=>!!t.selected&&!m.value),_=n.computed(()=>{var w;return o&&((w=o.selectedAttr.value)==null?void 0:w.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>_.value.size>0);function g(w,k){const C=k.shiftKey?"range":k.metaKey||k.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,w.modelId,C)}const I=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),N=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),q=n.computed(()=>t.data.collapsed??!1),U=n.computed(()=>t.data.locked??!1);function X(){s.value&&(o==null||o.setEntityCollapsed(t.id,!q.value))}const K=n.computed(()=>N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL"),W=n.computed(()=>{const w=N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL",k={};for(const C of y.value.attributes){const Z=C.attrType.startsWith("RELATION")&&C.dbAttrs.length>0;k[C.modelId]={pk:C.identifier,fk:Z&&w,required:C.notNull&&!C.identifier}}return k});function ne(w){if(!w)return"";const k=[];return w.pk&&w.fk?k.push("PFK (식별 외래키)"):w.pk?k.push("PK (기본키)"):w.fk&&k.push("FK (외래키)"),w.required&&k.push("필수 (NOT NULL)"),k.join(" · ")}const re=n.computed(()=>{const w=ul(nt(t.data.style)),k={};return w&&(k["--em-header-bg"]=w.bar,k["--em-header-fg"]=w.barOn),k});function L(w){var k,C;return(C=ul(nt((k=t.data.attributeStyles)==null?void 0:k[w.modelId])))==null?void 0:C.text}const Q=n.computed(()=>[...y.value.operations??[]].sort((w,k)=>w.order-k.order)),v=n.computed(()=>N.value==="CLASS"&&Q.value.length>0),T={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function $(w){return w?T[w]:"~"}function P(w){var k,C;return(C=ul(nt((k=t.data.operationStyles)==null?void 0:k[w.modelId])))==null?void 0:C.text}function H(w,k,C){switch(N.value){case"CLASS":return[{text:w}];case"PHYSICAL":return[{text:C||w}];case"LOGICAL":return[k?{text:k}:{text:"(논리명)",missing:!0}];default:{const Z=k?{text:k}:{text:"(논리명)",missing:!0};return C?[Z,{text:` · ${C}`}]:[Z]}}}function te(w){var k,C,Z;return M(w)?[{text:w.name}]:H(w.name,(C=(k=w.dbAttrs[0])==null?void 0:k.logicalName)==null?void 0:C.ko,((Z=w.dbAttrs[0])==null?void 0:Z.physicalName)??"")}function M(w){return w.attrType.startsWith("EMBED")&&w.dbAttrs.length>0}function ee(w){return w.attrType==="DIVIDER"}function le(w){if(w.attrType!=="EMBED_PREDEF")return w.dbAttrs;const k=o==null?void 0:o.embeddableCatalog.value.find(Z=>Z.type===w.type);if(!k)return w.dbAttrs;const C=Wn(y.value.attributes.flatMap(Z=>Z.dbAttrs));return w.dbAttrs.map((Z,ae)=>{const se=k.fields[ae],V=zo(Z,C);return V?{...Z,physicalName:V.physicalName,logicalName:Z.logicalName??(se==null?void 0:se.logicalName),dataType:Z.dataType||(se==null?void 0:se.dataType)||""}:se?{...Z,physicalName:Z.physicalName||se.physicalName,logicalName:Z.logicalName??se.logicalName,dataType:Z.dataType||se.dataType,length:Z.length??se.length}:Z})}function me(w){var k;return H(w.physicalName,(k=w.logicalName)==null?void 0:k.ko,w.physicalName)}function ye(w){const k=er(w,(o==null?void 0:o.state.logical.associations)??[]);return pa(N.value,w,k)}const ce=n.computed(()=>{var w,k,C;return H(y.value.name,(k=(w=y.value.table)==null?void 0:w.logicalName)==null?void 0:k.ko,((C=y.value.table)==null?void 0:C.physicalName)??"")}),ue=n.ref(!1),he=n.ref(""),ve=n.ref(null);async function Se(){var w,k;s.value&&(he.value=y.value.name,ue.value=!0,await n.nextTick(),(w=ve.value)==null||w.focus(),(k=ve.value)==null||k.select())}function Ie(){if(!ue.value)return;ue.value=!1;const w=he.value.trim();w&&w!==y.value.name&&(o==null||o.renameEntity(t.id,w))}function pe(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:Y,findNode:E}=Oe(),A=n.ref(null),R=n.computed(()=>{const w=A.value??t.data.size;return w?{width:`${w.width}px`,minHeight:`${w.height}px`}:void 0});let G=null;function J(w){var Z,ae,se;if(!s.value)return;w.stopPropagation();const k=(Z=E(t.id))==null?void 0:Z.dimensions,C=Y({x:w.clientX,y:w.clientY});G={fx:C.x,fy:C.y,w:(k==null?void 0:k.width)??((ae=t.data.size)==null?void 0:ae.width)??200,h:(k==null?void 0:k.height)??((se=t.data.size)==null?void 0:se.height)??120},w.target.setPointerCapture(w.pointerId)}function fe(w){if(!G)return;const k=Y({x:w.clientX,y:w.clientY});A.value={width:Math.max(40,G.w+(k.x-G.fx)),height:Math.max(40,G.h+(k.y-G.fy))}}function _e(w){var k,C,Z;if(G&&A.value&&o){const ae=(k=E(t.id))==null?void 0:k.dimensions;o.resizeEntity(t.id,{width:Math.round((ae==null?void 0:ae.width)??A.value.width),height:Math.round((ae==null?void 0:ae.height)??A.value.height)})}G=null,A.value=null,(Z=(C=w.target).releasePointerCapture)==null||Z.call(C,w.pointerId)}const ke=n.ref(null),be=n.ref(null);function xe(w,k){if(!s.value)return;k.stopPropagation(),k.preventDefault();const C=_.value,Z=C.has(w.modelId)?new Set(C):new Set([w.modelId]);be.value={ids:Z,dropIndex:-1,lineY:0},k.target.setPointerCapture(k.pointerId)}function Ve(w){if(!be.value||!ke.value)return;const k=Array.from(ke.value.querySelectorAll(".em-entity__row"));if(!k.length)return;let C=k.length;for(let se=0;se<k.length;se++){const V=k[se].getBoundingClientRect();if(w.clientY<V.top+V.height/2){C=se;break}}const Z=k[k.length-1],ae=C<k.length?k[C].offsetTop:Z.offsetTop+Z.offsetHeight;be.value={...be.value,dropIndex:C,lineY:ae}}function Te(){const w=be.value;if(be.value=null,!w||w.dropIndex<0)return;const k=y.value.attributes,C=k.filter(z=>w.ids.has(z.modelId)).map(z=>z.modelId),Z=k.filter((z,F)=>w.ids.has(z.modelId)&&F<w.dropIndex).length,ae=w.dropIndex-Z,se=k.filter(z=>!w.ids.has(z.modelId)).map(z=>z.modelId);[...se.slice(0,ae),...C,...se.slice(ae)].join(",")!==k.map(z=>z.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,C,ae))}function x(){be.value=null}const B=n.ref(null),S=n.ref(null);function D(w,k){s.value&&(k.stopPropagation(),k.preventDefault(),S.value={id:w.modelId,dropIndex:-1,lineY:0},k.target.setPointerCapture(k.pointerId))}function O(w){if(!S.value||!B.value)return;const k=Array.from(B.value.querySelectorAll(".em-entity__op-row"));if(!k.length)return;let C=k.length;for(let se=0;se<k.length;se++){const V=k[se].getBoundingClientRect();if(w.clientY<V.top+V.height/2){C=se;break}}const Z=k[k.length-1],ae=C<k.length?k[C].offsetTop:Z.offsetTop+Z.offsetHeight;S.value={...S.value,dropIndex:C,lineY:ae}}function de(){const w=S.value;if(S.value=null,!w||w.dropIndex<0)return;const C=Q.value.findIndex(ae=>ae.modelId===w.id);if(C<0)return;const Z=w.dropIndex-(C<w.dropIndex?1:0);Z!==C&&(o==null||o.reorderOperations(t.id,[w.id],Z))}function ge(){S.value=null}return(w,k)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":I.value,"is-selected":m.value,"is-multi-selected":h.value,"has-focused-attr":b.value,"is-locked":U.value}]),style:n.normalizeStyle(R.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",K_,[...k[7]||(k[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(re.value),onDblclick:n.withModifiers(Se,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:q.value?"펼치기":"접기","aria-expanded":!q.value,disabled:!s.value,onClick:n.withModifiers(X,["stop"]),onPointerdown:k[0]||(k[0]=n.withModifiers(()=>{},["stop"])),onDblclick:k[1]||(k[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(q.value?"▸":"▾"),41,q_),n.createElementVNode("span",X_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),ue.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ve,"onUpdate:modelValue":k[2]||(k[2]=C=>he.value=C),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Ie,["enter"]),k[3]||(k[3]=n.withKeys(C=>ue.value=!1,["esc"]))],onBlur:Ie,onPointerdown:k[4]||(k[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,he.value]]):(n.openBlock(),n.createElementBlock("span",j_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.value,(C,Z)=>(n.openBlock(),n.createElementBlock("span",{key:Z,class:n.normalizeClass({"em-entity__missing":C.missing})},n.toDisplayString(C.text),3))),128))])),U.value?(n.openBlock(),n.createBlock(Re,{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:ke,class:"em-entity__attrs"},[be.value&&be.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${be.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,C=>{var Z,ae,se,V;return n.openBlock(),n.createElementBlock(n.Fragment,{key:C.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":_.value.has(C.modelId),"is-dragging":(Z=be.value)==null?void 0:Z.ids.has(C.modelId),"is-embed":M(C),"is-divider":ee(C),nodrag:ee(C)&&s.value}]),"data-attr":C.modelId,onClick:n.withModifiers(z=>g(C,z),["stop"]),onPointerdown:z=>ee(C)?xe(C,z):void 0,onPointermove:z=>ee(C)?Ve(z):void 0,onPointerup:z=>ee(C)?Te():void 0,onPointercancel:z=>ee(C)?x():void 0},[s.value&&!ee(C)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:z=>xe(C,z),onPointermove:Ve,onPointerup:Te,onPointercancel:x,onClick:k[5]||(k[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,J_)):n.createCommentVNode("",!0),ee(C)?(n.openBlock(),n.createElementBlock("span",Q_,n.toDisplayString(C.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${C.modelId}`,type:"target",position:n.unref($e).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(W.value[C.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",tw,[(ae=W.value[C.modelId])!=null&&ae.pk?(n.openBlock(),n.createBlock(Re,{key:0,name:"key",size:12,class:"em-key is-pk"})):(se=W.value[C.modelId])!=null&&se.required?(n.openBlock(),n.createBlock(Re,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",nw,[M(C)?(n.openBlock(),n.createBlock(Re,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(V=W.value[C.modelId])!=null&&V.fk?(n.openBlock(),n.createBlock(Re,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,ew),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(C)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te(C),(z,F)=>(n.openBlock(),n.createElementBlock("span",{key:F,class:n.normalizeClass({"em-entity__missing":z.missing})},n.toDisplayString(z.text),3))),128))],4),ye(C)?(n.openBlock(),n.createElementBlock("span",ow,n.toDisplayString(ye(C)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${C.modelId}`,type:"source",position:n.unref($e).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Z_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M(C)&&K.value?le(C):[],z=>(n.openBlock(),n.createElementBlock("li",{key:`${C.modelId}:${z.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":_.value.has(C.modelId)}]),onClick:n.withModifiers(F=>g(C,F),["stop"])},[k[8]||(k[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",aw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me(z),(F,oe)=>(n.openBlock(),n.createElementBlock("span",{key:oe,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))]),n.createElementVNode("span",lw,n.toDisplayString(z.dataType),1)],10,iw))),128))],64)}),128))],512)),!q.value&&v.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:B,class:"em-entity__ops"},[S.value&&S.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${S.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Q.value,C=>{var Z;return n.openBlock(),n.createElementBlock("li",{key:C.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((Z=S.value)==null?void 0:Z.id)===C.modelId}]),"data-op":C.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ae=>D(C,ae),onPointermove:O,onPointerup:de,onPointercancel:ge,onClick:k[6]||(k[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,sw)):n.createCommentVNode("",!0),n.createElementVNode("span",cw,n.toDisplayString($(C.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:P(C)})},n.toDisplayString(C.name)+"()",5)],10,rw)}),128))],512)):Q.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${Q.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Re,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(Q.value.length)+"개",1)],8,dw)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",uw,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:pe},"+ 속성"),k[9]||(k[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&&!ue.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:fe,onPointerup:_e},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-7efbcdb3"]]),fw={key:0,class:"em-sel","aria-hidden":"true"},mw={class:"em-group__label"},pw={class:"em-group__name"},hw={key:0,class:"em-group__pkg"},yw={key:1,class:"em-group__flag"},xd=Pe(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(()=>nt(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(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var W;return!!t.id&&((W=r==null?void 0:r.selection.value)==null?void 0:W.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Di,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),p=n.inject(Pn,null);function m(){t.id&&(p==null||p.setGroupHover(t.id))}function h(){p==null||p.setGroupHover(null)}const _=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),b=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:g,findNode:I}=Oe();let y=null,N=null;function q(W){var L;if(!t.id||!s.value)return;W.stopPropagation();const ne=((L=I(t.id))==null?void 0:L.dimensions)??{width:400,height:300},re=g({x:W.clientX,y:W.clientY});y={fx:re.x,fy:re.y,w:ne.width,h:ne.height},W.target.setPointerCapture(W.pointerId)}function U(W){if(!y||!t.id)return;const ne=g({x:W.clientX,y:W.clientY});N={width:Math.max(160,y.w+(ne.x-y.fx)),height:Math.max(120,y.h+(ne.y-y.fy))};const re=I(t.id);re&&(re.style={width:`${N.width}px`,height:`${N.height}px`})}function X(W){var ne,re;y&&N&&t.id&&r&&r.resizeGroup(t.id,N),y=null,N=null,(re=(ne=W.target).releasePointerCapture)==null||re.call(ne,W.pointerId)}const K=n.computed(()=>{const W=o.value.name;return(W==null?void 0:W.ko)||(W==null?void 0:W.en)||(W==null?void 0:W.ja)||(W==null?void 0:W.zh)||o.value.packageName||"그룹"});return(W,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":_.value,"is-dimmed":b.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:h},[c.value?(n.openBlock(),n.createElementBlock("div",fw,[...ne[0]||(ne[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",mw,[n.createElementVNode("span",pw,n.toDisplayString(K.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",hw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",yw,"DDL 제외")):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Re,{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:U,onPointerup:X},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),gw={key:0,class:"em-sel","aria-hidden":"true"},bw={key:2,class:"em-note__text"},Id=Pe(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Di,null),a=n.inject(Pn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>nt(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 v;return((v=a==null?void 0:a.source.value)==null?void 0:v.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!p.value),h=n.computed(()=>{var v;return((v=o==null?void 0:o.selection.value)==null?void 0:v.kind)==="note"&&o.selection.value.id===t.id}),_=n.computed(()=>!!t.selected&&!h.value),b=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!h.value),g=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],I=n.ref(!1),y=n.ref(""),N=n.ref(null);async function q(){var v;r.value&&(y.value=l.value.memo,I.value=!0,await n.nextTick(),(v=N.value)==null||v.focus())}function U(){I.value&&(I.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:X,findNode:K}=Oe();let W=null,ne=null;function re(v){var P;if(!r.value)return;v.stopPropagation();const T=((P=K(t.id))==null?void 0:P.dimensions)??l.value.geo.size,$=X({x:v.clientX,y:v.clientY});W={fx:$.x,fy:$.y,w:T.width,h:T.height},v.target.setPointerCapture(v.pointerId)}function L(v){if(!W)return;const T=X({x:v.clientX,y:v.clientY});ne={width:Math.max(140,W.w+(T.x-W.fx)),height:Math.max(60,W.h+(T.y-W.fy))};const $=K(t.id);$&&($.style={width:`${ne.width}px`,height:`${ne.height}px`})}function Q(v){var T,$;W&&ne&&o&&o.resizeNote(t.id,ne),W=null,ne=null,($=(T=v.target).releasePointerCapture)==null||$.call(T,v.pointerId)}return(v,T)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":m.value,"is-dimmed":b.value,"is-selected":h.value,"is-multi-selected":_.value}]),style:n.normalizeStyle(c.value),onDblclick:q,onPointerdown:d,onMouseenter:u,onMouseleave:f},[h.value?(n.openBlock(),n.createElementBlock("div",gw,[...T[4]||(T[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),I.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":T[0]||(T[0]=$=>y.value=$),class:"em-note__edit nodrag",onBlur:U,onKeydown:T[1]||(T[1]=n.withKeys($=>I.value=!1,["esc"])),onPointerdown:T[2]||(T[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",bw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(g,$=>n.createVNode(n.unref(dn),{id:$.id,key:$.id,type:"source",position:$.pos,class:"em-note-handle",onPointerdown:T[3]||(T[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!I.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:re,onPointermove:L,onPointerup:Q},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),_w=20,ww=22,vw=7,kw=22,Sd=31,Cd=7,Ew=20,Rd=11,Vd=11,Nw=Sd+Cd;function $w(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function xw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Oi(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 Ad(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Li(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Td(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Ad(e,t);return[Li(o,a,l-Math.PI/2),Li(o,a,l+Math.PI/2)]}function Md(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 Bd(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=Oi(e,t,_w),[d,u]=Td(e,t,c,ww);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}),$w(o.multiplicity)){const f=Oi(e,t,Sd);l.push({cx:f.x,cy:f.y,r:Cd})}if(xw(o.multiplicity)){const f=Oi(e,t,vw),[p,m]=Td(e,t,f,kw);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=Oi(e,t,Ew),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Ad(e,t),f=Li(d,Rd/2,u-Math.PI/2),p=Li(d,Rd/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=Md(s,c,Vd,!0),u=Md(s,c,Vd,!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 Dd=200,Od=120,hl=24;function Ld(e){var a,l;if(!e)return{x:0,y:0,width:Dd,height:Od};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Dd,i=((l=e.dimensions)==null?void 0:l.height)||Od;return{x:t.x,y:t.y,width:o,height:i}}function Pd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function zd(e){const t=n.computed(()=>Ld(e.sourceNode())),o=n.computed(()=>Ld(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,h;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-f)<hl){const _=(f+p)/2;f=_-hl/2,p=_+hl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),l=n.computed(()=>e.waypoints()[0]??Pd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Pd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?sa(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?sa(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"),Iw=["d"],Sw=["d"],Cw=["d"],Rw=["x1","y1","x2","y2"],Vw=["cx","cy","r"],Aw=["x","y"],Tw=["x","y"],Mw=["cx","cy","onDblclick"],Bw=["x","y","onPointerdown","onDblclick"],Ud=Pe(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Oe(),i=n.inject(yl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Nd,null),s=n.inject(Pn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const pe=r==null?void 0:r.value;if(!pe||!a)return null;const j=a.resolved.value.entities,Y=A=>{var R;return(R=j.find(G=>G.entity.modelId===A))==null?void 0:R.groupRef},E=t.data.association;return Y(E.end1.entityRef)===pe.groupId&&Y(E.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),h=n.ref({x:0,y:0}),_=n.computed(()=>{const pe=f.value;return p.value.map((j,Y)=>Y===m.value?h.value:pe?{x:j.x+pe.dx,y:j.y+pe.dy}:j)}),b=n.computed(()=>{var pe;return!!((pe=t.sourceNode.data)!=null&&pe.collapsed)}),g=n.computed(()=>{var pe;return!!((pe=t.targetNode.data)!=null&&pe.collapsed)}),{source:I,target:y,sourceSide:N,targetSide:q,isSelf:U}=zd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>_.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!g.value?t.targetY:void 0}),X=Nw+4,K=n.computed(()=>U.value?Fl(I.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ia(I.value,N.value,_.value,y.value,q.value,X):la(I.value,_.value,y.value)),W=n.computed(()=>U.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?aa(I.value,N.value,_.value,y.value,q.value,X):ca(I.value,_.value,y.value).map((pe,j)=>({point:pe,segIndex:j}))),ne=n.computed(()=>U.value||!l.value?[]:_.value);function re(pe){switch(pe){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(pe,j){m.value=pe,h.value={...p.value[pe]},j.target.setPointerCapture(j.pointerId),j.stopPropagation()}function Q(pe){if(m.value<0)return;const j=o({x:pe.clientX,y:pe.clientY});h.value={x:j.x,y:j.y}}function v(pe){var j,Y;m.value>=0&&i&&i.movePoint(t.id,m.value,{...h.value}),m.value=-1,(Y=(j=pe.target).releasePointerCapture)==null||Y.call(j,pe.pointerId)}function T(pe,j){j.stopPropagation(),i==null||i.removePoint(t.id,pe)}function $(pe,j){if(!i)return;const Y=o({x:j.clientX,y:j.clientY});i.insertPoint(t.id,pe,{x:Y.x,y:Y.y})}const P=n.computed(()=>re(t.data.association.end1.multiplicity)),H=n.computed(()=>re(t.data.association.end2.multiplicity)),te=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),M=n.computed(()=>te.value==="class"),ee=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=Gn(N.value);return{x:I.value.x+pe.x*10,y:I.value.y+pe.y*10}}return _.value[0]??y.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const j=Gn(q.value);return{x:y.value.x+j.x*10,y:y.value.y+j.y*10}}const pe=_.value;return pe[pe.length-1]??I.value}),me=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),ye=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),ce=n.computed(()=>Bd(I.value,ee.value,me.value,te.value)),ue=n.computed(()=>Bd(y.value,le.value,ye.value,te.value)),he=n.computed(()=>[...ce.value.lines,...ue.value.lines]),ve=n.computed(()=>[...ce.value.circles,...ue.value.circles]),Se=n.computed(()=>[...ce.value.polygons,...ue.value.polygons].map(pe=>`M${pe.points.map(j=>`${j.x},${j.y}`).join(" L")} Z`)),Ie=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,j)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:K.value,fill:"none",class:"em-edge__hit"},null,8,Iw),n.createElementVNode("path",{d:K.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,Sw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Se.value,(Y,E)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${E}`,d:Y,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ie.value])},null,10,Cw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(he.value,(Y,E)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${E}`,x1:Y.x1,y1:Y.y1,x2:Y.x2,y2:Y.y2,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,Rw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ve.value,(Y,E)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${E}`,cx:Y.cx,cy:Y.cy,r:Y.r,class:n.normalizeClass(["em-edge__marker",Ie.value])},null,10,Vw))),128)),M.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(I).x+8,y:n.unref(I).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(P.value),11,Aw),n.createElementVNode("text",{x:n.unref(y).x-8,y:n.unref(y).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,Tw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(W.value,(Y,E)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${E}`,cx:Y.point.x,cy:Y.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(A=>$(Y.segIndex,A),["stop"])},null,42,Mw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.value,(Y,E)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${E}`,x:Y.x-5,y:Y.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:A=>L(E,A),onPointermove:Q,onPointerup:v,onDblclick:A=>T(E,A)},null,42,Bw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Mt=(e=>(e.Lines="lines",e.Dots="dots",e))(Mt||{});const Hd=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]}`})},Fd=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Mt.Lines+"",Mt.Dots+"";const Dw={[Mt.Dots]:"#81818a",[Mt.Lines]:"#eee"},Ow=["id","x","y","width","height","patternTransform"],Lw={key:2,height:"100",width:"100"},Pw=["fill"],zw=["x","y","fill"],Uw={name:"Background",compatConfig:{MODE:3}},Hw=n.defineComponent({...Uw,props:{id:{},variant:{default:()=>Mt.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}=Oe(),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||Dw[e.variant||Mt.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(Mt).Lines?(n.openBlock(),n.createBlock(n.unref(Hd),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Mt).Dots?(n.openBlock(),n.createBlock(n.unref(Fd),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Lw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Pw)])):n.createCommentVNode("",!0)])],8,Ow)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,zw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Fw={name:"ControlButton",compatConfig:{MODE:3}},Gw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Yw={type:"button",class:"vue-flow__controls-button"};function Ww(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Yw,[n.renderSlot(e.$slots,"default")])}const hn=Gw(Fw,[["render",Ww]]),Kw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},qw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Xw(e,t){return n.openBlock(),n.createElementBlock("svg",Kw,qw)}const jw={render:Xw},Zw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Jw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Qw(e,t){return n.openBlock(),n.createElementBlock("svg",Zw,Jw)}const ev={render:Qw},tv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},nv=[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 ov(e,t){return n.openBlock(),n.createElementBlock("svg",tv,nv)}const iv={render:ov},av={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},lv=[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 rv(e,t){return n.openBlock(),n.createElementBlock("svg",av,lv)}const sv={render:rv},cv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dv=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function uv(e,t){return n.openBlock(),n.createElementBlock("svg",cv,dv)}const fv={render:uv},mv={name:"Controls",compatConfig:{MODE:3}},pv=n.defineComponent({...mv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>hc.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}=Oe(),p=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),h=n.toRef(()=>d.value.zoom>=f.value);function _(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function g(){c(e.fitViewParams),t("fitView")}function I(){l(!p.value),t("interactionChange",!p.value)}return(y,N)=>(n.openBlock(),n.createBlock(n.unref(md),{class:"vue-flow__controls",position:y.position},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"top"),y.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(y.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(jw))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(ev))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(iv))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:I},{default:n.withCtx(()=>[p.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(fv))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(sv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var hv={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 Pi(o)}function Pi(e){this._=e}function yv(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}})}Pi.prototype=gl.prototype={constructor:Pi,on:function(e,t){var o=this._,i=yv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=gv(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]=Gd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Gd(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 Pi(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 gv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Gd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=hv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var bl="http://www.w3.org/1999/xhtml";const Yd={svg:"http://www.w3.org/2000/svg",xhtml:bl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function zi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Yd.hasOwnProperty(t)?{space:Yd[t],local:e}:e}function bv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===bl&&t.documentElement.namespaceURI===bl?t.createElement(e):t.createElementNS(o,e)}}function _v(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Wd(e){var t=zi(e);return(t.local?_v:bv)(t)}function wv(){}function _l(e){return e==null?wv:function(){return this.querySelector(e)}}function vv(e){typeof e!="function"&&(e=_l(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 ct(i,this._parents)}function kv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ev(){return[]}function Kd(e){return e==null?Ev:function(){return this.querySelectorAll(e)}}function Nv(e){return function(){return kv(e.apply(this,arguments))}}function $v(e){typeof e=="function"?e=Nv(e):e=Kd(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 ct(i,a)}function qd(e){return function(){return this.matches(e)}}function Xd(e){return function(t){return t.matches(e)}}var xv=Array.prototype.find;function Iv(e){return function(){return xv.call(this.children,e)}}function Sv(){return this.firstElementChild}function Cv(e){return this.select(e==null?Sv:Iv(typeof e=="function"?e:Xd(e)))}var Rv=Array.prototype.filter;function Vv(){return Array.from(this.children)}function Av(e){return function(){return Rv.call(this.children,e)}}function Tv(e){return this.selectAll(e==null?Vv:Av(typeof e=="function"?e:Xd(e)))}function Mv(e){typeof e!="function"&&(e=qd(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 ct(i,this._parents)}function jd(e){return new Array(e.length)}function Bv(){return new ct(this._enter||this._groups.map(jd),this._parents)}function Ui(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ui.prototype={constructor:Ui,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 Dv(e){return function(){return e}}function Ov(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 Ui(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Lv(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 Ui(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(a[s]=c)}function Pv(e){return e.__data__}function zv(e,t){if(!arguments.length)return Array.from(this,Pv);var o=t?Lv:Ov,i=this._parents,a=this._groups;typeof e!="function"&&(e=Dv(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=Uv(e.call(u,u&&u.__data__,d,i)),h=m.length,_=s[d]=new Array(h),b=r[d]=new Array(h),g=c[d]=new Array(p);o(u,f,_,b,g,m,t);for(var I=0,y=0,N,q;I<h;++I)if(N=_[I]){for(I>=y&&(y=I+1);!(q=b[y])&&++y<h;);N._next=q||null}}return r=new ct(r,i),r._enter=s,r._exit=c,r}function Uv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Hv(){return new ct(this._exit||this._groups.map(jd),this._parents)}function Fv(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 Gv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,l=i.length,r=Math.min(a,l),s=new Array(a),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,h=0;h<f;++h)(m=d[h]||u[h])&&(p[h]=m);for(;c<a;++c)s[c]=o[c];return new ct(s,this._parents)}function Yv(){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 Wv(e){e||(e=Kv);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 ct(a,this._parents).order()}function Kv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xv(){return Array.from(this)}function jv(){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 Zv(){let e=0;for(const t of this)++e;return e}function Jv(){return!this.node()}function Qv(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 ek(e){return function(){this.removeAttribute(e)}}function tk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nk(e,t){return function(){this.setAttribute(e,t)}}function ok(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ik(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function ak(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 lk(e,t){var o=zi(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?tk:ek:typeof t=="function"?o.local?ak:ik:o.local?ok:nk)(o,t))}function Zd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rk(e){return function(){this.style.removeProperty(e)}}function sk(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ck(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function dk(e,t,o){return arguments.length>1?this.each((t==null?rk:typeof t=="function"?ck:sk)(e,t,o??"")):zn(this.node(),e)}function zn(e,t){return e.style.getPropertyValue(t)||Zd(e).getComputedStyle(e,null).getPropertyValue(t)}function uk(e){return function(){delete this[e]}}function fk(e,t){return function(){this[e]=t}}function mk(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function pk(e,t){return arguments.length>1?this.each((t==null?uk:typeof t=="function"?mk:fk)(e,t)):this.node()[e]}function Jd(e){return e.trim().split(/^|\s+/)}function wl(e){return e.classList||new Qd(e)}function Qd(e){this._node=e,this._names=Jd(e.getAttribute("class")||"")}Qd.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 eu(e,t){for(var o=wl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function tu(e,t){for(var o=wl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function hk(e){return function(){eu(this,e)}}function yk(e){return function(){tu(this,e)}}function gk(e,t){return function(){(t.apply(this,arguments)?eu:tu)(this,e)}}function bk(e,t){var o=Jd(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"?gk:t?hk:yk)(o,t))}function _k(){this.textContent=""}function wk(e){return function(){this.textContent=e}}function vk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function kk(e){return arguments.length?this.each(e==null?_k:(typeof e=="function"?vk:wk)(e)):this.node().textContent}function Ek(){this.innerHTML=""}function Nk(e){return function(){this.innerHTML=e}}function $k(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function xk(e){return arguments.length?this.each(e==null?Ek:(typeof e=="function"?$k:Nk)(e)):this.node().innerHTML}function Ik(){this.nextSibling&&this.parentNode.appendChild(this)}function Sk(){return this.each(Ik)}function Ck(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Rk(){return this.each(Ck)}function Vk(e){var t=typeof e=="function"?e:Wd(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ak(){return null}function Tk(e,t){var o=typeof e=="function"?e:Wd(e),i=t==null?Ak:typeof t=="function"?t:_l(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Mk(){var e=this.parentNode;e&&e.removeChild(this)}function Bk(){return this.each(Mk)}function Dk(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ok(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lk(e){return this.select(e?Ok:Dk)}function Pk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function zk(e){return function(t){e.call(this,t,this.__data__)}}function Uk(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 Hk(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 Fk(e,t,o){return function(){var i=this.__on,a,l=zk(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 Gk(e,t,o){var i=Uk(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?Fk:Hk,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function nu(e,t,o){var i=Zd(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 Yk(e,t){return function(){return nu(this,e,t)}}function Wk(e,t){return function(){return nu(this,e,t.apply(this,arguments))}}function Kk(e,t){return this.each((typeof t=="function"?Wk:Yk)(e,t))}function*qk(){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 ou=[null];function ct(e,t){this._groups=e,this._parents=t}function wo(){return new ct([[document.documentElement]],ou)}function Xk(){return this}ct.prototype=wo.prototype={constructor:ct,select:vv,selectAll:$v,selectChild:Cv,selectChildren:Tv,filter:Mv,data:zv,enter:Bv,exit:Hv,join:Fv,merge:Gv,selection:Xk,order:Yv,sort:Wv,call:qv,nodes:Xv,node:jv,size:Zv,empty:Jv,each:Qv,attr:lk,style:dk,property:pk,classed:bk,text:kk,html:xk,raise:Sk,lower:Rk,append:Vk,insert:Tk,remove:Bk,clone:Lk,datum:Pk,on:Gk,dispatch:Kk,[Symbol.iterator]:qk};function Wt(e){return typeof e=="string"?new ct([[document.querySelector(e)]],[document.documentElement]):new ct([[e]],ou)}function jk(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kt(e,t){if(e=jk(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 vl={capture:!0,passive:!1};function kl(e){e.preventDefault(),e.stopImmediatePropagation()}function Zk(e){var t=e.document.documentElement,o=Wt(e).on("dragstart.drag",kl,vl);"onselectstart"in t?o.on("selectstart.drag",kl,vl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Jk(e,t){var o=e.document.documentElement,i=Wt(e).on("dragstart.drag",null);t&&(i.on("click.drag",kl,vl),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 El(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function iu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function vo(){}var ko=.7,Hi=1/ko,Un="\\s*([+-]?\\d+)\\s*",Eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qk=/^#([0-9a-f]{3,8})$/,eE=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),tE=new RegExp(`^rgb\\(${Nt},${Nt},${Nt}\\)$`),nE=new RegExp(`^rgba\\(${Un},${Un},${Un},${Eo}\\)$`),oE=new RegExp(`^rgba\\(${Nt},${Nt},${Nt},${Eo}\\)$`),iE=new RegExp(`^hsl\\(${Eo},${Nt},${Nt}\\)$`),aE=new RegExp(`^hsla\\(${Eo},${Nt},${Nt},${Eo}\\)$`),au={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};El(vo,No,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:lu,formatHex:lu,formatHex8:lE,formatHsl:rE,formatRgb:ru,toString:ru});function lu(){return this.rgb().formatHex()}function lE(){return this.rgb().formatHex8()}function rE(){return fu(this).formatHsl()}function ru(){return this.rgb().formatRgb()}function No(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Qk.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?su(t):o===3?new lt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Fi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Fi(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=eE.exec(e))?new lt(t[1],t[2],t[3],1):(t=tE.exec(e))?new lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nE.exec(e))?Fi(t[1],t[2],t[3],t[4]):(t=oE.exec(e))?Fi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=iE.exec(e))?uu(t[1],t[2]/100,t[3]/100,1):(t=aE.exec(e))?uu(t[1],t[2]/100,t[3]/100,t[4]):au.hasOwnProperty(e)?su(au[e]):e==="transparent"?new lt(NaN,NaN,NaN,0):null}function su(e){return new lt(e>>16&255,e>>8&255,e&255,1)}function Fi(e,t,o,i){return i<=0&&(e=t=o=NaN),new lt(e,t,o,i)}function sE(e){return e instanceof vo||(e=No(e)),e?(e=e.rgb(),new lt(e.r,e.g,e.b,e.opacity)):new lt}function Nl(e,t,o,i){return arguments.length===1?sE(e):new lt(e,t,o,i??1)}function lt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}El(lt,Nl,iu(vo,{brighter(e){return e=e==null?Hi:Math.pow(Hi,e),new lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new lt(yn(this.r),yn(this.g),yn(this.b),Gi(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:cu,formatHex:cu,formatHex8:cE,formatRgb:du,toString:du}));function cu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function cE(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function du(){const e=Gi(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function Gi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return e=yn(e),(e<16?"0":"")+e.toString(16)}function uu(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new ht(e,t,o,i)}function fu(e){if(e instanceof ht)return new ht(e.h,e.s,e.l,e.opacity);if(e instanceof vo||(e=No(e)),!e)return new ht;if(e instanceof ht)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 ht(r,s,c,e.opacity)}function dE(e,t,o,i){return arguments.length===1?fu(e):new ht(e,t,o,i??1)}function ht(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}El(ht,dE,iu(vo,{brighter(e){return e=e==null?Hi:Math.pow(Hi,e),new ht(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ko:Math.pow(ko,e),new ht(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 lt($l(e>=240?e-240:e+120,a,i),$l(e,a,i),$l(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ht(mu(this.h),Yi(this.s),Yi(this.l),Gi(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=Gi(this.opacity);return`${e===1?"hsl(":"hsla("}${mu(this.h)}, ${Yi(this.s)*100}%, ${Yi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mu(e){return e=(e||0)%360,e<0?e+360:e}function Yi(e){return Math.max(0,Math.min(1,e||0))}function $l(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 pu=e=>()=>e;function uE(e,t){return function(o){return e+o*t}}function fE(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 mE(e){return(e=+e)==1?hu:function(t,o){return o-t?fE(t,o,e):pu(isNaN(t)?o:t)}}function hu(e,t){var o=t-e;return o?uE(e,o):pu(isNaN(e)?t:e)}const yu=(function e(t){var o=mE(t);function i(a,l){var r=o((a=Nl(a)).r,(l=Nl(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=hu(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 qt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var xl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Il=new RegExp(xl.source,"g");function pE(e){return function(){return e}}function hE(e){return function(t){return e(t)+""}}function yE(e,t){var o=xl.lastIndex=Il.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=xl.exec(e))&&(a=Il.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:qt(i,a)})),o=Il.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?hE(c[0].x):pE(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 gu=180/Math.PI,Sl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bu(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)*gu,skewX:Math.atan(c)*gu,scaleX:r,scaleY:s}}var Wi;function gE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sl:bu(t.a,t.b,t.c,t.d,t.e,t.f)}function bE(e){return e==null||(Wi||(Wi=document.createElementNS("http://www.w3.org/2000/svg","g")),Wi.setAttribute("transform",e),!(e=Wi.transform.baseVal.consolidate()))?Sl:(e=e.matrix,bu(e.a,e.b,e.c,e.d,e.e,e.f))}function _u(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,p,m,h){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);h.push({i:_-4,x:qt(d,f)},{i:_-2,x:qt(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:qt(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:qt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,p,m,h){if(d!==f||u!==p){var _=m.push(a(m)+"scale(",null,",",null,")");h.push({i:_-4,x:qt(d,f)},{i:_-2,x:qt(u,p)})}else(f!==1||p!==1)&&m.push(a(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var h=-1,_=p.length,b;++h<_;)f[(b=p[h]).i]=b.x(m);return f.join("")}}}var _E=_u(gE,"px, ","px)","deg)"),wE=_u(bE,", ",")",")"),vE=1e-12;function wu(e){return((e=Math.exp(e))+1/e)/2}function kE(e){return((e=Math.exp(e))-1/e)/2}function EE(e){return((e=Math.exp(2*e))-1)/(e+1)}const NE=(function e(t,o,i){function a(l,r){var s=l[0],c=l[1],d=l[2],u=r[0],f=r[1],p=r[2],m=u-s,h=f-c,_=m*m+h*h,b,g;if(_<vE)g=Math.log(p/d)/t,b=function(X){return[s+X*m,c+X*h,d*Math.exp(t*X*g)]};else{var I=Math.sqrt(_),y=(p*p-d*d+i*_)/(2*d*o*I),N=(p*p-d*d-i*_)/(2*p*o*I),q=Math.log(Math.sqrt(y*y+1)-y),U=Math.log(Math.sqrt(N*N+1)-N);g=(U-q)/t,b=function(X){var K=X*g,W=wu(q),ne=d/(o*I)*(W*EE(t*K+q)-kE(q));return[s+ne*m,c+ne*h,d*W/wu(t*K+q)]}}return b.duration=g*1e3*t/Math.SQRT2,b}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 Hn=0,$o=0,xo=0,vu=1e3,Ki,Io,qi=0,bn=0,Xi=0,So=typeof performance=="object"&&performance.now?performance:Date,ku=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cl(){return bn||(ku($E),bn=So.now()+Xi)}function $E(){bn=0}function ji(){this._call=this._time=this._next=null}ji.prototype=Eu.prototype={constructor:ji,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Cl():+o)+(t==null?0:+t),!this._next&&Io!==this&&(Io?Io._next=this:Ki=this,Io=this),this._call=e,this._time=o,Rl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rl())}};function Eu(e,t,o){var i=new ji;return i.restart(e,t,o),i}function xE(){Cl(),++Hn;for(var e=Ki,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hn}function Nu(){bn=(qi=So.now())+Xi,Hn=$o=0;try{xE()}finally{Hn=0,SE(),bn=0}}function IE(){var e=So.now(),t=e-qi;t>vu&&(Xi-=t,qi=e)}function SE(){for(var e,t=Ki,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:Ki=o);Io=e,Rl(i)}function Rl(e){if(!Hn){$o&&($o=clearTimeout($o));var t=e-bn;t>24?(e<1/0&&($o=setTimeout(Nu,e-So.now()-Xi)),xo&&(xo=clearInterval(xo))):(xo||(qi=So.now(),xo=setInterval(IE,vu)),Hn=1,ku(Nu))}}function $u(e,t,o){var i=new ji;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var CE=gl("start","end","cancel","interrupt"),RE=[],xu=0,Iu=1,Vl=2,Zi=3,Su=4,Al=5,Ji=6;function Qi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;VE(e,o,{name:t,index:i,group:a,on:CE,tween:RE,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:xu})}function Tl(e,t){var o=yt(e,t);if(o.state>xu)throw new Error("too late; already scheduled");return o}function $t(e,t){var o=yt(e,t);if(o.state>Zi)throw new Error("too late; already running");return o}function yt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function VE(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Eu(l,0,o.time);function l(d){o.state=Iu,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!==Iu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Zi)return $u(r);m.state===Su?(m.state=Ji,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Ji,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if($u(function(){o.state===Zi&&(o.state=Su,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Vl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Vl){for(o.state=Zi,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=Al,1),f=-1,p=a.length;++f<p;)a[f].call(e,u);o.state===Al&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ji,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ea(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>Vl&&i.state<Al,i.state=Ji,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function AE(e){return this.each(function(){ea(this,e)})}function TE(e,t){var o,i;return function(){var a=$t(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 ME(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=$t(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 BE(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=yt(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?TE:ME)(o,e,t))}function Ml(e,t,o){var i=e._id;return e.each(function(){var a=$t(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return yt(a,i).value[t]}}function Cu(e,t){var o;return(typeof t=="number"?qt:t instanceof No?yu:(o=No(t))?(t=o,yu):yE)(e,t)}function DE(e){return function(){this.removeAttribute(e)}}function OE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LE(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 PE(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 zE(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 UE(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 HE(e,t){var o=zi(e),i=o==="transform"?wE:Cu;return this.attrTween(e,typeof t=="function"?(o.local?UE:zE)(o,i,Ml(this,"attr."+e,t)):t==null?(o.local?OE:DE)(o):(o.local?PE:LE)(o,i,t))}function FE(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function GE(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function YE(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&GE(e,l)),o}return a._value=t,a}function WE(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&FE(e,l)),o}return a._value=t,a}function KE(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=zi(e);return this.tween(o,(i.local?YE:WE)(i,t))}function qE(e,t){return function(){Tl(this,e).delay=+t.apply(this,arguments)}}function XE(e,t){return t=+t,function(){Tl(this,e).delay=t}}function jE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qE:XE)(t,e)):yt(this.node(),t).delay}function ZE(e,t){return function(){$t(this,e).duration=+t.apply(this,arguments)}}function JE(e,t){return t=+t,function(){$t(this,e).duration=t}}function QE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ZE:JE)(t,e)):yt(this.node(),t).duration}function eN(e,t){if(typeof t!="function")throw new Error;return function(){$t(this,e).ease=t}}function tN(e){var t=this._id;return arguments.length?this.each(eN(t,e)):yt(this.node(),t).ease}function nN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;$t(this,e).ease=o}}function oN(e){if(typeof e!="function")throw new Error;return this.each(nN(this._id,e))}function iN(e){typeof e!="function"&&(e=qd(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 Bt(i,this._parents,this._name,this._id)}function aN(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 Bt(r,this._parents,this._name,this._id)}function lN(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 rN(e,t,o){var i,a,l=lN(t)?Tl:$t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function sN(e,t){var o=this._id;return arguments.length<2?yt(this.node(),o).on.on(e):this.each(rN(o,e,t))}function cN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function dN(){return this.on("end.remove",cN(this._id))}function uN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=_l(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,Qi(d[p],t,o,p,d,yt(u,o)));return new Bt(l,this._parents,t,o)}function fN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Kd(e));for(var i=this._groups,a=i.length,l=[],r=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,h=yt(u,o),_=0,b=p.length;_<b;++_)(m=p[_])&&Qi(m,t,o,_,p,h);l.push(p),r.push(u)}return new Bt(l,r,t,o)}var mN=wo.prototype.constructor;function pN(){return new mN(this._groups,this._parents)}function hN(e,t){var o,i,a;return function(){var l=zn(this,e),r=(this.style.removeProperty(e),zn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Ru(e){return function(){this.style.removeProperty(e)}}function yN(e,t,o){var i,a=o+"",l;return function(){var r=zn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function gN(e,t,o){var i,a,l;return function(){var r=zn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),zn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function bN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=$t(this,e),d=c.on,u=c.value[l]==null?s||(s=Ru(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function _N(e,t,o){var i=(e+="")=="transform"?_E:Cu;return t==null?this.styleTween(e,hN(e,i)).on("end.style."+e,Ru(e)):typeof t=="function"?this.styleTween(e,gN(e,i,Ml(this,"style."+e,t))).each(bN(this._id,e)):this.styleTween(e,yN(e,i,t),o).on("end.style."+e,null)}function wN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function vN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&wN(e,r,o)),i}return l._value=t,l}function kN(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,vN(e,t,o??""))}function EN(e){return function(){this.textContent=e}}function NN(e){return function(){var t=e(this);this.textContent=t??""}}function $N(e){return this.tween("text",typeof e=="function"?NN(Ml(this,"text",e)):EN(e==null?"":e+""))}function xN(e){return function(t){this.textContent=e.call(this,t)}}function IN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&xN(a)),t}return i._value=e,i}function SN(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,IN(e))}function CN(){for(var e=this._name,t=this._id,o=Vu(),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=yt(c,t);Qi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Bt(i,this._parents,e,o)}function RN(){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=$t(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 VN=0;function Bt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Vu(){return++VN}var Dt=wo.prototype;Bt.prototype={constructor:Bt,select:uN,selectAll:fN,selectChild:Dt.selectChild,selectChildren:Dt.selectChildren,filter:iN,merge:aN,selection:pN,transition:CN,call:Dt.call,nodes:Dt.nodes,node:Dt.node,size:Dt.size,empty:Dt.empty,each:Dt.each,on:sN,attr:HE,attrTween:KE,style:_N,styleTween:kN,text:$N,textTween:SN,remove:dN,tween:BE,delay:jE,duration:QE,ease:tN,easeVarying:oN,end:RN,[Symbol.iterator]:Dt[Symbol.iterator]};function AN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var TN={time:null,delay:0,duration:250,ease:AN};function MN(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 BN(e){var t,o;e instanceof Bt?(t=e._id,e=e._name):(t=Vu(),(o=TN).time=Cl(),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])&&Qi(c,e,t,d,r,o||MN(c,t));return new Bt(i,this._parents,e,t)}wo.prototype.interrupt=AE,wo.prototype.transition=BN;const ta=e=>()=>e;function DN(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 Bl=new Ot(1,0,0);Ot.prototype;function Dl(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function ON(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function LN(){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 Au(){return this.__zoom||Bl}function PN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zN(){return navigator.maxTouchPoints||"ontouchstart"in this}function UN(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 HN(){var e=ON,t=LN,o=UN,i=PN,a=zN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=NE,d=gl("start","zoom","end"),u,f,p,m=500,h=150,_=0,b=10;function g(v){v.property("__zoom",Au).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(v,T,$,P){var H=v.selection?v.selection():v;H.property("__zoom",Au),v!==H?q(v,T,$,P):H.interrupt().each(function(){U(this,arguments).event(P).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(v,T,$,P){g.scaleTo(v,function(){var H=this.__zoom.k,te=typeof T=="function"?T.apply(this,arguments):T;return H*te},$,P)},g.scaleTo=function(v,T,$,P){g.transform(v,function(){var H=t.apply(this,arguments),te=this.__zoom,M=$==null?N(H):typeof $=="function"?$.apply(this,arguments):$,ee=te.invert(M),le=typeof T=="function"?T.apply(this,arguments):T;return o(y(I(te,le),M,ee),H,r)},$,P)},g.translateBy=function(v,T,$,P){g.transform(v,function(){return o(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),r)},null,P)},g.translateTo=function(v,T,$,P,H){g.transform(v,function(){var te=t.apply(this,arguments),M=this.__zoom,ee=P==null?N(te):typeof P=="function"?P.apply(this,arguments):P;return o(Bl.translate(ee[0],ee[1]).scale(M.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof $=="function"?-$.apply(this,arguments):-$),te,r)},P,H)};function I(v,T){return T=Math.max(l[0],Math.min(l[1],T)),T===v.k?v:new Ot(T,v.x,v.y)}function y(v,T,$){var P=T[0]-$[0]*v.k,H=T[1]-$[1]*v.k;return P===v.x&&H===v.y?v:new Ot(v.k,P,H)}function N(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function q(v,T,$,P){v.on("start.zoom",function(){U(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){U(this,arguments).event(P).end()}).tween("zoom",function(){var H=this,te=arguments,M=U(H,te).event(P),ee=t.apply(H,te),le=$==null?N(ee):typeof $=="function"?$.apply(H,te):$,me=Math.max(ee[1][0]-ee[0][0],ee[1][1]-ee[0][1]),ye=H.__zoom,ce=typeof T=="function"?T.apply(H,te):T,ue=c(ye.invert(le).concat(me/ye.k),ce.invert(le).concat(me/ce.k));return function(he){if(he===1)he=ce;else{var ve=ue(he),Se=me/ve[2];he=new Ot(Se,le[0]-ve[0]*Se,le[1]-ve[1]*Se)}M.zoom(null,he)}})}function U(v,T,$){return!$&&v.__zooming||new X(v,T)}function X(v,T){this.that=v,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,T),this.taps=0}X.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,T){return this.mouse&&v!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var T=Wt(this.that).datum();d.call(v,this.that,new DN(v,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),T)}};function K(v,...T){if(!e.apply(this,arguments))return;var $=U(this,T).event(v),P=this.__zoom,H=Math.max(l[0],Math.min(l[1],P.k*Math.pow(2,i.apply(this,arguments)))),te=Kt(v);if($.wheel)($.mouse[0][0]!==te[0]||$.mouse[0][1]!==te[1])&&($.mouse[1]=P.invert($.mouse[0]=te)),clearTimeout($.wheel);else{if(P.k===H)return;$.mouse=[te,P.invert(te)],ea(this),$.start()}Co(v),$.wheel=setTimeout(M,h),$.zoom("mouse",o(y(I(P,H),$.mouse[0],$.mouse[1]),$.extent,r));function M(){$.wheel=null,$.end()}}function W(v,...T){if(p||!e.apply(this,arguments))return;var $=v.currentTarget,P=U(this,T,!0).event(v),H=Wt(v.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),te=Kt(v,$),M=v.clientX,ee=v.clientY;Zk(v.view),Dl(v),P.mouse=[te,this.__zoom.invert(te)],ea(this),P.start();function le(ye){if(Co(ye),!P.moved){var ce=ye.clientX-M,ue=ye.clientY-ee;P.moved=ce*ce+ue*ue>_}P.event(ye).zoom("mouse",o(y(P.that.__zoom,P.mouse[0]=Kt(ye,$),P.mouse[1]),P.extent,r))}function me(ye){H.on("mousemove.zoom mouseup.zoom",null),Jk(ye.view,P.moved),Co(ye),P.event(ye).end()}}function ne(v,...T){if(e.apply(this,arguments)){var $=this.__zoom,P=Kt(v.changedTouches?v.changedTouches[0]:v,this),H=$.invert(P),te=$.k*(v.shiftKey?.5:2),M=o(y(I($,te),P,H),t.apply(this,T),r);Co(v),s>0?Wt(this).transition().duration(s).call(q,M,P,v):Wt(this).call(g.transform,M,P,v)}}function re(v,...T){if(e.apply(this,arguments)){var $=v.touches,P=$.length,H=U(this,T,v.changedTouches.length===P).event(v),te,M,ee,le;for(Dl(v),M=0;M<P;++M)ee=$[M],le=Kt(ee,this),le=[le,this.__zoom.invert(le),ee.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,te=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),te&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),ea(this),H.start())}}function L(v,...T){if(this.__zooming){var $=U(this,T).event(v),P=v.changedTouches,H=P.length,te,M,ee,le;for(Co(v),te=0;te<H;++te)M=P[te],ee=Kt(M,this),$.touch0&&$.touch0[2]===M.identifier?$.touch0[0]=ee:$.touch1&&$.touch1[2]===M.identifier&&($.touch1[0]=ee);if(M=$.that.__zoom,$.touch1){var me=$.touch0[0],ye=$.touch0[1],ce=$.touch1[0],ue=$.touch1[1],he=(he=ce[0]-me[0])*he+(he=ce[1]-me[1])*he,ve=(ve=ue[0]-ye[0])*ve+(ve=ue[1]-ye[1])*ve;M=I(M,Math.sqrt(he/ve)),ee=[(me[0]+ce[0])/2,(me[1]+ce[1])/2],le=[(ye[0]+ue[0])/2,(ye[1]+ue[1])/2]}else if($.touch0)ee=$.touch0[0],le=$.touch0[1];else return;$.zoom("touch",o(y(M,ee,le),$.extent,r))}}function Q(v,...T){if(this.__zooming){var $=U(this,T).event(v),P=v.changedTouches,H=P.length,te,M;for(Dl(v),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),te=0;te<H;++te)M=P[te],$.touch0&&$.touch0[2]===M.identifier?delete $.touch0:$.touch1&&$.touch1[2]===M.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(M=Kt(M,this),Math.hypot(f[0]-M[0],f[1]-M[1])<b)){var ee=Wt(this).on("dblclick.zoom");ee&&ee.apply(this,arguments)}}}return g.wheelDelta=function(v){return arguments.length?(i=typeof v=="function"?v:ta(+v),g):i},g.filter=function(v){return arguments.length?(e=typeof v=="function"?v:ta(!!v),g):e},g.touchable=function(v){return arguments.length?(a=typeof v=="function"?v:ta(!!v),g):a},g.extent=function(v){return arguments.length?(t=typeof v=="function"?v:ta([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),g):t},g.scaleExtent=function(v){return arguments.length?(l[0]=+v[0],l[1]=+v[1],g):[l[0],l[1]]},g.translateExtent=function(v){return arguments.length?(r[0][0]=+v[0][0],r[1][0]=+v[1][0],r[0][1]=+v[0][1],r[1][1]=+v[1][1],g):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},g.constrain=function(v){return arguments.length?(o=v,g):o},g.duration=function(v){return arguments.length?(s=+v,g):s},g.interpolate=function(v){return arguments.length?(c=v,g):c},g.on=function(){var v=d.on.apply(d,arguments);return v===d?g:v},g.clickDistance=function(v){return arguments.length?(_=(v=+v)*v,g):Math.sqrt(_)},g.tapDistance=function(v){return arguments.length?(b=+v,g):b},g}const Tu=Symbol("MiniMapSlots"),FN=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],GN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},YN=n.defineComponent({...GN,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(Tu),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,FN))],64)):n.createCommentVNode("",!0)}}),WN=["width","height","viewBox","aria-labelledby"],KN=["id"],qN=["d","fill","stroke","stroke-width"],XN={name:"MiniMap",compatConfig:{MODE:3}},jN=n.defineComponent({...XN,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,l=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:h}=Oe(),_=n.ref();n.provide(Tu,o);const b=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??a}),g=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??l}),I=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=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:()=>""),U=n.computed(()=>Za(h.value.filter(H=>!H.hidden))),X=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})),K=n.computed(()=>h.value&&h.value.length?Gg(U.value,X.value):X.value),W=n.computed(()=>{const H=K.value.width/b.value,te=K.value.height/g.value;return Math.max(H,te)}),ne=n.computed(()=>{const H=W.value*b.value,te=W.value*g.value,M=e.offsetScale*W.value;return{offset:M,x:K.value.x-(H-K.value.width)/2-M,y:K.value.y-(te-K.value.height)/2-M,width:H+M*2,height:te+M*2}}),re=n.computed(()=>!ne.value.x||!ne.value.y?"":`
|
|
29
|
+
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 Je extends Error{constructor(t,...o){var i;super((i=Jc[t])==null?void 0:i.call(Jc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function dl(e){return"clientX"in e}function wb(e){return"sourceEvent"in e}function xt(e,t){const o=dl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const wo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Eb(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 Ci(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const vb=()=>!0;function ul(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Nb(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())$i(a,Ni(l))>0&&i.push(l);return i}const $b=250;function xb(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Nb(e,o,t+$b);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:h,y:m}=Dn(d,f,f.position,!0),p=Math.sqrt((h-e.x)**2+(m-e.y)**2);p>t||(p<s?(r=[{...f,x:h,y:m}],s=p):p===s&&r.push({...f,x:h,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 Qc(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=vb},u,f,h,m){const p=l==="target",y=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:b,y:_}=xt(e),A=r.elementFromPoint(b,_),g=A!=null&&A.classList.contains(`${s}-flow__handle`)?A:y,N={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const te=ed(void 0,g),S=g.getAttribute("data-nodeid"),O=g.getAttribute("data-handleid"),z=g.classList.contains("connectable"),F=g.classList.contains("connectableend");if(!S||!te)return N;const ne={source:p?S:i,sourceHandle:p?O:a,target:p?i:S,targetHandle:p?a:O};N.connection=ne;const L=z&&F&&(o===Bt.Strict?p&&te==="source"||!p&&te==="target":S!==i||O!==a);N.isValid=L&&d(ne,{nodes:f,edges:u,sourceNode:h(ne.source),targetNode:h(ne.target)}),N.toHandle=td(S,te,O,m,o,!0)}return N}function ed(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ib(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Sb(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function td(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===Bt.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(h=>h.id===o):u==null?void 0:u[0])??null;return f&&l?{...f,...Dn(d,f,f.position,!0)}:f}const fl={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top},Cb=["production","prod"];function Eo(e,...t){nd()&&console.warn(`[Vue Flow]: ${e}`,...t)}function nd(){return!Cb.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,...xi(r)}}):null}function ml(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 Rb(e,t,o,i){if(!e||!e.source||!e.target)return o(new Je(qe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Gt(e)?a=e:a={...e,id:Dc(e)},a=Mc(a,void 0,i),db(a,t)?!1:a}function Vb(e,t,o,i,a){if(!t.source||!t.target)return a(new Je(qe.EDGE_INVALID,e.id)),!1;if(!o)return a(new Je(qe.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?Dc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function id(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!sn(r)){o(new Je(qe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=rb(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 Je(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 ad(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 pl(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}`;ad("source",c,u,e,a,r),ad("target",c,d,e,l,s)}}function ld(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function hl(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Gt(d)?d:Rb(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){a(new Je(qe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Je(qe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new Je(qe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Je(qe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Mc(u,m,l),sourceNode:f,targetNode:h})}return c}const rd=Symbol("vueFlow"),sd=Symbol("nodeId"),cd=Symbol("nodeRef"),Ab=Symbol("edgeId"),Tb=Symbol("edgeRef"),Ri=Symbol("slots");function dd(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:h,findNode:m,multiSelectionActive:p,nodesSelectionActive:y,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:A,updateNodePositions:g,emits:N}=Le(),{onStart:te,onDrag:S,onStop:O,onClick:z,el:F,disabled:ne,id:re,selectable:L,dragHandle:oe}=e,k=n.shallowRef(!1);let W=[],R,G=null,H={x:void 0,y:void 0},ae={x:0,y:0},v=null,q=!1,le=!1,me=0,he=!1;const se=Db(),ce=({x:X,y:K})=>{H={x:X,y:K};let w=!1;if(W=W.map(C=>{const V={x:X-C.distance.x,y:K-C.distance.y},{computedPosition:Y}=cl(C,o.value?Ci(V,i.value):V,N.error,r.value,C.parentNode?m(C.parentNode):void 0);return w=w||C.position.x!==Y.x||C.position.y!==Y.y,C.position=Y,C}),le=le||w,!!w&&(g(W,!0,!0),k.value=!0,v)){const[C,V]=sl({id:re,dragItems:W,findNode:m});S({event:v,node:C,nodes:V})}},ye=()=>{if(!G)return;const[X,K]=Fc(ae,G,u.value);if(X!==0||K!==0){const w={x:(H.x??0)-X/c.value.zoom,y:(H.y??0)-K/c.value.zoom};h({x:X,y:K})&&ce(w)}me=requestAnimationFrame(ye)},ke=(X,K)=>{q=!0;const w=m(re);!b.value&&!p.value&&w&&(w.selected||_()),w&&n.toValue(L)&&b.value&&ml(w,p.value,A,_,y,!1,K);const C=se(X.sourceEvent);if(H=C,W=hb(l.value,f.value,C,re),W.length){const[V,Y]=sl({id:re,dragItems:W,findNode:m});te({event:X.sourceEvent,node:V,nodes:Y})}},Re=(X,K)=>{var w;X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||(le=!1,s.value===0&&ke(X,K),H=se(X.sourceEvent),G=((w=t.value)==null?void 0:w.getBoundingClientRect())||null,ae=xt(X.sourceEvent,G))},xe=(X,K)=>{const w=se(X.sourceEvent);if(!he&&q&&d.value&&(he=!0,ye()),!q){const C=w.xSnapped-(H.x??0),V=w.ySnapped-(H.y??0);Math.sqrt(C*C+V*V)>s.value&&ke(X,K)}(H.x!==w.xSnapped||H.y!==w.ySnapped)&&W.length&&q&&(v=X.sourceEvent,ae=xt(X.sourceEvent,G),ce(w))},pe=X=>{let K=!1;if(!q&&!k.value&&!p.value){const w=X.sourceEvent,C=se(w),V=C.xSnapped-(H.x??0),Y=C.ySnapped-(H.y??0),J=Math.sqrt(V*V+Y*Y);J!==0&&J<=s.value&&(z==null||z(w),K=!0)}if(W.length&&!K){le&&(g(W,!1,!1),le=!1);const[w,C]=sl({id:re,dragItems:W,findNode:m});O({event:X.sourceEvent,node:w,nodes:C})}W=[],k.value=!1,he=!1,q=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(ne),F],([X,K],w,C)=>{if(K){const V=ht(K);X||(R=ly().on("start",Y=>Re(Y,K)).on("drag",Y=>xe(Y,K)).on("end",Y=>pe(Y)).filter(Y=>{const J=Y.target,ge=n.toValue(oe);return!Y.button&&(!a.value||!Xc(J,`.${a.value}`,K)&&(!ge||Xc(J,ge,K)))}),V.call(R)),C(()=>{V.on(".drag",null),R&&(R.on("start",null),R.on("drag",null),R.on("end",null))})}}),k}function Mb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function Bb(e,t){const o=Mb();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 Db(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Le();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=wb(a)?a.sourceEvent:a,{x:c,y:d}=xt(s,r),u=_o({x:c,y:d},e.value),{x:f,y:h}=o.value?Ci(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Vi(){return!0}function ud({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:h,nodesConnectable:m,autoPanOnConnect:p,autoPanSpeed:y,findNode:b,panBy:_,startConnection:A,updateConnection:g,endConnection:N,emits:te,viewport:S,edges:O,nodes:z,isValidConnection:F,nodeLookup:ne}=Le();let re=null,L=!1,oe=null;function k(R){var G;const H=n.toValue(o)==="target",ae=dl(R),v=Tc(R.target),q=R.currentTarget;if(q&&(ae&&R.button===0||!ae)){let le=function(_e){w=xt(_e,pe),ce=xb(_o(w,S.value,!1,[1,1]),u.value,ne.value,Y),C||(V(),C=!0);const Ce=Qc(_e,{handle:ce,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:se,doc:v,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value);oe=Ce.handleDomNode,re=Ce.connection,L=Sb(!!ce,Ce.isValid);const Te={...Ne,isValid:L,to:Ce.toHandle&&L?bo({x:Ce.toHandle.x,y:Ce.toHandle.y},S.value):w,toHandle:Ce.toHandle,toPosition:L&&Ce.toHandle?Ce.toHandle.position:fl[Y.position],toNode:Ce.toHandle?ne.value.get(Ce.toHandle.nodeId):null};if(L&&ce&&(Ne!=null&&Ne.toHandle)&&Te.toHandle&&Ne.toHandle.type===Te.toHandle.type&&Ne.toHandle.nodeId===Te.toHandle.nodeId&&Ne.toHandle.id===Te.toHandle.id&&Ne.to.x===Te.to.x&&Ne.to.y===Te.to.y)return;const De=ce??Ce.toHandle;if(g(De&&L?bo({x:De.x,y:De.y},S.value):w,De,Ib(!!De,L)),Ne=Te,!ce&&!L&&!oe)return ul(K);re&&re.source!==re.target&&oe&&(ul(K),K=oe,oe.classList.add("connecting","vue-flow__handle-connecting"),oe.classList.toggle("valid",!!L),oe.classList.toggle("vue-flow__handle-valid",!!L))},me=function(_e){"touches"in _e&&_e.touches.length>0||((ce||oe)&&re&&L&&(l?l(_e,re):te.connect(re)),te.connectEnd(_e),a&&(r==null||r(_e)),ul(K),cancelAnimationFrame(ye),N(_e),C=!1,L=!1,re=null,oe=null,v.removeEventListener("mousemove",le),v.removeEventListener("mouseup",me),v.removeEventListener("touchmove",le),v.removeEventListener("touchend",me))};const he=b(n.toValue(t));let se=n.toValue(i)||F.value||Vi;!se&&he&&(se=(H?he.isValidSourcePos:he.isValidTargetPos)||Vi);let ce,ye=0;const{x:ke,y:Re}=xt(R),xe=ed(n.toValue(a),q),pe=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!pe||!xe)return;const X=td(n.toValue(t),xe,n.toValue(e),ne.value,d.value);if(!X)return;let K,w=xt(R,pe),C=!1;const V=()=>{if(!p.value)return;const[_e,Ce]=Fc(w,pe,y.value);_({x:_e,y:Ce}),ye=requestAnimationFrame(V)},Y={...X,nodeId:n.toValue(t),type:xe,position:X.position},J=ne.value.get(n.toValue(t)),we={inProgress:!0,isValid:null,from:Dn(J,Y,Se.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:J,to:w,toHandle:null,toPosition:fl[Y.position],toNode:null};A({nodeId:n.toValue(t),id:n.toValue(e),type:xe,position:(q==null?void 0:q.getAttribute("data-handlepos"))||Se.Top,...w},{x:ke-pe.left,y:Re-pe.top}),te.connectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:xe});let Ne=we;v.addEventListener("mousemove",le),v.addEventListener("mouseup",me),v.addEventListener("touchmove",le),v.addEventListener("touchend",me)}}function W(R){var G,H;if(!f.value)return;const ae=n.toValue(o)==="target";if(!h.value){te.clickConnectStart({event:R,nodeId:n.toValue(t),handleId:n.toValue(e)}),A({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Se.Top,...xt(R)},void 0,!0);return}let v=n.toValue(i)||F.value||Vi;const q=b(n.toValue(t));if(!v&&q&&(v=(ae?q.isValidSourcePos:q.isValidTargetPos)||Vi),q&&(typeof q.connectable>"u"?m.value:q.connectable)===!1)return;const le=Tc(R.target),me=Qc(R,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Se.Top,...xt(R)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:v,doc:le,lib:"vue",flowId:s,nodeLookup:ne.value},O.value,z.value,b,ne.value),he=((G=me.connection)==null?void 0:G.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!he&&te.connect(me.connection),te.clickConnectEnd(R),N(R,!0)}return{handlePointerDown:k,handleClick:W}}function Ob(){return n.inject(sd,"")}function fd(e){const t=e??Ob()??"",o=n.inject(cd,n.ref(null)),{findNode:i,edges:a,emits:l}=Le(),r=i(t);return r||l.error(new Je(qe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>cn([r],a.value))}}function Lb(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function Pb(e,t){const o=Lb();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 md(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Le();return(c,d=!1)=>{const u=l.value?a.value[0]:5,f=l.value?a.value[1]:5,h=d?4:1,m=c.x*u*h,p=c.y*f*h,y=[];for(const b of e.value)if(b.draggable||r&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+m,y:b.computedPosition.y+p},{position:A}=cl(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);y.push({id:b.id,position:A,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(y,!0,!1)}}const Ai=.1,zb=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kt(){return Eo("Viewport not initialized yet."),Promise.resolve(!1)}const Ub={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 Hb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?so:pi).scaleBy(yl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{l(!0)}),i):l(!1)})}function o(i,a,l,r){return new Promise(s=>{var c;const{x:d,y:u}=Ac({x:-i,y:-a},e.translateExtent),f=Tn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?so:pi).transform(yl(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"?so:pi).scaleTo(yl(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:Ai,includeHiddenNodes:!1,duration:0})=>{var l,r;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((l=a.nodes)!=null&&l.length)||(r=a.nodes)!=null&&r.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=al(s),{x:d,y:u,zoom:f}=zc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ai);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:Ai})=>{const{x:r,y:s,zoom:c}=zc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??Ai);return o(r,s,c,l)},project:a=>_o(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 _o(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 bo(s,e.viewport)}return{x:0,y:0}}}:Ub)}function yl(e,t=0,o=zb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function Fb(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let y,b,_=!!(o.nodes.value.length||o.edges.value.length);y=Sn([e.modelValue,()=>{var A,g;return(g=(A=e.modelValue)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setElements(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([A,g])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(y==null||y.pause(),e.modelValue.value=[...A,...g],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let y,b,_=!!o.nodes.value.length;y=Sn([e.nodes,()=>{var A,g;return(g=(A=e.nodes)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setNodes(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.nodes,()=>o.nodes.value.length],([A])=>{var g;(g=e.nodes)!=null&&g.value&&Array.isArray(e.nodes.value)&&(y==null||y.pause(),e.nodes.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let y,b,_=!!o.edges.value.length;y=Sn([e.edges,()=>{var A,g;return(g=(A=e.edges)==null?void 0:A.value)==null?void 0:g.length}],([A])=>{A&&Array.isArray(A)&&(b==null||b.pause(),o.setEdges(A),!b&&!_&&A.length?_=!0:b==null||b.resume())}),b=Sn([o.edges,()=>o.edges.value.length],([A])=>{var g;(g=e.edges)!=null&&g.value&&Array.isArray(e.edges.value)&&(y==null||y.pause(),e.edges.value=[...A],n.nextTick(()=>{y==null||y.resume()}))},{immediate:_}),n.onScopeDispose(()=>{y==null||y.stop(),b==null||b.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})})},h=()=>{i.run(()=>{const y=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{Xe(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,A)=>{b?o.onConnect(y):o.hooks.value.connect.off(y),A(()=>{o.hooks.value.connect.off(y)})},{immediate:!0})})},m=()=>{const y=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!y.includes(_)){const A=n.toRef(()=>t[_]),g=o[_];n.isRef(g)&&i.run(()=>{n.watch(A,N=>{Xe(N)&&(g.value=N)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function Gb(){return{edgesChange:$e(),nodesChange:$e(),nodeDoubleClick:$e(),nodeClick:$e(),nodeMouseEnter:$e(),nodeMouseMove:$e(),nodeMouseLeave:$e(),nodeContextMenu:$e(),nodeDragStart:$e(),nodeDrag:$e(),nodeDragStop:$e(),nodesInitialized:$e(),miniMapNodeClick:$e(),miniMapNodeDoubleClick:$e(),miniMapNodeMouseEnter:$e(),miniMapNodeMouseMove:$e(),miniMapNodeMouseLeave:$e(),connect:$e(),connectStart:$e(),connectEnd:$e(),clickConnectStart:$e(),clickConnectEnd:$e(),paneReady:$e(),init:$e(),move:$e(),moveStart:$e(),moveEnd:$e(),selectionDragStart:$e(),selectionDrag:$e(),selectionDragStop:$e(),selectionContextMenu:$e(),selectionStart:$e(),selectionEnd:$e(),viewportChangeStart:$e(),viewportChange:$e(),viewportChangeEnd:$e(),paneScroll:$e(),paneClick:$e(),paneContextMenu:$e(),paneMouseEnter:$e(),paneMouseMove:$e(),paneMouseLeave:$e(),edgeContextMenu:$e(),edgeMouseEnter:$e(),edgeMouseMove:$e(),edgeMouseLeave:$e(),edgeDoubleClick:$e(),edgeClick:$e(),edgeUpdateStart:$e(),edgeUpdate:$e(),edgeUpdateEnd:$e(),updateNodeInternals:$e(),error:$e(e=>Eo(e.message))}}function Yb(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),no(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),no(l.removeHasEmitListeners)}});function i(a){var l;const r=Wb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function Wb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function pd(){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:nl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ho.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:ln.Bezier,style:{}},connectionMode:Bt.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:wo()?"Meta":"Control",zoomActivationKeyCode:wo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Gb(),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 Kb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function qb(e,t,o){const i=Hb(e),a=w=>{const C=w??[];e.hooks.updateNodeInternals.trigger(C)},l=w=>cb(w,e.nodes,e.edges),r=w=>sb(w,e.nodes,e.edges),s=w=>cn(w,e.edges),c=({id:w,type:C,nodeId:V})=>{var Y;const J=w?`-${C}-${w}`:`-${C}`;return Array.from(((Y=e.connectionLookup.get(`${V}${J}`))==null?void 0:Y.values())??[])},d=w=>{if(w)return t.value.get(w)},u=w=>{if(w)return o.value.get(w)},f=(w,C,V)=>{var Y,J;const ge=[];for(const we of w){const Ne={id:we.id,type:"position",dragging:V,from:we.from};if(C&&(Ne.position=we.position,we.parentNode)){const _e=d(we.parentNode);Ne.position={x:Ne.position.x-(((Y=_e==null?void 0:_e.computedPosition)==null?void 0:Y.x)??0),y:Ne.position.y-(((J=_e==null?void 0:_e.computedPosition)==null?void 0:J.y)??0)}}ge.push(Ne)}ge!=null&&ge.length&&e.hooks.nodesChange.trigger(ge)},h=w=>{if(!e.vueFlowRef)return;const C=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!C)return;const V=window.getComputedStyle(C),{m22:Y}=new window.DOMMatrixReadOnly(V.transform),J=[];for(const ge of w){const we=ge,Ne=d(we.id);if(Ne){const _e=xi(we.nodeElement);if(!!(_e.width&&_e.height&&(Ne.dimensions.width!==_e.width||Ne.dimensions.height!==_e.height||we.forceUpdate))){const Te=we.nodeElement.getBoundingClientRect();Ne.dimensions=_e,Ne.handleBounds.source=od("source",we.nodeElement,Te,Y,Ne.id),Ne.handleBounds.target=od("target",we.nodeElement,Te,Y,Ne.id),J.push({id:Ne.id,type:"dimensions",dimensions:_e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),J.length&&e.hooks.nodesChange.trigger(J)},m=(w,C)=>{const V=new Set,Y=new Set;for(const we of w)sn(we)?V.add(we.id):Gt(we)&&Y.add(we.id);const J=Wt(t.value,V,!0),ge=Wt(o.value,Y);if(e.multiSelectionActive){for(const we of V)J.push(Yt(we,C));for(const we of Y)ge.push(Yt(we,C))}J.length&&e.hooks.nodesChange.trigger(J),ge.length&&e.hooks.edgesChange.trigger(ge)},p=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.nodesChange.trigger(C);return}e.hooks.nodesChange.trigger(Wt(t.value,new Set(w.map(C=>C.id)),!0)),e.hooks.edgesChange.trigger(Wt(o.value))},y=w=>{if(e.multiSelectionActive){const C=w.map(V=>Yt(V.id,!0));e.hooks.edgesChange.trigger(C);return}e.hooks.edgesChange.trigger(Wt(o.value,new Set(w.map(C=>C.id)))),e.hooks.nodesChange.trigger(Wt(t.value,new Set,!0))},b=w=>{m(w,!0)},_=w=>{const V=(w||e.nodes).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.nodesChange.trigger(V)},A=w=>{const V=(w||e.edges).map(Y=>(Y.selected=!1,Yt(Y.id,!1)));e.hooks.edgesChange.trigger(V)},g=w=>{if(!w||!w.length)return m([],!1);const C=w.reduce((V,Y)=>{const J=Yt(Y.id,!1);return sn(Y)?V.nodes.push(J):V.edges.push(J),V},{nodes:[],edges:[]});C.nodes.length&&e.hooks.nodesChange.trigger(C.nodes),C.edges.length&&e.hooks.edgesChange.trigger(C.edges)},N=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([w,e.maxZoom]),e.minZoom=w},te=w=>{var C;(C=e.d3Zoom)==null||C.scaleExtent([e.minZoom,w]),e.maxZoom=w},S=w=>{var C;(C=e.d3Zoom)==null||C.translateExtent(w),e.translateExtent=w},O=w=>{e.nodeExtent=w,a()},z=w=>{var C;(C=e.d3Zoom)==null||C.clickDistance(w)},F=w=>{e.nodesDraggable=w,e.nodesConnectable=w,e.elementsSelectable=w},ne=w=>{const C=w instanceof Function?w(e.nodes):w;!e.initialized&&!C.length||(e.nodes=id(C,d,e.hooks.error.trigger))},re=w=>{const C=w instanceof Function?w(e.edges):w;if(!e.initialized&&!C.length)return;const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);pl(e.connectionLookup,o.value,V),e.edges=V},L=w=>{const C=w instanceof Function?w([...e.nodes,...e.edges]):w;!e.initialized&&!C.length||(ne(C.filter(sn)),re(C.filter(Gt)))},oe=w=>{let C=w instanceof Function?w(e.nodes):w;C=Array.isArray(C)?C:[C];const V=id(C,d,e.hooks.error.trigger),Y=[];for(const J of V)Y.push(Yc(J));Y.length&&e.hooks.nodesChange.trigger(Y)},k=w=>{let C=w instanceof Function?w(e.edges):w;C=Array.isArray(C)?C:[C];const V=hl(C,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Y=[];for(const J of V)Y.push(Yc(J));Y.length&&e.hooks.edgesChange.trigger(Y)},W=(w,C=!0,V=!1)=>{const Y=w instanceof Function?w(e.nodes):w,J=Array.isArray(Y)?Y:[Y],ge=[],we=[];function Ne(Ce){const Te=s(Ce);for(const De of Te)(!Xe(De.deletable)||De.deletable)&&we.push(Kc(De.id,De.source,De.target,De.sourceHandle,De.targetHandle))}function _e(Ce){const Te=[];for(const De of e.nodes)De.parentNode===Ce&&Te.push(De);if(Te.length){for(const De of Te)ge.push(Wc(De.id));C&&Ne(Te);for(const De of Te)_e(De.id)}}for(const Ce of J){const Te=typeof Ce=="string"?d(Ce):Ce;Te&&(Xe(Te.deletable)&&!Te.deletable||(ge.push(Wc(Te.id)),C&&Ne([Te]),V&&_e(Te.id)))}we.length&&e.hooks.edgesChange.trigger(we),ge.length&&e.hooks.nodesChange.trigger(ge)},R=w=>{const C=w instanceof Function?w(e.edges):w,V=Array.isArray(C)?C:[C],Y=[];for(const J of V){const ge=typeof J=="string"?u(J):J;ge&&(Xe(ge.deletable)&&!ge.deletable||Y.push(Kc(typeof J=="string"?J:J.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle)))}e.hooks.edgesChange.trigger(Y)},G=(w,C,V=!0)=>{const Y=u(w.id);if(!Y)return!1;const J=e.edges.indexOf(Y),ge=Vb(w,C,Y,V,e.hooks.error.trigger);if(ge){const[we]=hl([ge],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ne,_e)=>_e===J?we:Ne),pl(e.connectionLookup,o.value,[we]),we}return!1},H=(w,C,V={replace:!1})=>{const Y=u(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},ae=w=>Gc(w,e.nodes),v=w=>{const C=Gc(w,e.edges);return pl(e.connectionLookup,o.value,C),C},q=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;V.replace?e.nodes.splice(e.nodes.indexOf(Y),1,J):Object.assign(Y,J)},le=(w,C,V={replace:!1})=>{const Y=d(w);if(!Y)return;const J=typeof C=="function"?C(Y):C;Y.data=V.replace?J:{...Y.data,...J}},me=(w,C,V=!1)=>{V?e.connectionClickStartHandle=w:e.connectionStartHandle=w,e.connectionEndHandle=null,e.connectionStatus=null,C&&(e.connectionPosition=C)},he=(w,C=null,V=null)=>{e.connectionStartHandle&&(e.connectionPosition=w,e.connectionEndHandle=C,e.connectionStatus=V)},se=(w,C)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,C?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ce=w=>{const C=lb(w),V=C?null:go(w)?w:d(w.id);return!C&&!V?[null,null,C]:[C?w:Ni(V),V,C]},ye=(w,C=!0,V=e.nodes)=>{const[Y,J,ge]=ce(w);if(!Y)return[];const we=[];for(const Ne of V||e.nodes){if(!ge&&(Ne.id===J.id||!Ne.computedPosition))continue;const _e=Ni(Ne),Ce=$i(_e,Y);(C&&Ce>0||Ce>=_e.width*_e.height||Ce>=Number(Y.width)*Number(Y.height))&&we.push(Ne)}return we},ke=(w,C,V=!0)=>{const[Y]=ce(w);if(!Y)return!1;const J=$i(Y,C);return V&&J>0||J>=Number(Y.width)*Number(Y.height)},Re=w=>{const{viewport:C,dimensions:V,d3Zoom:Y,d3Selection:J,translateExtent:ge}=e;if(!Y||!J||!w.x&&!w.y)return!1;const we=Tn.translate(C.x+w.x,C.y+w.y).scale(C.zoom),Ne=[[0,0],[V.width,V.height]],_e=Y.constrain()(we,Ne,ge),Ce=e.viewport.x!==_e.x||e.viewport.y!==_e.y||e.viewport.zoom!==_e.k;return Y.transform(J,_e),Ce},xe=w=>{const C=w instanceof Function?w(e):w,V=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Xe(C.defaultEdgeOptions)&&(e.defaultEdgeOptions=C.defaultEdgeOptions);const Y=C.modelValue||C.nodes||C.edges?[]:void 0;Y&&(C.modelValue&&Y.push(...C.modelValue),C.nodes&&Y.push(...C.nodes),C.edges&&Y.push(...C.edges),L(Y));const J=()=>{Xe(C.maxZoom)&&te(C.maxZoom),Xe(C.minZoom)&&N(C.minZoom),Xe(C.translateExtent)&&S(C.translateExtent)};for(const ge of Object.keys(C)){const we=ge,Ne=C[we];![...Kb,...V].includes(we)&&Xe(Ne)&&(e[we]=Ne)}Ba(()=>e.d3Zoom).not.toBeNull().then(J),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:L,setNodes:ne,setEdges:re,addNodes:oe,addEdges:k,removeNodes:W,removeEdges:R,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:H,updateNode:q,updateNodeData:le,applyEdgeChanges:v,applyNodeChanges:ae,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:y,setMinZoom:N,setMaxZoom:te,setTranslateExtent:S,setNodeExtent:O,setPaneClickDistance:z,removeSelectedElements:g,removeSelectedNodes:_,removeSelectedEdges:A,startConnection:me,updateConnection:he,endConnection:se,setInteractive:F,setState:xe,getIntersectingNodes:ye,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:ke,panBy:Re,fitView:w=>i.value.fitView(w),zoomIn:w=>i.value.zoomIn(w),zoomOut:w=>i.value.zoomOut(w),zoomTo:(w,C)=>i.value.zoomTo(w,C),setViewport:(w,C)=>i.value.setViewport(w,C),setTransform:(w,C)=>i.value.setTransform(w,C),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(w,C,V)=>i.value.setCenter(w,C,V),fitBounds:(w,C)=>i.value.fitBounds(w,C),project:w=>i.value.project(w),screenToFlowCoordinate:w=>i.value.screenToFlowCoordinate(w),flowToScreenCoordinate:w=>i.value.flowToScreenCoordinate(w),toObject:()=>{const w=[],C=[];for(const V of e.nodes){const{computedPosition:Y,handleBounds:J,selected:ge,dimensions:we,isParent:Ne,resizing:_e,dragging:Ce,events:Te,...De}=V;w.push(De)}for(const V of e.edges){const{selected:Y,sourceNode:J,targetNode:ge,events:we,...Ne}=V;C.push(Ne)}return JSON.parse(JSON.stringify({nodes:w,edges:C,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:w=>new Promise(C=>{const{nodes:V,edges:Y,position:J,zoom:ge,viewport:we}=w;V&&ne(V),Y&&re(Y);const[Ne,_e]=we!=null&&we.x&&(we!=null&&we.y)?[we.x,we.y]:J??[null,null];if(Ne&&_e){const Ce=(we==null?void 0:we.zoom)||ge||e.viewport.zoom;return Ba(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ne,y:_e,zoom:Ce}).then(()=>{C(!0)})})}else C(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const w=pd();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const C=Tn.translate(w.defaultViewport.x??0,w.defaultViewport.y??0).scale(rn(w.defaultViewport.zoom??1,w.minZoom,w.maxZoom)),V=e.viewportRef.getBoundingClientRect(),Y=[[0,0],[V.width,V.height]],J=e.d3Zoom.constrain()(C,Y,w.translateExtent);e.d3Zoom.transform(e.d3Selection,J)}xe(w)},$destroy:()=>{}}}const Xb=["data-id","data-handleid","data-nodeid","data-handlepos"],jb={name:"Handle",compatConfig:{MODE:3}},dn=n.defineComponent({...jb,props:{id:{default:null},type:{},position:{default:()=>Se.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:h}=Le(),{id:m,node:p,nodeEl:y,connectedEdges:b}=fd(),_=n.ref(),A=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=n.toRef(()=>{var re,L,oe,k,W,R;return((re=r.value)==null?void 0:re.nodeId)===m&&((L=r.value)==null?void 0:L.id)===e.id&&((oe=r.value)==null?void 0:oe.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===m&&((W=c.value)==null?void 0:W.id)===e.id&&((R=c.value)==null?void 0:R.type)===i.value}),te=n.toRef(()=>{var re,L,oe;return((re=s.value)==null?void 0:re.nodeId)===m&&((L=s.value)==null?void 0:L.id)===e.id&&((oe=s.value)==null?void 0:oe.type)===i.value}),{handlePointerDown:S,handleClick:O}=ud({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),z=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}):typeof e.connectable=="number"?b.value.filter(re=>{const L=re[`${i.value}Handle`];return re[i.value]!==m?!1:L?L===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):Xe(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var re;if(!p.dimensions.width||!p.dimensions.height)return;const L=(re=p.handleBounds[i.value])==null?void 0:re.find(ae=>ae.id===e.id);if(!d.value||L)return;const oe=d.value.querySelector(".vue-flow__transformationpane");if(!y.value||!_.value||!oe||!e.id)return;const k=y.value.getBoundingClientRect(),W=_.value.getBoundingClientRect(),R=window.getComputedStyle(oe),{m22:G}=new window.DOMMatrixReadOnly(R.transform),H={id:e.id,position:e.position,x:(W.left-k.left)/G,y:(W.top-k.top)/G,type:i.value,nodeId:m,...xi(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],H]});function F(re){const L=dl(re);z.value&&A.value&&(L&&re.button===0||!L)&&S(re)}function ne(re){!m||!s.value&&!A.value||z.value&&O(re)}return t({handleClick:O,handlePointerDown:S,onClick:ne,onPointerDown:F}),(re,L)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${n.unref(l)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":re.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${re.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:z.value,connecting:te.value,connectablestart:A.value,connectableend:g.value,connectionindicator:z.value&&(A.value&&!N.value||g.value&&N.value)}]]),onMousedown:F,onTouchstartPassive:F,onClick:ne},[n.renderSlot(re.$slots,"default",{id:re.id})],42,Xb))}}),Ti=function({sourcePosition:e=Se.Bottom,targetPosition:t=Se.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(dn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(dn,{type:"source",position:e,connectable:i,isValidConnection:l})]};Ti.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ti.inheritAttrs=!1,Ti.compatConfig={MODE:3};const Zb=Ti,Mi=function({targetPosition:e=Se.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(dn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Mi.props=["targetPosition","label","isValidTargetPos","connectable","data"],Mi.inheritAttrs=!1,Mi.compatConfig={MODE:3};const Jb=Mi,Bi=function({sourcePosition:e=Se.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(dn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Bi.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Bi.inheritAttrs=!1,Bi.compatConfig={MODE:3};const Qb=Bi,e0=["transform"],t0=["width","height","x","y","rx","ry"],n0=["y"],o0={name:"EdgeText",compatConfig:{MODE:3}},i0=n.defineComponent({...o0,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,t0)):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,n0)],8,e0))}}),a0=["id","d","marker-end","marker-start"],l0=["d","stroke-width"],r0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Di=n.defineComponent({...r0,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,a0),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,l0)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(i0,{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 hd({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 yd({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 Oi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function gd({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Se.Left:r=t-Oi(t-i,l),s=o;break;case Se.Right:r=t+Oi(i-t,l),s=o;break;case Se.Top:r=t,s=o-Oi(o-a,l);break;case Se.Bottom:r=t,s=o+Oi(a-o,l);break}return[r,s]}function bd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,curvature:s=.25}=e,[c,d]=gd({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=gd({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,y]=yd({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}`,h,m,p,y]}function _d({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Se.Left:case Se.Right:l=.5*(t+i),r=o;break;case Se.Top:case Se.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function kd(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top}=e,[s,c]=_d({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=_d({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=yd({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,h,m,p]}const wd={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}};function s0({source:e,sourcePosition:t=Se.Bottom,target:o}){return t===Se.Left||t===Se.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 Ed(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function c0({source:e,sourcePosition:t=Se.Bottom,target:o,targetPosition:i=Se.Top,center:a,offset:l}){const r=wd[t],s=wd[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=s0({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,y;const b={x:0,y:0},_={x:0,y:0},[A,g,N,te]=hd({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??A,y=a.y??g;const O=[{x:p,y:c.y},{x:p,y:d.y}],z=[{x:c.x,y},{x:d.x,y}];r[f]===h?m=f==="x"?O:z:m=f==="x"?z:O}else{const O=[{x:c.x,y:d.y}],z=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?z:O:m=r.y===h?O:z,t===i){const oe=Math.abs(e[f]-o[f]);if(oe<=l){const k=Math.min(l-1,l-oe);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*k:_[f]=(d[f]>o[f]?-1:1)*k}}if(t!==i){const oe=f==="x"?"y":"x",k=r[f]===s[oe],W=c[oe]>d[oe],R=c[oe]<d[oe];(r[f]===1&&(!k&&W||k&&R)||r[f]!==1&&(!k&&R||k&&W))&&(m=f==="x"?O:z)}const F={x:c.x+b.x,y:c.y+b.y},ne={x:d.x+_.x,y:d.y+_.y},re=Math.max(Math.abs(F.x-m[0].x),Math.abs(ne.x-m[0].x)),L=Math.max(Math.abs(F.y-m[0].y),Math.abs(ne.y-m[0].y));re>=L?(p=(F.x+ne.x)/2,y=m[0].y):(p=m[0].x,y=(F.y+ne.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...m,{x:d.x+_.x,y:d.y+_.y},o],p,y,N,te]}function d0(e,t,o,i){const a=Math.min(Ed(e,t)/2,Ed(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 gl(e){const{sourceX:t,sourceY:o,sourcePosition:i=Se.Bottom,targetX:a,targetY:l,targetPosition:r=Se.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,y]=c0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,A,g)=>{let N;return g>0&&g<f.length-1?N=d0(f[g-1],A,f[g+1],s):N=`${g===0?"M":"L"}${A.x} ${A.y}`,_+=N,_},""),h,m,p,y]}function u0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=hd({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const f0=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]=u0(e);return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),vd=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]=gl({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),m0=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(vd,{...e,...t,borderRadius:0})}}),p0=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]=bd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),h0=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]=kd({...e,sourcePosition:e.sourcePosition??Se.Bottom,targetPosition:e.targetPosition??Se.Top});return n.h(Di,{path:o,labelX:i,labelY:a,...t,...e})}}}),y0={input:Qb,default:Zb,output:Jb},g0={default:p0,straight:f0,step:m0,smoothstep:vd,simplebezier:h0};function b0(e,t,o){const i=n.computed(()=>y=>t.value.get(y)),a=n.computed(()=>y=>o.value.get(y)),l=n.computed(()=>{const y={...g0,...e.edgeTypes},b=Object.keys(y);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),r=n.computed(()=>{const y={...y0,...e.nodeTypes},b=Object.keys(y);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(y[_.type]=_.type);return y}),s=n.computed(()=>e.onlyRenderVisibleElements?Pc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const y=[];for(const b of e.edges){const _=t.value.get(b.source),A=t.value.get(b.target);_b({sourcePos:_.computedPosition||{x:0,y:0},targetPos:A.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:A.dimensions.width,targetHeight:A.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&y.push(b)}return y}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const y=[];for(const b of e.nodes)b.selected&&y.push(b);return y}),f=n.computed(()=>{const y=[];for(const b of e.edges)b.selected&&y.push(b);return y}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const y=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&y.push(b);return y}),p=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:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:p}}class un{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)??un.instance;return un.instance=i??new un,o&&(o.config.globalProperties.$vueFlowStorage=un.instance),un.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=pd(),a=n.reactive(i),l={};for(const[h,m]of Object.entries(a.hooks)){const p=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;l[p]=m.on}const r={};for(const[h,m]of Object.entries(a.hooks))r[h]=m.trigger;const s=n.computed(()=>{const h=new Map;for(const m of a.nodes)h.set(m.id,m);return h}),c=n.computed(()=>{const h=new Map;for(const m of a.edges)h.set(m.id,m);return h}),d=b0(a,s,c),u=qb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...hp(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 Le(e){const t=un.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(rd,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,h,m)=>{const p=b=>{d.applyNodeChanges(b)},y=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(y)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(y)})},{immediate:!0}),no(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Eo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(rd,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Je(qe.USEVUEFLOW_OPTIONS))}return s}function _0(e){const{emits:t,dimensions:o}=Le();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=xi(e.value);(s.width===0||s.height===0)&&t.error(new Je(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 k0={name:"UserSelection",compatConfig:{MODE:3}},w0=n.defineComponent({...k0,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))}}),E0=["tabIndex"],v0={name:"NodesSelection",compatConfig:{MODE:3}},N0=n.defineComponent({...v0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Le(),s=md(),c=n.ref(null),d=dd({el:c,onStart(p){t.selectionDragStart(p),t.nodeDragStart(p)},onDrag(p){t.selectionDrag(p),t.nodeDrag(p)},onStop(p){t.selectionDragStop(p),t.nodeDragStop(p)}});n.onMounted(()=>{var p;l.value||(p=c.value)==null||p.focus({preventScroll:!0})});const u=n.computed(()=>al(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 h(p){t.selectionContextMenu({event:p,nodes:i.value})}function m(p){l.value||Mn[p.key]&&(p.preventDefault(),s({x:Mn[p.key].x,y:Mn[p.key].y},p.shiftKey))}return(p,y)=>!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:h,onKeydown:m},null,46,E0)],6)):n.createCommentVNode("",!0)}});function $0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const x0={name:"Pane",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,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:h,removeEdges:m,selectionMode:p,deleteKeyCode:y,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:A,nodeLookup:g,connectionLookup:N,defaultEdgeOptions:te,connectionStartHandle:S,panOnDrag:O}=Le(),z=n.shallowRef(null),F=n.shallowRef(new Set),ne=n.shallowRef(new Set),re=n.shallowRef(null),L=n.toRef(()=>c.value&&(e.isSelecting||l.value)),oe=n.toRef(()=>S.value!==null);let k=!1,W=!1;const R=yo(y,{actInsideInputWithModifier:!1}),G=yo(b);n.watch(R,se=>{se&&(h(f.value),m(u.value),d.value=!1)}),n.watch(G,se=>{_.value=se});function H(se,ce){return ye=>{ye.target===ce&&(se==null||se(ye))}}function ae(se){if(k||oe.value){k=!1;return}a.paneClick(se),r(),d.value=!1}function v(se){var ce;if(Array.isArray(O.value)&&((ce=O.value)!=null&&ce.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function q(se){a.paneScroll(se)}function le(se){var ce,ye,ke;if(re.value=((ce=t.value)==null?void 0:ce.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==z.value||!re.value)return;(ke=(ye=se.target)==null?void 0:ye.setPointerCapture)==null||ke.call(ye,se.pointerId);const{x:Re,y:xe}=$0(se,re.value);W=!0,k=!1,r(),s.value={width:0,height:0,startX:Re,startY:xe,x:Re,y:xe},a.selectionStart(se)}function me(se){var ce;if(!re.value||!s.value)return;k=!0;const{x:ye,y:ke}=xt(se,re.value),{startX:Re=0,startY:xe=0}=s.value,pe={startX:Re,startY:xe,x:ye<Re?ye:Re,y:ke<xe?ke:xe,width:Math.abs(ye-Re),height:Math.abs(ke-xe)},X=F.value,K=ne.value;F.value=new Set(Pc(o.value,pe,i.value,p.value===nl.Partial,!0).map(C=>C.id)),ne.value=new Set;const w=((ce=te.value)==null?void 0:ce.selectable)??!0;for(const C of F.value){const V=N.value.get(C);if(V)for(const{edgeId:Y}of V.values()){const J=A.value.get(Y);J&&(J.selectable??w)&&ne.value.add(Y)}}if(!ld(X,F.value)){const C=Wt(g.value,F.value,!0);a.nodesChange(C)}if(!ld(K,ne.value)){const C=Wt(A.value,ne.value);a.edgesChange(C)}s.value=pe,l.value=!0,d.value=!1}function he(se){var ce;se.button!==0||!W||((ce=se.target)==null||ce.releasePointerCapture(se.pointerId),!l.value&&s.value&&se.target===z.value&&ae(se),l.value=!1,s.value=null,d.value=F.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(k=!1),W=!1)}return(se,ce)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:z,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:ce[0]||(ce[0]=ye=>L.value?void 0:H(ae,z.value)(ye)),onContextmenu:ce[1]||(ce[1]=ye=>H(v,z.value)(ye)),onWheelPassive:ce[2]||(ce[2]=ye=>H(q,z.value)(ye)),onPointerenter:ce[3]||(ce[3]=ye=>L.value?void 0:n.unref(a).paneMouseEnter(ye)),onPointerdown:ce[4]||(ce[4]=ye=>L.value?le(ye):n.unref(a).paneMouseMove(ye)),onPointermove:ce[5]||(ce[5]=ye=>L.value?me(ye):n.unref(a).paneMouseMove(ye)),onPointerup:ce[6]||(ce[6]=ye=>L.value?he(ye):void 0),onPointerleave:ce[7]||(ce[7]=ye=>n.unref(a).paneMouseLeave(ye))},[n.renderSlot(se.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(w0,{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(N0,{key:1})):n.createCommentVNode("",!0)],34))}}),S0={name:"Transform",compatConfig:{MODE:3}},C0=n.defineComponent({...S0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Le(),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))}}),R0={name:"Viewport",compatConfig:{MODE:3}},V0=n.defineComponent({...R0,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:h,zoomOnPinch:m,zoomOnScroll:p,preventScrolling:y,noWheelClassName:b,noPanClassName:_,emits:A,connectionStartHandle:g,userSelectionActive:N,paneDragging:te,d3Zoom:S,d3Selection:O,d3ZoomHandler:z,viewport:F,viewportRef:ne,paneClickDistance:re}=Le();_0(ne);const L=n.shallowRef(!1),oe=n.shallowRef(!1);let k=null,W=!1,R=0,G={x:0,y:0,zoom:0};const H=yo(s),ae=yo(r),v=yo(l),q=n.toRef(()=>(!ae.value||ae.value&&r.value===!0)&&(H.value||f.value)),le=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&q.value!==!0),he=n.toRef(()=>ae.value&&r.value!==!0||N.value||me.value),se=n.toRef(()=>g.value!==null);n.onMounted(()=>{if(!ne.value){Eo("Viewport element is missing");return}const xe=ne.value,pe=xe.getBoundingClientRect(),X=Qg().clickDistance(re.value).scaleExtent([t.value,o.value]).translateExtent(a.value),K=ht(xe).call(X),w=K.on("wheel.zoom"),C=Tn.translate(i.value.x??0,i.value.y??0).scale(rn(i.value.zoom??1,t.value,o.value)),V=[[0,0],[pe.width,pe.height]],Y=X.constrain()(C,V,a.value);X.transform(K,Y),X.wheelDelta(ll),S.value=X,O.value=K,z.value=w,F.value={x:Y.x,y:Y.y,zoom:Y.k},X.on("start",J=>{var ge;if(!J.sourceEvent)return null;R=J.sourceEvent.button,L.value=!0;const we=ke(J.transform);((ge=J.sourceEvent)==null?void 0:ge.type)==="mousedown"&&(te.value=!0),G=we,A.viewportChangeStart(we),A.moveStart({event:J,flowTransform:we})}),X.on("end",J=>{if(!J.sourceEvent)return null;if(L.value=!1,te.value=!1,ce(q.value,R??0)&&!W&&A.paneContextMenu(J.sourceEvent),W=!1,ye(G,J.transform)){const ge=ke(J.transform);G=ge,A.viewportChangeEnd(ge),A.moveEnd({event:J,flowTransform:ge})}}),X.filter(J=>{var ge;const we=v.value||p.value,Ne=m.value&&J.ctrlKey,_e=J.button,Ce=J.type==="wheel";if(_e===1&&J.type==="mousedown"&&(Re(J,"vue-flow__node")||Re(J,"vue-flow__edge")))return!0;if(!q.value&&!we&&!le.value&&!h.value&&!m.value||N.value||se.value&&!Ce||!h.value&&J.type==="dblclick"||Re(J,b.value)&&Ce||Re(J,_.value)&&(!Ce||le.value&&Ce&&!v.value)||!m.value&&J.ctrlKey&&Ce||!we&&!le.value&&!Ne&&Ce)return!1;if(!m&&J.type==="touchstart"&&((ge=J.touches)==null?void 0:ge.length)>1)return J.preventDefault(),!1;if(!q.value&&(J.type==="mousedown"||J.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&_e===0||Array.isArray(f.value)&&!f.value.includes(_e)&&(J.type==="mousedown"||J.type==="touchstart"))return!1;const Te=Array.isArray(f.value)&&f.value.includes(_e)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!_e||_e<=1;return(!J.ctrlKey||H.value||Ce)&&Te}),n.watch([N,q],()=>{N.value&&!L.value?X.on("zoom",null):N.value||X.on("zoom",J=>{F.value={x:J.transform.x,y:J.transform.y,zoom:J.transform.k};const ge=ke(J.transform);W=ce(q.value,R??0),A.viewportChange(ge),A.move({event:J,flowTransform:ge})})},{immediate:!0}),n.watch([N,le,d,v,m,y,b],()=>{le.value&&!v.value&&!N.value?K.on("wheel.zoom",J=>{if(Re(J,b.value))return!1;const ge=v.value||p.value,we=m.value&&J.ctrlKey;if(!(!y.value||le.value||ge||we))return!1;J.preventDefault(),J.stopImmediatePropagation();const _e=K.property("__zoom").k||1,Ce=wo();if(!H.value&&J.ctrlKey&&m.value&&Ce){const I=Et(J),M=ll(J),B=_e*2**M;X.scaleTo(K,B,I,J);return}const Te=J.deltaMode===1?20:1;let De=d.value===ho.Vertical?0:J.deltaX*Te,E=d.value===ho.Horizontal?0:J.deltaY*Te;!Ce&&J.shiftKey&&d.value!==ho.Vertical&&!De&&E&&(De=E,E=0),X.translateBy(K,-(De/_e)*u.value,-(E/_e)*u.value);const T=ke(K.property("__zoom"));k&&clearTimeout(k),oe.value?(A.move({event:J,flowTransform:T}),A.viewportChange(T),k=setTimeout(()=>{A.moveEnd({event:J,flowTransform:T}),A.viewportChangeEnd(T),oe.value=!1},150)):(oe.value=!0,A.moveStart({event:J,flowTransform:T}),A.viewportChangeStart(T))},{passive:!1}):typeof w<"u"&&K.on("wheel.zoom",function(J,ge){const we=!y.value&&J.type==="wheel"&&!J.ctrlKey,Ne=v.value||p.value,_e=m.value&&J.ctrlKey;if(!Ne&&!c.value&&!_e&&J.type==="wheel"||we||Re(J,b.value))return null;J.preventDefault(),w.call(this,J,ge)},{passive:!1})},{immediate:!0})});function ce(xe,pe){return pe===2&&Array.isArray(xe)&&xe.includes(2)}function ye(xe,pe){return xe.x!==pe.x&&!Number.isNaN(pe.x)||xe.y!==pe.y&&!Number.isNaN(pe.y)||xe.zoom!==pe.k&&!Number.isNaN(pe.k)}function ke(xe){return{x:xe.x,y:xe.y,zoom:xe.k}}function Re(xe,pe){return xe.target.closest(`.${pe}`)}return(xe,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:ne,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(I0,{"is-selecting":he.value,"selection-key-pressed":n.unref(ae),class:n.normalizeClass({connecting:se.value,dragging:n.unref(te),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(C0,null,{default:n.withCtx(()=>[n.renderSlot(xe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),A0=["id"],T0=["id"],M0=["id"],B0={name:"A11yDescriptions",compatConfig:{MODE:3}},D0=n.defineComponent({...B0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Cc)}-${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,A0),n.createElementVNode("div",{id:`${n.unref(Rc)}-${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,T0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(ab)}-${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,M0))],64))}});function O0(){const e=Le();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function L0(e,t,o){return o===Se.Left?e-t:o===Se.Right?e+t:e}function P0(e,t,o){return o===Se.Top?e-t:o===Se.Bottom?e+t:e}const bl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Se.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:L0(t,e,i),cy:P0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};bl.props=["radius","centerX","centerY","position","type"],bl.compatConfig={MODE:3};const Nd=bl,z0=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:h,multiSelectionActive:m,disableKeyboardA11y:p,elementsSelectable:y,edgesUpdatable:b,edgesFocusable:_,hooks:A}=Le(),g=n.computed(()=>u(e.id)),{emit:N,on:te}=Bb(g.value,l),S=n.inject(Ri),O=n.getCurrentInstance(),z=n.ref(!1),F=n.ref(!1),ne=n.ref(""),re=n.ref(null),L=n.ref("source"),oe=n.ref(null),k=n.toRef(()=>typeof g.value.selectable>"u"?y.value:g.value.selectable),W=n.toRef(()=>typeof g.value.updatable>"u"?b.value:g.value.updatable),R=n.toRef(()=>typeof g.value.focusable>"u"?_.value:g.value.focusable);n.provide(Ab,e.id),n.provide(Tb,oe);const G=n.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),H=n.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),ae=n.computed(()=>{const C=g.value.type||"default",V=S==null?void 0:S[`edge-${C}`];if(V)return V;let Y=g.value.template??c.value[C];if(typeof Y=="string"&&O){const J=Object.keys(O.appContext.components);J&&J.includes(C)&&(Y=n.resolveComponent(C,!1))}return Y&&typeof Y!="string"?Y:(l.error(new Je(qe.EDGE_TYPE_MISSING,Y)),!1)}),{handlePointerDown:v}=ud({nodeId:ne,handleId:re,type:L,isValidConnection:h,edgeUpdaterType:L,onEdgeUpdate:me,onEdgeUpdateEnd:he});return()=>{const C=f(g.value.source),V=f(g.value.target),Y="pathOptions"in g.value?g.value.pathOptions:{};if(!C&&!V)return l.error(new Je(qe.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!C)return l.error(new Je(qe.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!V)return l.error(new Je(qe.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||C.hidden||V.hidden)return null;let J;i.value===Bt.Strict?J=C.handleBounds.source:J=[...C.handleBounds.source||[],...C.handleBounds.target||[]];const ge=Zc(J,g.value.sourceHandle);let we;i.value===Bt.Strict?we=V.handleBounds.target:we=[...V.handleBounds.target||[],...V.handleBounds.source||[]];const Ne=Zc(we,g.value.targetHandle),_e=(ge==null?void 0:ge.position)||Se.Bottom,Ce=(Ne==null?void 0:Ne.position)||Se.Top,{x:Te,y:De}=Dn(C,ge,_e),{x:E,y:T}=Dn(V,Ne,Ce);return g.value.sourceX=Te,g.value.sourceY=De,g.value.targetX=E,g.value.targetY=T,n.h("g",{ref:oe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ae.value===!1?"default":g.value.type||"default"}`,s.value,G.value,{updating:z.value,selected:g.value.selected,animated:g.value.animated,inactive:!k.value&&!A.value.edgeClick.hasListeners()}],tabIndex:R.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":R.value?`${Rc}-${t}`:void 0,"aria-roledescription":"edge",role:R.value?"group":"img",...g.value.domAttributes,onClick:ce,onContextmenu:ye,onDblclick:ke,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onKeyDown:R.value?w:void 0},[F.value?null:n.h(ae.value===!1?c.value.default:ae.value,{id:e.id,sourceNode:C,targetNode:V,source:g.value.source,target:g.value.target,type:g.value.type,updatable:W.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...te},style:H.value,markerStart:`url('#${ko(g.value.markerStart,t)}')`,markerEnd:`url('#${ko(g.value.markerEnd,t)}')`,sourcePosition:_e,targetPosition:Ce,sourceX:Te,sourceY:De,targetX:E,targetY:T,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...Y}),[W.value==="source"||W.value===!0?[n.h("g",{onMousedown:X,onMouseenter:q,onMouseout:le},n.h(Nd,{position:_e,centerX:Te,centerY:De,radius:a.value,type:"source","data-type":"source"}))]:null,W.value==="target"||W.value===!0?[n.h("g",{onMousedown:K,onMouseenter:q,onMouseout:le},n.h(Nd,{position:Ce,centerX:E,centerY:T,radius:a.value,type:"target","data-type":"target"}))]:null]])};function q(){z.value=!0}function le(){z.value=!1}function me(C,V){N.update({event:C,edge:g.value,connection:V})}function he(C){N.updateEnd({event:C,edge:g.value}),F.value=!1}function se(C,V){C.button===0&&(F.value=!0,ne.value=V?g.value.target:g.value.source,re.value=(V?g.value.targetHandle:g.value.sourceHandle)??null,L.value=V?"target":"source",N.updateStart({event:C,edge:g.value}),v(C))}function ce(C){var V;const Y={event:C,edge:g.value};k.value&&(r.value=!1,g.value.selected&&m.value?(d([g.value]),(V=oe.value)==null||V.blur()):o([g.value])),N.click(Y)}function ye(C){N.contextMenu({event:C,edge:g.value})}function ke(C){N.doubleClick({event:C,edge:g.value})}function Re(C){N.mouseEnter({event:C,edge:g.value})}function xe(C){N.mouseMove({event:C,edge:g.value})}function pe(C){N.mouseLeave({event:C,edge:g.value})}function X(C){se(C,!0)}function K(C){se(C,!1)}function w(C){var V;!p.value&&Vc.includes(C.key)&&k.value&&(C.key==="Escape"?((V=oe.value)==null||V.blur(),d([u(e.id)])):o([u(e.id)]))}}}),U0=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}=Le(),h=(e=n.inject(Ri))==null?void 0:e["connection-line"],m=n.computed(()=>{var A;return f((A=i.value)==null?void 0:A.nodeId)}),p=n.computed(()=>{var A;return f((A=a.value)==null?void 0:A.nodeId)??null}),y=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${ko(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${ko(c.value.markerEnd,t)})`:"");return()=>{var A,g,N;if(!m.value||!i.value)return null;const te=i.value.id,S=i.value.type,O=m.value.handleBounds;let z=(O==null?void 0:O[S])??[];if(o.value===Bt.Loose){const H=(O==null?void 0:O[S==="source"?"target":"source"])??[];z=[...z,...H]}if(!z)return null;const F=(te?z.find(H=>H.id===te):z[0])??null,ne=(F==null?void 0:F.position)??Se.Top,{x:re,y:L}=Dn(m.value,F,ne);let oe=null;p.value&&(o.value===Bt.Strict?oe=((A=p.value.handleBounds[S==="source"?"target":"source"])==null?void 0:A.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null:oe=((g=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:g.find(H=>{var ae;return H.id===((ae=a.value)==null?void 0:ae.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(ne?fl[ne]:null);if(!ne||!k)return null;const W=r.value??c.value.type??ln.Bezier;let R="";const G={sourceX:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k};return W===ln.Bezier?[R]=bd(G):W===ln.Step?[R]=gl({...G,borderRadius:0}):W===ln.SmoothStep?[R]=gl(G):W===ln.SimpleBezier?[R]=kd(G):R=`M${re},${L} ${y.value.x},${y.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},h?n.h(h,{sourceX:re,sourceY:L,sourcePosition:ne,targetX:y.value.x,targetY:y.value.y,targetPosition:k,sourceNode:m.value,sourceHandle:F,targetNode:p.value,targetHandle:oe,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):n.h("path",{d:R,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),H0=["id","markerWidth","markerHeight","markerUnits","orient"],F0={name:"MarkerType",compatConfig:{MODE:3}},G0=n.defineComponent({...F0,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(ol).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(ol).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,H0))}}),Y0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},W0={name:"MarkerDefinitions",compatConfig:{MODE:3}},K0=n.defineComponent({...W0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Le(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=ko(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",Y0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(G0,{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))])]))}}),q0={name:"Edges",compatConfig:{MODE:3}},X0=n.defineComponent({...q0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Le();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(K0),(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(kb)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(z0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(U0))],64))}}),j0=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:l,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:m,disableKeyboardA11y:p,ariaLiveMessage:y,snapToGrid:b,snapGrid:_,nodeDragThreshold:A,nodesDraggable:g,elementsSelectable:N,nodesConnectable:te,nodesFocusable:S,hooks:O}=Le(),z=n.ref(null);n.provide(cd,z),n.provide(sd,e.id);const F=n.inject(Ri),ne=n.getCurrentInstance(),re=md(),{node:L,parentNode:oe}=fd(e.id),{emit:k,on:W}=Pb(L,r),R=n.toRef(()=>typeof L.draggable>"u"?g.value:L.draggable),G=n.toRef(()=>typeof L.selectable>"u"?N.value:L.selectable),H=n.toRef(()=>typeof L.connectable>"u"?te.value:L.connectable),ae=n.toRef(()=>typeof L.focusable>"u"?S.value:L.focusable),v=n.computed(()=>G.value||R.value||O.value.nodeClick.hasListeners()||O.value.nodeDoubleClick.hasListeners()||O.value.nodeMouseEnter.hasListeners()||O.value.nodeMouseMove.hasListeners()||O.value.nodeMouseLeave.hasListeners()),q=n.toRef(()=>!!L.dimensions.width&&!!L.dimensions.height),le=n.computed(()=>{const V=L.type||"default",Y=F==null?void 0:F[`node-${V}`];if(Y)return Y;let J=L.template||f.value[V];if(typeof J=="string"&&ne){const ge=Object.keys(ne.appContext.components);ge&&ge.includes(V)&&(J=n.resolveComponent(V,!1))}return J&&typeof J!="string"?J:(r.error(new Je(qe.NODE_TYPE_MISSING,J)),!1)}),me=dd({id:e.id,el:z,disabled:()=>!R.value,selectable:G,dragHandle:()=>L.dragHandle,onStart(V){k.dragStart(V)},onDrag(V){k.drag(V)},onStop(V){k.dragStop(V)},onClick(V){w(V)}}),he=n.computed(()=>L.class instanceof Function?L.class(L):L.class),se=n.computed(()=>{const V=(L.style instanceof Function?L.style(L):L.style)||{},Y=L.width instanceof Function?L.width(L):L.width,J=L.height instanceof Function?L.height(L):L.height;return!V.width&&Y&&(V.width=typeof Y=="string"?Y:`${Y}px`),!V.height&&J&&(V.height=typeof J=="string"?J:`${J}px`),V}),ce=n.toRef(()=>Number(L.zIndex??se.value.zIndex??0));return u(V=>{(V.includes(e.id)||!V.length)&&ke()}),n.onMounted(()=>{n.watch(()=>L.hidden,(V=!1,Y,J)=>{!V&&z.value&&(e.resizeObserver.observe(z.value),J(()=>{z.value&&e.resizeObserver.unobserve(z.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>L.type,()=>L.sourcePosition,()=>L.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])})}),n.watch([()=>L.position.x,()=>L.position.y,()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.x},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.y},()=>{var V;return(V=oe.value)==null?void 0:V.computedPosition.z},ce,()=>L.selected,()=>L.dimensions.height,()=>L.dimensions.width,()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.height},()=>{var V;return(V=oe.value)==null?void 0:V.dimensions.width}],([V,Y,J,ge,we,Ne])=>{const _e={x:V,y:Y,z:Ne+(m.value&&L.selected?1e3:0)};typeof J<"u"&&typeof ge<"u"?L.computedPosition=pb({x:J,y:ge,z:we},_e):L.computedPosition=_e},{flush:"post",immediate:!0}),n.watch([()=>L.extent,h],([V,Y],[J,ge])=>{(V!==J||Y!==ge)&&ye()}),L.extent==="parent"||typeof L.extent=="object"&&"range"in L.extent&&L.extent.range==="parent"?Ba(()=>q).toBe(!0).then(ye):ye(),()=>L.hidden?null:n.h("div",{ref:z,"data-id":L.id,class:["vue-flow__node",`vue-flow__node-${le.value===!1?"default":L.type||"default"}`,{[o.value]:R.value,dragging:me==null?void 0:me.value,draggable:R.value,selected:L.selected,selectable:G.value,parent:L.isParent},he.value],style:{visibility:q.value?"visible":"hidden",zIndex:L.computedPosition.z??ce.value,transform:`translate(${L.computedPosition.x}px,${L.computedPosition.y}px)`,pointerEvents:v.value?"all":"none",...se.value},tabIndex:ae.value?0:void 0,role:ae.value?"group":void 0,"aria-describedby":p.value?void 0:`${Cc}-${t}`,"aria-label":L.ariaLabel,"aria-roledescription":"node",...L.domAttributes,onMouseenter:Re,onMousemove:xe,onMouseleave:pe,onContextmenu:X,onClick:w,onDblclick:K,onKeydown:C},[n.h(le.value===!1?f.value.default:le.value,{id:L.id,type:L.type,data:L.data,events:{...L.events,...W},selected:L.selected,resizing:L.resizing,dragging:me.value,connectable:H.value,position:L.computedPosition,dimensions:L.dimensions,isValidTargetPos:L.isValidTargetPos,isValidSourcePos:L.isValidSourcePos,parent:L.parentNode,parentNodeId:L.parentNode,zIndex:L.computedPosition.z??ce.value,targetPosition:L.targetPosition,sourcePosition:L.sourcePosition,label:L.label,dragHandle:L.dragHandle,onUpdateNodeInternals:ke})]);function ye(){const V=L.computedPosition,{computedPosition:Y,position:J}=cl(L,b.value?Ci(V,_.value):V,r.error,h.value,oe.value);(L.computedPosition.x!==Y.x||L.computedPosition.y!==Y.y)&&(L.computedPosition={...L.computedPosition,...Y}),(L.position.x!==J.x||L.position.y!==J.y)&&(L.position=J)}function ke(){z.value&&d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])}function Re(V){me!=null&&me.value||k.mouseEnter({event:V,node:L})}function xe(V){me!=null&&me.value||k.mouseMove({event:V,node:L})}function pe(V){me!=null&&me.value||k.mouseLeave({event:V,node:L})}function X(V){return k.contextMenu({event:V,node:L})}function K(V){return k.doubleClick({event:V,node:L})}function w(V){G.value&&(!i.value||!R.value||A.value>0)&&ml(L,l.value,c,s,a,!1,z.value),k.click({event:V,node:L})}function C(V){if(!(il(V)||p.value))if(Vc.includes(V.key)&&G.value){const Y=V.key==="Escape";ml(L,l.value,c,s,a,Y,z.value)}else R.value&&L.selected&&Mn[V.key]&&(V.preventDefault(),y.value=`Moved selected node ${V.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~L.position.x}, y: ${~~L.position.y}`,re({x:Mn[V.key].x,y:Mn[V.key].y},V.shiftKey))}}});function Z0(e={includeHiddenNodes:!1}){const{nodes:t}=Le();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 J0={class:"vue-flow__nodes vue-flow__container"},Q0={name:"Nodes",compatConfig:{MODE:3}},e1=n.defineComponent({...Q0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Le(),a=Z0(),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",J0,[l.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const h=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,h))return f;const m=(n.openBlock(),n.createBlock(n.unref(j0),{id:c.id,key:c.id,"resize-observer":l.value},null,8,["id","resize-observer"]));return m.memo=h,m},s,0),128)):n.createCommentVNode("",!0)]))}});function t1(){const{emits:e}=Le();n.onMounted(()=>{if(nd()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Je(qe.MISSING_STYLES))}})}const n1=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),o1={name:"VueFlow",compatConfig:{MODE:3}},i1=n.defineComponent({...o1,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=Da(i,"modelValue",o),r=Da(i,"nodes",o),s=Da(i,"edges",o),c=Le(i),d=Fb({modelValue:l,nodes:r,edges:s},i,c);return Yb(o,c.hooks),O0(),t1(),n.provide(Ri,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(V0,null,{default:n.withCtx(()=>[n.createVNode(X0),n1,n.createVNode(e1),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(D0)],512))}}),a1={name:"Panel",compatConfig:{MODE:3}},$d=n.defineComponent({...a1,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Le(),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))}}),fn=["red","amber","green","teal","blue","indigo","violet","pink"],xd={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function l1(e){return typeof e=="string"&&e in xd}const r1={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},s1=.15;function c1(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 d1(e){if(typeof e!="string")return null;const t=c1(e);if(!t||t.s<s1)return null;let o=null,i=1/0;for(const a of fn){const l=Math.abs(t.h-r1[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function it(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(l1(t))return t;const o=e==null?void 0:e.properties;return d1((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function _l(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const u1={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)"},f1={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 Id(e,t=!1){return e?t?f1[e]:u1[e]:null}function On(e){return xd[e]}function Ln(e){return`var(--em-swatch-${e}-bar)`}const m1=["width","height","innerHTML"],p1=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,m1))}}),Ue=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ue(p1,[["__scopeId","data-v-92c1dba8"]]),h1={class:"em-inline-issue__msgs"},mn=Ue(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",h1,[(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"]]),y1={class:"em-mlang"},g1={class:"em-mlang__tabs",role:"tablist"},b1=["aria-selected","onClick"],_1={key:0,class:"em-mlang__dot"},kl=Ue(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",y1,[n.createElementVNode("div",g1,[(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:h=>l.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",_1,"•")):n.createCommentVNode("",!0)],10,b1))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(ie.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(ie.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"]]),k1=["disabled"],w1={class:"em-panel__sub-label"},E1={class:"em-field"},v1={class:"em-field"},N1={class:"em-field"},$1={class:"em-class"},x1={class:"em-field"},I1={class:"em-field"},S1={class:"em-field"},C1={class:"em-field"},R1={class:"em-multilang"},V1={class:"em-multilang"},A1={class:"em-jpa"},T1={class:"em-field"},M1={class:"em-field"},B1={class:"em-field"},D1={class:"em-swatch"},O1={class:"em-swatch__row"},L1=["title","onClick"],Sd=Ue(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(L=>L.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(L=>L.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var L;return it(((L=r.value)==null?void 0:L.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=L=>L;function h(L){return L==="inherit"?"기본(따름)":L}function m(L){l.value&&a.updateEntity(l.value.modelId,L)}function p(L,oe,k){var R;const W=((R=l.value)==null?void 0:R.table)??{physicalName:""};m(L==="physicalName"?{table:{...W,physicalName:k}}:{table:{...W,logicalName:{...W.logicalName,[oe]:k}}})}function y(L){m({description:Object.keys(L).length?L:void 0})}function b(L,oe){var k;m({jpaAttrs:{...(k=l.value)==null?void 0:k.jpaAttrs,[L]:oe}})}function _(L,oe){b(L,oe)}const A=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.jpaAttrs)==null?void 0:oe.discriminatorType)??"inherit"}),g=n.computed(()=>{var L,oe;return!((oe=(L=l.value)==null?void 0:L.jpaAttrs)!=null&&oe.useDiscriminator)});function N(L){b("discriminatorType",L==="inherit"?void 0:L)}function te(L){m({hasPersonalInfo:L})}function S(L){m({superClass:L.trim()||void 0})}function O(L){m({schema:L.trim()||void 0})}function z(L){m({abstractClass:L})}const F=n.computed(()=>{var L,oe;return((oe=(L=l.value)==null?void 0:L.declarationOfInterfaces)==null?void 0:oe.join(", "))??""});function ne(L){const oe=L.split(",").map(k=>k.trim()).filter(Boolean);m({declarationOfInterfaces:oe.length?oe:void 0})}function re(L){l.value&&a.setEntitySwatch(l.value.modelId,L)}return(L,oe)=>{var k,W,R;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]=G=>i("toggle"))},[n.createElementVNode("span",w1,[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(mn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",E1,[oe[13]||(oe[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":oe[1]||(oe[1]=G=>m({name:G}))},null,8,["model-value"])]),n.createElementVNode("label",v1,[oe[14]||(oe[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":oe[2]||(oe[2]=G=>m({stereotype:G}))},null,8,["model-value"])]),n.createElementVNode("label",N1,[oe[15]||(oe[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":oe[3]||(oe[3]=G=>m({packageName:G}))},null,8,["model-value"])]),n.createElementVNode("fieldset",$1,[oe[18]||(oe[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",x1,[oe[16]||(oe[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":oe[4]||(oe[4]=G=>S(G))},null,8,["model-value"])]),n.createElementVNode("label",I1,[oe[17]||(oe[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":F.value,"onUpdate:modelValue":oe[5]||(oe[5]=G=>ne(G))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":oe[6]||(oe[6]=G=>z(G))},null,8,["model-value"])]),n.createElementVNode("label",S1,[oe[19]||(oe[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=l.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":oe[7]||(oe[7]=G=>p("physicalName",null,G))},null,8,["model-value"])]),n.createElementVNode("label",C1,[oe[20]||(oe[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":oe[8]||(oe[8]=G=>O(G))},null,8,["model-value"])]),n.createElementVNode("fieldset",R1,[oe[21]||(oe[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,G=>{var H,ae;return n.openBlock(),n.createElementBlock("label",{key:G,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(G),1),n.createVNode(n.unref(ie.BSTextInput),{name:`ent-logical-${G}`,width:"100%","model-value":((ae=(H=l.value.table)==null?void 0:H.logicalName)==null?void 0:ae[G])??"","onUpdate:modelValue":v=>p("logicalName",G,v)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",V1,[oe[22]||(oe[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":y},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",A1,[oe[26]||(oe[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,G=>{var H;return n.createVNode(n.unref(ie.BSCheckbox),{key:G.key,name:`jpa-${G.key}`,class:"em-check",label:G.label,"model-value":!!((H=l.value.jpaAttrs)!=null&&H[G.key]),"onUpdate:modelValue":ae=>_(G.key,ae)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",T1,[oe[23]||(oe[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:g.value,"model-value":((W=l.value.jpaAttrs)==null?void 0:W.discriminatorColumnName)??"","onUpdate:modelValue":oe[9]||(oe[9]=G=>b("discriminatorColumnName",G.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",M1,[oe[24]||(oe[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(ie.BSSelect),{disabled:g.value,"model-value":A.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":oe[10]||(oe[10]=G=>G&&N(G))},null,8,["disabled","model-value"])]),n.createElementVNode("label",B1,[oe[25]||(oe[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(ie.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:g.value,"model-value":(R=l.value.jpaAttrs)==null?void 0:R.discriminatorLength,"onUpdate:modelValue":oe[11]||(oe[11]=G=>b("discriminatorLength",G||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!l.value.hasPersonalInfo,"onUpdate:modelValue":te},null,8,["model-value"]),n.createElementVNode("fieldset",D1,[oe[27]||(oe[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",O1,[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]=G=>re(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===G}]),style:n.normalizeStyle({background:n.unref(Ln)(G)}),title:n.unref(On)(G),onClick:H=>re(G)},null,14,L1))),128))])])],64)):n.createCommentVNode("",!0)],8,k1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),Cd=["ko","en","ja","zh"];function P1(e){if(e)for(const t of Cd){const o=e[t];if(o)return o}}function wl(e){const t=P1(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function z1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Cd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const U1=["aria-expanded"],H1=["aria-selected","onClick","onMouseenter"],F1={key:0,class:"gcc__opt gcc__opt--empty"},Rd=Ue(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(z=>z.groupCode===o.modelValue)),h=n.computed(()=>f.value?wl(f.value):"");n.watch(h,z=>{c.value||(s.value=z)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:z1(o.items,s.value));function p(){var F;const z=(F=a.value)==null?void 0:F.getBoundingClientRect();z&&(u.value={left:`${z.left}px`,top:`${z.bottom}px`,width:`${z.width}px`})}function y(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(z=>z.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",O)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",O)}n.onBeforeUnmount(b);function _(){y(),n.nextTick(()=>{var z;return(z=l.value)==null?void 0:z.select()})}function A(){c.value||y(),d.value=0}function g(z){i("update:modelValue",z.groupCode),s.value=wl(z),b()}function N(){i("update:modelValue",void 0),s.value="",b()}function te(){s.value.trim()===""?N():(s.value=h.value,b())}function S(z){var F;if(z.key==="ArrowDown")c.value||y(),d.value=Math.min(d.value+1,m.value.length-1),z.preventDefault();else if(z.key==="ArrowUp")d.value=Math.max(d.value-1,0),z.preventDefault();else if(z.key==="Enter"){const ne=m.value[d.value];ne&&g(ne),z.preventDefault()}else z.key==="Escape"&&(s.value=h.value,b(),(F=l.value)==null||F.blur())}function O(z){var ne,re;const F=z.target;!((ne=a.value)!=null&&ne.contains(F))&&!((re=r.value)!=null&&re.contains(F))&&te()}return(z,F)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":F[0]||(F[0]=ne=>s.value=ne),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:A,onKeydown:S},null,40,U1),[[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:F[1]||(F[1]=n.withModifiers(()=>{},["prevent"])),onClick:N},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(ne,re)=>(n.openBlock(),n.createElementBlock("li",{key:ne.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":re===d.value,"is-selected":ne.groupCode===e.modelValue}]),role:"option","aria-selected":ne.groupCode===e.modelValue,onMousedown:F[2]||(F[2]=n.withModifiers(()=>{},["prevent"])),onClick:L=>g(ne),onMouseenter:L=>d.value=re},n.toDisplayString(n.unref(wl)(ne)),43,H1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",F1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),G1=["disabled"],Y1={class:"em-aw__toolbar"},W1={class:"em-aw__count"},K1={class:"em-aw__scroll"},q1={class:"em-aw__table"},X1={key:0,class:"c-code"},j1=["colspan"],Z1={class:"c-del"},J1={class:"c-flag"},Q1={class:"c-flag"},e_={class:"c-flag"},t_={class:"c-flag"},n_={class:"c-flag"},o_={class:"c-flag"},i_={class:"c-flag"},a_={class:"c-flag"},l_={key:0},r_=["title"],s_=["colspan"],c_={class:"c-del"},d_={class:"em-aw__embed-label"},u_={class:"em-aw__ro"},f_={class:"em-aw__ro"},m_={class:"em-aw__ro"},p_={class:"em-aw__ro"},h_={colspan:"8"},y_=["colspan"],g_={key:0},b_="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",Li="__OWN__",__=Ue(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(I=>I.modelId===t.entityId)??null),a=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.attrType!=="DIVIDER").length}),s=n.computed(()=>W.value.length?19:18),c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(I){return I==="none"?"(없음)":I}const u=I=>I;function f(I,M){i.value&&o.updateAttribute(i.value.modelId,I.modelId,M)}function h(I){return!!i.value&&!!ti(o.state.logical,i.value.modelId,I.modelId)}function m(I,M){f(I,{naturalId:M||void 0,naturalIdMutable:M?I.naturalIdMutable:void 0})}function p(){return{naturalId:void 0,naturalIdMutable:void 0}}function y(I,M){f(I,{identifier:M,...M?p():{}})}function b(I,M){f(I,{transient:M||void 0,...M?p():{}})}function _(I){return!!I.transient}const A=I=>I.value,g=I=>I.label;function N(I,M){if(!M)return;const B=re.value.find(de=>de.type===M);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};f(I,{type:M,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}f(I,M===zt?{type:M}:{type:M,customType:void 0})}function te(I,M){f(I,{customType:M.trim()===""?void 0:M})}function S(I,M){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...M};M.dataType!==void 0&&!Go.has(de.dataType)&&(de.scale=void 0),f(I,{dbAttrs:[de]})}function O(I){var M;return Go.has(((M=I.dbAttrs[0])==null?void 0:M.dataType)??"")}function z(I,M,B){var de;S(I,{logicalName:{...(de=I.dbAttrs[0])==null?void 0:de.logicalName,[M]:B}})}function F(I){return I.personalInfoAttributeType??"none"}function ne(I,M){f(I,{personalInfoAttributeType:M==="none"?void 0:M})}const re=n.computed(()=>o.predefinedCustomTypeCatalog.value),L=n.computed(()=>o.embeddableCatalog.value);function oe(I){var M,B;return((M=I.label)==null?void 0:M.ko)??((B=I.label)==null?void 0:B.en)??I.type}function k(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function R(I){var M;return((M=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:M.codes)??[]}function G(I){return["none",...R(I)]}function H(I){return I==="none"?"none":I.code}function ae(I){var B,de;if(I==="none")return"(없음)";const M=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return M?`${I.code} (${M})`:I.code}function v(I,M){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,M)}function q(I,M){f(I,{defaultValue:M==="none"?void 0:M})}function le(I,M){f(I,{defaultValue:M.trim()===""?void 0:M})}function me(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function he(I,M,B){const de=I.dbAttrs.map((be,Q)=>{if(Q!==M)return be;const Z={...be,...B};for(const j of Object.keys(B))B[j]===void 0&&delete Z[j];return Z});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function se(I,M,B,de){var be;he(I,M,{logicalName:{...(be=I.dbAttrs[M])==null?void 0:be.logicalName,[B]:de}})}function ce(I,M){var be,Q,Z;if(I.attrType==="EMBED_PREDEF"){const j=(be=o.embeddableCatalog.value.find(ue=>ue.type===I.type))==null?void 0:be.fields[M];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,shareable:j.shareable,logicalName:j.logicalName}:void 0}const B=(Q=I.embedded)==null?void 0:Q.embeddableRef;if(!B)return;const de=(Z=o.state.logical.entities.find(j=>j.modelId===B))==null?void 0:Z.attributes.flatMap(j=>j.dbAttrs)[M];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function ye(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.dataType)||((de=I.dbAttrs[M])==null?void 0:de.dataType)||""}function ke(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.length)??((de=I.dbAttrs[M])==null?void 0:de.length)}function Re(I,M){var B,de;return((B=ce(I,M))==null?void 0:B.scale)??((de=I.dbAttrs[M])==null?void 0:de.scale)}const xe=["inherit","true","false"];function pe(I){return I==="inherit"?"기본(따름)":I}function X(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function K(I,M,B){he(I,M,{updatable:B==="inherit"?void 0:B==="true"})}function w(I,M){S(I,{updatable:M==="inherit"?void 0:M==="true"})}const C=["inherit","true","false"];function V(I){return I==="inherit"?"기본(따름)":I}function Y(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function J(I,M,B){he(I,M,{insertable:B==="inherit"?void 0:B==="true"})}function ge(I,M){S(I,{insertable:M==="inherit"?void 0:M==="true"})}const we=n.computed(()=>{var I;return Xn(((I=i.value)==null?void 0:I.attributes.flatMap(M=>M.dbAttrs))??[])}),Ne=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>({modelId:M.dbAttrs[0].modelId,label:M.dbAttrs[0].physicalName||M.name}))});function _e(){return[Li,...Ne.value.map(I=>I.modelId)]}function Ce(I){if(I===Li)return"전용 컬럼(OWN)";const M=Ne.value.find(B=>B.modelId===I);return M?`↗ ${M.label} (공유)`:I}function Te(I){return(I==null?void 0:I.sharedColumnRef)??Li}function De(I,M,B){he(I,M,{sharedColumnRef:B===Li?void 0:B})}function E(I){return(I==null?void 0:I.sharedColumnRef)!=null}function T(I){var M;return((M=Yo(I,we.value))==null?void 0:M.physicalName)??""}return(I,M)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Y1,[n.createElementVNode("span",W1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:M[0]||(M[0]=B=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"구분선",onClick:M[1]||(M[1]=B=>n.unref(o).addDivider(i.value.modelId))}),L.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:L.value,"value-provider":B=>B.type,"label-provider":oe,"onUpdate:modelValue":k},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",K1,[n.createElementVNode("table",q1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[M[2]||(M[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),M[3]||(M[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),M[4]||(M[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),M[5]||(M[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),M[6]||(M[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[7]||(M[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),M[8]||(M[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),M[9]||(M[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),M[10]||(M[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),M[11]||(M[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),M[12]||(M[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),M[13]||(M[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),M[14]||(M[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),M[15]||(M[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),M[16]||(M[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),M[17]||(M[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),M[18]||(M[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),M[19]||(M[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),W.value.length?(n.openBlock(),n.createElementBlock("th",X1,"코드그룹")):n.createCommentVNode("",!0),M[20]||(M[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),M[21]||(M[21]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,be,Q,Z,j,ue,x,D,$,U,P;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,j1),n.createElementVNode("td",Z1,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):me(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(B.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:W.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(B.dbAttrs.length)+"개",9,s_),n.createElementVNode("td",c_,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ee,fe)=>{var Ie,Be,Me,Ke,Ge,Qe,Ye;return n.openBlock(),n.createElementBlock("tr",{key:ee.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",d_,"↳ "+n.toDisplayString(((Ie=ce(B,fe))==null?void 0:Ie.name)??((Be=ce(B,fe))==null?void 0:Be.physicalName)??`컬럼 ${fe+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",u_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-logical-${ee.modelId}`,width:"100%",placeholder:((Ke=(Me=ce(B,fe))==null?void 0:Me.logicalName)==null?void 0:Ke.ko)??"논리명","model-value":((Ge=ee.logicalName)==null?void 0:Ge.ko)??"","onUpdate:modelValue":Pe=>se(B,fe,"ko",Pe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-embed-col-${ee.modelId}`,width:"100%",disabled:E(ee),placeholder:((Qe=ce(B,fe))==null?void 0:Qe.physicalName)??"컬럼","model-value":E(ee)?T(ee):ee.physicalName,"onUpdate:modelValue":Pe=>he(B,fe,{physicalName:Pe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":ee.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",f_,n.toDisplayString(ye(B,fe)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",m_,n.toDisplayString(ke(B,fe)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",p_,n.toDisplayString(Re(B,fe)??""),1)]),n.createElementVNode("td",h_,[(Ye=ce(B,fe))!=null&&Ye.shareable?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":Te(ee),items:_e(),"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":Pe=>Pe&&De(B,fe,Pe)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":Y(ee),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":Pe=>Pe&&J(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:E(ee),"model-value":E(ee)?"false":X(ee),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":Pe=>Pe&&K(B,fe,Pe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:W.value.length?4:3},null,8,y_)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(B.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:"이름","model-value":B.name,"onUpdate:modelValue":ee=>f(B,{name:ee})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:"타입",disabled:!!B.groupCode,items:n.unref(ur)(B.type,re.value),"value-provider":A,"label-provider":g,"model-value":B.type,"onUpdate:modelValue":ee=>N(B,ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(zt)?(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":B.customType??"","onUpdate:modelValue":ee=>te(B,ee)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-logical-${B.modelId}`,width:"100%",placeholder:"논리명","model-value":((be=(de=B.dbAttrs[0])==null?void 0:de.logicalName)==null?void 0:be.ko)??"","onUpdate:modelValue":ee=>z(B,"ko",ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:"컬럼",disabled:_(B),"model-value":((Q=B.dbAttrs[0])==null?void 0:Q.physicalName)??"","onUpdate:modelValue":ee=>S(B,{physicalName:ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Z=B.dbAttrs[0])==null?void 0:Z.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:_(B),items:n.unref(cr)(((j=B.dbAttrs[0])==null?void 0:j.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(_a),"model-value":((ue=B.dbAttrs[0])==null?void 0:ue.dataType)??"","onUpdate:modelValue":ee=>ee&&S(B,{dataType:ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:_(B),"model-value":(x=B.dbAttrs[0])==null?void 0:x.length,"onUpdate:modelValue":ee=>S(B,{length:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"100%",placeholder:"scale",disabled:_(B)||!O(B),"model-value":(D=B.dbAttrs[0])==null?void 0:D.scale,"onUpdate:modelValue":ee=>S(B,{scale:ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",J1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-pk-${B.modelId}`,"model-value":B.identifier,disabled:a.value||_(B),"onUpdate:modelValue":ee=>y(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",Q1,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nn-${B.modelId}`,"model-value":B.notNull,disabled:_(B),"onUpdate:modelValue":ee=>f(B,{notNull:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",e_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-uq-${B.modelId}`,"model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{unique:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",t_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-ai-${B.modelId}`,"model-value":!!((U=B.dbAttrs[0])!=null&&U.autoIncrement),disabled:_(B)||!B.identifier,"onUpdate:modelValue":ee=>S(B,{autoIncrement:ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-tr-${B.modelId}`,"model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ee=>b(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nid-${B.modelId}`,"model-value":!!B.naturalId,disabled:B.identifier||_(B),"onUpdate:modelValue":ee=>m(B,ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",i_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-nidm-${B.modelId}`,"model-value":!!B.naturalIdMutable,disabled:_(B)||!B.naturalId,"onUpdate:modelValue":ee=>f(B,{naturalIdMutable:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",a_,[n.createVNode(n.unref(ie.BSCheckbox),{name:`aw-mv-${B.modelId}`,"model-value":!!((P=B.dbAttrs[0])!=null&&P.multiValue),disabled:_(B),"onUpdate:modelValue":ee=>S(B,{multiValue:ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-ins-${B.modelId}`,width:"100%",disabled:_(B),"model-value":Y(B.dbAttrs[0]),items:C,"value-provider":u,"label-provider":V,"onUpdate:modelValue":ee=>ee&&ge(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{name:`aw-upd-${B.modelId}`,width:"100%",disabled:_(B),"model-value":X(B.dbAttrs[0]),items:xe,"value-provider":u,"label-provider":pe,"onUpdate:modelValue":ee=>ee&&w(B,ee)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":F(B),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ee=>ee&&ne(B,ee)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("td",l_,[n.createVNode(Rd,{"model-value":B.groupCode,items:W.value,"onUpdate:modelValue":ee=>v(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[R(B).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":B.defaultValue??"none",items:G(B),"value-provider":H,"label-provider":ae,"onUpdate:modelValue":ee=>ee&&q(B,ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"100%",placeholder:"기본값","model-value":B.defaultValue??"","onUpdate:modelValue":ee=>le(B,ee)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",{class:"c-del",title:h(B)?b_:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ee=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,r_)],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",g_,[...M[22]||(M[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,G1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7e02965"]]),k_=["disabled"],w_={class:"em-idxw__list"},E_={class:"em-idxw__list-head"},v_=["onClick"],N_={class:"em-idxw__item-name"},$_={key:0,class:"em-idxw__badge"},x_={class:"em-idxw__item-cnt"},I_={key:0,class:"em-idxw__empty"},S_={key:0,class:"em-idxw__edit"},C_={class:"em-idxw__form"},R_={class:"em-field em-idxw__name"},V_={class:"em-field"},A_=["value"],T_={class:"em-idxw__transfer"},M_={class:"em-idxw__pane"},B_={class:"em-idxw__pane-head"},D_={class:"em-idxw__cols"},O_=["onClick"],L_={key:0,class:"em-idxw__empty"},P_={class:"em-idxw__arrows"},z_={class:"em-idxw__pane"},U_={class:"em-idxw__pane-head"},H_={class:"em-idxw__cols"},F_={class:"em-idxw__col-name"},G_={class:"em-idxw__col-ops"},Y_=["disabled","onClick"],W_=["disabled","onClick"],K_=["onClick"],q_={key:0,class:"em-idxw__empty"},X_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},j_=Ue(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 O;S.some(z=>z.modelId===r.value)||(r.value=((O=S[0])==null?void 0:O.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(S=>S.modelId===r.value)??null),c=n.computed(()=>{var S;return new Set(((S=s.value)==null?void 0:S.columns.map(O=>O.columnRef))??[])}),d=n.computed(()=>l.value.filter(S=>!c.value.has(S.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(S){var z;const O=(z=S.dbAttrs[0])==null?void 0:z.physicalName;return O&&O!==S.name?`${S.name} (${O})`:S.name}function h(S){const O=l.value.find(z=>z.modelId===S);return O?f(O):S}function m(S,O){i.value&&o.updateIndex(i.value.modelId,S,O)}function p(){var O;if(!i.value)return;const S=Oe();o.addIndex(i.value.modelId,{modelId:S,name:`idx_${(((O=i.value.indexes)==null?void 0:O.length)??0)+1}`,unique:!1,columns:[]}),r.value=S}function y(S){i.value&&o.removeIndex(i.value.modelId,S)}function b(S){s.value&&m(s.value.modelId,{parameters:S.trim()===""?void 0:S})}function _(S){const O=new Set(u.value);O.has(S)?O.delete(S):O.add(S),u.value=O}function A(){const S=s.value;if(!S||!u.value.size)return;const O=[...u.value].map(z=>({columnRef:z,descending:!1}));m(S.modelId,{columns:[...S.columns,...O]}),u.value=new Set}function g(S){const O=s.value;O&&m(O.modelId,{columns:O.columns.filter((z,F)=>F!==S)})}function N(S,O){const z=s.value;z&&m(z.modelId,{columns:z.columns.map((F,ne)=>ne===S?{...F,descending:O}:F)})}function te(S,O){const z=s.value;if(!z)return;const F=S+O;if(F<0||F>=z.columns.length)return;const ne=[...z.columns];[ne[S],ne[F]]=[ne[F],ne[S]],m(z.modelId,{columns:ne})}return(S,O)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",w_,[n.createElementVNode("div",E_,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":z.modelId===r.value}]),onClick:F=>r.value=z.modelId},[n.createElementVNode("span",N_,n.toDisplayString(z.name||"(이름 없음)"),1),z.unique?(n.openBlock(),n.createElementBlock("span",$_,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",x_,n.toDisplayString(z.columns.length),1)],10,v_))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",I_,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",S_,[n.createElementVNode("div",C_,[n.createElementVNode("label",R_,[O[4]||(O[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":O[0]||(O[0]=z=>m(s.value.modelId,{name:z}))},null,8,["model-value"]),n.createVNode(mn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":O[1]||(O[1]=z=>m(s.value.modelId,{unique:z}))},null,8,["model-value"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:O[2]||(O[2]=z=>y(s.value.modelId))})]),n.createElementVNode("label",V_,[O[5]||(O[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:O[3]||(O[3]=z=>b(z.target.value))},null,40,A_)]),n.createElementVNode("div",T_,[n.createElementVNode("div",M_,[n.createElementVNode("div",B_,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",D_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,z=>(n.openBlock(),n.createElementBlock("li",{key:z.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(z.modelId)}]),onClick:F=>_(z.modelId)},n.toDisplayString(f(z)),11,O_))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",L_,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",P_,[n.createVNode(n.unref(ie.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:A},null,8,["disabled"])]),n.createElementVNode("div",z_,[n.createElementVNode("div",U_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",H_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(z,F)=>(n.openBlock(),n.createElementBlock("li",{key:F,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",F_,n.toDisplayString(h(z.columnRef)),1),n.createVNode(n.unref(ie.BSCheckbox),{name:`idxw-desc-${F}`,class:"em-check",label:"DESC","model-value":z.descending,"onUpdate:modelValue":ne=>N(F,ne)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",G_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:F===0,onClick:ne=>te(F,-1)},"↑",8,Y_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:F===s.value.columns.length-1,onClick:ne=>te(F,1)},"↓",8,W_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:ne=>g(F)},"✕",8,K_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",q_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",X_,"인덱스를 선택하거나 추가하세요."))],8,k_)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),Z_={class:"em-op-src"},J_={class:"em-op-src__actions"},Vd=Ue(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=ie.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",Z_,[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",J_,[n.createVNode(n.unref(ie.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-2150d2fc"]]),Q_=["disabled"],ek={class:"em-ow__toolbar"},tk={class:"em-ow__count"},nk={class:"em-ow__scroll"},ok={class:"em-ow__table"},ik={class:"c-del"},ak={key:0},lk=Ue(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.useModal(),a=n.computed(()=>o.state.logical.entities.find(p=>p.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(p){return p==="none"?"(없음)":p}const c=p=>p;function d(p,y){a.value&&o.updateOperation(a.value.modelId,p.modelId,y)}function u(p,y,b){d(p,{description:{...p.description,[y]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,y){d(p,{personalInfoAttributeType:y==="none"?void 0:y})}function m(p){i.openModal({component:Vd,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:y=>d(p,{sourceCode:y})}})}return(p,y)=>{var b,_;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",tk,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:y[0]||(y[0]=A=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",nk,[n.createElementVNode("table",ok,[y[2]||(y[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??[],A=>{var g;return n.openBlock(),n.createElementBlock("tr",{key:A.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-name-${A.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":A.name,"onUpdate:modelValue":N=>d(A,{name:N})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":A.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":N=>N&&d(A,{visibility:N})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSTextInput),{name:`ow-desc-${A.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((g=A.description)==null?void 0:g.ko)??"","onUpdate:modelValue":N=>u(A,"ko",N)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":f(A),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":N=>N&&h(A,N)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:A.sourceCode?"본문 ●":"본문",onClick:N=>m(A)},null,8,["caption","onClick"])]),n.createElementVNode("td",ik,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:N=>n.unref(o).removeOperation(a.value.modelId,A.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",ak,[...y[1]||(y[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,Q_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),rk={class:"em-detail__tabs"},sk=["onClick"],ck=Ue(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=ie.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(ie.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",rk,[(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,sk)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Sd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(__,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(j_,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(lk,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-67239153"]]);function Pi(e,t,o){e.openModal({component:ck,bind:{controller:n.markRaw(t),entityId:o}})}const Ad="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function dk(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Oe(),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=Oe();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Oe()}for(const a of t.indexes??[]){a.modelId=Oe();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const pn=Symbol("editorController");function Td(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zi(e,t){const o=[];for(const i of t.remove)o.push(xn(e,i));for(const i of t.update)o.push(en(e,i.attributeId,i.patch));for(const i of t.add)o.push(Rt(e,i));return o}function Pn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function zn(e,t){const o=[];for(const[i,a]of fm(e,t,Oe))o.push(...zi(i,a));return o}function Md(e,t,o){const i=new Set(o.remove);return Pn(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 El(e,t){const o=to(e,t,Oe),i=zi(t,o),a=Md(e,t,o);return i.push(...zn(a,t)),i}function Bd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Oe()}))}function uk(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,p)=>Math.max(m,p.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let h="id";for(let m=2;f.has(h);m++)h=`id${m}`;a={modelId:Oe(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Oe(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(Rt(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 h=e.associations.find(b=>b.modelId===f.embedded.associationRef);if(!h)continue;const m=h.end1.entityRef===u.modelId,p=m?h.end1:h.end2,y=m?h.end2:h.end1;l.push({ownerId:u.modelId,dispId:f.modelId,assocId:h.modelId,end1:{entityRef:u.modelId,multiplicity:p.multiplicity,navigable:p.navigable,composition:!1},end2:{entityRef:t,multiplicity:y.multiplicity,navigable:y.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(h=>h.ownerId===u.modelId).map(h=>h.dispId));return f.size?{...u,attributes:u.attributes.filter(h=>!f.has(h.modelId))}:u}),associations:e.associations.map(u=>{const f=l.find(h=>h.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=to(r,t,Oe);for(const u of l){const f=s.add.find(h=>{var m;return((m=h.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of l)i.push(xn(u.ownerId,u.dispId)),i.push(Zo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...zi(t,s));const c=Md(r,t,s);return i.push(...zn(c,t)),i}function fk(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(g=>g.modelId===c);if(!d||d.attributes.some(g=>{var N;return((N=g.embedded)==null?void 0:N.associationRef)===l.modelId}))continue;const u=Oe(),f=d.attributes.reduce((g,N)=>Math.max(g,N.order),-1)+1,h=new Set(d.attributes.map(g=>g.name)),m=a(o.name);let p=m;for(let g=2;h.has(p);g++)p=`${m}${g}`;const y=o.attributes.filter(g=>!g.identifier&&!g.derivedFrom).flatMap(g=>g.dbAttrs).map(g=>({...g,modelId:Oe()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(Rt(c,b));const _=r?"end2":"end1",A=r?"end1":"end2";i.push(Zo(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Oe()},[A]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function mk(e=Td(),t={}){var Te,De;const o=n.reactive(e);let i=new Ia(o);const a=n.ref(t.embeddableCatalog??[]),l=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),h=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),p=n.ref(!1),y=n.ref(!1),b=n.ref(0),_=n.ref(null);let A=0;const g=E=>{if(t.onNotice){t.onNotice(E);return}_.value={text:E,id:++A}},N=n.ref(((Te=t.meta)==null?void 0:Te.schemaVersion)??1),te=n.ref(((De=t.meta)==null?void 0:De.opWriteEnabled)??!1),S=n.computed(()=>N.value>=2&&te.value),O=t.historyTransport,z=n.computed(()=>S.value&&O!==void 0),F=t.restoreTransport,ne=n.ref(0),re=n.computed(()=>S.value&&oe.value&&F!==void 0);async function L(E){if(!F||!oe.value)return{ok:!1,reason:"unavailable"};const T=await F(E);return T.ok&&ne.value++,T}const oe=n.ref(!(N.value>=2&&te.value===!1)),k=n.ref("LOGICAL_PHYSICAL"),W=n.ref("straight"),R=n.ref(!0),G=n.ref(!0),H=n.ref(null),ae=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?{entityId:H.value.entityId,attrId:H.value.anchor}:null}),v=n.computed(()=>{var E;return((E=H.value)==null?void 0:E.kind)==="attribute"?H.value.ids:[]}),q=n.computed(()=>{var E,T;return((E=H.value)==null?void 0:E.kind)==="entity"?H.value.id:((T=H.value)==null?void 0:T.kind)==="attribute"?H.value.entityId:null}),le=n.ref(null);let me=0;const he=n.ref(null),se=n.ref(null);let ce=t.meta;function ye(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,b.value++})}ye();let ke=null,Re=null;function xe(){Re==null||Re(),Re=null,ke=null}function pe(){if(xe(),!S.value||!t.opTransport)return;const E=new ss({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:T=>{oe.value=!1,se.value=T},onError:t.onOpError});E.seed((ce==null?void 0:ce.revSeed)??{}),Re=E.attach(i),ke=E}pe();const X=n.computed(()=>jl(o.logical,o.layout)),K=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),w=n.computed(()=>pr(o.logical,K.value)),C=n.computed(()=>{const E=new Map;for(const T of w.value){if(!T.targetRef)continue;const I=E.get(T.targetRef);I?I.push(T):E.set(T.targetRef,[T])}return E}),V=E=>{oe.value&&i.execute(E)},Y=E=>o.layout.entityLayouts.some(T=>T.entityRef===E&&!!T.locked),J=E=>o.layout.groupLayouts.some(T=>T.groupRef===E&&!!T.locked),ge=E=>{const T=o.logical.associations.find(I=>I.modelId===E);return!!T&&(Y(T.end1.entityRef)||Y(T.end2.entityRef))},we=(E,T,I)=>{if(Y(E))return;const M=en(E,T,I),B=Pn(o.logical,E,be=>be.map(Q=>Q.modelId===T?{...Q,...I}:Q)),de=zn(B,E);V(de.length?Fe("속성 수정",[M,...de]):M)};function Ne(E){const T=E.map(Z=>o.layout.entityLayouts.find(j=>j.entityRef===Z)).filter(Z=>!!Z);if(!T.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,M=1/0,B=-1/0,de=-1/0;for(const Z of T){const j=Z.geo.size.width||220,ue=Z.geo.size.height||140;I=Math.min(I,Z.geo.location.x),M=Math.min(M,Z.geo.location.y),B=Math.max(B,Z.geo.location.x+j),de=Math.max(de,Z.geo.location.y+ue)}const be=40,Q=28;return{location:{x:I-be,y:M-be-Q},size:{width:B-I+be*2,height:de-M+be*2+Q}}}function _e(E,T,I){var Z;const M=o.layout.groupLayouts.find(j=>j.groupRef===E),B=(M==null?void 0:M.geo.location)??T,de=T.x-B.x,be=T.y-B.y,Q=[Rr(E,T),...I.map(j=>$n(j.id,j.location))];if(de||be){const j=new Set(((Z=o.logical.groups.find(ue=>ue.modelId===E))==null?void 0:Z.memberEntityRefs)??[]);for(const ue of o.logical.associations){if(!j.has(ue.end1.entityRef)||!j.has(ue.end2.entityRef))continue;const x=o.layout.associationLayouts.find(D=>D.associationRef===ue.modelId);x&&x.waypoints.length&&Q.push(Yr(ue.modelId,de,be))}for(const ue of(M==null?void 0:M.memberNoteRefs)??[]){const x=o.layout.notes.find(D=>D.modelId===ue);x&&Q.push(eo(ue,{x:x.geo.location.x+de,y:x.geo.location.y+be}))}}return Q}const Ce={state:o,resolved:X,issues:w,issuesByRef:C,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:y,revision:b,notice:_,editable:oe,schemaVersion:N,opWriteEnabled:te,opMode:S,opConflict:se,historyTransport:O,historyAvailable:z,restoreTransport:F,restoreAvailable:re,restoreToSeq:L,reloadRequest:ne,displayMode:k,routingMode:W,showGrid:R,showMinimap:G,selection:H,selectedAttr:ae,selectedAttrIds:v,inspectedEntityId:q,focusRequest:le,clipboard:he,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(E){oe.value=E&&S.value},setEmbeddableCatalog(E){a.value=E},setGroupCodeCatalog(E){l.value=E},setPredefinedCustomTypeCatalog(E){r.value=E},selectAttribute(E,T,I="replace"){const M=H.value,B=(M==null?void 0:M.kind)==="attribute"&&M.entityId===E;if(I==="replace"||!B){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}if(I==="toggle"){const x=M.ids.includes(T),D=x?M.ids.filter(U=>U!==T):[...M.ids,T];if(!D.length){H.value=null;return}const $=x&&M.anchor===T?D[D.length-1]:x?M.anchor:T;H.value={kind:"attribute",entityId:E,ids:D,anchor:$};return}const de=o.logical.entities.find(x=>x.modelId===E),be=[...(de==null?void 0:de.attributes)??[]].sort((x,D)=>x.order-D.order).map(x=>x.modelId),Q=be.indexOf(M.anchor),Z=be.indexOf(T);if(Q<0||Z<0){H.value={kind:"attribute",entityId:E,ids:[T],anchor:T};return}const[j,ue]=Q<=Z?[Q,Z]:[Z,Q];H.value={kind:"attribute",entityId:E,ids:be.slice(j,ue+1),anchor:M.anchor}},moveAttributeFocus(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(be=>be.modelId===T.entityId);if(!I||!I.attributes.length)return!1;const M=I.attributes.findIndex(be=>be.modelId===T.anchor);if(M<0)return!1;const B=Math.min(Math.max(M+E,0),I.attributes.length-1);if(B===M)return!0;const de=I.attributes[B].modelId;return H.value={kind:"attribute",entityId:T.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(E){const T=H.value;if((T==null?void 0:T.kind)!=="attribute")return!1;const I=o.logical.entities.find(x=>x.modelId===T.entityId);if(!I)return!1;const M=I.attributes,B=new Set(T.ids),de=M.map((x,D)=>B.has(x.modelId)?D:-1).filter(x=>x>=0);if(!de.length)return!1;const be=Math.min(...de),Q=M.filter(x=>!B.has(x.modelId)),Z=M.slice(0,be).filter(x=>!B.has(x.modelId)).length;let j;if(E<0){if(Z<=0)return!0;j=Z-1}else{if(Q.length-Z<=0)return!0;j=Z+1}if(Y(T.entityId))return!0;const ue=M.filter(x=>B.has(x.modelId)).map(x=>x.modelId);return V(Va(T.entityId,ue,j)),!0},deleteSelection(){if(!oe.value)return!1;const E=H.value;if(!E)return!1;if(E.kind==="attribute"){if(Y(E.entityId))return!1;const T=E.ids;if(!T.length)return!1;T.length===1?Ce.removeAttribute(E.entityId,T[0]):Ce.removeAttributes(E.entityId,T)}else if(E.kind==="entity"){if(Y(E.id))return!1;Ce.removeEntity(E.id)}else if(E.kind==="note")Ce.removeNote(E.id);else if(E.kind==="group"){if(J(E.id))return!1;Ce.removeGroup(E.id)}else Ce.removeAssociation(E.id);return H.value=null,!0},nudgeNodes(E,T,I){if(!E.length||T===0&&I===0)return!1;const M=new Set(o.logical.entities.map(j=>j.modelId)),B=new Set(o.logical.groups.map(j=>j.modelId)),de=new Set(o.layout.notes.map(j=>j.modelId)),be=new Set;for(const j of E){if(!B.has(j))continue;const ue=o.logical.groups.find(x=>x.modelId===j);for(const x of(ue==null?void 0:ue.memberEntityRefs)??[])be.add(x)}const Q=[],Z=[];for(const j of E)if(B.has(j)){if(J(j))continue;const ue=o.layout.groupLayouts.find(U=>U.groupRef===j);if(!ue)continue;const x=o.logical.groups.find(U=>U.modelId===j),D=((x==null?void 0:x.memberEntityRefs)??[]).map(U=>{var ee;const P=((ee=o.layout.entityLayouts.find(fe=>fe.entityRef===U))==null?void 0:ee.geo.location)??{x:0,y:0};return{id:U,location:{x:P.x+T,y:P.y+I}}}),$={x:ue.geo.location.x+T,y:ue.geo.location.y+I};Q.push(Fe("그룹 이동",_e(j,$,D))),Z.push("g:"+j)}else if(M.has(j)){if(be.has(j)||Y(j))continue;const ue=o.layout.entityLayouts.find(x=>x.entityRef===j);if(!ue)continue;Q.push($n(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("e:"+j)}else if(de.has(j)){const ue=o.layout.notes.find(x=>x.modelId===j);if(!ue)continue;Q.push(eo(j,{x:ue.geo.location.x+T,y:ue.geo.location.y+I})),Z.push("n:"+j)}return Q.length?(V(Fe("이동",Q,"nudge:"+Z.sort().join(","))),!0):!1},requestFocus(E){le.value={id:E,nonce:++me}},undo:()=>{oe.value&&i.undo()},redo:()=>{oe.value&&i.redo()},markSaved:()=>{oe.value&&(ke==null||ke.flush(),i.markSavePoint())},loadDiagram(E,T){xe(),o.logical=E.logical,o.layout=E.layout,i=new Ia(o),ye(),N.value=(T==null?void 0:T.schemaVersion)??1,te.value=(T==null?void 0:T.opWriteEnabled)??!1,oe.value=!(N.value>=2&&te.value===!1),ce=T,se.value=null,H.value=null,m.value=i.canUndo,p.value=i.canRedo,y.value=i.isDirty,pe()},flush(){ke==null||ke.flush()},whenOpsSettled(){return(ke==null?void 0:ke.whenSettled())??Promise.resolve()},addEntity(E="NewEntity",T={x:80,y:80}){const I=Oe(),M={modelId:I,name:E,stereotype:"JPA_ENTITY",table:{physicalName:E.toLowerCase()},attributes:[{modelId:Oe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Oe(),physicalName:"id",dataType:"BIGINT"}]}]};return V(Sa(M,{location:{...T},size:{width:220,height:140}})),I},renameEntity(E,T){Y(E)||V(Er(E,T))},updateEntity(E,T){if(Y(E))return;const I=wr(E,T),M=o.logical.entities.find(be=>be.modelId===E),B=T.stereotype==="JPA_EMBEDDABLE"&&!!M&&M.stereotype!=="JPA_EMBEDDABLE",de=!!T.stereotype&&T.stereotype!=="JPA_EMBEDDABLE"&&!!M&&M.stereotype==="JPA_EMBEDDABLE";if(B&&M){const be=M.attributes.filter(x=>x.identifier&&!x.derivedFrom).map(x=>en(E,x.modelId,{identifier:!1})),Q=Pn({...o.logical,entities:o.logical.entities.map(x=>x.modelId===E?{...x,stereotype:"JPA_EMBEDDABLE"}:x)},E,x=>x.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),Z=El(Q,E),j=fk(o.logical,E),ue=[I,...be,...Z,...j];V(ue.length>1?Fe("임베더블 변환",ue):I);return}if(de){const be=uk(o.logical,E),Q=[I,...be];V(Q.length>1?Fe("엔터티 전환",Q):I);return}V(I)},moveEntity(E,T){Y(E)||V($n(E,T))},resizeEntity(E,T){Y(E)||V(vr(E,T))},removeEntity(E){Y(E)||V(kr(E))},setEntitySwatch(E,T){V(Nr(E,T))},setEntityCollapsed(E,T){V($r(E,T))},setEntityLocked(E,T){V(xr(E,T))},isEntityLocked(E){return Y(E)},collapseAll(){V(Ca(!0))},expandAll(){V(Ca(!1))},setAttributeSwatch(E,T,I){V(Xo(E,T,I))},dragGroup(E,T,I){J(E)||V(Fe("그룹 이동",_e(E,T,I)))},resizeGroup(E,T){J(E)||V(Vr(E,T))},setGroupSwatch(E,T){V(Ar(E,T))},setGroupLocked(E,T){V(Tr(E,T))},isGroupLocked(E){return J(E)},updateGroup(E,T){J(E)||V(Ir(E,T))},createGroup(E,T){if(!E.length)return null;const I=[];for(const de of o.logical.groups)for(const be of E)de.memberEntityRefs.includes(be)&&I.push(jo(de.modelId,be));const M=Oe(),B={modelId:M,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...E]};return I.push(Ra(B,Ne(E))),V(Fe("그룹 생성",I)),H.value=null,M},addEmptyGroup(E,T){const I=Oe();return V(Ra({modelId:I,name:T?{ko:T}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...E},size:{width:360,height:260}})),I},removeGroup(E){J(E)||V(Sr(E))},dropEntity(E,T,I){var de;if(Y(E))return;const M=((de=o.logical.groups.find(be=>be.memberEntityRefs.includes(E)))==null?void 0:de.modelId)??null,B=[$n(E,T)];M!==I&&(M&&B.push(jo(M,E)),I&&B.push(Cr(I,E))),V(Fe("이동",B))},ungroupEntity(E){const T=o.logical.groups.find(I=>I.memberEntityRefs.includes(E));T&&V(jo(T.modelId,E))},dropNote(E,T,I){var de;const M=((de=o.layout.groupLayouts.find(be=>{var Q;return(Q=be.memberNoteRefs)==null?void 0:Q.includes(E)}))==null?void 0:de.groupRef)??null,B=[eo(E,T)];M!==I&&(M&&B.push(es(M,E)),I&&B.push(Qr(I,E))),V(Fe("이동",B))},addPredefinedEmbed(E,T){if(Y(E))return;const I=a.value.find(Z=>Z.type===T),M=o.logical.entities.find(Z=>Z.modelId===E);if(!I||!M)return;const B=M.attributes.reduce((Z,j)=>Math.max(Z,j.order),-1)+1,de=Oe(),be=I.fields.map(()=>({modelId:Oe(),physicalName:"",dataType:""})),Q={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:be};return V(Rt(E,Q)),de},addAttribute(E,T={}){if(Y(E))return T.modelId??"";const I=o.logical.entities.find(ue=>ue.modelId===E),M=I?I.attributes.length:0,B=T.modelId??Oe(),de=T.name??`field${M}`,be={modelId:B,name:de,type:T.type??ka,attrType:T.attrType??"NORMAL",identifier:T.identifier??!1,notNull:T.notNull??!1,order:M,dbAttrs:T.dbAttrs??[{modelId:Oe(),physicalName:de,dataType:"VARCHAR",length:255}],...T},Q=Rt(E,be),Z=Pn(o.logical,E,ue=>[...ue,be]),j=zn(Z,E);return V(j.length?Fe("속성 추가",[Q,...j]):Q),B},addDivider(E){if(Y(E))return"";const T=o.logical.entities.find(de=>de.modelId===E),I=T?T.attributes.length:0,M=Oe();return V(Rt(E,{modelId:M,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),M},updateAttribute(E,T,I){we(E,T,I)},setAttributeGroupCode(E,T,I){we(E,T,{groupCode:I,type:I?qn:ka})},setEmbedColumns(E,T,I){var Z,j;if(Y(E))return;const M=en(E,T,{dbAttrs:I}),B=(Z=o.logical.entities.find(ue=>ue.modelId===E))==null?void 0:Z.attributes.find(ue=>ue.modelId===T),de=(j=B==null?void 0:B.embedded)==null?void 0:j.associationRef,be=de?o.logical.associations.find(ue=>ue.modelId===de):void 0,Q=[];be&&de&&(be.end1.legacyEmbedRaw&&Q.push(In(de,"end1",{legacyEmbedRaw:void 0})),be.end2.legacyEmbedRaw&&Q.push(In(de,"end2",{legacyEmbedRaw:void 0}))),V(Q.length?Fe("임베드 컬럼 수정",[M,...Q]):M)},removeAttribute(E,T){if(Y(E))return;if(ti(o.logical,E,T)){g(Ad);return}const I=xn(E,T),M=Pn(o.logical,E,de=>de.filter(be=>be.modelId!==T)),B=zn(M,E);V(B.length?Fe("속성 삭제",[I,...B]):I)},removeAttributes(E,T){var Q;if(!T.length||Y(E))return;const I=T.filter(Z=>!ti(o.logical,E,Z));if(I.length<T.length&&g(Ad),!I.length)return;const M=I.map(Z=>xn(E,Z)),B=new Set(I),de=Pn(o.logical,E,Z=>Z.filter(j=>!B.has(j.modelId))),be=[...M,...zn(de,E)];V(be.length===1?be[0]:Fe("속성 삭제",be)),((Q=H.value)==null?void 0:Q.kind)==="attribute"&&H.value.entityId===E&&(H.value=null)},setAttributeSwatches(E,T,I){T.length&&(T.length===1?V(Xo(E,T[0],I)):V(Fe("속성 색상",T.map(M=>Xo(E,M,I)))))},reorderAttributes(E,T,I){!T.length||Y(E)||V(Va(E,T,I))},addIndex(E,T){Y(E)||V(zr(E,T))},updateIndex(E,T,I){Y(E)||V(Ur(E,T,I))},removeIndex(E,T){Y(E)||V(Hr(E,T))},addOperation(E,T={}){var be;if(Y(E))return T.modelId??"";const I=o.logical.entities.find(Q=>Q.modelId===E),M=((be=I==null?void 0:I.operations)==null?void 0:be.length)??0,B=T.modelId??Oe(),de={modelId:B,name:T.name??`method${M}`,visibility:T.visibility??"PACKAGE",order:M,...T};return V(Mr(E,de)),B},updateOperation(E,T,I){Y(E)||V(Br(E,T,I))},removeOperation(E,T){Y(E)||V(Dr(E,T))},reorderOperations(E,T,I){!T.length||Y(E)||V(Or(E,T,I))},setOperationSwatch(E,T,I){V(Lr(E,T,I))},addAssociation(E,T,I,M){if(Y(E)||Y(T))return"";const B=Oe(),de={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:T,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},be={...o.logical,associations:[...o.logical.associations,de]},Q=to(be,T,Oe),Z=Q.add[0];Z&&(de.end2.attributeRef=Z.modelId);const j={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(Z==null?void 0:Z.modelId)??M},ue=Aa(de,j),x=zi(T,Q);return V(x.length?Fe("관계 추가",[ue,...x]):ue),B},addEmbedAssociation(E,T){if(Y(E))return;const I=o.logical.entities.find(ee=>ee.modelId===E),M=o.logical.entities.find(ee=>ee.modelId===T);if(!I||!M||M.stereotype!=="JPA_EMBEDDABLE")return;const B=Oe(),de=Oe(),be=Oe(),Q=I.attributes.reduce((ee,fe)=>Math.max(ee,fe.order),-1)+1,Z=Bd(M),j=ee=>ee&&ee.charAt(0).toLowerCase()+ee.slice(1),ue=new Set(I.attributes.map(ee=>ee.name)),x=j(M.name);let D=x;for(let ee=2;ue.has(D);ee++)D=`${x}${ee}`;const $={modelId:de,name:D,type:M.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:Q,dbAttrs:Z,embedded:{associationRef:B,embeddableRef:T}},U={modelId:B,end1:{entityRef:E,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:be},end2:{entityRef:T,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},P={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return V(Fe("임베드 추가",[Rt(E,$),Aa(U,P)])),B},setEmbedCollectionMode(E,T){if(ge(E))return;const I=o.logical.associations.find(j=>j.modelId===E);if(!I)return;let M,B;for(const j of o.logical.entities){const ue=j.attributes.find(x=>{var D;return((D=x.embedded)==null?void 0:D.associationRef)===E&&x.attrType==="EMBED_OWN"});if(ue){M=j.modelId,B=ue;break}}if(!M||!B)return;const de=B.embedded.embeddableRef,be=I.end2.entityRef===de?"end2":"end1",Q=I[be],Z=Q.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(T==="COLLECTION"?Z:!Z))if(T==="COLLECTION")V(Fe("임베드 컬렉션 전환",[en(M,B.modelId,{dbAttrs:[]}),In(E,be,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...Q.jpa,collectionType:"LIST"}})]));else{const j=o.logical.entities.find(ue=>ue.modelId===de);if(!j)return;V(Fe("임베드 단일 전환",[en(M,B.modelId,{dbAttrs:Bd(j)}),In(E,be,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...Q.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(E){if(ge(E))return;const T=o.logical.associations.find(be=>be.modelId===E),I=Pr(E);if(!T){V(I);return}for(const be of o.logical.entities){const Q=be.attributes.find(Z=>{var j;return((j=Z.embedded)==null?void 0:j.associationRef)===E});if(Q){V(Fe("임베드 삭제",[I,xn(be.modelId,Q.modelId)]));return}}const M=T.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(be=>be.modelId!==E)},de=El(B,M);V(de.length?Fe("관계 삭제",[I,...de]):I)},setAssociationIdentifying(E,T){if(ge(E))return;const I=o.logical.associations.find(Q=>Q.modelId===E),M=Zo(E,{identifying:T});if(!I||I.identifying===T){V(M);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(Q=>Q.modelId===E?{...Q,identifying:T}:Q)},be=El(de,B);V(be.length?Fe("식별 관계 변경",[M,...be]):M)},updateAssociationEnd(E,T,I){ge(E)||V(In(E,T,I))},moveWaypoint(E,T,I){V(Fr(E,T,I))},addWaypoint(E,T,I){V(Kr(E,T,I))},removeWaypoint(E,T){V(Gr(E,T))},clearWaypoints(E){V(Wr(E))},addNote(E="메모",T={x:80,y:80}){const I=Oe();return V(qr({modelId:I,memo:E,geo:{location:{...T},size:{width:200,height:120}}})),I},removeNote(E){V(Xr(E))},moveNote(E,T){V(eo(E,T))},resizeNote(E,T){V(jr(E,T))},setNoteMemo(E,T){V(Zr(E,T))},setNoteSwatch(E,T){V(Jr(E,T))},addNoteConnection(E,T){V(ts(E,T))},removeNoteConnection(E,T){V(ns(E,T))},moveNoteConnectionWaypoint(E,T,I,M){V(os(E,T,I,M))},addNoteConnectionWaypoint(E,T,I,M){V(is(E,T,I,M))},removeNoteConnectionWaypoint(E,T,I){V(as(E,T,I))},clearNoteConnectionWaypoints(E,T){V(ls(E,T))},autoLayout(){const E=Ql(o.logical,o.layout);E.length&&V(Fe("자동 배치",E.map(T=>$n(T.id,T.location))))},copy(){const E=H.value;if((E==null?void 0:E.kind)==="attribute"){const de=o.logical.entities.find(Q=>Q.modelId===E.entityId);if(!de)return;const be=[...de.attributes].sort((Q,Z)=>Q.order-Z.order).filter(Q=>E.ids.includes(Q.modelId));if(!be.length)return;he.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:be}));return}const T=q.value;if(!T)return;const I=o.logical.entities.find(de=>de.modelId===T),M=o.layout.entityLayouts.find(de=>de.entityRef===T);if(!I)return;const B=(M==null?void 0:M.geo)??{location:{x:80,y:80},size:{width:220,height:140}};he.value=JSON.parse(JSON.stringify({kind:"entity",entity:I,geo:B}))},paste(){if(!oe.value)return;const E=he.value;if(!E)return;if(E.kind==="attribute"){const M=q.value;if(!M)return;const B=o.logical.entities.find(ue=>ue.modelId===M);if(!B)return;const de=new Set(B.attributes.map(ue=>ue.name)),be=new Set(B.attributes.flatMap(ue=>ue.dbAttrs.map(x=>x.physicalName))),Q=B.attributes.length,Z=[],j=E.attributes.map((ue,x)=>{const D=JSON.parse(JSON.stringify(ue));D.modelId=Oe();for(const $ of D.dbAttrs)$.modelId=Oe();de.has(D.name)&&(D.name=`${D.name}_copy`);for(const $ of D.dbAttrs)$.physicalName&&be.has($.physicalName)&&($.physicalName=`${$.physicalName}_copy`);return D.order=Q+x,Z.push(D.modelId),Rt(M,D)});V(j.length===1?j[0]:Fe("속성 붙여넣기",j)),H.value={kind:"attribute",entityId:M,ids:Z,anchor:Z[Z.length-1]};return}const T=dk(E.entity),I={location:{x:E.geo.location.x+40,y:E.geo.location.y+40},size:{...E.geo.size}};V(Sa(T,I)),H.value={kind:"entity",id:T.modelId}}};return Ce}const Ui=Symbol("groupHover"),Dd=Symbol("groupDrag"),Un=Symbol("relationHighlight"),pk={key:0,class:"em-sel","aria-hidden":"true"},hk=["title","aria-expanded","disabled"],yk={class:"em-entity__stereotype"},gk={key:1,class:"em-entity__name"},bk=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],_k=["onPointerdown"],kk={key:1,class:"em-entity__divider-label"},wk=["title"],Ek={class:"em-key-slot"},vk={class:"em-key-slot"},Nk={key:0,class:"em-entity__type"},$k=["onClick"],xk={class:"em-entity__attrname"},Ik={class:"em-entity__type"},Sk=["data-op"],Ck=["onPointerdown"],Rk={class:"em-entity__op-vis","aria-hidden":"true"},Vk=["title"],Ak={key:4,class:"em-entity__footer"},Od=Ue(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=ie.useModal();function a(){o&&Pi(i,o,t.id)}const l=n.inject(Ui,null),r=n.inject(Un,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)),h=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var Q;return((Q=o==null?void 0:o.selection.value)==null?void 0:Q.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),y=n.computed(()=>{var Q;return o&&((Q=o.selectedAttr.value)==null?void 0:Q.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>y.value.size>0);function _(Q,Z){const j=Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,Q.modelId,j)}const A=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),g=n.computed(()=>t.data.entity),N=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),te=n.computed(()=>t.data.collapsed??!1),S=n.computed(()=>t.data.locked??!1);function O(){s.value&&(o==null||o.setEntityCollapsed(t.id,!te.value))}const z=n.computed(()=>N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL"),F=n.computed(()=>{const Q=N.value==="PHYSICAL"||N.value==="LOGICAL_PHYSICAL",Z={};for(const j of g.value.attributes){const ue=j.attrType.startsWith("RELATION")&&j.dbAttrs.length>0;Z[j.modelId]={pk:j.identifier,fk:ue&&Q,required:j.notNull&&!j.identifier}}return Z});function ne(Q){if(!Q)return"";const Z=[];return Q.pk&&Q.fk?Z.push("PFK (식별 외래키)"):Q.pk?Z.push("PK (기본키)"):Q.fk&&Z.push("FK (외래키)"),Q.required&&Z.push("필수 (NOT NULL)"),Z.join(" · ")}const re=n.computed(()=>{const Q=_l(it(t.data.style)),Z={};return Q&&(Z["--em-header-bg"]=Q.bar,Z["--em-header-fg"]=Q.barOn),Z});function L(Q){var Z,j;return(j=_l(it((Z=t.data.attributeStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}const oe=n.computed(()=>[...g.value.operations??[]].sort((Q,Z)=>Q.order-Z.order)),k=n.computed(()=>N.value==="CLASS"&&oe.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(Q){return Q?W[Q]:"~"}function G(Q){var Z,j;return(j=_l(it((Z=t.data.operationStyles)==null?void 0:Z[Q.modelId])))==null?void 0:j.text}function H(Q,Z,j){switch(N.value){case"CLASS":return[{text:Q}];case"PHYSICAL":return[{text:j||Q}];case"LOGICAL":return[Z?{text:Z}:{text:"(논리명)",missing:!0}];default:{const ue=Z?{text:Z}:{text:"(논리명)",missing:!0};return j?[ue,{text:` · ${j}`}]:[ue]}}}function ae(Q){var Z,j,ue;return v(Q)?[{text:Q.name}]:H(Q.name,(j=(Z=Q.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:j.ko,((ue=Q.dbAttrs[0])==null?void 0:ue.physicalName)??"")}function v(Q){return Q.attrType.startsWith("EMBED")&&Q.dbAttrs.length>0}function q(Q){return Q.attrType==="DIVIDER"}function le(Q){if(Q.attrType!=="EMBED_PREDEF")return Q.dbAttrs;const Z=o==null?void 0:o.embeddableCatalog.value.find(ue=>ue.type===Q.type);if(!Z)return Q.dbAttrs;const j=Xn(g.value.attributes.flatMap(ue=>ue.dbAttrs));return Q.dbAttrs.map((ue,x)=>{const D=Z.fields[x],$=Yo(ue,j);return $?{...ue,physicalName:$.physicalName,logicalName:ue.logicalName??(D==null?void 0:D.logicalName),dataType:ue.dataType||(D==null?void 0:D.dataType)||""}:D?{...ue,physicalName:ue.physicalName||D.physicalName,logicalName:ue.logicalName??D.logicalName,dataType:ue.dataType||D.dataType,length:ue.length??D.length}:ue})}function me(Q){var Z;return H(Q.physicalName,(Z=Q.logicalName)==null?void 0:Z.ko,Q.physicalName)}function he(Q){const Z=fr(Q,(o==null?void 0:o.state.logical.associations)??[]);return Ea(N.value,Q,Z)}const se=n.computed(()=>{var Q,Z,j;return H(g.value.name,(Z=(Q=g.value.table)==null?void 0:Q.logicalName)==null?void 0:Z.ko,((j=g.value.table)==null?void 0:j.physicalName)??"")}),ce=n.ref(!1),ye=n.ref(""),ke=n.ref(null);async function Re(){var Q,Z;s.value&&(ye.value=g.value.name,ce.value=!0,await n.nextTick(),(Q=ke.value)==null||Q.focus(),(Z=ke.value)==null||Z.select())}function xe(){if(!ce.value)return;ce.value=!1;const Q=ye.value.trim();Q&&Q!==g.value.name&&(o==null||o.renameEntity(t.id,Q))}function pe(){o==null||o.addAttribute(t.id)}function X(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:K,findNode:w}=Le(),C=n.ref(null),V=n.computed(()=>{const Q=C.value??t.data.size;return Q?{width:`${Q.width}px`,minHeight:`${Q.height}px`}:void 0});let Y=null;function J(Q){var ue,x,D;if(!s.value)return;Q.stopPropagation();const Z=(ue=w(t.id))==null?void 0:ue.dimensions,j=K({x:Q.clientX,y:Q.clientY});Y={fx:j.x,fy:j.y,w:(Z==null?void 0:Z.width)??((x=t.data.size)==null?void 0:x.width)??200,h:(Z==null?void 0:Z.height)??((D=t.data.size)==null?void 0:D.height)??120},Q.target.setPointerCapture(Q.pointerId)}function ge(Q){if(!Y)return;const Z=K({x:Q.clientX,y:Q.clientY});C.value={width:Math.max(40,Y.w+(Z.x-Y.fx)),height:Math.max(40,Y.h+(Z.y-Y.fy))}}function we(Q){var Z,j,ue;if(Y&&C.value&&o){const x=(Z=w(t.id))==null?void 0:Z.dimensions;o.resizeEntity(t.id,{width:Math.round((x==null?void 0:x.width)??C.value.width),height:Math.round((x==null?void 0:x.height)??C.value.height)})}Y=null,C.value=null,(ue=(j=Q.target).releasePointerCapture)==null||ue.call(j,Q.pointerId)}const Ne=n.ref(null),_e=n.ref(null);function Ce(Q,Z){if(!s.value)return;Z.stopPropagation(),Z.preventDefault();const j=y.value,ue=j.has(Q.modelId)?new Set(j):new Set([Q.modelId]);_e.value={ids:ue,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId)}function Te(Q){if(!_e.value||!Ne.value)return;const Z=Array.from(Ne.value.querySelectorAll(".em-entity__row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;_e.value={..._e.value,dropIndex:j,lineY:x}}function De(){const Q=_e.value;if(_e.value=null,!Q||Q.dropIndex<0)return;const Z=g.value.attributes,j=Z.filter(U=>Q.ids.has(U.modelId)).map(U=>U.modelId),ue=Z.filter((U,P)=>Q.ids.has(U.modelId)&&P<Q.dropIndex).length,x=Q.dropIndex-ue,D=Z.filter(U=>!Q.ids.has(U.modelId)).map(U=>U.modelId);[...D.slice(0,x),...j,...D.slice(x)].join(",")!==Z.map(U=>U.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,j,x))}function E(){_e.value=null}const T=n.ref(null),I=n.ref(null);function M(Q,Z){s.value&&(Z.stopPropagation(),Z.preventDefault(),I.value={id:Q.modelId,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId))}function B(Q){if(!I.value||!T.value)return;const Z=Array.from(T.value.querySelectorAll(".em-entity__op-row"));if(!Z.length)return;let j=Z.length;for(let D=0;D<Z.length;D++){const $=Z[D].getBoundingClientRect();if(Q.clientY<$.top+$.height/2){j=D;break}}const ue=Z[Z.length-1],x=j<Z.length?Z[j].offsetTop:ue.offsetTop+ue.offsetHeight;I.value={...I.value,dropIndex:j,lineY:x}}function de(){const Q=I.value;if(I.value=null,!Q||Q.dropIndex<0)return;const j=oe.value.findIndex(x=>x.modelId===Q.id);if(j<0)return;const ue=Q.dropIndex-(j<Q.dropIndex?1:0);ue!==j&&(o==null||o.reorderOperations(t.id,[Q.id],ue))}function be(){I.value=null}return(Q,Z)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":A.value,"is-selected":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value,"is-locked":S.value}]),style:n.normalizeStyle(V.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",pk,[...Z[7]||(Z[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(re.value),onDblclick:n.withModifiers(Re,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:te.value?"펼치기":"접기","aria-expanded":!te.value,disabled:!s.value,onClick:n.withModifiers(O,["stop"]),onPointerdown:Z[0]||(Z[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Z[1]||(Z[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(te.value?"▸":"▾"),41,hk),n.createElementVNode("span",yk,"«"+n.toDisplayString(g.value.stereotype)+"»",1),ce.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ke,"onUpdate:modelValue":Z[2]||(Z[2]=j=>ye.value=j),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(xe,["enter"]),Z[3]||(Z[3]=n.withKeys(j=>ce.value=!1,["esc"]))],onBlur:xe,onPointerdown:Z[4]||(Z[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",gk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.value,(j,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":j.missing})},n.toDisplayString(j.text),3))),128))])),S.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:"편집 잠금"})):n.createCommentVNode("",!0)],36),te.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Ne,class:"em-entity__attrs"},[_e.value&&_e.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${_e.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value.attributes,j=>{var ue,x,D,$;return n.openBlock(),n.createElementBlock(n.Fragment,{key:j.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":y.value.has(j.modelId),"is-dragging":(ue=_e.value)==null?void 0:ue.ids.has(j.modelId),"is-embed":v(j),"is-divider":q(j),nodrag:q(j)&&s.value}]),"data-attr":j.modelId,onClick:n.withModifiers(U=>_(j,U),["stop"]),onPointerdown:U=>q(j)?Ce(j,U):void 0,onPointermove:U=>q(j)?Te(U):void 0,onPointerup:U=>q(j)?De():void 0,onPointercancel:U=>q(j)?E():void 0},[s.value&&!q(j)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:U=>Ce(j,U),onPointermove:Te,onPointerup:De,onPointercancel:E,onClick:Z[5]||(Z[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,_k)):n.createCommentVNode("",!0),q(j)?(n.openBlock(),n.createElementBlock("span",kk,n.toDisplayString(j.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(dn),{id:`l:${j.modelId}`,type:"target",position:n.unref(Se).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ne(F.value[j.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Ek,[(x=F.value[j.modelId])!=null&&x.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(D=F.value[j.modelId])!=null&&D.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",vk,[v(j)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):($=F.value[j.modelId])!=null&&$.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,wk),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:L(j)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ae(j),(U,P)=>(n.openBlock(),n.createElementBlock("span",{key:P,class:n.normalizeClass({"em-entity__missing":U.missing})},n.toDisplayString(U.text),3))),128))],4),he(j)?(n.openBlock(),n.createElementBlock("span",Nk,n.toDisplayString(he(j)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(dn),{id:`r:${j.modelId}`,type:"source",position:n.unref(Se).Right,class:"em-handle"},null,8,["id","position"])],64))],42,bk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v(j)&&z.value?le(j):[],U=>(n.openBlock(),n.createElementBlock("li",{key:`${j.modelId}:${U.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":y.value.has(j.modelId)}]),onClick:n.withModifiers(P=>_(j,P),["stop"])},[Z[8]||(Z[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",xk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me(U),(P,ee)=>(n.openBlock(),n.createElementBlock("span",{key:ee,class:n.normalizeClass({"em-entity__missing":P.missing})},n.toDisplayString(P.text),3))),128))]),n.createElementVNode("span",Ik,n.toDisplayString(U.dataType),1)],10,$k))),128))],64)}),128))],512)),!te.value&&k.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:T,class:"em-entity__ops"},[I.value&&I.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${I.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(oe.value,j=>{var ue;return n.openBlock(),n.createElementBlock("li",{key:j.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((ue=I.value)==null?void 0:ue.id)===j.modelId}]),"data-op":j.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:x=>M(j,x),onPointermove:B,onPointerup:de,onPointercancel:be,onClick:Z[6]||(Z[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Ck)):n.createCommentVNode("",!0),n.createElementVNode("span",Rk,n.toDisplayString(R(j.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:G(j)})},n.toDisplayString(j.name)+"()",5)],10,Sk)}),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,Vk)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Ak,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:pe},"+ 속성"),Z[9]||(Z[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:X},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!ce.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:J,onPointermove:ge,onPointerup:we},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-7efbcdb3"]]),Tk={key:0,class:"em-sel","aria-hidden":"true"},Mk={class:"em-group__label"},Bk={class:"em-group__name"},Dk={key:0,class:"em-group__pkg"},Ok={key:1,class:"em-group__flag"},Ld=Ue(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(()=>it(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(pn,null),s=n.computed(()=>!!r&&r.editable.value),c=n.computed(()=>{var F;return!!t.id&&((F=r==null?void 0:r.selection.value)==null?void 0:F.kind)==="group"&&r.selection.value.id===t.id}),d=n.computed(()=>!!t.selected&&!c.value),u=n.inject(Ui,null),f=n.computed(()=>!!t.id&&(u==null?void 0:u.value)===t.id),h=n.inject(Un,null);function m(){t.id&&(h==null||h.setGroupHover(t.id))}function p(){h==null||h.setGroupHover(null)}const y=n.computed(()=>!!h&&h.hoverGroupId.value===t.id),b=n.computed(()=>!!h&&h.hoverGroupId.value!==null&&h.hoverGroupId.value!==t.id),{screenToFlowCoordinate:_,findNode:A}=Le();let g=null,N=null;function te(F){var L;if(!t.id||!s.value)return;F.stopPropagation();const ne=((L=A(t.id))==null?void 0:L.dimensions)??{width:400,height:300},re=_({x:F.clientX,y:F.clientY});g={fx:re.x,fy:re.y,w:ne.width,h:ne.height},F.target.setPointerCapture(F.pointerId)}function S(F){if(!g||!t.id)return;const ne=_({x:F.clientX,y:F.clientY});N={width:Math.max(160,g.w+(ne.x-g.fx)),height:Math.max(120,g.h+(ne.y-g.fy))};const re=A(t.id);re&&(re.style={width:`${N.width}px`,height:`${N.height}px`})}function O(F){var ne,re;g&&N&&t.id&&r&&r.resizeGroup(t.id,N),g=null,N=null,(re=(ne=F.target).releasePointerCapture)==null||re.call(ne,F.pointerId)}const z=n.computed(()=>{const F=o.value.name;return(F==null?void 0:F.ko)||(F==null?void 0:F.en)||(F==null?void 0:F.ja)||(F==null?void 0:F.zh)||o.value.packageName||"그룹"});return(F,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":y.value,"is-dimmed":b.value,"is-selected":c.value,"is-multi-selected":d.value,"is-locked":i.value}]),style:n.normalizeStyle(l.value),onMouseenter:m,onMouseleave:p},[c.value?(n.openBlock(),n.createElementBlock("div",Tk,[...ne[0]||(ne[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",Mk,[n.createElementVNode("span",Bk,n.toDisplayString(z.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Dk,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Ok,"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:te,onPointermove:S,onPointerup:O},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-681f8dc8"]]),Lk={key:0,class:"em-sel","aria-hidden":"true"},Pk={key:2,class:"em-note__text"},Pd=Ue(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(pn,null),i=n.inject(Ui,null),a=n.inject(Un,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>it(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 h=n.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===t.id}),y=n.computed(()=>!!t.selected&&!p.value),b=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:Se.Top},{id:"n-right",pos:Se.Right},{id:"n-bottom",pos:Se.Bottom},{id:"n-left",pos:Se.Left}],A=n.ref(!1),g=n.ref(""),N=n.ref(null);async function te(){var k;r.value&&(g.value=l.value.memo,A.value=!0,await n.nextTick(),(k=N.value)==null||k.focus())}function S(){A.value&&(A.value=!1,g.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,g.value)))}const{screenToFlowCoordinate:O,findNode:z}=Le();let F=null,ne=null;function re(k){var G;if(!r.value)return;k.stopPropagation();const W=((G=z(t.id))==null?void 0:G.dimensions)??l.value.geo.size,R=O({x:k.clientX,y:k.clientY});F={fx:R.x,fy:R.y,w:W.width,h:W.height},k.target.setPointerCapture(k.pointerId)}function L(k){if(!F)return;const W=O({x:k.clientX,y:k.clientY});ne={width:Math.max(140,F.w+(W.x-F.fx)),height:Math.max(60,F.h+(W.y-F.fy))};const R=z(t.id);R&&(R.style={width:`${ne.width}px`,height:`${ne.height}px`})}function oe(k){var W,R;F&&ne&&o&&o.resizeNote(t.id,ne),F=null,ne=null,(R=(W=k.target).releasePointerCapture)==null||R.call(W,k.pointerId)}return(k,W)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":m.value,"is-dimmed":b.value,"is-selected":p.value,"is-multi-selected":y.value}]),style:n.normalizeStyle(c.value),onDblclick:te,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",Lk,[...W[4]||(W[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),A.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":W[0]||(W[0]=R=>g.value=R),class:"em-note__edit nodrag",onBlur:S,onKeydown:W[1]||(W[1]=n.withKeys(R=>A.value=!1,["esc"])),onPointerdown:W[2]||(W[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,g.value]]):(n.openBlock(),n.createElementBlock("div",Pk,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,R=>n.createVNode(n.unref(dn),{id:R.id,key:R.id,type:"source",position:R.pos,class:"em-note-handle",onPointerdown:W[3]||(W[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!A.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:re,onPointermove:L,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),zk=20,Uk=22,Hk=7,Fk=22,zd=31,Ud=7,Gk=20,Hd=11,Fd=11,Yk=zd+Ud;function Wk(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Kk(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Hi(e,t,o){const i=t.x-e.x,a=t.y-e.y,l=Math.hypot(i,a)||1;return{x:e.x+i*o/l,y:e.y+a*o/l}}function Gd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Fi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Yd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Gd(e,t);return[Fi(o,a,l-Math.PI/2),Fi(o,a,l+Math.PI/2)]}function Wd(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 Kd(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=Hi(e,t,zk),[d,u]=Yd(e,t,c,Uk);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}),Wk(o.multiplicity)){const f=Hi(e,t,zd);l.push({cx:f.x,cy:f.y,r:Ud})}if(Kk(o.multiplicity)){const f=Hi(e,t,Hk),[h,m]=Yd(e,t,f,Fk);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.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=Hi(e,t,Gk),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Gd(e,t),f=Fi(d,Hd/2,u-Math.PI/2),h=Fi(d,Hd/2,u+Math.PI/2);r.push({points:[e,f,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=Wd(s,c,Fd,!0),u=Wd(s,c,Fd,!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 qd=200,Xd=120,vl=24;function jd(e){var a,l;if(!e)return{x:0,y:0,width:qd,height:Xd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||qd,i=((l=e.dimensions)==null?void 0:l.height)||Xd;return{x:t.x,y:t.y,width:o,height:i}}function Zd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Jd(e){const t=n.computed(()=>jd(e.sourceNode())),o=n.computed(()=>jd(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var m,p;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,h=((p=e.targetRowY)==null?void 0:p.call(e))??d.y+d.height*2/3;if(Math.abs(h-f)<vl){const y=(f+h)/2;f=y-vl/2,h=y+vl/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??Zd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Zd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?pa(t.value,d,l.value.x):ma(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?pa(o.value,d,r.value.x):ma(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 Nl=Symbol("waypointController"),qk=["d"],Xk=["d"],jk=["d"],Zk=["x1","y1","x2","y2"],Jk=["cx","cy","r"],Qk=["x","y"],ew=["x","y"],tw=["cx","cy","onDblclick"],nw=["x","y","onPointerdown","onDblclick"],Qd=Ue(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Dd,null),s=n.inject(Un,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var pe;return((pe=a==null?void 0:a.selection.value)==null?void 0:pe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const pe=r==null?void 0:r.value;if(!pe||!a)return null;const X=a.resolved.value.entities,K=C=>{var V;return(V=X.find(Y=>Y.entity.modelId===C))==null?void 0:V.groupRef},w=t.data.association;return K(w.end1.entityRef)===pe.groupId&&K(w.end2.entityRef)===pe.groupId?{dx:pe.dx,dy:pe.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),y=n.computed(()=>{const pe=f.value;return h.value.map((X,K)=>K===m.value?p.value:pe?{x:X.x+pe.dx,y:X.y+pe.dy}:X)}),b=n.computed(()=>{var pe;return!!((pe=t.sourceNode.data)!=null&&pe.collapsed)}),_=n.computed(()=>{var pe;return!!((pe=t.targetNode.data)!=null&&pe.collapsed)}),{source:A,target:g,sourceSide:N,targetSide:te,isSelf:S}=Jd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>y.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),O=Yk+4,z=n.computed(()=>S.value?Jl(A.value,g.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?da(A.value,N.value,y.value,g.value,te.value,O):fa(A.value,y.value,g.value)),F=n.computed(()=>S.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(A.value,N.value,y.value,g.value,te.value,O):ha(A.value,y.value,g.value).map((pe,X)=>({point:pe,segIndex:X}))),ne=n.computed(()=>S.value||!l.value?[]:y.value);function re(pe){switch(pe){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function L(pe,X){m.value=pe,p.value={...h.value[pe]},X.target.setPointerCapture(X.pointerId),X.stopPropagation()}function oe(pe){if(m.value<0)return;const X=o({x:pe.clientX,y:pe.clientY});p.value={x:X.x,y:X.y}}function k(pe){var X,K;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(K=(X=pe.target).releasePointerCapture)==null||K.call(X,pe.pointerId)}function W(pe,X){X.stopPropagation(),i==null||i.removePoint(t.id,pe)}function R(pe,X){if(!i)return;const K=o({x:X.clientX,y:X.clientY});i.insertPoint(t.id,pe,{x:K.x,y:K.y})}const G=n.computed(()=>re(t.data.association.end1.multiplicity)),H=n.computed(()=>re(t.data.association.end2.multiplicity)),ae=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),v=n.computed(()=>ae.value==="class"),q=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const pe=Wn(N.value);return{x:A.value.x+pe.x*10,y:A.value.y+pe.y*10}}return y.value[0]??g.value}),le=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const X=Wn(te.value);return{x:g.value.x+X.x*10,y:g.value.y+X.y*10}}const pe=y.value;return pe[pe.length-1]??A.value}),me=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end1.multiplicity,navigable:pe.end1.navigable,composition:pe.end1.composition,otherNavigable:pe.end2.navigable}}),he=n.computed(()=>{const pe=t.data.association;return{multiplicity:pe.end2.multiplicity,navigable:pe.end2.navigable,composition:pe.end2.composition,otherNavigable:pe.end1.navigable}}),se=n.computed(()=>Kd(A.value,q.value,me.value,ae.value)),ce=n.computed(()=>Kd(g.value,le.value,he.value,ae.value)),ye=n.computed(()=>[...se.value.lines,...ce.value.lines]),ke=n.computed(()=>[...se.value.circles,...ce.value.circles]),Re=n.computed(()=>[...se.value.polygons,...ce.value.polygons].map(pe=>`M${pe.points.map(X=>`${X.x},${X.y}`).join(" L")} Z`)),xe=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(pe,X)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:z.value,fill:"none",class:"em-edge__hit"},null,8,qk),n.createElementVNode("path",{d:z.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,Xk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Re.value,(K,w)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${w}`,d:K,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",xe.value])},null,10,jk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ye.value,(K,w)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${w}`,x1:K.x1,y1:K.y1,x2:K.x2,y2:K.y2,class:n.normalizeClass(["em-edge__marker",xe.value])},null,10,Zk))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ke.value,(K,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${w}`,cx:K.cx,cy:K.cy,r:K.r,class:n.normalizeClass(["em-edge__marker",xe.value])},null,10,Jk))),128)),v.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(A).x+8,y:n.unref(A).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(G.value),11,Qk),n.createElementVNode("text",{x:n.unref(g).x-8,y:n.unref(g).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,ew)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,(K,w)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${w}`,cx:K.point.x,cy:K.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(C=>R(K.segIndex,C),["stop"])},null,42,tw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.value,(K,w)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${w}`,x:K.x-5,y:K.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:C=>L(w,C),onPointermove:oe,onPointerup:k,onDblclick:C=>W(w,C)},null,42,nw))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Dt=(e=>(e.Lines="lines",e.Dots="dots",e))(Dt||{});const eu=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]}`})},tu=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Dt.Lines+"",Dt.Dots+"";const ow={[Dt.Dots]:"#81818a",[Dt.Lines]:"#eee"},iw=["id","x","y","width","height","patternTransform"],aw={key:2,height:"100",width:"100"},lw=["fill"],rw=["x","y","fill"],sw={name:"Background",compatConfig:{MODE:3}},cw=n.defineComponent({...sw,props:{id:{},variant:{default:()=>Dt.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}=Le(),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,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,h*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||ow[e.variant||Dt.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(Dt).Lines?(n.openBlock(),n.createBlock(n.unref(eu),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Dt).Dots?(n.openBlock(),n.createBlock(n.unref(tu),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",aw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,lw)])):n.createCommentVNode("",!0)])],8,iw)]),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))}}),dw={name:"ControlButton",compatConfig:{MODE:3}},uw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},fw={type:"button",class:"vue-flow__controls-button"};function mw(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",fw,[n.renderSlot(e.$slots,"default")])}const hn=uw(dw,[["render",mw]]),pw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},hw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function yw(e,t){return n.openBlock(),n.createElementBlock("svg",pw,hw)}const gw={render:yw},bw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},_w=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function kw(e,t){return n.openBlock(),n.createElementBlock("svg",bw,_w)}const ww={render:kw},Ew={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},vw=[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 Nw(e,t){return n.openBlock(),n.createElementBlock("svg",Ew,vw)}const $w={render:Nw},xw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Iw=[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 Sw(e,t){return n.openBlock(),n.createElementBlock("svg",xw,Iw)}const Cw={render:Sw},Rw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Vw=[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 Aw(e,t){return n.openBlock(),n.createElementBlock("svg",Rw,Vw)}const Tw={render:Aw},Mw={name:"Controls",compatConfig:{MODE:3}},Bw=n.defineComponent({...Mw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ic.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}=Le(),h=n.toRef(()=>o.value||i.value||a.value),m=n.toRef(()=>d.value.zoom<=u.value),p=n.toRef(()=>d.value.zoom>=f.value);function y(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function A(){l(!h.value),t("interactionChange",!h.value)}return(g,N)=>(n.openBlock(),n.createBlock(n.unref($d),{class:"vue-flow__controls",position:g.position},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"top"),g.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(g.$slots,"control-zoom-in",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:y},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(gw))))])]),_:3},8,["disabled"])]),n.renderSlot(g.$slots,"control-zoom-out",{},()=>[n.createVNode(hn,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:b},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(ww))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),g.showFitView?n.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hn,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(g.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($w))))])]),_:3})]):n.createCommentVNode("",!0),g.showInteractive?n.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(n.openBlock(),n.createBlock(hn,{key:0,class:"vue-flow__controls-interactive",onClick:A},{default:n.withCtx(()=>[h.value?n.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Tw))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Cw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}});var Dw={value:()=>{}};function $l(){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 Gi(o)}function Gi(e){this._=e}function Ow(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}})}Gi.prototype=$l.prototype={constructor:Gi,on:function(e,t){var o=this._,i=Ow(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Lw(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]=nu(o[a],e.name,t);else if(t==null)for(a in o)o[a]=nu(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 Gi(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 Lw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function nu(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Dw,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var xl="http://www.w3.org/1999/xhtml";const ou={svg:"http://www.w3.org/2000/svg",xhtml:xl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yi(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 Pw(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===xl&&t.documentElement.namespaceURI===xl?t.createElement(e):t.createElementNS(o,e)}}function zw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iu(e){var t=Yi(e);return(t.local?zw:Pw)(t)}function Uw(){}function Il(e){return e==null?Uw:function(){return this.querySelector(e)}}function Hw(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 ft(i,this._parents)}function Fw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Gw(){return[]}function au(e){return e==null?Gw:function(){return this.querySelectorAll(e)}}function Yw(e){return function(){return Fw(e.apply(this,arguments))}}function Ww(e){typeof e=="function"?e=Yw(e):e=au(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 lu(e){return function(){return this.matches(e)}}function ru(e){return function(t){return t.matches(e)}}var Kw=Array.prototype.find;function qw(e){return function(){return Kw.call(this.children,e)}}function Xw(){return this.firstElementChild}function jw(e){return this.select(e==null?Xw:qw(typeof e=="function"?e:ru(e)))}var Zw=Array.prototype.filter;function Jw(){return Array.from(this.children)}function Qw(e){return function(){return Zw.call(this.children,e)}}function eE(e){return this.selectAll(e==null?Jw:Qw(typeof e=="function"?e:ru(e)))}function tE(e){typeof e!="function"&&(e=lu(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 su(e){return new Array(e.length)}function nE(){return new ft(this._enter||this._groups.map(su),this._parents)}function Wi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Wi.prototype={constructor:Wi,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 oE(e){return function(){return e}}function iE(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 Wi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function aE(e,t,o,i,a,l,r){var s,c,d=new Map,u=t.length,f=l.length,h=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(h[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 Wi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function lE(e){return e.__data__}function rE(e,t){if(!arguments.length)return Array.from(this,lE);var o=t?aE:iE,i=this._parents,a=this._groups;typeof e!="function"&&(e=oE(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],h=f.length,m=sE(e.call(u,u&&u.__data__,d,i)),p=m.length,y=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,y,b,_,m,t);for(var A=0,g=0,N,te;A<p;++A)if(N=y[A]){for(A>=g&&(g=A+1);!(te=b[g])&&++g<p;);N._next=te||null}}return r=new ft(r,i),r._enter=s,r._exit=c,r}function sE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cE(){return new ft(this._exit||this._groups.map(su),this._parents)}function dE(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 uE(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,h=s[c]=new Array(f),m,p=0;p<f;++p)(m=d[p]||u[p])&&(h[p]=m);for(;c<a;++c)s[c]=o[c];return new ft(s,this._parents)}function fE(){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 mE(e){e||(e=pE);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}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 pE(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function hE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yE(){return Array.from(this)}function gE(){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 bE(){let e=0;for(const t of this)++e;return e}function _E(){return!this.node()}function kE(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 wE(e){return function(){this.removeAttribute(e)}}function EE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vE(e,t){return function(){this.setAttribute(e,t)}}function NE(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $E(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function xE(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 IE(e,t){var o=Yi(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?EE:wE:typeof t=="function"?o.local?xE:$E:o.local?NE:vE)(o,t))}function cu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function SE(e){return function(){this.style.removeProperty(e)}}function CE(e,t,o){return function(){this.style.setProperty(e,t,o)}}function RE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function VE(e,t,o){return arguments.length>1?this.each((t==null?SE:typeof t=="function"?RE:CE)(e,t,o??"")):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||cu(e).getComputedStyle(e,null).getPropertyValue(t)}function AE(e){return function(){delete this[e]}}function TE(e,t){return function(){this[e]=t}}function ME(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function BE(e,t){return arguments.length>1?this.each((t==null?AE:typeof t=="function"?ME:TE)(e,t)):this.node()[e]}function du(e){return e.trim().split(/^|\s+/)}function Sl(e){return e.classList||new uu(e)}function uu(e){this._node=e,this._names=du(e.getAttribute("class")||"")}uu.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 fu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function mu(e,t){for(var o=Sl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function DE(e){return function(){fu(this,e)}}function OE(e){return function(){mu(this,e)}}function LE(e,t){return function(){(t.apply(this,arguments)?fu:mu)(this,e)}}function PE(e,t){var o=du(e+"");if(arguments.length<2){for(var i=Sl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?LE:t?DE:OE)(o,t))}function zE(){this.textContent=""}function UE(e){return function(){this.textContent=e}}function HE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function FE(e){return arguments.length?this.each(e==null?zE:(typeof e=="function"?HE:UE)(e)):this.node().textContent}function GE(){this.innerHTML=""}function YE(e){return function(){this.innerHTML=e}}function WE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function KE(e){return arguments.length?this.each(e==null?GE:(typeof e=="function"?WE:YE)(e)):this.node().innerHTML}function qE(){this.nextSibling&&this.parentNode.appendChild(this)}function XE(){return this.each(qE)}function jE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ZE(){return this.each(jE)}function JE(e){var t=typeof e=="function"?e:iu(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function QE(){return null}function ev(e,t){var o=typeof e=="function"?e:iu(e),i=t==null?QE:typeof t=="function"?t:Il(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function tv(){var e=this.parentNode;e&&e.removeChild(this)}function nv(){return this.each(tv)}function ov(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function iv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function av(e){return this.select(e?iv:ov)}function lv(e){return arguments.length?this.property("__data__",e):this.node().__data__}function rv(e){return function(t){e.call(this,t,this.__data__)}}function sv(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 cv(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 dv(e,t,o){return function(){var i=this.__on,a,l=rv(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 uv(e,t,o){var i=sv(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?dv:cv,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function pu(e,t,o){var i=cu(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 fv(e,t){return function(){return pu(this,e,t)}}function mv(e,t){return function(){return pu(this,e,t.apply(this,arguments))}}function pv(e,t){return this.each((typeof t=="function"?mv:fv)(e,t))}function*hv(){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 hu=[null];function ft(e,t){this._groups=e,this._parents=t}function vo(){return new ft([[document.documentElement]],hu)}function yv(){return this}ft.prototype=vo.prototype={constructor:ft,select:Hw,selectAll:Ww,selectChild:jw,selectChildren:eE,filter:tE,data:rE,enter:nE,exit:cE,join:dE,merge:uE,selection:yv,order:fE,sort:mE,call:hE,nodes:yE,node:gE,size:bE,empty:_E,each:kE,attr:IE,style:VE,property:BE,classed:PE,text:FE,html:KE,raise:XE,lower:ZE,append:JE,insert:ev,remove:nv,clone:av,datum:lv,on:uv,dispatch:pv,[Symbol.iterator]:hv};function qt(e){return typeof e=="string"?new ft([[document.querySelector(e)]],[document.documentElement]):new ft([[e]],hu)}function gv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Xt(e,t){if(e=gv(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 Cl={capture:!0,passive:!1};function Rl(e){e.preventDefault(),e.stopImmediatePropagation()}function bv(e){var t=e.document.documentElement,o=qt(e).on("dragstart.drag",Rl,Cl);"onselectstart"in t?o.on("selectstart.drag",Rl,Cl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _v(e,t){var o=e.document.documentElement,i=qt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Rl,Cl),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 Vl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function yu(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function No(){}var $o=.7,Ki=1/$o,Fn="\\s*([+-]?\\d+)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",It="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kv=/^#([0-9a-f]{3,8})$/,wv=new RegExp(`^rgb\\(${Fn},${Fn},${Fn}\\)$`),Ev=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),vv=new RegExp(`^rgba\\(${Fn},${Fn},${Fn},${xo}\\)$`),Nv=new RegExp(`^rgba\\(${It},${It},${It},${xo}\\)$`),$v=new RegExp(`^hsl\\(${xo},${It},${It}\\)$`),xv=new RegExp(`^hsla\\(${xo},${It},${It},${xo}\\)$`),gu={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};Vl(No,Io,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bu,formatHex:bu,formatHex8:Iv,formatHsl:Sv,formatRgb:_u,toString:_u});function bu(){return this.rgb().formatHex()}function Iv(){return this.rgb().formatHex8()}function Sv(){return Nu(this).formatHsl()}function _u(){return this.rgb().formatRgb()}function Io(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=kv.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?ku(t):o===3?new ct(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?qi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?qi(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=wv.exec(e))?new ct(t[1],t[2],t[3],1):(t=Ev.exec(e))?new ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vv.exec(e))?qi(t[1],t[2],t[3],t[4]):(t=Nv.exec(e))?qi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$v.exec(e))?vu(t[1],t[2]/100,t[3]/100,1):(t=xv.exec(e))?vu(t[1],t[2]/100,t[3]/100,t[4]):gu.hasOwnProperty(e)?ku(gu[e]):e==="transparent"?new ct(NaN,NaN,NaN,0):null}function ku(e){return new ct(e>>16&255,e>>8&255,e&255,1)}function qi(e,t,o,i){return i<=0&&(e=t=o=NaN),new ct(e,t,o,i)}function Cv(e){return e instanceof No||(e=Io(e)),e?(e=e.rgb(),new ct(e.r,e.g,e.b,e.opacity)):new ct}function Al(e,t,o,i){return arguments.length===1?Cv(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}Vl(ct,Al,yu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?$o:Math.pow($o,e),new ct(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ct(yn(this.r),yn(this.g),yn(this.b),Xi(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:wu,formatHex:wu,formatHex8:Rv,formatRgb:Eu,toString:Eu}));function wu(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function Rv(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Eu(){const e=Xi(this.opacity);return`${e===1?"rgb(":"rgba("}${yn(this.r)}, ${yn(this.g)}, ${yn(this.b)}${e===1?")":`, ${e})`}`}function Xi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return e=yn(e),(e<16?"0":"")+e.toString(16)}function vu(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 Nu(e){if(e instanceof bt)return new bt(e.h,e.s,e.l,e.opacity);if(e instanceof No||(e=Io(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 Vv(e,t,o,i){return arguments.length===1?Nu(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}Vl(bt,Vv,yu(No,{brighter(e){return e=e==null?Ki:Math.pow(Ki,e),new bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?$o:Math.pow($o,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(Tl(e>=240?e-240:e+120,a,i),Tl(e,a,i),Tl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new bt($u(this.h),ji(this.s),ji(this.l),Xi(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=Xi(this.opacity);return`${e===1?"hsl(":"hsla("}${$u(this.h)}, ${ji(this.s)*100}%, ${ji(this.l)*100}%${e===1?")":`, ${e})`}`}}));function $u(e){return e=(e||0)%360,e<0?e+360:e}function ji(e){return Math.max(0,Math.min(1,e||0))}function Tl(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 xu=e=>()=>e;function Av(e,t){return function(o){return e+o*t}}function Tv(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 Mv(e){return(e=+e)==1?Iu:function(t,o){return o-t?Tv(t,o,e):xu(isNaN(t)?o:t)}}function Iu(e,t){var o=t-e;return o?Av(e,o):xu(isNaN(e)?t:e)}const Su=(function e(t){var o=Mv(t);function i(a,l){var r=o((a=Al(a)).r,(l=Al(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Iu(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 jt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Ml=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bl=new RegExp(Ml.source,"g");function Bv(e){return function(){return e}}function Dv(e){return function(t){return e(t)+""}}function Ov(e,t){var o=Ml.lastIndex=Bl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Ml.exec(e))&&(a=Bl.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:jt(i,a)})),o=Bl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Dv(c[0].x):Bv(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 Cu=180/Math.PI,Dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ru(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)*Cu,skewX:Math.atan(c)*Cu,scaleX:r,scaleY:s}}var Zi;function Lv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dl:Ru(t.a,t.b,t.c,t.d,t.e,t.f)}function Pv(e){return e==null||(Zi||(Zi=document.createElementNS("http://www.w3.org/2000/svg","g")),Zi.setAttribute("transform",e),!(e=Zi.transform.baseVal.consolidate()))?Dl:(e=e.matrix,Ru(e.a,e.b,e.c,e.d,e.e,e.f))}function Vu(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function l(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push("translate(",null,t,null,o);p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f||h)&&m.push("translate("+f+t+h+o)}function r(d,u,f,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:f.push(a(f)+"rotate(",null,i)-2,x:jt(d,u)})):u&&f.push(a(f)+"rotate("+u+i)}function s(d,u,f,h){d!==u?h.push({i:f.push(a(f)+"skewX(",null,i)-2,x:jt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var y=m.push(a(m)+"scale(",null,",",null,")");p.push({i:y-4,x:jt(d,f)},{i:y-2,x:jt(u,h)})}else(f!==1||h!==1)&&m.push(a(m)+"scale("+f+","+h+")")}return function(d,u){var f=[],h=[];return d=e(d),u=e(u),l(d.translateX,d.translateY,u.translateX,u.translateY,f,h),r(d.rotate,u.rotate,f,h),s(d.skewX,u.skewX,f,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,h),d=u=null,function(m){for(var p=-1,y=h.length,b;++p<y;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var zv=Vu(Lv,"px, ","px)","deg)"),Uv=Vu(Pv,", ",")",")"),Hv=1e-12;function Au(e){return((e=Math.exp(e))+1/e)/2}function Fv(e){return((e=Math.exp(e))-1/e)/2}function Gv(e){return((e=Math.exp(2*e))-1)/(e+1)}const Yv=(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],h=r[2],m=u-s,p=f-c,y=m*m+p*p,b,_;if(y<Hv)_=Math.log(h/d)/t,b=function(O){return[s+O*m,c+O*p,d*Math.exp(t*O*_)]};else{var A=Math.sqrt(y),g=(h*h-d*d+i*y)/(2*d*o*A),N=(h*h-d*d-i*y)/(2*h*o*A),te=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(N*N+1)-N);_=(S-te)/t,b=function(O){var z=O*_,F=Au(te),ne=d/(o*A)*(F*Gv(t*z+te)-Fv(te));return[s+ne*m,c+ne*p,d*F/Au(t*z+te)]}}return b.duration=_*1e3*t/Math.SQRT2,b}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 Gn=0,So=0,Co=0,Tu=1e3,Ji,Ro,Qi=0,bn=0,ea=0,Vo=typeof performance=="object"&&performance.now?performance:Date,Mu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ol(){return bn||(Mu(Wv),bn=Vo.now()+ea)}function Wv(){bn=0}function ta(){this._call=this._time=this._next=null}ta.prototype=Bu.prototype={constructor:ta,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ol():+o)+(t==null?0:+t),!this._next&&Ro!==this&&(Ro?Ro._next=this:Ji=this,Ro=this),this._call=e,this._time=o,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};function Bu(e,t,o){var i=new ta;return i.restart(e,t,o),i}function Kv(){Ol(),++Gn;for(var e=Ji,t;e;)(t=bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gn}function Du(){bn=(Qi=Vo.now())+ea,Gn=So=0;try{Kv()}finally{Gn=0,Xv(),bn=0}}function qv(){var e=Vo.now(),t=e-Qi;t>Tu&&(ea-=t,Qi=e)}function Xv(){for(var e,t=Ji,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:Ji=o);Ro=e,Ll(i)}function Ll(e){if(!Gn){So&&(So=clearTimeout(So));var t=e-bn;t>24?(e<1/0&&(So=setTimeout(Du,e-Vo.now()-ea)),Co&&(Co=clearInterval(Co))):(Co||(Qi=Vo.now(),Co=setInterval(qv,Tu)),Gn=1,Mu(Du))}}function Ou(e,t,o){var i=new ta;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var jv=$l("start","end","cancel","interrupt"),Zv=[],Lu=0,Pu=1,Pl=2,na=3,zu=4,zl=5,oa=6;function ia(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Jv(e,o,{name:t,index:i,group:a,on:jv,tween:Zv,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Lu})}function Ul(e,t){var o=_t(e,t);if(o.state>Lu)throw new Error("too late; already scheduled");return o}function St(e,t){var o=_t(e,t);if(o.state>na)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 Jv(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Bu(l,0,o.time);function l(d){o.state=Pu,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,h,m;if(o.state!==Pu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===na)return Ou(r);m.state===zu?(m.state=oa,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=oa,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Ou(function(){o.state===na&&(o.state=zu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Pl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Pl){for(o.state=na,a=new Array(h=o.tween.length),u=0,f=-1;u<h;++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=zl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===zl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=oa,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function aa(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>Pl&&i.state<zl,i.state=oa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function Qv(e){return this.each(function(){aa(this,e)})}function eN(e,t){var o,i;return function(){var a=St(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 tN(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=St(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 nN(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?eN:tN)(o,e,t))}function Hl(e,t,o){var i=e._id;return e.each(function(){var a=St(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return _t(a,i).value[t]}}function Uu(e,t){var o;return(typeof t=="number"?jt:t instanceof Io?Su:(o=Io(t))?(t=o,Su):Ov)(e,t)}function oN(e){return function(){this.removeAttribute(e)}}function iN(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aN(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 lN(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 rN(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 sN(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 cN(e,t){var o=Yi(e),i=o==="transform"?Uv:Uu;return this.attrTween(e,typeof t=="function"?(o.local?sN:rN)(o,i,Hl(this,"attr."+e,t)):t==null?(o.local?iN:oN)(o):(o.local?lN:aN)(o,i,t))}function dN(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function uN(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function fN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&uN(e,l)),o}return a._value=t,a}function mN(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&dN(e,l)),o}return a._value=t,a}function pN(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=Yi(e);return this.tween(o,(i.local?fN:mN)(i,t))}function hN(e,t){return function(){Ul(this,e).delay=+t.apply(this,arguments)}}function yN(e,t){return t=+t,function(){Ul(this,e).delay=t}}function gN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hN:yN)(t,e)):_t(this.node(),t).delay}function bN(e,t){return function(){St(this,e).duration=+t.apply(this,arguments)}}function _N(e,t){return t=+t,function(){St(this,e).duration=t}}function kN(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bN:_N)(t,e)):_t(this.node(),t).duration}function wN(e,t){if(typeof t!="function")throw new Error;return function(){St(this,e).ease=t}}function EN(e){var t=this._id;return arguments.length?this.each(wN(t,e)):_t(this.node(),t).ease}function vN(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;St(this,e).ease=o}}function NN(e){if(typeof e!="function")throw new Error;return this.each(vN(this._id,e))}function $N(e){typeof e!="function"&&(e=lu(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 Ot(i,this._parents,this._name,this._id)}function xN(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),h,m=0;m<u;++m)(h=c[m]||d[m])&&(f[m]=h);for(;s<i;++s)r[s]=t[s];return new Ot(r,this._parents,this._name,this._id)}function IN(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 SN(e,t,o){var i,a,l=IN(t)?Ul:St;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function CN(e,t){var o=this._id;return arguments.length<2?_t(this.node(),o).on.on(e):this.each(SN(o,e,t))}function RN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function VN(){return this.on("end.remove",RN(this._id))}function AN(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,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),d[h]=f,ia(d[h],t,o,h,d,_t(u,o)));return new Ot(l,this._parents,t,o)}function TN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=au(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 h=e.call(u,u.__data__,f,c),m,p=_t(u,o),y=0,b=h.length;y<b;++y)(m=h[y])&&ia(m,t,o,y,h,p);l.push(h),r.push(u)}return new Ot(l,r,t,o)}var MN=vo.prototype.constructor;function BN(){return new MN(this._groups,this._parents)}function DN(e,t){var o,i,a;return function(){var l=Hn(this,e),r=(this.style.removeProperty(e),Hn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function Hu(e){return function(){this.style.removeProperty(e)}}function ON(e,t,o){var i,a=o+"",l;return function(){var r=Hn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function LN(e,t,o){var i,a,l;return function(){var r=Hn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Hn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function PN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=St(this,e),d=c.on,u=c.value[l]==null?s||(s=Hu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function zN(e,t,o){var i=(e+="")=="transform"?zv:Uu;return t==null?this.styleTween(e,DN(e,i)).on("end.style."+e,Hu(e)):typeof t=="function"?this.styleTween(e,LN(e,i,Hl(this,"style."+e,t))).each(PN(this._id,e)):this.styleTween(e,ON(e,i,t),o).on("end.style."+e,null)}function UN(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function HN(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&UN(e,r,o)),i}return l._value=t,l}function FN(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,HN(e,t,o??""))}function GN(e){return function(){this.textContent=e}}function YN(e){return function(){var t=e(this);this.textContent=t??""}}function WN(e){return this.tween("text",typeof e=="function"?YN(Hl(this,"text",e)):GN(e==null?"":e+""))}function KN(e){return function(t){this.textContent=e.call(this,t)}}function qN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&KN(a)),t}return i._value=e,i}function XN(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,qN(e))}function jN(){for(var e=this._name,t=this._id,o=Fu(),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);ia(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ot(i,this._parents,e,o)}function ZN(){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=St(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 JN=0;function Ot(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Fu(){return++JN}var Lt=vo.prototype;Ot.prototype={constructor:Ot,select:AN,selectAll:TN,selectChild:Lt.selectChild,selectChildren:Lt.selectChildren,filter:$N,merge:xN,selection:BN,transition:jN,call:Lt.call,nodes:Lt.nodes,node:Lt.node,size:Lt.size,empty:Lt.empty,each:Lt.each,on:CN,attr:cN,attrTween:pN,style:zN,styleTween:FN,text:WN,textTween:XN,remove:VN,tween:nN,delay:gN,duration:kN,ease:EN,easeVarying:NN,end:ZN,[Symbol.iterator]:Lt[Symbol.iterator]};function QN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var e$={time:null,delay:0,duration:250,ease:QN};function t$(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function n$(e){var t,o;e instanceof Ot?(t=e._id,e=e._name):(t=Fu(),(o=e$).time=Ol(),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])&&ia(c,e,t,d,r,o||t$(c,t));return new Ot(i,this._parents,e,t)}vo.prototype.interrupt=Qv,vo.prototype.transition=n$;const la=e=>()=>e;function o$(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 Pt(e,t,o){this.k=e,this.x=t,this.y=o}Pt.prototype={constructor:Pt,scale:function(e){return e===1?this:new Pt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pt(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 Fl=new Pt(1,0,0);Pt.prototype;function Gl(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function i$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function a$(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Gu(){return this.__zoom||Fl}function l$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function r$(){return navigator.maxTouchPoints||"ontouchstart"in this}function s$(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 c$(){var e=i$,t=a$,o=s$,i=l$,a=r$,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Yv,d=$l("start","zoom","end"),u,f,h,m=500,p=150,y=0,b=10;function _(k){k.property("__zoom",Gu).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",ne).filter(a).on("touchstart.zoom",re).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",oe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,W,R,G){var H=k.selection?k.selection():k;H.property("__zoom",Gu),k!==H?te(k,W,R,G):H.interrupt().each(function(){S(this,arguments).event(G).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},_.scaleBy=function(k,W,R,G){_.scaleTo(k,function(){var H=this.__zoom.k,ae=typeof W=="function"?W.apply(this,arguments):W;return H*ae},R,G)},_.scaleTo=function(k,W,R,G){_.transform(k,function(){var H=t.apply(this,arguments),ae=this.__zoom,v=R==null?N(H):typeof R=="function"?R.apply(this,arguments):R,q=ae.invert(v),le=typeof W=="function"?W.apply(this,arguments):W;return o(g(A(ae,le),v,q),H,r)},R,G)},_.translateBy=function(k,W,R,G){_.transform(k,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),r)},null,G)},_.translateTo=function(k,W,R,G,H){_.transform(k,function(){var ae=t.apply(this,arguments),v=this.__zoom,q=G==null?N(ae):typeof G=="function"?G.apply(this,arguments):G;return o(Fl.translate(q[0],q[1]).scale(v.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof R=="function"?-R.apply(this,arguments):-R),ae,r)},G,H)};function A(k,W){return W=Math.max(l[0],Math.min(l[1],W)),W===k.k?k:new Pt(W,k.x,k.y)}function g(k,W,R){var G=W[0]-R[0]*k.k,H=W[1]-R[1]*k.k;return G===k.x&&H===k.y?k:new Pt(k.k,G,H)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function te(k,W,R,G){k.on("start.zoom",function(){S(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,ae=arguments,v=S(H,ae).event(G),q=t.apply(H,ae),le=R==null?N(q):typeof R=="function"?R.apply(H,ae):R,me=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),he=H.__zoom,se=typeof W=="function"?W.apply(H,ae):W,ce=c(he.invert(le).concat(me/he.k),se.invert(le).concat(me/se.k));return function(ye){if(ye===1)ye=se;else{var ke=ce(ye),Re=me/ke[2];ye=new Pt(Re,le[0]-ke[0]*Re,le[1]-ke[1]*Re)}v.zoom(null,ye)}})}function S(k,W,R){return!R&&k.__zooming||new O(k,W)}function O(k,W){this.that=k,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,W),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,W){return this.mouse&&k!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var W=qt(this.that).datum();d.call(k,this.that,new o$(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),W)}};function z(k,...W){if(!e.apply(this,arguments))return;var R=S(this,W).event(k),G=this.__zoom,H=Math.max(l[0],Math.min(l[1],G.k*Math.pow(2,i.apply(this,arguments)))),ae=Xt(k);if(R.wheel)(R.mouse[0][0]!==ae[0]||R.mouse[0][1]!==ae[1])&&(R.mouse[1]=G.invert(R.mouse[0]=ae)),clearTimeout(R.wheel);else{if(G.k===H)return;R.mouse=[ae,G.invert(ae)],aa(this),R.start()}Ao(k),R.wheel=setTimeout(v,p),R.zoom("mouse",o(g(A(G,H),R.mouse[0],R.mouse[1]),R.extent,r));function v(){R.wheel=null,R.end()}}function F(k,...W){if(h||!e.apply(this,arguments))return;var R=k.currentTarget,G=S(this,W,!0).event(k),H=qt(k.view).on("mousemove.zoom",le,!0).on("mouseup.zoom",me,!0),ae=Xt(k,R),v=k.clientX,q=k.clientY;bv(k.view),Gl(k),G.mouse=[ae,this.__zoom.invert(ae)],aa(this),G.start();function le(he){if(Ao(he),!G.moved){var se=he.clientX-v,ce=he.clientY-q;G.moved=se*se+ce*ce>y}G.event(he).zoom("mouse",o(g(G.that.__zoom,G.mouse[0]=Xt(he,R),G.mouse[1]),G.extent,r))}function me(he){H.on("mousemove.zoom mouseup.zoom",null),_v(he.view,G.moved),Ao(he),G.event(he).end()}}function ne(k,...W){if(e.apply(this,arguments)){var R=this.__zoom,G=Xt(k.changedTouches?k.changedTouches[0]:k,this),H=R.invert(G),ae=R.k*(k.shiftKey?.5:2),v=o(g(A(R,ae),G,H),t.apply(this,W),r);Ao(k),s>0?qt(this).transition().duration(s).call(te,v,G,k):qt(this).call(_.transform,v,G,k)}}function re(k,...W){if(e.apply(this,arguments)){var R=k.touches,G=R.length,H=S(this,W,k.changedTouches.length===G).event(k),ae,v,q,le;for(Gl(k),v=0;v<G;++v)q=R[v],le=Xt(q,this),le=[le,this.__zoom.invert(le),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==le[2]&&(H.touch1=le,H.taps=0):(H.touch0=le,ae=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),ae&&(H.taps<2&&(f=le[0],u=setTimeout(function(){u=null},m)),aa(this),H.start())}}function L(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v,q,le;for(Ao(k),ae=0;ae<H;++ae)v=G[ae],q=Xt(v,this),R.touch0&&R.touch0[2]===v.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===v.identifier&&(R.touch1[0]=q);if(v=R.that.__zoom,R.touch1){var me=R.touch0[0],he=R.touch0[1],se=R.touch1[0],ce=R.touch1[1],ye=(ye=se[0]-me[0])*ye+(ye=se[1]-me[1])*ye,ke=(ke=ce[0]-he[0])*ke+(ke=ce[1]-he[1])*ke;v=A(v,Math.sqrt(ye/ke)),q=[(me[0]+se[0])/2,(me[1]+se[1])/2],le=[(he[0]+ce[0])/2,(he[1]+ce[1])/2]}else if(R.touch0)q=R.touch0[0],le=R.touch0[1];else return;R.zoom("touch",o(g(v,q,le),R.extent,r))}}function oe(k,...W){if(this.__zooming){var R=S(this,W).event(k),G=k.changedTouches,H=G.length,ae,v;for(Gl(k),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),ae=0;ae<H;++ae)v=G[ae],R.touch0&&R.touch0[2]===v.identifier?delete R.touch0:R.touch1&&R.touch1[2]===v.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(v=Xt(v,this),Math.hypot(f[0]-v[0],f[1]-v[1])<b)){var q=qt(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:la(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:la(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:la(!!k),_):a},_.extent=function(k){return arguments.length?(t=typeof k=="function"?k:la([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):t},_.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],_):[l[0],l[1]]},_.translateExtent=function(k){return arguments.length?(r[0][0]=+k[0][0],r[1][0]=+k[1][0],r[0][1]=+k[0][1],r[1][1]=+k[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(y=(k=+k)*k,_):Math.sqrt(y)},_.tapDistance=function(k){return arguments.length?(b=+k,_):b},_}const Yu=Symbol("MiniMapSlots"),d$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],u$={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},f$=n.defineComponent({...u$,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(Yu),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,h)=>!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,d$))],64)):n.createCommentVNode("",!0)}}),m$=["width","height","viewBox","aria-labelledby"],p$=["id"],h$=["d","fill","stroke","stroke-width"],y$={name:"MiniMap",compatConfig:{MODE:3}},g$=n.defineComponent({...y$,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:h,d3Zoom:m,getNodesInitialized:p}=Le(),y=n.ref();n.provide(Yu,o);const b=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??a}),_=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??l}),A=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",g=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),te=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),S=n.computed(()=>al(p.value.filter(H=>!H.hidden))),O=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})),z=n.computed(()=>p.value&&p.value.length?ub(S.value,O.value):O.value),F=n.computed(()=>{const H=z.value.width/b.value,ae=z.value.height/_.value;return Math.max(H,ae)}),ne=n.computed(()=>{const H=F.value*b.value,ae=F.value*_.value,v=e.offsetScale*F.value;return{offset:v,x:z.value.x-(H-z.value.width)/2-v,y:z.value.y-(ae-z.value.height)/2-v,width:H+v*2,height:ae+v*2}}),re=n.computed(()=>!ne.value.x||!ne.value.y?"":`
|
|
28
30
|
M${ne.value.x-ne.value.offset},${ne.value.y-ne.value.offset}
|
|
29
31
|
h${ne.value.width+ne.value.offset*2}
|
|
30
32
|
v${ne.value.height+ne.value.offset*2}
|
|
31
33
|
h${-ne.value.width-ne.value.offset*2}z
|
|
32
|
-
M${
|
|
33
|
-
h${
|
|
34
|
+
M${O.value.x+e.maskBorderRadius},${O.value.y}
|
|
35
|
+
h${O.value.width-2*e.maskBorderRadius}
|
|
34
36
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
35
|
-
v${
|
|
37
|
+
v${O.value.height-2*e.maskBorderRadius}
|
|
36
38
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
37
|
-
h${-(
|
|
39
|
+
h${-(O.value.width-2*e.maskBorderRadius)}
|
|
38
40
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
39
|
-
v${-(
|
|
40
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(_.value){const te=Wt(_.value),M=me=>{if(me.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const ye=me.sourceEvent.ctrlKey&&bo()?10:1,ce=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,ue=c.value.zoom*2**(ce*ye);m.value.scaleTo(p.value,ue)},ee=me=>{if(me.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const ye=W.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),ce={x:c.value.x-me.sourceEvent.movementX*ye,y:c.value.y-me.sourceEvent.movementY*ye},ue=[[0,0],[u.value.width,u.value.height]],he=Bl.translate(ce.x,ce.y).scale(c.value.zoom),ve=m.value.constrain()(he,ue,d.value);m.value.transform(p.value,ve)},le=HN().wheelDelta(me=>Ja(me)*(e.zoomStep/10)).on("zoom",e.pannable?ee:()=>{}).on("zoom.wheel",e.zoomable?M:()=>{});te.call(le),H(()=>{te.on("zoom",null)})}},{flush:"post"});function L(H){const[te,M]=Kt(H);t("click",{event:H,position:{x:te,y:M}})}function Q(H,te){const M={event:H,node:te,connectedEdges:cn([te],s.value)};f.miniMapNodeClick(M),t("nodeClick",M)}function v(H,te){const M={event:H,node:te,connectedEdges:cn([te],s.value)};f.miniMapNodeDoubleClick(M),t("nodeDblclick",M)}function T(H,te){const M={event:H,node:te,connectedEdges:cn([te],s.value)};f.miniMapNodeMouseEnter(M),t("nodeMouseenter",M)}function $(H,te){const M={event:H,node:te,connectedEdges:cn([te],s.value)};f.miniMapNodeMouseMove(M),t("nodeMousemove",M)}function P(H,te){const M={event:H,node:te,connectedEdges:cn([te],s.value)};f.miniMapNodeMouseLeave(M),t("nodeMouseleave",M)}return(H,te)=>(n.openBlock(),n.createBlock(n.unref(md),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:_,width:b.value,height:g.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,KN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(h),M=>(n.openBlock(),n.createBlock(YN,{id:M.id,key:M.id,f:"",position:M.computedPosition,dimensions:M.dimensions,selected:M.selected,dragging:M.dragging,style:n.normalizeStyle(M.style),class:n.normalizeClass(q.value(M)),color:y.value(M),"border-radius":H.nodeBorderRadius,"stroke-color":N.value(M),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref(I),type:M.type,hidden:M.hidden,onClick:ee=>Q(ee,M),onDblclick:ee=>v(ee,M),onMouseenter:ee=>T(ee,M),onMousemove:ee=>$(ee,M),onMouseleave:ee=>P(ee,M)},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:re.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,qN)],8,WN))]),_:1},8,["position","class"]))}}),ZN=["d"],JN=["cx","cy","onDblclick"],QN=["x","y","onPointerdown","onDblclick"],e$=Pe(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Oe(),i=n.inject(yl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Pn,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((K,W)=>W===d.value?u.value:K)),{source:p,target:m,sourceSide:h,targetSide:_}=zd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ia(p.value,h.value,f.value,m.value,_.value):la(p.value,f.value,m.value)),g=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?aa(p.value,h.value,f.value,m.value,_.value):ca(p.value,f.value,m.value).map((K,W)=>({point:K,segIndex:W})):[]),I=n.computed(()=>l.value?f.value:[]);function y(K,W){d.value=K,u.value={...c.value[K]},W.target.setPointerCapture(W.pointerId),W.stopPropagation()}function N(K){if(d.value<0)return;const W=o({x:K.clientX,y:K.clientY});u.value={x:W.x,y:W.y}}function q(K){var W,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(W=K.target).releasePointerCapture)==null||ne.call(W,K.pointerId)}function U(K,W){W.stopPropagation(),i==null||i.removePoint(t.id,K)}function X(K,W){if(!i)return;const ne=o({x:W.clientX,y:W.clientY});i.insertPoint(t.id,K,{x:ne.x,y:ne.y})}return(K,W)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,ZN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.value,(ne,re)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${re}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>X(ne.segIndex,L),["stop"])},null,42,JN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(I.value,(ne,re)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${re}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>y(re,L),onPointermove:N,onPointerup:q,onDblclick:L=>U(re,L)},null,42,QN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),t$=["data-theme"],n$={key:0,class:"em-ctx__sep",role:"separator"},o$={key:1,class:"em-ctx__swatches"},i$={class:"em-ctx__swatches-label"},a$={class:"em-ctx__chips"},l$=["onClick"],r$=["title","onClick"],s$=["disabled","onClick"],c$={class:"em-ctx__icon"},d$={class:"em-ctx__caption"},u$=Pe(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),a=n.ref(void 0),l=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,h){var g;i.value=h,a.value=(g=m.target)!=null&&g.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 _=l.value;if(!_)return;const b=_.getBoundingClientRect();r.x+b.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-b.width)),r.y+b.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-b.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function p(m,h){m.onPick(h),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,h)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":a.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:l,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:h[0]||(h[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(_,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[_.type==="separator"?(n.openBlock(),n.createElementBlock("div",n$)):_.type==="swatches"?(n.openBlock(),n.createElementBlock("div",o$,[n.createElementVNode("span",i$,n.toDisplayString(_.caption),1),n.createElementVNode("div",a$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":_.current===null}]),title:"없음",onClick:g=>p(_,null)},null,10,l$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),g=>(n.openBlock(),n.createElementBlock("button",{key:g,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":_.current===g}]),style:n.normalizeStyle({background:n.unref(Dn)(g)}),title:n.unref(Bn)(g),onClick:I=>p(_,g)},null,14,r$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":_.danger,"is-disabled":_.disabled}]),disabled:_.disabled,role:"menuitem",onClick:g=>f(_)},[n.createElementVNode("span",c$,[_.icon?(n.openBlock(),n.createBlock(Re,{key:0,name:_.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",d$,n.toDisplayString(_.caption),1)],10,s$))],64))),128))],36)],8,t$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Ol=[".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 Fn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function f$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function m$(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const l=e.firstChild,r=a.getClientRects();if(!l||l.nodeType!==3||r.length<=1){const h=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const _=t(h.left,h.top+h.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const h=d.trim();if(h){const _=t(f,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(l,h),a.setEnd(l,h+1);const _=a.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(m(),u=_.top,f=_.left,p=_.bottom,d=s[h]):(d+=s[h],p=Math.max(p,_.bottom))}return m(),c}function na(e,t){const o=[];for(const i of e.querySelectorAll("*"))f$(i)&&(i.closest(Ol)||Fn(i)&&o.push(...m$(i,t)));return o}function Ro(e){return Math.round(e*100)/100}function p$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Ol)||!Fn(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="${Ro(l.x)}" y="${Ro(l.y)}" width="${Ro(r.x-l.x)}" height="${Ro(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 h$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Fn(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=>Ro(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 Mu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Ol)||!Fn(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 Vo(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 Ll(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 y$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,h)=>e.screenToFlowCoordinate({x:m,y:h}),i=[],a=[],l=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const h=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!h||!Fn(h))continue;const _=h.firstElementChild;if(_)if(m.type==="group"){const b=Vo(_,o);Ll(s,b),i.push({...b,texts:[]});const g=_.querySelector(".em-group__label");g&&i.push({...Vo(g,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:na(_,o)})}else if(m.type==="note"){const b={...Vo(_,o),texts:na(_,o),lines:Mu(_,_,o)};Ll(s,b),l.push(b)}else{const b=Vo(_,o);Ll(s,b);const g=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const I=_.querySelector(".em-entity__header");if(I){const y=Vo(I,o);a.push({x:b.x,y:b.y,w:b.w,h:y.y+y.h-b.y,fill:y.fill,stroke:"none",radius:{tl:g.tl,tr:g.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:na(_,o),lines:Mu(_,_,o),icons:p$(_,o)}),a.push({...b,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const h=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!Fn(h))continue;const _=h.getAttribute("d");if(!_)continue;const b=getComputedStyle(h),g=b.strokeDasharray,I=h$(m);r.push({d:_,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:g&&g!=="none"?g:void 0,labels:na(m,o),markers:I.length?I: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 Bu(e){return jl(y$(e))}function Du(e,t="diagram.svg"){const o=Bu(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),a=URL.createObjectURL(i);try{const l=document.createElement("a");l.href=a,l.download=t,document.body.appendChild(l),l.click(),l.remove()}finally{URL.revokeObjectURL(a)}}const g$={key:0,class:"em-toast",role:"status","aria-live":"polite"},Pl="nc:",Ou=Pe(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,w=>{w&&(l.value=w.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.ref(!1),c=n.ref(!1),d={x:0,y:0};function u(w){d.x=w.clientX,d.y=w.clientY}const f=n.ref(null);n.provide(Di,f);const p=n.ref(null);n.provide(Nd,p);const m=n.ref(null),h=n.computed(()=>{const w=m.value,k=new Set;if(!w)return k;if(w.kind==="entity")k.add(w.id);else if(w.kind==="group"){const C=i.resolved.value.groups.find(Z=>Z.group.modelId===w.id);for(const Z of(C==null?void 0:C.group.memberEntityRefs)??[])k.add(Z)}return k}),_=n.computed(()=>{const w=m.value,k=new Set(h.value),C=new Set,Z=new Set;if(!w)return{related:k,edges:C,notes:Z};if(w.kind==="note"){Z.add(w.id);for(const se of i.resolved.value.noteConnections)se.noteRef===w.id&&k.add(se.targetRef);return{related:k,edges:C,notes:Z}}const ae=h.value;if(!ae.size)return{related:k,edges:C,notes:Z};for(const se of i.resolved.value.associations){const{end1:V,end2:z}=se.association;(ae.has(V.entityRef)||ae.has(z.entityRef))&&(C.add(se.association.modelId),k.add(V.entityRef),k.add(z.entityRef))}for(const se of i.resolved.value.noteConnections)k.has(se.targetRef)&&Z.add(se.noteRef);return{related:k,edges:C,notes:Z}});n.provide(Pn,{source:m,active:n.computed(()=>m.value!==null),primaryEntityIds:h,relatedEntityIds:n.computed(()=>_.value.related),relatedEdgeIds:n.computed(()=>_.value.edges),relatedNoteIds:n.computed(()=>_.value.notes),hoverGroupId:n.computed(()=>{var w;return((w=m.value)==null?void 0:w.kind)==="group"?m.value.id:null}),setEntityHover:w=>{p.value||c.value||(m.value=w?{kind:"entity",id:w}:null)},setGroupHover:w=>{p.value||c.value||(m.value=w?{kind:"group",id:w}:null)},setNoteHover:w=>{p.value||c.value||(m.value=w?{kind:"note",id:w}:null)}}),n.provide(pn,i);function b(w,k){return`${Pl}${w}:${k}`}function g(w){if(!w.startsWith(Pl))return null;const[k,C]=w.slice(Pl.length).split(":");return k&&C?{noteRef:k,targetRef:C}:null}n.provide(yl,{points:w=>{var C,Z;const k=g(w);return k?((C=i.resolved.value.noteConnections.find(ae=>ae.noteRef===k.noteRef&&ae.targetRef===k.targetRef))==null?void 0:C.waypoints)??[]:((Z=i.resolved.value.associations.find(ae=>ae.association.modelId===w))==null?void 0:Z.waypoints)??[]},movePoint:(w,k,C)=>{const Z=g(w);Z?i.moveNoteConnectionWaypoint(Z.noteRef,Z.targetRef,k,C):i.moveWaypoint(w,k,C)},insertPoint:(w,k,C)=>{const Z=g(w);Z?i.addNoteConnectionWaypoint(Z.noteRef,Z.targetRef,k,C):i.addWaypoint(w,k,C)},removePoint:(w,k)=>{const C=g(w);C?i.removeNoteConnectionWaypoint(C.noteRef,C.targetRef,k):i.removeWaypoint(w,k)}});const I=Oe(),{nodes:y,edges:N,findNode:q,findEdge:U,addNodes:X,addEdges:K,removeNodes:W,removeEdges:ne,fitView:re,setCenter:L,getViewport:Q,screenToFlowCoordinate:v,getSelectedNodes:T,updateNodeInternals:$}=I,P=n.ref(!1);async function H(){P.value=!0,await n.nextTick(),await new Promise(w=>requestAnimationFrame(()=>w(null)));try{Du(I)}finally{P.value=!1}}t({exportSvg:H});function te(){const w=Q(),{width:k,height:C}=I.dimensions.value;return{x:(k/2-w.x)/w.zoom,y:(C/2-w.y)/w.zoom}}function M(){const w=te();i.addEntity("NewEntity",{x:w.x,y:w.y})}function ee(){const w=te();i.addNote("메모",{x:w.x,y:w.y})}function le(w){for(const k of i.resolved.value.groups){const{location:C,size:Z}=k.geo;if(w.x>=C.x&&w.x<=C.x+Z.width&&w.y>=C.y&&w.y<=C.y+Z.height)return k.group.modelId}return null}function me(){const w=i.resolved.value,k=new Map(w.groups.map(V=>[V.group.modelId,V.geo])),C=new Set(w.groups.map(V=>V.group.modelId)),Z=new Set([...C,...w.entities.map(V=>V.entity.modelId),...w.notes.map(V=>V.note.modelId)]);for(const V of[...y.value])Z.has(V.id)||W([V.id]);for(const V of w.groups){const z=V.group.modelId,F={width:`${V.geo.size.width}px`,height:`${V.geo.size.height}px`},oe={group:V.group,style:V.style,locked:V.locked},Ae=V.locked?!1:void 0,Le=q(z);Le?(Le.position={...V.geo.location},Le.data=oe,Le.style=F,Le.draggable=Ae):X([{id:z,type:"group",position:{...V.geo.location},draggable:Ae,style:F,data:oe}])}for(const V of w.entities){const z=V.entity.modelId,F=V.groupRef&&C.has(V.groupRef)?V.groupRef:void 0,oe={entity:V.entity,displayMode:i.displayMode.value,collapsed:V.collapsed,locked:V.locked,groupRef:F,size:V.geo.size,style:V.style,attributeStyles:V.attributeStyles,operationStyles:V.operationStyles},Ae=V.locked?!1:void 0,Le=F?k.get(F):void 0,He=Le?{x:V.geo.location.x-Le.location.x,y:V.geo.location.y-Le.location.y}:{...V.geo.location},Be=q(z);Be?(Be.position=He,Be.data=oe,Be.parentNode=F,Be.draggable=Ae):X([{id:z,type:"entity",position:He,parentNode:F,draggable:Ae,data:oe}])}for(const V of w.notes){const z=V.note,F=z.modelId,oe=V.groupRef&&C.has(V.groupRef)?V.groupRef:void 0,Ae={note:z,groupRef:oe},Le={width:`${z.geo.size.width}px`,height:`${z.geo.size.height}px`},He=oe?k.get(oe):void 0,Be=He?{x:z.geo.location.x-He.location.x,y:z.geo.location.y-He.location.y}:{...z.geo.location},Fe=q(F);Fe?(Fe.position=Be,Fe.data=Ae,Fe.style=Le,Fe.parentNode=oe):X([{id:F,type:"note",position:Be,parentNode:oe,style:Le,data:Ae}])}const ae=new Map(w.associations.map(V=>[V.association.modelId,V])),se=new Set(w.noteConnections.map(V=>b(V.noteRef,V.targetRef)));for(const V of[...N.value])!ae.has(V.id)&&!se.has(V.id)&&ne([V.id]);for(const[V,z]of ae){const F={id:V,type:"association",source:z.association.end1.entityRef,target:z.association.end2.entityRef,sourceHandle:z.sourceColumnRef?`r:${z.sourceColumnRef}`:void 0,targetHandle:z.targetColumnRef?`l:${z.targetColumnRef}`:void 0,data:{association:z.association,sourceColumnRef:z.sourceColumnRef,targetColumnRef:z.targetColumnRef}},oe=U(V);oe?(oe.data=F.data,oe.sourceHandle=F.sourceHandle,oe.targetHandle=F.targetHandle):K([F])}for(const V of w.noteConnections){const z=b(V.noteRef,V.targetRef),F={noteRef:V.noteRef,targetRef:V.targetRef},oe=U(z);oe?oe.data=F:K([{id:z,type:"note-connection",source:V.noteRef,target:V.targetRef,data:F}])}ye()}function ye(){n.nextTick(()=>requestAnimationFrame(()=>$()))}function ce(){const w=T.value.map(C=>C.id);if(w.length)return w;const k=i.selection.value;return k&&(k.kind==="entity"||k.kind==="note"||k.kind==="group")?[k.id]:[]}function ue(w){var ae;const k=w.target;if(k&&(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable))return;if(!i.editable.value){(w.metaKey||w.ctrlKey)&&w.key.toLowerCase()==="c"&&(i.copy(),w.preventDefault());return}if(w.key==="Delete"||w.key==="Backspace"){i.deleteSelection()&&w.preventDefault();return}if(w.key==="ArrowUp"||w.key==="ArrowDown"||w.key==="ArrowLeft"||w.key==="ArrowRight"){if(((ae=i.selection.value)==null?void 0:ae.kind)==="attribute"){if(w.key==="ArrowUp"||w.key==="ArrowDown"){const F=w.key==="ArrowDown"?1:-1;(w.altKey?i.nudgeSelectedAttributes(F):i.moveAttributeFocus(F))&&w.preventDefault()}return}const se=w.shiftKey?10:1,V=w.key==="ArrowLeft"?-se:w.key==="ArrowRight"?se:0,z=w.key==="ArrowUp"?-se:w.key==="ArrowDown"?se:0;i.nudgeNodes(ce(),V,z)&&w.preventDefault();return}if(!(w.metaKey||w.ctrlKey))return;const Z=w.key.toLowerCase();Z==="c"?(i.copy(),w.preventDefault()):Z==="v"?(i.paste(),w.preventDefault()):Z==="z"&&(w.shiftKey?i.redo():i.undo(),w.preventDefault())}n.onMounted(async()=>{me(),await n.nextTick(),re(),window.addEventListener("keydown",ue),window.addEventListener("pointerup",he),window.addEventListener("pointermove",u,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",ue),window.removeEventListener("pointerup",he),window.removeEventListener("pointermove",u)});function he(){f.value=null}function ve(){c.value=!0,m.value=null}function Se(){var Z;c.value=!1;const w=(Z=document.elementFromPoint(d.x,d.y))==null?void 0:Z.closest(".vue-flow__node"),k=w==null?void 0:w.dataset.id;if(!k){m.value=null;return}const C=w.classList.contains("vue-flow__node-group")?"group":w.classList.contains("vue-flow__node-note")?"note":"entity";m.value={kind:C,id:k}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],me),n.watch(()=>i.revision.value,ye),n.watch(()=>i.resolved.value,w=>{const k=m.value;if(!k)return;(k.kind==="entity"?w.entities.some(Z=>Z.entity.modelId===k.id):k.kind==="group"?w.groups.some(Z=>Z.group.modelId===k.id):w.notes.some(Z=>Z.note.modelId===k.id))||(m.value=null)});function Ie(w){const k=w.computedPosition??w.position,C=w.dimensions??{width:0,height:0};return{x:k.x+C.width/2,y:k.y+C.height/2}}function pe(w){const k=w.node;if(k){if(m.value=null,k.type==="group"){const C=i.resolved.value.groups.find(Z=>Z.group.modelId===k.id);p.value=C?{groupId:k.id,dx:k.position.x-C.geo.location.x,dy:k.position.y-C.geo.location.y}:null,f.value=null;return}if(k.type!=="entity"&&k.type!=="note"){f.value=null;return}f.value=le(Ie(k))}}function j(w){var Z;f.value=null,p.value=null;const k=(Z=w.nodes)!=null&&Z.length?w.nodes:[w.node],C=k.filter(ae=>(ae==null?void 0:ae.type)==="group");if(C.length){for(const ae of C){if(!ae)continue;const se=i.resolved.value.entities.filter(V=>V.groupRef===ae.id).map(V=>{const z=q(V.entity.modelId),F=(z==null?void 0:z.computedPosition)??(z==null?void 0:z.position)??{x:0,y:0};return{id:V.entity.modelId,location:{x:F.x,y:F.y}}});i.dragGroup(ae.id,{x:ae.position.x,y:ae.position.y},se)}return}for(const ae of k){if(!ae||ae.type==="group")continue;const se=ae.computedPosition??ae.position,V=ae.dimensions??{width:0,height:0},z={x:se.x+V.width/2,y:se.y+V.height/2};ae.type==="note"?i.dropNote(ae.id,{x:se.x,y:se.y},le(z)):i.dropEntity(ae.id,{x:se.x,y:se.y},le(z))}}function Y(w){var F,oe,Ae,Le,He;if(!i.editable.value||!w.source||!w.target)return;const k=((F=q(w.source))==null?void 0:F.type)==="note",C=((oe=q(w.target))==null?void 0:oe.type)==="note";if(k||C){if(k&&C)return;const Be=k?w.source:w.target,Fe=k?w.target:w.source;((Ae=q(Fe))==null?void 0:Ae.type)==="entity"&&i.addNoteConnection(Be,Fe);return}const Z=Be=>{var Fe;return(Fe=i.state.logical.entities.find(xt=>xt.modelId===Be))==null?void 0:Fe.stereotype},ae=Z(w.source)==="JPA_EMBEDDABLE",se=Z(w.target)==="JPA_EMBEDDABLE";if(ae||se){if(ae&&se)return;const Be=ae?w.source:w.target,Fe=ae?w.target:w.source;i.addEmbedAssociation(Fe,Be);return}const V=(Le=w.sourceHandle)!=null&&Le.startsWith("r:")?w.sourceHandle.slice(2):void 0,z=(He=w.targetHandle)!=null&&He.startsWith("l:")?w.targetHandle.slice(2):void 0;i.addAssociation(w.source,w.target,V,z)}const E=n.ref(null);function A(w,k){var Z;const C=i.state.layout.entityLayouts.find(ae=>ae.entityRef===w);return nt((Z=C==null?void 0:C.attributeStyles)==null?void 0:Z[k])}function R(w,k){var Z;const C=i.state.layout.entityLayouts.find(ae=>ae.entityRef===w);return nt((Z=C==null?void 0:C.operationStyles)==null?void 0:Z[k])}function G(w){var k;return nt((k=i.state.layout.groupLayouts.find(C=>C.groupRef===w))==null?void 0:k.style)}function J(w){var k;return nt((k=i.state.layout.notes.find(C=>C.modelId===w))==null?void 0:k.style)}function fe(w){var Z,ae;if(w.preventDefault(),!i.editable.value)return;const k=()=>v({x:w.clientX,y:w.clientY}),C=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const se=k();i.addEntity("NewEntity",{x:se.x,y:se.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const se=k();i.addNote("메모",{x:se.x,y:se.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const se=k();i.addEmptyGroup({x:se.x,y:se.y})}}];((Z=i.clipboard.value)==null?void 0:Z.kind)==="entity"&&C.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&C.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(ae=E.value)==null||ae.open(w,C)}function _e({event:w,node:k}){var F,oe,Ae,Le,He,Be,Fe,xt,Xt,jt,Je,Ao,we,Qe,To,Mo,Bo,Do;const C=w;if(C.preventDefault(),!i.editable.value){if(k.type==="group"||k.type==="note")return;const De=(oe=(F=C.target)==null?void 0:F.closest("[data-attr]"))==null?void 0:oe.dataset.attr;if(De){const Ge=i.selection.value;(Ge==null?void 0:Ge.kind)==="attribute"&&Ge.entityId===k.id&&Ge.ids.includes(De)||i.selectAttribute(k.id,De);const Xe=((Ae=i.selection.value)==null?void 0:Ae.kind)==="attribute"&&i.selection.value.entityId===k.id?[...i.selection.value.ids]:[De];(Le=E.value)==null||Le.open(C,[{caption:Xe.length>1?`복사 (${Xe.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(He=E.value)==null||He.open(C,[{caption:"상세 편집…",icon:"pencil",handler:()=>Mi(a,i,k.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:k.id},i.copy()}}]);return}if(k.type==="group"){const De=i.isGroupLocked(k.id),Ge=[];De||Ge.push({type:"swatches",caption:"색상",current:G(k.id),onPick:qe=>i.setGroupSwatch(k.id,qe)},{type:"separator"}),Ge.push({caption:De?"잠금 해제":"잠금",icon:De?"unlock":"lock",handler:()=>i.setGroupLocked(k.id,!De)}),De||Ge.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(k.id)}),(Be=E.value)==null||Be.open(C,Ge);return}if(k.type==="note"){(Fe=E.value)==null||Fe.open(C,[{type:"swatches",caption:"색상",current:J(k.id),onPick:De=>i.setNoteSwatch(k.id,De)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(k.id)}]);return}const Z=(Xt=(xt=C.target)==null?void 0:xt.closest("[data-attr]"))==null?void 0:Xt.dataset.attr;if(Z){const De=i.selection.value;(De==null?void 0:De.kind)==="attribute"&&De.entityId===k.id&&De.ids.includes(Z)||i.selectAttribute(k.id,Z);const qe=((jt=i.selection.value)==null?void 0:jt.kind)==="attribute"&&i.selection.value.entityId===k.id?[...i.selection.value.ids]:[Z];if(i.isEntityLocked(k.id)){(Je=E.value)==null||Je.open(C,[{caption:qe.length>1?`복사 (${qe.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const Xe=qe.length>1,zl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(k.id)},{type:"swatches",caption:Xe?`색상 (${qe.length})`:"색상",current:Xe?null:A(k.id,Z),onPick:rS=>i.setAttributeSwatches(k.id,qe,rS)},{type:"separator"},{caption:Xe?`복사 (${qe.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Oo=i.clipboard.value;(Oo==null?void 0:Oo.kind)==="attribute"&&zl.push({caption:Oo.attributes.length>1?`속성 붙여넣기 (${Oo.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:k.id},i.paste()}}),zl.push({type:"separator"},{caption:Xe?`속성 삭제 (${qe.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(k.id,qe)}),(Ao=E.value)==null||Ao.open(C,zl);return}const ae=(Qe=(we=C.target)==null?void 0:we.closest("[data-op]"))==null?void 0:Qe.dataset.op;if(ae){if(i.isEntityLocked(k.id))return;(To=E.value)==null||To.open(C,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(k.id)},{type:"swatches",caption:"색상",current:R(k.id,ae),onPick:De=>i.setOperationSwatch(k.id,ae,De)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(k.id,ae)}]);return}const se=i.resolved.value.entities.find(De=>De.entity.modelId===k.id),V=!!(se!=null&&se.locked),z=[{caption:V?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Mi(a,i,k.id)}];if(!V){z.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(k.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(k.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Ge=T.value.filter(qe=>qe.type==="entity").map(qe=>qe.id);i.createGroup(Ge.includes(k.id)&&Ge.length?Ge:[k.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(k.id,k.id)});const De=i.embeddableCatalog.value;if(De.length){z.push({type:"separator"});for(const Ge of De){const qe=((Mo=Ge.label)==null?void 0:Mo.ko)??((Bo=Ge.label)==null?void 0:Bo.en)??Ge.type;z.push({caption:`임베더블 추가: ${qe}`,icon:"link",handler:()=>i.addPredefinedEmbed(k.id,Ge.type)})}}}if(z.push({type:"separator"}),z.push({caption:se!=null&&se.collapsed?"펼치기":"접기",icon:se!=null&&se.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(k.id,!(se!=null&&se.collapsed))}),se!=null&&se.groupRef&&!V&&z.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(k.id)}),z.push({caption:V?"잠금 해제":"잠금",icon:V?"unlock":"lock",handler:()=>i.setEntityLocked(k.id,!V)}),z.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:k.id},i.copy()}}),!V){const De=i.clipboard.value;(De==null?void 0:De.kind)==="attribute"&&z.push({caption:De.attributes.length>1?`속성 붙여넣기 (${De.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:k.id},i.paste()}}),z.push({type:"separator"}),z.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(k.id)})}(Do=E.value)==null||Do.open(C,z)}function ke({event:w,edge:k}){var ae,se;const C=w;if(C.preventDefault(),!i.editable.value)return;const Z=g(k.id);if(Z){(ae=E.value)==null||ae.open(C,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Z.noteRef,Z.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Z.noteRef,Z.targetRef)}]);return}(se=E.value)==null||se.open(C,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(k.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(k.id)}])}function be(w){return w==="group"?"group":w==="note"?"note":"entity"}function xe({node:w}){if(T.value.length>1){i.selection.value=null;return}i.selection.value={kind:be(w.type),id:w.id}}function Ve({nodes:w}){w.length>1&&(i.selection.value=null)}function Te({edge:w}){const k=g(w.id);i.selection.value=k?{kind:"note",id:k.noteRef}:{kind:"association",id:w.id}}function x(w){const k=i.selection.value;return!!k&&k.kind!=="attribute"&&k.id===w.id}function B(w){var k,C;return x(w)?w.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":w.type==="note"?"var(--em-note-soft)":w.type==="group"?hd(nt((k=w.data)==null?void 0:k.style),!0)??"var(--em-mm-group)":hd(nt((C=w.data)==null?void 0:C.style))??"var(--em-mm-entity)"}function S(w){return x(w)?"var(--em-selection)":w.type==="note"?"var(--em-note-accent)":w.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function D(w,k){L(w,k,{zoom:Q().zoom,duration:350})}n.watch(()=>i.focusRequest.value,w=>{if(!w)return;const k=q(w.id);if(!k)return;const C=k.computedPosition??k.position,Z=k.dimensions??{width:0,height:0};D(C.x+Z.width/2,C.y+Z.height/2)});function O({position:w}){D(w.x,w.y)}function de({node:w}){i.selection.value={kind:be(w.type),id:w.id};const k=w.computedPosition??w.position,C=w.dimensions??{width:0,height:0};D(k.x+C.width/2,k.y+C.height/2)}function ge({node:w}){re({nodes:[w.id],duration:350,maxZoom:1.2,padding:.6})}return(w,k)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":s.value,"is-panning":c.value}])},[n.createVNode(n.unref(O0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!P.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(Tt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ve,onMoveEnd:Se,onConnect:Y,onConnectStart:k[1]||(k[1]=C=>s.value=!0),onConnectEnd:k[2]||(k[2]=C=>s.value=!1),onNodeDrag:pe,onNodeDragStop:j,onNodeClick:xe,onEdgeClick:Te,onSelectionChange:Ve,onPaneClick:k[3]||(k[3]=C=>n.unref(i).selection.value=null),onPaneContextMenu:fe,onNodeContextMenu:_e,onEdgeContextMenu:ke},{"node-group":n.withCtx(C=>[n.createVNode(xd,n.normalizeProps(n.guardReactiveProps(C)),null,16)]),"node-entity":n.withCtx(C=>[n.createVNode($d,n.normalizeProps(n.guardReactiveProps(C)),null,16)]),"node-note":n.withCtx(C=>[n.createVNode(Id,n.normalizeProps(n.guardReactiveProps(C)),null,16)]),"edge-association":n.withCtx(C=>[n.createVNode(Ud,n.normalizeProps(n.guardReactiveProps(C)),null,16)]),"edge-note-connection":n.withCtx(C=>[n.createVNode(e$,n.normalizeProps(n.guardReactiveProps(C)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Hw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(pv),{"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(hn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:M},{default:n.withCtx(()=>[n.createVNode(Re,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:ee},{default:n.withCtx(()=>[n.createVNode(Re,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:k[0]||(k[0]=C=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Re,{name:"auto-layout",size:14})]),_:1})],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(jN),{key:1,pannable:"",width:224,height:160,"node-color":B,"node-stroke-color":S,"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:O,onNodeClick:de,onNodeDblclick:ge})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(u$,{ref_key:"menuRef",ref:E},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",g$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-635a23f2"]]),b$={class:"em-explorer em-scroll-overlay"},_$={class:"em-explorer__rows"},w$=["data-key","onClick","onDblclick"],v$=["onClick"],k$=["title"],E$={class:"em-key-slot"},N$={class:"em-key-slot"},$$={class:"em-explorer__label"},Lu=Pe(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var v;const g=i.resolved.value,I=i.displayMode.value,y=T=>{var $,P,H;return Lo(I,T.name,(P=($=T.table)==null?void 0:$.logicalName)==null?void 0:P.ko,(H=T.table)==null?void 0:H.physicalName)},N=I==="PHYSICAL"||I==="LOGICAL_PHYSICAL",q=T=>{const $=T.attrType.startsWith("RELATION")&&T.dbAttrs.length>0;return{icon:T.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:T.identifier,fk:$&&N}}},U=T=>T.attrType.startsWith("EMBED")&&T.dbAttrs.length>0,X=I==="PHYSICAL"||I==="LOGICAL_PHYSICAL",K=T=>{if(T.attrType!=="EMBED_PREDEF")return T.dbAttrs;const $=i.embeddableCatalog.value.find(P=>P.type===T.type);return $?T.dbAttrs.map((P,H)=>{const te=$.fields[H];return te?{...P,physicalName:P.physicalName||te.physicalName,logicalName:P.logicalName??te.logicalName,dataType:P.dataType||te.dataType,length:P.length??te.length}:P}):T.dbAttrs},W=(T,$)=>{var M,ee,le;const P={entityId:$,attrId:T.modelId};if(U(T)){const me=pa(I,T);return{key:`attr:${T.modelId}`,label:T.name+(me?` : ${me}`:""),icon:"table",attrRef:P,focusId:$,children:X?K(T).map(ye=>{var ce;return{key:`attr:${T.modelId}:col:${ye.modelId}`,label:Lo(I,ye.physicalName,(ce=ye.logicalName)==null?void 0:ce.ko,ye.physicalName)+(ye.dataType?` : ${ye.dataType}`:""),icon:"field",attrRef:P,focusId:$,children:[]}}):[]}}const H=er(T,i.state.logical.associations),te=pa(I,T,H);return{key:`attr:${T.modelId}`,label:Lo(I,T.name,(ee=(M=T.dbAttrs[0])==null?void 0:M.logicalName)==null?void 0:ee.ko,(le=T.dbAttrs[0])==null?void 0:le.physicalName)+(te?` : ${te}`:""),...q(T),attrRef:P,focusId:$,children:[]}},ne=T=>{const $=T.entity,P=[...$.attributes].sort((H,te)=>H.order-te.order);return{key:`entity:${$.modelId}`,label:y($),icon:"table",selectKind:"entity",selectId:$.modelId,focusId:$.modelId,children:P.map(H=>W(H,$.modelId))}},re=new Map,L=[];for(const T of g.entities)if(T.groupRef){const $=re.get(T.groupRef)??[];$.push(T),re.set(T.groupRef,$)}else L.push(T);const Q=[];for(const T of g.groups){const $=T.group;Q.push({key:`group:${$.modelId}`,label:((v=$.name)==null?void 0:v.ko)||$.packageName||"(그룹)",icon:"folder",focusId:$.modelId,children:(re.get($.modelId)??[]).map(ne)})}for(const T of L)Q.push(ne(T));if(g.associations.length){const T=new Map(g.entities.map($=>[$.entity.modelId,y($.entity)]));Q.push({key:"section:associations",label:`관계 (${g.associations.length})`,icon:"arrow-lr",children:g.associations.map($=>{const P=$.association,H=T.get(P.end1.entityRef)??P.end1.entityRef,te=T.get(P.end2.entityRef)??P.end2.entityRef;return{key:`assoc:${P.modelId}`,label:`${H} — ${te}`,icon:"arrow-lr",selectKind:"association",selectId:P.modelId,children:[]}})})}return g.notes.length&&Q.push({key:"section:notes",label:`노트 (${g.notes.length})`,icon:"note",children:g.notes.map(({note:T})=>{var $;return{key:`note:${T.modelId}`,label:(($=T.memo.split(`
|
|
41
|
-
`)[0])==null?void 0:$.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:T.modelId,focusId:T.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:Q}});function r(g){return g?g.pk&&g.fk?"PFK (식별 외래키)":g.pk?"PK (기본키)":g.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(g){const I=new Set(s.value);I.has(g)?I.delete(g):I.add(g),s.value=I}const d=n.computed(()=>{const g=[],I=(y,N)=>{if(g.push({node:y,depth:N}),!s.value.has(y.key))for(const q of y.children)I(q,N+1)};return I(l.value,0),g}),u=n.computed(()=>{const g=[],I=y=>{if(y.children.length){y.key!=="root"&&g.push(y.key);for(const N of y.children)I(N)}};return I(l.value),g}),f=n.computed(()=>!u.value.some(g=>s.value.has(g)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(g){const I=i.selection.value;return g.attrRef?(I==null?void 0:I.kind)==="attribute"&&I.entityId===g.attrRef.entityId&&I.ids.includes(g.attrRef.attrId):!!I&&I.kind!=="attribute"&&!!g.selectId&&g.selectKind===I.kind&&g.selectId===I.id}function h(g){const I=i.selection.value;return g.selectKind==="entity"&&(I==null?void 0:I.kind)==="attribute"&&I.entityId===g.selectId}function _(g,I){if(g.attrRef){const y=I.shiftKey?"range":I.metaKey||I.ctrlKey?"toggle":"replace";i.selectAttribute(g.attrRef.entityId,g.attrRef.attrId,y)}else g.selectKind&&g.selectId&&(i.selection.value={kind:g.selectKind,id:g.selectId});g.focusId&&i.requestFocus(g.focusId)}function b(g){g.selectKind==="entity"&&g.selectId&&Mi(a,i,g.selectId)}return(g,I)=>(n.openBlock(),n.createElementBlock("section",b$,[n.createElementVNode("div",_$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:y,depth:N})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":h(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+N*14+"px"}),onClick:q=>_(y,q),onDblclick:q=>b(y)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!y.children.length,"is-open":!s.value.has(y.key)}]),onClick:n.withModifiers(q=>y.children.length&&c(y.key),["stop"])},[y.children.length?(n.openBlock(),n.createBlock(Re,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,v$),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",E$,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Re,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Re,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",N$,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Re,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,k$)):(n.openBlock(),n.createBlock(Re,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",$$,n.toDisplayString(y.label),1)],46,w$))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),x$={class:"em-text-preview"},I$={class:"em-text-preview__pre"},S$={class:"em-text-preview__actions"},C$=Pe(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=ie.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.showNotification("복사에 실패했습니다.","error")}}return(a,l)=>(n.openBlock(),n.createBlock(n.unref(ie.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",x$,[n.createElementVNode("pre",I$,n.toDisplayString(t.text),1),n.createElementVNode("div",S$,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:l[0]||(l[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),R$={class:"em-toolbar"},V$={class:"em-toolbar__mode"},Pu=Pe(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.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(m=>m.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){l.openModal({component:C$,bind:{text:ql(i.state.logical)}})}return(p,m)=>(n.openBlock(),n.createElementBlock("div",R$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:m[0]||(m[0]=h=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Re,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:m[1]||(m[1]=h=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Re,{name:"redo",size:16})]),_:1},8,["disabled"]),m[9]||(m[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",V$,[m[7]||(m[7]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":m[2]||(m[2]=h=>s.value=h),items:r,"value-provider":h=>h.v,"label-provider":h=>h.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:c},{left:n.withCtx(()=>[n.createVNode(Re,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:m[3]||(m[3]=h=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Re,{name:"grid",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:m[4]||(m[4]=h=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Re,{name:"map",size:16})]),_:1},8,["class","tooltip"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:d.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Re,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),m[10]||(m[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:f},{left:n.withCtx(()=>[n.createVNode(Re,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:m[5]||(m[5]=h=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Re,{name:"image",size:16})]),_:1}),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[m[8]||(m[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:m[6]||(m[6]=h=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Re,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-13589c57"]]),A$=Pe(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,a)=>(n.openBlock(),n.createBlock(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:a[0]||(a[0]=l=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Re,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),T$=["disabled"],M$={class:"em-panel__sub"},B$={class:"em-nav"},D$={key:0,class:"em-nav__divider","aria-hidden":"true"},O$={key:1},L$=["onClick","onKeydown"],P$={class:"em-nav__name"},z$=["title"],U$={key:0,class:"em-panel__note"},H$=["data-attr-block"],F$={class:"em-attr__row"},G$=["title"],Y$={key:0,class:"em-attr__row"},W$={class:"em-attr__row"},K$={class:"em-attr__row"},q$={class:"em-attr__flags"},X$={class:"em-attr__pii"},j$={class:"em-attr__pii"},Z$={class:"em-attr__pii"},J$={key:0,class:"em-attr__pii em-attr__codetop"},Q$={class:"em-multilang"},ex={key:2,class:"em-embed-cols"},tx={class:"em-embed-col__label"},nx={class:"em-attr__row"},ox={class:"em-attr__row"},ix={key:0,class:"em-embed-upd"},ax={class:"em-embed-upd"},lx={class:"em-embed-upd"},rx={class:"em-swatch__row em-attr__swatch"},sx=["onClick"],cx=["title","onClick"],dx={key:0,class:"em-attr__swatch-hint"},ux="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",oa="__OWN__",fx=Pe(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(V=>V.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(V=>V.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.attributes.filter(z=>z.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.attributes)??[]}),d=n.computed(()=>s.value.filter(V=>r.value.has(V.modelId)));function u(V){return{pk:V.identifier,fk:V.attrType.startsWith("RELATION")&&V.dbAttrs.length>0,required:V.notNull&&!V.identifier}}function f(V){return!!i.value&&!!jo(o.state.logical,i.value.modelId,V.modelId)}function p(V){const z=u(V),F=[z.pk&&"PK",z.fk&&"FK",z.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function m(V,z){i.value&&o.selectAttribute(i.value.modelId,V.modelId,z.shiftKey?"range":z.metaKey||z.ctrlKey?"toggle":"replace")}const h=["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 _(V){return V==="none"?"(없음)":V}const b=V=>V;function g(V){var z,F;return nt((F=(z=a.value)==null?void 0:z.attributeStyles)==null?void 0:F[V.modelId])}function I(V){return r.value.size>1&&r.value.has(V.modelId)}function y(V,z){if(!i.value)return;const F=I(V)?o.selectedAttrIds.value:[V.modelId];o.setAttributeSwatches(i.value.modelId,F,z)}function N(V,z){i.value&&o.updateAttribute(i.value.modelId,V.modelId,z)}function q(V,z){N(V,{naturalId:z||void 0,naturalIdMutable:z?V.naturalIdMutable:void 0})}function U(){return{naturalId:void 0,naturalIdMutable:void 0}}function X(V,z){N(V,{identifier:z,...z?U():{}})}function K(V,z){N(V,{transient:z||void 0,...z?U():{}})}function W(V){return!!V.transient}const ne=V=>V.value,re=V=>V.label;function L(V,z){if(!z)return;const F=M.value.find(oe=>oe.type===z);if(F){const oe=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};N(V,{type:z,customType:void 0,dbAttrs:[{...oe,dataType:F.dataType,length:F.length,scale:F.scale}]});return}N(V,z===Lt?{type:z}:{type:z,customType:void 0})}function Q(V,z){N(V,{customType:z.trim()===""?void 0:z})}function v(V,z){const oe={...V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"},...z};z.dataType!==void 0&&!Po.has(oe.dataType)&&(oe.scale=void 0),N(V,{dbAttrs:[oe]})}function T(V){var z;return Po.has(((z=V.dbAttrs[0])==null?void 0:z.dataType)??"")}function $(V,z,F){var oe;v(V,{logicalName:{...(oe=V.dbAttrs[0])==null?void 0:oe.logicalName,[z]:F}})}function P(V,z){N(V,{description:Object.keys(z).length?z:void 0})}function H(V){return V.personalInfoAttributeType??"none"}function te(V,z){N(V,{personalInfoAttributeType:z==="none"?void 0:z})}const M=n.computed(()=>o.predefinedCustomTypeCatalog.value),ee=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function me(V){var z,F;return((z=V.label)==null?void 0:z.ko)??((F=V.label)==null?void 0:F.en)??V.type}function ye(V){if(!V||!i.value)return;const z=o.addPredefinedEmbed(i.value.modelId,V);z&&o.selectAttribute(i.value.modelId,z),le.value=void 0}function ce(){if(!i.value)return;const V=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,V)}const ue=n.computed(()=>o.groupCodeCatalog.value);function he(V){var z;return((z=ue.value.find(F=>F.groupCode===V.groupCode))==null?void 0:z.codes)??[]}function ve(V){return["none",...he(V)]}function Se(V){return V==="none"?"none":V.code}function Ie(V){var F,oe;if(V==="none")return"(없음)";const z=((F=V.label)==null?void 0:F.ko)??((oe=V.label)==null?void 0:oe.en);return z?`${V.code} (${z})`:V.code}function pe(V,z){i.value&&o.setAttributeGroupCode(i.value.modelId,V.modelId,z)}function j(V,z){N(V,{defaultValue:z==="none"?void 0:z})}function Y(V,z){N(V,{defaultValue:z.trim()===""?void 0:z})}function E(V){return V.attrType.startsWith("EMBED")&&V.dbAttrs.length>0}function A(V,z,F){const oe=V.dbAttrs.map((Ae,Le)=>{if(Le!==z)return Ae;const He={...Ae,...F};for(const Be of Object.keys(F))F[Be]===void 0&&delete He[Be];return He});i.value&&o.setEmbedColumns(i.value.modelId,V.modelId,oe)}function R(V,z,F,oe){var Ae;A(V,z,{logicalName:{...(Ae=V.dbAttrs[z])==null?void 0:Ae.logicalName,[F]:oe}})}function G(V,z){var Ae,Le,He;if(V.attrType==="EMBED_PREDEF"){const Be=(Ae=o.embeddableCatalog.value.find(Fe=>Fe.type===V.type))==null?void 0:Ae.fields[z];return Be?{name:Be.name,physicalName:Be.physicalName,dataType:Be.dataType,length:Be.length,shareable:Be.shareable,logicalName:Be.logicalName}:void 0}const F=(Le=V.embedded)==null?void 0:Le.embeddableRef;if(!F)return;const oe=(He=o.state.logical.entities.find(Be=>Be.modelId===F))==null?void 0:He.attributes.flatMap(Be=>Be.dbAttrs)[z];return oe?{physicalName:oe.physicalName,dataType:oe.dataType,length:oe.length,scale:oe.scale,logicalName:oe.logicalName}:void 0}function J(V,z){var F,oe;return((F=G(V,z))==null?void 0:F.dataType)||((oe=V.dbAttrs[z])==null?void 0:oe.dataType)||""}function fe(V,z){var F,oe;return((F=G(V,z))==null?void 0:F.length)??((oe=V.dbAttrs[z])==null?void 0:oe.length)}function _e(V,z){var F,oe;return((F=G(V,z))==null?void 0:F.scale)??((oe=V.dbAttrs[z])==null?void 0:oe.scale)}const ke=["inherit","true","false"];function be(V){return V==="inherit"?"기본(따름)":V}function xe(V){return(V==null?void 0:V.updatable)===void 0?"inherit":V.updatable?"true":"false"}function Ve(V,z,F){A(V,z,{updatable:F==="inherit"?void 0:F==="true"})}function Te(V,z){v(V,{updatable:z==="inherit"?void 0:z==="true"})}const x=["inherit","true","false"];function B(V){return V==="inherit"?"기본(따름)":V}function S(V){return(V==null?void 0:V.insertable)===void 0?"inherit":V.insertable?"true":"false"}function D(V,z,F){A(V,z,{insertable:F==="inherit"?void 0:F==="true"})}function O(V,z){v(V,{insertable:z==="inherit"?void 0:z==="true"})}const de=n.computed(()=>{var V;return Wn(((V=i.value)==null?void 0:V.attributes.flatMap(z=>z.dbAttrs))??[])}),ge=n.computed(()=>{var V;return(((V=i.value)==null?void 0:V.attributes)??[]).filter(z=>z.attrType==="NORMAL"&&z.dbAttrs.length===1&&z.dbAttrs[0]).map(z=>({modelId:z.dbAttrs[0].modelId,label:z.dbAttrs[0].physicalName||z.name}))});function w(){return[oa,...ge.value.map(V=>V.modelId)]}function k(V){if(V===oa)return"전용 컬럼(OWN)";const z=ge.value.find(F=>F.modelId===V);return z?`↗ ${z.label} (공유)`:V}function C(V){return(V==null?void 0:V.sharedColumnRef)??oa}function Z(V,z,F){A(V,z,{sharedColumnRef:F===oa?void 0:F})}function ae(V){return(V==null?void 0:V.sharedColumnRef)!=null}function se(V){var z;return((z=zo(V,de.value))==null?void 0:z.physicalName)??""}return(V,z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",M$,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:ce}),ee.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:ee.value,"value-provider":F=>F.type,"label-provider":me,"onUpdate:modelValue":ye},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",B$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,F=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:F.modelId},[F.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",D$,[...z[0]||(z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",O$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:oe=>m(F,oe),onKeydown:[n.withKeys(n.withModifiers(oe=>m(F,oe),["prevent"]),["enter"]),n.withKeys(n.withModifiers(oe=>m(F,oe),["prevent"]),["space"])]},[n.createElementVNode("span",P$,n.toDisplayString(F.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:p(F)},[u(F).pk?(n.openBlock(),n.createBlock(Re,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Re,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Re,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,z$)],42,L$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",U$," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var oe,Ae,Le,He,Be,Fe,xt,Xt,jt,Je,Ao;return n.openBlock(),n.createElementBlock("div",{key:F.modelId,class:n.normalizeClass(["em-attr",{"is-focused":r.value.has(F.modelId)}]),"data-attr-block":F.modelId},[n.createElementVNode("div",F$,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:"이름","model-value":F.name,"onUpdate:modelValue":we=>N(F,{name:we})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:"타입",disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Ql)(F.type,M.value),"value-provider":ne,"label-provider":re,"model-value":F.type,"onUpdate:modelValue":we=>L(F,we)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(F)?ux:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:we=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])],8,G$)]),F.type===n.unref(Lt)?(n.openBlock(),n.createElementBlock("div",Y$,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":F.customType??"","onUpdate:modelValue":we=>Q(F,we)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),E(F)?(n.openBlock(),n.createElementBlock("div",ex,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(we,Qe)=>{var To,Mo,Bo,Do,De,Ge,qe;return n.openBlock(),n.createElementBlock("div",{key:we.modelId,class:"em-embed-col"},[n.createElementVNode("span",tx,n.toDisplayString(((To=G(F,Qe))==null?void 0:To.name)??((Mo=G(F,Qe))==null?void 0:Mo.physicalName)??`컬럼 ${Qe+1}`),1),n.createElementVNode("div",nx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${we.modelId}`,width:"100%",disabled:ae(we),placeholder:((Bo=G(F,Qe))==null?void 0:Bo.physicalName)??"컬럼","model-value":ae(we)?se(we):we.physicalName,"onUpdate:modelValue":Xe=>A(F,Qe,{physicalName:Xe})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${we.modelId}`,width:"84px",disabled:"","model-value":J(F,Qe)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${we.modelId}`,width:"48px",disabled:"","model-value":fe(F,Qe)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${we.modelId}`,width:"48px",disabled:"","model-value":_e(F,Qe)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":we.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",ox,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${we.modelId}`,width:"100%",placeholder:((De=(Do=G(F,Qe))==null?void 0:Do.logicalName)==null?void 0:De.ko)??"논리명","model-value":((Ge=we.logicalName)==null?void 0:Ge.ko)??"","onUpdate:modelValue":Xe=>R(F,Qe,"ko",Xe)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(qe=G(F,Qe))!=null&&qe.shareable?(n.openBlock(),n.createElementBlock("label",ix,[z[7]||(z[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":C(we),items:w(),"value-provider":b,"label-provider":k,"onUpdate:modelValue":Xe=>Xe&&Z(F,Qe,Xe)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",ax,[z[8]||(z[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:ae(we),"model-value":ae(we)?"false":S(we),items:x,"value-provider":b,"label-provider":B,"onUpdate:modelValue":Xe=>Xe&&D(F,Qe,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",lx,[z[9]||(z[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:ae(we),"model-value":ae(we)?"false":xe(we),items:ke,"value-provider":b,"label-provider":be,"onUpdate:modelValue":Xe=>Xe&&Ve(F,Qe,Xe)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",W$,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${F.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ae=(oe=F.dbAttrs[0])==null?void 0:oe.logicalName)==null?void 0:Ae.ko)??"","onUpdate:modelValue":we=>$(F,"ko",we)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",K$,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:"컬럼",disabled:W(F),"model-value":((Le=F.dbAttrs[0])==null?void 0:Le.physicalName)??"","onUpdate:modelValue":we=>v(F,{physicalName:we})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:W(F),items:n.unref(Zl)(((He=F.dbAttrs[0])==null?void 0:He.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(ua),"model-value":((Be=F.dbAttrs[0])==null?void 0:Be.dataType)??"","onUpdate:modelValue":we=>we&&v(F,{dataType:we})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:W(F),"model-value":(Fe=F.dbAttrs[0])==null?void 0:Fe.length,"onUpdate:modelValue":we=>v(F,{length:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:W(F)||!T(F),"model-value":(xt=F.dbAttrs[0])==null?void 0:xt.scale,"onUpdate:modelValue":we=>v(F,{scale:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Xt=F.dbAttrs[0])==null?void 0:Xt.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",q$,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:l.value||W(F),"onUpdate:modelValue":we=>X(F,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:W(F),"onUpdate:modelValue":we=>N(F,{notNull:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((jt=F.dbAttrs[0])!=null&&jt.unique),disabled:W(F),"onUpdate:modelValue":we=>v(F,{unique:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Je=F.dbAttrs[0])!=null&&Je.autoIncrement),disabled:W(F)||!F.identifier,"onUpdate:modelValue":we=>v(F,{autoIncrement:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${F.modelId}`,label:"@Transient","model-value":!!F.transient,disabled:F.identifier,"onUpdate:modelValue":we=>K(F,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||W(F),"onUpdate:modelValue":we=>q(F,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:W(F)||!F.naturalId,"onUpdate:modelValue":we=>N(F,{naturalIdMutable:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ao=F.dbAttrs[0])!=null&&Ao.multiValue),disabled:W(F),"onUpdate:modelValue":we=>v(F,{multiValue:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",X$,[z[1]||(z[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:W(F),"model-value":S(F.dbAttrs[0]),items:x,"value-provider":b,"label-provider":B,"onUpdate:modelValue":we=>we&&O(F,we)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",j$,[z[2]||(z[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:W(F),"model-value":xe(F.dbAttrs[0]),items:ke,"value-provider":b,"label-provider":be,"onUpdate:modelValue":we=>we&&Te(F,we)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Z$,[z[3]||(z[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(F),items:h,"value-provider":b,"label-provider":_,"onUpdate:modelValue":we=>we&&te(F,we)},null,8,["model-value","onUpdate:modelValue"])]),ue.value.length?(n.openBlock(),n.createElementBlock("label",J$,[z[4]||(z[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(bd,{"model-value":F.groupCode,items:ue.value,"onUpdate:modelValue":we=>pe(F,we)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!ue.value.length}])},[z[5]||(z[5]=n.createElementVNode("span",null,"기본값",-1)),he(F).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:ve(F),"value-provider":Se,"label-provider":Ie,"onUpdate:modelValue":we=>we&&j(F,we)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:"기본값","model-value":F.defaultValue??"","onUpdate:modelValue":we=>Y(F,we)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Q$,[z[6]||(z[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(fl,{multiline:"",name:`attr-desc-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":F.description,"onUpdate:modelValue":we=>P(F,we)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",rx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(F)===null}]),title:"없음",onClick:we=>y(F,null)},"∅",10,sx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),we=>(n.openBlock(),n.createElementBlock("button",{key:we,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(F)===we}]),style:n.normalizeStyle({background:n.unref(Dn)(we)}),title:n.unref(Bn)(we),onClick:Qe=>y(F,we)},null,14,cx))),128)),I(F)?(n.openBlock(),n.createElementBlock("span",dx,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,H$)}),128))],8,T$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-52beb53b"]]),mx=["disabled"],px={class:"em-panel__sub-label"},hx={class:"em-attr__row"},yx={class:"em-field em-idx-params"},gx=["value","onChange"],bx=Pe(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(m=>m.modelId===o.entityId)??null);function r(){var h;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Me(),name:`idx_${(((h=l.value.indexes)==null?void 0:h.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,h){l.value&&a.updateIndex(l.value.modelId,m,h)}function c(m){var _;const h=(_=l.value)==null?void 0:_.attributes[0];h&&s(m.modelId,{columns:[...m.columns,{columnRef:h.modelId,descending:!1}]})}function d(m,h,_){s(m.modelId,{columns:m.columns.map((b,g)=>g===h?{...b,columnRef:_}:b)})}function u(m,h,_){s(m.modelId,{columns:m.columns.map((b,g)=>g===h?{...b,descending:_}:b)})}function f(m,h){s(m.modelId,{columns:m.columns.filter((_,b)=>b!==h)})}function p(m,h){s(m.modelId,{parameters:h.trim()===""?void 0:h})}return(m,h)=>{var _;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:h[0]||(h[0]=b=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",px,[e.collapsible?(n.openBlock(),n.createBlock(Re,{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(((_=l.value.indexes)==null?void 0:_.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],b=>(n.openBlock(),n.createElementBlock("div",{key:b.modelId,class:"em-attr"},[n.createElementVNode("div",hx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${b.modelId}`,width:"100%",placeholder:"인덱스명","model-value":b.name,"onUpdate:modelValue":g=>s(b.modelId,{name:g})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${b.modelId}`,class:"em-check",label:"UQ","model-value":b.unique,"onUpdate:modelValue":g=>s(b.modelId,{unique:g})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:g=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":b.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.columns,(g,I)=>(n.openBlock(),n.createElementBlock("div",{key:I,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":g.columnRef,items:l.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&d(b,I,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${b.modelId}-desc-${I}`,class:"em-check",label:"DESC","model-value":g.descending,"onUpdate:modelValue":y=>u(b,I,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:y=>f(b,I)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:g=>c(b)},null,8,["onClick"]),n.createElementVNode("label",yx,[h[1]||(h[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:g=>p(b,g.target.value)},null,40,gx)])]))),128)):n.createCommentVNode("",!0)],8,mx)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),_x=["disabled"],wx={class:"em-panel__sub-label"},vx={class:"em-attr__row"},kx={class:"em-attr__row"},Ex={class:"em-multilang"},Nx={class:"em-attr__pii"},$x={class:"em-swatch__row em-attr__swatch"},xx=["onClick"],Ix=["title","onClick"],Sx=Pe(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=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(y=>y.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(y=>y.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(y){return y==="none"?"(없음)":y}const f=y=>y;function p(y,N){r.value&&a.updateOperation(r.value.modelId,y.modelId,N)}function m(y,N){p(y,{description:Object.keys(N).length?N:void 0})}function h(y){return y.personalInfoAttributeType??"none"}function _(y,N){p(y,{personalInfoAttributeType:N==="none"?void 0:N})}function b(y){var N,q;return nt((q=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:q[y.modelId])}function g(y,N){r.value&&a.setOperationSwatch(r.value.modelId,y.modelId,N)}function I(y){l.openModal({component:_d,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:N=>p(y,{sourceCode:N})}})}return(y,N)=>{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:N[1]||(N[1]=U=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",wx,[e.collapsible?(n.openBlock(),n.createBlock(Re,{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(ie.BSButton),{variant:"text",caption:"추가",onClick:N[0]||(N[0]=n.withModifiers(U=>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??[],U=>(n.openBlock(),n.createElementBlock("div",{key:U.modelId,class:"em-attr"},[n.createElementVNode("div",vx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${U.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":U.name,"onUpdate:modelValue":X=>p(U,{name:X})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":U.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":X=>X&&p(U,{visibility:X})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(a).removeOperation(r.value.modelId,U.modelId)},null,8,["onClick"])]),n.createElementVNode("div",kx,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:U.sourceCode?"본문 편집 ●":"본문 편집",onClick:X=>I(U)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Ex,[N[2]||(N[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(fl,{multiline:"",name:`op-desc-${U.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":U.description,"onUpdate:modelValue":X=>m(U,X)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Nx,[N[3]||(N[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":h(U),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":X=>X&&_(U,X)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",$x,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(U)===null}]),title:"없음",onClick:X=>g(U,null)},"∅",10,xx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),X=>(n.openBlock(),n.createElementBlock("button",{key:X,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(U)===X}]),style:n.normalizeStyle({background:n.unref(Dn)(X)}),title:n.unref(Bn)(X),onClick:K=>g(U,X)},null,14,Ix))),128))])]))),128)):n.createCommentVNode("",!0)],8,_x)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),Cx={class:"em-panel__head"},Rx={class:"em-panel__head-row"},Vx={class:"em-panel__context"},Ax={key:0,class:"em-panel__lock"},Tx=["disabled"],Mx={key:0,class:"em-panel__note"},Bx={key:1,class:"em-panel__note"},Dx={key:2,class:"em-jpa"},Ox={class:"em-field"},Lx={class:"em-field"},Px={key:0,class:"em-field"},zx={class:"em-panel__sub"},Ux={class:"em-field"},Hx={class:"em-jpa"},Fx={key:0,class:"em-panel__note"},Gx={class:"em-jpa"},Yx={class:"em-field"},Wx={key:0,class:"em-panel__note"},Kx={class:"em-field"},qx={class:"em-multilang"},Xx={class:"em-field"},jx=["value"],Zx={class:"em-field"},Jx={class:"em-swatch"},Qx={class:"em-swatch__row"},eI=["title","onClick"],tI={class:"em-panel__note"},nI={class:"em-field"},oI=["value"],iI={class:"em-swatch"},aI={class:"em-swatch__row"},lI=["title","onClick"],zu=Pe(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(Y=>Y.modelId===j)??null:null}),c=n.computed(()=>{const j=l.value;if((j==null?void 0:j.kind)==="association"){const E=a.state.logical.associations.find(A=>A.modelId===j.id);return!!E&&(a.isEntityLocked(E.end1.entityRef)||a.isEntityLocked(E.end2.entityRef))}const Y=r.value;return!!Y&&a.isEntityLocked(Y)}),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 h(j){p.value={...p.value,[j]:!m(j)}}const _=n.computed(()=>{var E;const j=s.value;if(!j)return"엔티티";const Y=(E=j.table)==null?void 0:E.physicalName;return Y?`${j.name} (${Y})`:j.name}),b=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="association"?a.state.logical.associations.find(Y=>Y.modelId===j.id)??null:null}),g=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="group"?a.state.logical.groups.find(Y=>Y.modelId===j.id)??null:null}),I=n.computed(()=>{const j=l.value;return(j==null?void 0:j.kind)==="note"?a.state.layout.notes.find(Y=>Y.modelId===j.id)??null:null}),y=n.computed(()=>{var Y,E;const j=(Y=g.value)==null?void 0:Y.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)||((E=g.value)==null?void 0:E.packageName)||"그룹"}),N=n.computed(()=>{if(s.value){const j=u.value.size;if(j>1)return`엔티티 · ${s.value.name} › 속성 · ${j}개`;if(d.value){const Y=s.value.attributes.find(E=>E.modelId===d.value);return(Y==null?void 0:Y.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(Y==null?void 0:Y.name)??""}`}return`엔티티 · ${s.value.name}`}if(b.value){const j=Y=>{var E;return((E=a.state.logical.entities.find(A=>A.modelId===Y))==null?void 0:E.name)??Y};return`관계 · ${j(b.value.end1.entityRef)} — ${j(b.value.end2.entityRef)}`}return g.value?`그룹 · ${y.value}`:I.value?"노트":"선택된 항목 없음"}),q=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],U=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],X=["LIST","SET"],K=["inherit","LAZY","EAGER"],W=j=>j;function ne(j){return j==="inherit"?"기본(따름)":j}const re=n.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function L(j,Y){b.value&&a.updateAssociationEnd(b.value.modelId,j,Y)}function Q(j){b.value&&!re.value&&a.setAssociationIdentifying(b.value.modelId,j)}function v(j){var Y,E,A;return!!((A=(E=(Y=b.value)==null?void 0:Y[j].jpa)==null?void 0:E.cascadeTypes)!=null&&A.includes("ALL"))}function T(j,Y,E){var G,J;const A=(G=b.value)==null?void 0:G[j];if(Y==="ALL"&&E){L(j,{jpa:{...A==null?void 0:A.jpa,cascadeTypes:["ALL"]}});return}const R=new Set(((J=A==null?void 0:A.jpa)==null?void 0:J.cascadeTypes)??[]);E?R.add(Y):R.delete(Y),L(j,{jpa:{...A==null?void 0:A.jpa,cascadeTypes:[...R]}})}function $(j,Y){var A;const E=(A=b.value)==null?void 0:A[j];L(j,{jpa:{...E==null?void 0:E.jpa,...Y}})}function P(j){var Y,E;return((E=(Y=b.value)==null?void 0:Y[j].jpa)==null?void 0:E.fetchType)??"inherit"}function H(j,Y){$(j,{fetchType:Y==="inherit"?void 0:Y})}function te(j){var E;const Y=(E=b.value)==null?void 0:E[j==="end1"?"end2":"end1"];return(Y==null?void 0:Y.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(Y==null?void 0:Y.multiplicity)==="ONE_OR_MORE_INSTANCES"}const M=n.computed(()=>{const j=b.value;if(!j)return null;for(const Y of a.state.logical.entities){const E=Y.attributes.find(G=>{var J;return((J=G.embedded)==null?void 0:J.associationRef)===j.modelId&&G.attrType==="EMBED_OWN"});if(!E)continue;const A=j.end2.entityRef===E.embedded.embeddableRef?"end2":"end1",R=j[A].jpa;return{which:A,isCollection:j[A].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(R==null?void 0:R.collectionType)??"LIST",collectionTable:(R==null?void 0:R.collectionTable)??"",orderColumn:(R==null?void 0:R.orderColumn)??""}}return null});function ee(j){b.value&&a.setEmbedCollectionMode(b.value.modelId,j?"COLLECTION":"SINGLE")}function le(j){const Y=M.value;Y&&$(Y.which,j==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function me(j){const Y=M.value;Y&&$(Y.which,{collectionTable:j.trim()||void 0})}function ye(j){const Y=M.value;Y&&$(Y.which,{orderColumn:j.trim()||void 0})}function ce(j){g.value&&a.updateGroup(g.value.modelId,j)}function ue(j,Y){var E;ce({name:{...(E=g.value)==null?void 0:E.name,[j]:Y}})}const he=n.computed(()=>{var j;return g.value?nt((j=a.state.layout.groupLayouts.find(Y=>Y.groupRef===g.value.modelId))==null?void 0:j.style):null});function ve(j){g.value&&a.setGroupSwatch(g.value.modelId,j)}function Se(j){I.value&&a.setNoteMemo(I.value.modelId,j)}const Ie=n.computed(()=>{var j;return nt((j=I.value)==null?void 0:j.style)});function pe(j){I.value&&a.setNoteSwatch(I.value.modelId,j)}return(j,Y)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:"너비 조절",onPointerdown:Y[0]||(Y[0]=(...E)=>e.startResize&&e.startResize(...E))},null,34),n.createElementVNode("header",Cx,[n.createElementVNode("div",Rx,[Y[13]||(Y[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:Y[1]||(Y[1]=E=>i("collapse"))},[n.createVNode(Re,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",Vx,n.toDisplayString(N.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",Ax,[n.createVNode(Re,{name:"lock",size:13}),Y[14]||(Y[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:Y[2]||(Y[2]=E=>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(yd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:_.value,onToggle:Y[3]||(Y[3]=E=>h("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(fx,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(bx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:Y[4]||(Y[4]=E=>h("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(Sx,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:Y[5]||(Y[5]=E=>h("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!b.value.identifying,disabled:re.value||!!M.value,"onUpdate:modelValue":Q},null,8,["model-value","disabled"]),re.value?(n.openBlock(),n.createElementBlock("p",Mx,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):M.value?(n.openBlock(),n.createElementBlock("p",Bx,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),M.value?(n.openBlock(),n.createElementBlock("fieldset",Dx,[Y[18]||(Y[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":M.value.isCollection,"onUpdate:modelValue":ee},null,8,["model-value"]),M.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",Ox,[Y[15]||(Y[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":M.value.collectionType,items:X,"value-provider":W,"label-provider":W,"onUpdate:modelValue":Y[6]||(Y[6]=E=>E&&le(E))},null,8,["model-value"])]),n.createElementVNode("label",Lx,[Y[16]||(Y[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":M.value.collectionTable,"onUpdate:modelValue":me},null,8,["model-value"])]),M.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",Px,[Y[17]||(Y[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":M.value.orderColumn,"onUpdate:modelValue":ye},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),Y[19]||(Y[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],E=>{var A,R,G,J;return n.createElementVNode("div",{key:E,class:"em-end"},[n.createElementVNode("h4",zx,n.toDisplayString(E)+" → "+n.toDisplayString(b.value[E].entityRef),1),n.createElementVNode("label",Ux,[Y[20]||(Y[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":b.value[E].multiplicity,items:q,"value-provider":W,"label-provider":W,disabled:((A=M.value)==null?void 0:A.which)===E,"onUpdate:modelValue":fe=>L(E,{multiplicity:fe})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${E}-navigable`,class:"em-check",label:"navigable","model-value":b.value[E].navigable,"onUpdate:modelValue":fe=>L(E,{navigable:fe})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${E}-composition`,class:"em-check",label:"composition","model-value":b.value[E].composition,"onUpdate:modelValue":fe=>L(E,{composition:fe})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",Hx,[Y[21]||(Y[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(U,fe=>{var _e,ke;return n.createVNode(n.unref(ie.BSCheckbox),{key:fe,name:`${E}-cascade-${fe}`,class:"em-check",label:fe,"model-value":!!((ke=(_e=b.value[E].jpa)==null?void 0:_e.cascadeTypes)!=null&&ke.includes(fe)),disabled:fe!=="ALL"&&v(E),"onUpdate:modelValue":be=>T(E,fe,be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),v(E)?(n.openBlock(),n.createElementBlock("p",Fx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",Gx,[Y[24]||(Y[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",Yx,[Y[22]||(Y[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":P(E),items:K,"value-provider":W,"label-provider":ne,"onUpdate:modelValue":fe=>fe&&H(E,fe)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${E}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((R=b.value[E].jpa)!=null&&R.orphanRemoval),disabled:te(E),"onUpdate:modelValue":fe=>$(E,{orphanRemoval:fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),te(E)&&((G=b.value[E].jpa)!=null&&G.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",Wx,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",Kx,[Y[23]||(Y[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${E}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=b.value[E].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":fe=>$(E,{orderBy:fe.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",qx,[Y[25]||(Y[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,E=>{var A;return n.openBlock(),n.createElementBlock("label",{key:E,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(E),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${E}`,width:"100%","model-value":((A=g.value.name)==null?void 0:A[E])??"","onUpdate:modelValue":R=>ue(E,R)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",Xx,[Y[26]||(Y[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:g.value.description??"",rows:"3",onChange:Y[7]||(Y[7]=E=>ce({description:E.target.value}))},null,40,jx)]),n.createElementVNode("label",Zx,[Y[27]||(Y[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":g.value.packageName??"","onUpdate:modelValue":Y[8]||(Y[8]=E=>ce({packageName:E}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":g.value.excludeDDLGeneration,"onUpdate:modelValue":Y[9]||(Y[9]=E=>ce({excludeDDLGeneration:E}))},null,8,["model-value"]),n.createElementVNode("fieldset",Jx,[Y[28]||(Y[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",Qx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":he.value===null}]),title:"없음",onClick:Y[10]||(Y[10]=E=>ve(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),E=>(n.openBlock(),n.createElementBlock("button",{key:E,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":he.value===E}]),style:n.normalizeStyle({background:n.unref(Dn)(E)}),title:n.unref(Bn)(E),onClick:A=>ve(E)},null,14,eI))),128))])]),n.createElementVNode("p",tI,"멤버 엔티티 "+n.toDisplayString(g.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),I.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",nI,[Y[29]||(Y[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:I.value.memo,rows:"6",onChange:Y[11]||(Y[11]=E=>Se(E.target.value))},null,40,oI)]),n.createElementVNode("fieldset",iI,[Y[30]||(Y[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",aI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ie.value===null}]),title:"없음",onClick:Y[12]||(Y[12]=E=>pe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),E=>(n.openBlock(),n.createElementBlock("button",{key:E,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Ie.value===E}]),style:n.normalizeStyle({background:n.unref(Dn)(E)}),title:n.unref(Bn)(E),onClick:A=>pe(E)},null,14,lI))),128))])])],64)):n.createCommentVNode("",!0)],8,Tx)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),rI={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function sI(e){const t=e.split("-")[1];return t?rI[t]??t:e}function cI(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const dI=["title"],uI=["title","onClick"],fI={key:0,class:"em-validation__body"},mI={class:"em-validation__opt"},pI={key:0,class:"em-validation__empty"},hI={key:1,class:"em-validation__empty"},yI={key:2,class:"em-validation__list"},gI=["onClick"],bI={class:"em-validation__item-msg"},_I={key:0,class:"em-validation__item-entity"},wI=["title"],vI=Pe(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 _=new Map;for(const b of o.state.logical.entities)_.set(b.modelId,b.name);return _});function l(_){const b=cI(_);if(!b)return null;const g=a.value.get(b);return g===void 0?null:g.trim()===""?"(이름 없음)":g}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 _={error:0,warning:0,info:0};for(const b of i.value)_[b.severity]++;return _}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,b)=>r[_.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(_=>({issue:_,entityName:l(_),category:sI(_.ruleId)}))),f=n.ref(!1);function p(_){c.value[_]=!c.value[_]}function m(_){if(!f.value){f.value=!0;return}p(_)}function h(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,b)=>(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:b[1]||(b[1]=g=>f.value=!f.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:f.value?"접기":"펼치기"},[n.createVNode(Re,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":f.value},"em-validation__chevron"])},null,8,["class"]),b[3]||(b[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,dI),n.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],g=>n.createElementVNode("button",{key:g,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${g}`,{"is-off":!c.value[g]}]]),title:f.value?`${r[g].label} ${c.value[g]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:I=>m(g)},[n.createVNode(Re,{name:r[g].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[g]),1)],10,uI)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",fI,[n.createElementVNode("label",mI,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=g=>n.unref(o).flagEntitiesWithoutRelations.value=g)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",pI,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",hI," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",yI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:g,entityName:I,category:y},N)=>(n.openBlock(),n.createElementBlock("li",{key:`${g.ruleId}:${g.targetRef??"model"}:${N}`,class:n.normalizeClass(["em-validation__item",[`is-${g.severity}`,{"is-clickable":!!g.targetRef}]]),onClick:q=>h(g)},[n.createVNode(Re,{name:r[g.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",bI,[I?(n.openBlock(),n.createElementBlock("span",_I,n.toDisplayString(I),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(g.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:g.ruleId},n.toDisplayString(y),9,wI)],10,gI))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),kI={class:"em-history"},EI={class:"em-history__head"},NI={class:"em-history__title"},$I={class:"em-history__head-actions"},xI=["disabled"],II={class:"em-history__filters"},SI={class:"em-history__filter"},CI={class:"em-history__body"},RI={key:0,class:"em-history__empty"},VI={key:1,class:"em-history__empty is-error"},AI={key:2,class:"em-history__empty"},TI={key:3,class:"em-history__list"},MI=["onClick"],BI={class:"em-history__summary"},DI={class:"em-history__seq"},OI={class:"em-history__gmeta"},LI={class:"em-history__who"},PI={key:0,class:"em-history__time"},zI={key:1,class:"em-history__restored-from"},UI={key:0,class:"em-history__detail"},HI={class:"em-history__action-head"},FI={class:"em-history__action-name"},GI={key:0,class:"em-history__fields"},YI={class:"em-history__fname"},WI={key:0,class:"em-history__old"},KI={class:"em-history__val"},qI={key:1,class:"em-history__restore"},XI=["disabled","onClick"],jI=["disabled"],ZI=["onClick"],JI=Pe(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(M){s.value=M instanceof Error?M.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,M=>{M&&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(M=>[M.modelId,M]))),m=n.computed(()=>new Map(a.state.logical.associations.map(M=>[M.modelId,M]))),h=n.computed(()=>new Map((a.state.logical.groups??[]).map(M=>{var ee;return[M.modelId,M.packageName||((ee=M.name)==null?void 0:ee.ko)||M.modelId]})));function _(M){var ye,ce,ue,he,ve,Se,Ie;const ee=m.value.get(M);if(!ee)return"연관";if((ye=ee.description)!=null&&ye.trim())return ee.description.trim();const le=(he=(ue=p.value.get((ce=ee.end1)==null?void 0:ce.entityRef))==null?void 0:ue.name)==null?void 0:he.trim(),me=(Ie=(Se=p.value.get((ve=ee.end2)==null?void 0:ve.entityRef))==null?void 0:Se.name)==null?void 0:Ie.trim();return le&&me?`${le}→${me}`:"연관"}function b(M){var ee,le,me,ye;if(M.kind==="entity")return((le=(ee=p.value.get(M.ref))==null?void 0:ee.name)==null?void 0:le.trim())||"(이름 없음)";if(M.kind==="attribute"||M.kind==="operation"||M.kind==="index"){const ce=M.entityRef?p.value.get(M.entityRef):void 0,he=((M.kind==="attribute"?ce==null?void 0:ce.attributes:M.kind==="operation"?ce==null?void 0:ce.operations:ce==null?void 0:ce.indexes)??[]).find(Se=>Se.modelId===M.ref),ve=(me=ce==null?void 0:ce.name)==null?void 0:me.trim();return`${ve?ve+".":""}${((ye=he==null?void 0:he.name)==null?void 0:ye.trim())||M.ref}`}return M.kind==="association"?_(M.ref):M.kind==="associationEnd"?`${_(M.ref)}(${M.end})`:M.kind==="group"?`그룹 ${h.value.get(M.ref)??M.ref}`:M.ref}const g={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),N=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],q=n.computed({get:()=>y.value,set:M=>{M&&(y.value=M)}}),U=n.computed(()=>lr(l.value)),X=n.computed(()=>U.value.length?U.value[0].seq:null),K=n.computed(()=>y.value==="all"?U.value:U.value.filter(M=>(M.kind??"edit")===y.value));function W(M){return M===void 0?"—":M===null?"(비움)":typeof M=="object"?JSON.stringify(M):String(M)}function ne(M){const ee=b(M.subject);if(M.verb==="add")return`${ee} 추가`;if(M.verb==="remove")return`${ee} 삭제`;if(M.fields.length===1){const le=M.fields[0];return`${ee}.${le.field} ${le.oldValue!==void 0?W(le.oldValue)+"→":""}${W(le.value)}`}return`${ee} ${M.fields.length}개 변경`}function re(M){return M.actions.length===0?"변경 없음":M.actions.length===1?ne(M.actions[0]):`${ne(M.actions[0])} 외 ${M.actions.length-1}건`}const L=n.ref(new Set);function Q(M){const ee=new Set(L.value);ee.has(M)?ee.delete(M):ee.add(M),L.value=ee}function v(M){if(M==null)return"";const ee=new Date(M);return isNaN(ee.getTime())?String(M):ee.toLocaleString()}function T(M){const ee=M.author,le=M.origin;return ee&&le?`${ee}(${le})`:ee||(le?`(${le})`:"—")}const $=n.ref(null),P=n.ref(!1);function H(M){$.value=M}async function te(M){P.value=!0;try{const ee=await a.restoreToSeq(M);ee.ok||(s.value=`복원 실패: ${ee.reason??"알 수 없음"}`)}finally{P.value=!1,$.value=null}}return(M,ee)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",kI,[n.createElementVNode("header",EI,[n.createElementVNode("div",NI,[n.createVNode(Re,{name:"undo",size:15}),ee[4]||(ee[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",$I,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:ee[0]||(ee[0]=le=>d())},[n.createVNode(Re,{name:"redo",size:15})],8,xI),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:ee[1]||(ee[1]=le=>i("close"))},[n.createVNode(Re,{name:"panel-close",size:15})])])]),n.createElementVNode("div",II,[n.createElementVNode("label",SI,[ee[5]||(ee[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:q.value,"onUpdate:modelValue":ee[2]||(ee[2]=le=>q.value=le),items:N,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",CI,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",RI,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",VI,n.toDisplayString(s.value),1)):K.value.length===0?(n.openBlock(),n.createElementBlock("p",AI,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",TI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(K.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:me=>Q(le.seq)},[n.createVNode(Re,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.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",BI,n.toDisplayString(re(le)),1),n.createElementVNode("span",DI,"#"+n.toDisplayString(le.seq),1)],8,MI),n.createElementVNode("div",OI,[n.createElementVNode("span",LI,n.toDisplayString(T(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",PI,n.toDisplayString(v(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",zI,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",UI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(me,ye)=>(n.openBlock(),n.createElementBlock("div",{key:ye,class:"em-history__action"},[n.createElementVNode("div",HI,[n.createVNode(Re,{name:g[me.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",FI,n.toDisplayString(b(me.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${me.verb}`])},n.toDisplayString(I[me.verb]),3)]),me.fields.length?(n.openBlock(),n.createElementBlock("ul",GI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me.fields,(ce,ue)=>(n.openBlock(),n.createElementBlock("li",{key:ue,class:"em-history__field"},[n.createElementVNode("span",YI,n.toDisplayString(ce.field),1),ce.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",WI,n.toDisplayString(W(ce.oldValue)),1)):n.createCommentVNode("",!0),ce.oldValue!==void 0?(n.openBlock(),n.createBlock(Re,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",KI,n.toDisplayString(W(ce.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==X.value?(n.openBlock(),n.createElementBlock("div",qI,[$.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[ee[6]||(ee[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:P.value,onClick:me=>te(le.seq)},"복원",8,XI),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:P.value,onClick:ee[3]||(ee[3]=me=>$.value=null)},"취소",8,jI)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:me=>H(le.seq)},[n.createVNode(Re,{name:"undo",size:12}),ee[7]||(ee[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,ZI))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function QI(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 Uu(e){const t=n.ref(QI(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 eS={class:"em-modeler"},tS={class:"em-modeler__body"},nS={class:"em-drawer__inner"},oS={class:"em-drawer__head"},iS={class:"em-drawer__actions"},aS=["title"],lS=Pe(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}=Uu({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Uu({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(p,m)=>{var h,_,b;return n.openBlock(),n.createElementBlock("div",eS,[n.createVNode(Pu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=g=>{var I;return(I=u.value)==null?void 0:I.exportSvg()}),onToggleHistory:m[1]||(m[1]=g=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",tS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",nS,[n.createElementVNode("header",oS,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",iS,[(h=f.value)!=null&&h.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(_=f.value)!=null&&_.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=g=>{var I;return(I=f.value)==null?void 0:I.toggleAll()})},[n.createVNode(Re,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,aS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=g=>t.value=!1)},[n.createVNode(Re,{name:"panel-close",size:16})])])]),n.createVNode(Lu,{ref_key:"explorer",ref:f,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(l)}]),title:"너비 조절",onPointerdown:m[4]||(m[4]=(...g)=>n.unref(r)&&n.unref(r)(...g))},null,34),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:"Diagram Explorer 열기",onClick:m[5]||(m[5]=g=>t.value=!0)},[n.createVNode(Re,{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(Ou,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(zu,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[6]||(m[6]=g=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:"Inspector 열기",onClick:m[7]||(m[7]=g=>o.value=!0)},[n.createVNode(Re,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(JI,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=g=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(vI,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-dc519653"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=dm,Ee.AssociationEdge=Ud,Ee.CUSTOM_TYPE_VALUE=Lt,Ee.CommandStack=_a,Ee.DEFAULT_JAVA_TYPE=fa,Ee.DiagramCanvas=Ou,Ee.DiagramExplorer=Lu,Ee.EDITOR=pn,Ee.EditModeToggle=A$,Ee.EditorToolbar=Pu,Ee.EntityModeler=lS,Ee.EntityNode=$d,Ee.GROUP_CODE_ENUM_VALUE=Yn,Ee.GroupNode=xd,Ee.JAVA_TYPES=ma,Ee.NoteNode=Id,Ee.OpSyncAdapter=jr,Ee.PHYSICAL_NAME_MAX_LENGTH=ha,Ee.PropertyPanel=zu,Ee.RevCache=Xr,Ee.SELECTABLE_JAVA_TYPES=Jl,Ee.SYMBOLIC_OP_KINDS=Zr,Ee.SYMBOLIC_OP_SCHEMA=ss,Ee.anchoredEdgePoint=sa,Ee.buildAgentBatch=um,Ee.buildDiagramSvg=Bu,Ee.buildOrthogonalPath=ia,Ee.buildSelfLoopPath=Fl,Ee.buildStraightPath=la,Ee.commands=Mf,Ee.computeAutoLayout=Gl,Ee.createEditorController=W_,Ee.displayLabel=Lo,Ee.emptyState=vd,Ee.entityModelToText=ql,Ee.estimateEntityHeight=Wl,Ee.exportDiagramSvg=Du,Ee.fromPersisted=Nm,Ee.indexColumnsByModelId=Wn,Ee.javaTypeLabel=wn,Ee.migrateLegacyMoney=hf,Ee.newId=Me,Ee.orthogonalMidpoints=aa,Ee.packEntityBoxes=qu,Ee.physicalNameWarning=Uo,Ee.projectActionLog=lr,Ee.projectEntityAudit=ir,Ee.projectFieldAudit=Pt,Ee.rectExitPoint=ra,Ee.renderDiagramSvg=jl,Ee.resolveDiagram=Ul,Ee.resolveSharedColumn=zo,Ee.resolveSymbolicOps=em,Ee.restoreDeepEqual=vn,Ee.segmentMidpoints=ca,Ee.sideDir=Gn,Ee.synthesizeRestoreOps=$f,Ee.toPersisted=Lm,Ee.toPersistedV2=Pm,Ee.validateModel=nr,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));
|
|
41
|
+
v${-(O.value.height-2*e.maskBorderRadius)}
|
|
42
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(y.value){const ae=qt(y.value),v=me=>{if(me.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const he=me.sourceEvent.ctrlKey&&wo()?10:1,se=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,ce=c.value.zoom*2**(se*he);m.value.scaleTo(h.value,ce)},q=me=>{if(me.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const he=F.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-me.sourceEvent.movementX*he,y:c.value.y-me.sourceEvent.movementY*he},ce=[[0,0],[u.value.width,u.value.height]],ye=Fl.translate(se.x,se.y).scale(c.value.zoom),ke=m.value.constrain()(ye,ce,d.value);m.value.transform(h.value,ke)},le=c$().wheelDelta(me=>ll(me)*(e.zoomStep/10)).on("zoom",e.pannable?q:()=>{}).on("zoom.wheel",e.zoomable?v:()=>{});ae.call(le),H(()=>{ae.on("zoom",null)})}},{flush:"post"});function L(H){const[ae,v]=Xt(H);t("click",{event:H,position:{x:ae,y:v}})}function oe(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeClick(v),t("nodeClick",v)}function k(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeDoubleClick(v),t("nodeDblclick",v)}function W(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseEnter(v),t("nodeMouseenter",v)}function R(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseMove(v),t("nodeMousemove",v)}function G(H,ae){const v={event:H,node:ae,connectedEdges:cn([ae],s.value)};f.miniMapNodeMouseLeave(v),t("nodeMouseleave",v)}return(H,ae)=>(n.openBlock(),n.createBlock(n.unref($d),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:y,width:b.value,height:_.value,viewBox:[ne.value.x,ne.value.y,ne.value.width,ne.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:L},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,p$)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),v=>(n.openBlock(),n.createBlock(f$,{id:v.id,key:v.id,f:"",position:v.computedPosition,dimensions:v.dimensions,selected:v.selected,dragging:v.dragging,style:n.normalizeStyle(v.style),class:n.normalizeClass(te.value(v)),color:g.value(v),"border-radius":H.nodeBorderRadius,"stroke-color":N.value(v),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref(A),type:v.type,hidden:v.hidden,onClick:q=>oe(q,v),onDblclick:q=>k(q,v),onMouseenter:q=>W(q,v),onMousemove:q=>R(q,v),onMouseleave:q=>G(q,v)},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:re.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,h$)],8,m$))]),_:1},8,["position","class"]))}}),b$=["d"],_$=["cx","cy","onDblclick"],k$=["x","y","onPointerdown","onDblclick"],w$=Ue(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Le(),i=n.inject(Nl),a=n.inject(pn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Un,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((z,F)=>F===d.value?u.value:z)),{source:h,target:m,sourceSide:p,targetSide:y}=Jd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?da(h.value,p.value,f.value,m.value,y.value):fa(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ua(h.value,p.value,f.value,m.value,y.value):ha(h.value,f.value,m.value).map((z,F)=>({point:z,segIndex:F})):[]),A=n.computed(()=>l.value?f.value:[]);function g(z,F){d.value=z,u.value={...c.value[z]},F.target.setPointerCapture(F.pointerId),F.stopPropagation()}function N(z){if(d.value<0)return;const F=o({x:z.clientX,y:z.clientY});u.value={x:F.x,y:F.y}}function te(z){var F,ne;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(ne=(F=z.target).releasePointerCapture)==null||ne.call(F,z.pointerId)}function S(z,F){F.stopPropagation(),i==null||i.removePoint(t.id,z)}function O(z,F){if(!i)return;const ne=o({x:F.clientX,y:F.clientY});i.insertPoint(t.id,z,{x:ne.x,y:ne.y})}return(z,F)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,b$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(ne,re)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${re}`,cx:ne.point.x,cy:ne.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(L=>O(ne.segIndex,L),["stop"])},null,42,_$))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(A.value,(ne,re)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${re}`,x:ne.x-5,y:ne.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:L=>g(re,L),onPointermove:N,onPointerup:te,onDblclick:L=>S(re,L)},null,42,k$))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),E$=["data-theme"],v$={key:0,class:"em-ctx__sep",role:"separator"},N$={key:1,class:"em-ctx__swatches"},$$={class:"em-ctx__swatches-label"},x$={class:"em-ctx__chips"},I$=["onClick"],S$=["title","onClick"],C$=["disabled","onClick"],R$={class:"em-ctx__icon"},V$={class:"em-ctx__caption"},A$=Ue(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,p){var _;i.value=p,a.value=(_=m.target)!=null&&_.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 y=l.value;if(!y)return;const b=y.getBoundingClientRect();r.x+b.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-b.width)),r.y+b.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-b.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 h(m,p){m.onPick(p),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,p)=>(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:p[0]||(p[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(y,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[y.type==="separator"?(n.openBlock(),n.createElementBlock("div",v$)):y.type==="swatches"?(n.openBlock(),n.createElementBlock("div",N$,[n.createElementVNode("span",$$,n.toDisplayString(y.caption),1),n.createElementVNode("div",x$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":y.current===null}]),title:"없음",onClick:_=>h(y,null)},null,10,I$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":y.current===_}]),style:n.normalizeStyle({background:n.unref(Ln)(_)}),title:n.unref(On)(_),onClick:A=>h(y,_)},null,14,S$))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":y.danger,"is-disabled":y.disabled}]),disabled:y.disabled,role:"menuitem",onClick:_=>f(y)},[n.createElementVNode("span",R$,[y.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:y.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",V$,n.toDisplayString(y.caption),1)],10,C$))],64))),128))],36)],8,E$)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Yl=[".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 Yn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function T$(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function M$(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 p=r.length?a.getBoundingClientRect():e.getBoundingClientRect();if(p.width===0&&p.height===0)return[];const y=t(p.left,p.top+p.height/2);return[{...i,x:y.x,y:y.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const y=t(f,(u+h)/2);c.push({...i,x:y.x,y:y.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const y=a.getBoundingClientRect();u===null||Math.abs(y.top-u)>1?(m(),u=y.top,f=y.left,h=y.bottom,d=s[p]):(d+=s[p],h=Math.max(h,y.bottom))}return m(),c}function ra(e,t){const o=[];for(const i of e.querySelectorAll("*"))T$(i)&&(i.closest(Yl)||Yn(i)&&o.push(...M$(i,t)));return o}function To(e){return Math.round(e*100)/100}function B$(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Yl)||!Yn(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="${To(l.x)}" y="${To(l.y)}" width="${To(r.x-l.x)}" height="${To(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 D$(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Yn(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=>To(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 Wu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Yl)||!Yn(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 Mo(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 Wl(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 O$(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,p)=>e.screenToFlowCoordinate({x:m,y:p}),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 p=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!p||!Yn(p))continue;const y=p.firstElementChild;if(y)if(m.type==="group"){const b=Mo(y,o);Wl(s,b),i.push({...b,texts:[]});const _=y.querySelector(".em-group__label");_&&i.push({...Mo(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o)})}else if(m.type==="note"){const b={...Mo(y,o),texts:ra(y,o),lines:Wu(y,y,o)};Wl(s,b),l.push(b)}else{const b=Mo(y,o);Wl(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const A=y.querySelector(".em-entity__header");if(A){const g=Mo(A,o);a.push({x:b.x,y:b.y,w:b.w,h:g.y+g.h-b.y,fill:g.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ra(y,o),lines:Wu(y,y,o),icons:B$(y,o)}),a.push({...b,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const p=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!p||!Yn(p))continue;const y=p.getAttribute("d");if(!y)continue;const b=getComputedStyle(p),_=b.strokeDasharray,A=D$(m);r.push({d:y,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ra(m,o),markers:A.length?A: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 Kl(e){return sr(O$(e))}function Ku(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 qu(e,t="diagram.svg"){const o=Kl(e);Ku(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function L$(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 Xu(e,t="diagram.png",o=2){const i=Kl(e),{w:a,h:l}=L$(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,h)=>{s.onload=()=>f(),s.onerror=()=>h(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 변환 실패");Ku(u,t)}finally{URL.revokeObjectURL(r)}}const P$={class:"em-shortcuts"},z$={class:"em-shortcuts__title"},U$={class:"em-shortcuts__keys"},H$={class:"em-shortcuts__kbd"},F$={key:0,class:"em-shortcuts__plus"},G$={class:"em-shortcuts__desc"},Y$={class:"em-shortcuts__actions"},ju=Ue(n.defineComponent({__name:"ShortcutHelpModal",setup(e){const t=ie.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(ie.BSModalFrame),{title:"키보드 단축키"},{default:n.withCtx(()=>[n.createElementVNode("div",P$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,s=>n.createElementVNode("section",{key:s.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",z$,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",U$,[(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",H$,n.toDisplayString(d),1),u<c.keys.length-1?(n.openBlock(),n.createElementBlock("span",F$,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",G$,n.toDisplayString(c.desc),1)]))),128))])),64)),n.createElementVNode("div",Y$,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:r[0]||(r[0]=s=>n.unref(t).close())})])])]),_:1}))}}),[["__scopeId","data-v-bb2fb594"]]);function W$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const K$={key:0,class:"em-canvas__empty","aria-hidden":"true"},q$={key:1,class:"em-canvas__empty-title"},X$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},j$={class:"em-conflict-banner__body"},Z$={class:"em-conflict-banner__title"},J$={class:"em-conflict-banner__detail"},Q$={key:0,class:"em-toast",role:"status","aria-live":"polite"},ql="nc:",Zu=Ue(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.ref(null);let r;n.watch(()=>i.notice.value,x=>{x&&(l.value=x.text,r&&clearTimeout(r),r=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>r&&clearTimeout(r));const s=n.computed(()=>W$(i.opConflict.value)),c=n.ref(!1),d=n.ref(!1),u={x:0,y:0};function f(x){u.x=x.clientX,u.y=x.clientY}const h=n.ref(null);n.provide(Ui,h);const m=n.ref(null);n.provide(Dd,m);const p=n.ref(null),y=n.computed(()=>{const x=p.value,D=new Set;if(!x)return D;if(x.kind==="entity")D.add(x.id);else if(x.kind==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===x.id);for(const U of($==null?void 0:$.group.memberEntityRefs)??[])D.add(U)}return D}),b=n.computed(()=>{const x=p.value,D=new Set(y.value),$=new Set,U=new Set;if(!x)return{related:D,edges:$,notes:U};if(x.kind==="note"){U.add(x.id);for(const ee of i.resolved.value.noteConnections)ee.noteRef===x.id&&D.add(ee.targetRef);return{related:D,edges:$,notes:U}}const P=y.value;if(!P.size)return{related:D,edges:$,notes:U};for(const ee of i.resolved.value.associations){const{end1:fe,end2:Ie}=ee.association;(P.has(fe.entityRef)||P.has(Ie.entityRef))&&($.add(ee.association.modelId),D.add(fe.entityRef),D.add(Ie.entityRef))}for(const ee of i.resolved.value.noteConnections)D.has(ee.targetRef)&&U.add(ee.noteRef);return{related:D,edges:$,notes:U}});n.provide(Un,{source:p,active:n.computed(()=>p.value!==null),primaryEntityIds:y,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var x;return((x=p.value)==null?void 0:x.kind)==="group"?p.value.id:null}),setEntityHover:x=>{m.value||d.value||(p.value=x?{kind:"entity",id:x}:null)},setGroupHover:x=>{m.value||d.value||(p.value=x?{kind:"group",id:x}:null)},setNoteHover:x=>{m.value||d.value||(p.value=x?{kind:"note",id:x}:null)}}),n.provide(pn,i);function _(x,D){return`${ql}${x}:${D}`}function A(x){if(!x.startsWith(ql))return null;const[D,$]=x.slice(ql.length).split(":");return D&&$?{noteRef:D,targetRef:$}:null}n.provide(Nl,{points:x=>{var $,U;const D=A(x);return D?(($=i.resolved.value.noteConnections.find(P=>P.noteRef===D.noteRef&&P.targetRef===D.targetRef))==null?void 0:$.waypoints)??[]:((U=i.resolved.value.associations.find(P=>P.association.modelId===x))==null?void 0:U.waypoints)??[]},movePoint:(x,D,$)=>{const U=A(x);U?i.moveNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.moveWaypoint(x,D,$)},insertPoint:(x,D,$)=>{const U=A(x);U?i.addNoteConnectionWaypoint(U.noteRef,U.targetRef,D,$):i.addWaypoint(x,D,$)},removePoint:(x,D)=>{const $=A(x);$?i.removeNoteConnectionWaypoint($.noteRef,$.targetRef,D):i.removeWaypoint(x,D)}});const g=Le(),{nodes:N,edges:te,findNode:S,findEdge:O,addNodes:z,addEdges:F,removeNodes:ne,removeEdges:re,fitView:L,setCenter:oe,getViewport:k,screenToFlowCoordinate:W,getSelectedNodes:R,updateNodeInternals:G}=g,H=n.ref(!1);async function ae(x){H.value=!0,await n.nextTick(),await new Promise(D=>requestAnimationFrame(()=>D(null)));try{return await x()}finally{H.value=!1}}function v(){return ae(()=>qu(g))}function q(){return ae(()=>Xu(g))}t({exportSvg:v,exportPng:q});const le=n.computed(()=>i.resolved.value.entities.length===0);function me(){const x=k(),{width:D,height:$}=g.dimensions.value;return{x:(D/2-x.x)/x.zoom,y:($/2-x.y)/x.zoom}}function he(){const x=me();i.addEntity("NewEntity",{x:x.x,y:x.y})}function se(){const x=me();i.addNote("메모",{x:x.x,y:x.y})}function ce(x){for(const D of i.resolved.value.groups){const{location:$,size:U}=D.geo;if(x.x>=$.x&&x.x<=$.x+U.width&&x.y>=$.y&&x.y<=$.y+U.height)return D.group.modelId}return null}function ye(){const x=i.resolved.value,D=new Map(x.groups.map(fe=>[fe.group.modelId,fe.geo])),$=new Set(x.groups.map(fe=>fe.group.modelId)),U=new Set([...$,...x.entities.map(fe=>fe.entity.modelId),...x.notes.map(fe=>fe.note.modelId)]);for(const fe of[...N.value])U.has(fe.id)||ne([fe.id]);for(const fe of x.groups){const Ie=fe.group.modelId,Be={width:`${fe.geo.size.width}px`,height:`${fe.geo.size.height}px`},Me={group:fe.group,style:fe.style,locked:fe.locked},Ke=fe.locked?!1:void 0,Ge=S(Ie);Ge?(Ge.position={...fe.geo.location},Ge.data=Me,Ge.style=Be,Ge.draggable=Ke):z([{id:Ie,type:"group",position:{...fe.geo.location},draggable:Ke,style:Be,data:Me}])}for(const fe of x.entities){const Ie=fe.entity.modelId,Be=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Me={entity:fe.entity,displayMode:i.displayMode.value,collapsed:fe.collapsed,locked:fe.locked,groupRef:Be,size:fe.geo.size,style:fe.style,attributeStyles:fe.attributeStyles,operationStyles:fe.operationStyles},Ke=fe.locked?!1:void 0,Ge=Be?D.get(Be):void 0,Qe=Ge?{x:fe.geo.location.x-Ge.location.x,y:fe.geo.location.y-Ge.location.y}:{...fe.geo.location},Ye=S(Ie);Ye?(Ye.position=Qe,Ye.data=Me,Ye.parentNode=Be,Ye.draggable=Ke):z([{id:Ie,type:"entity",position:Qe,parentNode:Be,draggable:Ke,data:Me}])}for(const fe of x.notes){const Ie=fe.note,Be=Ie.modelId,Me=fe.groupRef&&$.has(fe.groupRef)?fe.groupRef:void 0,Ke={note:Ie,groupRef:Me},Ge={width:`${Ie.geo.size.width}px`,height:`${Ie.geo.size.height}px`},Qe=Me?D.get(Me):void 0,Ye=Qe?{x:Ie.geo.location.x-Qe.location.x,y:Ie.geo.location.y-Qe.location.y}:{...Ie.geo.location},Pe=S(Be);Pe?(Pe.position=Ye,Pe.data=Ke,Pe.style=Ge,Pe.parentNode=Me):z([{id:Be,type:"note",position:Ye,parentNode:Me,style:Ge,data:Ke}])}const P=new Map(x.associations.map(fe=>[fe.association.modelId,fe])),ee=new Set(x.noteConnections.map(fe=>_(fe.noteRef,fe.targetRef)));for(const fe of[...te.value])!P.has(fe.id)&&!ee.has(fe.id)&&re([fe.id]);for(const[fe,Ie]of P){const Be={id:fe,type:"association",source:Ie.association.end1.entityRef,target:Ie.association.end2.entityRef,sourceHandle:Ie.sourceColumnRef?`r:${Ie.sourceColumnRef}`:void 0,targetHandle:Ie.targetColumnRef?`l:${Ie.targetColumnRef}`:void 0,data:{association:Ie.association,sourceColumnRef:Ie.sourceColumnRef,targetColumnRef:Ie.targetColumnRef}},Me=O(fe);Me?(Me.data=Be.data,Me.sourceHandle=Be.sourceHandle,Me.targetHandle=Be.targetHandle):F([Be])}for(const fe of x.noteConnections){const Ie=_(fe.noteRef,fe.targetRef),Be={noteRef:fe.noteRef,targetRef:fe.targetRef},Me=O(Ie);Me?Me.data=Be:F([{id:Ie,type:"note-connection",source:fe.noteRef,target:fe.targetRef,data:Be}])}ke()}function ke(){n.nextTick(()=>requestAnimationFrame(()=>G()))}function Re(){const x=R.value.map($=>$.id);if(x.length)return x;const D=i.selection.value;return D&&(D.kind==="entity"||D.kind==="note"||D.kind==="group")?[D.id]:[]}function xe(x){var P;const D=x.target;if(D&&(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable))return;if(x.key==="?"){a.openModal({component:ju}),x.preventDefault();return}if(!i.editable.value){(x.metaKey||x.ctrlKey)&&x.key.toLowerCase()==="c"&&(i.copy(),x.preventDefault());return}if(x.key==="Delete"||x.key==="Backspace"){i.deleteSelection()&&x.preventDefault();return}if(x.key==="ArrowUp"||x.key==="ArrowDown"||x.key==="ArrowLeft"||x.key==="ArrowRight"){if(((P=i.selection.value)==null?void 0:P.kind)==="attribute"){if(x.key==="ArrowUp"||x.key==="ArrowDown"){const Be=x.key==="ArrowDown"?1:-1;(x.altKey?i.nudgeSelectedAttributes(Be):i.moveAttributeFocus(Be))&&x.preventDefault()}return}const ee=x.shiftKey?10:1,fe=x.key==="ArrowLeft"?-ee:x.key==="ArrowRight"?ee:0,Ie=x.key==="ArrowUp"?-ee:x.key==="ArrowDown"?ee:0;i.nudgeNodes(Re(),fe,Ie)&&x.preventDefault();return}if(!(x.metaKey||x.ctrlKey))return;const U=x.key.toLowerCase();U==="c"?(i.copy(),x.preventDefault()):U==="v"?(i.paste(),x.preventDefault()):U==="z"&&(x.shiftKey?i.redo():i.undo(),x.preventDefault())}n.onMounted(async()=>{ye(),await n.nextTick(),L(),window.addEventListener("keydown",xe),window.addEventListener("pointerup",pe),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",xe),window.removeEventListener("pointerup",pe),window.removeEventListener("pointermove",f)});function pe(){h.value=null}function X(){d.value=!0,p.value=null}function K(){var U;d.value=!1;const x=(U=document.elementFromPoint(u.x,u.y))==null?void 0:U.closest(".vue-flow__node"),D=x==null?void 0:x.dataset.id;if(!D){p.value=null;return}const $=x.classList.contains("vue-flow__node-group")?"group":x.classList.contains("vue-flow__node-note")?"note":"entity";p.value={kind:$,id:D}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],ye),n.watch(()=>i.revision.value,ke),n.watch(()=>i.resolved.value,x=>{const D=p.value;if(!D)return;(D.kind==="entity"?x.entities.some(U=>U.entity.modelId===D.id):D.kind==="group"?x.groups.some(U=>U.group.modelId===D.id):x.notes.some(U=>U.note.modelId===D.id))||(p.value=null)});function w(x){const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};return{x:D.x+$.width/2,y:D.y+$.height/2}}function C(x){const D=x.node;if(D){if(p.value=null,D.type==="group"){const $=i.resolved.value.groups.find(U=>U.group.modelId===D.id);m.value=$?{groupId:D.id,dx:D.position.x-$.geo.location.x,dy:D.position.y-$.geo.location.y}:null,h.value=null;return}if(D.type!=="entity"&&D.type!=="note"){h.value=null;return}h.value=ce(w(D))}}function V(x){var U;h.value=null,m.value=null;const D=(U=x.nodes)!=null&&U.length?x.nodes:[x.node],$=D.filter(P=>(P==null?void 0:P.type)==="group");if($.length){for(const P of $){if(!P)continue;const ee=i.resolved.value.entities.filter(fe=>fe.groupRef===P.id).map(fe=>{const Ie=S(fe.entity.modelId),Be=(Ie==null?void 0:Ie.computedPosition)??(Ie==null?void 0:Ie.position)??{x:0,y:0};return{id:fe.entity.modelId,location:{x:Be.x,y:Be.y}}});i.dragGroup(P.id,{x:P.position.x,y:P.position.y},ee)}return}for(const P of D){if(!P||P.type==="group")continue;const ee=P.computedPosition??P.position,fe=P.dimensions??{width:0,height:0},Ie={x:ee.x+fe.width/2,y:ee.y+fe.height/2};P.type==="note"?i.dropNote(P.id,{x:ee.x,y:ee.y},ce(Ie)):i.dropEntity(P.id,{x:ee.x,y:ee.y},ce(Ie))}}function Y(x){var Be,Me,Ke,Ge,Qe;if(!i.editable.value||!x.source||!x.target)return;const D=((Be=S(x.source))==null?void 0:Be.type)==="note",$=((Me=S(x.target))==null?void 0:Me.type)==="note";if(D||$){if(D&&$)return;const Ye=D?x.source:x.target,Pe=D?x.target:x.source;((Ke=S(Pe))==null?void 0:Ke.type)==="entity"&&i.addNoteConnection(Ye,Pe);return}const U=Ye=>{var Pe;return(Pe=i.state.logical.entities.find(_n=>_n.modelId===Ye))==null?void 0:Pe.stereotype},P=U(x.source)==="JPA_EMBEDDABLE",ee=U(x.target)==="JPA_EMBEDDABLE";if(P||ee){if(P&&ee)return;const Ye=P?x.source:x.target,Pe=P?x.target:x.source;i.addEmbedAssociation(Pe,Ye);return}const fe=(Ge=x.sourceHandle)!=null&&Ge.startsWith("r:")?x.sourceHandle.slice(2):void 0,Ie=(Qe=x.targetHandle)!=null&&Qe.startsWith("l:")?x.targetHandle.slice(2):void 0;i.addAssociation(x.source,x.target,fe,Ie)}const J=n.ref(null);function ge(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.attributeStyles)==null?void 0:U[D])}function we(x,D){var U;const $=i.state.layout.entityLayouts.find(P=>P.entityRef===x);return it((U=$==null?void 0:$.operationStyles)==null?void 0:U[D])}function Ne(x){var D;return it((D=i.state.layout.groupLayouts.find($=>$.groupRef===x))==null?void 0:D.style)}function _e(x){var D;return it((D=i.state.layout.notes.find($=>$.modelId===x))==null?void 0:D.style)}function Ce(x){var U,P;if(x.preventDefault(),!i.editable.value)return;const D=()=>W({x:x.clientX,y:x.clientY}),$=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const ee=D();i.addEntity("NewEntity",{x:ee.x,y:ee.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const ee=D();i.addNote("메모",{x:ee.x,y:ee.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const ee=D();i.addEmptyGroup({x:ee.x,y:ee.y})}}];((U=i.clipboard.value)==null?void 0:U.kind)==="entity"&&$.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&$.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(P=J.value)==null||P.open(x,$)}function Te({event:x,node:D}){var Be,Me,Ke,Ge,Qe,Ye,Pe,_n,Ee,et,Bo,Do,Oo,Lo,Po,zo,Uo,rt;const $=x;if($.preventDefault(),!i.editable.value){if(D.type==="group"||D.type==="note")return;const ze=(Me=(Be=$.target)==null?void 0:Be.closest("[data-attr]"))==null?void 0:Me.dataset.attr;if(ze){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===D.id&&je.ids.includes(ze)||i.selectAttribute(D.id,ze);const kn=((Ke=i.selection.value)==null?void 0:Ke.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[ze];(Ge=J.value)==null||Ge.open($,[{caption:kn.length>1?`복사 (${kn.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Qe=J.value)==null||Qe.open($,[{caption:"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}]);return}if(D.type==="group"){const ze=i.isGroupLocked(D.id),je=[];ze||je.push({type:"swatches",caption:"색상",current:Ne(D.id),onPick:nt=>i.setGroupSwatch(D.id,nt)},{type:"separator"}),je.push({caption:ze?"잠금 해제":"잠금",icon:ze?"unlock":"lock",handler:()=>i.setGroupLocked(D.id,!ze)}),ze||je.push({type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(D.id)}),(Ye=J.value)==null||Ye.open($,je);return}if(D.type==="note"){(Pe=J.value)==null||Pe.open($,[{type:"swatches",caption:"색상",current:_e(D.id),onPick:ze=>i.setNoteSwatch(D.id,ze)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(D.id)}]);return}const U=(Ee=(_n=$.target)==null?void 0:_n.closest("[data-attr]"))==null?void 0:Ee.dataset.attr;if(U){const ze=i.selection.value;(ze==null?void 0:ze.kind)==="attribute"&&ze.entityId===D.id&&ze.ids.includes(U)||i.selectAttribute(D.id,U);const nt=((et=i.selection.value)==null?void 0:et.kind)==="attribute"&&i.selection.value.entityId===D.id?[...i.selection.value.ids]:[U];if(i.isEntityLocked(D.id)){(Bo=J.value)==null||Bo.open($,[{caption:nt.length>1?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}const kn=nt.length>1,Xl=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{type:"swatches",caption:kn?`색상 (${nt.length})`:"색상",current:kn?null:ge(D.id,U),onPick:JS=>i.setAttributeSwatches(D.id,nt,JS)},{type:"separator"},{caption:kn?`복사 (${nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Ho=i.clipboard.value;(Ho==null?void 0:Ho.kind)==="attribute"&&Xl.push({caption:Ho.attributes.length>1?`속성 붙여넣기 (${Ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Xl.push({type:"separator"},{caption:kn?`속성 삭제 (${nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(D.id,nt)}),(Do=J.value)==null||Do.open($,Xl);return}const P=(Lo=(Oo=$.target)==null?void 0:Oo.closest("[data-op]"))==null?void 0:Lo.dataset.op;if(P){if(i.isEntityLocked(D.id))return;(Po=J.value)==null||Po.open($,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(D.id)},{type:"swatches",caption:"색상",current:we(D.id,P),onPick:ze=>i.setOperationSwatch(D.id,P,ze)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(D.id,P)}]);return}const ee=i.resolved.value.entities.find(ze=>ze.entity.modelId===D.id),fe=!!(ee!=null&&ee.locked),Ie=[{caption:fe?"상세 보기…":"상세 편집…",icon:"pencil",handler:()=>Pi(a,i,D.id)}];if(!fe){Ie.push({type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(D.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(D.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const je=R.value.filter(nt=>nt.type==="entity").map(nt=>nt.id);i.createGroup(je.includes(D.id)&&je.length?je:[D.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(D.id,D.id)});const ze=i.embeddableCatalog.value;if(ze.length){Ie.push({type:"separator"});for(const je of ze){const nt=((zo=je.label)==null?void 0:zo.ko)??((Uo=je.label)==null?void 0:Uo.en)??je.type;Ie.push({caption:`임베더블 추가: ${nt}`,icon:"link",handler:()=>i.addPredefinedEmbed(D.id,je.type)})}}}if(Ie.push({type:"separator"}),Ie.push({caption:ee!=null&&ee.collapsed?"펼치기":"접기",icon:ee!=null&&ee.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(D.id,!(ee!=null&&ee.collapsed))}),ee!=null&&ee.groupRef&&!fe&&Ie.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(D.id)}),Ie.push({caption:fe?"잠금 해제":"잠금",icon:fe?"unlock":"lock",handler:()=>i.setEntityLocked(D.id,!fe)}),Ie.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.copy()}}),!fe){const ze=i.clipboard.value;(ze==null?void 0:ze.kind)==="attribute"&&Ie.push({caption:ze.attributes.length>1?`속성 붙여넣기 (${ze.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:D.id},i.paste()}}),Ie.push({type:"separator"}),Ie.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(D.id)})}(rt=J.value)==null||rt.open($,Ie)}function De({event:x,edge:D}){var P,ee;const $=x;if($.preventDefault(),!i.editable.value)return;const U=A(D.id);if(U){(P=J.value)==null||P.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(U.noteRef,U.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(U.noteRef,U.targetRef)}]);return}(ee=J.value)==null||ee.open($,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(D.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(D.id)}])}function E(x){return x==="group"?"group":x==="note"?"note":"entity"}function T({node:x}){if(R.value.length>1){i.selection.value=null;return}i.selection.value={kind:E(x.type),id:x.id}}function I({nodes:x}){x.length>1&&(i.selection.value=null)}function M({edge:x}){const D=A(x.id);i.selection.value=D?{kind:"note",id:D.noteRef}:{kind:"association",id:x.id}}function B(x){const D=i.selection.value;return!!D&&D.kind!=="attribute"&&D.id===x.id}function de(x){var D,$;return B(x)?x.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":x.type==="note"?"var(--em-note-soft)":x.type==="group"?Id(it((D=x.data)==null?void 0:D.style),!0)??"var(--em-mm-group)":Id(it(($=x.data)==null?void 0:$.style))??"var(--em-mm-entity)"}function be(x){return B(x)?"var(--em-selection)":x.type==="note"?"var(--em-note-accent)":x.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function Q(x,D){oe(x,D,{zoom:k().zoom,duration:350})}n.watch(()=>i.focusRequest.value,x=>{if(!x)return;const D=S(x.id);if(!D)return;const $=D.computedPosition??D.position,U=D.dimensions??{width:0,height:0};Q($.x+U.width/2,$.y+U.height/2)});function Z({position:x}){Q(x.x,x.y)}function j({node:x}){i.selection.value={kind:E(x.type),id:x.id};const D=x.computedPosition??x.position,$=x.dimensions??{width:0,height:0};Q(D.x+$.width/2,D.y+$.height/2)}function ue({node:x}){L({nodes:[x.id],duration:350,maxZoom:1.2,padding:.6})}return(x,D)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":c.value,"is-panning":d.value}])},[n.createVNode(n.unref(i1),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!H.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(Bt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:X,onMoveEnd:K,onConnect:Y,onConnectStart:D[1]||(D[1]=$=>c.value=!0),onConnectEnd:D[2]||(D[2]=$=>c.value=!1),onNodeDrag:C,onNodeDragStop:V,onNodeClick:T,onEdgeClick:M,onSelectionChange:I,onPaneClick:D[3]||(D[3]=$=>n.unref(i).selection.value=null),onPaneContextMenu:Ce,onNodeContextMenu:Te,onEdgeContextMenu:De},{"node-group":n.withCtx($=>[n.createVNode(Ld,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-entity":n.withCtx($=>[n.createVNode(Od,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"node-note":n.withCtx($=>[n.createVNode(Pd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-association":n.withCtx($=>[n.createVNode(Qd,n.normalizeProps(n.guardReactiveProps($)),null,16)]),"edge-note-connection":n.withCtx($=>[n.createVNode(w$,n.normalizeProps(n.guardReactiveProps($)),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(Bw),{"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(hn),{class:"em-palette__group-start",title:"엔티티 추가",onClick:he},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"노트 추가",onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1}),n.createVNode(n.unref(hn),{title:"자동 배치",onClick:D[0]||(D[0]=$=>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(g$),{key:1,pannable:"",width:224,height:160,"node-color":de,"node-stroke-color":be,"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:Z,onNodeClick:j,onNodeDblclick:ue})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),le.value?(n.openBlock(),n.createElementBlock("div",K$,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[D[4]||(D[4]=n.createElementVNode("p",{class:"em-canvas__empty-title"},"빈 다이어그램입니다",-1)),D[5]||(D[5]=n.createElementVNode("p",{class:"em-canvas__empty-hint"},[n.createTextVNode(" 캔버스를 "),n.createElementVNode("strong",null,"우클릭"),n.createTextVNode("하거나 좌하단 "),n.createElementVNode("strong",null,"+"),n.createTextVNode(" 버튼으로 첫 엔티티를 추가하세요. ")],-1)),D[6]||(D[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",q$,"표시할 엔티티가 없습니다"))])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[s.value?(n.openBlock(),n.createElementBlock("div",X$,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",j$,[n.createElementVNode("strong",Z$,n.toDisplayString(s.value.title),1),n.createElementVNode("span",J$,n.toDisplayString(s.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(A$,{ref_key:"menuRef",ref:J},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",Q$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-0ff29e17"]]);function sa(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function ex(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 tx={class:"em-explorer em-scroll-overlay"},nx={class:"em-explorer__search"},ox={key:0,class:"em-explorer__empty"},ix={class:"em-explorer__rows"},ax=["data-key","onClick","onDblclick"],lx=["onClick"],rx=["title"],sx={class:"em-key-slot"},cx={class:"em-key-slot"},dx={class:"em-explorer__label"},Ju=Ue(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=ie.useModal(),l=n.computed(()=>{var ae;const S=i.resolved.value,O=i.displayMode.value,z=v=>{var q,le,me;return Fo(O,v.name,(le=(q=v.table)==null?void 0:q.logicalName)==null?void 0:le.ko,(me=v.table)==null?void 0:me.physicalName)},F=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",ne=v=>{const q=v.attrType.startsWith("RELATION")&&v.dbAttrs.length>0;return{icon:v.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:v.identifier,fk:q&&F}}},re=v=>v.attrType.startsWith("EMBED")&&v.dbAttrs.length>0,L=O==="PHYSICAL"||O==="LOGICAL_PHYSICAL",oe=v=>{if(v.attrType!=="EMBED_PREDEF")return v.dbAttrs;const q=i.embeddableCatalog.value.find(le=>le.type===v.type);return q?v.dbAttrs.map((le,me)=>{const he=q.fields[me];return he?{...le,physicalName:le.physicalName||he.physicalName,logicalName:le.logicalName??he.logicalName,dataType:le.dataType||he.dataType,length:le.length??he.length}:le}):v.dbAttrs},k=(v,q)=>{var se,ce,ye,ke,Re,xe,pe,X,K;const le={entityId:q,attrId:v.modelId};if(re(v)){const w=Ea(O,v);return{key:`attr:${v.modelId}`,label:v.name+(w?` : ${w}`:""),icon:"table",attrRef:le,focusId:q,matchText:sa(v.name,(ce=(se=v.dbAttrs[0])==null?void 0:se.logicalName)==null?void 0:ce.ko,(ye=v.dbAttrs[0])==null?void 0:ye.physicalName),children:L?oe(v).map(C=>{var V,Y;return{key:`attr:${v.modelId}:col:${C.modelId}`,label:Fo(O,C.physicalName,(V=C.logicalName)==null?void 0:V.ko,C.physicalName)+(C.dataType?` : ${C.dataType}`:""),icon:"field",attrRef:le,focusId:q,matchText:sa(C.physicalName,(Y=C.logicalName)==null?void 0:Y.ko),children:[]}}):[]}}const me=fr(v,i.state.logical.associations),he=Ea(O,v,me);return{key:`attr:${v.modelId}`,label:Fo(O,v.name,(Re=(ke=v.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:Re.ko,(xe=v.dbAttrs[0])==null?void 0:xe.physicalName)+(he?` : ${he}`:""),...ne(v),attrRef:le,focusId:q,matchText:sa(v.name,(X=(pe=v.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:X.ko,(K=v.dbAttrs[0])==null?void 0:K.physicalName),children:[]}},W=v=>{var me,he,se;const q=v.entity,le=[...q.attributes].sort((ce,ye)=>ce.order-ye.order);return{key:`entity:${q.modelId}`,label:z(q),icon:"table",selectKind:"entity",selectId:q.modelId,focusId:q.modelId,matchText:sa(q.name,(he=(me=q.table)==null?void 0:me.logicalName)==null?void 0:he.ko,(se=q.table)==null?void 0:se.physicalName),children:le.map(ce=>k(ce,q.modelId))}},R=new Map,G=[];for(const v of S.entities)if(v.groupRef){const q=R.get(v.groupRef)??[];q.push(v),R.set(v.groupRef,q)}else G.push(v);const H=[];for(const v of S.groups){const q=v.group;H.push({key:`group:${q.modelId}`,label:((ae=q.name)==null?void 0:ae.ko)||q.packageName||"(그룹)",icon:"folder",focusId:q.modelId,children:(R.get(q.modelId)??[]).map(W)})}for(const v of G)H.push(W(v));if(S.associations.length){const v=new Map(S.entities.map(q=>[q.entity.modelId,z(q.entity)]));H.push({key:"section:associations",label:`관계 (${S.associations.length})`,icon:"arrow-lr",children:S.associations.map(q=>{const le=q.association,me=v.get(le.end1.entityRef)??le.end1.entityRef,he=v.get(le.end2.entityRef)??le.end2.entityRef;return{key:`assoc:${le.modelId}`,label:`${me} — ${he}`,icon:"arrow-lr",selectKind:"association",selectId:le.modelId,children:[]}})})}return S.notes.length&&H.push({key:"section:notes",label:`노트 (${S.notes.length})`,icon:"note",children:S.notes.map(({note:v})=>{var q;return{key:`note:${v.modelId}`,label:((q=v.memo.split(`
|
|
43
|
+
`)[0])==null?void 0:q.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:v.modelId,focusId:v.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:H}});function r(S){return S?S.pk&&S.fk?"PFK (식별 외래키)":S.pk?"PK (기본키)":S.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(S){const O=new Set(s.value);O.has(S)?O.delete(S):O.add(S),s.value=O}const d=n.ref(""),u=n.ref(null),f=n.computed(()=>d.value.trim().length>0),h=n.computed(()=>{const S=[];if(f.value){const z=ex(l.value,d.value.trim().toLowerCase()),F=(ne,re)=>{if(z.has(ne.key)){S.push({node:ne,depth:re});for(const L of ne.children)F(L,re+1)}};return F(l.value,0),S}const O=(z,F)=>{if(S.push({node:z,depth:F}),!s.value.has(z.key))for(const ne of z.children)O(ne,F+1)};return O(l.value,0),S}),m=n.computed(()=>f.value&&h.value.length<=1);function p(S){var F;if(S.key!=="/"||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;const O=S.target,z=O==null?void 0:O.tagName;z==="INPUT"||z==="TEXTAREA"||z==="SELECT"||O!=null&&O.isContentEditable||(S.preventDefault(),(F=u.value)==null||F.focus())}n.onMounted(()=>window.addEventListener("keydown",p)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",p));const y=n.computed(()=>{const S=[],O=z=>{if(z.children.length){z.key!=="root"&&S.push(z.key);for(const F of z.children)O(F)}};return O(l.value),S}),b=n.computed(()=>!y.value.some(S=>s.value.has(S)));function _(){s.value=b.value?new Set(y.value):new Set}t({toggleAll:_,allExpanded:b,hasExpandable:n.computed(()=>y.value.length>0)});function A(S){const O=i.selection.value;return S.attrRef?(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.attrRef.entityId&&O.ids.includes(S.attrRef.attrId):!!O&&O.kind!=="attribute"&&!!S.selectId&&S.selectKind===O.kind&&S.selectId===O.id}function g(S){const O=i.selection.value;return S.selectKind==="entity"&&(O==null?void 0:O.kind)==="attribute"&&O.entityId===S.selectId}function N(S,O){if(S.attrRef){const z=O.shiftKey?"range":O.metaKey||O.ctrlKey?"toggle":"replace";i.selectAttribute(S.attrRef.entityId,S.attrRef.attrId,z)}else S.selectKind&&S.selectId&&(i.selection.value={kind:S.selectKind,id:S.selectId});S.focusId&&i.requestFocus(S.focusId)}function te(S){S.selectKind==="entity"&&S.selectId&&Pi(a,i,S.selectId)}return(S,O)=>(n.openBlock(),n.createElementBlock("section",tx,[n.createElementVNode("div",nx,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":O[0]||(O[0]=z=>d.value=z),class:"em-explorer__search-input",type:"text",placeholder:"엔티티·속성 검색 ( / )","aria-label":"엔티티·속성 검색",onKeydown:O[1]||(O[1]=n.withKeys(z=>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:O[2]||(O[2]=z=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("p",ox,"일치하는 엔티티·속성이 없습니다")):n.createCommentVNode("",!0),n.createElementVNode("div",ix,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value,({node:z,depth:F})=>(n.openBlock(),n.createElementBlock("div",{key:z.key,class:n.normalizeClass(["em-explorer__row",{"is-active":A(z),"is-focus-parent":g(z),"is-selectable":!!z.selectKind||!!z.attrRef||!!z.focusId}]),"data-key":z.key,style:n.normalizeStyle({paddingLeft:4+F*14+"px"}),onClick:ne=>N(z,ne),onDblclick:ne=>te(z)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!z.children.length,"is-open":!s.value.has(z.key)}]),onClick:n.withModifiers(ne=>z.children.length&&c(z.key),["stop"])},[z.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,lx),z.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(z.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",sx,[z.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):z.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",cx,[z.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,rx)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:z.icon,size:15},null,8,["name"])),n.createElementVNode("span",dx,n.toDisplayString(z.label),1)],46,ax))),128))])]))}}),[["__scopeId","data-v-19a86314"]]),ux={class:"em-text-export"},fx={key:0,class:"em-text-export__tabs",role:"tablist"},mx=["aria-selected","onClick"],px={class:"em-text-export__pre"},hx={class:"em-text-export__actions"},yx=Ue(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{}},setup(e){const t=e,o=ie.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),ie.showNotification("클립보드에 복사되었습니다.","info")}catch{ie.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(ie.BSModalFrame),{title:t.title??"내보내기"},{default:n.withCtx(()=>[n.createElementVNode("div",ux,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",fx,[(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,mx))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",px,n.toDisplayString(a().content),1),n.createElementVNode("div",hx,[n.createVNode(n.unref(ie.BSButton),{caption:"복사",onClick:l}),n.createVNode(n.unref(ie.BSButton),{caption:"다운로드",onClick:r}),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=d=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-58b9bdc3"]]),gx={class:"em-toolbar"},bx={class:"em-toolbar__mode"},Qu=Ue(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=ie.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(p=>p.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function f(){const m=i.state.logical;l.openModal({component:yx,bind:{title:"내보내기 (텍스트 · Mermaid)",formats:[{key:"text",label:"논리 모델 텍스트",content:or(m),filename:"diagram.txt"},{key:"mermaid-er",label:"Mermaid (ER)",content:ya(m,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:"Mermaid (클래스)",content:ya(m,"class"),filename:"diagram.class.mmd"}]}})}function h(){l.openModal({component:ju})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",gx,[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:p[0]||(p[0]=y=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:p[1]||(p[1]=y=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),p[10]||(p[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",bx,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[2]||(p[2]=y=>s.value=y),items:r,"value-provider":y=>y.v,"label-provider":y=>y.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(ie.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(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:p[3]||(p[3]=y=>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(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:p[4]||(p[4]=y=>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(ie.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"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.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(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[5]||(p[5]=y=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1}),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"PNG 내보내기",onClick:p[6]||(p[6]=y=>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},[p[9]||(p[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=y=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:"키보드 단축키 (?)",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1})]))}}),[["__scopeId","data-v-aea19e30"]]),_x={key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다."},kx=["title"],wx=["disabled","aria-pressed"],Ex=["disabled","aria-pressed"],vx=Ue(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",_x,[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,wx),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,Ex)],10,kx))}}),[["__scopeId","data-v-44f7d737"]]),Nx=["disabled"],$x={class:"em-panel__sub"},xx={class:"em-nav"},Ix={key:0,class:"em-nav__divider","aria-hidden":"true"},Sx={key:1},Cx=["onClick","onKeydown"],Rx={class:"em-nav__name"},Vx=["title"],Ax={key:0,class:"em-panel__note"},Tx=["data-attr-block"],Mx={class:"em-attr__row"},Bx=["title"],Dx={key:0,class:"em-attr__row"},Ox={class:"em-attr__row"},Lx={class:"em-attr__row"},Px={class:"em-attr__flags"},zx={class:"em-attr__pii"},Ux={class:"em-attr__pii"},Hx={class:"em-attr__pii"},Fx={key:0,class:"em-attr__pii em-attr__codetop"},Gx={class:"em-multilang"},Yx={key:2,class:"em-embed-cols"},Wx={class:"em-embed-col__label"},Kx={class:"em-attr__row"},qx={class:"em-attr__row"},Xx={key:0,class:"em-embed-upd"},jx={class:"em-embed-upd"},Zx={class:"em-embed-upd"},Jx={class:"em-swatch__row em-attr__swatch"},Qx=["onClick"],eI=["title","onClick"],tI={key:0,class:"em-attr__swatch-hint"},nI="외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요",ca="__OWN__",oI=Ue(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(U=>U.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>r.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function f($){return!!i.value&&!!ti(o.state.logical,i.value.modelId,$.modelId)}function h($){const U=u($),P=[U.pk&&"PK",U.fk&&"FK",U.required&&"NOT NULL"].filter(Boolean);return P.length?P.join(" · "):void 0}function m($,U){i.value&&o.selectAttribute(i.value.modelId,$.modelId,U.shiftKey?"range":U.metaKey||U.ctrlKey?"toggle":"replace")}const p=["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 y($){return $==="none"?"(없음)":$}const b=$=>$;function _($){var U,P;return it((P=(U=a.value)==null?void 0:U.attributeStyles)==null?void 0:P[$.modelId])}function A($){return r.value.size>1&&r.value.has($.modelId)}function g($,U){if(!i.value)return;const P=A($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,P,U)}function N($,U){i.value&&o.updateAttribute(i.value.modelId,$.modelId,U)}function te($,U){N($,{naturalId:U||void 0,naturalIdMutable:U?$.naturalIdMutable:void 0})}function S(){return{naturalId:void 0,naturalIdMutable:void 0}}function O($,U){N($,{identifier:U,...U?S():{}})}function z($,U){N($,{transient:U||void 0,...U?S():{}})}function F($){return!!$.transient}const ne=$=>$.value,re=$=>$.label;function L($,U){if(!U)return;const P=v.value.find(ee=>ee.type===U);if(P){const ee=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};N($,{type:U,customType:void 0,dbAttrs:[{...ee,dataType:P.dataType,length:P.length,scale:P.scale}]});return}N($,U===zt?{type:U}:{type:U,customType:void 0})}function oe($,U){N($,{customType:U.trim()===""?void 0:U})}function k($,U){const ee={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!Go.has(ee.dataType)&&(ee.scale=void 0),N($,{dbAttrs:[ee]})}function W($){var U;return Go.has(((U=$.dbAttrs[0])==null?void 0:U.dataType)??"")}function R($,U,P){var ee;k($,{logicalName:{...(ee=$.dbAttrs[0])==null?void 0:ee.logicalName,[U]:P}})}function G($,U){N($,{description:Object.keys(U).length?U:void 0})}function H($){return $.personalInfoAttributeType??"none"}function ae($,U){N($,{personalInfoAttributeType:U==="none"?void 0:U})}const v=n.computed(()=>o.predefinedCustomTypeCatalog.value),q=n.computed(()=>o.embeddableCatalog.value),le=n.ref(void 0);function me($){var U,P;return((U=$.label)==null?void 0:U.ko)??((P=$.label)==null?void 0:P.en)??$.type}function he($){if(!$||!i.value)return;const U=o.addPredefinedEmbed(i.value.modelId,$);U&&o.selectAttribute(i.value.modelId,U),le.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const ce=n.computed(()=>o.groupCodeCatalog.value);function ye($){var U;return((U=ce.value.find(P=>P.groupCode===$.groupCode))==null?void 0:U.codes)??[]}function ke($){return["none",...ye($)]}function Re($){return $==="none"?"none":$.code}function xe($){var P,ee;if($==="none")return"(없음)";const U=((P=$.label)==null?void 0:P.ko)??((ee=$.label)==null?void 0:ee.en);return U?`${$.code} (${U})`:$.code}function pe($,U){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,U)}function X($,U){N($,{defaultValue:U==="none"?void 0:U})}function K($,U){N($,{defaultValue:U.trim()===""?void 0:U})}function w($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function C($,U,P){const ee=$.dbAttrs.map((fe,Ie)=>{if(Ie!==U)return fe;const Be={...fe,...P};for(const Me of Object.keys(P))P[Me]===void 0&&delete Be[Me];return Be});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,ee)}function V($,U,P,ee){var fe;C($,U,{logicalName:{...(fe=$.dbAttrs[U])==null?void 0:fe.logicalName,[P]:ee}})}function Y($,U){var fe,Ie,Be;if($.attrType==="EMBED_PREDEF"){const Me=(fe=o.embeddableCatalog.value.find(Ke=>Ke.type===$.type))==null?void 0:fe.fields[U];return Me?{name:Me.name,physicalName:Me.physicalName,dataType:Me.dataType,length:Me.length,shareable:Me.shareable,logicalName:Me.logicalName}:void 0}const P=(Ie=$.embedded)==null?void 0:Ie.embeddableRef;if(!P)return;const ee=(Be=o.state.logical.entities.find(Me=>Me.modelId===P))==null?void 0:Be.attributes.flatMap(Me=>Me.dbAttrs)[U];return ee?{physicalName:ee.physicalName,dataType:ee.dataType,length:ee.length,scale:ee.scale,logicalName:ee.logicalName}:void 0}function J($,U){var P,ee;return((P=Y($,U))==null?void 0:P.dataType)||((ee=$.dbAttrs[U])==null?void 0:ee.dataType)||""}function ge($,U){var P,ee;return((P=Y($,U))==null?void 0:P.length)??((ee=$.dbAttrs[U])==null?void 0:ee.length)}function we($,U){var P,ee;return((P=Y($,U))==null?void 0:P.scale)??((ee=$.dbAttrs[U])==null?void 0:ee.scale)}const Ne=["inherit","true","false"];function _e($){return $==="inherit"?"기본(따름)":$}function Ce($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Te($,U,P){C($,U,{updatable:P==="inherit"?void 0:P==="true"})}function De($,U){k($,{updatable:U==="inherit"?void 0:U==="true"})}const E=["inherit","true","false"];function T($){return $==="inherit"?"기본(따름)":$}function I($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function M($,U,P){C($,U,{insertable:P==="inherit"?void 0:P==="true"})}function B($,U){k($,{insertable:U==="inherit"?void 0:U==="true"})}const de=n.computed(()=>{var $;return Xn((($=i.value)==null?void 0:$.attributes.flatMap(U=>U.dbAttrs))??[])}),be=n.computed(()=>{var $;return((($=i.value)==null?void 0:$.attributes)??[]).filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>({modelId:U.dbAttrs[0].modelId,label:U.dbAttrs[0].physicalName||U.name}))});function Q(){return[ca,...be.value.map($=>$.modelId)]}function Z($){if($===ca)return"전용 컬럼(OWN)";const U=be.value.find(P=>P.modelId===$);return U?`↗ ${U.label} (공유)`:$}function j($){return($==null?void 0:$.sharedColumnRef)??ca}function ue($,U,P){C($,U,{sharedColumnRef:P===ca?void 0:P})}function x($){return($==null?void 0:$.sharedColumnRef)!=null}function D($){var U;return((U=Yo($,de.value))==null?void 0:U.physicalName)??""}return($,U)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",$x,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:se}),q.value.length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":le.value,items:q.value,"value-provider":P=>P.type,"label-provider":me,"onUpdate:modelValue":he},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",xx,[(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",Ix,[...U[0]||(U[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",Sx,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(P.modelId)}]),role:"button",tabindex:"0",onClick:ee=>m(P,ee),onKeydown:[n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ee=>m(P,ee),["prevent"]),["space"])]},[n.createElementVNode("span",Rx,n.toDisplayString(P.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:h(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,Vx)],42,Cx)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",Ax," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,P=>{var ee,fe,Ie,Be,Me,Ke,Ge,Qe,Ye,Pe,_n;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",Mx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-name-${P.modelId}`,width:"100%",placeholder:"이름","model-value":P.name,"onUpdate:modelValue":Ee=>N(P,{name:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-type-${P.modelId}`,width:"84px",placeholder:"타입",disabled:P.attrType.startsWith("EMBED")||!!P.groupCode,items:n.unref(ur)(P.type,v.value),"value-provider":ne,"label-provider":re,"model-value":P.type,"onUpdate:modelValue":Ee=>L(P,Ee)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:f(P)?nI:void 0},[n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>n.unref(o).removeAttribute(i.value.modelId,P.modelId)},null,8,["onClick"])],8,Bx)]),P.type===n.unref(zt)?(n.openBlock(),n.createElementBlock("div",Dx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-customtype-${P.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":P.customType??"","onUpdate:modelValue":Ee=>oe(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),w(P)?(n.openBlock(),n.createElementBlock("div",Yx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.dbAttrs,(Ee,et)=>{var Bo,Do,Oo,Lo,Po,zo,Uo;return n.openBlock(),n.createElementBlock("div",{key:Ee.modelId,class:"em-embed-col"},[n.createElementVNode("span",Wx,n.toDisplayString(((Bo=Y(P,et))==null?void 0:Bo.name)??((Do=Y(P,et))==null?void 0:Do.physicalName)??`컬럼 ${et+1}`),1),n.createElementVNode("div",Kx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-col-${Ee.modelId}`,width:"100%",disabled:x(Ee),placeholder:((Oo=Y(P,et))==null?void 0:Oo.physicalName)??"컬럼","model-value":x(Ee)?D(Ee):Ee.physicalName,"onUpdate:modelValue":rt=>C(P,et,{physicalName:rt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSTextInput),{name:`embed-dtype-${Ee.modelId}`,width:"84px",disabled:"","model-value":J(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-len-${Ee.modelId}`,width:"48px",disabled:"","model-value":ge(P,et)},null,8,["name","model-value"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`embed-scale-${Ee.modelId}`,width:"48px",disabled:"","model-value":we(P,et)},null,8,["name","model-value"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",qx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`embed-logical-${Ee.modelId}`,width:"100%",placeholder:((Po=(Lo=Y(P,et))==null?void 0:Lo.logicalName)==null?void 0:Po.ko)??"논리명","model-value":((zo=Ee.logicalName)==null?void 0:zo.ko)??"","onUpdate:modelValue":rt=>V(P,et,"ko",rt)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Uo=Y(P,et))!=null&&Uo.shareable?(n.openBlock(),n.createElementBlock("label",Xx,[U[7]||(U[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px","model-value":j(Ee),items:Q(),"value-provider":b,"label-provider":Z,"onUpdate:modelValue":rt=>rt&&ue(P,et,rt)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",jx,[U[8]||(U[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":I(Ee),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":rt=>rt&&M(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Zx,[U[9]||(U[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"110px",disabled:x(Ee),"model-value":x(Ee)?"false":Ce(Ee),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":rt=>rt&&Te(P,et,rt)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",Ox,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-logical-${P.modelId}`,width:"100%",placeholder:"논리명","model-value":((fe=(ee=P.dbAttrs[0])==null?void 0:ee.logicalName)==null?void 0:fe.ko)??"","onUpdate:modelValue":Ee=>R(P,"ko",Ee)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Lx,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`attr-col-${P.modelId}`,width:"100%",placeholder:"컬럼",disabled:F(P),"model-value":((Ie=P.dbAttrs[0])==null?void 0:Ie.physicalName)??"","onUpdate:modelValue":Ee=>k(P,{physicalName:Ee})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{name:`attr-dtype-${P.modelId}`,width:"84px",placeholder:"dataType",disabled:F(P),items:n.unref(cr)(((Be=P.dbAttrs[0])==null?void 0:Be.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":b,"label-provider":n.unref(_a),"model-value":((Me=P.dbAttrs[0])==null?void 0:Me.dataType)??"","onUpdate:modelValue":Ee=>Ee&&k(P,{dataType:Ee})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-len-${P.modelId}`,width:"48px",placeholder:"len",disabled:F(P),"model-value":(Ke=P.dbAttrs[0])==null?void 0:Ke.length,"onUpdate:modelValue":Ee=>k(P,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSNumberInput),{name:`attr-scale-${P.modelId}`,width:"48px",placeholder:"scale",disabled:F(P)||!W(P),"model-value":(Ge=P.dbAttrs[0])==null?void 0:Ge.scale,"onUpdate:modelValue":Ee=>k(P,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(mn,{controller:n.unref(o),"ref-id":(Qe=P.dbAttrs[0])==null?void 0:Qe.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",Px,[n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-pk-${P.modelId}`,label:"Primary Key","model-value":P.identifier,disabled:l.value||F(P),"onUpdate:modelValue":Ee=>O(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nn-${P.modelId}`,label:"Not Null","model-value":P.notNull,disabled:F(P),"onUpdate:modelValue":Ee=>N(P,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-uq-${P.modelId}`,label:"Unique","model-value":!!((Ye=P.dbAttrs[0])!=null&&Ye.unique),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-ai-${P.modelId}`,label:"Auto Increment","model-value":!!((Pe=P.dbAttrs[0])!=null&&Pe.autoIncrement),disabled:F(P)||!P.identifier,"onUpdate:modelValue":Ee=>k(P,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-tr-${P.modelId}`,label:"@Transient","model-value":!!P.transient,disabled:P.identifier,"onUpdate:modelValue":Ee=>z(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-nid-${P.modelId}`,label:"@NaturalId","model-value":!!P.naturalId,disabled:P.identifier||F(P),"onUpdate:modelValue":Ee=>te(P,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${P.modelId}`,label:"mutable","model-value":!!P.naturalIdMutable,disabled:F(P)||!P.naturalId,"onUpdate:modelValue":Ee=>N(P,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`attr-mv-${P.modelId}`,label:"Multi-Value (Set)","model-value":!!((_n=P.dbAttrs[0])!=null&&_n.multiValue),disabled:F(P),"onUpdate:modelValue":Ee=>k(P,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",zx,[U[1]||(U[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":I(P.dbAttrs[0]),items:E,"value-provider":b,"label-provider":T,"onUpdate:modelValue":Ee=>Ee&&B(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Ux,[U[2]||(U[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%",disabled:F(P),"model-value":Ce(P.dbAttrs[0]),items:Ne,"value-provider":b,"label-provider":_e,"onUpdate:modelValue":Ee=>Ee&&De(P,Ee)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Hx,[U[3]||(U[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":H(P),items:p,"value-provider":b,"label-provider":y,"onUpdate:modelValue":Ee=>Ee&&ae(P,Ee)},null,8,["model-value","onUpdate:modelValue"])]),ce.value.length?(n.openBlock(),n.createElementBlock("label",Fx,[U[4]||(U[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Rd,{"model-value":P.groupCode,items:ce.value,"onUpdate:modelValue":Ee=>pe(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!ce.value.length}])},[U[5]||(U[5]=n.createElementVNode("span",null,"기본값",-1)),ye(P).length?(n.openBlock(),n.createBlock(n.unref(ie.BSSelect),{key:0,width:"100%","model-value":P.defaultValue??"none",items:ke(P),"value-provider":Re,"label-provider":xe,"onUpdate:modelValue":Ee=>Ee&&X(P,Ee)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(ie.BSTextInput),{key:1,name:`attr-default-${P.modelId}`,width:"100%",placeholder:"기본값","model-value":P.defaultValue??"","onUpdate:modelValue":Ee=>K(P,Ee)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",Gx,[U[6]||(U[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{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":Ee=>G(P,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",Jx,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(P)===null}]),title:"없음",onClick:Ee=>g(P,null)},"∅",10,Qx),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),Ee=>(n.openBlock(),n.createElementBlock("button",{key:Ee,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(P)===Ee}]),style:n.normalizeStyle({background:n.unref(Ln)(Ee)}),title:n.unref(On)(Ee),onClick:et=>g(P,Ee)},null,14,eI))),128)),A(P)?(n.openBlock(),n.createElementBlock("span",tI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,Tx)}),128))],8,Nx)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-52beb53b"]]),iI=["disabled"],aI={class:"em-panel__sub-label"},lI={class:"em-attr__row"},rI={class:"em-field em-idx-params"},sI=["value","onChange"],cI=Ue(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(m=>m.modelId===o.entityId)??null);function r(){var p;if(!l.value)return;const m=l.value.attributes[0];a.addIndex(l.value.modelId,{modelId:Oe(),name:`idx_${(((p=l.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:m?[{columnRef:m.modelId,descending:!1}]:[]})}function s(m,p){l.value&&a.updateIndex(l.value.modelId,m,p)}function c(m){var y;const p=(y=l.value)==null?void 0:y.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:y}:b)})}function u(m,p,y){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:y}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((y,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var y;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:p[0]||(p[0]=b=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",aI,[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(((y=l.value.indexes)==null?void 0:y.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:n.withModifiers(r,["stop"])})],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.indexes??[],b=>(n.openBlock(),n.createElementBlock("div",{key:b.modelId,class:"em-attr"},[n.createElementVNode("div",lI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`idx-name-${b.modelId}`,width:"100%",placeholder:"인덱스명","model-value":b.name,"onUpdate:modelValue":_=>s(b.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-uq-${b.modelId}`,class:"em-check",label:"UQ","model-value":b.unique,"onUpdate:modelValue":_=>s(b.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(mn,{controller:n.unref(a),"ref-id":b.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.columns,(_,A)=>(n.openBlock(),n.createElementBlock("div",{key:A,class:"em-attr__row"},[n.createVNode(n.unref(ie.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":g=>g.modelId,"label-provider":g=>g.name,"onUpdate:modelValue":g=>g&&d(b,A,g)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`idx-${b.modelId}-desc-${A}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":g=>u(b,A,g)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"−",onClick:g=>f(b,A)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",rI,[p[1]||(p[1]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>h(b,_.target.value)},null,40,sI)])]))),128)):n.createCommentVNode("",!0)],8,iI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),dI=["disabled"],uI={class:"em-panel__sub-label"},fI={class:"em-attr__row"},mI={class:"em-attr__row"},pI={class:"em-multilang"},hI={class:"em-attr__pii"},yI={class:"em-swatch__row em-attr__swatch"},gI=["onClick"],bI=["title","onClick"],_I=Ue(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=ie.useModal(),r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),s=n.computed(()=>r.value?a.state.layout.entityLayouts.find(g=>g.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(g){return g==="none"?"(없음)":g}const f=g=>g;function h(g,N){r.value&&a.updateOperation(r.value.modelId,g.modelId,N)}function m(g,N){h(g,{description:Object.keys(N).length?N:void 0})}function p(g){return g.personalInfoAttributeType??"none"}function y(g,N){h(g,{personalInfoAttributeType:N==="none"?void 0:N})}function b(g){var N,te;return it((te=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:te[g.modelId])}function _(g,N){r.value&&a.setOperationSwatch(r.value.modelId,g.modelId,N)}function A(g){l.openModal({component:Vd,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:N=>h(g,{sourceCode:N})}})}return(g,N)=>{var te;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:N[1]||(N[1]=S=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",uI,[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(((te=r.value.operations)==null?void 0:te.length)??0)+") ",1)]),n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:"추가",onClick:N[0]||(N[0]=n.withModifiers(S=>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??[],S=>(n.openBlock(),n.createElementBlock("div",{key:S.modelId,class:"em-attr"},[n.createElementVNode("div",fI,[n.createVNode(n.unref(ie.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":O=>h(S,{name:O})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":O=>O&&h(S,{visibility:O})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:O=>n.unref(a).removeOperation(r.value.modelId,S.modelId)},null,8,["onClick"])]),n.createElementVNode("div",mI,[n.createVNode(n.unref(ie.BSButton),{variant:"text",caption:S.sourceCode?"본문 편집 ●":"본문 편집",onClick:O=>A(S)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",pI,[N[2]||(N[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(kl,{multiline:"",name:`op-desc-${S.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":O=>m(S,O)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",hI,[N[3]||(N[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(ie.BSSelect),{width:"100%","model-value":p(S),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":O=>O&&y(S,O)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",yI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(S)===null}]),title:"없음",onClick:O=>_(S,null)},"∅",10,gI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),O=>(n.openBlock(),n.createElementBlock("button",{key:O,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(S)===O}]),style:n.normalizeStyle({background:n.unref(Ln)(O)}),title:n.unref(On)(O),onClick:z=>_(S,O)},null,14,bI))),128))])]))),128)):n.createCommentVNode("",!0)],8,dI)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),kI={class:"em-panel__head"},wI={class:"em-panel__head-row"},EI={class:"em-panel__context"},vI={key:0,class:"em-panel__lock"},NI=["disabled"],$I={key:0,class:"em-panel__note"},xI={key:1,class:"em-panel__note"},II={key:2,class:"em-jpa"},SI={class:"em-field"},CI={class:"em-field"},RI={key:0,class:"em-field"},VI={class:"em-panel__sub"},AI={class:"em-field"},TI={class:"em-jpa"},MI={key:0,class:"em-panel__note"},BI={class:"em-jpa"},DI={class:"em-field"},OI={key:0,class:"em-panel__note"},LI={class:"em-field"},PI={class:"em-multilang"},zI={class:"em-field"},UI=["value"],HI={class:"em-field"},FI={class:"em-swatch"},GI={class:"em-swatch__row"},YI=["title","onClick"],WI={class:"em-panel__note"},KI={class:"em-field"},qI=["value"],XI={class:"em-swatch"},jI={class:"em-swatch__row"},ZI=["title","onClick"],ef=Ue(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.selection.value),r=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const X=r.value;return X?a.state.logical.entities.find(K=>K.modelId===X)??null:null}),c=n.computed(()=>{const X=l.value;if((X==null?void 0:X.kind)==="association"){const w=a.state.logical.associations.find(C=>C.modelId===X.id);return!!w&&(a.isEntityLocked(w.end1.entityRef)||a.isEntityLocked(w.end2.entityRef))}const K=r.value;return!!K&&a.isEntityLocked(K)}),d=n.computed(()=>{var X;return((X=a.selectedAttr.value)==null?void 0:X.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),f=n.computed(()=>d.value!==null),h=n.ref({});n.watch(f,()=>{h.value={}});function m(X){return h.value[X]??f.value}function p(X){h.value={...h.value,[X]:!m(X)}}const y=n.computed(()=>{var w;const X=s.value;if(!X)return"엔티티";const K=(w=X.table)==null?void 0:w.physicalName;return K?`${X.name} (${K})`:X.name}),b=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="association"?a.state.logical.associations.find(K=>K.modelId===X.id)??null:null}),_=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="group"?a.state.logical.groups.find(K=>K.modelId===X.id)??null:null}),A=n.computed(()=>{const X=l.value;return(X==null?void 0:X.kind)==="note"?a.state.layout.notes.find(K=>K.modelId===X.id)??null:null}),g=n.computed(()=>{var K,w;const X=(K=_.value)==null?void 0:K.name;return(X==null?void 0:X.ko)||(X==null?void 0:X.en)||(X==null?void 0:X.ja)||(X==null?void 0:X.zh)||((w=_.value)==null?void 0:w.packageName)||"그룹"}),N=n.computed(()=>{if(s.value){const X=u.value.size;if(X>1)return`엔티티 · ${s.value.name} › 속성 · ${X}개`;if(d.value){const K=s.value.attributes.find(w=>w.modelId===d.value);return(K==null?void 0:K.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(K==null?void 0:K.name)??""}`}return`엔티티 · ${s.value.name}`}if(b.value){const X=K=>{var w;return((w=a.state.logical.entities.find(C=>C.modelId===K))==null?void 0:w.name)??K};return`관계 · ${X(b.value.end1.entityRef)} — ${X(b.value.end2.entityRef)}`}return _.value?`그룹 · ${g.value}`:A.value?"노트":"선택된 항목 없음"}),te=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],S=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],O=["LIST","SET"],z=["inherit","LAZY","EAGER"],F=X=>X;function ne(X){return X==="inherit"?"기본(따름)":X}const re=n.computed(()=>!!b.value&&b.value.end1.entityRef===b.value.end2.entityRef);function L(X,K){b.value&&a.updateAssociationEnd(b.value.modelId,X,K)}function oe(X){b.value&&!re.value&&a.setAssociationIdentifying(b.value.modelId,X)}function k(X){var K,w,C;return!!((C=(w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.cascadeTypes)!=null&&C.includes("ALL"))}function W(X,K,w){var Y,J;const C=(Y=b.value)==null?void 0:Y[X];if(K==="ALL"&&w){L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:["ALL"]}});return}const V=new Set(((J=C==null?void 0:C.jpa)==null?void 0:J.cascadeTypes)??[]);w?V.add(K):V.delete(K),L(X,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:[...V]}})}function R(X,K){var C;const w=(C=b.value)==null?void 0:C[X];L(X,{jpa:{...w==null?void 0:w.jpa,...K}})}function G(X){var K,w;return((w=(K=b.value)==null?void 0:K[X].jpa)==null?void 0:w.fetchType)??"inherit"}function H(X,K){R(X,{fetchType:K==="inherit"?void 0:K})}function ae(X){var w;const K=(w=b.value)==null?void 0:w[X==="end1"?"end2":"end1"];return(K==null?void 0:K.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(K==null?void 0:K.multiplicity)==="ONE_OR_MORE_INSTANCES"}const v=n.computed(()=>{const X=b.value;if(!X)return null;for(const K of a.state.logical.entities){const w=K.attributes.find(Y=>{var J;return((J=Y.embedded)==null?void 0:J.associationRef)===X.modelId&&Y.attrType==="EMBED_OWN"});if(!w)continue;const C=X.end2.entityRef===w.embedded.embeddableRef?"end2":"end1",V=X[C].jpa;return{which:C,isCollection:X[C].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(V==null?void 0:V.collectionType)??"LIST",collectionTable:(V==null?void 0:V.collectionTable)??"",orderColumn:(V==null?void 0:V.orderColumn)??""}}return null});function q(X){b.value&&a.setEmbedCollectionMode(b.value.modelId,X?"COLLECTION":"SINGLE")}function le(X){const K=v.value;K&&R(K.which,X==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function me(X){const K=v.value;K&&R(K.which,{collectionTable:X.trim()||void 0})}function he(X){const K=v.value;K&&R(K.which,{orderColumn:X.trim()||void 0})}function se(X){_.value&&a.updateGroup(_.value.modelId,X)}function ce(X,K){var w;se({name:{...(w=_.value)==null?void 0:w.name,[X]:K}})}const ye=n.computed(()=>{var X;return _.value?it((X=a.state.layout.groupLayouts.find(K=>K.groupRef===_.value.modelId))==null?void 0:X.style):null});function ke(X){_.value&&a.setGroupSwatch(_.value.modelId,X)}function Re(X){A.value&&a.setNoteMemo(A.value.modelId,X)}const xe=n.computed(()=>{var X;return it((X=A.value)==null?void 0:X.style)});function pe(X){A.value&&a.setNoteSwatch(A.value.modelId,X)}return(X,K)=>(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:K[0]||(K[0]=(...w)=>e.startResize&&e.startResize(...w))},null,34),n.createElementVNode("header",kI,[n.createElementVNode("div",wI,[K[13]||(K[13]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:K[1]||(K[1]=w=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",EI,n.toDisplayString(N.value),1),c.value&&r.value?(n.openBlock(),n.createElementBlock("div",vI,[n.createVNode(Ve,{name:"lock",size:13}),K[14]||(K[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:K[2]||(K[2]=w=>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(Sd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("basics"),title:y.value,onToggle:K[3]||(K[3]=w=>p("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(oI,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(cI,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("index"),onToggle:K[4]||(K[4]=w=>p("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(_I,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:m("ops"),onToggle:K[5]||(K[5]=w=>p("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(ie.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!b.value.identifying,disabled:re.value||!!v.value,"onUpdate:modelValue":oe},null,8,["model-value","disabled"]),re.value?(n.openBlock(),n.createElementBlock("p",$I,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):v.value?(n.openBlock(),n.createElementBlock("p",xI,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),v.value?(n.openBlock(),n.createElementBlock("fieldset",II,[K[18]||(K[18]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(ie.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":v.value.isCollection,"onUpdate:modelValue":q},null,8,["model-value"]),v.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",SI,[K[15]||(K[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":v.value.collectionType,items:O,"value-provider":F,"label-provider":F,"onUpdate:modelValue":K[6]||(K[6]=w=>w&&le(w))},null,8,["model-value"])]),n.createElementVNode("label",CI,[K[16]||(K[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":v.value.collectionTable,"onUpdate:modelValue":me},null,8,["model-value"])]),v.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",RI,[K[17]||(K[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":v.value.orderColumn,"onUpdate:modelValue":he},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),K[19]||(K[19]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],w=>{var C,V,Y,J;return n.createElementVNode("div",{key:w,class:"em-end"},[n.createElementVNode("h4",VI,n.toDisplayString(w)+" → "+n.toDisplayString(b.value[w].entityRef),1),n.createElementVNode("label",AI,[K[20]||(K[20]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":b.value[w].multiplicity,items:te,"value-provider":F,"label-provider":F,disabled:((C=v.value)==null?void 0:C.which)===w,"onUpdate:modelValue":ge=>L(w,{multiplicity:ge})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-navigable`,class:"em-check",label:"navigable","model-value":b.value[w].navigable,"onUpdate:modelValue":ge=>L(w,{navigable:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-composition`,class:"em-check",label:"composition","model-value":b.value[w].composition,"onUpdate:modelValue":ge=>L(w,{composition:ge})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",TI,[K[21]||(K[21]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(S,ge=>{var we,Ne;return n.createVNode(n.unref(ie.BSCheckbox),{key:ge,name:`${w}-cascade-${ge}`,class:"em-check",label:ge,"model-value":!!((Ne=(we=b.value[w].jpa)==null?void 0:we.cascadeTypes)!=null&&Ne.includes(ge)),disabled:ge!=="ALL"&&k(w),"onUpdate:modelValue":_e=>W(w,ge,_e)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),k(w)?(n.openBlock(),n.createElementBlock("p",MI,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",BI,[K[24]||(K[24]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",DI,[K[22]||(K[22]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(ie.BSSelect),{"model-value":G(w),items:z,"value-provider":F,"label-provider":ne,"onUpdate:modelValue":ge=>ge&&H(w,ge)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:`${w}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((V=b.value[w].jpa)!=null&&V.orphanRemoval),disabled:ae(w),"onUpdate:modelValue":ge=>R(w,{orphanRemoval:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ae(w)&&((Y=b.value[w].jpa)!=null&&Y.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",OI,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",LI,[K[23]||(K[23]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:`${w}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((J=b.value[w].jpa)==null?void 0:J.orderBy)??"","onUpdate:modelValue":ge=>R(w,{orderBy:ge.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",PI,[K[25]||(K[25]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,w=>{var C;return n.openBlock(),n.createElementBlock("label",{key:w,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(w),1),n.createVNode(n.unref(ie.BSTextInput),{name:`grp-name-${w}`,width:"100%","model-value":((C=_.value.name)==null?void 0:C[w])??"","onUpdate:modelValue":V=>ce(w,V)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",zI,[K[26]||(K[26]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:K[7]||(K[7]=w=>se({description:w.target.value}))},null,40,UI)]),n.createElementVNode("label",HI,[K[27]||(K[27]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(ie.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":K[8]||(K[8]=w=>se({packageName:w}))},null,8,["model-value"])]),n.createVNode(n.unref(ie.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":K[9]||(K[9]=w=>se({excludeDDLGeneration:w}))},null,8,["model-value"]),n.createElementVNode("fieldset",FI,[K[28]||(K[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",GI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:K[10]||(K[10]=w=>ke(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>ke(w)},null,14,YI))),128))])]),n.createElementVNode("p",WI,"멤버 엔티티 "+n.toDisplayString(_.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",KI,[K[29]||(K[29]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:A.value.memo,rows:"6",onChange:K[11]||(K[11]=w=>Re(w.target.value))},null,40,qI)]),n.createElementVNode("fieldset",XI,[K[30]||(K[30]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",jI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:"없음",onClick:K[12]||(K[12]=w=>pe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(fn),w=>(n.openBlock(),n.createElementBlock("button",{key:w,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":xe.value===w}]),style:n.normalizeStyle({background:n.unref(Ln)(w)}),title:n.unref(On)(w),onClick:C=>pe(w)},null,14,ZI))),128))])])],64)):n.createCommentVNode("",!0)],8,NI)],4))}}),[["__scopeId","data-v-2bdf0dab"]]),JI={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function QI(e){const t=e.split("-")[1];return t?JI[t]??t:e}function eS(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const tS=["title"],nS=["title","onClick"],oS={key:0,class:"em-validation__body"},iS={class:"em-validation__opt"},aS={key:0,class:"em-validation__empty"},lS={key:1,class:"em-validation__empty"},rS={key:2,class:"em-validation__list"},sS=["onClick"],cS={class:"em-validation__item-msg"},dS={key:0,class:"em-validation__item-entity"},uS=["title"],fS=Ue(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 y=new Map;for(const b of o.state.logical.entities)y.set(b.modelId,b.name);return y});function l(y){const b=eS(y);if(!b)return null;const _=a.value.get(b);return _===void 0?null:_.trim()===""?"(이름 없음)":_}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 y={error:0,warning:0,info:0};for(const b of i.value)y[b.severity]++;return y}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(y=>c.value[y.severity]).slice().sort((y,b)=>r[y.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(y=>({issue:y,entityName:l(y),category:QI(y.ruleId)}))),f=n.ref(!1);function h(y){c.value[y]=!c.value[y]}function m(y){if(!f.value){f.value=!0;return}h(y)}function p(y){y.targetRef&&o.requestFocus(y.targetRef)}return(y,b)=>(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:b[1]||(b[1]=_=>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"]),b[3]||(b[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,tS),n.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],_=>n.createElementVNode("button",{key:_,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:f.value?`${r[_].label} ${c.value[_]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:A=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,nS)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",oS,[n.createElementVNode("label",iS,[n.createVNode(n.unref(ie.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>n.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",aS,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",lS," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",rS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:A,category:g},N)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${N}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:te=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",cS,[A?(n.openBlock(),n.createElementBlock("span",dS,n.toDisplayString(A),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(g),9,uS)],10,sS))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),mS={class:"em-history"},pS={class:"em-history__head"},hS={class:"em-history__title"},yS={class:"em-history__head-actions"},gS=["disabled"],bS={class:"em-history__filters"},_S={class:"em-history__filter"},kS={class:"em-history__body"},wS={key:0,class:"em-history__empty"},ES={key:1,class:"em-history__empty is-error"},vS={key:2,class:"em-history__empty"},NS={key:3,class:"em-history__list"},$S=["onClick"],xS={class:"em-history__summary"},IS={class:"em-history__seq"},SS={class:"em-history__gmeta"},CS={class:"em-history__who"},RS={key:0,class:"em-history__time"},VS={key:1,class:"em-history__restored-from"},AS={key:0,class:"em-history__detail"},TS={class:"em-history__action-head"},MS={class:"em-history__action-name"},BS={key:0,class:"em-history__fields"},DS={class:"em-history__fname"},OS={key:0,class:"em-history__old"},LS={class:"em-history__val"},PS={key:1,class:"em-history__restore"},zS=["disabled","onClick"],US=["disabled"],HS=["onClick"],FS=Ue(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.ref([]),r=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){r.value=!0,s.value=null;try{l.value=await a.historyTransport(),c.value=!0}catch(v){s.value=v instanceof Error?v.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,v=>{v&&u()},{immediate:!0});let f=null;n.watch(()=>a.revision.value,()=>{o.open&&(f&&clearTimeout(f),f=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const h=n.computed(()=>new Map(a.state.logical.entities.map(v=>[v.modelId,v]))),m=n.computed(()=>new Map(a.state.logical.associations.map(v=>[v.modelId,v]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(v=>{var q;return[v.modelId,v.packageName||((q=v.name)==null?void 0:q.ko)||v.modelId]})));function y(v){var he,se,ce,ye,ke,Re,xe;const q=m.value.get(v);if(!q)return"연관";if((he=q.description)!=null&&he.trim())return q.description.trim();const le=(ye=(ce=h.value.get((se=q.end1)==null?void 0:se.entityRef))==null?void 0:ce.name)==null?void 0:ye.trim(),me=(xe=(Re=h.value.get((ke=q.end2)==null?void 0:ke.entityRef))==null?void 0:Re.name)==null?void 0:xe.trim();return le&&me?`${le}→${me}`:"연관"}function b(v){var q,le,me,he;if(v.kind==="entity")return((le=(q=h.value.get(v.ref))==null?void 0:q.name)==null?void 0:le.trim())||"(이름 없음)";if(v.kind==="attribute"||v.kind==="operation"||v.kind==="index"){const se=v.entityRef?h.value.get(v.entityRef):void 0,ye=((v.kind==="attribute"?se==null?void 0:se.attributes:v.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Re=>Re.modelId===v.ref),ke=(me=se==null?void 0:se.name)==null?void 0:me.trim();return`${ke?ke+".":""}${((he=ye==null?void 0:ye.name)==null?void 0:he.trim())||v.ref}`}return v.kind==="association"?y(v.ref):v.kind==="associationEnd"?`${y(v.ref)}(${v.end})`:v.kind==="group"?`그룹 ${p.value.get(v.ref)??v.ref}`:v.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},A={add:"추가",update:"수정",remove:"삭제"},g=n.ref("all"),N=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],te=n.computed({get:()=>g.value,set:v=>{v&&(g.value=v)}}),S=n.computed(()=>br(l.value)),O=n.computed(()=>S.value.length?S.value[0].seq:null),z=n.computed(()=>g.value==="all"?S.value:S.value.filter(v=>(v.kind??"edit")===g.value));function F(v){return v===void 0?"—":v===null?"(비움)":typeof v=="object"?JSON.stringify(v):String(v)}function ne(v){const q=b(v.subject);if(v.verb==="add")return`${q} 추가`;if(v.verb==="remove")return`${q} 삭제`;if(v.fields.length===1){const le=v.fields[0];return`${q}.${le.field} ${le.oldValue!==void 0?F(le.oldValue)+"→":""}${F(le.value)}`}return`${q} ${v.fields.length}개 변경`}function re(v){return v.actions.length===0?"변경 없음":v.actions.length===1?ne(v.actions[0]):`${ne(v.actions[0])} 외 ${v.actions.length-1}건`}const L=n.ref(new Set);function oe(v){const q=new Set(L.value);q.has(v)?q.delete(v):q.add(v),L.value=q}function k(v){if(v==null)return"";const q=new Date(v);return isNaN(q.getTime())?String(v):q.toLocaleString()}function W(v){const q=v.author,le=v.origin;return q&&le?`${q}(${le})`:q||(le?`(${le})`:"—")}const R=n.ref(null),G=n.ref(!1);function H(v){R.value=v}async function ae(v){G.value=!0;try{const q=await a.restoreToSeq(v);q.ok||(s.value=`복원 실패: ${q.reason??"알 수 없음"}`)}finally{G.value=!1,R.value=null}}return(v,q)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",mS,[n.createElementVNode("header",pS,[n.createElementVNode("div",hS,[n.createVNode(Ve,{name:"undo",size:15}),q[4]||(q[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",yS,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:q[0]||(q[0]=le=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,gS),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:q[1]||(q[1]=le=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",bS,[n.createElementVNode("label",_S,[q[5]||(q[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(ie.BSSelect),{modelValue:te.value,"onUpdate:modelValue":q[2]||(q[2]=le=>te.value=le),items:N,"value-provider":le=>le.v,"label-provider":le=>le.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",kS,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",wS,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",ES,n.toDisplayString(s.value),1)):z.value.length===0?(n.openBlock(),n.createElementBlock("p",vS,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",NS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.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:me=>oe(le.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":L.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",xS,n.toDisplayString(re(le)),1),n.createElementVNode("span",IS,"#"+n.toDisplayString(le.seq),1)],8,$S),n.createElementVNode("div",SS,[n.createElementVNode("span",CS,n.toDisplayString(W(le)),1),le.ts?(n.openBlock(),n.createElementBlock("span",RS,n.toDisplayString(k(le.ts)),1)):n.createCommentVNode("",!0),le.kind==="restore"&&le.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",VS,"← #"+n.toDisplayString(le.restoredFromSeq),1)):n.createCommentVNode("",!0)]),L.value.has(le.seq)?(n.openBlock(),n.createElementBlock("div",AS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(le.actions,(me,he)=>(n.openBlock(),n.createElementBlock("div",{key:he,class:"em-history__action"},[n.createElementVNode("div",TS,[n.createVNode(Ve,{name:_[me.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",MS,n.toDisplayString(b(me.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${me.verb}`])},n.toDisplayString(A[me.verb]),3)]),me.fields.length?(n.openBlock(),n.createElementBlock("ul",BS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(me.fields,(se,ce)=>(n.openBlock(),n.createElementBlock("li",{key:ce,class:"em-history__field"},[n.createElementVNode("span",DS,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",OS,n.toDisplayString(F(se.oldValue)),1)):n.createCommentVNode("",!0),se.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",LS,n.toDisplayString(F(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&le.seq!==O.value?(n.openBlock(),n.createElementBlock("div",PS,[R.value===le.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[q[6]||(q[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:G.value,onClick:me=>ae(le.seq)},"복원",8,zS),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:G.value,onClick:q[3]||(q[3]=me=>R.value=null)},"취소",8,US)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:me=>H(le.seq)},[n.createVNode(Ve,{name:"undo",size:12}),q[7]||(q[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,HS))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-23ba7bba"]]);function GS(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 tf(e){const t=n.ref(GS(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 YS={class:"em-modeler"},WS={class:"em-modeler__body"},KS={class:"em-drawer__inner"},qS={class:"em-drawer__head"},XS={class:"em-drawer__actions"},jS=["title"],ZS=Ue(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}=tf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=tf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,y,b;return n.openBlock(),n.createElementBlock("div",YS,[n.createVNode(Qu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var A;return(A=u.value)==null?void 0:A.exportSvg()}),onExportPng:m[1]||(m[1]=_=>{var A;return(A=u.value)==null?void 0:A.exportPng()}),onToggleHistory:m[2]||(m[2]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",WS,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",KS,[n.createElementVNode("header",qS,[m[10]||(m[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",XS,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(y=f.value)!=null&&y.allExpanded?"모두 접기":"모두 펼치기",onClick:m[3]||(m[3]=_=>{var A;return(A=f.value)==null?void 0:A.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,jS)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[4]||(m[4]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Ju,{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]=(..._)=>n.unref(r)&&n.unref(r)(..._))},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]=_=>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(Zu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(ef,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[7]||(m[7]=_=>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]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(FS,{controller:e.controller,open:i.value,onClose:m[9]||(m[9]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(fS,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1bc07cae"]]);ve.APPLY_MODEL_OPS_INPUT_SCHEMA=Vm,ve.AssociationEdge=Qd,ve.CUSTOM_TYPE_VALUE=zt,ve.CommandStack=Ia,ve.DEFAULT_JAVA_TYPE=ka,ve.DiagramCanvas=Zu,ve.DiagramExplorer=Ju,ve.EDITOR=pn,ve.EditModeToggle=vx,ve.EditorToolbar=Qu,ve.EntityModeler=ZS,ve.EntityNode=Od,ve.GROUP_CODE_ENUM_VALUE=qn,ve.GroupNode=Ld,ve.JAVA_TYPES=wa,ve.NoteNode=Pd,ve.OpSyncAdapter=ss,ve.PHYSICAL_NAME_MAX_LENGTH=va,ve.PropertyPanel=ef,ve.RevCache=rs,ve.SELECTABLE_JAVA_TYPES=dr,ve.SYMBOLIC_OP_KINDS=cs,ve.SYMBOLIC_OP_SCHEMA=ks,ve.anchoredEdgePoint=pa,ve.buildAgentBatch=Am,ve.buildDiagramSvg=Kl,ve.buildOrthogonalPath=da,ve.buildSelfLoopPath=Jl,ve.buildStraightPath=fa,ve.commands=tm,ve.computeAutoLayout=Ql,ve.createEditorController=mk,ve.defaultMermaidDialect=df,ve.displayLabel=Fo,ve.emptyState=Td,ve.entityModelToMermaid=ya,ve.entityModelToText=or,ve.estimateEntityHeight=tr,ve.exportDiagramPng=Xu,ve.exportDiagramSvg=qu,ve.fromPersisted=Ym,ve.indexColumnsByModelId=Xn,ve.javaTypeLabel=En,ve.migrateLegacyMoney=Df,ve.newId=Oe,ve.orthogonalMidpoints=ua,ve.packEntityBoxes=cf,ve.physicalNameWarning=Wo,ve.projectActionLog=br,ve.projectEntityAudit=yr,ve.projectFieldAudit=Ut,ve.rectExitPoint=ma,ve.renderDiagramSvg=sr,ve.resolveDiagram=jl,ve.resolveSharedColumn=Yo,ve.resolveSymbolicOps=wm,ve.restoreDeepEqual=vn,ve.segmentMidpoints=ha,ve.sideDir=Wn,ve.synthesizeRestoreOps=Wf,ve.toPersisted=ap,ve.toPersistedV2=lp,ve.validateModel=pr,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})}));
|