@g1cloud/entity-modeler-next 5.0.0-alpha.6 → 5.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- (function(Ne,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):(Ne=typeof globalThis<"u"?globalThis:Ne||self,n(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,n,le){"use strict";var qx=Object.defineProperty;var Xx=(Ne,n,le)=>n in Ne?qx(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:le}):Ne[n]=le;var ze=(Ne,n,le)=>Xx(Ne,typeof n!="symbol"?n+"":n,le);const Tu={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Mu(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 Ll(e,t,o={}){const i={...Tu,...o},a=new Map(e.entities.map(y=>[y.modelId,y])),l=new Map(e.associations.map(y=>[y.modelId,y])),r=new Map(t.entityLayouts.map(y=>[y.entityRef,y])),s=new Map(t.associationLayouts.map(y=>[y.associationRef,y])),c=t.entityLayouts.map(y=>y.entityRef).filter(y=>!a.has(y)),d=t.associationLayouts.map(y=>y.associationRef).filter(y=>!l.has(y)),u=new Map;for(const y of e.groups)for(const x of y.memberEntityRefs)u.set(x,y.modelId);const f=new Map;for(const y of t.groupLayouts)for(const x of y.memberNoteRefs??[])f.set(x,y.groupRef);let h=0;const m=e.entities.map(y=>{const x=u.get(y.modelId),q=r.get(y.modelId);if(q){const K={location:{x:q.geo.location.x,y:q.geo.location.y},size:{width:q.geo.size.width,height:q.geo.size.height}};return{entity:y,geo:K,collapsed:q.collapsed??!1,groupRef:x,style:q.style,attributeStyles:q.attributeStyles,operationStyles:q.operationStyles}}const P=Mu(h++,i);return{entity:y,geo:P,collapsed:!1,groupRef:x}}),p=new Map(t.groupLayouts.map(y=>[y.groupRef,y])),g=e.groups.map(y=>{const x=p.get(y.modelId),q=x?{location:{x:x.geo.location.x,y:x.geo.location.y},size:{width:x.geo.size.width,height:x.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:y,geo:q,style:x==null?void 0:x.style}}),b=e.associations.map(y=>{const x=s.get(y.modelId);return{association:y,waypoints:(x==null?void 0:x.waypoints)??[],sourceColumnRef:x==null?void 0:x.sourceColumnRef,targetColumnRef:x==null?void 0:x.targetColumnRef}}),_=t.notes.map(y=>({note:{...y,geo:{location:{x:y.geo.location.x,y:y.geo.location.y},size:{width:y.geo.size.width,height:y.geo.size.height}}},groupRef:f.get(y.modelId)})),N=[];for(const y of t.notes)for(const x of y.connections??[])a.has(x.targetRef)&&N.push({noteRef:y.modelId,targetRef:x.targetRef,waypoints:x.waypoints.map(q=>({x:q.x,y:q.y}))});return{entities:m,associations:b,groups:g,notes:_,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function Gn(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 Pl(e,t,o,i,a,l){const r=Gn(t),s=Gn(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,g=c;for(let b=1;b<u.length;b++){const _=u[b],N=b<=o.length?b-1:o.length,y=Math.abs(_.x-g.x)<wn,x=Math.abs(_.y-g.y)<wn;y&&x||(y?(m(_,N),p=!1):x?(m(_,N),p=!0):p?(m({x:g.x,y:_.y},N),m(_,N),p=!0):(m({x:_.x,y:g.y},N),m(_,N),p=!1),g=_)}return m(i,o.length),f}function ea(e,t,o,i,a,l=20){const r=Pl(e,t,o,i,a,l);let s=`M ${qe(e.x)},${qe(e.y)}`;for(const c of r)s+=` L ${qe(c.b.x)},${qe(c.b.y)}`;return s}const Bu=14;function ta(e,t,o,i,a,l=20){return Pl(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=Bu).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function qe(e){return Math.round(e*100)/100}const Du=36;function zl(e,t,o=Du){const i=Math.max(e.x,t.x)+o;return`M ${qe(e.x)},${qe(e.y)} L ${qe(i)},${qe(e.y)} L ${qe(i)},${qe(t.y)} L ${qe(t.x)},${qe(t.y)}`}function na(e,t,o){const i=[e,...t,o];let a=`M ${qe(i[0].x)},${qe(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${qe(i[l].x)},${qe(i[l].y)}`;return a}function Ou(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function oa(e,t){const o=Ou(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 ia(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function aa(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const Lu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ul(e,t,o={}){const i={...Lu,...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((g,b)=>{const _=b%p,N=Math.floor(b/p);l.push({id:g,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=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 Hl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Fl(e,t={}){const o={...Hl,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Pu(e,t={}){const o={...Hl,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=Fl(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 To(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 Gl(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 Yl(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],g=p!=null&&p.length?`(${p.length}${p.scale!=null?`,${p.scale}`:""})`:"",b=p?` → ${p.physicalName} ${p.dataType}${g}`:"",_=[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(g=>`${o.get(g.columnRef)??g.columnRef}${g.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}}`:"",g=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${p}${g}`)}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} ${Gl(c.end1.multiplicity)} —— ${Gl(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
- `).trim()}const zu=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function it(e){return e.replace(zu,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Re(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Wl(e){return`<text ${[`x="${Re(e.x)}"`,`y="${Re(e.y)}"`,`fill="${it(e.fill)}"`,`font-size="${Re(e.fontSize)}"`,e.fontFamily?`font-family="${it(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${it(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${it(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${it(e.text)}</text>`}function Uu(e){return`<line x1="${Re(e.x1)}" y1="${Re(e.y)}" x2="${Re(e.x2)}" y2="${Re(e.y)}" stroke="${it(e.stroke)}" stroke-width="${Re(e.strokeWidth??1)}" />`}function Hu(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 Fu(e,t,o,i,a){return[`M${Re(e+a.tl)},${Re(t)}`,`L${Re(e+o-a.tr)},${Re(t)}`,a.tr?`Q${Re(e+o)},${Re(t)} ${Re(e+o)},${Re(t+a.tr)}`:"",`L${Re(e+o)},${Re(t+i-a.br)}`,a.br?`Q${Re(e+o)},${Re(t+i)} ${Re(e+o-a.br)},${Re(t+i)}`:"",`L${Re(e+a.bl)},${Re(t+i)}`,a.bl?`Q${Re(e)},${Re(t+i)} ${Re(e)},${Re(t+i-a.bl)}`:"",`L${Re(e)},${Re(t+a.tl)}`,a.tl?`Q${Re(e)},${Re(t)} ${Re(e+a.tl)},${Re(t)}`:"","Z"].filter(Boolean).join(" ")}function la(e){const t=Hu(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${it(e.fill)}"`,`stroke="${it(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${it(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Re(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Fu(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Re(e.x)}" y="${Re(e.y)}" width="${Re(e.w)}" height="${Re(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Uu(r));for(const r of e.texts)l.push(Wl(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Gu(e){const o=[`<path ${[`d="${it(e.d)}"`,'fill="none"',`stroke="${it(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${it(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Wl(i));return`<g>${o.join("")}</g>`}function Kl(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Re(t)}" y="${Re(o)}" width="${Re(i)}" height="${Re(a)}" fill="${it(e.background)}" />`);for(const r of e.groups)l.push(la(r));for(const r of e.edges)l.push(Gu(r));for(const r of e.entities)l.push(la(r));for(const r of e.notes)l.push(la(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Re(t)} ${Re(o)} ${Re(i)} ${Re(a)}" width="${Re(i)}" height="${Re(a)}">`+l.join("")+"</svg>"}const Yu=["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"],Wu=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"]),Ku=Yu.filter(e=>!Wu.has(e)),qu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ra(e){return qu[e]??e}const Xu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Mo=new Set(["NUMERIC","DECIMAL"]);function ql(e,t=Ku){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Jt="CustomType",Bo="GroupCodeEnum",Xl="String",jl=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Bo,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Jt,label:"CustomType"}],ju=new Map(jl.map(e=>[e.value,e.label]));function Yn(e){return ju.get(e)??e}const Zu=new Set([Bo,"CustomMoneyType"]),Ju=jl.filter(e=>!Zu.has(e.value)).map(e=>e.value===Jt?{...e,label:"CustomType (사용자정의)"}:e);function Zl(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=[...Ju,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Yn(e)},...i]:i}function Qu(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Jl(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 sa(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${Yn(t.type)}>`:Qu(t)?Yn(t.type):e==="CLASS"?t.type===Jt&&t.customType||Yn(t.type):ra(((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 Do(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 ca=63;function Oo(e){if(!e)return null;const t=e.length;return t<=ca?null:`물리명이 ${ca}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Ql(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function rt(e){return!e||e.trim()===""}function Kn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ef(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 tf(e,t,o,i,a){var l,r,s,c,d;if(!rt(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 da(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 er(e,t){var l,r,s;const o=[];for(const c of da(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(rt(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) 속성이 없습니다"}),rt((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(g=>g.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(g=>g.identifier&&g.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 g of p.dbAttrs)!g.autoIncrement&&rt(g.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`채번(${g.autoIncrement?"auto increment":`시퀀스 "${g.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(g=>g.naturalId&&g.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(g=>g.naturalId&&g.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(g=>g.naturalId&&!g.notNull&&!g.identifier&&!g.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 da(d,g=>g.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)rt(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((g,b)=>({col:g,name:tf(p,g,b,e,t)})).filter(g=>g.col.sharedColumnRef==null));for(const p of da(f,g=>g.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 g=Oo(p.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!rt(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&&!rt(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}"`}),!rt(p.dataType)&&Xu.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=Wn(d.flatMap(g=>g.dbAttrs));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===g.type);b&&g.dbAttrs.forEach((_,N)=>{if(_.sharedColumnRef==null)return;const y=b.fields[N],x=p.get(_.sharedColumnRef);if(!y||!x)return;(x.dataType!==y.dataType||(x.length??null)!==(y.length??null)||(x.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${Ql(x)})이 ${y.name??"컬럼"} 정의(${Ql(y)})와 다릅니다`})})}}for(const p of d){const g=p.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;p.type===Bo&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Oo(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!rt(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 g=Oo(p.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!rt(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){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??[],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"}와 의미가 겹칩니다`}),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 ef(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(!rt(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 Te(){return crypto.randomUUID()}const nf="CustomMoneyType",of="Money";function af(e){return!(e.type!==nf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function lf(e){const t=e.dbAttrs[0]??{modelId:Te(),physicalName:"",dataType:""},o={modelId:Te(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:of,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function rf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>af(r)?(a=!0,t=!0,lf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function ua(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 Qt(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 en(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 sf(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 cf=new Set(["attributes","operations","indexes","rev"]),df=new Set(["end1","end2","rev"]),uf=new Set(["memberEntityRefs","rev"]),tr=new Set(["modelId"]),ff=new Set(["modelId","columns"]),mf=new Set([]);function pf(e,t,o,i){const a=en(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=Qt(s,c,tr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=en(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=Qt(s,c,tr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=en(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=Qt(s,c,ff);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function hf(e,t,o){const i=en(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:ua(r)});for(const{cur:r,tgt:s}of i.common){const c=Qt(r,s,cf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),pf(r.modelId,r,s,o)}const a=en(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:ua(r)});for(const{cur:r,tgt:s}of a.common){const c=Qt(r,s,df);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Qt(r[d]??{},s[d]??{},mf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=en(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:ua(r)});for(const{cur:r,tgt:s}of l.common){const c=Qt(r,s,uf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=sf(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 Lo(e,t,o,i,a,l,r){const s=en(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){Lo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Lo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Lo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Lo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function gf(e,t){const o=[];return hf(e.logical,t.logical,o),yf(e.layout,t.layout,o),o}function bf(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 _f={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 wf{constructor(t){ze(this,"out",[]);ze(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 pt(e,t,o,i){if(o==null||typeof o!="object")return;const a=_f[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function tn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function fa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Ot(e,t){var l,r,s,c,d,u,f,h;const o=bf(t),i=new wf(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"?pt(i,m,p.value,"entity"):p.kind==="entity.update"?tn(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 g=fa((l=p.value)==null?void 0:l.attributes,t.attributeRef);g&&pt(i,m,g,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?pt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?tn(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 g=fa((s=p.value)==null?void 0:s.operations,t.operationRef);g&&pt(i,m,g,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?pt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?tn(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 g=fa((d=p.value)==null?void 0:d.indexes,t.indexRef);g&&pt(i,m,g,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?pt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?tn(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"?pt(i,m,p.value,"association"):p.kind==="association.update"?tn(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 g=(f=p.value)==null?void 0:f[t.end];pt(i,m,g,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?tn(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"){pt(i,m,p.value,"group");const g=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const b of g)i.member(m,b,!1)}else p.kind==="group.update"?tn(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 vf(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function En(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Ef(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;En(c==null?void 0:c.attributes,o),En(c==null?void 0:c.operations,i),En(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(r.kind==="attribute.add"?En([s.value],o):r.kind==="attribute.update"||r.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):r.kind==="operation.add"?En([s.value],i):r.kind==="operation.update"||r.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):r.kind==="index.add"?En([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 Po(e,t){return e.map(o=>({...o,subject:t}))}function nr(e,t){const o=e.filter(s=>s.ops.some(c=>vf(c,t))),{attributes:i,operations:a,indexes:l}=Ef(o,t),r=[...Po(Ot(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Po(Ot(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Po(Ot(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Po(Ot(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 or(e){return`${e.kind}:${e.ref}:${e.end??""}`}function kf(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 Nf(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 If(e){const{entities:t,associations:o,groups:i}=Nf(e),a=[];for(const l of t)for(const r of nr(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Ot(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Ot(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Ot(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function ir(e){const t=If(e),o=kf(e),i=new Map;for(const r of t){const s=or(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=or(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 ma{constructor(t){ze(this,"undoStack",[]);ze(this,"redoStack",[]);ze(this,"savePoint",null);ze(this,"listeners",new Set);ze(this,"commandListeners",new Set);ze(this,"coalesceSealed",!1);this.state=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 ar(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function We(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function st(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Oe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function $t(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function pa(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=ar(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=We(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 ha(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=ar(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=We(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),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 lr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Oe(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Oe(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 rr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Oe(i,e);o=a.name,a.name=t},invert(i){Oe(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 kn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=We(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=We(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 sr(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=We(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=We(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 cr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=We(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=We(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=We(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 dr(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=We(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=We(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 ya(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 zo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=We(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=We(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=We(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 ga(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 ur(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 ba(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 fr(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 Uo(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 mr(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 pr(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 hr(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 xt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Oe(o,e).attributes.push(t)},invert(o){const i=Oe(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 nn(e,t,o){const i={},a=l=>{const r=Oe(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 Lt(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Oe(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&&Oe(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 _a(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Oe(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&&Oe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Oe(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 yr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Oe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Oe(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 gr(e,t,o){const i={},a=l=>{var s;const r=(s=Oe(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 br(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Oe(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=Oe(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=Oe(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=Oe(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Oe(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 wr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=We(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=We(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=We(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 wa(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 va(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 Ho(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 Nn(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 vr(e,t){return{label:"인덱스 추가",apply(o){const i=Oe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Oe(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 Er(e,t,o){const i={},a=l=>{var s;const r=(s=Oe(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 kr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Oe(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&&Oe(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 ht=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),jn=(e,t)=>{var o;return((o=st(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Nr(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=st(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=st(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:[ht(e,l)],invert:[ht(e,r)]}}}}function Ir(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=st(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=st(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:[ht(e,a)],invert:[ht(e,l)]}}}}function $r(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=st(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=st(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[ht(e,jn(a,e))],invert:[ht(e,i??[])]}}}}function xr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=st(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=st(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[ht(e,jn(o,e))],invert:[ht(e,t??[])]}}}}function Sr(e,t,o){return{label:"waypoint 추가",apply(i){const a=st(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=st(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:[ht(e,a)],invert:[ht(e,l)]}}}}function Cr(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 Ea(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 Rr(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 Vr(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 Ar(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 Tr(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 Mr(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 Pt=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Fo=(e,t,o)=>{var i;return((i=$t(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Br(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 Dr(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 Or(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=$t(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=$t(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Fo(l,e,t),s=r.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Pt(e,t,r)],invert:[Pt(e,t,s)]}}}}function Lr(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=$t(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=$t(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Fo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[Pt(e,t,l)],invert:[Pt(e,t,r)]}}}}function Pr(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=$t(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=$t(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Fo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[Pt(e,t,l)],invert:[Pt(e,t,r)]}}}}function zr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=$t(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=$t(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Pt(e,t,Fo(i,e,t))],invert:[Pt(e,t,o??[])]}}}}function Le(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 $f=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:wa,addAttribute:xt,addEntity:pa,addEntityToGroup:fr,addGroup:ga,addIndex:vr,addNote:Cr,addNoteConnection:Br,addNoteConnectionWaypoint:Lr,addNoteToGroup:Tr,addOperation:yr,addWaypoint:Sr,clearNoteConnectionWaypoints:zr,clearWaypoints:xr,composite:Le,moveEntity:kn,moveGroup:mr,moveNote:Zn,moveNoteConnectionWaypoint:Or,moveWaypoint:Nr,removeAssociation:va,removeAttribute:Lt,removeEntity:ha,removeEntityFromGroup:Uo,removeGroup:ba,removeIndex:kr,removeNote:Ea,removeNoteConnection:Dr,removeNoteConnectionWaypoint:Pr,removeNoteFromGroup:Mr,removeOperation:br,removeWaypoint:Ir,renameEntity:rr,reorderAttributes:_a,reorderOperations:_r,resizeEntity:sr,resizeGroup:pr,resizeNote:Rr,setAllEntitiesCollapsed:ya,setAttributeSwatch:zo,setEntityCollapsed:dr,setEntitySwatch:cr,setGroupSwatch:hr,setNoteMemo:Vr,setNoteSwatch:Ar,setOperationSwatch:wr,translateWaypoints:$r,updateAssociation:Ho,updateAssociationEnd:Nn,updateAttribute:nn,updateEntity:lr,updateGroup:ur,updateIndex:Er,updateOperation:gr},Symbol.toStringTag,{value:"Module"}));class Ur{constructor(){ze(this,"revs",new Map);ze(this,"layoutVersion",0);ze(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 Hr{constructor(t){ze(this,"cache",new Ur);ze(this,"newClientOpId");ze(this,"debounceMs");ze(this,"emissions",new WeakMap);ze(this,"open",null);ze(this,"debounceHandle",null);ze(this,"queue",[]);ze(this,"sending",!1);ze(this,"_frozen",!1);ze(this,"stack",null);ze(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Te,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 Fr=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"];function xf(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 Sf(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 Gr(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function je(e,t){const o=xf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Cf(e,t){const o=Sf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Rf(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 Yr(e,t){const o=Rf(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 Vf(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Af(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Tf(e,t){const o=Vf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Mf(e,t){const o=Af(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 Wr(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 Kr(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"},g=Yr(i,p);if(!g.ok){r.push(g.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:g.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:g.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 qr(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 Xr(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=Yr(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 Bf(e,t,o={}){const i=o.mkId??Te,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,g;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}}:{}},N={ref:f.spec.name};let y=!1;for(const[P,K]of(f.spec.attributes??[]).entries()){if(K.type==="GroupCodeEnum"&&!K.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:N,handle:{ref:K.name}}),y=!0;continue}const T=l(K.type);if(T){const ie=Kr(K,T,P,_,h,N,s,i);ie?_.attributes.push(ie):y=!0}else(m=K.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:N,handle:{ref:K.name}}),y=!0):_.attributes.push(Wr(K,P,i))}const x=(f.spec.operations??[]).map((P,K)=>qr(P,K,i));x.length&&(_.operations=x);const q=[];for(const P of f.spec.indexes??[]){const K=Xr(_,P,h,N,s,i);K?q.push(K):y=!0}if(q.length&&(_.indexes=q),y)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=je(e,f.entity);if(!b.ok){s.push(Ze(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=je(e,f.entity);if(!b.ok){s.push(Ze(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=je(e,f.entity);if(!b.ok){s.push(Ze(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 N=l(f.spec.type);let y;if(N)y=Kr(f.spec,N,_,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 y=Wr(f.spec,_,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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Cf(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=je(e,f.spec.from),_=je(e,f.spec.to);if(b.ok||s.push(Ze(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(Ze(_.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 N=i(),y={modelId:N,...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}};r.push({kind:"association.add",casUnit:"logical",associationRef:N,value:y});break}case"association.remove":{const b=je(e,f.association.from),_=je(e,f.association.to);if(b.ok||s.push(Ze(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(Ze(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const N=Gr(e,b.value.modelId,_.value.modelId);if(N.length!==1){s.push(N.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:N.map(y=>y.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:N[0].modelId});break}case"association.update":{const b=jr(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=jr(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Xr(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Tf(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((g=b.value.operations)==null?void 0:g.length)??0;d.set(b.value.modelId,_+1);const N=qr(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const b=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Mf(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 x of f.spec.members){const q=je(e,x);if(!q.ok){s.push(Ze(q.reason,h,x,q.matches,u)),_=!0;continue}b.push(q.value.modelId)}if(_)break;const N=i(),y={modelId:N,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:N,value:y});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function Ze(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 jr(e,t,o,i,a){const l=je(e,t.from),r=je(e,t.to);if(l.ok||i.push(Ze(l.reason,o,t.from,l.matches,a)),r.ok||i.push(Ze(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=Gr(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 Zr={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Df={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Of={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},Go={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Lf={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:{...Go,description:"속성 설명(다국어)."},columnLogicalName:{...Go,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},Jr={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Pf={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Jr,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Jr,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},zf={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Zr,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},Uf={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Go,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Hf={type:"object",properties:{name:{...Go,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},Ff={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function Ke(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Gf={"entity.add":Ke("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":Ke("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":Ke("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":Ke("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":Ke("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":Ke("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":Ke("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":Ke("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":Ke("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":Ke("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":Ke("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":Ke("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":Ke("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":Ke("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":Ke("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":Ke("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":Ke("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Qr={anyOf:Fr.map(e=>Gf[e])},Yf={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Zr,assocHandle:Df,entitySpec:Of,attrSpec:Lf,assocSpec:Pf,indexSpec:zf,operationSpec:Uf,groupSpec:Hf,patch:Ff,symbolicOp:Qr}};function Wf(e,t,o,i={}){const a=i.mkClientOpId??Te,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 es={location:{x:0,y:0},size:{width:220,height:140}};function ts(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 Kf=/^[-=_*~\s]{3,}$/;function qf(e){return e.attrType&&e.attrType!=="NORMAL"||!Kf.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Xf(e,t){return e.attrType==="DIVIDER"||qf(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(ts)}}function jf(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 Zf(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 Jf(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(Xf),operations:(t=e.operations)==null?void 0:t.map(jf),indexes:(o=e.indexes)==null?void 0:o.map(Zf),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Qf(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??{...es},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function ns(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 ka(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:ns(e)}}function em(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:ka(e.end1),end2:ka(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 os(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function is(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function as(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 ls(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(ts)}}function tm(e,t,o){var b,_;const i=os(e.end1.attribute),a=os(e.end2.attribute);if(i===a)return em(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((N,y)=>Math.max(N,y.order),-1)+1:s.order??0,h={...ls(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(N,y)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:y?d:h.modelId,legacyNavRaw:y?void 0:N.attribute,jpa:ns(N)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:g}}function nm(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 om(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((g,b)=>Math.max(g,b.order),-1)+1:r.order??0,d={...ls(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>nm(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...ka(g),legacyEmbedRaw:g.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 im(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 rs(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=im(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 am(e){return(e.schemaVersion??1)>=2&&"logical"in e?lm(e):rm(e)}function lm(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 rm(e){var _,N;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,x)=>{o.push(Jf(y));const q=Qf(y);q.geo={location:{x:q.geo.location.x+x.x,y:q.geo.location.y+x.y},size:q.geo.size},i.push(q);for(const P of y.ownedAssociations??[])c.push(P)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const x=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:x.map(P=>P.modelId)});const q=((_=y.geo)==null?void 0:_.location)??u;if(y.geo){const P=(y.notes??[]).map(K=>K.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,memberNoteRefs:P.length?P:void 0})}for(const P of x)d(P,q);for(const P of y.notes??[])f.push(rs(P,q))}const h=new Map(o.map(y=>[y.modelId,y])),m=new Map,p=new Map;for(const y of o)for(const x of y.attributes)for(const q of x.dbAttrs)m.set(q.modelId,x.modelId),p.set(q.modelId,q);for(const y of c)for(const x of[y.end1,y.end2]){const q=x.attribute;if(q&&(((N=q.dbAttrs)==null?void 0:N.length)??0)>0)for(const P of q.dbAttrs)P.modelId&&m.set(P.modelId,q.modelId)}for(const y of c){const x=is(y.end1.attribute),q=is(y.end2.attribute),P=as(y.end1)||as(y.end2),{assoc:K,layout:T}=x!==q||P?om(y,h,p):tm(y,h,m);a.push(K),l.push(T)}const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>rs(y)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:b}}function ss(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 sm(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(ss),style:t}}function cm(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 dm(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 zt(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 um(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{...ss(i),targetModelId:(l=o==null?void 0:o.dbAttrs[a])==null?void 0:l.modelId}})}}function fm(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 mm(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 pm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function hm(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:pm(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 ym(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)=>hm(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:zt(e.end1,c?s:u),end2:zt(e.end2,c?u:s)}}function gm(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:zt(e.end1,e.end1.legacyEmbedRaw),end2:zt(e.end2,e.end2.legacyEmbedRaw)};const a=ym(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?um(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:zt(e.end1,l?m:h),end2:zt(e.end2,r?m:h)}}return{...i,end1:zt(e.end1),end2:zt(e.end2)}}function cs(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)??{...es},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 sm(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 cm(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>gm(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(dm),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed}}function bm(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=>ds(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>cs(c,t,o,i,r)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style}}function ds(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 _m(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=fm(e),l=mm(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=>cs(s,e,a,l)),groups:e.logical.groups.map(s=>bm(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>ds(s))}}function wm(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 Jn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function St(e){return typeof e=="function"?e():n.unref(e)}const vm=typeof window<"u"&&typeof document<"u",Em=e=>typeof e<"u",km=Object.prototype.toString,Nm=e=>km.call(e)==="[object Object]",Im=()=>{};function $m(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 us=e=>e();function xm(e=us){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 fs(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Sm(e,t,o={}){const{eventFilter:i=us,...a}=o;return n.watch(e,$m(i,t),a)}function In(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=xm(i);return{stop:Sm(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Cm(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=St(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 Na(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:g}={}){let b=null;const N=[new Promise(y=>{b=n.watch(e,x=>{f(x)!==t&&(b==null||b(),y(x))},{flush:h,deep:m,immediate:!0})})];return p!=null&&N.push(fs(p,g).then(()=>St(e)).finally(()=>b==null?void 0:b())),Promise.race(N)}function i(f,h){if(!n.isRef(f))return o(x=>x===f,h);const{flush:m="sync",deep:p=!1,timeout:g,throwOnTimeout:b}=h??{};let _=null;const y=[new Promise(x=>{_=n.watch([e,f],([q,P])=>{t!==(q===P)&&(_==null||_(),x(q))},{flush:m,deep:p,immediate:!0})})];return g!=null&&y.push(fs(g,b).then(()=>St(e)).finally(()=>(_==null||_(),St(e)))),Promise.race(y)}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(St(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(St(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Na(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return Na(e,!t)}}}function Ia(e){return Na(e)}function Rm(e){var t;const o=St(e);return(t=o==null?void 0:o.$el)!=null?t:o}const ms=vm?window:void 0;function ps(...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 Im;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(()=>[Rm(t),St(a)],([u,f])=>{if(r(),!u)return;const h=Nm(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Jn(d),d}function Vm(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function hs(...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=Vm(t);return ps(a,l,u=>{u.repeat&&St(s)||c(u)&&o(u)},r)}function Am(e){return JSON.parse(JSON.stringify(e))}function $a(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 g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const b=y=>s?typeof s=="function"?s(y):Am(y):y,_=()=>Em(e[t])?b(e[t]):f,N=y=>{h?h(y)&&p(g,y):p(g,y)};if(c){const y=_(),x=n.ref(y);let q=!1;return n.watch(()=>e[t],P=>{q||(q=!0,x.value=b(P),n.nextTick(()=>q=!1))}),n.watch(x,P=>{!q&&(P!==e[t]||u)&&N(P)},{deep:u}),x}else return n.computed({get(){return _()},set(y){N(y)}})}var Tm={value:()=>{}};function Yo(){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 Wo(o)}function Wo(e){this._=e}function Mm(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}})}Wo.prototype=Yo.prototype={constructor:Wo,on:function(e,t){var o=this._,i=Mm(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Bm(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]=ys(o[a],e.name,t);else if(t==null)for(a in o)o[a]=ys(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 Wo(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 Bm(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function ys(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Tm,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var xa="http://www.w3.org/1999/xhtml";const gs={svg:"http://www.w3.org/2000/svg",xhtml:xa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ko(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),gs.hasOwnProperty(t)?{space:gs[t],local:e}:e}function Dm(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===xa&&t.documentElement.namespaceURI===xa?t.createElement(e):t.createElementNS(o,e)}}function Om(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bs(e){var t=Ko(e);return(t.local?Om:Dm)(t)}function Lm(){}function Sa(e){return e==null?Lm:function(){return this.querySelector(e)}}function Pm(e){typeof e!="function"&&(e=Sa(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 at(i,this._parents)}function zm(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Um(){return[]}function _s(e){return e==null?Um:function(){return this.querySelectorAll(e)}}function Hm(e){return function(){return zm(e.apply(this,arguments))}}function Fm(e){typeof e=="function"?e=Hm(e):e=_s(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 at(i,a)}function ws(e){return function(){return this.matches(e)}}function vs(e){return function(t){return t.matches(e)}}var Gm=Array.prototype.find;function Ym(e){return function(){return Gm.call(this.children,e)}}function Wm(){return this.firstElementChild}function Km(e){return this.select(e==null?Wm:Ym(typeof e=="function"?e:vs(e)))}var qm=Array.prototype.filter;function Xm(){return Array.from(this.children)}function jm(e){return function(){return qm.call(this.children,e)}}function Zm(e){return this.selectAll(e==null?Xm:jm(typeof e=="function"?e:vs(e)))}function Jm(e){typeof e!="function"&&(e=ws(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)}function Es(e){return new Array(e.length)}function Qm(){return new at(this._enter||this._groups.map(Es),this._parents)}function qo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qo.prototype={constructor:qo,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 ep(e){return function(){return e}}function tp(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 qo(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function np(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 qo(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function op(e){return e.__data__}function ip(e,t){if(!arguments.length)return Array.from(this,op);var o=t?np:tp,i=this._parents,a=this._groups;typeof e!="function"&&(e=ep(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=ap(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var N=0,y=0,x,q;N<p;++N)if(x=g[N]){for(N>=y&&(y=N+1);!(q=b[y])&&++y<p;);x._next=q||null}}return r=new at(r,i),r._enter=s,r._exit=c,r}function ap(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lp(){return new at(this._exit||this._groups.map(Es),this._parents)}function rp(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 sp(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 at(s,this._parents)}function cp(){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 dp(e){e||(e=up);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 at(a,this._parents).order()}function up(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mp(){return Array.from(this)}function pp(){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 hp(){let e=0;for(const t of this)++e;return e}function yp(){return!this.node()}function gp(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 bp(e){return function(){this.removeAttribute(e)}}function _p(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wp(e,t){return function(){this.setAttribute(e,t)}}function vp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ep(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function kp(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 Np(e,t){var o=Ko(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?_p:bp:typeof t=="function"?o.local?kp:Ep:o.local?vp:wp)(o,t))}function ks(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ip(e){return function(){this.style.removeProperty(e)}}function $p(e,t,o){return function(){this.style.setProperty(e,t,o)}}function xp(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Sp(e,t,o){return arguments.length>1?this.each((t==null?Ip:typeof t=="function"?xp:$p)(e,t,o??"")):$n(this.node(),e)}function $n(e,t){return e.style.getPropertyValue(t)||ks(e).getComputedStyle(e,null).getPropertyValue(t)}function Cp(e){return function(){delete this[e]}}function Rp(e,t){return function(){this[e]=t}}function Vp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ap(e,t){return arguments.length>1?this.each((t==null?Cp:typeof t=="function"?Vp:Rp)(e,t)):this.node()[e]}function Ns(e){return e.trim().split(/^|\s+/)}function Ca(e){return e.classList||new Is(e)}function Is(e){this._node=e,this._names=Ns(e.getAttribute("class")||"")}Is.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 $s(e,t){for(var o=Ca(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function xs(e,t){for(var o=Ca(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Tp(e){return function(){$s(this,e)}}function Mp(e){return function(){xs(this,e)}}function Bp(e,t){return function(){(t.apply(this,arguments)?$s:xs)(this,e)}}function Dp(e,t){var o=Ns(e+"");if(arguments.length<2){for(var i=Ca(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Bp:t?Tp:Mp)(o,t))}function Op(){this.textContent=""}function Lp(e){return function(){this.textContent=e}}function Pp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zp(e){return arguments.length?this.each(e==null?Op:(typeof e=="function"?Pp:Lp)(e)):this.node().textContent}function Up(){this.innerHTML=""}function Hp(e){return function(){this.innerHTML=e}}function Fp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gp(e){return arguments.length?this.each(e==null?Up:(typeof e=="function"?Fp:Hp)(e)):this.node().innerHTML}function Yp(){this.nextSibling&&this.parentNode.appendChild(this)}function Wp(){return this.each(Yp)}function Kp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qp(){return this.each(Kp)}function Xp(e){var t=typeof e=="function"?e:bs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jp(){return null}function Zp(e,t){var o=typeof e=="function"?e:bs(e),i=t==null?jp:typeof t=="function"?t:Sa(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Jp(){var e=this.parentNode;e&&e.removeChild(this)}function Qp(){return this.each(Jp)}function eh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function th(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nh(e){return this.select(e?th:eh)}function oh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ih(e){return function(t){e.call(this,t,this.__data__)}}function ah(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 lh(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 rh(e,t,o){return function(){var i=this.__on,a,l=ih(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 sh(e,t,o){var i=ah(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?rh:lh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Ss(e,t,o){var i=ks(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 ch(e,t){return function(){return Ss(this,e,t)}}function dh(e,t){return function(){return Ss(this,e,t.apply(this,arguments))}}function uh(e,t){return this.each((typeof t=="function"?dh:ch)(e,t))}function*fh(){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 Cs=[null];function at(e,t){this._groups=e,this._parents=t}function Qn(){return new at([[document.documentElement]],Cs)}function mh(){return this}at.prototype=Qn.prototype={constructor:at,select:Pm,selectAll:Fm,selectChild:Km,selectChildren:Zm,filter:Jm,data:ip,enter:Qm,exit:lp,join:rp,merge:sp,selection:mh,order:cp,sort:dp,call:fp,nodes:mp,node:pp,size:hp,empty:yp,each:gp,attr:Np,style:Sp,property:Ap,classed:Dp,text:zp,html:Gp,raise:Wp,lower:qp,append:Xp,insert:Zp,remove:Qp,clone:nh,datum:oh,on:sh,dispatch:uh,[Symbol.iterator]:fh};function ct(e){return typeof e=="string"?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],Cs)}function ph(e){let t;for(;t=e.sourceEvent;)e=t;return e}function yt(e,t){if(e=ph(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 hh={passive:!1},eo={capture:!0,passive:!1};function Ra(e){e.stopImmediatePropagation()}function xn(e){e.preventDefault(),e.stopImmediatePropagation()}function Rs(e){var t=e.document.documentElement,o=ct(e).on("dragstart.drag",xn,eo);"onselectstart"in t?o.on("selectstart.drag",xn,eo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Vs(e,t){var o=e.document.documentElement,i=ct(e).on("dragstart.drag",null);t&&(i.on("click.drag",xn,eo),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 Xo=e=>()=>e;function Va(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}})}Va.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yh(e){return!e.ctrlKey&&!e.button}function gh(){return this.parentNode}function bh(e,t){return t??{x:e.x,y:e.y}}function _h(){return navigator.maxTouchPoints||"ontouchstart"in this}function wh(){var e=yh,t=gh,o=bh,i=_h,a={},l=Yo("start","drag","end"),r=0,s,c,d,u,f=0;function h(x){x.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,hh).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,q){if(!(u||!e.call(this,x,q))){var P=y(this,t.call(this,x,q),x,q,"mouse");P&&(ct(x.view).on("mousemove.drag",p,eo).on("mouseup.drag",g,eo),Rs(x.view),Ra(x),d=!1,s=x.clientX,c=x.clientY,P("start",x))}}function p(x){if(xn(x),!d){var q=x.clientX-s,P=x.clientY-c;d=q*q+P*P>f}a.mouse("drag",x)}function g(x){ct(x.view).on("mousemove.drag mouseup.drag",null),Vs(x.view,d),xn(x),a.mouse("end",x)}function b(x,q){if(e.call(this,x,q)){var P=x.changedTouches,K=t.call(this,x,q),T=P.length,ie,te;for(ie=0;ie<T;++ie)(te=y(this,K,x,q,P[ie].identifier,P[ie]))&&(Ra(x),te("start",x,P[ie]))}}function _(x){var q=x.changedTouches,P=q.length,K,T;for(K=0;K<P;++K)(T=a[q[K].identifier])&&(xn(x),T("drag",x,q[K]))}function N(x){var q=x.changedTouches,P=q.length,K,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),K=0;K<P;++K)(T=a[q[K].identifier])&&(Ra(x),T("end",x,q[K]))}function y(x,q,P,K,T,ie){var te=l.copy(),fe=yt(ie||P,q),M,ne,E;if((E=o.call(x,new Va("beforestart",{sourceEvent:P,target:h,identifier:T,active:r,x:fe[0],y:fe[1],dx:0,dy:0,dispatch:te}),K))!=null)return M=E.x-fe[0]||0,ne=E.y-fe[1]||0,function S(I,B,G){var X=fe,A;switch(I){case"start":a[T]=S,A=r++;break;case"end":delete a[T],--r;case"drag":fe=yt(G||B,q),A=r;break}te.call(I,x,new Va(I,{sourceEvent:B,subject:E,target:h,identifier:T,active:A,x:fe[0]+M,y:fe[1]+ne,dx:fe[0]-X[0],dy:fe[1]-X[1],dispatch:te}),K)}}return h.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Xo(!!x),h):e},h.container=function(x){return arguments.length?(t=typeof x=="function"?x:Xo(x),h):t},h.subject=function(x){return arguments.length?(o=typeof x=="function"?x:Xo(x),h):o},h.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:Xo(!!x),h):i},h.on=function(){var x=l.on.apply(l,arguments);return x===l?h:x},h.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,h):Math.sqrt(f)},h}function Aa(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function As(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function to(){}var no=.7,jo=1/no,Sn="\\s*([+-]?\\d+)\\s*",oo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vh=/^#([0-9a-f]{3,8})$/,Eh=new RegExp(`^rgb\\(${Sn},${Sn},${Sn}\\)$`),kh=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),Nh=new RegExp(`^rgba\\(${Sn},${Sn},${Sn},${oo}\\)$`),Ih=new RegExp(`^rgba\\(${gt},${gt},${gt},${oo}\\)$`),$h=new RegExp(`^hsl\\(${oo},${gt},${gt}\\)$`),xh=new RegExp(`^hsla\\(${oo},${gt},${gt},${oo}\\)$`),Ts={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};Aa(to,on,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ms,formatHex:Ms,formatHex8:Sh,formatHsl:Ch,formatRgb:Bs,toString:Bs});function Ms(){return this.rgb().formatHex()}function Sh(){return this.rgb().formatHex8()}function Ch(){return zs(this).formatHsl()}function Bs(){return this.rgb().formatRgb()}function on(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=vh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ds(t):o===3?new et(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Zo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Zo(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=Eh.exec(e))?new et(t[1],t[2],t[3],1):(t=kh.exec(e))?new et(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nh.exec(e))?Zo(t[1],t[2],t[3],t[4]):(t=Ih.exec(e))?Zo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$h.exec(e))?Ps(t[1],t[2]/100,t[3]/100,1):(t=xh.exec(e))?Ps(t[1],t[2]/100,t[3]/100,t[4]):Ts.hasOwnProperty(e)?Ds(Ts[e]):e==="transparent"?new et(NaN,NaN,NaN,0):null}function Ds(e){return new et(e>>16&255,e>>8&255,e&255,1)}function Zo(e,t,o,i){return i<=0&&(e=t=o=NaN),new et(e,t,o,i)}function Rh(e){return e instanceof to||(e=on(e)),e?(e=e.rgb(),new et(e.r,e.g,e.b,e.opacity)):new et}function Ta(e,t,o,i){return arguments.length===1?Rh(e):new et(e,t,o,i??1)}function et(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Aa(et,Ta,As(to,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new et(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?no:Math.pow(no,e),new et(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new et(an(this.r),an(this.g),an(this.b),Jo(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:Os,formatHex:Os,formatHex8:Vh,formatRgb:Ls,toString:Ls}));function Os(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}`}function Vh(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}${ln((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ls(){const e=Jo(this.opacity);return`${e===1?"rgb(":"rgba("}${an(this.r)}, ${an(this.g)}, ${an(this.b)}${e===1?")":`, ${e})`}`}function Jo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function an(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ln(e){return e=an(e),(e<16?"0":"")+e.toString(16)}function Ps(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new dt(e,t,o,i)}function zs(e){if(e instanceof dt)return new dt(e.h,e.s,e.l,e.opacity);if(e instanceof to||(e=on(e)),!e)return new dt;if(e instanceof dt)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 dt(r,s,c,e.opacity)}function Ah(e,t,o,i){return arguments.length===1?zs(e):new dt(e,t,o,i??1)}function dt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Aa(dt,Ah,As(to,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?no:Math.pow(no,e),new dt(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 et(Ma(e>=240?e-240:e+120,a,i),Ma(e,a,i),Ma(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new dt(Us(this.h),Qo(this.s),Qo(this.l),Jo(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=Jo(this.opacity);return`${e===1?"hsl(":"hsla("}${Us(this.h)}, ${Qo(this.s)*100}%, ${Qo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Us(e){return e=(e||0)%360,e<0?e+360:e}function Qo(e){return Math.max(0,Math.min(1,e||0))}function Ma(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 Ba=e=>()=>e;function Th(e,t){return function(o){return e+o*t}}function Mh(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 Bh(e){return(e=+e)==1?Hs:function(t,o){return o-t?Mh(t,o,e):Ba(isNaN(t)?o:t)}}function Hs(e,t){var o=t-e;return o?Th(e,o):Ba(isNaN(e)?t:e)}const ei=(function e(t){var o=Bh(t);function i(a,l){var r=o((a=Ta(a)).r,(l=Ta(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=Hs(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 Dh(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 Oh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Lh(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]=io(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 Ph(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function bt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function zh(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]=io(e[a],t[a]):i[a]=t[a];return function(l){for(a in o)i[a]=o[a](l);return i}}var Da=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Oa=new RegExp(Da.source,"g");function Uh(e){return function(){return e}}function Hh(e){return function(t){return e(t)+""}}function Fs(e,t){var o=Da.lastIndex=Oa.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Da.exec(e))&&(a=Oa.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:bt(i,a)})),o=Oa.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?Hh(c[0].x):Uh(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 io(e,t){var o=typeof t,i;return t==null||o==="boolean"?Ba(t):(o==="number"?bt:o==="string"?(i=on(t))?(t=i,ei):Fs:t instanceof on?ei:t instanceof Date?Ph:Oh(t)?Dh:Array.isArray(t)?Lh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zh:bt)(e,t)}var Gs=180/Math.PI,La={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ys(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)*Gs,skewX:Math.atan(c)*Gs,scaleX:r,scaleY:s}}var ti;function Fh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?La:Ys(t.a,t.b,t.c,t.d,t.e,t.f)}function Gh(e){return e==null||(ti||(ti=document.createElementNS("http://www.w3.org/2000/svg","g")),ti.setAttribute("transform",e),!(e=ti.transform.baseVal.consolidate()))?La:(e=e.matrix,Ys(e.a,e.b,e.c,e.d,e.e,e.f))}function Ws(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 g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:bt(d,f)},{i:g-2,x:bt(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:bt(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:bt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:bt(d,f)},{i:g-2,x:bt(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,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Yh=Ws(Fh,"px, ","px)","deg)"),Wh=Ws(Gh,", ",")",")"),Kh=1e-12;function Ks(e){return((e=Math.exp(e))+1/e)/2}function qh(e){return((e=Math.exp(e))-1/e)/2}function Xh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ni=(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,g=m*m+p*p,b,_;if(g<Kh)_=Math.log(h/d)/t,b=function(K){return[s+K*m,c+K*p,d*Math.exp(t*K*_)]};else{var N=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*N),x=(h*h-d*d-i*g)/(2*h*o*N),q=Math.log(Math.sqrt(y*y+1)-y),P=Math.log(Math.sqrt(x*x+1)-x);_=(P-q)/t,b=function(K){var T=K*_,ie=Ks(q),te=d/(o*N)*(ie*Xh(t*T+q)-qh(q));return[s+te*m,c+te*p,d*ie/Ks(t*T+q)]}}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 Cn=0,ao=0,lo=0,qs=1e3,oi,ro,ii=0,rn=0,ai=0,so=typeof performance=="object"&&performance.now?performance:Date,Xs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pa(){return rn||(Xs(jh),rn=so.now()+ai)}function jh(){rn=0}function li(){this._call=this._time=this._next=null}li.prototype=js.prototype={constructor:li,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Pa():+o)+(t==null?0:+t),!this._next&&ro!==this&&(ro?ro._next=this:oi=this,ro=this),this._call=e,this._time=o,za()},stop:function(){this._call&&(this._call=null,this._time=1/0,za())}};function js(e,t,o){var i=new li;return i.restart(e,t,o),i}function Zh(){Pa(),++Cn;for(var e=oi,t;e;)(t=rn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Cn}function Zs(){rn=(ii=so.now())+ai,Cn=ao=0;try{Zh()}finally{Cn=0,Qh(),rn=0}}function Jh(){var e=so.now(),t=e-ii;t>qs&&(ai-=t,ii=e)}function Qh(){for(var e,t=oi,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:oi=o);ro=e,za(i)}function za(e){if(!Cn){ao&&(ao=clearTimeout(ao));var t=e-rn;t>24?(e<1/0&&(ao=setTimeout(Zs,e-so.now()-ai)),lo&&(lo=clearInterval(lo))):(lo||(ii=so.now(),lo=setInterval(Jh,qs)),Cn=1,Xs(Zs))}}function Js(e,t,o){var i=new li;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var ey=Yo("start","end","cancel","interrupt"),ty=[],Qs=0,ec=1,Ua=2,ri=3,tc=4,Ha=5,si=6;function ci(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;ny(e,o,{name:t,index:i,group:a,on:ey,tween:ty,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Qs})}function Fa(e,t){var o=ut(e,t);if(o.state>Qs)throw new Error("too late; already scheduled");return o}function _t(e,t){var o=ut(e,t);if(o.state>ri)throw new Error("too late; already running");return o}function ut(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function ny(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=js(l,0,o.time);function l(d){o.state=ec,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!==ec)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ri)return Js(r);m.state===tc?(m.state=si,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=si,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Js(function(){o.state===ri&&(o.state=tc,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ua,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ua){for(o.state=ri,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=Ha,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Ha&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=si,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function di(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>Ua&&i.state<Ha,i.state=si,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function oy(e){return this.each(function(){di(this,e)})}function iy(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 ay(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 ly(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ut(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?iy:ay)(o,e,t))}function Ga(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 ut(a,i).value[t]}}function nc(e,t){var o;return(typeof t=="number"?bt:t instanceof on?ei:(o=on(t))?(t=o,ei):Fs)(e,t)}function ry(e){return function(){this.removeAttribute(e)}}function sy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cy(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 dy(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 uy(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 fy(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 my(e,t){var o=Ko(e),i=o==="transform"?Wh:nc;return this.attrTween(e,typeof t=="function"?(o.local?fy:uy)(o,i,Ga(this,"attr."+e,t)):t==null?(o.local?sy:ry)(o):(o.local?dy:cy)(o,i,t))}function py(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function hy(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function yy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&hy(e,l)),o}return a._value=t,a}function gy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&py(e,l)),o}return a._value=t,a}function by(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=Ko(e);return this.tween(o,(i.local?yy:gy)(i,t))}function _y(e,t){return function(){Fa(this,e).delay=+t.apply(this,arguments)}}function wy(e,t){return t=+t,function(){Fa(this,e).delay=t}}function vy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_y:wy)(t,e)):ut(this.node(),t).delay}function Ey(e,t){return function(){_t(this,e).duration=+t.apply(this,arguments)}}function ky(e,t){return t=+t,function(){_t(this,e).duration=t}}function Ny(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ey:ky)(t,e)):ut(this.node(),t).duration}function Iy(e,t){if(typeof t!="function")throw new Error;return function(){_t(this,e).ease=t}}function $y(e){var t=this._id;return arguments.length?this.each(Iy(t,e)):ut(this.node(),t).ease}function xy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;_t(this,e).ease=o}}function Sy(e){if(typeof e!="function")throw new Error;return this.each(xy(this._id,e))}function Cy(e){typeof e!="function"&&(e=ws(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,this._name,this._id)}function Ry(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 Ct(r,this._parents,this._name,this._id)}function Vy(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 Ay(e,t,o){var i,a,l=Vy(t)?Fa:_t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Ty(e,t){var o=this._id;return arguments.length<2?ut(this.node(),o).on.on(e):this.each(Ay(o,e,t))}function My(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function By(){return this.on("end.remove",My(this._id))}function Dy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Sa(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,ci(d[h],t,o,h,d,ut(u,o)));return new Ct(l,this._parents,t,o)}function Oy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=_s(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=ut(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&ci(m,t,o,g,h,p);l.push(h),r.push(u)}return new Ct(l,r,t,o)}var Ly=Qn.prototype.constructor;function Py(){return new Ly(this._groups,this._parents)}function zy(e,t){var o,i,a;return function(){var l=$n(this,e),r=(this.style.removeProperty(e),$n(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function oc(e){return function(){this.style.removeProperty(e)}}function Uy(e,t,o){var i,a=o+"",l;return function(){var r=$n(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Hy(e,t,o){var i,a,l;return function(){var r=$n(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),$n(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Fy(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=oc(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Gy(e,t,o){var i=(e+="")=="transform"?Yh:nc;return t==null?this.styleTween(e,zy(e,i)).on("end.style."+e,oc(e)):typeof t=="function"?this.styleTween(e,Hy(e,i,Ga(this,"style."+e,t))).each(Fy(this._id,e)):this.styleTween(e,Uy(e,i,t),o).on("end.style."+e,null)}function Yy(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Wy(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Yy(e,r,o)),i}return l._value=t,l}function Ky(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,Wy(e,t,o??""))}function qy(e){return function(){this.textContent=e}}function Xy(e){return function(){var t=e(this);this.textContent=t??""}}function jy(e){return this.tween("text",typeof e=="function"?Xy(Ga(this,"text",e)):qy(e==null?"":e+""))}function Zy(e){return function(t){this.textContent=e.call(this,t)}}function Jy(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Zy(a)),t}return i._value=e,i}function Qy(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,Jy(e))}function eg(){for(var e=this._name,t=this._id,o=ic(),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=ut(c,t);ci(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ct(i,this._parents,e,o)}function tg(){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 ng=0;function Ct(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ic(){return++ng}var Rt=Qn.prototype;Ct.prototype={constructor:Ct,select:Dy,selectAll:Oy,selectChild:Rt.selectChild,selectChildren:Rt.selectChildren,filter:Cy,merge:Ry,selection:Py,transition:eg,call:Rt.call,nodes:Rt.nodes,node:Rt.node,size:Rt.size,empty:Rt.empty,each:Rt.each,on:Ty,attr:my,attrTween:by,style:Gy,styleTween:Ky,text:jy,textTween:Qy,remove:By,tween:ly,delay:vy,duration:Ny,ease:$y,easeVarying:Sy,end:tg,[Symbol.iterator]:Rt[Symbol.iterator]};function og(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ig={time:null,delay:0,duration:250,ease:og};function ag(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 lg(e){var t,o;e instanceof Ct?(t=e._id,e=e._name):(t=ic(),(o=ig).time=Pa(),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])&&ci(c,e,t,d,r,o||ag(c,t));return new Ct(i,this._parents,e,t)}Qn.prototype.interrupt=oy,Qn.prototype.transition=lg;const ui=e=>()=>e;function rg(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 Vt(e,t,o){this.k=e,this.x=t,this.y=o}Vt.prototype={constructor:Vt,scale:function(e){return e===1?this:new Vt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vt(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 Rn=new Vt(1,0,0);Vt.prototype;function Ya(e){e.stopImmediatePropagation()}function co(e){e.preventDefault(),e.stopImmediatePropagation()}function sg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cg(){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 ac(){return this.__zoom||Rn}function dg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ug(){return navigator.maxTouchPoints||"ontouchstart"in this}function fg(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 mg(){var e=sg,t=cg,o=fg,i=dg,a=ug,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ni,d=Yo("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(E){E.property("__zoom",ac).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ie).on("dblclick.zoom",te).filter(a).on("touchstart.zoom",fe).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",ne).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,S,I,B){var G=E.selection?E.selection():E;G.property("__zoom",ac),E!==G?q(E,S,I,B):G.interrupt().each(function(){P(this,arguments).event(B).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},_.scaleBy=function(E,S,I,B){_.scaleTo(E,function(){var G=this.__zoom.k,X=typeof S=="function"?S.apply(this,arguments):S;return G*X},I,B)},_.scaleTo=function(E,S,I,B){_.transform(E,function(){var G=t.apply(this,arguments),X=this.__zoom,A=I==null?x(G):typeof I=="function"?I.apply(this,arguments):I,ae=X.invert(A),se=typeof S=="function"?S.apply(this,arguments):S;return o(y(N(X,se),A,ae),G,r)},I,B)},_.translateBy=function(E,S,I,B){_.transform(E,function(){return o(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),r)},null,B)},_.translateTo=function(E,S,I,B,G){_.transform(E,function(){var X=t.apply(this,arguments),A=this.__zoom,ae=B==null?x(X):typeof B=="function"?B.apply(this,arguments):B;return o(Rn.translate(ae[0],ae[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof I=="function"?-I.apply(this,arguments):-I),X,r)},B,G)};function N(E,S){return S=Math.max(l[0],Math.min(l[1],S)),S===E.k?E:new Vt(S,E.x,E.y)}function y(E,S,I){var B=S[0]-I[0]*E.k,G=S[1]-I[1]*E.k;return B===E.x&&G===E.y?E:new Vt(E.k,B,G)}function x(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function q(E,S,I,B){E.on("start.zoom",function(){P(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(B).end()}).tween("zoom",function(){var G=this,X=arguments,A=P(G,X).event(B),ae=t.apply(G,X),se=I==null?x(ae):typeof I=="function"?I.apply(G,X):I,ge=Math.max(ae[1][0]-ae[0][0],ae[1][1]-ae[0][1]),_e=G.__zoom,re=typeof S=="function"?S.apply(G,X):S,ye=c(_e.invert(se).concat(ge/_e.k),re.invert(se).concat(ge/re.k));return function(be){if(be===1)be=re;else{var $e=ye(be),Se=ge/$e[2];be=new Vt(Se,se[0]-$e[0]*Se,se[1]-$e[1]*Se)}A.zoom(null,be)}})}function P(E,S,I){return!I&&E.__zooming||new K(E,S)}function K(E,S){this.that=E,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,S),this.taps=0}K.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,S){return this.mouse&&E!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var S=ct(this.that).datum();d.call(E,this.that,new rg(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),S)}};function T(E,...S){if(!e.apply(this,arguments))return;var I=P(this,S).event(E),B=this.__zoom,G=Math.max(l[0],Math.min(l[1],B.k*Math.pow(2,i.apply(this,arguments)))),X=yt(E);if(I.wheel)(I.mouse[0][0]!==X[0]||I.mouse[0][1]!==X[1])&&(I.mouse[1]=B.invert(I.mouse[0]=X)),clearTimeout(I.wheel);else{if(B.k===G)return;I.mouse=[X,B.invert(X)],di(this),I.start()}co(E),I.wheel=setTimeout(A,p),I.zoom("mouse",o(y(N(B,G),I.mouse[0],I.mouse[1]),I.extent,r));function A(){I.wheel=null,I.end()}}function ie(E,...S){if(h||!e.apply(this,arguments))return;var I=E.currentTarget,B=P(this,S,!0).event(E),G=ct(E.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",ge,!0),X=yt(E,I),A=E.clientX,ae=E.clientY;Rs(E.view),Ya(E),B.mouse=[X,this.__zoom.invert(X)],di(this),B.start();function se(_e){if(co(_e),!B.moved){var re=_e.clientX-A,ye=_e.clientY-ae;B.moved=re*re+ye*ye>g}B.event(_e).zoom("mouse",o(y(B.that.__zoom,B.mouse[0]=yt(_e,I),B.mouse[1]),B.extent,r))}function ge(_e){G.on("mousemove.zoom mouseup.zoom",null),Vs(_e.view,B.moved),co(_e),B.event(_e).end()}}function te(E,...S){if(e.apply(this,arguments)){var I=this.__zoom,B=yt(E.changedTouches?E.changedTouches[0]:E,this),G=I.invert(B),X=I.k*(E.shiftKey?.5:2),A=o(y(N(I,X),B,G),t.apply(this,S),r);co(E),s>0?ct(this).transition().duration(s).call(q,A,B,E):ct(this).call(_.transform,A,B,E)}}function fe(E,...S){if(e.apply(this,arguments)){var I=E.touches,B=I.length,G=P(this,S,E.changedTouches.length===B).event(E),X,A,ae,se;for(Ya(E),A=0;A<B;++A)ae=I[A],se=yt(ae,this),se=[se,this.__zoom.invert(se),ae.identifier],G.touch0?!G.touch1&&G.touch0[2]!==se[2]&&(G.touch1=se,G.taps=0):(G.touch0=se,X=!0,G.taps=1+!!u);u&&(u=clearTimeout(u)),X&&(G.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),di(this),G.start())}}function M(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A,ae,se;for(co(E),X=0;X<G;++X)A=B[X],ae=yt(A,this),I.touch0&&I.touch0[2]===A.identifier?I.touch0[0]=ae:I.touch1&&I.touch1[2]===A.identifier&&(I.touch1[0]=ae);if(A=I.that.__zoom,I.touch1){var ge=I.touch0[0],_e=I.touch0[1],re=I.touch1[0],ye=I.touch1[1],be=(be=re[0]-ge[0])*be+(be=re[1]-ge[1])*be,$e=($e=ye[0]-_e[0])*$e+($e=ye[1]-_e[1])*$e;A=N(A,Math.sqrt(be/$e)),ae=[(ge[0]+re[0])/2,(ge[1]+re[1])/2],se=[(_e[0]+ye[0])/2,(_e[1]+ye[1])/2]}else if(I.touch0)ae=I.touch0[0],se=I.touch0[1];else return;I.zoom("touch",o(y(A,ae,se),I.extent,r))}}function ne(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A;for(Ya(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),X=0;X<G;++X)A=B[X],I.touch0&&I.touch0[2]===A.identifier?delete I.touch0:I.touch1&&I.touch1[2]===A.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(A=yt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<b)){var ae=ct(this).on("dblclick.zoom");ae&&ae.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:ui(+E),_):i},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ui(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:ui(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:ui([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(l[0]=+E[0],l[1]=+E[1],_):[l[0],l[1]]},_.translateExtent=function(E){return arguments.length?(r[0][0]=+E[0][0],r[1][0]=+E[1][0],r[0][1]=+E[0][1],r[1][1]=+E[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(E){return arguments.length?(o=E,_):o},_.duration=function(E){return arguments.length?(s=+E,_):s},_.interpolate=function(E){return arguments.length?(c=E,_):c},_.on=function(){var E=d.on.apply(d,arguments);return E===d?_:E},_.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,_):Math.sqrt(g)},_.tapDistance=function(E){return arguments.length?(b=+E,_):b},_}var Ie=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ie||{}),Wa=(e=>(e.Partial="partial",e.Full="full",e))(Wa||{}),sn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(sn||{}),At=(e=>(e.Strict="strict",e.Loose="loose",e))(At||{}),Ka=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ka||{}),uo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(uo||{}),lc=(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))(lc||{});const pg=["INPUT","SELECT","TEXTAREA"],hg=typeof document<"u"?document:null;function qa(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 pg.includes(i==null?void 0:i.nodeName)||a||!!l}function yg(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function rc(e,t,o,i){const a=t.replace("+",`
1
+ (function(Ee,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],n):(Ee=typeof globalThis<"u"?globalThis:Ee||self,n(Ee.EntityModeler={},Ee.Vue,Ee.OpenBlueseaCore))})(this,(function(Ee,n,le){"use strict";var qx=Object.defineProperty;var Xx=(Ee,n,le)=>n in Ee?qx(Ee,n,{enumerable:!0,configurable:!0,writable:!0,value:le}):Ee[n]=le;var ze=(Ee,n,le)=>Xx(Ee,typeof n!="symbol"?n+"":n,le);const Mu={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Bu(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 zl(e,t,o={}){const i={...Mu,...o},a=new Map(e.entities.map(y=>[y.modelId,y])),l=new Map(e.associations.map(y=>[y.modelId,y])),r=new Map(t.entityLayouts.map(y=>[y.entityRef,y])),s=new Map(t.associationLayouts.map(y=>[y.associationRef,y])),c=t.entityLayouts.map(y=>y.entityRef).filter(y=>!a.has(y)),d=t.associationLayouts.map(y=>y.associationRef).filter(y=>!l.has(y)),u=new Map;for(const y of e.groups)for(const x of y.memberEntityRefs)u.set(x,y.modelId);const f=new Map;for(const y of t.groupLayouts)for(const x of y.memberNoteRefs??[])f.set(x,y.groupRef);let h=0;const m=e.entities.map(y=>{const x=u.get(y.modelId),q=r.get(y.modelId);if(q){const K={location:{x:q.geo.location.x,y:q.geo.location.y},size:{width:q.geo.size.width,height:q.geo.size.height}};return{entity:y,geo:K,collapsed:q.collapsed??!1,groupRef:x,style:q.style,attributeStyles:q.attributeStyles,operationStyles:q.operationStyles}}const P=Bu(h++,i);return{entity:y,geo:P,collapsed:!1,groupRef:x}}),p=new Map(t.groupLayouts.map(y=>[y.groupRef,y])),g=e.groups.map(y=>{const x=p.get(y.modelId),q=x?{location:{x:x.geo.location.x,y:x.geo.location.y},size:{width:x.geo.size.width,height:x.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:y,geo:q,style:x==null?void 0:x.style}}),b=e.associations.map(y=>{const x=s.get(y.modelId);return{association:y,waypoints:(x==null?void 0:x.waypoints)??[],sourceColumnRef:x==null?void 0:x.sourceColumnRef,targetColumnRef:x==null?void 0:x.targetColumnRef}}),_=t.notes.map(y=>({note:{...y,geo:{location:{x:y.geo.location.x,y:y.geo.location.y},size:{width:y.geo.size.width,height:y.geo.size.height}}},groupRef:f.get(y.modelId)})),N=[];for(const y of t.notes)for(const x of y.connections??[])a.has(x.targetRef)&&N.push({noteRef:y.modelId,targetRef:x.targetRef,waypoints:x.waypoints.map(q=>({x:q.x,y:q.y}))});return{entities:m,associations:b,groups:g,notes:_,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function Yn(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const vn=.5;function Ul(e,t,o,i,a,l){const r=Yn(t),s=Yn(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)>=vn||Math.abs(b.y-h.y)>=vn)&&(f.push({a:h,b,seg:_}),h=b)};m(c,0);let p=r.x!==0,g=c;for(let b=1;b<u.length;b++){const _=u[b],N=b<=o.length?b-1:o.length,y=Math.abs(_.x-g.x)<vn,x=Math.abs(_.y-g.y)<vn;y&&x||(y?(m(_,N),p=!1):x?(m(_,N),p=!0):p?(m({x:g.x,y:_.y},N),m(_,N),p=!0):(m({x:_.x,y:g.y},N),m(_,N),p=!1),g=_)}return m(i,o.length),f}function ea(e,t,o,i,a,l=20){const r=Ul(e,t,o,i,a,l);let s=`M ${qe(e.x)},${qe(e.y)}`;for(const c of r)s+=` L ${qe(c.b.x)},${qe(c.b.y)}`;return s}const Du=14;function ta(e,t,o,i,a,l=20){return Ul(e,t,o,i,a,l).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=Du).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function qe(e){return Math.round(e*100)/100}const Ou=36;function Hl(e,t,o=Ou){const i=Math.max(e.x,t.x)+o;return`M ${qe(e.x)},${qe(e.y)} L ${qe(i)},${qe(e.y)} L ${qe(i)},${qe(t.y)} L ${qe(t.x)},${qe(t.y)}`}function na(e,t,o){const i=[e,...t,o];let a=`M ${qe(i[0].x)},${qe(i[0].y)}`;for(let l=1;l<i.length;l++)a+=` L ${qe(i[l].x)},${qe(i[l].y)}`;return a}function Lu(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function oa(e,t){const o=Lu(e),i=e.width/2,a=e.height/2,l=t.x-o.x,r=t.y-o.y;if(Math.abs(l)<vn&&Math.abs(r)<vn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=l!==0?i/Math.abs(l):1/0,c=r!==0?a/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+l*d,y:o.y+r*d},f=s<=c?l>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function ia(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function aa(e,t,o){const i=[e,...t,o],a=[];for(let l=1;l<i.length;l++){const r=i[l-1],s=i[l];a.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return a}const Pu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Fl(e,t,o={}){const i={...Pu,...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((g,b)=>{const _=b%p,N=Math.floor(b/p);l.push({id:g,location:{x:h.x+i.pad+_*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=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 Gl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Yl(e,t={}){const o={...Gl,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function zu(e,t={}){const o={...Gl,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((l,r)=>{const s=r%i,c=Yl(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 Mo(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 Wl(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 Kl(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],g=p!=null&&p.length?`(${p.length}${p.scale!=null?`,${p.scale}`:""})`:"",b=p?` → ${p.physicalName} ${p.dataType}${g}`:"",_=[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(g=>`${o.get(g.columnRef)??g.columnRef}${g.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}}`:"",g=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";a.push(` method ${m.name}()${p}${g}`)}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} ${Wl(c.end1.multiplicity)} —— ${Wl(c.end2.multiplicity)} ${u}${f}`)}}return a.join(`
2
+ `).trim()}const Uu=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function it(e){return e.replace(Uu,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Re(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function ql(e){return`<text ${[`x="${Re(e.x)}"`,`y="${Re(e.y)}"`,`fill="${it(e.fill)}"`,`font-size="${Re(e.fontSize)}"`,e.fontFamily?`font-family="${it(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${it(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${it(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${it(e.text)}</text>`}function Hu(e){return`<line x1="${Re(e.x1)}" y1="${Re(e.y)}" x2="${Re(e.x2)}" y2="${Re(e.y)}" stroke="${it(e.stroke)}" stroke-width="${Re(e.strokeWidth??1)}" />`}function Fu(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 Gu(e,t,o,i,a){return[`M${Re(e+a.tl)},${Re(t)}`,`L${Re(e+o-a.tr)},${Re(t)}`,a.tr?`Q${Re(e+o)},${Re(t)} ${Re(e+o)},${Re(t+a.tr)}`:"",`L${Re(e+o)},${Re(t+i-a.br)}`,a.br?`Q${Re(e+o)},${Re(t+i)} ${Re(e+o-a.br)},${Re(t+i)}`:"",`L${Re(e+a.bl)},${Re(t+i)}`,a.bl?`Q${Re(e)},${Re(t+i)} ${Re(e)},${Re(t+i-a.bl)}`:"",`L${Re(e)},${Re(t+a.tl)}`,a.tl?`Q${Re(e)},${Re(t)} ${Re(e+a.tl)},${Re(t)}`:"","Z"].filter(Boolean).join(" ")}function la(e){const t=Fu(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${it(e.fill)}"`,`stroke="${it(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${it(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Re(e.opacity)}"`:""].filter(Boolean),l=[o?`<path d="${Gu(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Re(e.x)}" y="${Re(e.y)}" width="${Re(e.w)}" height="${Re(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])l.push(Hu(r));for(const r of e.texts)l.push(ql(r));for(const r of e.icons??[])l.push(r);return`<g>${l.join("")}</g>`}function Yu(e){const o=[`<path ${[`d="${it(e.d)}"`,'fill="none"',`stroke="${it(e.stroke)}"`,`stroke-width="${Re(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${it(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(ql(i));return`<g>${o.join("")}</g>`}function Xl(e){const{x:t,y:o,w:i,h:a}=e.viewBox,l=[];e.background&&l.push(`<rect x="${Re(t)}" y="${Re(o)}" width="${Re(i)}" height="${Re(a)}" fill="${it(e.background)}" />`);for(const r of e.groups)l.push(la(r));for(const r of e.edges)l.push(Yu(r));for(const r of e.entities)l.push(la(r));for(const r of e.notes)l.push(la(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Re(t)} ${Re(o)} ${Re(i)} ${Re(a)}" width="${Re(i)}" height="${Re(a)}">`+l.join("")+"</svg>"}const Wu=["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"],Ku=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"]),qu=Wu.filter(e=>!Ku.has(e)),Xu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function ra(e){return Xu[e]??e}const ju=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Bo=new Set(["NUMERIC","DECIMAL"]);function jl(e,t=qu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Ot="CustomType",Wn="GroupCodeEnum",sa="String",ca=[{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:Wn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Ot,label:"CustomType"}],Zu=new Map(ca.map(e=>[e.value,e.label]));function wn(e){return Zu.get(e)??e}const Ju=new Set([Wn,"CustomMoneyType"]),Zl=ca.filter(e=>!Ju.has(e.value)).map(e=>e.value===Ot?{...e,label:"CustomType (사용자정의)"}:e);function Jl(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=[...Zl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wn(e)},...i]:i}function Qu(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ql(e,t){var a;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((a=i.jpa)==null?void 0:a.collectionType)??"LIST"}function da(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wn(t.type)}>`:Qu(t)?wn(t.type):e==="CLASS"?t.type===Ot&&t.customType||wn(t.type):ra(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function Kn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function Do(e,t){if(e.sharedColumnRef==null)return null;const o=t.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const ua=63;function Oo(e){if(!e)return null;const t=e.length;return t<=ua?null:`물리명이 ${ua}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function er(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function rt(e){return!e||e.trim()===""}function qn(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ef(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 tf(e,t,o,i,a){var l,r,s,c,d;if(!rt(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 fa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function tr(e,t){var l,r,s;const o=[];for(const c of fa(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(rt(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) 속성이 없습니다"}),rt((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(g=>g.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(g=>g.identifier&&g.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 g of p.dbAttrs)!g.autoIncrement&&rt(g.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`채번(${g.autoIncrement?"auto increment":`시퀀스 "${g.sequenceName}"`})은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "${p.name}"에 설정되어 있습니다`});for(const p of d.filter(g=>g.naturalId&&g.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(g=>g.naturalId&&g.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(g=>g.naturalId&&!g.notNull&&!g.identifier&&!g.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 fa(d,g=>g.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)rt(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((g,b)=>({col:g,name:tf(p,g,b,e,t)})).filter(g=>g.col.sharedColumnRef==null));for(const p of fa(f,g=>g.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 g=Oo(p.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!rt(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&&!rt(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}"`}),!rt(p.dataType)&&ju.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=Kn(d.flatMap(g=>g.dbAttrs));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const b=t.embeddableCatalog.find(_=>_.type===g.type);b&&g.dbAttrs.forEach((_,N)=>{if(_.sharedColumnRef==null)return;const y=b.fields[N],x=p.get(_.sharedColumnRef);if(!y||!x)return;(x.dataType!==y.dataType||(x.length??null)!==(y.length??null)||(x.scale??null)!==(y.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:_.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${er(x)})이 ${y.name??"컬럼"} 정의(${er(y)})와 다릅니다`})})}}for(const p of d){const g=p.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;p.type===Wn&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${p.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const h=(s=c.table)==null?void 0:s.physicalName,m=Oo(h);m&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:m}),t!=null&&t.reservedWords&&!rt(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 g=Oo(p.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:p.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!rt(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){qn(c.end1.multiplicity)&&qn(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"}와 의미가 겹칩니다`}),qn(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&&qn(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에서만 유효합니다`}),!qn(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 ef(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(!rt(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 Te(){return crypto.randomUUID()}const nf="CustomMoneyType",of="Money";function af(e){return!(e.type!==nf||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function lf(e){const t=e.dbAttrs[0]??{modelId:Te(),physicalName:"",dataType:""},o={modelId:Te(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:of,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function rf(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const l=i.attributes.map(r=>af(r)?(a=!0,t=!0,lf(r)):r);return a?{...i,attributes:l}:i});return t?{...e,entities:o}:e}function ma(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function En(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)=>En(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(!En(e[i],t[i]))return!1;return!0}return!1}function Qt(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const l of a)o.has(l)||En(e[l],t[l])||(i[l]=t[l]===void 0?null:t[l]);return Object.keys(i).length?i:null}function en(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 sf(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 cf=new Set(["attributes","operations","indexes","rev"]),df=new Set(["end1","end2","rev"]),uf=new Set(["memberEntityRefs","rev"]),nr=new Set(["modelId"]),ff=new Set(["modelId","columns"]),mf=new Set([]);function pf(e,t,o,i){const a=en(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=Qt(s,c,nr);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const l=en(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=Qt(s,c,nr);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const r=en(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(!En(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=Qt(s,c,ff);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function hf(e,t,o){const i=en(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:ma(r)});for(const{cur:r,tgt:s}of i.common){const c=Qt(r,s,cf);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:r.modelId,entityRef:r.modelId,patch:c}),pf(r.modelId,r,s,o)}const a=en(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:ma(r)});for(const{cur:r,tgt:s}of a.common){const c=Qt(r,s,df);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,patch:c});for(const d of["end1","end2"]){const u=Qt(r[d]??{},s[d]??{},mf);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:r.modelId,associationRef:r.modelId,end:d,patch:u})}}const l=en(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:ma(r)});for(const{cur:r,tgt:s}of l.common){const c=Qt(r,s,uf);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:r.modelId,groupRef:r.modelId,patch:c});const d=sf(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 Lo(e,t,o,i,a,l,r){const s=en(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)En(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){Lo(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Lo(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Lo(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Lo(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function gf(e,t){const o=[];return hf(e.logical,t.logical,o),yf(e.layout,t.layout,o),o}function bf(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 _f={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 vf{constructor(t){ze(this,"out",[]);ze(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({...Xn(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({...Xn(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({...Xn(t),field:a,value:void 0,removed:!0});continue}this.out.push({...Xn(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({...Xn(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Xn(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 pt(e,t,o,i){if(o==null||typeof o!="object")return;const a=_f[i];for(const[l,r]of Object.entries(o))a.has(l)||e.set(t,l,r)}function tn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function pa(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Lt(e,t){var l,r,s,c,d,u,f,h;const o=bf(t),i=new vf(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"?pt(i,m,p.value,"entity"):p.kind==="entity.update"?tn(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 g=pa((l=p.value)==null?void 0:l.attributes,t.attributeRef);g&&pt(i,m,g,"attribute")}else p.kind==="attribute.add"&&((r=p.value)==null?void 0:r.modelId)===t.attributeRef?pt(i,m,p.value,"attribute"):p.kind==="attribute.update"&&p.attributeRef===t.attributeRef?tn(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 g=pa((s=p.value)==null?void 0:s.operations,t.operationRef);g&&pt(i,m,g,"operation")}else p.kind==="operation.add"&&((c=p.value)==null?void 0:c.modelId)===t.operationRef?pt(i,m,p.value,"operation"):p.kind==="operation.update"&&p.operationRef===t.operationRef?tn(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 g=pa((d=p.value)==null?void 0:d.indexes,t.indexRef);g&&pt(i,m,g,"index")}else p.kind==="index.add"&&((u=p.value)==null?void 0:u.modelId)===t.indexRef?pt(i,m,p.value,"index"):p.kind==="index.update"&&p.indexRef===t.indexRef?tn(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"?pt(i,m,p.value,"association"):p.kind==="association.update"?tn(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 g=(f=p.value)==null?void 0:f[t.end];pt(i,m,g,"associationEnd")}else p.kind==="associationEnd.update"&&p.end===t.end?tn(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"){pt(i,m,p.value,"group");const g=(h=p.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const b of g)i.member(m,b,!1)}else p.kind==="group.update"?tn(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 wf(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 Ef(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 Po(e,t){return e.map(o=>({...o,subject:t}))}function or(e,t){const o=e.filter(s=>s.ops.some(c=>wf(c,t))),{attributes:i,operations:a,indexes:l}=Ef(o,t),r=[...Po(Lt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)r.push(...Po(Lt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)r.push(...Po(Lt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of l)r.push(...Po(Lt(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 ir(e){return`${e.kind}:${e.ref}:${e.end??""}`}function kf(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 Nf(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 If(e){const{entities:t,associations:o,groups:i}=Nf(e),a=[];for(const l of t)for(const r of or(e,l))a.push({...r,subject:{...r.subject,entityRef:l}});for(const l of o){for(const r of Lt(e,{associationRef:l}))a.push({...r,subject:{kind:"association",ref:l}});for(const r of["end1","end2"])for(const s of Lt(e,{associationRef:l,end:r}))a.push({...s,subject:{kind:"associationEnd",ref:l,end:r}})}for(const l of i)for(const r of Lt(e,{groupRef:l}))a.push({...r,subject:{kind:"group",ref:l}});return a}function ar(e){const t=If(e),o=kf(e),i=new Map;for(const r of t){const s=ir(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=ir(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 ha{constructor(t){ze(this,"undoStack",[]);ze(this,"redoStack",[]);ze(this,"savePoint",null);ze(this,"listeners",new Set);ze(this,"commandListeners",new Set);ze(this,"coalesceSealed",!1);this.state=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 lr(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function We(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function st(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Oe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function $t(e,t,o){var i,a;return(a=(i=e.layout.notes.find(l=>l.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(l=>l.targetRef===o)}function ya(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=lr(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const a=We(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 ga(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=lr(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const l=We(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),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 rr(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Oe(i,e);for(const l of Object.keys(t))o[l]=a[l];Object.assign(a,t)},invert(i){Object.assign(Oe(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 sr(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Oe(i,e);o=a.name,a.name=t},invert(i){Oe(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 Nn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=We(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=We(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 cr(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=We(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=We(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 dr(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=We(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=We(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=We(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 ur(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=We(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=We(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 ba(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 zo(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const l=We(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=We(a,e);l>=0&&(a.layout.entityLayouts[l].attributeStyles=i)},emitOps(a){const l=We(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 _a(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 fr(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 va(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 mr(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 Uo(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 pr(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 hr(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 yr(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 xt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Oe(o,e).attributes.push(t)},invert(o){const i=Oe(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 nn(e,t,o){const i={},a=l=>{const r=Oe(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 Pt(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Oe(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&&Oe(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 wa(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const l=Oe(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&&Oe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const l=Oe(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 gr(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Oe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var r;const a=Oe(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=Oe(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 _r(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Oe(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=Oe(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 vr(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const l=Oe(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=Oe(a,e);l.operations&&l.operations.splice(0,1/0,...i)},emitOps(a){const l=(Oe(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 wr(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const l=We(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=We(a,e);l>=0&&(a.layout.entityLayouts[l].operationStyles=i)},emitOps(a){const l=We(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 Ea(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 ka(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 Ho(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 Er(e,t){return{label:"인덱스 추가",apply(o){const i=Oe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var l;const i=Oe(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 kr(e,t,o){const i={},a=l=>{var s;const r=(s=Oe(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 Nr(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const a=Oe(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&&Oe(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 ht=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Zn=(e,t)=>{var o;return((o=st(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Ir(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const l=st(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=st(a,e);l&&i&&l.waypoints.splice(t,1,i)},emitOps(a){const l=Zn(a,e),r=l.map((s,c)=>c===t&&i?{...i}:s);return{forward:[ht(e,l)],invert:[ht(e,r)]}}}}function $r(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=st(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=st(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Zn(i,e),l=a.slice();return o&&l.splice(t,0,{...o}),{forward:[ht(e,a)],invert:[ht(e,l)]}}}}function xr(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const l=st(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=st(a,e);l&&i&&(l.waypoints=i)},emitOps(a){return{forward:[ht(e,Zn(a,e))],invert:[ht(e,i??[])]}}}}function Sr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=st(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=st(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[ht(e,Zn(o,e))],invert:[ht(e,t??[])]}}}}function Cr(e,t,o){return{label:"waypoint 추가",apply(i){const a=st(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=st(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Zn(i,e),l=a.slice();return l.splice(t,1),{forward:[ht(e,a)],invert:[ht(e,l)]}}}}function Rr(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 Na(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 Jn(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 Vr(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 Ar(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 Tr(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 Mr(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 Br(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}}),Fo=(e,t,o)=>{var i;return((i=$t(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Dr(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 Or(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 Lr(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(l){const r=$t(l,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(l){const r=$t(l,e,t);r&&a&&r.waypoints.splice(o,1,a)},emitOps(l){const r=Fo(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 Pr(e,t,o,i){return{label:"waypoint 추가",apply(a){const l=$t(a,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);l.waypoints.splice(o,0,{...i})},invert(a){const l=$t(a,e,t);l==null||l.waypoints.splice(o,1)},emitOps(a){const l=Fo(a,e,t),r=l.slice();return r.splice(o,1),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function zr(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const l=$t(a,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...l.waypoints[o]},l.waypoints.splice(o,1)},invert(a){const l=$t(a,e,t);l&&i&&l.waypoints.splice(o,0,i)},emitOps(a){const l=Fo(a,e,t),r=l.slice();return i&&r.splice(o,0,{...i}),{forward:[zt(e,t,l)],invert:[zt(e,t,r)]}}}}function Ur(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=$t(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(l=>({...l})),a.waypoints=[]},invert(i){const a=$t(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[zt(e,t,Fo(i,e,t))],invert:[zt(e,t,o??[])]}}}}function Le(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 $f=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:xt,addEntity:ya,addEntityToGroup:mr,addGroup:_a,addIndex:Er,addNote:Rr,addNoteConnection:Dr,addNoteConnectionWaypoint:Pr,addNoteToGroup:Mr,addOperation:gr,addWaypoint:Cr,clearNoteConnectionWaypoints:Ur,clearWaypoints:Sr,composite:Le,moveEntity:Nn,moveGroup:pr,moveNote:Jn,moveNoteConnectionWaypoint:Lr,moveWaypoint:Ir,removeAssociation:ka,removeAttribute:Pt,removeEntity:ga,removeEntityFromGroup:Uo,removeGroup:va,removeIndex:Nr,removeNote:Na,removeNoteConnection:Or,removeNoteConnectionWaypoint:zr,removeNoteFromGroup:Br,removeOperation:_r,removeWaypoint:$r,renameEntity:sr,reorderAttributes:wa,reorderOperations:vr,resizeEntity:cr,resizeGroup:hr,resizeNote:Vr,setAllEntitiesCollapsed:ba,setAttributeSwatch:zo,setEntityCollapsed:ur,setEntitySwatch:dr,setGroupSwatch:yr,setNoteMemo:Ar,setNoteSwatch:Tr,setOperationSwatch:wr,translateWaypoints:xr,updateAssociation:Ho,updateAssociationEnd:In,updateAttribute:nn,updateEntity:rr,updateGroup:fr,updateIndex:kr,updateOperation:br},Symbol.toStringTag,{value:"Module"}));class Hr{constructor(){ze(this,"revs",new Map);ze(this,"layoutVersion",0);ze(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 Fr{constructor(t){ze(this,"cache",new Hr);ze(this,"newClientOpId");ze(this,"debounceMs");ze(this,"emissions",new WeakMap);ze(this,"open",null);ze(this,"debounceHandle",null);ze(this,"queue",[]);ze(this,"sending",!1);ze(this,"_frozen",!1);ze(this,"stack",null);ze(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Te,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 Gr=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"];function xf(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 Sf(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 Yr(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function je(e,t){const o=xf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Cf(e,t){const o=Sf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Rf(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 Wr(e,t){const o=Rf(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 Vf(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function Af(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Tf(e,t){const o=Vf(e,t);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Mf(e,t){const o=Af(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 Kr(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 qr(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"},g=Wr(i,p);if(!g.ok){r.push(g.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:g.matches}),f=!0;continue}u.push({modelId:s(),physicalName:"",dataType:"",sharedColumnRef:g.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 Xr(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 jr(e,t,o,i,a,l){const r=[];let s=!1;for(const c of t.columns){const d=Wr(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 Bf(e,t,o={}){const i=o.mkId??Te,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,g;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}}:{}},N={ref:f.spec.name};let y=!1;for(const[P,K]of(f.spec.attributes??[]).entries()){if(K.type==="GroupCodeEnum"&&!K.groupCode){s.push({code:"groupcode-required",opIndex:h,entity:N,handle:{ref:K.name}}),y=!0;continue}const T=l(K.type);if(T){const ie=qr(K,T,P,_,h,N,s,i);ie?_.attributes.push(ie):y=!0}else(m=K.embeddableOverrides)!=null&&m.length?(s.push({code:"embeddable-type-unresolved",opIndex:h,entity:N,handle:{ref:K.name}}),y=!0):_.attributes.push(Kr(K,P,i))}const x=(f.spec.operations??[]).map((P,K)=>Xr(P,K,i));x.length&&(_.operations=x);const q=[];for(const P of f.spec.indexes??[]){const K=jr(_,P,h,N,s,i);K?q.push(K):y=!0}if(q.length&&(_.indexes=q),y)break;r.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:_});break}case"entity.update":{const b=je(e,f.entity);if(!b.ok){s.push(Ze(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=je(e,f.entity);if(!b.ok){s.push(Ze(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=je(e,f.entity);if(!b.ok){s.push(Ze(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 N=l(f.spec.type);let y;if(N)y=qr(f.spec,N,_,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 y=Kr(f.spec,_,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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Cf(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=je(e,f.spec.from),_=je(e,f.spec.to);if(b.ok||s.push(Ze(b.reason,h,f.spec.from,b.matches,u)),_.ok||s.push(Ze(_.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 N=i(),y={modelId:N,...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}};r.push({kind:"association.add",casUnit:"logical",associationRef:N,value:y});break}case"association.remove":{const b=je(e,f.association.from),_=je(e,f.association.to);if(b.ok||s.push(Ze(b.reason,h,f.association.from,b.matches,u)),_.ok||s.push(Ze(_.reason,h,f.association.to,_.matches,u)),!b.ok||!_.ok)break;const N=Yr(e,b.value.modelId,_.value.modelId);if(N.length!==1){s.push(N.length===0?{code:"association-not-found",opIndex:h,handle:f.association}:{code:"association-ambiguous",opIndex:h,handle:f.association,matches:N.map(y=>y.modelId)});break}r.push({kind:"association.remove",casUnit:"logical",associationRef:N[0].modelId});break}case"association.update":{const b=Zr(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=Zr(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=jr(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Tf(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=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=d.get(b.value.modelId)??((g=b.value.operations)==null?void 0:g.length)??0;d.set(b.value.modelId,_+1);const N=Xr(f.spec,_,i);r.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.modelId,value:N});break}case"operation.update":case"operation.remove":{const b=je(e,f.entity);if(!b.ok){s.push(Ze(b.reason,h,f.entity,b.matches,u));break}const _=Mf(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 x of f.spec.members){const q=je(e,x);if(!q.ok){s.push(Ze(q.reason,h,x,q.matches,u)),_=!0;continue}b.push(q.value.modelId)}if(_)break;const N=i(),y={modelId:N,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:N,value:y});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:r}}function Ze(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 Zr(e,t,o,i,a){const l=je(e,t.from),r=je(e,t.to);if(l.ok||i.push(Ze(l.reason,o,t.from,l.matches,a)),r.ok||i.push(Ze(r.reason,o,t.to,r.matches,a)),!l.ok||!r.ok)return null;const s=Yr(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 Jr={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Df={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Of={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},Go={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Lf={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:{...Go,description:"속성 설명(다국어)."},columnLogicalName:{...Go,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},Qr={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Pf={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Qr,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Qr,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},zf={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Jr,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},Uf={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Go,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Hf={type:"object",properties:{name:{...Go,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},Ff={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function Ke(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Gf={"entity.add":Ke("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":Ke("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":Ke("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":Ke("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":Ke("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":Ke("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":Ke("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":Ke("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":Ke("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":Ke("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":Ke("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":Ke("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":Ke("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":Ke("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":Ke("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":Ke("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":Ke("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},es={anyOf:Gr.map(e=>Gf[e])},Yf={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Jr,assocHandle:Df,entitySpec:Of,attrSpec:Lf,assocSpec:Pf,indexSpec:zf,operationSpec:Uf,groupSpec:Hf,patch:Ff,symbolicOp:es}};function Wf(e,t,o,i={}){const a=i.mkClientOpId??Te,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 ts={location:{x:0,y:0},size:{width:220,height:140}};function ns(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Kf=/^[-=_*~\s]{3,}$/;function qf(e){return e.attrType&&e.attrType!=="NORMAL"||!Kf.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Xf(e,t){return e.attrType==="DIVIDER"||qf(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(ns)}}function jf(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 Zf(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 Jf(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(Xf),operations:(t=e.operations)==null?void 0:t.map(jf),indexes:(o=e.indexes)==null?void 0:o.map(Zf),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Qf(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??{...ts},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function os(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 Ia(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:os(e)}}function em(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:Ia(e.end1),end2:Ia(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 is(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function as(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function ls(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 rs(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(ns)}}function tm(e,t,o){var b,_;const i=is(e.end1.attribute),a=is(e.end2.attribute);if(i===a)return em(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((N,y)=>Math.max(N,y.order),-1)+1:s.order??0,h={...rs(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const m=(N,y)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:y?d:h.modelId,legacyNavRaw:y?void 0:N.attribute,jpa:os(N)}),p={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p.end1.attributeRef,targetColumnRef:p.end2.attributeRef,style:e.style};return{assoc:p,layout:g}}function nm(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 om(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((g,b)=>Math.max(g,b.order),-1)+1:r.order??0,d={...rs(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(g=>nm(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...Ia(g),legacyEmbedRaw:g.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 im(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=im(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 am(e){return(e.schemaVersion??1)>=2&&"logical"in e?lm(e):rm(e)}function lm(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 rm(e){var _,N;const t=e.id??"",o=[],i=[],a=[],l=[],r=[],s=[],c=[],d=(y,x)=>{o.push(Jf(y));const q=Qf(y);q.geo={location:{x:q.geo.location.x+x.x,y:q.geo.location.y+x.y},size:q.geo.size},i.push(q);for(const P of y.ownedAssociations??[])c.push(P)},u={x:0,y:0};for(const y of e.entities??[])d(y,u);const f=[];for(const y of e.groups??[]){const x=y.entities??[];r.push({modelId:y.modelId,name:y.name,description:y.description,packageName:y.packageName,excludeDDLGeneration:y.excludeDDLGeneration??!1,memberEntityRefs:x.map(P=>P.modelId)});const q=((_=y.geo)==null?void 0:_.location)??u;if(y.geo){const P=(y.notes??[]).map(K=>K.modelId);s.push({groupRef:y.modelId,geo:y.geo,style:y.style,memberNoteRefs:P.length?P:void 0})}for(const P of x)d(P,q);for(const P of y.notes??[])f.push(ss(P,q))}const h=new Map(o.map(y=>[y.modelId,y])),m=new Map,p=new Map;for(const y of o)for(const x of y.attributes)for(const q of x.dbAttrs)m.set(q.modelId,x.modelId),p.set(q.modelId,q);for(const y of c)for(const x of[y.end1,y.end2]){const q=x.attribute;if(q&&(((N=q.dbAttrs)==null?void 0:N.length)??0)>0)for(const P of q.dbAttrs)P.modelId&&m.set(P.modelId,q.modelId)}for(const y of c){const x=as(y.end1.attribute),q=as(y.end2.attribute),P=ls(y.end1)||ls(y.end2),{assoc:K,layout:T}=x!==q||P?om(y,h,p):tm(y,h,m);a.push(K),l.push(T)}const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:l,groupLayouts:s,notes:[...(e.notes??[]).map(y=>ss(y)),...f]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,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 sm(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 cm(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 dm(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 um(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 fm(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 mm(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 pm(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function hm(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:pm(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 ym(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)=>hm(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:Ut(e.end1,c?s:u),end2:Ut(e.end2,c?u:s)}}function gm(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=ym(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?um(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ut(e.end1,l?m:h),end2:Ut(e.end2,r?m:h)}}return{...i,end1:Ut(e.end1),end2:Ut(e.end2)}}function ds(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)??{...ts},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 sm(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 cm(h,(m=l==null?void 0:l.operationStyles)==null?void 0:m[h.modelId])}),ownedAssociations:r.map(h=>gm(h,t,s(h.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(dm),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:l==null?void 0:l.style,collapsed:l==null?void 0:l.collapsed}}function bm(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=>us(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:l.map(c=>ds(c,t,o,i,r)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style}}function us(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 _m(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=fm(e),l=mm(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=>ds(s,e,a,l)),groups:e.logical.groups.map(s=>bm(s,e,a,l)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>us(s))}}function vm(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 St(e){return typeof e=="function"?e():n.unref(e)}const wm=typeof window<"u"&&typeof document<"u",Em=e=>typeof e<"u",km=Object.prototype.toString,Nm=e=>km.call(e)==="[object Object]",Im=()=>{};function $m(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 fs=e=>e();function xm(e=fs){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 ms(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function Sm(e,t,o={}){const{eventFilter:i=fs,...a}=o;return n.watch(e,$m(i,t),a)}function $n(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:l,pause:r,resume:s,isActive:c}=xm(i);return{stop:Sm(e,t,{...a,eventFilter:l}),pause:r,resume:s,isActive:c}}function Cm(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=St(t.replaceRef))!=null?l:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function $a(e,t=!1){function o(f,{flush:h="sync",deep:m=!1,timeout:p,throwOnTimeout:g}={}){let b=null;const N=[new Promise(y=>{b=n.watch(e,x=>{f(x)!==t&&(b==null||b(),y(x))},{flush:h,deep:m,immediate:!0})})];return p!=null&&N.push(ms(p,g).then(()=>St(e)).finally(()=>b==null?void 0:b())),Promise.race(N)}function i(f,h){if(!n.isRef(f))return o(x=>x===f,h);const{flush:m="sync",deep:p=!1,timeout:g,throwOnTimeout:b}=h??{};let _=null;const y=[new Promise(x=>{_=n.watch([e,f],([q,P])=>{t!==(q===P)&&(_==null||_(),x(q))},{flush:m,deep:p,immediate:!0})})];return g!=null&&y.push(ms(g,b).then(()=>St(e)).finally(()=>(_==null||_(),St(e)))),Promise.race(y)}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(St(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(St(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return $a(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:l,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return $a(e,!t)}}}function xa(e){return $a(e)}function Rm(e){var t;const o=St(e);return(t=o==null?void 0:o.$el)!=null?t:o}const ps=wm?window:void 0;function hs(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=ps):[t,o,i,a]=e,!t)return Im;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(()=>[Rm(t),St(a)],([u,f])=>{if(r(),!u)return;const h=Nm(f)?{...f}:f;l.push(...o.flatMap(m=>i.map(p=>s(u,m,p,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Qn(d),d}function Vm(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function ys(...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=ps,eventName:l="keydown",passive:r=!1,dedupe:s=!1}=i,c=Vm(t);return hs(a,l,u=>{u.repeat&&St(s)||c(u)&&o(u)},r)}function Am(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: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 g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const b=y=>s?typeof s=="function"?s(y):Am(y):y,_=()=>Em(e[t])?b(e[t]):f,N=y=>{h?h(y)&&p(g,y):p(g,y)};if(c){const y=_(),x=n.ref(y);let q=!1;return n.watch(()=>e[t],P=>{q||(q=!0,x.value=b(P),n.nextTick(()=>q=!1))}),n.watch(x,P=>{!q&&(P!==e[t]||u)&&N(P)},{deep:u}),x}else return n.computed({get(){return _()},set(y){N(y)}})}var Tm={value:()=>{}};function Yo(){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 Wo(o)}function Wo(e){this._=e}function Mm(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}})}Wo.prototype=Yo.prototype={constructor:Wo,on:function(e,t){var o=this._,i=Mm(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=Bm(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]=gs(o[a],e.name,t);else if(t==null)for(a in o)o[a]=gs(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 Wo(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 Bm(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function gs(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=Tm,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 bs={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 Ko(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),bs.hasOwnProperty(t)?{space:bs[t],local:e}:e}function Dm(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 Om(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _s(e){var t=Ko(e);return(t.local?Om:Dm)(t)}function Lm(){}function Ra(e){return e==null?Lm:function(){return this.querySelector(e)}}function Pm(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 at(i,this._parents)}function zm(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Um(){return[]}function vs(e){return e==null?Um:function(){return this.querySelectorAll(e)}}function Hm(e){return function(){return zm(e.apply(this,arguments))}}function Fm(e){typeof e=="function"?e=Hm(e):e=vs(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 at(i,a)}function ws(e){return function(){return this.matches(e)}}function Es(e){return function(t){return t.matches(e)}}var Gm=Array.prototype.find;function Ym(e){return function(){return Gm.call(this.children,e)}}function Wm(){return this.firstElementChild}function Km(e){return this.select(e==null?Wm:Ym(typeof e=="function"?e:Es(e)))}var qm=Array.prototype.filter;function Xm(){return Array.from(this.children)}function jm(e){return function(){return qm.call(this.children,e)}}function Zm(e){return this.selectAll(e==null?Xm:jm(typeof e=="function"?e:Es(e)))}function Jm(e){typeof e!="function"&&(e=ws(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)}function ks(e){return new Array(e.length)}function Qm(){return new at(this._enter||this._groups.map(ks),this._parents)}function qo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qo.prototype={constructor:qo,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 ep(e){return function(){return e}}function tp(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 qo(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function np(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 qo(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function op(e){return e.__data__}function ip(e,t){if(!arguments.length)return Array.from(this,op);var o=t?np:tp,i=this._parents,a=this._groups;typeof e!="function"&&(e=ep(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=ap(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var N=0,y=0,x,q;N<p;++N)if(x=g[N]){for(N>=y&&(y=N+1);!(q=b[y])&&++y<p;);x._next=q||null}}return r=new at(r,i),r._enter=s,r._exit=c,r}function ap(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lp(){return new at(this._exit||this._groups.map(ks),this._parents)}function rp(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 sp(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 at(s,this._parents)}function cp(){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 dp(e){e||(e=up);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 at(a,this._parents).order()}function up(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fp(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function mp(){return Array.from(this)}function pp(){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 hp(){let e=0;for(const t of this)++e;return e}function yp(){return!this.node()}function gp(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 bp(e){return function(){this.removeAttribute(e)}}function _p(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vp(e,t){return function(){this.setAttribute(e,t)}}function wp(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ep(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function kp(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 Np(e,t){var o=Ko(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?_p:bp:typeof t=="function"?o.local?kp:Ep:o.local?wp:vp)(o,t))}function Ns(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ip(e){return function(){this.style.removeProperty(e)}}function $p(e,t,o){return function(){this.style.setProperty(e,t,o)}}function xp(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Sp(e,t,o){return arguments.length>1?this.each((t==null?Ip:typeof t=="function"?xp:$p)(e,t,o??"")):xn(this.node(),e)}function xn(e,t){return e.style.getPropertyValue(t)||Ns(e).getComputedStyle(e,null).getPropertyValue(t)}function Cp(e){return function(){delete this[e]}}function Rp(e,t){return function(){this[e]=t}}function Vp(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Ap(e,t){return arguments.length>1?this.each((t==null?Cp:typeof t=="function"?Vp:Rp)(e,t)):this.node()[e]}function Is(e){return e.trim().split(/^|\s+/)}function Va(e){return e.classList||new $s(e)}function $s(e){this._node=e,this._names=Is(e.getAttribute("class")||"")}$s.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xs(e,t){for(var o=Va(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Ss(e,t){for(var o=Va(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function Tp(e){return function(){xs(this,e)}}function Mp(e){return function(){Ss(this,e)}}function Bp(e,t){return function(){(t.apply(this,arguments)?xs:Ss)(this,e)}}function Dp(e,t){var o=Is(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"?Bp:t?Tp:Mp)(o,t))}function Op(){this.textContent=""}function Lp(e){return function(){this.textContent=e}}function Pp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zp(e){return arguments.length?this.each(e==null?Op:(typeof e=="function"?Pp:Lp)(e)):this.node().textContent}function Up(){this.innerHTML=""}function Hp(e){return function(){this.innerHTML=e}}function Fp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gp(e){return arguments.length?this.each(e==null?Up:(typeof e=="function"?Fp:Hp)(e)):this.node().innerHTML}function Yp(){this.nextSibling&&this.parentNode.appendChild(this)}function Wp(){return this.each(Yp)}function Kp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qp(){return this.each(Kp)}function Xp(e){var t=typeof e=="function"?e:_s(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jp(){return null}function Zp(e,t){var o=typeof e=="function"?e:_s(e),i=t==null?jp:typeof t=="function"?t:Ra(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Jp(){var e=this.parentNode;e&&e.removeChild(this)}function Qp(){return this.each(Jp)}function eh(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function th(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nh(e){return this.select(e?th:eh)}function oh(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ih(e){return function(t){e.call(this,t,this.__data__)}}function ah(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 lh(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 rh(e,t,o){return function(){var i=this.__on,a,l=ih(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 sh(e,t,o){var i=ah(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?rh:lh,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Cs(e,t,o){var i=Ns(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 ch(e,t){return function(){return Cs(this,e,t)}}function dh(e,t){return function(){return Cs(this,e,t.apply(this,arguments))}}function uh(e,t){return this.each((typeof t=="function"?dh:ch)(e,t))}function*fh(){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 Rs=[null];function at(e,t){this._groups=e,this._parents=t}function eo(){return new at([[document.documentElement]],Rs)}function mh(){return this}at.prototype=eo.prototype={constructor:at,select:Pm,selectAll:Fm,selectChild:Km,selectChildren:Zm,filter:Jm,data:ip,enter:Qm,exit:lp,join:rp,merge:sp,selection:mh,order:cp,sort:dp,call:fp,nodes:mp,node:pp,size:hp,empty:yp,each:gp,attr:Np,style:Sp,property:Ap,classed:Dp,text:zp,html:Gp,raise:Wp,lower:qp,append:Xp,insert:Zp,remove:Qp,clone:nh,datum:oh,on:sh,dispatch:uh,[Symbol.iterator]:fh};function ct(e){return typeof e=="string"?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],Rs)}function ph(e){let t;for(;t=e.sourceEvent;)e=t;return e}function yt(e,t){if(e=ph(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 hh={passive:!1},to={capture:!0,passive:!1};function Aa(e){e.stopImmediatePropagation()}function Sn(e){e.preventDefault(),e.stopImmediatePropagation()}function Vs(e){var t=e.document.documentElement,o=ct(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 As(e,t){var o=e.document.documentElement,i=ct(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 Xo=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 yh(e){return!e.ctrlKey&&!e.button}function gh(){return this.parentNode}function bh(e,t){return t??{x:e.x,y:e.y}}function _h(){return navigator.maxTouchPoints||"ontouchstart"in this}function vh(){var e=yh,t=gh,o=bh,i=_h,a={},l=Yo("start","drag","end"),r=0,s,c,d,u,f=0;function h(x){x.on("mousedown.drag",m).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,hh).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(x,q){if(!(u||!e.call(this,x,q))){var P=y(this,t.call(this,x,q),x,q,"mouse");P&&(ct(x.view).on("mousemove.drag",p,to).on("mouseup.drag",g,to),Vs(x.view),Aa(x),d=!1,s=x.clientX,c=x.clientY,P("start",x))}}function p(x){if(Sn(x),!d){var q=x.clientX-s,P=x.clientY-c;d=q*q+P*P>f}a.mouse("drag",x)}function g(x){ct(x.view).on("mousemove.drag mouseup.drag",null),As(x.view,d),Sn(x),a.mouse("end",x)}function b(x,q){if(e.call(this,x,q)){var P=x.changedTouches,K=t.call(this,x,q),T=P.length,ie,te;for(ie=0;ie<T;++ie)(te=y(this,K,x,q,P[ie].identifier,P[ie]))&&(Aa(x),te("start",x,P[ie]))}}function _(x){var q=x.changedTouches,P=q.length,K,T;for(K=0;K<P;++K)(T=a[q[K].identifier])&&(Sn(x),T("drag",x,q[K]))}function N(x){var q=x.changedTouches,P=q.length,K,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),K=0;K<P;++K)(T=a[q[K].identifier])&&(Aa(x),T("end",x,q[K]))}function y(x,q,P,K,T,ie){var te=l.copy(),fe=yt(ie||P,q),M,ne,E;if((E=o.call(x,new Ta("beforestart",{sourceEvent:P,target:h,identifier:T,active:r,x:fe[0],y:fe[1],dx:0,dy:0,dispatch:te}),K))!=null)return M=E.x-fe[0]||0,ne=E.y-fe[1]||0,function S(I,B,G){var X=fe,A;switch(I){case"start":a[T]=S,A=r++;break;case"end":delete a[T],--r;case"drag":fe=yt(G||B,q),A=r;break}te.call(I,x,new Ta(I,{sourceEvent:B,subject:E,target:h,identifier:T,active:A,x:fe[0]+M,y:fe[1]+ne,dx:fe[0]-X[0],dy:fe[1]-X[1],dispatch:te}),K)}}return h.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Xo(!!x),h):e},h.container=function(x){return arguments.length?(t=typeof x=="function"?x:Xo(x),h):t},h.subject=function(x){return arguments.length?(o=typeof x=="function"?x:Xo(x),h):o},h.touchable=function(x){return arguments.length?(i=typeof x=="function"?x:Xo(!!x),h):i},h.on=function(){var x=l.on.apply(l,arguments);return x===l?h:x},h.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,h):Math.sqrt(f)},h}function Ma(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Ts(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function no(){}var oo=.7,jo=1/oo,Cn="\\s*([+-]?\\d+)\\s*",io="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wh=/^#([0-9a-f]{3,8})$/,Eh=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),kh=new RegExp(`^rgb\\(${gt},${gt},${gt}\\)$`),Nh=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${io}\\)$`),Ih=new RegExp(`^rgba\\(${gt},${gt},${gt},${io}\\)$`),$h=new RegExp(`^hsl\\(${io},${gt},${gt}\\)$`),xh=new RegExp(`^hsla\\(${io},${gt},${gt},${io}\\)$`),Ms={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,on,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Bs,formatHex:Bs,formatHex8:Sh,formatHsl:Ch,formatRgb:Ds,toString:Ds});function Bs(){return this.rgb().formatHex()}function Sh(){return this.rgb().formatHex8()}function Ch(){return Us(this).formatHsl()}function Ds(){return this.rgb().formatRgb()}function on(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=wh.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Os(t):o===3?new et(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Zo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Zo(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=Eh.exec(e))?new et(t[1],t[2],t[3],1):(t=kh.exec(e))?new et(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nh.exec(e))?Zo(t[1],t[2],t[3],t[4]):(t=Ih.exec(e))?Zo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$h.exec(e))?zs(t[1],t[2]/100,t[3]/100,1):(t=xh.exec(e))?zs(t[1],t[2]/100,t[3]/100,t[4]):Ms.hasOwnProperty(e)?Os(Ms[e]):e==="transparent"?new et(NaN,NaN,NaN,0):null}function Os(e){return new et(e>>16&255,e>>8&255,e&255,1)}function Zo(e,t,o,i){return i<=0&&(e=t=o=NaN),new et(e,t,o,i)}function Rh(e){return e instanceof no||(e=on(e)),e?(e=e.rgb(),new et(e.r,e.g,e.b,e.opacity)):new et}function Ba(e,t,o,i){return arguments.length===1?Rh(e):new et(e,t,o,i??1)}function et(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}Ma(et,Ba,Ts(no,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new et(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new et(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new et(an(this.r),an(this.g),an(this.b),Jo(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:Ls,formatHex:Ls,formatHex8:Vh,formatRgb:Ps,toString:Ps}));function Ls(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}`}function Vh(){return`#${ln(this.r)}${ln(this.g)}${ln(this.b)}${ln((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ps(){const e=Jo(this.opacity);return`${e===1?"rgb(":"rgba("}${an(this.r)}, ${an(this.g)}, ${an(this.b)}${e===1?")":`, ${e})`}`}function Jo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function an(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ln(e){return e=an(e),(e<16?"0":"")+e.toString(16)}function zs(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new dt(e,t,o,i)}function Us(e){if(e instanceof dt)return new dt(e.h,e.s,e.l,e.opacity);if(e instanceof no||(e=on(e)),!e)return new dt;if(e instanceof dt)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 dt(r,s,c,e.opacity)}function Ah(e,t,o,i){return arguments.length===1?Us(e):new dt(e,t,o,i??1)}function dt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}Ma(dt,Ah,Ts(no,{brighter(e){return e=e==null?jo:Math.pow(jo,e),new dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oo:Math.pow(oo,e),new dt(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 et(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 dt(Hs(this.h),Qo(this.s),Qo(this.l),Jo(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=Jo(this.opacity);return`${e===1?"hsl(":"hsla("}${Hs(this.h)}, ${Qo(this.s)*100}%, ${Qo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hs(e){return e=(e||0)%360,e<0?e+360:e}function Qo(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 Th(e,t){return function(o){return e+o*t}}function Mh(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 Bh(e){return(e=+e)==1?Fs:function(t,o){return o-t?Mh(t,o,e):Oa(isNaN(t)?o:t)}}function Fs(e,t){var o=t-e;return o?Th(e,o):Oa(isNaN(e)?t:e)}const ei=(function e(t){var o=Bh(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=Fs(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 Dh(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 Oh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Lh(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 Ph(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function bt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function zh(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 Uh(e){return function(){return e}}function Hh(e){return function(t){return e(t)+""}}function Gs(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:bt(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]?Hh(c[0].x):Uh(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"?bt:o==="string"?(i=on(t))?(t=i,ei):Gs:t instanceof on?ei:t instanceof Date?Ph:Oh(t)?Dh:Array.isArray(t)?Lh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zh:bt)(e,t)}var Ys=180/Math.PI,za={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ws(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)*Ys,skewX:Math.atan(c)*Ys,scaleX:r,scaleY:s}}var ti;function Fh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?za:Ws(t.a,t.b,t.c,t.d,t.e,t.f)}function Gh(e){return e==null||(ti||(ti=document.createElementNS("http://www.w3.org/2000/svg","g")),ti.setAttribute("transform",e),!(e=ti.transform.baseVal.consolidate()))?za:(e=e.matrix,Ws(e.a,e.b,e.c,e.d,e.e,e.f))}function Ks(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 g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:bt(d,f)},{i:g-2,x:bt(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:bt(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:bt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:bt(d,f)},{i:g-2,x:bt(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,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var Yh=Ks(Fh,"px, ","px)","deg)"),Wh=Ks(Gh,", ",")",")"),Kh=1e-12;function qs(e){return((e=Math.exp(e))+1/e)/2}function qh(e){return((e=Math.exp(e))-1/e)/2}function Xh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ni=(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,g=m*m+p*p,b,_;if(g<Kh)_=Math.log(h/d)/t,b=function(K){return[s+K*m,c+K*p,d*Math.exp(t*K*_)]};else{var N=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*N),x=(h*h-d*d-i*g)/(2*h*o*N),q=Math.log(Math.sqrt(y*y+1)-y),P=Math.log(Math.sqrt(x*x+1)-x);_=(P-q)/t,b=function(K){var T=K*_,ie=qs(q),te=d/(o*N)*(ie*Xh(t*T+q)-qh(q));return[s+te*m,c+te*p,d*ie/qs(t*T+q)]}}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 Rn=0,lo=0,ro=0,Xs=1e3,oi,so,ii=0,rn=0,ai=0,co=typeof performance=="object"&&performance.now?performance:Date,js=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ua(){return rn||(js(jh),rn=co.now()+ai)}function jh(){rn=0}function li(){this._call=this._time=this._next=null}li.prototype=Zs.prototype={constructor:li,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:oi=this,so=this),this._call=e,this._time=o,Ha()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ha())}};function Zs(e,t,o){var i=new li;return i.restart(e,t,o),i}function Zh(){Ua(),++Rn;for(var e=oi,t;e;)(t=rn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rn}function Js(){rn=(ii=co.now())+ai,Rn=lo=0;try{Zh()}finally{Rn=0,Qh(),rn=0}}function Jh(){var e=co.now(),t=e-ii;t>Xs&&(ai-=t,ii=e)}function Qh(){for(var e,t=oi,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:oi=o);so=e,Ha(i)}function Ha(e){if(!Rn){lo&&(lo=clearTimeout(lo));var t=e-rn;t>24?(e<1/0&&(lo=setTimeout(Js,e-co.now()-ai)),ro&&(ro=clearInterval(ro))):(ro||(ii=co.now(),ro=setInterval(Jh,Xs)),Rn=1,js(Js))}}function Qs(e,t,o){var i=new li;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var ey=Yo("start","end","cancel","interrupt"),ty=[],ec=0,tc=1,Fa=2,ri=3,nc=4,Ga=5,si=6;function ci(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;ny(e,o,{name:t,index:i,group:a,on:ey,tween:ty,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ec})}function Ya(e,t){var o=ut(e,t);if(o.state>ec)throw new Error("too late; already scheduled");return o}function _t(e,t){var o=ut(e,t);if(o.state>ri)throw new Error("too late; already running");return o}function ut(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function ny(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Zs(l,0,o.time);function l(d){o.state=tc,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!==tc)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===ri)return Qs(r);m.state===nc?(m.state=si,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=si,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Qs(function(){o.state===ri&&(o.state=nc,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=ri,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=Ga,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Ga&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=si,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function di(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=si,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function oy(e){return this.each(function(){di(this,e)})}function iy(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 ay(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 ly(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ut(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?iy:ay)(o,e,t))}function Wa(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 ut(a,i).value[t]}}function oc(e,t){var o;return(typeof t=="number"?bt:t instanceof on?ei:(o=on(t))?(t=o,ei):Gs)(e,t)}function ry(e){return function(){this.removeAttribute(e)}}function sy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cy(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 dy(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 uy(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 fy(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 my(e,t){var o=Ko(e),i=o==="transform"?Wh:oc;return this.attrTween(e,typeof t=="function"?(o.local?fy:uy)(o,i,Wa(this,"attr."+e,t)):t==null?(o.local?sy:ry)(o):(o.local?dy:cy)(o,i,t))}function py(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function hy(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function yy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&hy(e,l)),o}return a._value=t,a}function gy(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&py(e,l)),o}return a._value=t,a}function by(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=Ko(e);return this.tween(o,(i.local?yy:gy)(i,t))}function _y(e,t){return function(){Ya(this,e).delay=+t.apply(this,arguments)}}function vy(e,t){return t=+t,function(){Ya(this,e).delay=t}}function wy(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_y:vy)(t,e)):ut(this.node(),t).delay}function Ey(e,t){return function(){_t(this,e).duration=+t.apply(this,arguments)}}function ky(e,t){return t=+t,function(){_t(this,e).duration=t}}function Ny(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ey:ky)(t,e)):ut(this.node(),t).duration}function Iy(e,t){if(typeof t!="function")throw new Error;return function(){_t(this,e).ease=t}}function $y(e){var t=this._id;return arguments.length?this.each(Iy(t,e)):ut(this.node(),t).ease}function xy(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;_t(this,e).ease=o}}function Sy(e){if(typeof e!="function")throw new Error;return this.each(xy(this._id,e))}function Cy(e){typeof e!="function"&&(e=ws(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,this._name,this._id)}function Ry(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 Ct(r,this._parents,this._name,this._id)}function Vy(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 Ay(e,t,o){var i,a,l=Vy(t)?Ya:_t;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Ty(e,t){var o=this._id;return arguments.length<2?ut(this.node(),o).on.on(e):this.each(Ay(o,e,t))}function My(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function By(){return this.on("end.remove",My(this._id))}function Dy(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,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,ci(d[h],t,o,h,d,ut(u,o)));return new Ct(l,this._parents,t,o)}function Oy(e){var t=this._name,o=this._id;typeof e!="function"&&(e=vs(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=ut(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&ci(m,t,o,g,h,p);l.push(h),r.push(u)}return new Ct(l,r,t,o)}var Ly=eo.prototype.constructor;function Py(){return new Ly(this._groups,this._parents)}function zy(e,t){var o,i,a;return function(){var l=xn(this,e),r=(this.style.removeProperty(e),xn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function ic(e){return function(){this.style.removeProperty(e)}}function Uy(e,t,o){var i,a=o+"",l;return function(){var r=xn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function Hy(e,t,o){var i,a,l;return function(){var r=xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),xn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function Fy(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=ic(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function Gy(e,t,o){var i=(e+="")=="transform"?Yh:oc;return t==null?this.styleTween(e,zy(e,i)).on("end.style."+e,ic(e)):typeof t=="function"?this.styleTween(e,Hy(e,i,Wa(this,"style."+e,t))).each(Fy(this._id,e)):this.styleTween(e,Uy(e,i,t),o).on("end.style."+e,null)}function Yy(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Wy(e,t,o){var i,a;function l(){var r=t.apply(this,arguments);return r!==a&&(i=(a=r)&&Yy(e,r,o)),i}return l._value=t,l}function Ky(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,Wy(e,t,o??""))}function qy(e){return function(){this.textContent=e}}function Xy(e){return function(){var t=e(this);this.textContent=t??""}}function jy(e){return this.tween("text",typeof e=="function"?Xy(Wa(this,"text",e)):qy(e==null?"":e+""))}function Zy(e){return function(t){this.textContent=e.call(this,t)}}function Jy(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&Zy(a)),t}return i._value=e,i}function Qy(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,Jy(e))}function eg(){for(var e=this._name,t=this._id,o=ac(),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=ut(c,t);ci(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ct(i,this._parents,e,o)}function tg(){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 ng=0;function Ct(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ac(){return++ng}var Rt=eo.prototype;Ct.prototype={constructor:Ct,select:Dy,selectAll:Oy,selectChild:Rt.selectChild,selectChildren:Rt.selectChildren,filter:Cy,merge:Ry,selection:Py,transition:eg,call:Rt.call,nodes:Rt.nodes,node:Rt.node,size:Rt.size,empty:Rt.empty,each:Rt.each,on:Ty,attr:my,attrTween:by,style:Gy,styleTween:Ky,text:jy,textTween:Qy,remove:By,tween:ly,delay:wy,duration:Ny,ease:$y,easeVarying:Sy,end:tg,[Symbol.iterator]:Rt[Symbol.iterator]};function og(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ig={time:null,delay:0,duration:250,ease:og};function ag(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 lg(e){var t,o;e instanceof Ct?(t=e._id,e=e._name):(t=ac(),(o=ig).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])&&ci(c,e,t,d,r,o||ag(c,t));return new Ct(i,this._parents,e,t)}eo.prototype.interrupt=oy,eo.prototype.transition=lg;const ui=e=>()=>e;function rg(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 Vt(e,t,o){this.k=e,this.x=t,this.y=o}Vt.prototype={constructor:Vt,scale:function(e){return e===1?this:new Vt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vt(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 Vt(1,0,0);Vt.prototype;function Ka(e){e.stopImmediatePropagation()}function uo(e){e.preventDefault(),e.stopImmediatePropagation()}function sg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cg(){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 lc(){return this.__zoom||Vn}function dg(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ug(){return navigator.maxTouchPoints||"ontouchstart"in this}function fg(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 mg(){var e=sg,t=cg,o=fg,i=dg,a=ug,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ni,d=Yo("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(E){E.property("__zoom",lc).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ie).on("dblclick.zoom",te).filter(a).on("touchstart.zoom",fe).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",ne).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,S,I,B){var G=E.selection?E.selection():E;G.property("__zoom",lc),E!==G?q(E,S,I,B):G.interrupt().each(function(){P(this,arguments).event(B).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},_.scaleBy=function(E,S,I,B){_.scaleTo(E,function(){var G=this.__zoom.k,X=typeof S=="function"?S.apply(this,arguments):S;return G*X},I,B)},_.scaleTo=function(E,S,I,B){_.transform(E,function(){var G=t.apply(this,arguments),X=this.__zoom,A=I==null?x(G):typeof I=="function"?I.apply(this,arguments):I,ae=X.invert(A),se=typeof S=="function"?S.apply(this,arguments):S;return o(y(N(X,se),A,ae),G,r)},I,B)},_.translateBy=function(E,S,I,B){_.transform(E,function(){return o(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),r)},null,B)},_.translateTo=function(E,S,I,B,G){_.transform(E,function(){var X=t.apply(this,arguments),A=this.__zoom,ae=B==null?x(X):typeof B=="function"?B.apply(this,arguments):B;return o(Vn.translate(ae[0],ae[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof I=="function"?-I.apply(this,arguments):-I),X,r)},B,G)};function N(E,S){return S=Math.max(l[0],Math.min(l[1],S)),S===E.k?E:new Vt(S,E.x,E.y)}function y(E,S,I){var B=S[0]-I[0]*E.k,G=S[1]-I[1]*E.k;return B===E.x&&G===E.y?E:new Vt(E.k,B,G)}function x(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function q(E,S,I,B){E.on("start.zoom",function(){P(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(B).end()}).tween("zoom",function(){var G=this,X=arguments,A=P(G,X).event(B),ae=t.apply(G,X),se=I==null?x(ae):typeof I=="function"?I.apply(G,X):I,ge=Math.max(ae[1][0]-ae[0][0],ae[1][1]-ae[0][1]),_e=G.__zoom,re=typeof S=="function"?S.apply(G,X):S,ye=c(_e.invert(se).concat(ge/_e.k),re.invert(se).concat(ge/re.k));return function(be){if(be===1)be=re;else{var $e=ye(be),Se=ge/$e[2];be=new Vt(Se,se[0]-$e[0]*Se,se[1]-$e[1]*Se)}A.zoom(null,be)}})}function P(E,S,I){return!I&&E.__zooming||new K(E,S)}function K(E,S){this.that=E,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,S),this.taps=0}K.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,S){return this.mouse&&E!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var S=ct(this.that).datum();d.call(E,this.that,new rg(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),S)}};function T(E,...S){if(!e.apply(this,arguments))return;var I=P(this,S).event(E),B=this.__zoom,G=Math.max(l[0],Math.min(l[1],B.k*Math.pow(2,i.apply(this,arguments)))),X=yt(E);if(I.wheel)(I.mouse[0][0]!==X[0]||I.mouse[0][1]!==X[1])&&(I.mouse[1]=B.invert(I.mouse[0]=X)),clearTimeout(I.wheel);else{if(B.k===G)return;I.mouse=[X,B.invert(X)],di(this),I.start()}uo(E),I.wheel=setTimeout(A,p),I.zoom("mouse",o(y(N(B,G),I.mouse[0],I.mouse[1]),I.extent,r));function A(){I.wheel=null,I.end()}}function ie(E,...S){if(h||!e.apply(this,arguments))return;var I=E.currentTarget,B=P(this,S,!0).event(E),G=ct(E.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",ge,!0),X=yt(E,I),A=E.clientX,ae=E.clientY;Vs(E.view),Ka(E),B.mouse=[X,this.__zoom.invert(X)],di(this),B.start();function se(_e){if(uo(_e),!B.moved){var re=_e.clientX-A,ye=_e.clientY-ae;B.moved=re*re+ye*ye>g}B.event(_e).zoom("mouse",o(y(B.that.__zoom,B.mouse[0]=yt(_e,I),B.mouse[1]),B.extent,r))}function ge(_e){G.on("mousemove.zoom mouseup.zoom",null),As(_e.view,B.moved),uo(_e),B.event(_e).end()}}function te(E,...S){if(e.apply(this,arguments)){var I=this.__zoom,B=yt(E.changedTouches?E.changedTouches[0]:E,this),G=I.invert(B),X=I.k*(E.shiftKey?.5:2),A=o(y(N(I,X),B,G),t.apply(this,S),r);uo(E),s>0?ct(this).transition().duration(s).call(q,A,B,E):ct(this).call(_.transform,A,B,E)}}function fe(E,...S){if(e.apply(this,arguments)){var I=E.touches,B=I.length,G=P(this,S,E.changedTouches.length===B).event(E),X,A,ae,se;for(Ka(E),A=0;A<B;++A)ae=I[A],se=yt(ae,this),se=[se,this.__zoom.invert(se),ae.identifier],G.touch0?!G.touch1&&G.touch0[2]!==se[2]&&(G.touch1=se,G.taps=0):(G.touch0=se,X=!0,G.taps=1+!!u);u&&(u=clearTimeout(u)),X&&(G.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),di(this),G.start())}}function M(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A,ae,se;for(uo(E),X=0;X<G;++X)A=B[X],ae=yt(A,this),I.touch0&&I.touch0[2]===A.identifier?I.touch0[0]=ae:I.touch1&&I.touch1[2]===A.identifier&&(I.touch1[0]=ae);if(A=I.that.__zoom,I.touch1){var ge=I.touch0[0],_e=I.touch0[1],re=I.touch1[0],ye=I.touch1[1],be=(be=re[0]-ge[0])*be+(be=re[1]-ge[1])*be,$e=($e=ye[0]-_e[0])*$e+($e=ye[1]-_e[1])*$e;A=N(A,Math.sqrt(be/$e)),ae=[(ge[0]+re[0])/2,(ge[1]+re[1])/2],se=[(_e[0]+ye[0])/2,(_e[1]+ye[1])/2]}else if(I.touch0)ae=I.touch0[0],se=I.touch0[1];else return;I.zoom("touch",o(y(A,ae,se),I.extent,r))}}function ne(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A;for(Ka(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),X=0;X<G;++X)A=B[X],I.touch0&&I.touch0[2]===A.identifier?delete I.touch0:I.touch1&&I.touch1[2]===A.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(A=yt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<b)){var ae=ct(this).on("dblclick.zoom");ae&&ae.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:ui(+E),_):i},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:ui(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:ui(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:ui([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(l[0]=+E[0],l[1]=+E[1],_):[l[0],l[1]]},_.translateExtent=function(E){return arguments.length?(r[0][0]=+E[0][0],r[1][0]=+E[1][0],r[0][1]=+E[0][1],r[1][1]=+E[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(E){return arguments.length?(o=E,_):o},_.duration=function(E){return arguments.length?(s=+E,_):s},_.interpolate=function(E){return arguments.length?(c=E,_):c},_.on=function(){var E=d.on.apply(d,arguments);return E===d?_:E},_.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,_):Math.sqrt(g)},_.tapDistance=function(E){return arguments.length?(b=+E,_):b},_}var Ie=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Ie||{}),qa=(e=>(e.Partial="partial",e.Full="full",e))(qa||{}),sn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(sn||{}),At=(e=>(e.Strict="strict",e.Loose="loose",e))(At||{}),Xa=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Xa||{}),fo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(fo||{}),rc=(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))(rc||{});const pg=["INPUT","SELECT","TEXTAREA"],hg=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 pg.includes(i==null?void 0:i.nodeName)||a||!!l}function yg(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function sc(e,t,o,i){const a=t.replace("+",`
3
3
  `).replace(`
4
4
 
5
5
  `,`
6
6
  +`).split(`
7
- `).map(r=>r.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const l=a.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),l}function gg(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=bg(o.code,e);return Array.isArray(e)?e.some(a=>rc(o[i],a,t,o.type==="keyup")):rc(o[i],e,t,o.type==="keyup")}}function bg(e,t){return t.includes(e)?"code":"key"}function fo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??hg),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}),ps(["blur","contextmenu"],s),hs((...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=yg(d),(!a||a&&!h)&&qa(d))return;const g=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),hs((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&qa(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"?gg(d,l):d}return i}const sc="vue-flow__node-desc",cc="vue-flow__edge-desc",_g="vue-flow__aria-live",dc=["Enter"," ","Escape"],Vn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function fi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function mi(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 pi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function cn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function uc(e,t){return{x:cn(e.x,t[0][0],t[1][0]),y:cn(e.y,t[0][1],t[1][1])}}function fc(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Ut(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function dn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Ut(e)}function mo(e){return dn(e)&&"computedPosition"in e}function hi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function wg(e){return hi(e.width)&&hi(e.height)&&hi(e.x)&&hi(e.y)}function vg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function 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:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function pc(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 Eg(...e){if(e.length===3){const[l,r,s]=e;return pc(l,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ut(l)&&l.source===i).map(l=>o.find(r=>dn(r)&&r.id===l.target))}function kg(...e){if(e.length===3){const[l,r,s]=e;return pc(l,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(l=>Ut(l)&&l.target===i).map(l=>o.find(r=>dn(r)&&r.id===l.source))}function hc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Ng(e,t){return t.some(o=>Ut(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 po({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function ho({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?gi(s,r):s}function yc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function yi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function gc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function Ig(e,t){return gc(yc(yi(e),yi(t)))}function Xa(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=yc(t,yi({...i.computedPosition,...i.dimensions}))}return gc(t)}function bc(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const l={...ho(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=mi(l,fi(s)),p=f===null||h===null,g=i&&m>0,b=(f??0)*(h??0);(p||g||m>=b||s.dragging)&&r.push(s)}return r}function un(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 An(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 bo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function $g(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=An(e,o),a=An(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=An(e.top??e.y??0,o),a=An(e.bottom??e.y??0,o),l=An(e.left??e.x??0,t),r=An(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 xg(e,t,o,i,a,l){const{x:r,y:s}=po(e,{x:t,y:o,zoom:i}),{x:c,y:d}=po({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 _c(e,t,o,i,a,l=.1){const r=$g(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=cn(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,g=xg(e,m,p,u,t,o),b={left:Math.min(g.left-r.left,0),top:Math.min(g.top-r.top,0),right:Math.min(g.right-r.right,0),bottom:Math.min(g.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function Sg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function wc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:wc(o,t):!1}function yo(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&&go()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function vc(e,t,o){return e<t?cn(Math.abs(e-t),1,t)/t:e>o?-cn(Math.abs(e-o),1,t)/t:0}function Ec(e,t,o=15,i=40){const a=vc(e.x,i,t.width-i)*o,l=vc(e.y,i,t.height-i)*o;return[a,l]}function Za(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 kc(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(mo(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&&mo(c)&&Za(r,c)}break;case"dimensions":if(mo(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&&mo(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Za(r,c):n.nextTick(()=>{Za(r,c)}))}break}return t}function Ht(e,t){return{id:e,type:"select",selected:t}}function Nc(e){return{item:e,type:"add"}}function Ic(e){return{id:e,type:"remove"}}function $c(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Ft(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(Ht(l.id,r)))}return i}const xc=()=>{};function Ee(e){const t=new Set;let o=xc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=xc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return Jn(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 Sc(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 Cg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!wc(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 Ja({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 Cc(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 Rg(e,t,o){const[i,a,l,r]=typeof e!="string"?Cc(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 Vg(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=Rg(a,e,i);l&&(a=l)}else t(new Fe(Ue.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]=Cc(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 Ag({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Qa(e,t,o,i,a){const l=Ag(e.dimensions,Vg(e,o,i,a)),r=uc(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 Tn(e,t,o=Ie.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??Dg(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Ie.Top:return{x:a+r/2,y:l};case Ie.Right:return{x:a+r,y:l+s/2};case Ie.Bottom:return{x:a+r/2,y:l+s};case Ie.Left:return{x:a,y:l+s/2}}}function Rc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Tg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=yi({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*h)>0}function Mg(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 Ue=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Ue||{});const Vc={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
7
+ `).map(r=>r.trim().toLowerCase());if(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 gg(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=bg(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 bg(e,t){return t.includes(e)?"code":"key"}function mo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??hg),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}),hs(["blur","contextmenu"],s),ys((...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=yg(d),(!a||a&&!h)&&ja(d))return;const g=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,b=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!m&&(a||!b)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ys((...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"?gg(d,l):d}return i}const cc="vue-flow__node-desc",dc="vue-flow__edge-desc",_g="vue-flow__aria-live",uc=["Enter"," ","Escape"],An={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function fi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function mi(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 pi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function cn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function fc(e,t){return{x:cn(e.x,t[0][0],t[1][0]),y:cn(e.y,t[0][1],t[1][1])}}function mc(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 dn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Ht(e)}function po(e){return dn(e)&&"computedPosition"in e}function hi(e){return!Number.isNaN(e)&&Number.isFinite(e)}function vg(e){return hi(e.width)&&hi(e.height)&&hi(e.x)&&hi(e.y)}function wg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function pc(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:He(e.data)?e.data:{},events:n.markRaw(He(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??l,e,{id:e.id.toString()})}function hc(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 Eg(...e){if(e.length===3){const[l,r,s]=e;return hc(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=>dn(r)&&r.id===l.target))}function kg(...e){if(e.length===3){const[l,r,s]=e;return hc(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=>dn(r)&&r.id===l.source))}function yc({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function Ng(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?gi(s,r):s}function gc(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function yi({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function bc({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function Ig(e,t){return bc(gc(yi(e),yi(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=gc(t,yi({...i.computedPosition,...i.dimensions}))}return bc(t)}function _c(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,h=c.height??s.height??null;if(a&&!d||u)continue;const m=mi(l,fi(s)),p=f===null||h===null,g=i&&m>0,b=(f??0)*(h??0);(p||g||m>=b||s.dragging)&&r.push(s)}return r}function un(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 $g(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 xg(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 vc(e,t,o,i,a,l=.1){const r=$g(l,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=cn(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,g=xg(e,m,p,u,t,o),b={left:Math.min(g.left-r.left,0),top:Math.min(g.top-r.top,0),right:Math.min(g.right-r.right,0),bottom:Math.min(g.bottom-r.bottom,0)};return{x:m-b.left+b.right,y:p-b.top+b.bottom,zoom:u}}function Sg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function wc(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:wc(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 Ec(e,t,o){return e<t?cn(Math.abs(e-t),1,t)/t:e>o?-cn(Math.abs(e-o),1,t)/t:0}function kc(e,t,o=15,i=40){const a=Ec(e.x,i,t.width-i)*o,l=Ec(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 Nc(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 Ic(e){return{item:e,type:"add"}}function $c(e){return{id:e,type:"remove"}}function xc(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 Sc=()=>{};function ke(e){const t=new Set;let o=Sc,i=()=>!1;const a=()=>t.size>0||i(),l=h=>{o=h},r=()=>{o=Sc},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{t.delete(h)};return{on:h=>{t.add(h);const m=()=>d(h);return Qn(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 Cc(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 Cg(e,t,o,i){var a,l;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!wc(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 Rc(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 Rg(e,t,o){const[i,a,l,r]=typeof e!="string"?Rc(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 Vg(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=Rg(a,e,i);l&&(a=l)}else t(new Fe(Ue.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]=Rc(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 Ag({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=Ag(e.dimensions,Vg(e,o,i,a)),r=fc(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=Ie.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??Dg(e);if(i)return{x:a+r/2,y:l+s/2};switch((t==null?void 0:t.position)??o){case Ie.Top:return{x:a+r/2,y:l};case Ie.Right:return{x:a+r,y:l+s/2};case Ie.Bottom:return{x:a+r/2,y:l+s};case Ie.Left:return{x:a,y:l+s/2}}}function Vc(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function Tg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:l,width:r,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+l)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=yi({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*h)>0}function Mg(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 Ue=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Ue||{});const Ac={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
8
8
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
9
9
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
10
10
  Node: ${e}
@@ -24,7 +24,7 @@ Edge: ${e}
24
24
  Source: ${t}
25
25
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
26
26
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
27
- Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Fe extends Error{constructor(t,...o){var i;super((i=Vc[t])==null?void 0:i.call(Vc,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function el(e){return"clientX"in e}function Bg(e){return"sourceEvent"in e}function wt(e,t){const o=el(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 go=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Dg(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 gi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Og=()=>!0;function tl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Lg(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())mi(a,fi(l))>0&&i.push(l);return i}const Pg=250;function zg(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Lg(e,o,t+Pg);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}=Tn(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 Ac(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Og},u,f,h,m){const p=l==="target",g=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:_}=wt(e),N=r.elementFromPoint(b,_),y=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,x={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const q=Tc(void 0,y),P=y.getAttribute("data-nodeid"),K=y.getAttribute("data-handleid"),T=y.classList.contains("connectable"),ie=y.classList.contains("connectableend");if(!P||!q)return x;const te={source:p?P:i,sourceHandle:p?K:a,target:p?i:P,targetHandle:p?a:K};x.connection=te;const M=T&&ie&&(o===At.Strict?p&&q==="source"||!p&&q==="target":P!==i||K!==a);x.isValid=M&&d(te,{nodes:f,edges:u,sourceNode:h(te.source),targetNode:h(te.target)}),x.toHandle=Mc(P,q,K,m,o,!0)}return x}function Tc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ug(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Hg(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Mc(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===At.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,...Tn(d,f,f.position,!0)}:f}const nl={[Ie.Left]:Ie.Right,[Ie.Right]:Ie.Left,[Ie.Top]:Ie.Bottom,[Ie.Bottom]:Ie.Top},Fg=["production","prod"];function bo(e,...t){Bc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Bc(){return!Fg.includes(process.env.NODE_ENV||"")}function Dc(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,...pi(r)}}):null}function ol(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 He(e){return typeof n.unref(e)<"u"}function Gg(e,t,o,i){if(!e||!e.source||!e.target)return o(new Fe(Ue.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Ut(e)?a=e:a={...e,id:hc(e)},a=mc(a,void 0,i),Ng(a,t)?!1:a}function Yg(e,t,o,i,a){if(!t.source||!t.target)return a(new Fe(Ue.EDGE_INVALID,e.id)),!1;if(!o)return a(new Fe(Ue.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?hc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Oc(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!dn(r)){o(new Fe(Ue.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=vg(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 Fe(Ue.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 Lc(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 il(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}`;Lc("source",c,u,e,a,r),Lc("target",c,d,e,l,s)}}function Pc(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function al(e,t,o,i,a,l,r,s){const c=[];for(const d of e){const u=Ut(d)?d:Gg(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){a(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Fe(Ue.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new Fe(Ue.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Fe(Ue.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...mc(u,m,l),sourceNode:f,targetNode:h})}return c}const zc=Symbol("vueFlow"),Uc=Symbol("nodeId"),Hc=Symbol("nodeRef"),Wg=Symbol("edgeId"),Kg=Symbol("edgeRef"),bi=Symbol("slots");function Fc(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:g,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:N,updateNodePositions:y,emits:x}=Me(),{onStart:q,onDrag:P,onStop:K,onClick:T,el:ie,disabled:te,id:fe,selectable:M,dragHandle:ne}=e,E=n.shallowRef(!1);let S=[],I,B=null,G={x:void 0,y:void 0},X={x:0,y:0},A=null,ae=!1,se=!1,ge=0,_e=!1;const re=jg(),ye=({x:U,y:V})=>{G={x:U,y:V};let C=!1;if(S=S.map(R=>{const O={x:U-R.distance.x,y:V-R.distance.y},{computedPosition:oe}=Qa(R,o.value?gi(O,i.value):O,x.error,r.value,R.parentNode?m(R.parentNode):void 0);return C=C||R.position.x!==oe.x||R.position.y!==oe.y,R.position=oe,R}),se=se||C,!!C&&(y(S,!0,!0),E.value=!0,A)){const[R,O]=Ja({id:fe,dragItems:S,findNode:m});P({event:A,node:R,nodes:O})}},be=()=>{if(!B)return;const[U,V]=Ec(X,B,u.value);if(U!==0||V!==0){const C={x:(G.x??0)-U/c.value.zoom,y:(G.y??0)-V/c.value.zoom};h({x:U,y:V})&&ye(C)}ge=requestAnimationFrame(be)},$e=(U,V)=>{ae=!0;const C=m(fe);!b.value&&!p.value&&C&&(C.selected||_()),C&&n.toValue(M)&&b.value&&ol(C,p.value,N,_,g,!1,V);const R=re(U.sourceEvent);if(G=R,S=Cg(l.value,f.value,R,fe),S.length){const[O,oe]=Ja({id:fe,dragItems:S,findNode:m});q({event:U.sourceEvent,node:O,nodes:oe})}},Se=(U,V)=>{var C;U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||(se=!1,s.value===0&&$e(U,V),G=re(U.sourceEvent),B=((C=t.value)==null?void 0:C.getBoundingClientRect())||null,X=wt(U.sourceEvent,B))},Ce=(U,V)=>{const C=re(U.sourceEvent);if(!_e&&ae&&d.value&&(_e=!0,be()),!ae){const R=C.xSnapped-(G.x??0),O=C.ySnapped-(G.y??0);Math.sqrt(R*R+O*O)>s.value&&$e(U,V)}(G.x!==C.xSnapped||G.y!==C.ySnapped)&&S.length&&ae&&(A=U.sourceEvent,X=wt(U.sourceEvent,B),ye(C))},Y=U=>{let V=!1;if(!ae&&!E.value&&!p.value){const C=U.sourceEvent,R=re(C),O=R.xSnapped-(G.x??0),oe=R.ySnapped-(G.y??0),j=Math.sqrt(O*O+oe*oe);j!==0&&j<=s.value&&(T==null||T(C),V=!0)}if(S.length&&!V){se&&(y(S,!1,!1),se=!1);const[C,R]=Ja({id:fe,dragItems:S,findNode:m});K({event:U.sourceEvent,node:C,nodes:R})}S=[],E.value=!1,_e=!1,ae=!1,G={x:void 0,y:void 0},cancelAnimationFrame(ge)};return n.watch([()=>n.toValue(te),ie],([U,V],C,R)=>{if(V){const O=ct(V);U||(I=wh().on("start",oe=>Se(oe,V)).on("drag",oe=>Ce(oe,V)).on("end",oe=>Y(oe)).filter(oe=>{const j=oe.target,k=n.toValue(ne);return!oe.button&&(!a.value||!Sc(j,`.${a.value}`,V)&&(!k||Sc(j,k,V)))}),O.call(I)),R(()=>{O.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),E}function qg(){return{doubleClick:Ee(),click:Ee(),mouseEnter:Ee(),mouseMove:Ee(),mouseLeave:Ee(),contextMenu:Ee(),updateStart:Ee(),update:Ee(),updateEnd:Ee()}}function Xg(e,t){const o=qg();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 jg(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Me();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=Bg(a)?a.sourceEvent:a,{x:c,y:d}=wt(s,r),u=ho({x:c,y:d},e.value),{x:f,y:h}=o.value?gi(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function _i(){return!0}function Gc({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:g,findNode:b,panBy:_,startConnection:N,updateConnection:y,endConnection:x,emits:q,viewport:P,edges:K,nodes:T,isValidConnection:ie,nodeLookup:te}=Me();let fe=null,M=!1,ne=null;function E(I){var B;const G=n.toValue(o)==="target",X=el(I),A=fc(I.target),ae=I.currentTarget;if(ae&&(X&&I.button===0||!X)){let se=function(Q){C=wt(Q,Y),ye=zg(ho(C,P.value,!1,[1,1]),u.value,te.value,oe),R||(O(),R=!0);const ce=Ac(Q,{handle:ye,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:G?"target":"source",isValidConnection:re,doc:A,lib:"vue",flowId:s,nodeLookup:te.value},K.value,T.value,b,te.value);ne=ce.handleDomNode,fe=ce.connection,M=Hg(!!ye,ce.isValid);const me={...L,isValid:M,to:ce.toHandle&&M?po({x:ce.toHandle.x,y:ce.toHandle.y},P.value):C,toHandle:ce.toHandle,toPosition:M&&ce.toHandle?ce.toHandle.position:nl[oe.position],toNode:ce.toHandle?te.value.get(ce.toHandle.nodeId):null};if(M&&ye&&(L!=null&&L.toHandle)&&me.toHandle&&L.toHandle.type===me.toHandle.type&&L.toHandle.nodeId===me.toHandle.nodeId&&L.toHandle.id===me.toHandle.id&&L.to.x===me.to.x&&L.to.y===me.to.y)return;const he=ye??ce.toHandle;if(y(he&&M?po({x:he.x,y:he.y},P.value):C,he,Ug(!!he,M)),L=me,!ye&&!M&&!ne)return tl(V);fe&&fe.source!==fe.target&&ne&&(tl(V),V=ne,ne.classList.add("connecting","vue-flow__handle-connecting"),ne.classList.toggle("valid",!!M),ne.classList.toggle("vue-flow__handle-valid",!!M))},ge=function(Q){"touches"in Q&&Q.touches.length>0||((ye||ne)&&fe&&M&&(l?l(Q,fe):q.connect(fe)),q.connectEnd(Q),a&&(r==null||r(Q)),tl(V),cancelAnimationFrame(be),x(Q),R=!1,M=!1,fe=null,ne=null,A.removeEventListener("mousemove",se),A.removeEventListener("mouseup",ge),A.removeEventListener("touchmove",se),A.removeEventListener("touchend",ge))};const _e=b(n.toValue(t));let re=n.toValue(i)||ie.value||_i;!re&&_e&&(re=(G?_e.isValidSourcePos:_e.isValidTargetPos)||_i);let ye,be=0;const{x:$e,y:Se}=wt(I),Ce=Tc(n.toValue(a),ae),Y=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!Y||!Ce)return;const U=Mc(n.toValue(t),Ce,n.toValue(e),te.value,d.value);if(!U)return;let V,C=wt(I,Y),R=!1;const O=()=>{if(!p.value)return;const[Q,ce]=Ec(C,Y,g.value);_({x:Q,y:ce}),be=requestAnimationFrame(O)},oe={...U,nodeId:n.toValue(t),type:Ce,position:U.position},j=te.value.get(n.toValue(t)),$={inProgress:!0,isValid:null,from:Tn(j,oe,Ie.Left,!0),fromHandle:oe,fromPosition:oe.position,fromNode:j,to:C,toHandle:null,toPosition:nl[oe.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Ce,position:(ae==null?void 0:ae.getAttribute("data-handlepos"))||Ie.Top,...C},{x:$e-Y.left,y:Se-Y.top}),q.connectStart({event:I,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ce});let L=$;A.addEventListener("mousemove",se),A.addEventListener("mouseup",ge),A.addEventListener("touchmove",se),A.addEventListener("touchend",ge)}}function S(I){var B,G;if(!f.value)return;const X=n.toValue(o)==="target";if(!h.value){q.clickConnectStart({event:I,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Ie.Top,...wt(I)},void 0,!0);return}let A=n.toValue(i)||ie.value||_i;const ae=b(n.toValue(t));if(!A&&ae&&(A=(X?ae.isValidSourcePos:ae.isValidTargetPos)||_i),ae&&(typeof ae.connectable>"u"?m.value:ae.connectable)===!1)return;const se=fc(I.target),ge=Ac(I,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Ie.Top,...wt(I)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:A,doc:se,lib:"vue",flowId:s,nodeLookup:te.value},K.value,T.value,b,te.value),_e=((B=ge.connection)==null?void 0:B.source)===((G=ge.connection)==null?void 0:G.target);ge.isValid&&ge.connection&&!_e&&q.connect(ge.connection),q.clickConnectEnd(I),x(I,!0)}return{handlePointerDown:E,handleClick:S}}function Zg(){return n.inject(Uc,"")}function Yc(e){const t=e??Zg()??"",o=n.inject(Hc,n.ref(null)),{findNode:i,edges:a,emits:l}=Me(),r=i(t);return r||l.error(new Fe(Ue.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>un([r],a.value))}}function Jg(){return{doubleClick:Ee(),click:Ee(),mouseEnter:Ee(),mouseMove:Ee(),mouseLeave:Ee(),contextMenu:Ee(),dragStart:Ee(),drag:Ee(),dragStop:Ee()}}function Qg(e,t){const o=Jg();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 Wc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Me();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,g=[];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:N}=Qa(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);g.push({id:b.id,position:N,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(g,!0,!1)}}const wi=.1,eb=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Gt(){return bo("Viewport not initialized yet."),Promise.resolve(!1)}const tb={zoomIn:Gt,zoomOut:Gt,zoomTo:Gt,fitView:Gt,setCenter:Gt,fitBounds:Gt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Gt,setTransform:Gt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function nb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?io:ni).scaleBy(ll(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}=uc({x:-i,y:-a},e.translateExtent),f=Rn.translate(-d,-u).scale(l);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?io:ni).transform(ll(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"?io:ni).scaleTo(ll(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:wi,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=Xa(s),{x:d,y:u,zoom:f}=_c(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??wi);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:wi})=>{const{x:r,y:s,zoom:c}=_c(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??wi);return o(r,s,c,l)},project:a=>ho(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 ho(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 po(s,e.viewport)}return{x:0,y:0}}}:tb)}function ll(e,t=0,o=eb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function ob(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,b,_=!!(o.nodes.value.length||o.edges.value.length);g=In([e.modelValue,()=>{var N,y;return(y=(N=e.modelValue)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setElements(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=In([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,y])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...y],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let g,b,_=!!o.nodes.value.length;g=In([e.nodes,()=>{var N,y;return(y=(N=e.nodes)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setNodes(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=In([o.nodes,()=>o.nodes.value.length],([N])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let g,b,_=!!o.edges.value.length;g=In([e.edges,()=>{var N,y;return(y=(N=e.edges)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setEdges(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=In([o.edges,()=>o.edges.value.length],([N])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&He(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&He(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&He(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&He(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{He(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const g=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{He(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,N)=>{b?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},m=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!g.includes(_)){const N=n.toRef(()=>t[_]),y=o[_];n.isRef(y)&&i.run(()=>{n.watch(N,x=>{He(x)&&(y.value=x)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function ib(){return{edgesChange:Ee(),nodesChange:Ee(),nodeDoubleClick:Ee(),nodeClick:Ee(),nodeMouseEnter:Ee(),nodeMouseMove:Ee(),nodeMouseLeave:Ee(),nodeContextMenu:Ee(),nodeDragStart:Ee(),nodeDrag:Ee(),nodeDragStop:Ee(),nodesInitialized:Ee(),miniMapNodeClick:Ee(),miniMapNodeDoubleClick:Ee(),miniMapNodeMouseEnter:Ee(),miniMapNodeMouseMove:Ee(),miniMapNodeMouseLeave:Ee(),connect:Ee(),connectStart:Ee(),connectEnd:Ee(),clickConnectStart:Ee(),clickConnectEnd:Ee(),paneReady:Ee(),init:Ee(),move:Ee(),moveStart:Ee(),moveEnd:Ee(),selectionDragStart:Ee(),selectionDrag:Ee(),selectionDragStop:Ee(),selectionContextMenu:Ee(),selectionStart:Ee(),selectionEnd:Ee(),viewportChangeStart:Ee(),viewportChange:Ee(),viewportChangeEnd:Ee(),paneScroll:Ee(),paneClick:Ee(),paneContextMenu:Ee(),paneMouseEnter:Ee(),paneMouseMove:Ee(),paneMouseLeave:Ee(),edgeContextMenu:Ee(),edgeMouseEnter:Ee(),edgeMouseMove:Ee(),edgeMouseLeave:Ee(),edgeDoubleClick:Ee(),edgeClick:Ee(),edgeUpdateStart:Ee(),edgeUpdate:Ee(),edgeUpdateEnd:Ee(),updateNodeInternals:Ee(),error:Ee(e=>bo(e.message))}}function ab(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),Jn(l.removeEmitter),l.setHasEmitListeners(()=>i(a)),Jn(l.removeHasEmitListeners)}});function i(a){var l;const r=lb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function lb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Kc(){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:Wa.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:uo.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:sn.Bezier,style:{}},connectionMode:At.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:go()?"Meta":"Control",zoomActivationKeyCode:go()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:ib(),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 rb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function sb(e,t,o){const i=nb(e),a=C=>{const R=C??[];e.hooks.updateNodeInternals.trigger(R)},l=C=>kg(C,e.nodes,e.edges),r=C=>Eg(C,e.nodes,e.edges),s=C=>un(C,e.edges),c=({id:C,type:R,nodeId:O})=>{var oe;const j=C?`-${R}-${C}`:`-${R}`;return Array.from(((oe=e.connectionLookup.get(`${O}${j}`))==null?void 0:oe.values())??[])},d=C=>{if(C)return t.value.get(C)},u=C=>{if(C)return o.value.get(C)},f=(C,R,O)=>{var oe,j;const k=[];for(const $ of C){const L={id:$.id,type:"position",dragging:O,from:$.from};if(R&&(L.position=$.position,$.parentNode)){const Q=d($.parentNode);L.position={x:L.position.x-(((oe=Q==null?void 0:Q.computedPosition)==null?void 0:oe.x)??0),y:L.position.y-(((j=Q==null?void 0:Q.computedPosition)==null?void 0:j.y)??0)}}k.push(L)}k!=null&&k.length&&e.hooks.nodesChange.trigger(k)},h=C=>{if(!e.vueFlowRef)return;const R=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!R)return;const O=window.getComputedStyle(R),{m22:oe}=new window.DOMMatrixReadOnly(O.transform),j=[];for(const k of C){const $=k,L=d($.id);if(L){const Q=pi($.nodeElement);if(!!(Q.width&&Q.height&&(L.dimensions.width!==Q.width||L.dimensions.height!==Q.height||$.forceUpdate))){const me=$.nodeElement.getBoundingClientRect();L.dimensions=Q,L.handleBounds.source=Dc("source",$.nodeElement,me,oe,L.id),L.handleBounds.target=Dc("target",$.nodeElement,me,oe,L.id),j.push({id:L.id,type:"dimensions",dimensions:Q})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),j.length&&e.hooks.nodesChange.trigger(j)},m=(C,R)=>{const O=new Set,oe=new Set;for(const $ of C)dn($)?O.add($.id):Ut($)&&oe.add($.id);const j=Ft(t.value,O,!0),k=Ft(o.value,oe);if(e.multiSelectionActive){for(const $ of O)j.push(Ht($,R));for(const $ of oe)k.push(Ht($,R))}j.length&&e.hooks.nodesChange.trigger(j),k.length&&e.hooks.edgesChange.trigger(k)},p=C=>{if(e.multiSelectionActive){const R=C.map(O=>Ht(O.id,!0));e.hooks.nodesChange.trigger(R);return}e.hooks.nodesChange.trigger(Ft(t.value,new Set(C.map(R=>R.id)),!0)),e.hooks.edgesChange.trigger(Ft(o.value))},g=C=>{if(e.multiSelectionActive){const R=C.map(O=>Ht(O.id,!0));e.hooks.edgesChange.trigger(R);return}e.hooks.edgesChange.trigger(Ft(o.value,new Set(C.map(R=>R.id)))),e.hooks.nodesChange.trigger(Ft(t.value,new Set,!0))},b=C=>{m(C,!0)},_=C=>{const O=(C||e.nodes).map(oe=>(oe.selected=!1,Ht(oe.id,!1)));e.hooks.nodesChange.trigger(O)},N=C=>{const O=(C||e.edges).map(oe=>(oe.selected=!1,Ht(oe.id,!1)));e.hooks.edgesChange.trigger(O)},y=C=>{if(!C||!C.length)return m([],!1);const R=C.reduce((O,oe)=>{const j=Ht(oe.id,!1);return dn(oe)?O.nodes.push(j):O.edges.push(j),O},{nodes:[],edges:[]});R.nodes.length&&e.hooks.nodesChange.trigger(R.nodes),R.edges.length&&e.hooks.edgesChange.trigger(R.edges)},x=C=>{var R;(R=e.d3Zoom)==null||R.scaleExtent([C,e.maxZoom]),e.minZoom=C},q=C=>{var R;(R=e.d3Zoom)==null||R.scaleExtent([e.minZoom,C]),e.maxZoom=C},P=C=>{var R;(R=e.d3Zoom)==null||R.translateExtent(C),e.translateExtent=C},K=C=>{e.nodeExtent=C,a()},T=C=>{var R;(R=e.d3Zoom)==null||R.clickDistance(C)},ie=C=>{e.nodesDraggable=C,e.nodesConnectable=C,e.elementsSelectable=C},te=C=>{const R=C instanceof Function?C(e.nodes):C;!e.initialized&&!R.length||(e.nodes=Oc(R,d,e.hooks.error.trigger))},fe=C=>{const R=C instanceof Function?C(e.edges):C;if(!e.initialized&&!R.length)return;const O=al(R,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);il(e.connectionLookup,o.value,O),e.edges=O},M=C=>{const R=C instanceof Function?C([...e.nodes,...e.edges]):C;!e.initialized&&!R.length||(te(R.filter(dn)),fe(R.filter(Ut)))},ne=C=>{let R=C instanceof Function?C(e.nodes):C;R=Array.isArray(R)?R:[R];const O=Oc(R,d,e.hooks.error.trigger),oe=[];for(const j of O)oe.push(Nc(j));oe.length&&e.hooks.nodesChange.trigger(oe)},E=C=>{let R=C instanceof Function?C(e.edges):C;R=Array.isArray(R)?R:[R];const O=al(R,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),oe=[];for(const j of O)oe.push(Nc(j));oe.length&&e.hooks.edgesChange.trigger(oe)},S=(C,R=!0,O=!1)=>{const oe=C instanceof Function?C(e.nodes):C,j=Array.isArray(oe)?oe:[oe],k=[],$=[];function L(ce){const me=s(ce);for(const he of me)(!He(he.deletable)||he.deletable)&&$.push($c(he.id,he.source,he.target,he.sourceHandle,he.targetHandle))}function Q(ce){const me=[];for(const he of e.nodes)he.parentNode===ce&&me.push(he);if(me.length){for(const he of me)k.push(Ic(he.id));R&&L(me);for(const he of me)Q(he.id)}}for(const ce of j){const me=typeof ce=="string"?d(ce):ce;me&&(He(me.deletable)&&!me.deletable||(k.push(Ic(me.id)),R&&L([me]),O&&Q(me.id)))}$.length&&e.hooks.edgesChange.trigger($),k.length&&e.hooks.nodesChange.trigger(k)},I=C=>{const R=C instanceof Function?C(e.edges):C,O=Array.isArray(R)?R:[R],oe=[];for(const j of O){const k=typeof j=="string"?u(j):j;k&&(He(k.deletable)&&!k.deletable||oe.push($c(typeof j=="string"?j:j.id,k.source,k.target,k.sourceHandle,k.targetHandle)))}e.hooks.edgesChange.trigger(oe)},B=(C,R,O=!0)=>{const oe=u(C.id);if(!oe)return!1;const j=e.edges.indexOf(oe),k=Yg(C,R,oe,O,e.hooks.error.trigger);if(k){const[$]=al([k],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((L,Q)=>Q===j?$:L),il(e.connectionLookup,o.value,[$]),$}return!1},G=(C,R,O={replace:!1})=>{const oe=u(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;oe.data=O.replace?j:{...oe.data,...j}},X=C=>kc(C,e.nodes),A=C=>{const R=kc(C,e.edges);return il(e.connectionLookup,o.value,R),R},ae=(C,R,O={replace:!1})=>{const oe=d(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;O.replace?e.nodes.splice(e.nodes.indexOf(oe),1,j):Object.assign(oe,j)},se=(C,R,O={replace:!1})=>{const oe=d(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;oe.data=O.replace?j:{...oe.data,...j}},ge=(C,R,O=!1)=>{O?e.connectionClickStartHandle=C:e.connectionStartHandle=C,e.connectionEndHandle=null,e.connectionStatus=null,R&&(e.connectionPosition=R)},_e=(C,R=null,O=null)=>{e.connectionStartHandle&&(e.connectionPosition=C,e.connectionEndHandle=R,e.connectionStatus=O)},re=(C,R)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,R?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=C=>{const R=wg(C),O=R?null:mo(C)?C:d(C.id);return!R&&!O?[null,null,R]:[R?C:fi(O),O,R]},be=(C,R=!0,O=e.nodes)=>{const[oe,j,k]=ye(C);if(!oe)return[];const $=[];for(const L of O||e.nodes){if(!k&&(L.id===j.id||!L.computedPosition))continue;const Q=fi(L),ce=mi(Q,oe);(R&&ce>0||ce>=Q.width*Q.height||ce>=Number(oe.width)*Number(oe.height))&&$.push(L)}return $},$e=(C,R,O=!0)=>{const[oe]=ye(C);if(!oe)return!1;const j=mi(oe,R);return O&&j>0||j>=Number(oe.width)*Number(oe.height)},Se=C=>{const{viewport:R,dimensions:O,d3Zoom:oe,d3Selection:j,translateExtent:k}=e;if(!oe||!j||!C.x&&!C.y)return!1;const $=Rn.translate(R.x+C.x,R.y+C.y).scale(R.zoom),L=[[0,0],[O.width,O.height]],Q=oe.constrain()($,L,k),ce=e.viewport.x!==Q.x||e.viewport.y!==Q.y||e.viewport.zoom!==Q.k;return oe.transform(j,Q),ce},Ce=C=>{const R=C instanceof Function?C(e):C,O=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];He(R.defaultEdgeOptions)&&(e.defaultEdgeOptions=R.defaultEdgeOptions);const oe=R.modelValue||R.nodes||R.edges?[]:void 0;oe&&(R.modelValue&&oe.push(...R.modelValue),R.nodes&&oe.push(...R.nodes),R.edges&&oe.push(...R.edges),M(oe));const j=()=>{He(R.maxZoom)&&q(R.maxZoom),He(R.minZoom)&&x(R.minZoom),He(R.translateExtent)&&P(R.translateExtent)};for(const k of Object.keys(R)){const $=k,L=R[$];![...rb,...O].includes($)&&He(L)&&(e[$]=L)}Ia(()=>e.d3Zoom).not.toBeNull().then(j),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:M,setNodes:te,setEdges:fe,addNodes:ne,addEdges:E,removeNodes:S,removeEdges:I,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:G,updateNode:ae,updateNodeData:se,applyEdgeChanges:A,applyNodeChanges:X,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:g,setMinZoom:x,setMaxZoom:q,setTranslateExtent:P,setNodeExtent:K,setPaneClickDistance:T,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:N,startConnection:ge,updateConnection:_e,endConnection:re,setInteractive:ie,setState:Ce,getIntersectingNodes:be,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:$e,panBy:Se,fitView:C=>i.value.fitView(C),zoomIn:C=>i.value.zoomIn(C),zoomOut:C=>i.value.zoomOut(C),zoomTo:(C,R)=>i.value.zoomTo(C,R),setViewport:(C,R)=>i.value.setViewport(C,R),setTransform:(C,R)=>i.value.setTransform(C,R),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(C,R,O)=>i.value.setCenter(C,R,O),fitBounds:(C,R)=>i.value.fitBounds(C,R),project:C=>i.value.project(C),screenToFlowCoordinate:C=>i.value.screenToFlowCoordinate(C),flowToScreenCoordinate:C=>i.value.flowToScreenCoordinate(C),toObject:()=>{const C=[],R=[];for(const O of e.nodes){const{computedPosition:oe,handleBounds:j,selected:k,dimensions:$,isParent:L,resizing:Q,dragging:ce,events:me,...he}=O;C.push(he)}for(const O of e.edges){const{selected:oe,sourceNode:j,targetNode:k,events:$,...L}=O;R.push(L)}return JSON.parse(JSON.stringify({nodes:C,edges:R,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:C=>new Promise(R=>{const{nodes:O,edges:oe,position:j,zoom:k,viewport:$}=C;O&&te(O),oe&&fe(oe);const[L,Q]=$!=null&&$.x&&($!=null&&$.y)?[$.x,$.y]:j??[null,null];if(L&&Q){const ce=($==null?void 0:$.zoom)||k||e.viewport.zoom;return Ia(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:L,y:Q,zoom:ce}).then(()=>{R(!0)})})}else R(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const C=Kc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const R=Rn.translate(C.defaultViewport.x??0,C.defaultViewport.y??0).scale(cn(C.defaultViewport.zoom??1,C.minZoom,C.maxZoom)),O=e.viewportRef.getBoundingClientRect(),oe=[[0,0],[O.width,O.height]],j=e.d3Zoom.constrain()(R,oe,C.translateExtent);e.d3Zoom.transform(e.d3Selection,j)}Ce(C)},$destroy:()=>{}}}const cb=["data-id","data-handleid","data-nodeid","data-handlepos"],db={name:"Handle",compatConfig:{MODE:3}},fn=n.defineComponent({...db,props:{id:{default:null},type:{},position:{default:()=>Ie.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}=Me(),{id:m,node:p,nodeEl:g,connectedEdges:b}=Yc(),_=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),x=n.toRef(()=>{var fe,M,ne,E,S,I;return((fe=r.value)==null?void 0:fe.nodeId)===m&&((M=r.value)==null?void 0:M.id)===e.id&&((ne=r.value)==null?void 0:ne.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===m&&((S=c.value)==null?void 0:S.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),q=n.toRef(()=>{var fe,M,ne;return((fe=s.value)==null?void 0:fe.nodeId)===m&&((M=s.value)==null?void 0:M.id)===e.id&&((ne=s.value)==null?void 0:ne.type)===i.value}),{handlePointerDown:P,handleClick:K}=Gc({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),T=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(fe=>{const M=fe[`${i.value}Handle`];return fe[i.value]!==m?!1:M?M===e.id:!0}):typeof e.connectable=="number"?b.value.filter(fe=>{const M=fe[`${i.value}Handle`];return fe[i.value]!==m?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):He(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var fe;if(!p.dimensions.width||!p.dimensions.height)return;const M=(fe=p.handleBounds[i.value])==null?void 0:fe.find(X=>X.id===e.id);if(!d.value||M)return;const ne=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!ne||!e.id)return;const E=g.value.getBoundingClientRect(),S=_.value.getBoundingClientRect(),I=window.getComputedStyle(ne),{m22:B}=new window.DOMMatrixReadOnly(I.transform),G={id:e.id,position:e.position,x:(S.left-E.left)/B,y:(S.top-E.top)/B,type:i.value,nodeId:m,...pi(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],G]});function ie(fe){const M=el(fe);T.value&&N.value&&(M&&fe.button===0||!M)&&P(fe)}function te(fe){!m||!s.value&&!N.value||T.value&&K(fe)}return t({handleClick:K,handlePointerDown:P,onClick:te,onPointerDown:ie}),(fe,M)=>(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":fe.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${fe.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:T.value,connecting:q.value,connectablestart:N.value,connectableend:y.value,connectionindicator:T.value&&(N.value&&!x.value||y.value&&x.value)}]]),onMousedown:ie,onTouchstartPassive:ie,onClick:te},[n.renderSlot(fe.$slots,"default",{id:fe.id})],42,cb))}}),vi=function({sourcePosition:e=Ie.Bottom,targetPosition:t=Ie.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(fn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(fn,{type:"source",position:e,connectable:i,isValidConnection:l})]};vi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],vi.inheritAttrs=!1,vi.compatConfig={MODE:3};const ub=vi,Ei=function({targetPosition:e=Ie.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(fn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Ei.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ei.inheritAttrs=!1,Ei.compatConfig={MODE:3};const fb=Ei,ki=function({sourcePosition:e=Ie.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(fn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ki.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ki.inheritAttrs=!1,ki.compatConfig={MODE:3};const mb=ki,pb=["transform"],hb=["width","height","x","y","rx","ry"],yb=["y"],gb={name:"EdgeText",compatConfig:{MODE:3}},bb=n.defineComponent({...gb,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,hb)):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,yb)],8,pb))}}),_b=["id","d","marker-end","marker-start"],wb=["d","stroke-width"],vb={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ni=n.defineComponent({...vb,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,_b),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,wb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(bb,{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 qc({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 Xc({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 Ii(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function jc({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Ie.Left:r=t-Ii(t-i,l),s=o;break;case Ie.Right:r=t+Ii(i-t,l),s=o;break;case Ie.Top:r=t,s=o-Ii(o-a,l);break;case Ie.Bottom:r=t,s=o+Ii(a-o,l);break}return[r,s]}function Zc(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,curvature:s=.25}=e,[c,d]=jc({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=jc({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,g]=Xc({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,g]}function Jc({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Ie.Left:case Ie.Right:l=.5*(t+i),r=o;break;case Ie.Top:case Ie.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function Qc(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top}=e,[s,c]=Jc({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Jc({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=Xc({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 ed={[Ie.Left]:{x:-1,y:0},[Ie.Right]:{x:1,y:0},[Ie.Top]:{x:0,y:-1},[Ie.Bottom]:{x:0,y:1}};function Eb({source:e,sourcePosition:t=Ie.Bottom,target:o}){return t===Ie.Left||t===Ie.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 td(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function kb({source:e,sourcePosition:t=Ie.Bottom,target:o,targetPosition:i=Ie.Top,center:a,offset:l}){const r=ed[t],s=ed[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=Eb({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,g;const b={x:0,y:0},_={x:0,y:0},[N,y,x,q]=qc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??N,g=a.y??y;const K=[{x:p,y:c.y},{x:p,y:d.y}],T=[{x:c.x,y:g},{x:d.x,y:g}];r[f]===h?m=f==="x"?K:T:m=f==="x"?T:K}else{const K=[{x:c.x,y:d.y}],T=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?T:K:m=r.y===h?K:T,t===i){const ne=Math.abs(e[f]-o[f]);if(ne<=l){const E=Math.min(l-1,l-ne);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*E:_[f]=(d[f]>o[f]?-1:1)*E}}if(t!==i){const ne=f==="x"?"y":"x",E=r[f]===s[ne],S=c[ne]>d[ne],I=c[ne]<d[ne];(r[f]===1&&(!E&&S||E&&I)||r[f]!==1&&(!E&&I||E&&S))&&(m=f==="x"?K:T)}const ie={x:c.x+b.x,y:c.y+b.y},te={x:d.x+_.x,y:d.y+_.y},fe=Math.max(Math.abs(ie.x-m[0].x),Math.abs(te.x-m[0].x)),M=Math.max(Math.abs(ie.y-m[0].y),Math.abs(te.y-m[0].y));fe>=M?(p=(ie.x+te.x)/2,g=m[0].y):(p=m[0].x,g=(ie.y+te.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,g,x,q]}function Nb(e,t,o,i){const a=Math.min(td(e,t)/2,td(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 rl(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,g]=kb({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,N,y)=>{let x;return y>0&&y<f.length-1?x=Nb(f[y-1],N,f[y+1],s):x=`${y===0?"M":"L"}${N.x} ${N.y}`,_+=x,_},""),h,m,p,g]}function Ib(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=qc({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const $b=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]=Ib(e);return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),nd=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]=rl({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),xb=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(nd,{...e,...t,borderRadius:0})}}),Sb=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]=Zc({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),Cb=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=Qc({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),Rb={input:mb,default:ub,output:fb},Vb={default:Sb,straight:$b,step:xb,smoothstep:nd,simplebezier:Cb};function Ab(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),l=n.computed(()=>{const g={...Vb,...e.edgeTypes},b=Object.keys(g);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),r=n.computed(()=>{const g={...Rb,...e.nodeTypes},b=Object.keys(g);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?bc(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const b of e.edges){const _=t.value.get(b.source),N=t.value.get(b.target);Tg({sourcePos:_.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(b)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const b of e.nodes)b.selected&&g.push(b);return g}),f=n.computed(()=>{const g=[];for(const b of e.edges)b.selected&&g.push(b);return g}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const g=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&g.push(b);return g}),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 mn{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)??mn.instance;return mn.instance=i??new mn,o&&(o.config.globalProperties.$vueFlowStorage=mn.instance),mn.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=Kc(),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=Ab(a,s,c),u=sb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Cm(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 Me(e){const t=mn.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(zc,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)},g=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),Jn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():bo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(zc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Fe(Ue.USEVUEFLOW_OPTIONS))}return s}function Tb(e){const{emits:t,dimensions:o}=Me();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=pi(e.value);(s.width===0||s.height===0)&&t.error(new Fe(Ue.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};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 Mb={name:"UserSelection",compatConfig:{MODE:3}},Bb=n.defineComponent({...Mb,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))}}),Db=["tabIndex"],Ob={name:"NodesSelection",compatConfig:{MODE:3}},Lb=n.defineComponent({...Ob,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Me(),s=Wc(),c=n.ref(null),d=Fc({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(()=>Xa(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||Vn[p.key]&&(p.preventDefault(),s({x:Vn[p.key].x,y:Vn[p.key].y},p.shiftKey))}return(p,g)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:m},null,46,Db)],6)):n.createCommentVNode("",!0)}});function Pb(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const zb={name:"Pane",compatConfig:{MODE:3}},Ub=n.defineComponent({...zb,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:g,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:N,nodeLookup:y,connectionLookup:x,defaultEdgeOptions:q,connectionStartHandle:P,panOnDrag:K}=Me(),T=n.shallowRef(null),ie=n.shallowRef(new Set),te=n.shallowRef(new Set),fe=n.shallowRef(null),M=n.toRef(()=>c.value&&(e.isSelecting||l.value)),ne=n.toRef(()=>P.value!==null);let E=!1,S=!1;const I=fo(g,{actInsideInputWithModifier:!1}),B=fo(b);n.watch(I,re=>{re&&(h(f.value),m(u.value),d.value=!1)}),n.watch(B,re=>{_.value=re});function G(re,ye){return be=>{be.target===ye&&(re==null||re(be))}}function X(re){if(E||ne.value){E=!1;return}a.paneClick(re),r(),d.value=!1}function A(re){var ye;if(Array.isArray(K.value)&&((ye=K.value)!=null&&ye.includes(2))){re.preventDefault();return}a.paneContextMenu(re)}function ae(re){a.paneScroll(re)}function se(re){var ye,be,$e;if(fe.value=((ye=t.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||re.button!==0||re.target!==T.value||!fe.value)return;($e=(be=re.target)==null?void 0:be.setPointerCapture)==null||$e.call(be,re.pointerId);const{x:Se,y:Ce}=Pb(re,fe.value);S=!0,E=!1,r(),s.value={width:0,height:0,startX:Se,startY:Ce,x:Se,y:Ce},a.selectionStart(re)}function ge(re){var ye;if(!fe.value||!s.value)return;E=!0;const{x:be,y:$e}=wt(re,fe.value),{startX:Se=0,startY:Ce=0}=s.value,Y={startX:Se,startY:Ce,x:be<Se?be:Se,y:$e<Ce?$e:Ce,width:Math.abs(be-Se),height:Math.abs($e-Ce)},U=ie.value,V=te.value;ie.value=new Set(bc(o.value,Y,i.value,p.value===Wa.Partial,!0).map(R=>R.id)),te.value=new Set;const C=((ye=q.value)==null?void 0:ye.selectable)??!0;for(const R of ie.value){const O=x.value.get(R);if(O)for(const{edgeId:oe}of O.values()){const j=N.value.get(oe);j&&(j.selectable??C)&&te.value.add(oe)}}if(!Pc(U,ie.value)){const R=Ft(y.value,ie.value,!0);a.nodesChange(R)}if(!Pc(V,te.value)){const R=Ft(N.value,te.value);a.edgesChange(R)}s.value=Y,l.value=!0,d.value=!1}function _e(re){var ye;re.button!==0||!S||((ye=re.target)==null||ye.releasePointerCapture(re.pointerId),!l.value&&s.value&&re.target===T.value&&X(re),l.value=!1,s.value=null,d.value=ie.value.size>0,a.selectionEnd(re),e.selectionKeyPressed&&(E=!1),S=!1)}return(re,ye)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:T,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:re.isSelecting}]),onClick:ye[0]||(ye[0]=be=>M.value?void 0:G(X,T.value)(be)),onContextmenu:ye[1]||(ye[1]=be=>G(A,T.value)(be)),onWheelPassive:ye[2]||(ye[2]=be=>G(ae,T.value)(be)),onPointerenter:ye[3]||(ye[3]=be=>M.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:ye[4]||(ye[4]=be=>M.value?se(be):n.unref(a).paneMouseMove(be)),onPointermove:ye[5]||(ye[5]=be=>M.value?ge(be):n.unref(a).paneMouseMove(be)),onPointerup:ye[6]||(ye[6]=be=>M.value?_e(be):void 0),onPointerleave:ye[7]||(ye[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(re.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(Bb,{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(Lb,{key:1})):n.createCommentVNode("",!0)],34))}}),Hb={name:"Transform",compatConfig:{MODE:3}},Fb=n.defineComponent({...Hb,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Me(),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))}}),Gb={name:"Viewport",compatConfig:{MODE:3}},Yb=n.defineComponent({...Gb,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:g,noWheelClassName:b,noPanClassName:_,emits:N,connectionStartHandle:y,userSelectionActive:x,paneDragging:q,d3Zoom:P,d3Selection:K,d3ZoomHandler:T,viewport:ie,viewportRef:te,paneClickDistance:fe}=Me();Tb(te);const M=n.shallowRef(!1),ne=n.shallowRef(!1);let E=null,S=!1,I=0,B={x:0,y:0,zoom:0};const G=fo(s),X=fo(r),A=fo(l),ae=n.toRef(()=>(!X.value||X.value&&r.value===!0)&&(G.value||f.value)),se=n.toRef(()=>G.value||c.value),ge=n.toRef(()=>r.value===!0&&ae.value!==!0),_e=n.toRef(()=>X.value&&r.value!==!0||x.value||ge.value),re=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!te.value){bo("Viewport element is missing");return}const Ce=te.value,Y=Ce.getBoundingClientRect(),U=mg().clickDistance(fe.value).scaleExtent([t.value,o.value]).translateExtent(a.value),V=ct(Ce).call(U),C=V.on("wheel.zoom"),R=Rn.translate(i.value.x??0,i.value.y??0).scale(cn(i.value.zoom??1,t.value,o.value)),O=[[0,0],[Y.width,Y.height]],oe=U.constrain()(R,O,a.value);U.transform(V,oe),U.wheelDelta(ja),P.value=U,K.value=V,T.value=C,ie.value={x:oe.x,y:oe.y,zoom:oe.k},U.on("start",j=>{var k;if(!j.sourceEvent)return null;I=j.sourceEvent.button,M.value=!0;const $=$e(j.transform);((k=j.sourceEvent)==null?void 0:k.type)==="mousedown"&&(q.value=!0),B=$,N.viewportChangeStart($),N.moveStart({event:j,flowTransform:$})}),U.on("end",j=>{if(!j.sourceEvent)return null;if(M.value=!1,q.value=!1,ye(ae.value,I??0)&&!S&&N.paneContextMenu(j.sourceEvent),S=!1,be(B,j.transform)){const k=$e(j.transform);B=k,N.viewportChangeEnd(k),N.moveEnd({event:j,flowTransform:k})}}),U.filter(j=>{var k;const $=A.value||p.value,L=m.value&&j.ctrlKey,Q=j.button,ce=j.type==="wheel";if(Q===1&&j.type==="mousedown"&&(Se(j,"vue-flow__node")||Se(j,"vue-flow__edge")))return!0;if(!ae.value&&!$&&!se.value&&!h.value&&!m.value||x.value||re.value&&!ce||!h.value&&j.type==="dblclick"||Se(j,b.value)&&ce||Se(j,_.value)&&(!ce||se.value&&ce&&!A.value)||!m.value&&j.ctrlKey&&ce||!$&&!se.value&&!L&&ce)return!1;if(!m&&j.type==="touchstart"&&((k=j.touches)==null?void 0:k.length)>1)return j.preventDefault(),!1;if(!ae.value&&(j.type==="mousedown"||j.type==="touchstart")||ge.value&&Array.isArray(f.value)&&f.value.includes(0)&&Q===0||Array.isArray(f.value)&&!f.value.includes(Q)&&(j.type==="mousedown"||j.type==="touchstart"))return!1;const me=Array.isArray(f.value)&&f.value.includes(Q)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Q||Q<=1;return(!j.ctrlKey||G.value||ce)&&me}),n.watch([x,ae],()=>{x.value&&!M.value?U.on("zoom",null):x.value||U.on("zoom",j=>{ie.value={x:j.transform.x,y:j.transform.y,zoom:j.transform.k};const k=$e(j.transform);S=ye(ae.value,I??0),N.viewportChange(k),N.move({event:j,flowTransform:k})})},{immediate:!0}),n.watch([x,se,d,A,m,g,b],()=>{se.value&&!A.value&&!x.value?V.on("wheel.zoom",j=>{if(Se(j,b.value))return!1;const k=A.value||p.value,$=m.value&&j.ctrlKey;if(!(!g.value||se.value||k||$))return!1;j.preventDefault(),j.stopImmediatePropagation();const Q=V.property("__zoom").k||1,ce=go();if(!G.value&&j.ctrlKey&&m.value&&ce){const w=yt(j),v=ja(j),z=Q*2**v;U.scaleTo(V,z,w,j);return}const me=j.deltaMode===1?20:1;let he=d.value===uo.Vertical?0:j.deltaX*me,we=d.value===uo.Horizontal?0:j.deltaY*me;!ce&&j.shiftKey&&d.value!==uo.Vertical&&!he&&we&&(he=we,we=0),U.translateBy(V,-(he/Q)*u.value,-(we/Q)*u.value);const D=$e(V.property("__zoom"));E&&clearTimeout(E),ne.value?(N.move({event:j,flowTransform:D}),N.viewportChange(D),E=setTimeout(()=>{N.moveEnd({event:j,flowTransform:D}),N.viewportChangeEnd(D),ne.value=!1},150)):(ne.value=!0,N.moveStart({event:j,flowTransform:D}),N.viewportChangeStart(D))},{passive:!1}):typeof C<"u"&&V.on("wheel.zoom",function(j,k){const $=!g.value&&j.type==="wheel"&&!j.ctrlKey,L=A.value||p.value,Q=m.value&&j.ctrlKey;if(!L&&!c.value&&!Q&&j.type==="wheel"||$||Se(j,b.value))return null;j.preventDefault(),C.call(this,j,k)},{passive:!1})},{immediate:!0})});function ye(Ce,Y){return Y===2&&Array.isArray(Ce)&&Ce.includes(2)}function be(Ce,Y){return Ce.x!==Y.x&&!Number.isNaN(Y.x)||Ce.y!==Y.y&&!Number.isNaN(Y.y)||Ce.zoom!==Y.k&&!Number.isNaN(Y.k)}function $e(Ce){return{x:Ce.x,y:Ce.y,zoom:Ce.k}}function Se(Ce,Y){return Ce.target.closest(`.${Y}`)}return(Ce,Y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:te,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(Ub,{"is-selecting":_e.value,"selection-key-pressed":n.unref(X),class:n.normalizeClass({connecting:re.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(Fb,null,{default:n.withCtx(()=>[n.renderSlot(Ce.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Wb=["id"],Kb=["id"],qb=["id"],Xb={name:"A11yDescriptions",compatConfig:{MODE:3}},jb=n.defineComponent({...Xb,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Me();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(sc)}-${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,Wb),n.createElementVNode("div",{id:`${n.unref(cc)}-${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,Kb),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(_g)}-${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,qb))],64))}});function Zb(){const e=Me();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Jb(e,t,o){return o===Ie.Left?e-t:o===Ie.Right?e+t:e}function Qb(e,t,o){return o===Ie.Top?e-t:o===Ie.Bottom?e+t:e}const sl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Ie.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:Jb(t,e,i),cy:Qb(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};sl.props=["radius","centerX","centerY","position","type"],sl.compatConfig={MODE:3};const od=sl,e0=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:g,edgesUpdatable:b,edgesFocusable:_,hooks:N}=Me(),y=n.computed(()=>u(e.id)),{emit:x,on:q}=Xg(y.value,l),P=n.inject(bi),K=n.getCurrentInstance(),T=n.ref(!1),ie=n.ref(!1),te=n.ref(""),fe=n.ref(null),M=n.ref("source"),ne=n.ref(null),E=n.toRef(()=>typeof y.value.selectable>"u"?g.value:y.value.selectable),S=n.toRef(()=>typeof y.value.updatable>"u"?b.value:y.value.updatable),I=n.toRef(()=>typeof y.value.focusable>"u"?_.value:y.value.focusable);n.provide(Wg,e.id),n.provide(Kg,ne);const B=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),G=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),X=n.computed(()=>{const R=y.value.type||"default",O=P==null?void 0:P[`edge-${R}`];if(O)return O;let oe=y.value.template??c.value[R];if(typeof oe=="string"&&K){const j=Object.keys(K.appContext.components);j&&j.includes(R)&&(oe=n.resolveComponent(R,!1))}return oe&&typeof oe!="string"?oe:(l.error(new Fe(Ue.EDGE_TYPE_MISSING,oe)),!1)}),{handlePointerDown:A}=Gc({nodeId:te,handleId:fe,type:M,isValidConnection:h,edgeUpdaterType:M,onEdgeUpdate:ge,onEdgeUpdateEnd:_e});return()=>{const R=f(y.value.source),O=f(y.value.target),oe="pathOptions"in y.value?y.value.pathOptions:{};if(!R&&!O)return l.error(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!R)return l.error(new Fe(Ue.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!O)return l.error(new Fe(Ue.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||R.hidden||O.hidden)return null;let j;i.value===At.Strict?j=R.handleBounds.source:j=[...R.handleBounds.source||[],...R.handleBounds.target||[]];const k=Rc(j,y.value.sourceHandle);let $;i.value===At.Strict?$=O.handleBounds.target:$=[...O.handleBounds.target||[],...O.handleBounds.source||[]];const L=Rc($,y.value.targetHandle),Q=(k==null?void 0:k.position)||Ie.Bottom,ce=(L==null?void 0:L.position)||Ie.Top,{x:me,y:he}=Tn(R,k,Q),{x:we,y:D}=Tn(O,L,ce);return y.value.sourceX=me,y.value.sourceY=he,y.value.targetX=we,y.value.targetY=D,n.h("g",{ref:ne,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${X.value===!1?"default":y.value.type||"default"}`,s.value,B.value,{updating:T.value,selected:y.value.selected,animated:y.value.animated,inactive:!E.value&&!N.value.edgeClick.hasListeners()}],tabIndex:I.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":I.value?`${cc}-${t}`:void 0,"aria-roledescription":"edge",role:I.value?"group":"img",...y.value.domAttributes,onClick:ye,onContextmenu:be,onDblclick:$e,onMouseenter:Se,onMousemove:Ce,onMouseleave:Y,onKeyDown:I.value?C:void 0},[ie.value?null:n.h(X.value===!1?c.value.default:X.value,{id:e.id,sourceNode:R,targetNode:O,source:y.value.source,target:y.value.target,type:y.value.type,updatable:S.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:G.value,markerStart:`url('#${yo(y.value.markerStart,t)}')`,markerEnd:`url('#${yo(y.value.markerEnd,t)}')`,sourcePosition:Q,targetPosition:ce,sourceX:me,sourceY:he,targetX:we,targetY:D,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...oe}),[S.value==="source"||S.value===!0?[n.h("g",{onMousedown:U,onMouseenter:ae,onMouseout:se},n.h(od,{position:Q,centerX:me,centerY:he,radius:a.value,type:"source","data-type":"source"}))]:null,S.value==="target"||S.value===!0?[n.h("g",{onMousedown:V,onMouseenter:ae,onMouseout:se},n.h(od,{position:ce,centerX:we,centerY:D,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ae(){T.value=!0}function se(){T.value=!1}function ge(R,O){x.update({event:R,edge:y.value,connection:O})}function _e(R){x.updateEnd({event:R,edge:y.value}),ie.value=!1}function re(R,O){R.button===0&&(ie.value=!0,te.value=O?y.value.target:y.value.source,fe.value=(O?y.value.targetHandle:y.value.sourceHandle)??null,M.value=O?"target":"source",x.updateStart({event:R,edge:y.value}),A(R))}function ye(R){var O;const oe={event:R,edge:y.value};E.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(O=ne.value)==null||O.blur()):o([y.value])),x.click(oe)}function be(R){x.contextMenu({event:R,edge:y.value})}function $e(R){x.doubleClick({event:R,edge:y.value})}function Se(R){x.mouseEnter({event:R,edge:y.value})}function Ce(R){x.mouseMove({event:R,edge:y.value})}function Y(R){x.mouseLeave({event:R,edge:y.value})}function U(R){re(R,!0)}function V(R){re(R,!1)}function C(R){var O;!p.value&&dc.includes(R.key)&&E.value&&(R.key==="Escape"?((O=ne.value)==null||O.blur(),d([u(e.id)])):o([u(e.id)]))}}}),t0=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}=Me(),h=(e=n.inject(bi))==null?void 0:e["connection-line"],m=n.computed(()=>{var N;return f((N=i.value)==null?void 0:N.nodeId)}),p=n.computed(()=>{var N;return f((N=a.value)==null?void 0:N.nodeId)??null}),g=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${yo(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${yo(c.value.markerEnd,t)})`:"");return()=>{var N,y,x;if(!m.value||!i.value)return null;const q=i.value.id,P=i.value.type,K=m.value.handleBounds;let T=(K==null?void 0:K[P])??[];if(o.value===At.Loose){const G=(K==null?void 0:K[P==="source"?"target":"source"])??[];T=[...T,...G]}if(!T)return null;const ie=(q?T.find(G=>G.id===q):T[0])??null,te=(ie==null?void 0:ie.position)??Ie.Top,{x:fe,y:M}=Tn(m.value,ie,te);let ne=null;p.value&&(o.value===At.Strict?ne=((N=p.value.handleBounds[P==="source"?"target":"source"])==null?void 0:N.find(G=>{var X;return G.id===((X=a.value)==null?void 0:X.id)}))||null:ne=((y=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:y.find(G=>{var X;return G.id===((X=a.value)==null?void 0:X.id)}))||null);const E=((x=a.value)==null?void 0:x.position)??(te?nl[te]:null);if(!te||!E)return null;const S=r.value??c.value.type??sn.Bezier;let I="";const B={sourceX:fe,sourceY:M,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:E};return S===sn.Bezier?[I]=Zc(B):S===sn.Step?[I]=rl({...B,borderRadius:0}):S===sn.SmoothStep?[I]=rl(B):S===sn.SimpleBezier?[I]=Qc(B):I=`M${fe},${M} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},h?n.h(h,{sourceX:fe,sourceY:M,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:E,sourceNode:m.value,sourceHandle:ie,targetNode:p.value,targetHandle:ne,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):n.h("path",{d:I,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),n0=["id","markerWidth","markerHeight","markerUnits","orient"],o0={name:"MarkerType",compatConfig:{MODE:3}},i0=n.defineComponent({...o0,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(Ka).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(Ka).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,n0))}}),a0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},l0={name:"MarkerDefinitions",compatConfig:{MODE:3}},r0=n.defineComponent({...l0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Me(),l=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=yo(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",a0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(i0,{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))])]))}}),s0={name:"Edges",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Me();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(r0),(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(Mg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(e0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(t0))],64))}}),d0=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:g,snapToGrid:b,snapGrid:_,nodeDragThreshold:N,nodesDraggable:y,elementsSelectable:x,nodesConnectable:q,nodesFocusable:P,hooks:K}=Me(),T=n.ref(null);n.provide(Hc,T),n.provide(Uc,e.id);const ie=n.inject(bi),te=n.getCurrentInstance(),fe=Wc(),{node:M,parentNode:ne}=Yc(e.id),{emit:E,on:S}=Qg(M,r),I=n.toRef(()=>typeof M.draggable>"u"?y.value:M.draggable),B=n.toRef(()=>typeof M.selectable>"u"?x.value:M.selectable),G=n.toRef(()=>typeof M.connectable>"u"?q.value:M.connectable),X=n.toRef(()=>typeof M.focusable>"u"?P.value:M.focusable),A=n.computed(()=>B.value||I.value||K.value.nodeClick.hasListeners()||K.value.nodeDoubleClick.hasListeners()||K.value.nodeMouseEnter.hasListeners()||K.value.nodeMouseMove.hasListeners()||K.value.nodeMouseLeave.hasListeners()),ae=n.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),se=n.computed(()=>{const O=M.type||"default",oe=ie==null?void 0:ie[`node-${O}`];if(oe)return oe;let j=M.template||f.value[O];if(typeof j=="string"&&te){const k=Object.keys(te.appContext.components);k&&k.includes(O)&&(j=n.resolveComponent(O,!1))}return j&&typeof j!="string"?j:(r.error(new Fe(Ue.NODE_TYPE_MISSING,j)),!1)}),ge=Fc({id:e.id,el:T,disabled:()=>!I.value,selectable:B,dragHandle:()=>M.dragHandle,onStart(O){E.dragStart(O)},onDrag(O){E.drag(O)},onStop(O){E.dragStop(O)},onClick(O){C(O)}}),_e=n.computed(()=>M.class instanceof Function?M.class(M):M.class),re=n.computed(()=>{const O=(M.style instanceof Function?M.style(M):M.style)||{},oe=M.width instanceof Function?M.width(M):M.width,j=M.height instanceof Function?M.height(M):M.height;return!O.width&&oe&&(O.width=typeof oe=="string"?oe:`${oe}px`),!O.height&&j&&(O.height=typeof j=="string"?j:`${j}px`),O}),ye=n.toRef(()=>Number(M.zIndex??re.value.zIndex??0));return u(O=>{(O.includes(e.id)||!O.length)&&$e()}),n.onMounted(()=>{n.watch(()=>M.hidden,(O=!1,oe,j)=>{!O&&T.value&&(e.resizeObserver.observe(T.value),j(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),n.watch([()=>M.position.x,()=>M.position.y,()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.x},()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.y},()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.z},ye,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var O;return(O=ne.value)==null?void 0:O.dimensions.height},()=>{var O;return(O=ne.value)==null?void 0:O.dimensions.width}],([O,oe,j,k,$,L])=>{const Q={x:O,y:oe,z:L+(m.value&&M.selected?1e3:0)};typeof j<"u"&&typeof k<"u"?M.computedPosition=Sg({x:j,y:k,z:$},Q):M.computedPosition=Q},{flush:"post",immediate:!0}),n.watch([()=>M.extent,h],([O,oe],[j,k])=>{(O!==j||oe!==k)&&be()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?Ia(()=>ae).toBe(!0).then(be):be(),()=>M.hidden?null:n.h("div",{ref:T,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${se.value===!1?"default":M.type||"default"}`,{[o.value]:I.value,dragging:ge==null?void 0:ge.value,draggable:I.value,selected:M.selected,selectable:B.value,parent:M.isParent},_e.value],style:{visibility:ae.value?"visible":"hidden",zIndex:M.computedPosition.z??ye.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...re.value},tabIndex:X.value?0:void 0,role:X.value?"group":void 0,"aria-describedby":p.value?void 0:`${sc}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:Se,onMousemove:Ce,onMouseleave:Y,onContextmenu:U,onClick:C,onDblclick:V,onKeydown:R},[n.h(se.value===!1?f.value.default:se.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...S},selected:M.selected,resizing:M.resizing,dragging:ge.value,connectable:G.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??ye.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:$e})]);function be(){const O=M.computedPosition,{computedPosition:oe,position:j}=Qa(M,b.value?gi(O,_.value):O,r.error,h.value,ne.value);(M.computedPosition.x!==oe.x||M.computedPosition.y!==oe.y)&&(M.computedPosition={...M.computedPosition,...oe}),(M.position.x!==j.x||M.position.y!==j.y)&&(M.position=j)}function $e(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function Se(O){ge!=null&&ge.value||E.mouseEnter({event:O,node:M})}function Ce(O){ge!=null&&ge.value||E.mouseMove({event:O,node:M})}function Y(O){ge!=null&&ge.value||E.mouseLeave({event:O,node:M})}function U(O){return E.contextMenu({event:O,node:M})}function V(O){return E.doubleClick({event:O,node:M})}function C(O){B.value&&(!i.value||!I.value||N.value>0)&&ol(M,l.value,c,s,a,!1,T.value),E.click({event:O,node:M})}function R(O){if(!(qa(O)||p.value))if(dc.includes(O.key)&&B.value){const oe=O.key==="Escape";ol(M,l.value,c,s,a,oe,T.value)}else I.value&&M.selected&&Vn[O.key]&&(O.preventDefault(),g.value=`Moved selected node ${O.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,fe({x:Vn[O.key].x,y:Vn[O.key].y},O.shiftKey))}}});function u0(e={includeHiddenNodes:!1}){const{nodes:t}=Me();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 f0={class:"vue-flow__nodes vue-flow__container"},m0={name:"Nodes",compatConfig:{MODE:3}},p0=n.defineComponent({...m0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Me(),a=u0(),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",f0,[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(d0),{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 h0(){const{emits:e}=Me();n.onMounted(()=>{if(Bc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Fe(Ue.MISSING_STYLES))}})}const y0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),g0={name:"VueFlow",compatConfig:{MODE:3}},b0=n.defineComponent({...g0,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=$a(i,"modelValue",o),r=$a(i,"nodes",o),s=$a(i,"edges",o),c=Me(i),d=ob({modelValue:l,nodes:r,edges:s},i,c);return ab(o,c.hooks),Zb(),h0(),n.provide(bi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(Yb,null,{default:n.withCtx(()=>[n.createVNode(c0),y0,n.createVNode(p0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(jb)],512))}}),_0={name:"Panel",compatConfig:{MODE:3}},id=n.defineComponent({..._0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Me(),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))}}),pn=["red","amber","green","teal","blue","indigo","violet","pink"],ad={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function w0(e){return typeof e=="string"&&e in ad}const v0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},E0=.15;function k0(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 N0(e){if(typeof e!="string")return null;const t=k0(e);if(!t||t.s<E0)return null;let o=null,i=1/0;for(const a of pn){const l=Math.abs(t.h-v0[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function Xe(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(w0(t))return t;const o=e==null?void 0:e.properties;return N0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function cl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const I0={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)"},$0={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 ld(e,t=!1){return e?t?$0[e]:I0[e]:null}function Mn(e){return ad[e]}function Bn(e){return`var(--em-swatch-${e}-bar)`}const x0=["width","height","innerHTML"],S0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,x0))}}),De=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=De(S0,[["__scopeId","data-v-04de464d"]]),C0={class:"em-inline-issue__msgs"},hn=De(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",C0,[(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"]]),R0={class:"em-mlang"},V0={class:"em-mlang__tabs",role:"tablist"},A0=["aria-selected","onClick"],T0={key:0,class:"em-mlang__dot"},dl=De(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",R0,[n.createElementVNode("div",V0,[(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",T0,"•")):n.createCommentVNode("",!0)],10,A0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(le.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(le.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"]]),M0=["disabled"],B0={class:"em-panel__sub-label"},D0={class:"em-field"},O0={class:"em-field"},L0={class:"em-field"},P0={class:"em-class"},z0={class:"em-field"},U0={class:"em-field"},H0={class:"em-field"},F0={class:"em-field"},G0={class:"em-multilang"},Y0={class:"em-multilang"},W0={class:"em-jpa"},K0={class:"em-field"},q0={class:"em-field"},X0={class:"em-field"},j0={class:"em-swatch"},Z0={class:"em-swatch__row"},J0=["title","onClick"],rd=De(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(M=>M.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(M=>M.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var M;return Xe(((M=r.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=M=>M;function h(M){return M==="inherit"?"기본(따름)":M}function m(M){l.value&&a.updateEntity(l.value.modelId,M)}function p(M,ne,E){var I;const S=((I=l.value)==null?void 0:I.table)??{physicalName:""};m(M==="physicalName"?{table:{...S,physicalName:E}}:{table:{...S,logicalName:{...S.logicalName,[ne]:E}}})}function g(M){m({description:Object.keys(M).length?M:void 0})}function b(M,ne){var E;m({jpaAttrs:{...(E=l.value)==null?void 0:E.jpaAttrs,[M]:ne}})}function _(M,ne){b(M,ne)}const N=n.computed(()=>{var M,ne;return((ne=(M=l.value)==null?void 0:M.jpaAttrs)==null?void 0:ne.discriminatorType)??"inherit"}),y=n.computed(()=>{var M,ne;return!((ne=(M=l.value)==null?void 0:M.jpaAttrs)!=null&&ne.useDiscriminator)});function x(M){b("discriminatorType",M==="inherit"?void 0:M)}function q(M){m({hasPersonalInfo:M})}function P(M){m({superClass:M.trim()||void 0})}function K(M){m({schema:M.trim()||void 0})}function T(M){m({abstractClass:M})}const ie=n.computed(()=>{var M,ne;return((ne=(M=l.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:ne.join(", "))??""});function te(M){const ne=M.split(",").map(E=>E.trim()).filter(Boolean);m({declarationOfInterfaces:ne.length?ne:void 0})}function fe(M){l.value&&a.setEntitySwatch(l.value.modelId,M)}return(M,ne)=>{var E,S,I;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:ne[0]||(ne[0]=B=>i("toggle"))},[n.createElementVNode("span",B0,[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(hn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",D0,[ne[13]||(ne[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":ne[1]||(ne[1]=B=>m({name:B}))},null,8,["model-value"])]),n.createElementVNode("label",O0,[ne[14]||(ne[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":ne[2]||(ne[2]=B=>m({stereotype:B}))},null,8,["model-value"])]),n.createElementVNode("label",L0,[ne[15]||(ne[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":ne[3]||(ne[3]=B=>m({packageName:B}))},null,8,["model-value"])]),n.createElementVNode("fieldset",P0,[ne[18]||(ne[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",z0,[ne[16]||(ne[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":ne[4]||(ne[4]=B=>P(B))},null,8,["model-value"])]),n.createElementVNode("label",U0,[ne[17]||(ne[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":ie.value,"onUpdate:modelValue":ne[5]||(ne[5]=B=>te(B))},null,8,["model-value"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":ne[6]||(ne[6]=B=>T(B))},null,8,["model-value"])]),n.createElementVNode("label",H0,[ne[19]||(ne[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=l.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":ne[7]||(ne[7]=B=>p("physicalName",null,B))},null,8,["model-value"])]),n.createElementVNode("label",F0,[ne[20]||(ne[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":ne[8]||(ne[8]=B=>K(B))},null,8,["model-value"])]),n.createElementVNode("fieldset",G0,[ne[21]||(ne[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,B=>{var G,X;return n.openBlock(),n.createElementBlock("label",{key:B,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(B),1),n.createVNode(n.unref(le.BSTextInput),{name:`ent-logical-${B}`,width:"100%","model-value":((X=(G=l.value.table)==null?void 0:G.logicalName)==null?void 0:X[B])??"","onUpdate:modelValue":A=>p("logicalName",B,A)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",Y0,[ne[22]||(ne[22]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(dl,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":l.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",W0,[ne[26]||(ne[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,B=>{var G;return n.createVNode(n.unref(le.BSCheckbox),{key:B.key,name:`jpa-${B.key}`,class:"em-check",label:B.label,"model-value":!!((G=l.value.jpaAttrs)!=null&&G[B.key]),"onUpdate:modelValue":X=>_(B.key,X)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",K0,[ne[23]||(ne[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((S=l.value.jpaAttrs)==null?void 0:S.discriminatorColumnName)??"","onUpdate:modelValue":ne[9]||(ne[9]=B=>b("discriminatorColumnName",B.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",q0,[ne[24]||(ne[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(le.BSSelect),{disabled:y.value,"model-value":N.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":ne[10]||(ne[10]=B=>B&&x(B))},null,8,["disabled","model-value"])]),n.createElementVNode("label",X0,[ne[25]||(ne[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(le.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":(I=l.value.jpaAttrs)==null?void 0:I.discriminatorLength,"onUpdate:modelValue":ne[11]||(ne[11]=B=>b("discriminatorLength",B||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(le.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",j0,[ne[27]||(ne[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",Z0,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:ne[12]||(ne[12]=B=>fe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),B=>(n.openBlock(),n.createElementBlock("button",{key:B,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===B}]),style:n.normalizeStyle({background:n.unref(Bn)(B)}),title:n.unref(Mn)(B),onClick:G=>fe(B)},null,14,J0))),128))])])],64)):n.createCommentVNode("",!0)],8,M0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),sd=["ko","en","ja","zh"];function Q0(e){if(e)for(const t of sd){const o=e[t];if(o)return o}}function ul(e){const t=Q0(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function e1(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:sd.some(a=>{var l,r;return(r=(l=i.label)==null?void 0:l[a])==null?void 0:r.toLowerCase().includes(o)})):e}const t1=["aria-expanded"],n1=["aria-selected","onClick","onMouseenter"],o1={key:0,class:"gcc__opt gcc__opt--empty"},cd=De(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(T=>T.groupCode===o.modelValue)),h=n.computed(()=>f.value?ul(f.value):"");n.watch(h,T=>{c.value||(s.value=T)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:e1(o.items,s.value));function p(){var ie;const T=(ie=a.value)==null?void 0:ie.getBoundingClientRect();T&&(u.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function g(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",K)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",K)}n.onBeforeUnmount(b);function _(){g(),n.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function N(){c.value||g(),d.value=0}function y(T){i("update:modelValue",T.groupCode),s.value=ul(T),b()}function x(){i("update:modelValue",void 0),s.value="",b()}function q(){s.value.trim()===""?x():(s.value=h.value,b())}function P(T){var ie;if(T.key==="ArrowDown")c.value||g(),d.value=Math.min(d.value+1,m.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")d.value=Math.max(d.value-1,0),T.preventDefault();else if(T.key==="Enter"){const te=m.value[d.value];te&&y(te),T.preventDefault()}else T.key==="Escape"&&(s.value=h.value,b(),(ie=l.value)==null||ie.blur())}function K(T){var te,fe;const ie=T.target;!((te=a.value)!=null&&te.contains(ie))&&!((fe=r.value)!=null&&fe.contains(ie))&&q()}return(T,ie)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":ie[0]||(ie[0]=te=>s.value=te),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:N,onKeydown:P},null,40,t1),[[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:ie[1]||(ie[1]=n.withModifiers(()=>{},["prevent"])),onClick:x},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(te,fe)=>(n.openBlock(),n.createElementBlock("li",{key:te.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":fe===d.value,"is-selected":te.groupCode===e.modelValue}]),role:"option","aria-selected":te.groupCode===e.modelValue,onMousedown:ie[2]||(ie[2]=n.withModifiers(()=>{},["prevent"])),onClick:M=>y(te),onMouseenter:M=>d.value=fe},n.toDisplayString(n.unref(ul)(te)),43,n1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",o1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),i1=["disabled"],a1={class:"em-aw__toolbar"},l1={class:"em-aw__count"},r1={class:"em-aw__scroll"},s1={class:"em-aw__table"},c1={key:0,class:"c-code"},d1=["colspan"],u1={class:"c-del"},f1={class:"c-flag"},m1={class:"c-flag"},p1={class:"c-flag"},h1={class:"c-flag"},y1={class:"c-flag"},g1={class:"c-flag"},b1={class:"c-flag"},_1={class:"c-flag"},w1={key:0},v1={class:"c-del"},E1=["colspan"],k1={class:"c-del"},N1={class:"em-aw__embed-label"},I1={class:"em-aw__ro"},$1={class:"em-aw__ro"},x1={class:"em-aw__ro"},S1={class:"em-aw__ro"},C1={colspan:"8"},R1=["colspan"],V1={key:0},$i="__OWN__",A1=De(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(D=>D.modelId===t.entityId)??null),a=n.computed(()=>{var D;return((D=i.value)==null?void 0:D.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var D;return(((D=i.value)==null?void 0:D.attributes)??[]).filter(w=>w.attrType!=="DIVIDER").length}),s=n.computed(()=>E.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(D){return D==="none"?"(없음)":D}const u=D=>D;function f(D,w){i.value&&o.updateAttribute(i.value.modelId,D.modelId,w)}function h(D,w){f(D,{naturalId:w||void 0,naturalIdMutable:w?D.naturalIdMutable:void 0})}function m(){return{naturalId:void 0,naturalIdMutable:void 0}}function p(D,w){f(D,{identifier:w,...w?m():{}})}function g(D,w){f(D,{transient:w||void 0,...w?m():{}})}function b(D){return!!D.transient}const _=D=>D.value,N=D=>D.label;function y(D,w){if(!w)return;const v=te.value.find(z=>z.type===w);if(v){const z=D.dbAttrs[0]??{modelId:D.modelId+".c",physicalName:D.name,dataType:"VARCHAR"};f(D,{type:w,customType:void 0,dbAttrs:[{...z,dataType:v.dataType,length:v.length,scale:v.scale}]});return}f(D,w===Jt?{type:w}:{type:w,customType:void 0})}function x(D,w){f(D,{customType:w.trim()===""?void 0:w})}function q(D,w){const z={...D.dbAttrs[0]??{modelId:D.modelId+".c",physicalName:D.name,dataType:"VARCHAR"},...w};w.dataType!==void 0&&!Mo.has(z.dataType)&&(z.scale=void 0),f(D,{dbAttrs:[z]})}function P(D){var w;return Mo.has(((w=D.dbAttrs[0])==null?void 0:w.dataType)??"")}function K(D,w,v){var z;q(D,{logicalName:{...(z=D.dbAttrs[0])==null?void 0:z.logicalName,[w]:v}})}function T(D){return D.personalInfoAttributeType??"none"}function ie(D,w){f(D,{personalInfoAttributeType:w==="none"?void 0:w})}const te=n.computed(()=>o.predefinedCustomTypeCatalog.value),fe=n.computed(()=>o.embeddableCatalog.value);function M(D){var w,v;return((w=D.label)==null?void 0:w.ko)??((v=D.label)==null?void 0:v.en)??D.type}function ne(D){!D||!i.value||o.addPredefinedEmbed(i.value.modelId,D)}const E=n.computed(()=>o.groupCodeCatalog.value);function S(D){var w;return((w=E.value.find(v=>v.groupCode===D.groupCode))==null?void 0:w.codes)??[]}function I(D){return["none",...S(D)]}function B(D){return D==="none"?"none":D.code}function G(D){var v,z;if(D==="none")return"(없음)";const w=((v=D.label)==null?void 0:v.ko)??((z=D.label)==null?void 0:z.en);return w?`${D.code} (${w})`:D.code}function X(D,w){i.value&&o.setAttributeGroupCode(i.value.modelId,D.modelId,w)}function A(D,w){f(D,{defaultValue:w==="none"?void 0:w})}function ae(D,w){f(D,{defaultValue:w.trim()===""?void 0:w})}function se(D){return D.attrType.startsWith("EMBED")&&D.dbAttrs.length>0}function ge(D,w,v){const z=D.dbAttrs.map((pe,J)=>{if(J!==w)return pe;const Z={...pe,...v};for(const W of Object.keys(v))v[W]===void 0&&delete Z[W];return Z});i.value&&o.setEmbedColumns(i.value.modelId,D.modelId,z)}function _e(D,w,v,z){var pe;ge(D,w,{logicalName:{...(pe=D.dbAttrs[w])==null?void 0:pe.logicalName,[v]:z}})}function re(D,w){var pe,J,Z;if(D.attrType==="EMBED_PREDEF"){const W=(pe=o.embeddableCatalog.value.find(de=>de.type===D.type))==null?void 0:pe.fields[w];return W?{name:W.name,physicalName:W.physicalName,dataType:W.dataType,length:W.length,shareable:W.shareable,logicalName:W.logicalName}:void 0}const v=(J=D.embedded)==null?void 0:J.embeddableRef;if(!v)return;const z=(Z=o.state.logical.entities.find(W=>W.modelId===v))==null?void 0:Z.attributes.flatMap(W=>W.dbAttrs)[w];return z?{physicalName:z.physicalName,dataType:z.dataType,length:z.length,scale:z.scale,logicalName:z.logicalName}:void 0}function ye(D,w){var v,z;return((v=re(D,w))==null?void 0:v.dataType)||((z=D.dbAttrs[w])==null?void 0:z.dataType)||""}function be(D,w){var v,z;return((v=re(D,w))==null?void 0:v.length)??((z=D.dbAttrs[w])==null?void 0:z.length)}function $e(D,w){var v,z;return((v=re(D,w))==null?void 0:v.scale)??((z=D.dbAttrs[w])==null?void 0:z.scale)}const Se=["inherit","true","false"];function Ce(D){return D==="inherit"?"기본(따름)":D}function Y(D){return(D==null?void 0:D.updatable)===void 0?"inherit":D.updatable?"true":"false"}function U(D,w,v){ge(D,w,{updatable:v==="inherit"?void 0:v==="true"})}function V(D,w){q(D,{updatable:w==="inherit"?void 0:w==="true"})}const C=["inherit","true","false"];function R(D){return D==="inherit"?"기본(따름)":D}function O(D){return(D==null?void 0:D.insertable)===void 0?"inherit":D.insertable?"true":"false"}function oe(D,w,v){ge(D,w,{insertable:v==="inherit"?void 0:v==="true"})}function j(D,w){q(D,{insertable:w==="inherit"?void 0:w==="true"})}const k=n.computed(()=>{var D;return Wn(((D=i.value)==null?void 0:D.attributes.flatMap(w=>w.dbAttrs))??[])}),$=n.computed(()=>{var D;return(((D=i.value)==null?void 0:D.attributes)??[]).filter(w=>w.attrType==="NORMAL"&&w.dbAttrs.length===1&&w.dbAttrs[0]).map(w=>({modelId:w.dbAttrs[0].modelId,label:w.dbAttrs[0].physicalName||w.name}))});function L(){return[$i,...$.value.map(D=>D.modelId)]}function Q(D){if(D===$i)return"전용 컬럼(OWN)";const w=$.value.find(v=>v.modelId===D);return w?`↗ ${w.label} (공유)`:D}function ce(D){return(D==null?void 0:D.sharedColumnRef)??$i}function me(D,w,v){ge(D,w,{sharedColumnRef:v===$i?void 0:v})}function he(D){return(D==null?void 0:D.sharedColumnRef)!=null}function we(D){var w;return((w=Do(D,k.value))==null?void 0:w.physicalName)??""}return(D,w)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",a1,[n.createElementVNode("span",l1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:w[0]||(w[0]=v=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"구분선",onClick:w[1]||(w[1]=v=>n.unref(o).addDivider(i.value.modelId))}),fe.value.length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:fe.value,"value-provider":v=>v.type,"label-provider":M,"onUpdate:modelValue":ne},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",r1,[n.createElementVNode("table",s1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[w[2]||(w[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),w[3]||(w[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),w[4]||(w[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),w[5]||(w[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),w[6]||(w[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),w[7]||(w[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),w[8]||(w[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),w[9]||(w[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),w[10]||(w[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),w[11]||(w[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),w[12]||(w[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),w[13]||(w[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),w[14]||(w[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),w[15]||(w[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),w[16]||(w[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),w[17]||(w[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),w[18]||(w[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),w[19]||(w[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),E.value.length?(n.openBlock(),n.createElementBlock("th",c1,"코드그룹")):n.createCommentVNode("",!0),w[20]||(w[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),w[21]||(w[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,v=>{var z,pe,J,Z,W,de,ke,xe,H,ee,F;return n.openBlock(),n.createElementBlock(n.Fragment,{key:v.modelId},[v.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(v.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-divlabel-${v.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":v.name,"onUpdate:modelValue":ue=>f(v,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,d1),n.createElementVNode("td",u1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,v.modelId)},null,8,["onClick"])])],2)):se(v)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(v.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-name-${v.modelId}`,width:"100%",placeholder:"이름","model-value":v.name,"onUpdate:modelValue":ue=>f(v,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-type-${v.modelId}`,width:"100%",disabled:"","model-value":v.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:E.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(v.dbAttrs.length)+"개",9,E1),n.createElementVNode("td",k1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,v.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v.dbAttrs,(ue,Ae)=>{var Je,nt,Pe,kt,qt,Xt,jt;return n.openBlock(),n.createElementBlock("tr",{key:ue.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",N1,"↳ "+n.toDisplayString(((Je=re(v,Ae))==null?void 0:Je.name)??((nt=re(v,Ae))==null?void 0:nt.physicalName)??`컬럼 ${Ae+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",I1,n.toDisplayString(ye(v,Ae)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-embed-logical-${ue.modelId}`,width:"100%",placeholder:((kt=(Pe=re(v,Ae))==null?void 0:Pe.logicalName)==null?void 0:kt.ko)??"논리명","model-value":((qt=ue.logicalName)==null?void 0:qt.ko)??"","onUpdate:modelValue":Ge=>_e(v,Ae,"ko",Ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-embed-col-${ue.modelId}`,width:"100%",disabled:he(ue),placeholder:((Xt=re(v,Ae))==null?void 0:Xt.physicalName)??"컬럼","model-value":he(ue)?we(ue):ue.physicalName,"onUpdate:modelValue":Ge=>ge(v,Ae,{physicalName:Ge})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":ue.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",$1,n.toDisplayString(ye(v,Ae)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",x1,n.toDisplayString(be(v,Ae)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",S1,n.toDisplayString($e(v,Ae)??""),1)]),n.createElementVNode("td",C1,[(jt=re(v,Ae))!=null&&jt.shareable?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":ce(ue),items:L(),"value-provider":u,"label-provider":Q,"onUpdate:modelValue":Ge=>Ge&&me(v,Ae,Ge)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:he(ue),"model-value":he(ue)?"false":O(ue),items:C,"value-provider":u,"label-provider":R,"onUpdate:modelValue":Ge=>Ge&&oe(v,Ae,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:he(ue),"model-value":he(ue)?"false":Y(ue),items:Se,"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":Ge=>Ge&&U(v,Ae,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:E.value.length?4:3},null,8,R1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(v.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-name-${v.modelId}`,width:"100%",placeholder:"이름","model-value":v.name,"onUpdate:modelValue":ue=>f(v,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-type-${v.modelId}`,width:"100%",placeholder:"타입",disabled:!!v.groupCode,items:n.unref(Zl)(v.type,te.value),"value-provider":_,"label-provider":N,"model-value":v.type,"onUpdate:modelValue":ue=>y(v,ue)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),v.type===n.unref(Jt)?(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:0,name:`aw-customtype-${v.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":v.customType??"","onUpdate:modelValue":ue=>x(v,ue)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-logical-${v.modelId}`,width:"100%",placeholder:"논리명","model-value":((pe=(z=v.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:pe.ko)??"","onUpdate:modelValue":ue=>K(v,"ko",ue)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-col-${v.modelId}`,width:"100%",placeholder:"컬럼",disabled:b(v),"model-value":((J=v.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ue=>q(v,{physicalName:ue})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":(Z=v.dbAttrs[0])==null?void 0:Z.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-dtype-${v.modelId}`,width:"100%",placeholder:"dataType",disabled:b(v),items:n.unref(ql)(((W=v.dbAttrs[0])==null?void 0:W.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(ra),"model-value":((de=v.dbAttrs[0])==null?void 0:de.dataType)??"","onUpdate:modelValue":ue=>ue&&q(v,{dataType:ue})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSNumberInput),{name:`aw-len-${v.modelId}`,width:"100%",placeholder:"len",disabled:b(v),"model-value":(ke=v.dbAttrs[0])==null?void 0:ke.length,"onUpdate:modelValue":ue=>q(v,{length:ue||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSNumberInput),{name:`aw-scale-${v.modelId}`,width:"100%",placeholder:"scale",disabled:b(v)||!P(v),"model-value":(xe=v.dbAttrs[0])==null?void 0:xe.scale,"onUpdate:modelValue":ue=>q(v,{scale:ue||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",f1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-pk-${v.modelId}`,"model-value":v.identifier,disabled:a.value||b(v),"onUpdate:modelValue":ue=>p(v,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",m1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nn-${v.modelId}`,"model-value":v.notNull,disabled:b(v),"onUpdate:modelValue":ue=>f(v,{notNull:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",p1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-uq-${v.modelId}`,"model-value":!!((H=v.dbAttrs[0])!=null&&H.unique),disabled:b(v),"onUpdate:modelValue":ue=>q(v,{unique:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",h1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-ai-${v.modelId}`,"model-value":!!((ee=v.dbAttrs[0])!=null&&ee.autoIncrement),disabled:b(v)||!v.identifier,"onUpdate:modelValue":ue=>q(v,{autoIncrement:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",y1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-tr-${v.modelId}`,"model-value":!!v.transient,disabled:v.identifier,"onUpdate:modelValue":ue=>g(v,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",g1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nid-${v.modelId}`,"model-value":!!v.naturalId,disabled:v.identifier||b(v),"onUpdate:modelValue":ue=>h(v,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",b1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nidm-${v.modelId}`,"model-value":!!v.naturalIdMutable,disabled:b(v)||!v.naturalId,"onUpdate:modelValue":ue=>f(v,{naturalIdMutable:ue||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",_1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-mv-${v.modelId}`,"model-value":!!((F=v.dbAttrs[0])!=null&&F.multiValue),disabled:b(v),"onUpdate:modelValue":ue=>q(v,{multiValue:ue||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-ins-${v.modelId}`,width:"100%",disabled:b(v),"model-value":O(v.dbAttrs[0]),items:C,"value-provider":u,"label-provider":R,"onUpdate:modelValue":ue=>ue&&j(v,ue)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-upd-${v.modelId}`,width:"100%",disabled:b(v),"model-value":Y(v.dbAttrs[0]),items:Se,"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":ue=>ue&&V(v,ue)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":T(v),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ue=>ue&&ie(v,ue)},null,8,["model-value","onUpdate:modelValue"])]),E.value.length?(n.openBlock(),n.createElementBlock("td",w1,[n.createVNode(cd,{"model-value":v.groupCode,items:E.value,"onUpdate:modelValue":ue=>X(v,ue)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[S(v).length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":v.defaultValue??"none",items:I(v),"value-provider":B,"label-provider":G,"onUpdate:modelValue":ue=>ue&&A(v,ue)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:1,name:`aw-default-${v.modelId}`,width:"100%",placeholder:"기본값","model-value":v.defaultValue??"","onUpdate:modelValue":ue=>ae(v,ue)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",v1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,v.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",V1,[...w[22]||(w[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,i1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-d8326b9d"]]),T1=["disabled"],M1={class:"em-idxw__list"},B1={class:"em-idxw__list-head"},D1=["onClick"],O1={class:"em-idxw__item-name"},L1={key:0,class:"em-idxw__badge"},P1={class:"em-idxw__item-cnt"},z1={key:0,class:"em-idxw__empty"},U1={key:0,class:"em-idxw__edit"},H1={class:"em-idxw__form"},F1={class:"em-field em-idxw__name"},G1={class:"em-field"},Y1=["value"],W1={class:"em-idxw__transfer"},K1={class:"em-idxw__pane"},q1={class:"em-idxw__pane-head"},X1={class:"em-idxw__cols"},j1=["onClick"],Z1={key:0,class:"em-idxw__empty"},J1={class:"em-idxw__arrows"},Q1={class:"em-idxw__pane"},e_={class:"em-idxw__pane-head"},t_={class:"em-idxw__cols"},n_={class:"em-idxw__col-name"},o_={class:"em-idxw__col-ops"},i_=["disabled","onClick"],a_=["disabled","onClick"],l_=["onClick"],r_={key:0,class:"em-idxw__empty"},s_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},c_=De(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(P=>P.modelId===t.entityId)??null),a=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.indexes)??[]}),l=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.attributes)??[]}),r=n.ref(null);n.watch(a,P=>{var K;P.some(T=>T.modelId===r.value)||(r.value=((K=P[0])==null?void 0:K.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(P=>P.modelId===r.value)??null),c=n.computed(()=>{var P;return new Set(((P=s.value)==null?void 0:P.columns.map(K=>K.columnRef))??[])}),d=n.computed(()=>l.value.filter(P=>!c.value.has(P.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(P){var T;const K=(T=P.dbAttrs[0])==null?void 0:T.physicalName;return K&&K!==P.name?`${P.name} (${K})`:P.name}function h(P){const K=l.value.find(T=>T.modelId===P);return K?f(K):P}function m(P,K){i.value&&o.updateIndex(i.value.modelId,P,K)}function p(){var K;if(!i.value)return;const P=Te();o.addIndex(i.value.modelId,{modelId:P,name:`idx_${(((K=i.value.indexes)==null?void 0:K.length)??0)+1}`,unique:!1,columns:[]}),r.value=P}function g(P){i.value&&o.removeIndex(i.value.modelId,P)}function b(P){s.value&&m(s.value.modelId,{parameters:P.trim()===""?void 0:P})}function _(P){const K=new Set(u.value);K.has(P)?K.delete(P):K.add(P),u.value=K}function N(){const P=s.value;if(!P||!u.value.size)return;const K=[...u.value].map(T=>({columnRef:T,descending:!1}));m(P.modelId,{columns:[...P.columns,...K]}),u.value=new Set}function y(P){const K=s.value;K&&m(K.modelId,{columns:K.columns.filter((T,ie)=>ie!==P)})}function x(P,K){const T=s.value;T&&m(T.modelId,{columns:T.columns.map((ie,te)=>te===P?{...ie,descending:K}:ie)})}function q(P,K){const T=s.value;if(!T)return;const ie=P+K;if(ie<0||ie>=T.columns.length)return;const te=[...T.columns];[te[P],te[ie]]=[te[ie],te[P]],m(T.modelId,{columns:te})}return(P,K)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",M1,[n.createElementVNode("div",B1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":T.modelId===r.value}]),onClick:ie=>r.value=T.modelId},[n.createElementVNode("span",O1,n.toDisplayString(T.name||"(이름 없음)"),1),T.unique?(n.openBlock(),n.createElementBlock("span",L1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",P1,n.toDisplayString(T.columns.length),1)],10,D1))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",z1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",U1,[n.createElementVNode("div",H1,[n.createElementVNode("label",F1,[K[4]||(K[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":K[0]||(K[0]=T=>m(s.value.modelId,{name:T}))},null,8,["model-value"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":K[1]||(K[1]=T=>m(s.value.modelId,{unique:T}))},null,8,["model-value"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:K[2]||(K[2]=T=>g(s.value.modelId))})]),n.createElementVNode("label",G1,[K[5]||(K[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:K[3]||(K[3]=T=>b(T.target.value))},null,40,Y1)]),n.createElementVNode("div",W1,[n.createElementVNode("div",K1,[n.createElementVNode("div",q1,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",X1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(T.modelId)}]),onClick:ie=>_(T.modelId)},n.toDisplayString(f(T)),11,j1))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Z1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",J1,[n.createVNode(n.unref(le.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:N},null,8,["disabled"])]),n.createElementVNode("div",Q1,[n.createElementVNode("div",e_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",t_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(T,ie)=>(n.openBlock(),n.createElementBlock("li",{key:ie,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",n_,n.toDisplayString(h(T.columnRef)),1),n.createVNode(n.unref(le.BSCheckbox),{name:`idxw-desc-${ie}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":te=>x(ie,te)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",o_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:ie===0,onClick:te=>q(ie,-1)},"↑",8,i_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:ie===s.value.columns.length-1,onClick:te=>q(ie,1)},"↓",8,a_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:te=>y(ie)},"✕",8,l_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",r_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",s_,"인덱스를 선택하거나 추가하세요."))],8,T1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),d_={class:"em-op-src"},u_={class:"em-op-src__actions"},dd=De(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=le.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(le.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",d_,[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",u_,[n.createVNode(n.unref(le.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),f_=["disabled"],m_={class:"em-ow__toolbar"},p_={class:"em-ow__count"},h_={class:"em-ow__scroll"},y_={class:"em-ow__table"},g_={class:"c-del"},b_={key:0},__=De(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=le.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,g){a.value&&o.updateOperation(a.value.modelId,p.modelId,g)}function u(p,g,b){d(p,{description:{...p.description,[g]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,g){d(p,{personalInfoAttributeType:g==="none"?void 0:g})}function m(p){i.openModal({component:dd,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:g=>d(p,{sourceCode:g})}})}return(p,g)=>{var b,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",m_,[n.createElementVNode("span",p_,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=N=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",h_,[n.createElementVNode("table",y_,[g[2]||(g[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":N.name,"onUpdate:modelValue":x=>d(N,{name:x})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":x=>x&&d(N,{visibility:x})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=N.description)==null?void 0:y.ko)??"","onUpdate:modelValue":x=>u(N,"ko",x)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":f(N),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":x=>x&&h(N,x)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSButton),{variant:"text",caption:N.sourceCode?"본문 ●":"본문",onClick:x=>m(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",g_,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",b_,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,f_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),w_={class:"em-detail__tabs"},v_=["onClick"],E_=De(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=le.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(le.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",w_,[(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,v_)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(rd,{key:0,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(A1,{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(__,{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 xi(e,t,o){e.openModal({component:E_,bind:{controller:n.markRaw(t),entityId:o}})}const ud=()=>crypto.randomUUID(),k_=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,N_=e=>e&&e[0].toLowerCase()+e.slice(1),I_=e=>e&&e[0].toUpperCase()+e.slice(1),$_=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function x_(e,t){return N_(e)+I_(t)}function S_(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=x_(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:$_(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,t)=>`${e}::${t}`;function C_(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||s.length!==l.length||s.scale!==l.scale}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function R_(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 Ci(e,t,o=ud){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=>S_(e,f)),s=new Map(r.map(f=>[Si(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Si(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=Si(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=Si(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(R_(f,u++,o));else{const p=C_(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function V_(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 A_(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function T_(e,t,o=ud){const i=new Map,a=A_(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=Ci(a,d,o);if(k_(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&V_(f,u),l.has(d)||r.push(d)}}return i}function M_(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Te(),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=Te();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Te()}for(const a of t.indexes??[]){a.modelId=Te();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const yn=Symbol("editorController");function fd(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ri(e,t){const o=[];for(const i of t.remove)o.push(Lt(e,i));for(const i of t.update)o.push(nn(e,i.attributeId,i.patch));for(const i of t.add)o.push(xt(e,i));return o}function Dn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function On(e,t){const o=[];for(const[i,a]of T_(e,t,Te))o.push(...Ri(i,a));return o}function md(e,t,o){const i=new Set(o.remove);return Dn(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 fl(e,t){const o=Ci(e,t,Te),i=Ri(t,o),a=md(e,t,o);return i.push(...On(a,t)),i}function pd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Te()}))}function B_(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:Te(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Te(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(xt(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,g=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:g.multiplicity,navigable:g.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(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=Ci(r,t,Te);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(Lt(u.ownerId,u.dispId)),i.push(Ho(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Ri(t,s));const c=md(r,t,s);return i.push(...On(c,t)),i}function D_(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 x;return((x=y.embedded)==null?void 0:x.associationRef)===l.modelId}))continue;const u=Te(),f=d.attributes.reduce((y,x)=>Math.max(y,x.order),-1)+1,h=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let p=m;for(let y=2;h.has(p);y++)p=`${m}${y}`;const g=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Te()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(xt(c,b));const _=r?"end2":"end1",N=r?"end1":"end2";i.push(Ho(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Te()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function O_(e=fd(),t={}){var oe,j;const o=n.reactive(e);let i=new ma(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),g=n.ref(!1),b=n.ref(0),_=n.ref(((oe=t.meta)==null?void 0:oe.schemaVersion)??1),N=n.ref(((j=t.meta)==null?void 0:j.opWriteEnabled)??!1),y=n.computed(()=>_.value>=2&&N.value),x=t.historyTransport,q=n.computed(()=>y.value&&x!==void 0),P=t.restoreTransport,K=n.ref(0),T=n.computed(()=>y.value&&te.value&&P!==void 0);async function ie(k){if(!P||!te.value)return{ok:!1,reason:"unavailable"};const $=await P(k);return $.ok&&K.value++,$}const te=n.ref(!(_.value>=2&&N.value===!1)),fe=n.ref("LOGICAL_PHYSICAL"),M=n.ref("straight"),ne=n.ref(!0),E=n.ref(!0),S=n.ref(null),I=n.computed(()=>{var k;return((k=S.value)==null?void 0:k.kind)==="attribute"?{entityId:S.value.entityId,attrId:S.value.anchor}:null}),B=n.computed(()=>{var k;return((k=S.value)==null?void 0:k.kind)==="attribute"?S.value.ids:[]}),G=n.computed(()=>{var k,$;return((k=S.value)==null?void 0:k.kind)==="entity"?S.value.id:(($=S.value)==null?void 0:$.kind)==="attribute"?S.value.entityId:null}),X=n.ref(null);let A=0;const ae=n.ref(null),se=n.ref(null);let ge=t.meta;function _e(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,b.value++})}_e();let re=null,ye=null;function be(){ye==null||ye(),ye=null,re=null}function $e(){if(be(),!y.value||!t.opTransport)return;const k=new Hr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:$=>{te.value=!1,se.value=$},onError:t.onOpError});k.seed((ge==null?void 0:ge.revSeed)??{}),ye=k.attach(i),re=k}$e();const Se=n.computed(()=>Ll(o.logical,o.layout)),Ce=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),Y=n.computed(()=>er(o.logical,Ce.value)),U=n.computed(()=>{const k=new Map;for(const $ of Y.value){if(!$.targetRef)continue;const L=k.get($.targetRef);L?L.push($):k.set($.targetRef,[$])}return k}),V=k=>{te.value&&i.execute(k)},C=(k,$,L)=>{const Q=nn(k,$,L),ce=Dn(o.logical,k,he=>he.map(we=>we.modelId===$?{...we,...L}:we)),me=On(ce,k);V(me.length?Le("속성 수정",[Q,...me]):Q)};function R(k){const $=k.map(D=>o.layout.entityLayouts.find(w=>w.entityRef===D)).filter(D=>!!D);if(!$.length)return{location:{x:40,y:40},size:{width:400,height:300}};let L=1/0,Q=1/0,ce=-1/0,me=-1/0;for(const D of $){const w=D.geo.size.width||220,v=D.geo.size.height||140;L=Math.min(L,D.geo.location.x),Q=Math.min(Q,D.geo.location.y),ce=Math.max(ce,D.geo.location.x+w),me=Math.max(me,D.geo.location.y+v)}const he=40,we=28;return{location:{x:L-he,y:Q-he-we},size:{width:ce-L+he*2,height:me-Q+he*2+we}}}function O(k,$,L){var D;const Q=o.layout.groupLayouts.find(w=>w.groupRef===k),ce=(Q==null?void 0:Q.geo.location)??$,me=$.x-ce.x,he=$.y-ce.y,we=[mr(k,$),...L.map(w=>kn(w.id,w.location))];if(me||he){const w=new Set(((D=o.logical.groups.find(v=>v.modelId===k))==null?void 0:D.memberEntityRefs)??[]);for(const v of o.logical.associations){if(!w.has(v.end1.entityRef)||!w.has(v.end2.entityRef))continue;const z=o.layout.associationLayouts.find(pe=>pe.associationRef===v.modelId);z&&z.waypoints.length&&we.push($r(v.modelId,me,he))}for(const v of(Q==null?void 0:Q.memberNoteRefs)??[]){const z=o.layout.notes.find(pe=>pe.modelId===v);z&&we.push(Zn(v,{x:z.geo.location.x+me,y:z.geo.location.y+he}))}}return we}return{state:o,resolved:Se,issues:Y,issuesByRef:U,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:g,revision:b,editable:te,schemaVersion:_,opWriteEnabled:N,opMode:y,opConflict:se,historyTransport:x,historyAvailable:q,restoreTransport:P,restoreAvailable:T,restoreToSeq:ie,reloadRequest:K,displayMode:fe,routingMode:M,showGrid:ne,showMinimap:E,selection:S,selectedAttr:I,selectedAttrIds:B,inspectedEntityId:G,focusRequest:X,clipboard:ae,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(k){te.value=k&&y.value},setEmbeddableCatalog(k){a.value=k},setGroupCodeCatalog(k){l.value=k},setPredefinedCustomTypeCatalog(k){r.value=k},selectAttribute(k,$,L="replace"){const Q=S.value,ce=(Q==null?void 0:Q.kind)==="attribute"&&Q.entityId===k;if(L==="replace"||!ce){S.value={kind:"attribute",entityId:k,ids:[$],anchor:$};return}if(L==="toggle"){const z=Q.ids.includes($),pe=z?Q.ids.filter(Z=>Z!==$):[...Q.ids,$];if(!pe.length){S.value=null;return}const J=z&&Q.anchor===$?pe[pe.length-1]:z?Q.anchor:$;S.value={kind:"attribute",entityId:k,ids:pe,anchor:J};return}const me=o.logical.entities.find(z=>z.modelId===k),he=[...(me==null?void 0:me.attributes)??[]].sort((z,pe)=>z.order-pe.order).map(z=>z.modelId),we=he.indexOf(Q.anchor),D=he.indexOf($);if(we<0||D<0){S.value={kind:"attribute",entityId:k,ids:[$],anchor:$};return}const[w,v]=we<=D?[we,D]:[D,we];S.value={kind:"attribute",entityId:k,ids:he.slice(w,v+1),anchor:Q.anchor}},moveAttributeFocus(k){const $=S.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const L=o.logical.entities.find(he=>he.modelId===$.entityId);if(!L||!L.attributes.length)return!1;const Q=L.attributes.findIndex(he=>he.modelId===$.anchor);if(Q<0)return!1;const ce=Math.min(Math.max(Q+k,0),L.attributes.length-1);if(ce===Q)return!0;const me=L.attributes[ce].modelId;return S.value={kind:"attribute",entityId:$.entityId,ids:[me],anchor:me},!0},nudgeSelectedAttributes(k){const $=S.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const L=o.logical.entities.find(z=>z.modelId===$.entityId);if(!L)return!1;const Q=L.attributes,ce=new Set($.ids),me=Q.map((z,pe)=>ce.has(z.modelId)?pe:-1).filter(z=>z>=0);if(!me.length)return!1;const he=Math.min(...me),we=Q.filter(z=>!ce.has(z.modelId)),D=Q.slice(0,he).filter(z=>!ce.has(z.modelId)).length;let w;if(k<0){if(D<=0)return!0;w=D-1}else{if(we.length-D<=0)return!0;w=D+1}const v=Q.filter(z=>ce.has(z.modelId)).map(z=>z.modelId);return V(_a($.entityId,v,w)),!0},deleteSelection(){if(!te.value)return!1;const k=S.value;if(!k)return!1;if(k.kind==="attribute"){const $=k.ids;if(!$.length)return!1;$.length===1?V(Lt(k.entityId,$[0])):V(Le("속성 삭제",$.map(L=>Lt(k.entityId,L))))}else k.kind==="entity"?V(ha(k.id)):k.kind==="note"?V(Ea(k.id)):k.kind==="group"?V(ba(k.id)):V(va(k.id));return S.value=null,!0},nudgeNodes(k,$,L){if(!k.length||$===0&&L===0)return!1;const Q=new Set(o.logical.entities.map(w=>w.modelId)),ce=new Set(o.logical.groups.map(w=>w.modelId)),me=new Set(o.layout.notes.map(w=>w.modelId)),he=new Set;for(const w of k){if(!ce.has(w))continue;const v=o.logical.groups.find(z=>z.modelId===w);for(const z of(v==null?void 0:v.memberEntityRefs)??[])he.add(z)}const we=[],D=[];for(const w of k)if(ce.has(w)){const v=o.layout.groupLayouts.find(Z=>Z.groupRef===w);if(!v)continue;const z=o.logical.groups.find(Z=>Z.modelId===w),pe=((z==null?void 0:z.memberEntityRefs)??[]).map(Z=>{var de;const W=((de=o.layout.entityLayouts.find(ke=>ke.entityRef===Z))==null?void 0:de.geo.location)??{x:0,y:0};return{id:Z,location:{x:W.x+$,y:W.y+L}}}),J={x:v.geo.location.x+$,y:v.geo.location.y+L};we.push(Le("그룹 이동",O(w,J,pe))),D.push("g:"+w)}else if(Q.has(w)){if(he.has(w))continue;const v=o.layout.entityLayouts.find(z=>z.entityRef===w);if(!v)continue;we.push(kn(w,{x:v.geo.location.x+$,y:v.geo.location.y+L})),D.push("e:"+w)}else if(me.has(w)){const v=o.layout.notes.find(z=>z.modelId===w);if(!v)continue;we.push(Zn(w,{x:v.geo.location.x+$,y:v.geo.location.y+L})),D.push("n:"+w)}return we.length?(V(Le("이동",we,"nudge:"+D.sort().join(","))),!0):!1},requestFocus(k){X.value={id:k,nonce:++A}},undo:()=>{te.value&&i.undo()},redo:()=>{te.value&&i.redo()},markSaved:()=>{te.value&&(re==null||re.flush(),i.markSavePoint())},loadDiagram(k,$){be(),o.logical=k.logical,o.layout=k.layout,i=new ma(o),_e(),_.value=($==null?void 0:$.schemaVersion)??1,N.value=($==null?void 0:$.opWriteEnabled)??!1,te.value=!(_.value>=2&&N.value===!1),ge=$,se.value=null,S.value=null,m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,$e()},flush(){re==null||re.flush()},whenOpsSettled(){return(re==null?void 0:re.whenSettled())??Promise.resolve()},addEntity(k="NewEntity",$={x:80,y:80}){const L=Te(),Q={modelId:L,name:k,stereotype:"JPA_ENTITY",table:{physicalName:k.toLowerCase()},attributes:[{modelId:Te(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Te(),physicalName:"id",dataType:"BIGINT"}]}]};return V(pa(Q,{location:{...$},size:{width:220,height:140}})),L},renameEntity(k,$){V(rr(k,$))},updateEntity(k,$){const L=lr(k,$),Q=o.logical.entities.find(he=>he.modelId===k),ce=$.stereotype==="JPA_EMBEDDABLE"&&!!Q&&Q.stereotype!=="JPA_EMBEDDABLE",me=!!$.stereotype&&$.stereotype!=="JPA_EMBEDDABLE"&&!!Q&&Q.stereotype==="JPA_EMBEDDABLE";if(ce&&Q){const he=Q.attributes.filter(z=>z.identifier&&!z.derivedFrom).map(z=>nn(k,z.modelId,{identifier:!1})),we=Dn({...o.logical,entities:o.logical.entities.map(z=>z.modelId===k?{...z,stereotype:"JPA_EMBEDDABLE"}:z)},k,z=>z.map(pe=>pe.identifier&&!pe.derivedFrom?{...pe,identifier:!1}:pe)),D=fl(we,k),w=D_(o.logical,k),v=[L,...he,...D,...w];V(v.length>1?Le("임베더블 변환",v):L);return}if(me){const he=B_(o.logical,k),we=[L,...he];V(we.length>1?Le("엔터티 전환",we):L);return}V(L)},moveEntity(k,$){V(kn(k,$))},resizeEntity(k,$){V(sr(k,$))},removeEntity(k){V(ha(k))},setEntitySwatch(k,$){V(cr(k,$))},setEntityCollapsed(k,$){V(dr(k,$))},collapseAll(){V(ya(!0))},expandAll(){V(ya(!1))},setAttributeSwatch(k,$,L){V(zo(k,$,L))},dragGroup(k,$,L){V(Le("그룹 이동",O(k,$,L)))},resizeGroup(k,$){V(pr(k,$))},setGroupSwatch(k,$){V(hr(k,$))},updateGroup(k,$){V(ur(k,$))},createGroup(k,$){if(!k.length)return null;const L=[];for(const me of o.logical.groups)for(const he of k)me.memberEntityRefs.includes(he)&&L.push(Uo(me.modelId,he));const Q=Te(),ce={modelId:Q,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...k]};return L.push(ga(ce,R(k))),V(Le("그룹 생성",L)),S.value=null,Q},addEmptyGroup(k,$){const L=Te();return V(ga({modelId:L,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...k},size:{width:360,height:260}})),L},removeGroup(k){V(ba(k))},dropEntity(k,$,L){var me;const Q=((me=o.logical.groups.find(he=>he.memberEntityRefs.includes(k)))==null?void 0:me.modelId)??null,ce=[kn(k,$)];Q!==L&&(Q&&ce.push(Uo(Q,k)),L&&ce.push(fr(L,k))),V(Le("이동",ce))},ungroupEntity(k){const $=o.logical.groups.find(L=>L.memberEntityRefs.includes(k));$&&V(Uo($.modelId,k))},dropNote(k,$,L){var me;const Q=((me=o.layout.groupLayouts.find(he=>{var we;return(we=he.memberNoteRefs)==null?void 0:we.includes(k)}))==null?void 0:me.groupRef)??null,ce=[Zn(k,$)];Q!==L&&(Q&&ce.push(Mr(Q,k)),L&&ce.push(Tr(L,k))),V(Le("이동",ce))},addPredefinedEmbed(k,$){const L=a.value.find(D=>D.type===$),Q=o.logical.entities.find(D=>D.modelId===k);if(!L||!Q)return;const ce=Q.attributes.reduce((D,w)=>Math.max(D,w.order),-1)+1,me=Te(),he=L.fields.map(()=>({modelId:Te(),physicalName:"",dataType:""})),we={modelId:me,name:L.defaultName,type:L.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:ce,dbAttrs:he};return V(xt(k,we)),me},addAttribute(k,$={}){const L=o.logical.entities.find(v=>v.modelId===k),Q=L?L.attributes.length:0,ce=$.modelId??Te(),me=$.name??`field${Q}`,he={modelId:ce,name:me,type:$.type??Xl,attrType:$.attrType??"NORMAL",identifier:$.identifier??!1,notNull:$.notNull??!1,order:Q,dbAttrs:$.dbAttrs??[{modelId:Te(),physicalName:me,dataType:"VARCHAR",length:255}],...$},we=xt(k,he),D=Dn(o.logical,k,v=>[...v,he]),w=On(D,k);return V(w.length?Le("속성 추가",[we,...w]):we),ce},addDivider(k){const $=o.logical.entities.find(me=>me.modelId===k),L=$?$.attributes.length:0,Q=Te();return V(xt(k,{modelId:Q,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:L,dbAttrs:[]})),Q},updateAttribute(k,$,L){C(k,$,L)},setAttributeGroupCode(k,$,L){C(k,$,{groupCode:L,type:L?Bo:Xl})},setEmbedColumns(k,$,L){var D,w;const Q=nn(k,$,{dbAttrs:L}),ce=(D=o.logical.entities.find(v=>v.modelId===k))==null?void 0:D.attributes.find(v=>v.modelId===$),me=(w=ce==null?void 0:ce.embedded)==null?void 0:w.associationRef,he=me?o.logical.associations.find(v=>v.modelId===me):void 0,we=[];he&&me&&(he.end1.legacyEmbedRaw&&we.push(Nn(me,"end1",{legacyEmbedRaw:void 0})),he.end2.legacyEmbedRaw&&we.push(Nn(me,"end2",{legacyEmbedRaw:void 0}))),V(we.length?Le("임베드 컬럼 수정",[Q,...we]):Q)},removeAttribute(k,$){const L=Lt(k,$),Q=Dn(o.logical,k,me=>me.filter(he=>he.modelId!==$)),ce=On(Q,k);V(ce.length?Le("속성 삭제",[L,...ce]):L)},removeAttributes(k,$){var he;if(!$.length)return;const L=$.map(we=>Lt(k,we)),Q=new Set($),ce=Dn(o.logical,k,we=>we.filter(D=>!Q.has(D.modelId))),me=[...L,...On(ce,k)];V(me.length===1?me[0]:Le("속성 삭제",me)),((he=S.value)==null?void 0:he.kind)==="attribute"&&S.value.entityId===k&&(S.value=null)},setAttributeSwatches(k,$,L){$.length&&($.length===1?V(zo(k,$[0],L)):V(Le("속성 색상",$.map(Q=>zo(k,Q,L)))))},reorderAttributes(k,$,L){$.length&&V(_a(k,$,L))},addIndex(k,$){V(vr(k,$))},updateIndex(k,$,L){V(Er(k,$,L))},removeIndex(k,$){V(kr(k,$))},addOperation(k,$={}){var he;const L=o.logical.entities.find(we=>we.modelId===k),Q=((he=L==null?void 0:L.operations)==null?void 0:he.length)??0,ce=$.modelId??Te(),me={modelId:ce,name:$.name??`method${Q}`,visibility:$.visibility??"PACKAGE",order:Q,...$};return V(yr(k,me)),ce},updateOperation(k,$,L){V(gr(k,$,L))},removeOperation(k,$){V(br(k,$))},reorderOperations(k,$,L){$.length&&V(_r(k,$,L))},setOperationSwatch(k,$,L){V(wr(k,$,L))},addAssociation(k,$,L,Q){const ce=Te(),me={modelId:ce,end1:{entityRef:k,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:L},end2:{entityRef:$,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},he={...o.logical,associations:[...o.logical.associations,me]},we=Ci(he,$,Te),D=we.add[0];D&&(me.end2.attributeRef=D.modelId);const w={associationRef:ce,waypoints:[],sourceColumnRef:L,targetColumnRef:(D==null?void 0:D.modelId)??Q},v=wa(me,w),z=Ri($,we);return V(z.length?Le("관계 추가",[v,...z]):v),ce},addEmbedAssociation(k,$){const L=o.logical.entities.find(de=>de.modelId===k),Q=o.logical.entities.find(de=>de.modelId===$);if(!L||!Q||Q.stereotype!=="JPA_EMBEDDABLE")return;const ce=Te(),me=Te(),he=Te(),we=L.attributes.reduce((de,ke)=>Math.max(de,ke.order),-1)+1,D=pd(Q),w=de=>de&&de.charAt(0).toLowerCase()+de.slice(1),v=new Set(L.attributes.map(de=>de.name)),z=w(Q.name);let pe=z;for(let de=2;v.has(pe);de++)pe=`${z}${de}`;const J={modelId:me,name:pe,type:Q.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:we,dbAttrs:D,embedded:{associationRef:ce,embeddableRef:$}},Z={modelId:ce,end1:{entityRef:k,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:he},end2:{entityRef:$,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:me}},W={associationRef:ce,waypoints:[],sourceColumnRef:me,targetColumnRef:void 0};return V(Le("임베드 추가",[xt(k,J),wa(Z,W)])),ce},setEmbedCollectionMode(k,$){const L=o.logical.associations.find(w=>w.modelId===k);if(!L)return;let Q,ce;for(const w of o.logical.entities){const v=w.attributes.find(z=>{var pe;return((pe=z.embedded)==null?void 0:pe.associationRef)===k&&z.attrType==="EMBED_OWN"});if(v){Q=w.modelId,ce=v;break}}if(!Q||!ce)return;const me=ce.embedded.embeddableRef,he=L.end2.entityRef===me?"end2":"end1",we=L[he],D=we.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!($==="COLLECTION"?D:!D))if($==="COLLECTION")V(Le("임베드 컬렉션 전환",[nn(Q,ce.modelId,{dbAttrs:[]}),Nn(k,he,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...we.jpa,collectionType:"LIST"}})]));else{const w=o.logical.entities.find(v=>v.modelId===me);if(!w)return;V(Le("임베드 단일 전환",[nn(Q,ce.modelId,{dbAttrs:pd(w)}),Nn(k,he,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...we.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(k){const $=o.logical.associations.find(he=>he.modelId===k),L=va(k);if(!$){V(L);return}for(const he of o.logical.entities){const we=he.attributes.find(D=>{var w;return((w=D.embedded)==null?void 0:w.associationRef)===k});if(we){V(Le("임베드 삭제",[L,Lt(he.modelId,we.modelId)]));return}}const Q=$.end2.entityRef,ce={...o.logical,associations:o.logical.associations.filter(he=>he.modelId!==k)},me=fl(ce,Q);V(me.length?Le("관계 삭제",[L,...me]):L)},setAssociationIdentifying(k,$){const L=o.logical.associations.find(we=>we.modelId===k),Q=Ho(k,{identifying:$});if(!L||L.identifying===$){V(Q);return}const ce=L.end2.entityRef,me={...o.logical,associations:o.logical.associations.map(we=>we.modelId===k?{...we,identifying:$}:we)},he=fl(me,ce);V(he.length?Le("식별 관계 변경",[Q,...he]):Q)},updateAssociationEnd(k,$,L){V(Nn(k,$,L))},moveWaypoint(k,$,L){V(Nr(k,$,L))},addWaypoint(k,$,L){V(Sr(k,$,L))},removeWaypoint(k,$){V(Ir(k,$))},clearWaypoints(k){V(xr(k))},addNote(k="메모",$={x:80,y:80}){const L=Te();return V(Cr({modelId:L,memo:k,geo:{location:{...$},size:{width:200,height:120}}})),L},removeNote(k){V(Ea(k))},moveNote(k,$){V(Zn(k,$))},resizeNote(k,$){V(Rr(k,$))},setNoteMemo(k,$){V(Vr(k,$))},setNoteSwatch(k,$){V(Ar(k,$))},addNoteConnection(k,$){V(Br(k,$))},removeNoteConnection(k,$){V(Dr(k,$))},moveNoteConnectionWaypoint(k,$,L,Q){V(Or(k,$,L,Q))},addNoteConnectionWaypoint(k,$,L,Q){V(Lr(k,$,L,Q))},removeNoteConnectionWaypoint(k,$,L){V(Pr(k,$,L))},clearNoteConnectionWaypoints(k,$){V(zr(k,$))},autoLayout(){const k=Ul(o.logical,o.layout);k.length&&V(Le("자동 배치",k.map($=>kn($.id,$.location))))},copy(){const k=S.value;if((k==null?void 0:k.kind)==="attribute"){const me=o.logical.entities.find(we=>we.modelId===k.entityId);if(!me)return;const he=[...me.attributes].sort((we,D)=>we.order-D.order).filter(we=>k.ids.includes(we.modelId));if(!he.length)return;ae.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:he}));return}const $=G.value;if(!$)return;const L=o.logical.entities.find(me=>me.modelId===$),Q=o.layout.entityLayouts.find(me=>me.entityRef===$);if(!L)return;const ce=(Q==null?void 0:Q.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ae.value=JSON.parse(JSON.stringify({kind:"entity",entity:L,geo:ce}))},paste(){if(!te.value)return;const k=ae.value;if(!k)return;if(k.kind==="attribute"){const Q=G.value;if(!Q)return;const ce=o.logical.entities.find(v=>v.modelId===Q);if(!ce)return;const me=new Set(ce.attributes.map(v=>v.name)),he=new Set(ce.attributes.flatMap(v=>v.dbAttrs.map(z=>z.physicalName))),we=ce.attributes.length,D=[],w=k.attributes.map((v,z)=>{const pe=JSON.parse(JSON.stringify(v));pe.modelId=Te();for(const J of pe.dbAttrs)J.modelId=Te();me.has(pe.name)&&(pe.name=`${pe.name}_copy`);for(const J of pe.dbAttrs)J.physicalName&&he.has(J.physicalName)&&(J.physicalName=`${J.physicalName}_copy`);return pe.order=we+z,D.push(pe.modelId),xt(Q,pe)});V(w.length===1?w[0]:Le("속성 붙여넣기",w)),S.value={kind:"attribute",entityId:Q,ids:D,anchor:D[D.length-1]};return}const $=M_(k.entity),L={location:{x:k.geo.location.x+40,y:k.geo.location.y+40},size:{...k.geo.size}};V(pa($,L)),S.value={kind:"entity",id:$.modelId}}}}const Vi=Symbol("groupHover"),hd=Symbol("groupDrag"),Ln=Symbol("relationHighlight"),L_={key:0,class:"em-sel","aria-hidden":"true"},P_=["title","aria-expanded","disabled"],z_={class:"em-entity__stereotype"},U_={key:1,class:"em-entity__name"},H_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],F_=["onPointerdown"],G_={key:1,class:"em-entity__divider-label"},Y_=["title"],W_={class:"em-key-slot"},K_={class:"em-key-slot"},q_={key:0,class:"em-entity__type"},X_=["onClick"],j_={class:"em-entity__attrname"},Z_={class:"em-entity__type"},J_=["data-op"],Q_=["onPointerdown"],ew={class:"em-entity__op-vis","aria-hidden":"true"},tw=["title"],nw={key:4,class:"em-entity__footer"},yd=De(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(yn,null),i=le.useModal();function a(){o&&xi(i,o,t.id)}const l=n.inject(Vi,null),r=n.inject(Ln,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 J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),g=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>g.value.size>0);function _(J,Z){const W=Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,W)}const N=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),x=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),q=n.computed(()=>t.data.collapsed??!1);function P(){s.value&&(o==null||o.setEntityCollapsed(t.id,!q.value))}const K=n.computed(()=>x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL"),T=n.computed(()=>{const J=x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL",Z={};for(const W of y.value.attributes){const de=W.attrType.startsWith("RELATION")&&W.dbAttrs.length>0;Z[W.modelId]={pk:W.identifier,fk:de&&J,required:W.notNull&&!W.identifier}}return Z});function ie(J){if(!J)return"";const Z=[];return J.pk&&J.fk?Z.push("PFK (식별 외래키)"):J.pk?Z.push("PK (기본키)"):J.fk&&Z.push("FK (외래키)"),J.required&&Z.push("필수 (NOT NULL)"),Z.join(" · ")}const te=n.computed(()=>{const J=cl(Xe(t.data.style)),Z={};return J&&(Z["--em-header-bg"]=J.bar,Z["--em-header-fg"]=J.barOn),Z});function fe(J){var Z,W;return(W=cl(Xe((Z=t.data.attributeStyles)==null?void 0:Z[J.modelId])))==null?void 0:W.text}const M=n.computed(()=>[...y.value.operations??[]].sort((J,Z)=>J.order-Z.order)),ne=n.computed(()=>x.value==="CLASS"&&M.value.length>0),E={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function S(J){return J?E[J]:"~"}function I(J){var Z,W;return(W=cl(Xe((Z=t.data.operationStyles)==null?void 0:Z[J.modelId])))==null?void 0:W.text}function B(J,Z,W){switch(x.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:W||J}];case"LOGICAL":return[Z?{text:Z}:{text:"(논리명)",missing:!0}];default:{const de=Z?{text:Z}:{text:"(논리명)",missing:!0};return W?[de,{text:` · ${W}`}]:[de]}}}function G(J){var Z,W,de;return X(J)?[{text:J.name}]:B(J.name,(W=(Z=J.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:W.ko,((de=J.dbAttrs[0])==null?void 0:de.physicalName)??"")}function X(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function A(J){return J.attrType==="DIVIDER"}function ae(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const Z=o==null?void 0:o.embeddableCatalog.value.find(de=>de.type===J.type);if(!Z)return J.dbAttrs;const W=Wn(y.value.attributes.flatMap(de=>de.dbAttrs));return J.dbAttrs.map((de,ke)=>{const xe=Z.fields[ke],H=Do(de,W);return H?{...de,physicalName:H.physicalName,logicalName:de.logicalName??(xe==null?void 0:xe.logicalName),dataType:de.dataType||(xe==null?void 0:xe.dataType)||""}:xe?{...de,physicalName:de.physicalName||xe.physicalName,logicalName:de.logicalName??xe.logicalName,dataType:de.dataType||xe.dataType,length:de.length??xe.length}:de})}function se(J){var Z;return B(J.physicalName,(Z=J.logicalName)==null?void 0:Z.ko,J.physicalName)}function ge(J){const Z=Jl(J,(o==null?void 0:o.state.logical.associations)??[]);return sa(x.value,J,Z)}const _e=n.computed(()=>{var J,Z,W;return B(y.value.name,(Z=(J=y.value.table)==null?void 0:J.logicalName)==null?void 0:Z.ko,((W=y.value.table)==null?void 0:W.physicalName)??"")}),re=n.ref(!1),ye=n.ref(""),be=n.ref(null);async function $e(){var J,Z;s.value&&(ye.value=y.value.name,re.value=!0,await n.nextTick(),(J=be.value)==null||J.focus(),(Z=be.value)==null||Z.select())}function Se(){if(!re.value)return;re.value=!1;const J=ye.value.trim();J&&J!==y.value.name&&(o==null||o.renameEntity(t.id,J))}function Ce(){o==null||o.addAttribute(t.id)}function Y(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:U,findNode:V}=Me(),C=n.ref(null),R=n.computed(()=>{const J=C.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let O=null;function oe(J){var de,ke,xe;if(!s.value)return;J.stopPropagation();const Z=(de=V(t.id))==null?void 0:de.dimensions,W=U({x:J.clientX,y:J.clientY});O={fx:W.x,fy:W.y,w:(Z==null?void 0:Z.width)??((ke=t.data.size)==null?void 0:ke.width)??200,h:(Z==null?void 0:Z.height)??((xe=t.data.size)==null?void 0:xe.height)??120},J.target.setPointerCapture(J.pointerId)}function j(J){if(!O)return;const Z=U({x:J.clientX,y:J.clientY});C.value={width:Math.max(40,O.w+(Z.x-O.fx)),height:Math.max(40,O.h+(Z.y-O.fy))}}function k(J){var Z,W,de;if(O&&C.value&&o){const ke=(Z=V(t.id))==null?void 0:Z.dimensions;o.resizeEntity(t.id,{width:Math.round((ke==null?void 0:ke.width)??C.value.width),height:Math.round((ke==null?void 0:ke.height)??C.value.height)})}O=null,C.value=null,(de=(W=J.target).releasePointerCapture)==null||de.call(W,J.pointerId)}const $=n.ref(null),L=n.ref(null);function Q(J,Z){if(!s.value)return;Z.stopPropagation(),Z.preventDefault();const W=g.value,de=W.has(J.modelId)?new Set(W):new Set([J.modelId]);L.value={ids:de,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId)}function ce(J){if(!L.value||!$.value)return;const Z=Array.from($.value.querySelectorAll(".em-entity__row"));if(!Z.length)return;let W=Z.length;for(let xe=0;xe<Z.length;xe++){const H=Z[xe].getBoundingClientRect();if(J.clientY<H.top+H.height/2){W=xe;break}}const de=Z[Z.length-1],ke=W<Z.length?Z[W].offsetTop:de.offsetTop+de.offsetHeight;L.value={...L.value,dropIndex:W,lineY:ke}}function me(){const J=L.value;if(L.value=null,!J||J.dropIndex<0)return;const Z=y.value.attributes,W=Z.filter(ee=>J.ids.has(ee.modelId)).map(ee=>ee.modelId),de=Z.filter((ee,F)=>J.ids.has(ee.modelId)&&F<J.dropIndex).length,ke=J.dropIndex-de,xe=Z.filter(ee=>!J.ids.has(ee.modelId)).map(ee=>ee.modelId);[...xe.slice(0,ke),...W,...xe.slice(ke)].join(",")!==Z.map(ee=>ee.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,W,ke))}function he(){L.value=null}const we=n.ref(null),D=n.ref(null);function w(J,Z){s.value&&(Z.stopPropagation(),Z.preventDefault(),D.value={id:J.modelId,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId))}function v(J){if(!D.value||!we.value)return;const Z=Array.from(we.value.querySelectorAll(".em-entity__op-row"));if(!Z.length)return;let W=Z.length;for(let xe=0;xe<Z.length;xe++){const H=Z[xe].getBoundingClientRect();if(J.clientY<H.top+H.height/2){W=xe;break}}const de=Z[Z.length-1],ke=W<Z.length?Z[W].offsetTop:de.offsetTop+de.offsetHeight;D.value={...D.value,dropIndex:W,lineY:ke}}function z(){const J=D.value;if(D.value=null,!J||J.dropIndex<0)return;const W=M.value.findIndex(ke=>ke.modelId===J.id);if(W<0)return;const de=J.dropIndex-(W<J.dropIndex?1:0);de!==W&&(o==null||o.reorderOperations(t.id,[J.id],de))}function pe(){D.value=null}return(J,Z)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":N.value,"is-selected":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value}]),style:n.normalizeStyle(R.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",L_,[...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(te.value),onDblclick:n.withModifiers($e,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:q.value?"펼치기":"접기","aria-expanded":!q.value,disabled:!s.value,onClick:n.withModifiers(P,["stop"]),onPointerdown:Z[0]||(Z[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Z[1]||(Z[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(q.value?"▸":"▾"),41,P_),n.createElementVNode("span",z_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),re.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:be,"onUpdate:modelValue":Z[2]||(Z[2]=W=>ye.value=W),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Se,["enter"]),Z[3]||(Z[3]=n.withKeys(W=>re.value=!1,["esc"]))],onBlur:Se,onPointerdown:Z[4]||(Z[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",U_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_e.value,(W,de)=>(n.openBlock(),n.createElementBlock("span",{key:de,class:n.normalizeClass({"em-entity__missing":W.missing})},n.toDisplayString(W.text),3))),128))]))],36),q.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$,class:"em-entity__attrs"},[L.value&&L.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${L.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,W=>{var de,ke,xe,H;return n.openBlock(),n.createElementBlock(n.Fragment,{key:W.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(W.modelId),"is-dragging":(de=L.value)==null?void 0:de.ids.has(W.modelId),"is-embed":X(W),"is-divider":A(W),nodrag:A(W)&&s.value}]),"data-attr":W.modelId,onClick:n.withModifiers(ee=>_(W,ee),["stop"]),onPointerdown:ee=>A(W)?Q(W,ee):void 0,onPointermove:ee=>A(W)?ce(ee):void 0,onPointerup:ee=>A(W)?me():void 0,onPointercancel:ee=>A(W)?he():void 0},[s.value&&!A(W)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ee=>Q(W,ee),onPointermove:ce,onPointerup:me,onPointercancel:he,onClick:Z[5]||(Z[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,F_)):n.createCommentVNode("",!0),A(W)?(n.openBlock(),n.createElementBlock("span",G_,n.toDisplayString(W.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(fn),{id:`l:${W.modelId}`,type:"target",position:n.unref(Ie).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ie(T.value[W.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",W_,[(ke=T.value[W.modelId])!=null&&ke.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(xe=T.value[W.modelId])!=null&&xe.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",K_,[X(W)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(H=T.value[W.modelId])!=null&&H.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Y_),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:fe(W)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(G(W),(ee,F)=>(n.openBlock(),n.createElementBlock("span",{key:F,class:n.normalizeClass({"em-entity__missing":ee.missing})},n.toDisplayString(ee.text),3))),128))],4),ge(W)?(n.openBlock(),n.createElementBlock("span",q_,n.toDisplayString(ge(W)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(fn),{id:`r:${W.modelId}`,type:"source",position:n.unref(Ie).Right,class:"em-handle"},null,8,["id","position"])],64))],42,H_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(X(W)&&K.value?ae(W):[],ee=>(n.openBlock(),n.createElementBlock("li",{key:`${W.modelId}:${ee.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(W.modelId)}]),onClick:n.withModifiers(F=>_(W,F),["stop"])},[Z[8]||(Z[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",j_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se(ee),(F,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))]),n.createElementVNode("span",Z_,n.toDisplayString(ee.dataType),1)],10,X_))),128))],64)}),128))],512)),!q.value&&ne.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:we,class:"em-entity__ops"},[D.value&&D.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${D.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.value,W=>{var de;return n.openBlock(),n.createElementBlock("li",{key:W.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((de=D.value)==null?void 0:de.id)===W.modelId}]),"data-op":W.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ke=>w(W,ke),onPointermove:v,onPointerup:z,onPointercancel:pe,onClick:Z[6]||(Z[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Q_)):n.createCommentVNode("",!0),n.createElementVNode("span",ew,n.toDisplayString(S(W.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:I(W)})},n.toDisplayString(W.name)+"()",5)],10,J_)}),128))],512)):M.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${M.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(M.value.length)+"개",1)],8,tw)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",nw,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:Ce},"+ 속성"),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:Y},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!re.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:oe,onPointermove:j,onPointerup:k},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3eac9bf0"]]),ow={key:0,class:"em-sel","aria-hidden":"true"},iw={class:"em-group__label"},aw={class:"em-group__name"},lw={key:0,class:"em-group__pkg"},rw={key:1,class:"em-group__flag"},gd=De(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>Xe(t.data.style)),a=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),l=n.inject(yn,null),r=n.computed(()=>!!l&&l.editable.value),s=n.computed(()=>{var T;return!!t.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===t.id}),c=n.computed(()=>!!t.selected&&!s.value),d=n.inject(Vi,null),u=n.computed(()=>!!t.id&&(d==null?void 0:d.value)===t.id),f=n.inject(Ln,null);function h(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const p=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),g=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:b,findNode:_}=Me();let N=null,y=null;function x(T){var fe;if(!t.id||!r.value)return;T.stopPropagation();const ie=((fe=_(t.id))==null?void 0:fe.dimensions)??{width:400,height:300},te=b({x:T.clientX,y:T.clientY});N={fx:te.x,fy:te.y,w:ie.width,h:ie.height},T.target.setPointerCapture(T.pointerId)}function q(T){if(!N||!t.id)return;const ie=b({x:T.clientX,y:T.clientY});y={width:Math.max(160,N.w+(ie.x-N.fx)),height:Math.max(120,N.h+(ie.y-N.fy))};const te=_(t.id);te&&(te.style={width:`${y.width}px`,height:`${y.height}px`})}function P(T){var ie,te;N&&y&&t.id&&l&&l.resizeGroup(t.id,y),N=null,y=null,(te=(ie=T.target).releasePointerCapture)==null||te.call(ie,T.pointerId)}const K=n.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||"그룹"});return(T,ie)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":p.value,"is-dimmed":g.value,"is-selected":s.value,"is-multi-selected":c.value}]),style:n.normalizeStyle(a.value),onMouseenter:h,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",ow,[...ie[0]||(ie[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",iw,[n.createElementVNode("span",aw,n.toDisplayString(K.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",lw,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",rw,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:x,onPointermove:q,onPointerup:P},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),sw={key:0,class:"em-sel","aria-hidden":"true"},cw={key:2,class:"em-note__text"},bd=De(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(yn,null),i=n.inject(Vi,null),a=n.inject(Ln,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>Xe(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 E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===t.id}),g=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:Ie.Top},{id:"n-right",pos:Ie.Right},{id:"n-bottom",pos:Ie.Bottom},{id:"n-left",pos:Ie.Left}],N=n.ref(!1),y=n.ref(""),x=n.ref(null);async function q(){var E;r.value&&(y.value=l.value.memo,N.value=!0,await n.nextTick(),(E=x.value)==null||E.focus())}function P(){N.value&&(N.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:K,findNode:T}=Me();let ie=null,te=null;function fe(E){var B;if(!r.value)return;E.stopPropagation();const S=((B=T(t.id))==null?void 0:B.dimensions)??l.value.geo.size,I=K({x:E.clientX,y:E.clientY});ie={fx:I.x,fy:I.y,w:S.width,h:S.height},E.target.setPointerCapture(E.pointerId)}function M(E){if(!ie)return;const S=K({x:E.clientX,y:E.clientY});te={width:Math.max(140,ie.w+(S.x-ie.fx)),height:Math.max(60,ie.h+(S.y-ie.fy))};const I=T(t.id);I&&(I.style={width:`${te.width}px`,height:`${te.height}px`})}function ne(E){var S,I;ie&&te&&o&&o.resizeNote(t.id,te),ie=null,te=null,(I=(S=E.target).releasePointerCapture)==null||I.call(S,E.pointerId)}return(E,S)=>(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":g.value}]),style:n.normalizeStyle(c.value),onDblclick:q,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",sw,[...S[4]||(S[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:x,"onUpdate:modelValue":S[0]||(S[0]=I=>y.value=I),class:"em-note__edit nodrag",onBlur:P,onKeydown:S[1]||(S[1]=n.withKeys(I=>N.value=!1,["esc"])),onPointerdown:S[2]||(S[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",cw,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,I=>n.createVNode(n.unref(fn),{id:I.id,key:I.id,type:"source",position:I.pos,class:"em-note-handle",onPointerdown:S[3]||(S[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:fe,onPointermove:M,onPointerup:ne},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),dw=20,uw=22,fw=7,mw=22,_d=31,wd=7,pw=20,vd=11,Ed=11,hw=_d+wd;function yw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function gw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ai(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 kd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Ti(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Nd(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:kd(e,t);return[Ti(o,a,l-Math.PI/2),Ti(o,a,l+Math.PI/2)]}function Id(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 $d(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=Ai(e,t,dw),[d,u]=Nd(e,t,c,uw);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}),yw(o.multiplicity)){const f=Ai(e,t,_d);l.push({cx:f.x,cy:f.y,r:wd})}if(gw(o.multiplicity)){const f=Ai(e,t,fw),[h,m]=Nd(e,t,f,mw);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=Ai(e,t,pw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=kd(e,t),f=Ti(d,vd/2,u-Math.PI/2),h=Ti(d,vd/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=Id(s,c,Ed,!0),u=Id(s,c,Ed,!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 xd=200,Sd=120,ml=24;function Cd(e){var a,l;if(!e)return{x:0,y:0,width:xd,height:Sd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||xd,i=((l=e.dimensions)==null?void 0:l.height)||Sd;return{x:t.x,y:t.y,width:o,height:i}}function Rd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Vd(e){const t=n.computed(()=>Cd(e.sourceNode())),o=n.computed(()=>Cd(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)<ml){const g=(f+h)/2;f=g-ml/2,h=g+ml/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??Rd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Rd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ia(t.value,d,l.value.x):oa(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ia(o.value,d,r.value.x):oa(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 pl=Symbol("waypointController"),bw=["d"],_w=["d"],ww=["d"],vw=["x1","y1","x2","y2"],Ew=["cx","cy","r"],kw=["x","y"],Nw=["x","y"],Iw=["cx","cy","onDblclick"],$w=["x","y","onPointerdown","onDblclick"],Ad=De(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Me(),i=n.inject(pl),a=n.inject(yn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(hd,null),s=n.inject(Ln,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var Y;return((Y=a==null?void 0:a.selection.value)==null?void 0:Y.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 Y=r==null?void 0:r.value;if(!Y||!a)return null;const U=a.resolved.value.entities,V=R=>{var O;return(O=U.find(oe=>oe.entity.modelId===R))==null?void 0:O.groupRef},C=t.data.association;return V(C.end1.entityRef)===Y.groupId&&V(C.end2.entityRef)===Y.groupId?{dx:Y.dx,dy:Y.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),g=n.computed(()=>{const Y=f.value;return h.value.map((U,V)=>V===m.value?p.value:Y?{x:U.x+Y.dx,y:U.y+Y.dy}:U)}),b=n.computed(()=>{var Y;return!!((Y=t.sourceNode.data)!=null&&Y.collapsed)}),_=n.computed(()=>{var Y;return!!((Y=t.targetNode.data)!=null&&Y.collapsed)}),{source:N,target:y,sourceSide:x,targetSide:q,isSelf:P}=Vd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),K=hw+4,T=n.computed(()=>P.value?zl(N.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ea(N.value,x.value,g.value,y.value,q.value,K):na(N.value,g.value,y.value)),ie=n.computed(()=>P.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(N.value,x.value,g.value,y.value,q.value,K):aa(N.value,g.value,y.value).map((Y,U)=>({point:Y,segIndex:U}))),te=n.computed(()=>P.value||!l.value?[]:g.value);function fe(Y){switch(Y){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function M(Y,U){m.value=Y,p.value={...h.value[Y]},U.target.setPointerCapture(U.pointerId),U.stopPropagation()}function ne(Y){if(m.value<0)return;const U=o({x:Y.clientX,y:Y.clientY});p.value={x:U.x,y:U.y}}function E(Y){var U,V;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(V=(U=Y.target).releasePointerCapture)==null||V.call(U,Y.pointerId)}function S(Y,U){U.stopPropagation(),i==null||i.removePoint(t.id,Y)}function I(Y,U){if(!i)return;const V=o({x:U.clientX,y:U.clientY});i.insertPoint(t.id,Y,{x:V.x,y:V.y})}const B=n.computed(()=>fe(t.data.association.end1.multiplicity)),G=n.computed(()=>fe(t.data.association.end2.multiplicity)),X=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),A=n.computed(()=>X.value==="class"),ae=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Y=Gn(x.value);return{x:N.value.x+Y.x*10,y:N.value.y+Y.y*10}}return g.value[0]??y.value}),se=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const U=Gn(q.value);return{x:y.value.x+U.x*10,y:y.value.y+U.y*10}}const Y=g.value;return Y[Y.length-1]??N.value}),ge=n.computed(()=>{const Y=t.data.association;return{multiplicity:Y.end1.multiplicity,navigable:Y.end1.navigable,composition:Y.end1.composition,otherNavigable:Y.end2.navigable}}),_e=n.computed(()=>{const Y=t.data.association;return{multiplicity:Y.end2.multiplicity,navigable:Y.end2.navigable,composition:Y.end2.composition,otherNavigable:Y.end1.navigable}}),re=n.computed(()=>$d(N.value,ae.value,ge.value,X.value)),ye=n.computed(()=>$d(y.value,se.value,_e.value,X.value)),be=n.computed(()=>[...re.value.lines,...ye.value.lines]),$e=n.computed(()=>[...re.value.circles,...ye.value.circles]),Se=n.computed(()=>[...re.value.polygons,...ye.value.polygons].map(Y=>`M${Y.points.map(U=>`${U.x},${U.y}`).join(" L")} Z`)),Ce=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(Y,U)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:T.value,fill:"none",class:"em-edge__hit"},null,8,bw),n.createElementVNode("path",{d:T.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,_w),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Se.value,(V,C)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${C}`,d:V,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ce.value])},null,10,ww))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(V,C)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${C}`,x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,class:n.normalizeClass(["em-edge__marker",Ce.value])},null,10,vw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($e.value,(V,C)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${C}`,cx:V.cx,cy:V.cy,r:V.r,class:n.normalizeClass(["em-edge__marker",Ce.value])},null,10,Ew))),128)),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(B.value),11,kw),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(G.value),11,Nw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ie.value,(V,C)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${C}`,cx:V.point.x,cy:V.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(R=>I(V.segIndex,R),["stop"])},null,42,Iw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te.value,(V,C)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${C}`,x:V.x-5,y:V.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:R=>M(C,R),onPointermove:ne,onPointerup:E,onDblclick:R=>S(C,R)},null,42,$w))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Tt=(e=>(e.Lines="lines",e.Dots="dots",e))(Tt||{});const Td=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]}`})},Md=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Tt.Lines+"",Tt.Dots+"";const xw={[Tt.Dots]:"#81818a",[Tt.Lines]:"#eee"},Sw=["id","x","y","width","height","patternTransform"],Cw={key:2,height:"100",width:"100"},Rw=["fill"],Vw=["x","y","fill"],Aw={name:"Background",compatConfig:{MODE:3}},Tw=n.defineComponent({...Aw,props:{id:{},variant:{default:()=>Tt.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}=Me(),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||xw[e.variant||Tt.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(Tt).Lines?(n.openBlock(),n.createBlock(n.unref(Td),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Tt).Dots?(n.openBlock(),n.createBlock(n.unref(Md),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Cw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Rw)])):n.createCommentVNode("",!0)])],8,Sw)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Vw),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Mw={name:"ControlButton",compatConfig:{MODE:3}},Bw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Dw={type:"button",class:"vue-flow__controls-button"};function Ow(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Dw,[n.renderSlot(e.$slots,"default")])}const Mi=Bw(Mw,[["render",Ow]]),Lw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Pw=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function zw(e,t){return n.openBlock(),n.createElementBlock("svg",Lw,Pw)}const Uw={render:zw},Hw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Fw=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Gw(e,t){return n.openBlock(),n.createElementBlock("svg",Hw,Fw)}const Yw={render:Gw},Ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Kw=[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 qw(e,t){return n.openBlock(),n.createElementBlock("svg",Ww,Kw)}const Xw={render:qw},jw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Zw=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 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 Jw(e,t){return n.openBlock(),n.createElementBlock("svg",jw,Zw)}const Qw={render:Jw},ev={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},tv=[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 nv(e,t){return n.openBlock(),n.createElementBlock("svg",ev,tv)}const ov={render:nv},iv={name:"Controls",compatConfig:{MODE:3}},av=n.defineComponent({...iv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>lc.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}=Me(),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 g(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function N(){l(!h.value),t("interactionChange",!h.value)}return(y,x)=>(n.openBlock(),n.createBlock(n.unref(id),{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(Mi,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Uw))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(Mi,{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(Yw))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Mi,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Xw))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(Mi,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[h.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(ov))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Qw))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var lv={value:()=>{}};function hl(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Bi(o)}function Bi(e){this._=e}function rv(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Bi.prototype=hl.prototype={constructor:Bi,on:function(e,t){var o=this._,i=rv(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=sv(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]=Bd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Bd(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Bi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function sv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Bd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=lv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var yl="http://www.w3.org/1999/xhtml";const Dd={svg:"http://www.w3.org/2000/svg",xhtml:yl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Di(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Dd.hasOwnProperty(t)?{space:Dd[t],local:e}:e}function cv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===yl&&t.documentElement.namespaceURI===yl?t.createElement(e):t.createElementNS(o,e)}}function dv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Od(e){var t=Di(e);return(t.local?dv:cv)(t)}function uv(){}function gl(e){return e==null?uv:function(){return this.querySelector(e)}}function fv(e){typeof e!="function"&&(e=gl(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 lt(i,this._parents)}function mv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pv(){return[]}function Ld(e){return e==null?pv:function(){return this.querySelectorAll(e)}}function hv(e){return function(){return mv(e.apply(this,arguments))}}function yv(e){typeof e=="function"?e=hv(e):e=Ld(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 lt(i,a)}function Pd(e){return function(){return this.matches(e)}}function zd(e){return function(t){return t.matches(e)}}var gv=Array.prototype.find;function bv(e){return function(){return gv.call(this.children,e)}}function _v(){return this.firstElementChild}function wv(e){return this.select(e==null?_v:bv(typeof e=="function"?e:zd(e)))}var vv=Array.prototype.filter;function Ev(){return Array.from(this.children)}function kv(e){return function(){return vv.call(this.children,e)}}function Nv(e){return this.selectAll(e==null?Ev:kv(typeof e=="function"?e:zd(e)))}function Iv(e){typeof e!="function"&&(e=Pd(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 lt(i,this._parents)}function Ud(e){return new Array(e.length)}function $v(){return new lt(this._enter||this._groups.map(Ud),this._parents)}function Oi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Oi.prototype={constructor:Oi,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 xv(e){return function(){return e}}function Sv(e,t,o,i,a,l){for(var r=0,s,c=t.length,d=l.length;r<d;++r)(s=t[r])?(s.__data__=l[r],i[r]=s):o[r]=new Oi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Cv(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 Oi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Rv(e){return e.__data__}function Vv(e,t){if(!arguments.length)return Array.from(this,Rv);var o=t?Cv:Sv,i=this._parents,a=this._groups;typeof e!="function"&&(e=xv(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=Av(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var N=0,y=0,x,q;N<p;++N)if(x=g[N]){for(N>=y&&(y=N+1);!(q=b[y])&&++y<p;);x._next=q||null}}return r=new lt(r,i),r._enter=s,r._exit=c,r}function Av(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Tv(){return new lt(this._exit||this._groups.map(Ud),this._parents)}function Mv(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 Bv(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 lt(s,this._parents)}function Dv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,l=i[a],r;--a>=0;)(r=i[a])&&(l&&r.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(r,l),l=r);return this}function Ov(e){e||(e=Lv);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 lt(a,this._parents).order()}function Lv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Pv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zv(){return Array.from(this)}function Uv(){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 Hv(){let e=0;for(const t of this)++e;return e}function Fv(){return!this.node()}function Gv(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 Yv(e){return function(){this.removeAttribute(e)}}function Wv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kv(e,t){return function(){this.setAttribute(e,t)}}function qv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function jv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Zv(e,t){var o=Di(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?Wv:Yv:typeof t=="function"?o.local?jv:Xv:o.local?qv:Kv)(o,t))}function Hd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Jv(e){return function(){this.style.removeProperty(e)}}function Qv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function eE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function tE(e,t,o){return arguments.length>1?this.each((t==null?Jv:typeof t=="function"?eE:Qv)(e,t,o??"")):Pn(this.node(),e)}function Pn(e,t){return e.style.getPropertyValue(t)||Hd(e).getComputedStyle(e,null).getPropertyValue(t)}function nE(e){return function(){delete this[e]}}function oE(e,t){return function(){this[e]=t}}function iE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function aE(e,t){return arguments.length>1?this.each((t==null?nE:typeof t=="function"?iE:oE)(e,t)):this.node()[e]}function Fd(e){return e.trim().split(/^|\s+/)}function bl(e){return e.classList||new Gd(e)}function Gd(e){this._node=e,this._names=Fd(e.getAttribute("class")||"")}Gd.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 Yd(e,t){for(var o=bl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Wd(e,t){for(var o=bl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function lE(e){return function(){Yd(this,e)}}function rE(e){return function(){Wd(this,e)}}function sE(e,t){return function(){(t.apply(this,arguments)?Yd:Wd)(this,e)}}function cE(e,t){var o=Fd(e+"");if(arguments.length<2){for(var i=bl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?sE:t?lE:rE)(o,t))}function dE(){this.textContent=""}function uE(e){return function(){this.textContent=e}}function fE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function mE(e){return arguments.length?this.each(e==null?dE:(typeof e=="function"?fE:uE)(e)):this.node().textContent}function pE(){this.innerHTML=""}function hE(e){return function(){this.innerHTML=e}}function yE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gE(e){return arguments.length?this.each(e==null?pE:(typeof e=="function"?yE:hE)(e)):this.node().innerHTML}function bE(){this.nextSibling&&this.parentNode.appendChild(this)}function _E(){return this.each(bE)}function wE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vE(){return this.each(wE)}function EE(e){var t=typeof e=="function"?e:Od(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kE(){return null}function NE(e,t){var o=typeof e=="function"?e:Od(e),i=t==null?kE:typeof t=="function"?t:gl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function IE(){var e=this.parentNode;e&&e.removeChild(this)}function $E(){return this.each(IE)}function xE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function CE(e){return this.select(e?SE:xE)}function RE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function VE(e){return function(t){e.call(this,t,this.__data__)}}function AE(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 TE(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 ME(e,t,o){return function(){var i=this.__on,a,l=VE(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 BE(e,t,o){var i=AE(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?ME:TE,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function Kd(e,t,o){var i=Hd(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 DE(e,t){return function(){return Kd(this,e,t)}}function OE(e,t){return function(){return Kd(this,e,t.apply(this,arguments))}}function LE(e,t){return this.each((typeof t=="function"?OE:DE)(e,t))}function*PE(){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 qd=[null];function lt(e,t){this._groups=e,this._parents=t}function _o(){return new lt([[document.documentElement]],qd)}function zE(){return this}lt.prototype=_o.prototype={constructor:lt,select:fv,selectAll:yv,selectChild:wv,selectChildren:Nv,filter:Iv,data:Vv,enter:$v,exit:Tv,join:Mv,merge:Bv,selection:zE,order:Dv,sort:Ov,call:Pv,nodes:zv,node:Uv,size:Hv,empty:Fv,each:Gv,attr:Zv,style:tE,property:aE,classed:cE,text:mE,html:gE,raise:_E,lower:vE,append:EE,insert:NE,remove:$E,clone:CE,datum:RE,on:BE,dispatch:LE,[Symbol.iterator]:PE};function Yt(e){return typeof e=="string"?new lt([[document.querySelector(e)]],[document.documentElement]):new lt([[e]],qd)}function UE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Wt(e,t){if(e=UE(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 _l={capture:!0,passive:!1};function wl(e){e.preventDefault(),e.stopImmediatePropagation()}function HE(e){var t=e.document.documentElement,o=Yt(e).on("dragstart.drag",wl,_l);"onselectstart"in t?o.on("selectstart.drag",wl,_l):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function FE(e,t){var o=e.document.documentElement,i=Yt(e).on("dragstart.drag",null);t&&(i.on("click.drag",wl,_l),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 Xd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function wo(){}var vo=.7,Li=1/vo,zn="\\s*([+-]?\\d+)\\s*",Eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",GE=/^#([0-9a-f]{3,8})$/,YE=new RegExp(`^rgb\\(${zn},${zn},${zn}\\)$`),WE=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),KE=new RegExp(`^rgba\\(${zn},${zn},${zn},${Eo}\\)$`),qE=new RegExp(`^rgba\\(${vt},${vt},${vt},${Eo}\\)$`),XE=new RegExp(`^hsl\\(${Eo},${vt},${vt}\\)$`),jE=new RegExp(`^hsla\\(${Eo},${vt},${vt},${Eo}\\)$`),jd={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(wo,ko,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zd,formatHex:Zd,formatHex8:ZE,formatHsl:JE,formatRgb:Jd,toString:Jd});function Zd(){return this.rgb().formatHex()}function ZE(){return this.rgb().formatHex8()}function JE(){return ou(this).formatHsl()}function Jd(){return this.rgb().formatRgb()}function ko(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=GE.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Qd(t):o===3?new tt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Pi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Pi(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=YE.exec(e))?new tt(t[1],t[2],t[3],1):(t=WE.exec(e))?new tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=KE.exec(e))?Pi(t[1],t[2],t[3],t[4]):(t=qE.exec(e))?Pi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=XE.exec(e))?nu(t[1],t[2]/100,t[3]/100,1):(t=jE.exec(e))?nu(t[1],t[2]/100,t[3]/100,t[4]):jd.hasOwnProperty(e)?Qd(jd[e]):e==="transparent"?new tt(NaN,NaN,NaN,0):null}function Qd(e){return new tt(e>>16&255,e>>8&255,e&255,1)}function Pi(e,t,o,i){return i<=0&&(e=t=o=NaN),new tt(e,t,o,i)}function QE(e){return e instanceof wo||(e=ko(e)),e?(e=e.rgb(),new tt(e.r,e.g,e.b,e.opacity)):new tt}function El(e,t,o,i){return arguments.length===1?QE(e):new tt(e,t,o,i??1)}function tt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}vl(tt,El,Xd(wo,{brighter(e){return e=e==null?Li:Math.pow(Li,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vo:Math.pow(vo,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tt(gn(this.r),gn(this.g),gn(this.b),zi(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:eu,formatHex:eu,formatHex8:ek,formatRgb:tu,toString:tu}));function eu(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}`}function ek(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}${bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function tu(){const e=zi(this.opacity);return`${e===1?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${e===1?")":`, ${e})`}`}function zi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bn(e){return e=gn(e),(e<16?"0":"")+e.toString(16)}function nu(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,o,i)}function ou(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof wo||(e=ko(e)),!e)return new ft;if(e instanceof ft)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 ft(r,s,c,e.opacity)}function tk(e,t,o,i){return arguments.length===1?ou(e):new ft(e,t,o,i??1)}function ft(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}vl(ft,tk,Xd(wo,{brighter(e){return e=e==null?Li:Math.pow(Li,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vo:Math.pow(vo,e),new ft(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 tt(kl(e>=240?e-240:e+120,a,i),kl(e,a,i),kl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ft(iu(this.h),Ui(this.s),Ui(this.l),zi(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=zi(this.opacity);return`${e===1?"hsl(":"hsla("}${iu(this.h)}, ${Ui(this.s)*100}%, ${Ui(this.l)*100}%${e===1?")":`, ${e})`}`}}));function iu(e){return e=(e||0)%360,e<0?e+360:e}function Ui(e){return Math.max(0,Math.min(1,e||0))}function kl(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 au=e=>()=>e;function nk(e,t){return function(o){return e+o*t}}function ok(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 ik(e){return(e=+e)==1?lu:function(t,o){return o-t?ok(t,o,e):au(isNaN(t)?o:t)}}function lu(e,t){var o=t-e;return o?nk(e,o):au(isNaN(e)?t:e)}const ru=(function e(t){var o=ik(t);function i(a,l){var r=o((a=El(a)).r,(l=El(l)).r),s=o(a.g,l.g),c=o(a.b,l.b),d=lu(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 Kt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var Nl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Il=new RegExp(Nl.source,"g");function ak(e){return function(){return e}}function lk(e){return function(t){return e(t)+""}}function rk(e,t){var o=Nl.lastIndex=Il.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Nl.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:Kt(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]?lk(c[0].x):ak(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 su=180/Math.PI,$l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cu(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)*su,skewX:Math.atan(c)*su,scaleX:r,scaleY:s}}var Hi;function sk(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$l:cu(t.a,t.b,t.c,t.d,t.e,t.f)}function ck(e){return e==null||(Hi||(Hi=document.createElementNS("http://www.w3.org/2000/svg","g")),Hi.setAttribute("transform",e),!(e=Hi.transform.baseVal.consolidate()))?$l:(e=e.matrix,cu(e.a,e.b,e.c,e.d,e.e,e.f))}function du(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 g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:Kt(d,f)},{i:g-2,x:Kt(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:Kt(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:Kt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:Kt(d,f)},{i:g-2,x:Kt(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,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var dk=du(sk,"px, ","px)","deg)"),uk=du(ck,", ",")",")"),fk=1e-12;function uu(e){return((e=Math.exp(e))+1/e)/2}function mk(e){return((e=Math.exp(e))-1/e)/2}function pk(e){return((e=Math.exp(2*e))-1)/(e+1)}const hk=(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,g=m*m+p*p,b,_;if(g<fk)_=Math.log(h/d)/t,b=function(K){return[s+K*m,c+K*p,d*Math.exp(t*K*_)]};else{var N=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*N),x=(h*h-d*d-i*g)/(2*h*o*N),q=Math.log(Math.sqrt(y*y+1)-y),P=Math.log(Math.sqrt(x*x+1)-x);_=(P-q)/t,b=function(K){var T=K*_,ie=uu(q),te=d/(o*N)*(ie*pk(t*T+q)-mk(q));return[s+te*m,c+te*p,d*ie/uu(t*T+q)]}}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 Un=0,No=0,Io=0,fu=1e3,Fi,$o,Gi=0,_n=0,Yi=0,xo=typeof performance=="object"&&performance.now?performance:Date,mu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xl(){return _n||(mu(yk),_n=xo.now()+Yi)}function yk(){_n=0}function Wi(){this._call=this._time=this._next=null}Wi.prototype=pu.prototype={constructor:Wi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?xl():+o)+(t==null?0:+t),!this._next&&$o!==this&&($o?$o._next=this:Fi=this,$o=this),this._call=e,this._time=o,Sl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sl())}};function pu(e,t,o){var i=new Wi;return i.restart(e,t,o),i}function gk(){xl(),++Un;for(var e=Fi,t;e;)(t=_n-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Un}function hu(){_n=(Gi=xo.now())+Yi,Un=No=0;try{gk()}finally{Un=0,_k(),_n=0}}function bk(){var e=xo.now(),t=e-Gi;t>fu&&(Yi-=t,Gi=e)}function _k(){for(var e,t=Fi,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:Fi=o);$o=e,Sl(i)}function Sl(e){if(!Un){No&&(No=clearTimeout(No));var t=e-_n;t>24?(e<1/0&&(No=setTimeout(hu,e-xo.now()-Yi)),Io&&(Io=clearInterval(Io))):(Io||(Gi=xo.now(),Io=setInterval(bk,fu)),Un=1,mu(hu))}}function yu(e,t,o){var i=new Wi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var wk=hl("start","end","cancel","interrupt"),vk=[],gu=0,bu=1,Cl=2,Ki=3,_u=4,Rl=5,qi=6;function Xi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Ek(e,o,{name:t,index:i,group:a,on:wk,tween:vk,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:gu})}function Vl(e,t){var o=mt(e,t);if(o.state>gu)throw new Error("too late; already scheduled");return o}function Et(e,t){var o=mt(e,t);if(o.state>Ki)throw new Error("too late; already running");return o}function mt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Ek(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=pu(l,0,o.time);function l(d){o.state=bu,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!==bu)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Ki)return yu(r);m.state===_u?(m.state=qi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=qi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(yu(function(){o.state===Ki&&(o.state=_u,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Cl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Cl){for(o.state=Ki,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=Rl,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Rl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ji(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>Cl&&i.state<Rl,i.state=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function kk(e){return this.each(function(){ji(this,e)})}function Nk(e,t){var o,i;return function(){var a=Et(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 Ik(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Et(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 $k(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=mt(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?Nk:Ik)(o,e,t))}function Al(e,t,o){var i=e._id;return e.each(function(){var a=Et(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return mt(a,i).value[t]}}function wu(e,t){var o;return(typeof t=="number"?Kt:t instanceof ko?ru:(o=ko(t))?(t=o,ru):rk)(e,t)}function xk(e){return function(){this.removeAttribute(e)}}function Sk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ck(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 Rk(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 Vk(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 Ak(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 Tk(e,t){var o=Di(e),i=o==="transform"?uk:wu;return this.attrTween(e,typeof t=="function"?(o.local?Ak:Vk)(o,i,Al(this,"attr."+e,t)):t==null?(o.local?Sk:xk)(o):(o.local?Rk:Ck)(o,i,t))}function Mk(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Bk(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Dk(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Bk(e,l)),o}return a._value=t,a}function Ok(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Mk(e,l)),o}return a._value=t,a}function Lk(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=Di(e);return this.tween(o,(i.local?Dk:Ok)(i,t))}function Pk(e,t){return function(){Vl(this,e).delay=+t.apply(this,arguments)}}function zk(e,t){return t=+t,function(){Vl(this,e).delay=t}}function Uk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Pk:zk)(t,e)):mt(this.node(),t).delay}function Hk(e,t){return function(){Et(this,e).duration=+t.apply(this,arguments)}}function Fk(e,t){return t=+t,function(){Et(this,e).duration=t}}function Gk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hk:Fk)(t,e)):mt(this.node(),t).duration}function Yk(e,t){if(typeof t!="function")throw new Error;return function(){Et(this,e).ease=t}}function Wk(e){var t=this._id;return arguments.length?this.each(Yk(t,e)):mt(this.node(),t).ease}function Kk(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Et(this,e).ease=o}}function qk(e){if(typeof e!="function")throw new Error;return this.each(Kk(this._id,e))}function Xk(e){typeof e!="function"&&(e=Pd(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Mt(i,this._parents,this._name,this._id)}function jk(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 Mt(r,this._parents,this._name,this._id)}function Zk(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 Jk(e,t,o){var i,a,l=Zk(t)?Vl:Et;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Qk(e,t){var o=this._id;return arguments.length<2?mt(this.node(),o).on.on(e):this.each(Jk(o,e,t))}function eN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function tN(){return this.on("end.remove",eN(this._id))}function nN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=gl(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,Xi(d[h],t,o,h,d,mt(u,o)));return new Mt(l,this._parents,t,o)}function oN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Ld(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=mt(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&Xi(m,t,o,g,h,p);l.push(h),r.push(u)}return new Mt(l,r,t,o)}var iN=_o.prototype.constructor;function aN(){return new iN(this._groups,this._parents)}function lN(e,t){var o,i,a;return function(){var l=Pn(this,e),r=(this.style.removeProperty(e),Pn(this,e));return l===r?null:l===o&&r===i?a:a=t(o=l,i=r)}}function vu(e){return function(){this.style.removeProperty(e)}}function rN(e,t,o){var i,a=o+"",l;return function(){var r=Pn(this,e);return r===a?null:r===i?l:l=t(i=r,o)}}function sN(e,t,o){var i,a,l;return function(){var r=Pn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Pn(this,e))),r===c?null:r===i&&c===a?l:(a=c,l=t(i=r,s))}}function cN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Et(this,e),d=c.on,u=c.value[l]==null?s||(s=vu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function dN(e,t,o){var i=(e+="")=="transform"?dk:wu;return t==null?this.styleTween(e,lN(e,i)).on("end.style."+e,vu(e)):typeof t=="function"?this.styleTween(e,sN(e,i,Al(this,"style."+e,t))).each(cN(this._id,e)):this.styleTween(e,rN(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 fN(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 mN(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,fN(e,t,o??""))}function pN(e){return function(){this.textContent=e}}function hN(e){return function(){var t=e(this);this.textContent=t??""}}function yN(e){return this.tween("text",typeof e=="function"?hN(Al(this,"text",e)):pN(e==null?"":e+""))}function gN(e){return function(t){this.textContent=e.call(this,t)}}function bN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&gN(a)),t}return i._value=e,i}function _N(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,bN(e))}function wN(){for(var e=this._name,t=this._id,o=Eu(),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=mt(c,t);Xi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(i,this._parents,e,o)}function vN(){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=Et(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 EN=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Eu(){return++EN}var Bt=_o.prototype;Mt.prototype={constructor:Mt,select:nN,selectAll:oN,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:Xk,merge:jk,selection:aN,transition:wN,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:Qk,attr:Tk,attrTween:Lk,style:dN,styleTween:mN,text:yN,textTween:_N,remove:tN,tween:$k,delay:Uk,duration:Gk,ease:Wk,easeVarying:qk,end:vN,[Symbol.iterator]:Bt[Symbol.iterator]};function kN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var NN={time:null,delay:0,duration:250,ease:kN};function IN(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 Mt?(t=e._id,e=e._name):(t=Eu(),(o=NN).time=xl(),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])&&Xi(c,e,t,d,r,o||IN(c,t));return new Mt(i,this._parents,e,t)}_o.prototype.interrupt=kk,_o.prototype.transition=$N;const Zi=e=>()=>e;function xN(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 Dt(e,t,o){this.k=e,this.x=t,this.y=o}Dt.prototype={constructor:Dt,scale:function(e){return e===1?this:new Dt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Dt(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 Tl=new Dt(1,0,0);Dt.prototype;function Ml(e){e.stopImmediatePropagation()}function So(e){e.preventDefault(),e.stopImmediatePropagation()}function SN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function CN(){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 ku(){return this.__zoom||Tl}function RN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VN(){return navigator.maxTouchPoints||"ontouchstart"in this}function AN(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 TN(){var e=SN,t=CN,o=AN,i=RN,a=VN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=hk,d=hl("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(E){E.property("__zoom",ku).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ie).on("dblclick.zoom",te).filter(a).on("touchstart.zoom",fe).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",ne).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,S,I,B){var G=E.selection?E.selection():E;G.property("__zoom",ku),E!==G?q(E,S,I,B):G.interrupt().each(function(){P(this,arguments).event(B).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},_.scaleBy=function(E,S,I,B){_.scaleTo(E,function(){var G=this.__zoom.k,X=typeof S=="function"?S.apply(this,arguments):S;return G*X},I,B)},_.scaleTo=function(E,S,I,B){_.transform(E,function(){var G=t.apply(this,arguments),X=this.__zoom,A=I==null?x(G):typeof I=="function"?I.apply(this,arguments):I,ae=X.invert(A),se=typeof S=="function"?S.apply(this,arguments):S;return o(y(N(X,se),A,ae),G,r)},I,B)},_.translateBy=function(E,S,I,B){_.transform(E,function(){return o(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),r)},null,B)},_.translateTo=function(E,S,I,B,G){_.transform(E,function(){var X=t.apply(this,arguments),A=this.__zoom,ae=B==null?x(X):typeof B=="function"?B.apply(this,arguments):B;return o(Tl.translate(ae[0],ae[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof I=="function"?-I.apply(this,arguments):-I),X,r)},B,G)};function N(E,S){return S=Math.max(l[0],Math.min(l[1],S)),S===E.k?E:new Dt(S,E.x,E.y)}function y(E,S,I){var B=S[0]-I[0]*E.k,G=S[1]-I[1]*E.k;return B===E.x&&G===E.y?E:new Dt(E.k,B,G)}function x(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function q(E,S,I,B){E.on("start.zoom",function(){P(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(B).end()}).tween("zoom",function(){var G=this,X=arguments,A=P(G,X).event(B),ae=t.apply(G,X),se=I==null?x(ae):typeof I=="function"?I.apply(G,X):I,ge=Math.max(ae[1][0]-ae[0][0],ae[1][1]-ae[0][1]),_e=G.__zoom,re=typeof S=="function"?S.apply(G,X):S,ye=c(_e.invert(se).concat(ge/_e.k),re.invert(se).concat(ge/re.k));return function(be){if(be===1)be=re;else{var $e=ye(be),Se=ge/$e[2];be=new Dt(Se,se[0]-$e[0]*Se,se[1]-$e[1]*Se)}A.zoom(null,be)}})}function P(E,S,I){return!I&&E.__zooming||new K(E,S)}function K(E,S){this.that=E,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,S),this.taps=0}K.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,S){return this.mouse&&E!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var S=Yt(this.that).datum();d.call(E,this.that,new xN(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),S)}};function T(E,...S){if(!e.apply(this,arguments))return;var I=P(this,S).event(E),B=this.__zoom,G=Math.max(l[0],Math.min(l[1],B.k*Math.pow(2,i.apply(this,arguments)))),X=Wt(E);if(I.wheel)(I.mouse[0][0]!==X[0]||I.mouse[0][1]!==X[1])&&(I.mouse[1]=B.invert(I.mouse[0]=X)),clearTimeout(I.wheel);else{if(B.k===G)return;I.mouse=[X,B.invert(X)],ji(this),I.start()}So(E),I.wheel=setTimeout(A,p),I.zoom("mouse",o(y(N(B,G),I.mouse[0],I.mouse[1]),I.extent,r));function A(){I.wheel=null,I.end()}}function ie(E,...S){if(h||!e.apply(this,arguments))return;var I=E.currentTarget,B=P(this,S,!0).event(E),G=Yt(E.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",ge,!0),X=Wt(E,I),A=E.clientX,ae=E.clientY;HE(E.view),Ml(E),B.mouse=[X,this.__zoom.invert(X)],ji(this),B.start();function se(_e){if(So(_e),!B.moved){var re=_e.clientX-A,ye=_e.clientY-ae;B.moved=re*re+ye*ye>g}B.event(_e).zoom("mouse",o(y(B.that.__zoom,B.mouse[0]=Wt(_e,I),B.mouse[1]),B.extent,r))}function ge(_e){G.on("mousemove.zoom mouseup.zoom",null),FE(_e.view,B.moved),So(_e),B.event(_e).end()}}function te(E,...S){if(e.apply(this,arguments)){var I=this.__zoom,B=Wt(E.changedTouches?E.changedTouches[0]:E,this),G=I.invert(B),X=I.k*(E.shiftKey?.5:2),A=o(y(N(I,X),B,G),t.apply(this,S),r);So(E),s>0?Yt(this).transition().duration(s).call(q,A,B,E):Yt(this).call(_.transform,A,B,E)}}function fe(E,...S){if(e.apply(this,arguments)){var I=E.touches,B=I.length,G=P(this,S,E.changedTouches.length===B).event(E),X,A,ae,se;for(Ml(E),A=0;A<B;++A)ae=I[A],se=Wt(ae,this),se=[se,this.__zoom.invert(se),ae.identifier],G.touch0?!G.touch1&&G.touch0[2]!==se[2]&&(G.touch1=se,G.taps=0):(G.touch0=se,X=!0,G.taps=1+!!u);u&&(u=clearTimeout(u)),X&&(G.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),ji(this),G.start())}}function M(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A,ae,se;for(So(E),X=0;X<G;++X)A=B[X],ae=Wt(A,this),I.touch0&&I.touch0[2]===A.identifier?I.touch0[0]=ae:I.touch1&&I.touch1[2]===A.identifier&&(I.touch1[0]=ae);if(A=I.that.__zoom,I.touch1){var ge=I.touch0[0],_e=I.touch0[1],re=I.touch1[0],ye=I.touch1[1],be=(be=re[0]-ge[0])*be+(be=re[1]-ge[1])*be,$e=($e=ye[0]-_e[0])*$e+($e=ye[1]-_e[1])*$e;A=N(A,Math.sqrt(be/$e)),ae=[(ge[0]+re[0])/2,(ge[1]+re[1])/2],se=[(_e[0]+ye[0])/2,(_e[1]+ye[1])/2]}else if(I.touch0)ae=I.touch0[0],se=I.touch0[1];else return;I.zoom("touch",o(y(A,ae,se),I.extent,r))}}function ne(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A;for(Ml(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),X=0;X<G;++X)A=B[X],I.touch0&&I.touch0[2]===A.identifier?delete I.touch0:I.touch1&&I.touch1[2]===A.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(A=Wt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<b)){var ae=Yt(this).on("dblclick.zoom");ae&&ae.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Zi(+E),_):i},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Zi(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Zi(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Zi([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(l[0]=+E[0],l[1]=+E[1],_):[l[0],l[1]]},_.translateExtent=function(E){return arguments.length?(r[0][0]=+E[0][0],r[1][0]=+E[1][0],r[0][1]=+E[0][1],r[1][1]=+E[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(E){return arguments.length?(o=E,_):o},_.duration=function(E){return arguments.length?(s=+E,_):s},_.interpolate=function(E){return arguments.length?(c=E,_):c},_.on=function(){var E=d.on.apply(d,arguments);return E===d?_:E},_.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,_):Math.sqrt(g)},_.tapDistance=function(E){return arguments.length?(b=+E,_):b},_}const Nu=Symbol("MiniMapSlots"),MN=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],BN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},DN=n.defineComponent({...BN,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(Nu),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,MN))],64)):n.createCommentVNode("",!0)}}),ON=["width","height","viewBox","aria-labelledby"],LN=["id"],PN=["d","fill","stroke","stroke-width"],zN={name:"MiniMap",compatConfig:{MODE:3}},UN=n.defineComponent({...zN,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}=Me(),g=n.ref();n.provide(Nu,o);const b=n.toRef(()=>{var G;return e.width??((G=i.style)==null?void 0:G.width)??a}),_=n.toRef(()=>{var G;return e.height??((G=i.style)==null?void 0:G.height)??l}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),x=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),q=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),P=n.computed(()=>Xa(p.value.filter(G=>!G.hidden))),K=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})),T=n.computed(()=>p.value&&p.value.length?Ig(P.value,K.value):K.value),ie=n.computed(()=>{const G=T.value.width/b.value,X=T.value.height/_.value;return Math.max(G,X)}),te=n.computed(()=>{const G=ie.value*b.value,X=ie.value*_.value,A=e.offsetScale*ie.value;return{offset:A,x:T.value.x-(G-T.value.width)/2-A,y:T.value.y-(X-T.value.height)/2-A,width:G+A*2,height:X+A*2}}),fe=n.computed(()=>!te.value.x||!te.value.y?"":`
27
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Fe extends Error{constructor(t,...o){var i;super((i=Ac[t])==null?void 0:i.call(Ac,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function nl(e){return"clientX"in e}function Bg(e){return"sourceEvent"in e}function vt(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 Dg(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 gi(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Og=()=>!0;function ol(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Lg(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())mi(a,fi(l))>0&&i.push(l);return i}const Pg=250;function zg(e,t,o,i){var a,l;let r=[],s=Number.POSITIVE_INFINITY;const c=Lg(e,o,t+Pg);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}=Mn(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 Tc(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:l,doc:r,lib:s,flowId:c,isValidConnection:d=Og},u,f,h,m){const p=l==="target",g=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:_}=vt(e),N=r.elementFromPoint(b,_),y=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,x={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const q=Mc(void 0,y),P=y.getAttribute("data-nodeid"),K=y.getAttribute("data-handleid"),T=y.classList.contains("connectable"),ie=y.classList.contains("connectableend");if(!P||!q)return x;const te={source:p?P:i,sourceHandle:p?K:a,target:p?i:P,targetHandle:p?a:K};x.connection=te;const M=T&&ie&&(o===At.Strict?p&&q==="source"||!p&&q==="target":P!==i||K!==a);x.isValid=M&&d(te,{nodes:f,edges:u,sourceNode:h(te.source),targetNode:h(te.target)}),x.toHandle=Bc(P,q,K,m,o,!0)}return x}function Mc(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ug(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Hg(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function Bc(e,t,o,i,a,l=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=a===At.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,...Mn(d,f,f.position,!0)}:f}const il={[Ie.Left]:Ie.Right,[Ie.Right]:Ie.Left,[Ie.Top]:Ie.Bottom,[Ie.Bottom]:Ie.Top},Fg=["production","prod"];function _o(e,...t){Dc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Dc(){return!Fg.includes(process.env.NODE_ENV||"")}function Oc(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,...pi(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 He(e){return typeof n.unref(e)<"u"}function Gg(e,t,o,i){if(!e||!e.source||!e.target)return o(new Fe(Ue.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Ht(e)?a=e:a={...e,id:yc(e)},a=pc(a,void 0,i),Ng(a,t)?!1:a}function Yg(e,t,o,i,a){if(!t.source||!t.target)return a(new Fe(Ue.EDGE_INVALID,e.id)),!1;if(!o)return a(new Fe(Ue.EDGE_NOT_FOUND,e.id)),!1;const{id:l,...r}=e;return{...r,id:i?yc(t):l,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function Lc(e,t,o){const i={},a=[];for(let l=0;l<e.length;++l){const r=e[l];if(!dn(r)){o(new Fe(Ue.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${l}]`);continue}const s=wg(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 Fe(Ue.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 Pc(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}`;Pc("source",c,u,e,a,r),Pc("target",c,d,e,l,s)}}function zc(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:Gg(d,s,a,l);if(!u)continue;const f=o(u.source),h=o(u.target);if(!f||!h){a(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){a(new Fe(Ue.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new Fe(Ue.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:h})){a(new Fe(Ue.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...pc(u,m,l),sourceNode:f,targetNode:h})}return c}const Uc=Symbol("vueFlow"),Hc=Symbol("nodeId"),Fc=Symbol("nodeRef"),Wg=Symbol("edgeId"),Kg=Symbol("edgeRef"),bi=Symbol("slots");function Gc(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:g,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:N,updateNodePositions:y,emits:x}=Me(),{onStart:q,onDrag:P,onStop:K,onClick:T,el:ie,disabled:te,id:fe,selectable:M,dragHandle:ne}=e,E=n.shallowRef(!1);let S=[],I,B=null,G={x:void 0,y:void 0},X={x:0,y:0},A=null,ae=!1,se=!1,ge=0,_e=!1;const re=jg(),ye=({x:U,y:V})=>{G={x:U,y:V};let C=!1;if(S=S.map(R=>{const O={x:U-R.distance.x,y:V-R.distance.y},{computedPosition:oe}=tl(R,o.value?gi(O,i.value):O,x.error,r.value,R.parentNode?m(R.parentNode):void 0);return C=C||R.position.x!==oe.x||R.position.y!==oe.y,R.position=oe,R}),se=se||C,!!C&&(y(S,!0,!0),E.value=!0,A)){const[R,O]=el({id:fe,dragItems:S,findNode:m});P({event:A,node:R,nodes:O})}},be=()=>{if(!B)return;const[U,V]=kc(X,B,u.value);if(U!==0||V!==0){const C={x:(G.x??0)-U/c.value.zoom,y:(G.y??0)-V/c.value.zoom};h({x:U,y:V})&&ye(C)}ge=requestAnimationFrame(be)},$e=(U,V)=>{ae=!0;const C=m(fe);!b.value&&!p.value&&C&&(C.selected||_()),C&&n.toValue(M)&&b.value&&al(C,p.value,N,_,g,!1,V);const R=re(U.sourceEvent);if(G=R,S=Cg(l.value,f.value,R,fe),S.length){const[O,oe]=el({id:fe,dragItems:S,findNode:m});q({event:U.sourceEvent,node:O,nodes:oe})}},Se=(U,V)=>{var C;U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||(se=!1,s.value===0&&$e(U,V),G=re(U.sourceEvent),B=((C=t.value)==null?void 0:C.getBoundingClientRect())||null,X=vt(U.sourceEvent,B))},Ce=(U,V)=>{const C=re(U.sourceEvent);if(!_e&&ae&&d.value&&(_e=!0,be()),!ae){const R=C.xSnapped-(G.x??0),O=C.ySnapped-(G.y??0);Math.sqrt(R*R+O*O)>s.value&&$e(U,V)}(G.x!==C.xSnapped||G.y!==C.ySnapped)&&S.length&&ae&&(A=U.sourceEvent,X=vt(U.sourceEvent,B),ye(C))},Y=U=>{let V=!1;if(!ae&&!E.value&&!p.value){const C=U.sourceEvent,R=re(C),O=R.xSnapped-(G.x??0),oe=R.ySnapped-(G.y??0),j=Math.sqrt(O*O+oe*oe);j!==0&&j<=s.value&&(T==null||T(C),V=!0)}if(S.length&&!V){se&&(y(S,!1,!1),se=!1);const[C,R]=el({id:fe,dragItems:S,findNode:m});K({event:U.sourceEvent,node:C,nodes:R})}S=[],E.value=!1,_e=!1,ae=!1,G={x:void 0,y:void 0},cancelAnimationFrame(ge)};return n.watch([()=>n.toValue(te),ie],([U,V],C,R)=>{if(V){const O=ct(V);U||(I=vh().on("start",oe=>Se(oe,V)).on("drag",oe=>Ce(oe,V)).on("end",oe=>Y(oe)).filter(oe=>{const j=oe.target,k=n.toValue(ne);return!oe.button&&(!a.value||!Cc(j,`.${a.value}`,V)&&(!k||Cc(j,k,V)))}),O.call(I)),R(()=>{O.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),E}function qg(){return{doubleClick:ke(),click:ke(),mouseEnter:ke(),mouseMove:ke(),mouseLeave:ke(),contextMenu:ke(),updateStart:ke(),update:ke(),updateEnd:ke()}}function Xg(e,t){const o=qg();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 jg(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Me();return a=>{var l;const r=((l=i.value)==null?void 0:l.getBoundingClientRect())??{left:0,top:0},s=Bg(a)?a.sourceEvent:a,{x:c,y:d}=vt(s,r),u=yo({x:c,y:d},e.value),{x:f,y:h}=o.value?gi(u,t.value):u;return{xSnapped:f,ySnapped:h,...u}}}function _i(){return!0}function Yc({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:g,findNode:b,panBy:_,startConnection:N,updateConnection:y,endConnection:x,emits:q,viewport:P,edges:K,nodes:T,isValidConnection:ie,nodeLookup:te}=Me();let fe=null,M=!1,ne=null;function E(I){var B;const G=n.toValue(o)==="target",X=nl(I),A=mc(I.target),ae=I.currentTarget;if(ae&&(X&&I.button===0||!X)){let se=function(Q){C=vt(Q,Y),ye=zg(yo(C,P.value,!1,[1,1]),u.value,te.value,oe),R||(O(),R=!0);const ce=Tc(Q,{handle:ye,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:G?"target":"source",isValidConnection:re,doc:A,lib:"vue",flowId:s,nodeLookup:te.value},K.value,T.value,b,te.value);ne=ce.handleDomNode,fe=ce.connection,M=Hg(!!ye,ce.isValid);const me={...L,isValid:M,to:ce.toHandle&&M?ho({x:ce.toHandle.x,y:ce.toHandle.y},P.value):C,toHandle:ce.toHandle,toPosition:M&&ce.toHandle?ce.toHandle.position:il[oe.position],toNode:ce.toHandle?te.value.get(ce.toHandle.nodeId):null};if(M&&ye&&(L!=null&&L.toHandle)&&me.toHandle&&L.toHandle.type===me.toHandle.type&&L.toHandle.nodeId===me.toHandle.nodeId&&L.toHandle.id===me.toHandle.id&&L.to.x===me.to.x&&L.to.y===me.to.y)return;const he=ye??ce.toHandle;if(y(he&&M?ho({x:he.x,y:he.y},P.value):C,he,Ug(!!he,M)),L=me,!ye&&!M&&!ne)return ol(V);fe&&fe.source!==fe.target&&ne&&(ol(V),V=ne,ne.classList.add("connecting","vue-flow__handle-connecting"),ne.classList.toggle("valid",!!M),ne.classList.toggle("vue-flow__handle-valid",!!M))},ge=function(Q){"touches"in Q&&Q.touches.length>0||((ye||ne)&&fe&&M&&(l?l(Q,fe):q.connect(fe)),q.connectEnd(Q),a&&(r==null||r(Q)),ol(V),cancelAnimationFrame(be),x(Q),R=!1,M=!1,fe=null,ne=null,A.removeEventListener("mousemove",se),A.removeEventListener("mouseup",ge),A.removeEventListener("touchmove",se),A.removeEventListener("touchend",ge))};const _e=b(n.toValue(t));let re=n.toValue(i)||ie.value||_i;!re&&_e&&(re=(G?_e.isValidSourcePos:_e.isValidTargetPos)||_i);let ye,be=0;const{x:$e,y:Se}=vt(I),Ce=Mc(n.toValue(a),ae),Y=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!Y||!Ce)return;const U=Bc(n.toValue(t),Ce,n.toValue(e),te.value,d.value);if(!U)return;let V,C=vt(I,Y),R=!1;const O=()=>{if(!p.value)return;const[Q,ce]=kc(C,Y,g.value);_({x:Q,y:ce}),be=requestAnimationFrame(O)},oe={...U,nodeId:n.toValue(t),type:Ce,position:U.position},j=te.value.get(n.toValue(t)),$={inProgress:!0,isValid:null,from:Mn(j,oe,Ie.Left,!0),fromHandle:oe,fromPosition:oe.position,fromNode:j,to:C,toHandle:null,toPosition:il[oe.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Ce,position:(ae==null?void 0:ae.getAttribute("data-handlepos"))||Ie.Top,...C},{x:$e-Y.left,y:Se-Y.top}),q.connectStart({event:I,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ce});let L=$;A.addEventListener("mousemove",se),A.addEventListener("mouseup",ge),A.addEventListener("touchmove",se),A.addEventListener("touchend",ge)}}function S(I){var B,G;if(!f.value)return;const X=n.toValue(o)==="target";if(!h.value){q.clickConnectStart({event:I,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Ie.Top,...vt(I)},void 0,!0);return}let A=n.toValue(i)||ie.value||_i;const ae=b(n.toValue(t));if(!A&&ae&&(A=(X?ae.isValidSourcePos:ae.isValidTargetPos)||_i),ae&&(typeof ae.connectable>"u"?m.value:ae.connectable)===!1)return;const se=mc(I.target),ge=Tc(I,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Ie.Top,...vt(I)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:A,doc:se,lib:"vue",flowId:s,nodeLookup:te.value},K.value,T.value,b,te.value),_e=((B=ge.connection)==null?void 0:B.source)===((G=ge.connection)==null?void 0:G.target);ge.isValid&&ge.connection&&!_e&&q.connect(ge.connection),q.clickConnectEnd(I),x(I,!0)}return{handlePointerDown:E,handleClick:S}}function Zg(){return n.inject(Hc,"")}function Wc(e){const t=e??Zg()??"",o=n.inject(Fc,n.ref(null)),{findNode:i,edges:a,emits:l}=Me(),r=i(t);return r||l.error(new Fe(Ue.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>un([r],a.value))}}function Jg(){return{doubleClick:ke(),click:ke(),mouseEnter:ke(),mouseMove:ke(),mouseLeave:ke(),contextMenu:ke(),dragStart:ke(),drag:ke(),dragStop:ke()}}function Qg(e,t){const o=Jg();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 Kc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:l,nodesDraggable:r,emits:s}=Me();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,g=[];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:N}=tl(b,_,s.error,t.value,b.parentNode?i(b.parentNode):void 0);g.push({id:b.id,position:N,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(g,!0,!1)}}const vi=.1,eb=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 tb={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 nb(e){function t(i,a){return new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ao:ni).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}=fc({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:ni).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:ni).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:vi,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=Za(s),{x:d,y:u,zoom:f}=vc(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??vi);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:vi})=>{const{x:r,y:s,zoom:c}=vc(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,l.padding??vi);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}}}:tb)}function sl(e,t=0,o=eb,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function ob(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,b,_=!!(o.nodes.value.length||o.edges.value.length);g=$n([e.modelValue,()=>{var N,y;return(y=(N=e.modelValue)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setElements(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=$n([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,y])=>{var x;(x=e.modelValue)!=null&&x.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...y],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let g,b,_=!!o.nodes.value.length;g=$n([e.nodes,()=>{var N,y;return(y=(N=e.nodes)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setNodes(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=$n([o.nodes,()=>o.nodes.value.length],([N])=>{var y;(y=e.nodes)!=null&&y.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let g,b,_=!!o.edges.value.length;g=$n([e.edges,()=>{var N,y;return(y=(N=e.edges)==null?void 0:N.value)==null?void 0:y.length}],([N])=>{N&&Array.isArray(N)&&(b==null||b.pause(),o.setEdges(N),!b&&!_&&N.length?_=!0:b==null||b.resume())}),b=$n([o.edges,()=>o.edges.value.length],([N])=>{var y;(y=e.edges)!=null&&y.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),n.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&He(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&He(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&He(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&He(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{He(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const g=async b=>{let _=b;typeof t.autoConnect=="function"&&(_=await t.autoConnect(b)),_!==!1&&o.addEdges([_])};n.watch(()=>t.autoConnect,()=>{He(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(b,_,N)=>{b?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},m=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(t)){const _=b;if(!g.includes(_)){const N=n.toRef(()=>t[_]),y=o[_];n.isRef(y)&&i.run(()=>{n.watch(N,x=>{He(x)&&(y.value=x)},{immediate:!0})})}}};(()=>{a(),l(),r(),c(),s(),d(),u(),f(),h(),m()})()}),()=>i.stop()}function ib(){return{edgesChange:ke(),nodesChange:ke(),nodeDoubleClick:ke(),nodeClick:ke(),nodeMouseEnter:ke(),nodeMouseMove:ke(),nodeMouseLeave:ke(),nodeContextMenu:ke(),nodeDragStart:ke(),nodeDrag:ke(),nodeDragStop:ke(),nodesInitialized:ke(),miniMapNodeClick:ke(),miniMapNodeDoubleClick:ke(),miniMapNodeMouseEnter:ke(),miniMapNodeMouseMove:ke(),miniMapNodeMouseLeave:ke(),connect:ke(),connectStart:ke(),connectEnd:ke(),clickConnectStart:ke(),clickConnectEnd:ke(),paneReady:ke(),init:ke(),move:ke(),moveStart:ke(),moveEnd:ke(),selectionDragStart:ke(),selectionDrag:ke(),selectionDragStop:ke(),selectionContextMenu:ke(),selectionStart:ke(),selectionEnd:ke(),viewportChangeStart:ke(),viewportChange:ke(),viewportChangeEnd:ke(),paneScroll:ke(),paneClick:ke(),paneContextMenu:ke(),paneMouseEnter:ke(),paneMouseMove:ke(),paneMouseLeave:ke(),edgeContextMenu:ke(),edgeMouseEnter:ke(),edgeMouseMove:ke(),edgeMouseLeave:ke(),edgeDoubleClick:ke(),edgeClick:ke(),edgeUpdateStart:ke(),edgeUpdate:ke(),edgeUpdateEnd:ke(),updateNodeInternals:ke(),error:ke(e=>_o(e.message))}}function ab(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=lb(a);return!!((l=o==null?void 0:o.vnode.props)==null?void 0:l[r])}}function lb(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,l)=>l.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function qc(){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:sn.Bezier,style:{}},connectionMode:At.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:ib(),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 rb=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function sb(e,t,o){const i=nb(e),a=C=>{const R=C??[];e.hooks.updateNodeInternals.trigger(R)},l=C=>kg(C,e.nodes,e.edges),r=C=>Eg(C,e.nodes,e.edges),s=C=>un(C,e.edges),c=({id:C,type:R,nodeId:O})=>{var oe;const j=C?`-${R}-${C}`:`-${R}`;return Array.from(((oe=e.connectionLookup.get(`${O}${j}`))==null?void 0:oe.values())??[])},d=C=>{if(C)return t.value.get(C)},u=C=>{if(C)return o.value.get(C)},f=(C,R,O)=>{var oe,j;const k=[];for(const $ of C){const L={id:$.id,type:"position",dragging:O,from:$.from};if(R&&(L.position=$.position,$.parentNode)){const Q=d($.parentNode);L.position={x:L.position.x-(((oe=Q==null?void 0:Q.computedPosition)==null?void 0:oe.x)??0),y:L.position.y-(((j=Q==null?void 0:Q.computedPosition)==null?void 0:j.y)??0)}}k.push(L)}k!=null&&k.length&&e.hooks.nodesChange.trigger(k)},h=C=>{if(!e.vueFlowRef)return;const R=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!R)return;const O=window.getComputedStyle(R),{m22:oe}=new window.DOMMatrixReadOnly(O.transform),j=[];for(const k of C){const $=k,L=d($.id);if(L){const Q=pi($.nodeElement);if(!!(Q.width&&Q.height&&(L.dimensions.width!==Q.width||L.dimensions.height!==Q.height||$.forceUpdate))){const me=$.nodeElement.getBoundingClientRect();L.dimensions=Q,L.handleBounds.source=Oc("source",$.nodeElement,me,oe,L.id),L.handleBounds.target=Oc("target",$.nodeElement,me,oe,L.id),j.push({id:L.id,type:"dimensions",dimensions:Q})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),j.length&&e.hooks.nodesChange.trigger(j)},m=(C,R)=>{const O=new Set,oe=new Set;for(const $ of C)dn($)?O.add($.id):Ht($)&&oe.add($.id);const j=Gt(t.value,O,!0),k=Gt(o.value,oe);if(e.multiSelectionActive){for(const $ of O)j.push(Ft($,R));for(const $ of oe)k.push(Ft($,R))}j.length&&e.hooks.nodesChange.trigger(j),k.length&&e.hooks.edgesChange.trigger(k)},p=C=>{if(e.multiSelectionActive){const R=C.map(O=>Ft(O.id,!0));e.hooks.nodesChange.trigger(R);return}e.hooks.nodesChange.trigger(Gt(t.value,new Set(C.map(R=>R.id)),!0)),e.hooks.edgesChange.trigger(Gt(o.value))},g=C=>{if(e.multiSelectionActive){const R=C.map(O=>Ft(O.id,!0));e.hooks.edgesChange.trigger(R);return}e.hooks.edgesChange.trigger(Gt(o.value,new Set(C.map(R=>R.id)))),e.hooks.nodesChange.trigger(Gt(t.value,new Set,!0))},b=C=>{m(C,!0)},_=C=>{const O=(C||e.nodes).map(oe=>(oe.selected=!1,Ft(oe.id,!1)));e.hooks.nodesChange.trigger(O)},N=C=>{const O=(C||e.edges).map(oe=>(oe.selected=!1,Ft(oe.id,!1)));e.hooks.edgesChange.trigger(O)},y=C=>{if(!C||!C.length)return m([],!1);const R=C.reduce((O,oe)=>{const j=Ft(oe.id,!1);return dn(oe)?O.nodes.push(j):O.edges.push(j),O},{nodes:[],edges:[]});R.nodes.length&&e.hooks.nodesChange.trigger(R.nodes),R.edges.length&&e.hooks.edgesChange.trigger(R.edges)},x=C=>{var R;(R=e.d3Zoom)==null||R.scaleExtent([C,e.maxZoom]),e.minZoom=C},q=C=>{var R;(R=e.d3Zoom)==null||R.scaleExtent([e.minZoom,C]),e.maxZoom=C},P=C=>{var R;(R=e.d3Zoom)==null||R.translateExtent(C),e.translateExtent=C},K=C=>{e.nodeExtent=C,a()},T=C=>{var R;(R=e.d3Zoom)==null||R.clickDistance(C)},ie=C=>{e.nodesDraggable=C,e.nodesConnectable=C,e.elementsSelectable=C},te=C=>{const R=C instanceof Function?C(e.nodes):C;!e.initialized&&!R.length||(e.nodes=Lc(R,d,e.hooks.error.trigger))},fe=C=>{const R=C instanceof Function?C(e.edges):C;if(!e.initialized&&!R.length)return;const O=rl(R,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ll(e.connectionLookup,o.value,O),e.edges=O},M=C=>{const R=C instanceof Function?C([...e.nodes,...e.edges]):C;!e.initialized&&!R.length||(te(R.filter(dn)),fe(R.filter(Ht)))},ne=C=>{let R=C instanceof Function?C(e.nodes):C;R=Array.isArray(R)?R:[R];const O=Lc(R,d,e.hooks.error.trigger),oe=[];for(const j of O)oe.push(Ic(j));oe.length&&e.hooks.nodesChange.trigger(oe)},E=C=>{let R=C instanceof Function?C(e.edges):C;R=Array.isArray(R)?R:[R];const O=rl(R,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),oe=[];for(const j of O)oe.push(Ic(j));oe.length&&e.hooks.edgesChange.trigger(oe)},S=(C,R=!0,O=!1)=>{const oe=C instanceof Function?C(e.nodes):C,j=Array.isArray(oe)?oe:[oe],k=[],$=[];function L(ce){const me=s(ce);for(const he of me)(!He(he.deletable)||he.deletable)&&$.push(xc(he.id,he.source,he.target,he.sourceHandle,he.targetHandle))}function Q(ce){const me=[];for(const he of e.nodes)he.parentNode===ce&&me.push(he);if(me.length){for(const he of me)k.push($c(he.id));R&&L(me);for(const he of me)Q(he.id)}}for(const ce of j){const me=typeof ce=="string"?d(ce):ce;me&&(He(me.deletable)&&!me.deletable||(k.push($c(me.id)),R&&L([me]),O&&Q(me.id)))}$.length&&e.hooks.edgesChange.trigger($),k.length&&e.hooks.nodesChange.trigger(k)},I=C=>{const R=C instanceof Function?C(e.edges):C,O=Array.isArray(R)?R:[R],oe=[];for(const j of O){const k=typeof j=="string"?u(j):j;k&&(He(k.deletable)&&!k.deletable||oe.push(xc(typeof j=="string"?j:j.id,k.source,k.target,k.sourceHandle,k.targetHandle)))}e.hooks.edgesChange.trigger(oe)},B=(C,R,O=!0)=>{const oe=u(C.id);if(!oe)return!1;const j=e.edges.indexOf(oe),k=Yg(C,R,oe,O,e.hooks.error.trigger);if(k){const[$]=rl([k],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((L,Q)=>Q===j?$:L),ll(e.connectionLookup,o.value,[$]),$}return!1},G=(C,R,O={replace:!1})=>{const oe=u(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;oe.data=O.replace?j:{...oe.data,...j}},X=C=>Nc(C,e.nodes),A=C=>{const R=Nc(C,e.edges);return ll(e.connectionLookup,o.value,R),R},ae=(C,R,O={replace:!1})=>{const oe=d(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;O.replace?e.nodes.splice(e.nodes.indexOf(oe),1,j):Object.assign(oe,j)},se=(C,R,O={replace:!1})=>{const oe=d(C);if(!oe)return;const j=typeof R=="function"?R(oe):R;oe.data=O.replace?j:{...oe.data,...j}},ge=(C,R,O=!1)=>{O?e.connectionClickStartHandle=C:e.connectionStartHandle=C,e.connectionEndHandle=null,e.connectionStatus=null,R&&(e.connectionPosition=R)},_e=(C,R=null,O=null)=>{e.connectionStartHandle&&(e.connectionPosition=C,e.connectionEndHandle=R,e.connectionStatus=O)},re=(C,R)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,R?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ye=C=>{const R=vg(C),O=R?null:po(C)?C:d(C.id);return!R&&!O?[null,null,R]:[R?C:fi(O),O,R]},be=(C,R=!0,O=e.nodes)=>{const[oe,j,k]=ye(C);if(!oe)return[];const $=[];for(const L of O||e.nodes){if(!k&&(L.id===j.id||!L.computedPosition))continue;const Q=fi(L),ce=mi(Q,oe);(R&&ce>0||ce>=Q.width*Q.height||ce>=Number(oe.width)*Number(oe.height))&&$.push(L)}return $},$e=(C,R,O=!0)=>{const[oe]=ye(C);if(!oe)return!1;const j=mi(oe,R);return O&&j>0||j>=Number(oe.width)*Number(oe.height)},Se=C=>{const{viewport:R,dimensions:O,d3Zoom:oe,d3Selection:j,translateExtent:k}=e;if(!oe||!j||!C.x&&!C.y)return!1;const $=Vn.translate(R.x+C.x,R.y+C.y).scale(R.zoom),L=[[0,0],[O.width,O.height]],Q=oe.constrain()($,L,k),ce=e.viewport.x!==Q.x||e.viewport.y!==Q.y||e.viewport.zoom!==Q.k;return oe.transform(j,Q),ce},Ce=C=>{const R=C instanceof Function?C(e):C,O=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];He(R.defaultEdgeOptions)&&(e.defaultEdgeOptions=R.defaultEdgeOptions);const oe=R.modelValue||R.nodes||R.edges?[]:void 0;oe&&(R.modelValue&&oe.push(...R.modelValue),R.nodes&&oe.push(...R.nodes),R.edges&&oe.push(...R.edges),M(oe));const j=()=>{He(R.maxZoom)&&q(R.maxZoom),He(R.minZoom)&&x(R.minZoom),He(R.translateExtent)&&P(R.translateExtent)};for(const k of Object.keys(R)){const $=k,L=R[$];![...rb,...O].includes($)&&He(L)&&(e[$]=L)}xa(()=>e.d3Zoom).not.toBeNull().then(j),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:M,setNodes:te,setEdges:fe,addNodes:ne,addEdges:E,removeNodes:S,removeEdges:I,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:G,updateNode:ae,updateNodeData:se,applyEdgeChanges:A,applyNodeChanges:X,addSelectedElements:b,addSelectedNodes:p,addSelectedEdges:g,setMinZoom:x,setMaxZoom:q,setTranslateExtent:P,setNodeExtent:K,setPaneClickDistance:T,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:N,startConnection:ge,updateConnection:_e,endConnection:re,setInteractive:ie,setState:Ce,getIntersectingNodes:be,getIncomers:l,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:$e,panBy:Se,fitView:C=>i.value.fitView(C),zoomIn:C=>i.value.zoomIn(C),zoomOut:C=>i.value.zoomOut(C),zoomTo:(C,R)=>i.value.zoomTo(C,R),setViewport:(C,R)=>i.value.setViewport(C,R),setTransform:(C,R)=>i.value.setTransform(C,R),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(C,R,O)=>i.value.setCenter(C,R,O),fitBounds:(C,R)=>i.value.fitBounds(C,R),project:C=>i.value.project(C),screenToFlowCoordinate:C=>i.value.screenToFlowCoordinate(C),flowToScreenCoordinate:C=>i.value.flowToScreenCoordinate(C),toObject:()=>{const C=[],R=[];for(const O of e.nodes){const{computedPosition:oe,handleBounds:j,selected:k,dimensions:$,isParent:L,resizing:Q,dragging:ce,events:me,...he}=O;C.push(he)}for(const O of e.edges){const{selected:oe,sourceNode:j,targetNode:k,events:$,...L}=O;R.push(L)}return JSON.parse(JSON.stringify({nodes:C,edges:R,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:C=>new Promise(R=>{const{nodes:O,edges:oe,position:j,zoom:k,viewport:$}=C;O&&te(O),oe&&fe(oe);const[L,Q]=$!=null&&$.x&&($!=null&&$.y)?[$.x,$.y]:j??[null,null];if(L&&Q){const ce=($==null?void 0:$.zoom)||k||e.viewport.zoom;return xa(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:L,y:Q,zoom:ce}).then(()=>{R(!0)})})}else R(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const C=qc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const R=Vn.translate(C.defaultViewport.x??0,C.defaultViewport.y??0).scale(cn(C.defaultViewport.zoom??1,C.minZoom,C.maxZoom)),O=e.viewportRef.getBoundingClientRect(),oe=[[0,0],[O.width,O.height]],j=e.d3Zoom.constrain()(R,oe,C.translateExtent);e.d3Zoom.transform(e.d3Selection,j)}Ce(C)},$destroy:()=>{}}}const cb=["data-id","data-handleid","data-nodeid","data-handlepos"],db={name:"Handle",compatConfig:{MODE:3}},fn=n.defineComponent({...db,props:{id:{default:null},type:{},position:{default:()=>Ie.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}=Me(),{id:m,node:p,nodeEl:g,connectedEdges:b}=Wc(),_=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),y=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),x=n.toRef(()=>{var fe,M,ne,E,S,I;return((fe=r.value)==null?void 0:fe.nodeId)===m&&((M=r.value)==null?void 0:M.id)===e.id&&((ne=r.value)==null?void 0:ne.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===m&&((S=c.value)==null?void 0:S.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),q=n.toRef(()=>{var fe,M,ne;return((fe=s.value)==null?void 0:fe.nodeId)===m&&((M=s.value)==null?void 0:M.id)===e.id&&((ne=s.value)==null?void 0:ne.type)===i.value}),{handlePointerDown:P,handleClick:K}=Yc({nodeId:m,handleId:e.id,isValidConnection:a,type:i}),T=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(fe=>{const M=fe[`${i.value}Handle`];return fe[i.value]!==m?!1:M?M===e.id:!0}):typeof e.connectable=="number"?b.value.filter(fe=>{const M=fe[`${i.value}Handle`];return fe[i.value]!==m?!1:M?M===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):He(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var fe;if(!p.dimensions.width||!p.dimensions.height)return;const M=(fe=p.handleBounds[i.value])==null?void 0:fe.find(X=>X.id===e.id);if(!d.value||M)return;const ne=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!ne||!e.id)return;const E=g.value.getBoundingClientRect(),S=_.value.getBoundingClientRect(),I=window.getComputedStyle(ne),{m22:B}=new window.DOMMatrixReadOnly(I.transform),G={id:e.id,position:e.position,x:(S.left-E.left)/B,y:(S.top-E.top)/B,type:i.value,nodeId:m,...pi(_.value)};p.handleBounds[i.value]=[...p.handleBounds[i.value]??[],G]});function ie(fe){const M=nl(fe);T.value&&N.value&&(M&&fe.button===0||!M)&&P(fe)}function te(fe){!m||!s.value&&!N.value||T.value&&K(fe)}return t({handleClick:K,handlePointerDown:P,onClick:te,onPointerDown:ie}),(fe,M)=>(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":fe.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${fe.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(h),i.value,{connectable:T.value,connecting:q.value,connectablestart:N.value,connectableend:y.value,connectionindicator:T.value&&(N.value&&!x.value||y.value&&x.value)}]]),onMousedown:ie,onTouchstartPassive:ie,onClick:te},[n.renderSlot(fe.$slots,"default",{id:fe.id})],42,cb))}}),wi=function({sourcePosition:e=Ie.Bottom,targetPosition:t=Ie.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:l,data:r}){const s=r.label??o;return[n.h(fn,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(fn,{type:"source",position:e,connectable:i,isValidConnection:l})]};wi.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],wi.inheritAttrs=!1,wi.compatConfig={MODE:3};const ub=wi,Ei=function({targetPosition:e=Ie.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const l=a.label??t;return[n.h(fn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?n.h(l):n.h(n.Fragment,[l])]};Ei.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ei.inheritAttrs=!1,Ei.compatConfig={MODE:3};const fb=Ei,ki=function({sourcePosition:e=Ie.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(fn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ki.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ki.inheritAttrs=!1,ki.compatConfig={MODE:3};const mb=ki,pb=["transform"],hb=["width","height","x","y","rx","ry"],yb=["y"],gb={name:"EdgeText",compatConfig:{MODE:3}},bb=n.defineComponent({...gb,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,hb)):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,yb)],8,pb))}}),_b=["id","d","marker-end","marker-start"],vb=["d","stroke-width"],wb={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ni=n.defineComponent({...wb,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,_b),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,vb)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(bb,{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 Xc({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 jc({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 Ii(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Zc({pos:e,x1:t,y1:o,x2:i,y2:a,c:l}){let r,s;switch(e){case Ie.Left:r=t-Ii(t-i,l),s=o;break;case Ie.Right:r=t+Ii(i-t,l),s=o;break;case Ie.Top:r=t,s=o-Ii(o-a,l);break;case Ie.Bottom:r=t,s=o+Ii(a-o,l);break}return[r,s]}function Jc(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,curvature:s=.25}=e,[c,d]=Zc({pos:i,x1:t,y1:o,x2:a,y2:l,c:s}),[u,f]=Zc({pos:r,x1:a,y1:l,x2:t,y2:o,c:s}),[h,m,p,g]=jc({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,g]}function Qc({pos:e,x1:t,y1:o,x2:i,y2:a}){let l,r;switch(e){case Ie.Left:case Ie.Right:l=.5*(t+i),r=o;break;case Ie.Top:case Ie.Bottom:l=t,r=.5*(o+a);break}return[l,r]}function ed(e){const{sourceX:t,sourceY:o,sourcePosition:i=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top}=e,[s,c]=Qc({pos:i,x1:t,y1:o,x2:a,y2:l}),[d,u]=Qc({pos:r,x1:a,y1:l,x2:t,y2:o}),[f,h,m,p]=jc({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 td={[Ie.Left]:{x:-1,y:0},[Ie.Right]:{x:1,y:0},[Ie.Top]:{x:0,y:-1},[Ie.Bottom]:{x:0,y:1}};function Eb({source:e,sourcePosition:t=Ie.Bottom,target:o}){return t===Ie.Left||t===Ie.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 nd(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function kb({source:e,sourcePosition:t=Ie.Bottom,target:o,targetPosition:i=Ie.Top,center:a,offset:l}){const r=td[t],s=td[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=Eb({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let m,p,g;const b={x:0,y:0},_={x:0,y:0},[N,y,x,q]=Xc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){p=a.x??N,g=a.y??y;const K=[{x:p,y:c.y},{x:p,y:d.y}],T=[{x:c.x,y:g},{x:d.x,y:g}];r[f]===h?m=f==="x"?K:T:m=f==="x"?T:K}else{const K=[{x:c.x,y:d.y}],T=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===h?T:K:m=r.y===h?K:T,t===i){const ne=Math.abs(e[f]-o[f]);if(ne<=l){const E=Math.min(l-1,l-ne);r[f]===h?b[f]=(c[f]>e[f]?-1:1)*E:_[f]=(d[f]>o[f]?-1:1)*E}}if(t!==i){const ne=f==="x"?"y":"x",E=r[f]===s[ne],S=c[ne]>d[ne],I=c[ne]<d[ne];(r[f]===1&&(!E&&S||E&&I)||r[f]!==1&&(!E&&I||E&&S))&&(m=f==="x"?K:T)}const ie={x:c.x+b.x,y:c.y+b.y},te={x:d.x+_.x,y:d.y+_.y},fe=Math.max(Math.abs(ie.x-m[0].x),Math.abs(te.x-m[0].x)),M=Math.max(Math.abs(ie.y-m[0].y),Math.abs(te.y-m[0].y));fe>=M?(p=(ie.x+te.x)/2,g=m[0].y):(p=m[0].x,g=(ie.y+te.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,g,x,q]}function Nb(e,t,o,i){const a=Math.min(nd(e,t)/2,nd(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=Ie.Bottom,targetX:a,targetY:l,targetPosition:r=Ie.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,h,m,p,g]=kb({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:l},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((_,N,y)=>{let x;return y>0&&y<f.length-1?x=Nb(f[y-1],N,f[y+1],s):x=`${y===0?"M":"L"}${N.x} ${N.y}`,_+=x,_},""),h,m,p,g]}function Ib(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[l,r,s,c]=Xc({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,l,r,s,c]}const $b=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]=Ib(e);return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),od=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??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),xb=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(od,{...e,...t,borderRadius:0})}}),Sb=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]=Jc({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),Cb=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]=ed({...e,sourcePosition:e.sourcePosition??Ie.Bottom,targetPosition:e.targetPosition??Ie.Top});return n.h(Ni,{path:o,labelX:i,labelY:a,...t,...e})}}}),Rb={input:mb,default:ub,output:fb},Vb={default:Sb,straight:$b,step:xb,smoothstep:od,simplebezier:Cb};function Ab(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),l=n.computed(()=>{const g={...Vb,...e.edgeTypes},b=Object.keys(g);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),r=n.computed(()=>{const g={...Rb,...e.nodeTypes},b=Object.keys(g);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?_c(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const b of e.edges){const _=t.value.get(b.source),N=t.value.get(b.target);Tg({sourcePos:_.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(b)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const b of e.nodes)b.selected&&g.push(b);return g}),f=n.computed(()=>{const g=[];for(const b of e.edges)b.selected&&g.push(b);return g}),h=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const g=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&g.push(b);return g}),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 mn{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)??mn.instance;return mn.instance=i??new mn,o&&(o.config.globalProperties.$vueFlowStorage=mn.instance),mn.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=qc(),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=Ab(a,s,c),u=sb(a,s,c);u.setState({...a,...o});const f={...l,...d,...u,...Cm(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 Me(e){const t=mn.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(Uc,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)},g=b=>{d.applyEdgeChanges(b)};f?(d.onNodesChange(p),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)),m(()=>{d.hooks.value.nodesChange.off(p),d.hooks.value.edgesChange.off(g)})},{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(Uc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Fe(Ue.USEVUEFLOW_OPTIONS))}return s}function Tb(e){const{emits:t,dimensions:o}=Me();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=pi(e.value);(s.width===0||s.height===0)&&t.error(new Fe(Ue.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};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 Mb={name:"UserSelection",compatConfig:{MODE:3}},Bb=n.defineComponent({...Mb,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))}}),Db=["tabIndex"],Ob={name:"NodesSelection",compatConfig:{MODE:3}},Lb=n.defineComponent({...Ob,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:l,userSelectionActive:r}=Me(),s=Kc(),c=n.ref(null),d=Gc({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(()=>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 h(p){t.selectionContextMenu({event:p,nodes:i.value})}function m(p){l.value||An[p.key]&&(p.preventDefault(),s({x:An[p.key].x,y:An[p.key].y},p.shiftKey))}return(p,g)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(l)?void 0:-1,onContextmenu:h,onKeydown:m},null,46,Db)],6)):n.createCommentVNode("",!0)}});function Pb(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const zb={name:"Pane",compatConfig:{MODE:3}},Ub=n.defineComponent({...zb,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:g,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:N,nodeLookup:y,connectionLookup:x,defaultEdgeOptions:q,connectionStartHandle:P,panOnDrag:K}=Me(),T=n.shallowRef(null),ie=n.shallowRef(new Set),te=n.shallowRef(new Set),fe=n.shallowRef(null),M=n.toRef(()=>c.value&&(e.isSelecting||l.value)),ne=n.toRef(()=>P.value!==null);let E=!1,S=!1;const I=mo(g,{actInsideInputWithModifier:!1}),B=mo(b);n.watch(I,re=>{re&&(h(f.value),m(u.value),d.value=!1)}),n.watch(B,re=>{_.value=re});function G(re,ye){return be=>{be.target===ye&&(re==null||re(be))}}function X(re){if(E||ne.value){E=!1;return}a.paneClick(re),r(),d.value=!1}function A(re){var ye;if(Array.isArray(K.value)&&((ye=K.value)!=null&&ye.includes(2))){re.preventDefault();return}a.paneContextMenu(re)}function ae(re){a.paneScroll(re)}function se(re){var ye,be,$e;if(fe.value=((ye=t.value)==null?void 0:ye.getBoundingClientRect())??null,!c.value||!e.isSelecting||re.button!==0||re.target!==T.value||!fe.value)return;($e=(be=re.target)==null?void 0:be.setPointerCapture)==null||$e.call(be,re.pointerId);const{x:Se,y:Ce}=Pb(re,fe.value);S=!0,E=!1,r(),s.value={width:0,height:0,startX:Se,startY:Ce,x:Se,y:Ce},a.selectionStart(re)}function ge(re){var ye;if(!fe.value||!s.value)return;E=!0;const{x:be,y:$e}=vt(re,fe.value),{startX:Se=0,startY:Ce=0}=s.value,Y={startX:Se,startY:Ce,x:be<Se?be:Se,y:$e<Ce?$e:Ce,width:Math.abs(be-Se),height:Math.abs($e-Ce)},U=ie.value,V=te.value;ie.value=new Set(_c(o.value,Y,i.value,p.value===qa.Partial,!0).map(R=>R.id)),te.value=new Set;const C=((ye=q.value)==null?void 0:ye.selectable)??!0;for(const R of ie.value){const O=x.value.get(R);if(O)for(const{edgeId:oe}of O.values()){const j=N.value.get(oe);j&&(j.selectable??C)&&te.value.add(oe)}}if(!zc(U,ie.value)){const R=Gt(y.value,ie.value,!0);a.nodesChange(R)}if(!zc(V,te.value)){const R=Gt(N.value,te.value);a.edgesChange(R)}s.value=Y,l.value=!0,d.value=!1}function _e(re){var ye;re.button!==0||!S||((ye=re.target)==null||ye.releasePointerCapture(re.pointerId),!l.value&&s.value&&re.target===T.value&&X(re),l.value=!1,s.value=null,d.value=ie.value.size>0,a.selectionEnd(re),e.selectionKeyPressed&&(E=!1),S=!1)}return(re,ye)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:T,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:re.isSelecting}]),onClick:ye[0]||(ye[0]=be=>M.value?void 0:G(X,T.value)(be)),onContextmenu:ye[1]||(ye[1]=be=>G(A,T.value)(be)),onWheelPassive:ye[2]||(ye[2]=be=>G(ae,T.value)(be)),onPointerenter:ye[3]||(ye[3]=be=>M.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:ye[4]||(ye[4]=be=>M.value?se(be):n.unref(a).paneMouseMove(be)),onPointermove:ye[5]||(ye[5]=be=>M.value?ge(be):n.unref(a).paneMouseMove(be)),onPointerup:ye[6]||(ye[6]=be=>M.value?_e(be):void 0),onPointerleave:ye[7]||(ye[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(re.$slots,"default"),n.unref(l)&&n.unref(s)?(n.openBlock(),n.createBlock(Bb,{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(Lb,{key:1})):n.createCommentVNode("",!0)],34))}}),Hb={name:"Transform",compatConfig:{MODE:3}},Fb=n.defineComponent({...Hb,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Me(),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))}}),Gb={name:"Viewport",compatConfig:{MODE:3}},Yb=n.defineComponent({...Gb,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:g,noWheelClassName:b,noPanClassName:_,emits:N,connectionStartHandle:y,userSelectionActive:x,paneDragging:q,d3Zoom:P,d3Selection:K,d3ZoomHandler:T,viewport:ie,viewportRef:te,paneClickDistance:fe}=Me();Tb(te);const M=n.shallowRef(!1),ne=n.shallowRef(!1);let E=null,S=!1,I=0,B={x:0,y:0,zoom:0};const G=mo(s),X=mo(r),A=mo(l),ae=n.toRef(()=>(!X.value||X.value&&r.value===!0)&&(G.value||f.value)),se=n.toRef(()=>G.value||c.value),ge=n.toRef(()=>r.value===!0&&ae.value!==!0),_e=n.toRef(()=>X.value&&r.value!==!0||x.value||ge.value),re=n.toRef(()=>y.value!==null);n.onMounted(()=>{if(!te.value){_o("Viewport element is missing");return}const Ce=te.value,Y=Ce.getBoundingClientRect(),U=mg().clickDistance(fe.value).scaleExtent([t.value,o.value]).translateExtent(a.value),V=ct(Ce).call(U),C=V.on("wheel.zoom"),R=Vn.translate(i.value.x??0,i.value.y??0).scale(cn(i.value.zoom??1,t.value,o.value)),O=[[0,0],[Y.width,Y.height]],oe=U.constrain()(R,O,a.value);U.transform(V,oe),U.wheelDelta(Ja),P.value=U,K.value=V,T.value=C,ie.value={x:oe.x,y:oe.y,zoom:oe.k},U.on("start",j=>{var k;if(!j.sourceEvent)return null;I=j.sourceEvent.button,M.value=!0;const $=$e(j.transform);((k=j.sourceEvent)==null?void 0:k.type)==="mousedown"&&(q.value=!0),B=$,N.viewportChangeStart($),N.moveStart({event:j,flowTransform:$})}),U.on("end",j=>{if(!j.sourceEvent)return null;if(M.value=!1,q.value=!1,ye(ae.value,I??0)&&!S&&N.paneContextMenu(j.sourceEvent),S=!1,be(B,j.transform)){const k=$e(j.transform);B=k,N.viewportChangeEnd(k),N.moveEnd({event:j,flowTransform:k})}}),U.filter(j=>{var k;const $=A.value||p.value,L=m.value&&j.ctrlKey,Q=j.button,ce=j.type==="wheel";if(Q===1&&j.type==="mousedown"&&(Se(j,"vue-flow__node")||Se(j,"vue-flow__edge")))return!0;if(!ae.value&&!$&&!se.value&&!h.value&&!m.value||x.value||re.value&&!ce||!h.value&&j.type==="dblclick"||Se(j,b.value)&&ce||Se(j,_.value)&&(!ce||se.value&&ce&&!A.value)||!m.value&&j.ctrlKey&&ce||!$&&!se.value&&!L&&ce)return!1;if(!m&&j.type==="touchstart"&&((k=j.touches)==null?void 0:k.length)>1)return j.preventDefault(),!1;if(!ae.value&&(j.type==="mousedown"||j.type==="touchstart")||ge.value&&Array.isArray(f.value)&&f.value.includes(0)&&Q===0||Array.isArray(f.value)&&!f.value.includes(Q)&&(j.type==="mousedown"||j.type==="touchstart"))return!1;const me=Array.isArray(f.value)&&f.value.includes(Q)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!Q||Q<=1;return(!j.ctrlKey||G.value||ce)&&me}),n.watch([x,ae],()=>{x.value&&!M.value?U.on("zoom",null):x.value||U.on("zoom",j=>{ie.value={x:j.transform.x,y:j.transform.y,zoom:j.transform.k};const k=$e(j.transform);S=ye(ae.value,I??0),N.viewportChange(k),N.move({event:j,flowTransform:k})})},{immediate:!0}),n.watch([x,se,d,A,m,g,b],()=>{se.value&&!A.value&&!x.value?V.on("wheel.zoom",j=>{if(Se(j,b.value))return!1;const k=A.value||p.value,$=m.value&&j.ctrlKey;if(!(!g.value||se.value||k||$))return!1;j.preventDefault(),j.stopImmediatePropagation();const Q=V.property("__zoom").k||1,ce=bo();if(!G.value&&j.ctrlKey&&m.value&&ce){const v=yt(j),w=Ja(j),z=Q*2**w;U.scaleTo(V,z,v,j);return}const me=j.deltaMode===1?20:1;let he=d.value===fo.Vertical?0:j.deltaX*me,ve=d.value===fo.Horizontal?0:j.deltaY*me;!ce&&j.shiftKey&&d.value!==fo.Vertical&&!he&&ve&&(he=ve,ve=0),U.translateBy(V,-(he/Q)*u.value,-(ve/Q)*u.value);const D=$e(V.property("__zoom"));E&&clearTimeout(E),ne.value?(N.move({event:j,flowTransform:D}),N.viewportChange(D),E=setTimeout(()=>{N.moveEnd({event:j,flowTransform:D}),N.viewportChangeEnd(D),ne.value=!1},150)):(ne.value=!0,N.moveStart({event:j,flowTransform:D}),N.viewportChangeStart(D))},{passive:!1}):typeof C<"u"&&V.on("wheel.zoom",function(j,k){const $=!g.value&&j.type==="wheel"&&!j.ctrlKey,L=A.value||p.value,Q=m.value&&j.ctrlKey;if(!L&&!c.value&&!Q&&j.type==="wheel"||$||Se(j,b.value))return null;j.preventDefault(),C.call(this,j,k)},{passive:!1})},{immediate:!0})});function ye(Ce,Y){return Y===2&&Array.isArray(Ce)&&Ce.includes(2)}function be(Ce,Y){return Ce.x!==Y.x&&!Number.isNaN(Y.x)||Ce.y!==Y.y&&!Number.isNaN(Y.y)||Ce.zoom!==Y.k&&!Number.isNaN(Y.k)}function $e(Ce){return{x:Ce.x,y:Ce.y,zoom:Ce.k}}function Se(Ce,Y){return Ce.target.closest(`.${Y}`)}return(Ce,Y)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:te,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(Ub,{"is-selecting":_e.value,"selection-key-pressed":n.unref(X),class:n.normalizeClass({connecting:re.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(Fb,null,{default:n.withCtx(()=>[n.renderSlot(Ce.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Wb=["id"],Kb=["id"],qb=["id"],Xb={name:"A11yDescriptions",compatConfig:{MODE:3}},jb=n.defineComponent({...Xb,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Me();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,Wb),n.createElementVNode("div",{id:`${n.unref(dc)}-${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,Kb),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(_g)}-${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,qb))],64))}});function Zb(){const e=Me();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Jb(e,t,o){return o===Ie.Left?e-t:o===Ie.Right?e+t:e}function Qb(e,t,o){return o===Ie.Top?e-t:o===Ie.Bottom?e+t:e}const dl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Ie.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:Jb(t,e,i),cy:Qb(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};dl.props=["radius","centerX","centerY","position","type"],dl.compatConfig={MODE:3};const id=dl,e0=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:g,edgesUpdatable:b,edgesFocusable:_,hooks:N}=Me(),y=n.computed(()=>u(e.id)),{emit:x,on:q}=Xg(y.value,l),P=n.inject(bi),K=n.getCurrentInstance(),T=n.ref(!1),ie=n.ref(!1),te=n.ref(""),fe=n.ref(null),M=n.ref("source"),ne=n.ref(null),E=n.toRef(()=>typeof y.value.selectable>"u"?g.value:y.value.selectable),S=n.toRef(()=>typeof y.value.updatable>"u"?b.value:y.value.updatable),I=n.toRef(()=>typeof y.value.focusable>"u"?_.value:y.value.focusable);n.provide(Wg,e.id),n.provide(Kg,ne);const B=n.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),G=n.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),X=n.computed(()=>{const R=y.value.type||"default",O=P==null?void 0:P[`edge-${R}`];if(O)return O;let oe=y.value.template??c.value[R];if(typeof oe=="string"&&K){const j=Object.keys(K.appContext.components);j&&j.includes(R)&&(oe=n.resolveComponent(R,!1))}return oe&&typeof oe!="string"?oe:(l.error(new Fe(Ue.EDGE_TYPE_MISSING,oe)),!1)}),{handlePointerDown:A}=Yc({nodeId:te,handleId:fe,type:M,isValidConnection:h,edgeUpdaterType:M,onEdgeUpdate:ge,onEdgeUpdateEnd:_e});return()=>{const R=f(y.value.source),O=f(y.value.target),oe="pathOptions"in y.value?y.value.pathOptions:{};if(!R&&!O)return l.error(new Fe(Ue.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!R)return l.error(new Fe(Ue.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!O)return l.error(new Fe(Ue.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||R.hidden||O.hidden)return null;let j;i.value===At.Strict?j=R.handleBounds.source:j=[...R.handleBounds.source||[],...R.handleBounds.target||[]];const k=Vc(j,y.value.sourceHandle);let $;i.value===At.Strict?$=O.handleBounds.target:$=[...O.handleBounds.target||[],...O.handleBounds.source||[]];const L=Vc($,y.value.targetHandle),Q=(k==null?void 0:k.position)||Ie.Bottom,ce=(L==null?void 0:L.position)||Ie.Top,{x:me,y:he}=Mn(R,k,Q),{x:ve,y:D}=Mn(O,L,ce);return y.value.sourceX=me,y.value.sourceY=he,y.value.targetX=ve,y.value.targetY=D,n.h("g",{ref:ne,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${X.value===!1?"default":y.value.type||"default"}`,s.value,B.value,{updating:T.value,selected:y.value.selected,animated:y.value.animated,inactive:!E.value&&!N.value.edgeClick.hasListeners()}],tabIndex:I.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":I.value?`${dc}-${t}`:void 0,"aria-roledescription":"edge",role:I.value?"group":"img",...y.value.domAttributes,onClick:ye,onContextmenu:be,onDblclick:$e,onMouseenter:Se,onMousemove:Ce,onMouseleave:Y,onKeyDown:I.value?C:void 0},[ie.value?null:n.h(X.value===!1?c.value.default:X.value,{id:e.id,sourceNode:R,targetNode:O,source:y.value.source,target:y.value.target,type:y.value.type,updatable:S.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:G.value,markerStart:`url('#${go(y.value.markerStart,t)}')`,markerEnd:`url('#${go(y.value.markerEnd,t)}')`,sourcePosition:Q,targetPosition:ce,sourceX:me,sourceY:he,targetX:ve,targetY:D,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...oe}),[S.value==="source"||S.value===!0?[n.h("g",{onMousedown:U,onMouseenter:ae,onMouseout:se},n.h(id,{position:Q,centerX:me,centerY:he,radius:a.value,type:"source","data-type":"source"}))]:null,S.value==="target"||S.value===!0?[n.h("g",{onMousedown:V,onMouseenter:ae,onMouseout:se},n.h(id,{position:ce,centerX:ve,centerY:D,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ae(){T.value=!0}function se(){T.value=!1}function ge(R,O){x.update({event:R,edge:y.value,connection:O})}function _e(R){x.updateEnd({event:R,edge:y.value}),ie.value=!1}function re(R,O){R.button===0&&(ie.value=!0,te.value=O?y.value.target:y.value.source,fe.value=(O?y.value.targetHandle:y.value.sourceHandle)??null,M.value=O?"target":"source",x.updateStart({event:R,edge:y.value}),A(R))}function ye(R){var O;const oe={event:R,edge:y.value};E.value&&(r.value=!1,y.value.selected&&m.value?(d([y.value]),(O=ne.value)==null||O.blur()):o([y.value])),x.click(oe)}function be(R){x.contextMenu({event:R,edge:y.value})}function $e(R){x.doubleClick({event:R,edge:y.value})}function Se(R){x.mouseEnter({event:R,edge:y.value})}function Ce(R){x.mouseMove({event:R,edge:y.value})}function Y(R){x.mouseLeave({event:R,edge:y.value})}function U(R){re(R,!0)}function V(R){re(R,!1)}function C(R){var O;!p.value&&uc.includes(R.key)&&E.value&&(R.key==="Escape"?((O=ne.value)==null||O.blur(),d([u(e.id)])):o([u(e.id)]))}}}),t0=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}=Me(),h=(e=n.inject(bi))==null?void 0:e["connection-line"],m=n.computed(()=>{var N;return f((N=i.value)==null?void 0:N.nodeId)}),p=n.computed(()=>{var N;return f((N=a.value)==null?void 0:N.nodeId)??null}),g=n.computed(()=>({x:(l.value.x-u.value.x)/u.value.zoom,y:(l.value.y-u.value.y)/u.value.zoom})),b=n.computed(()=>c.value.markerStart?`url(#${go(c.value.markerStart,t)})`:""),_=n.computed(()=>c.value.markerEnd?`url(#${go(c.value.markerEnd,t)})`:"");return()=>{var N,y,x;if(!m.value||!i.value)return null;const q=i.value.id,P=i.value.type,K=m.value.handleBounds;let T=(K==null?void 0:K[P])??[];if(o.value===At.Loose){const G=(K==null?void 0:K[P==="source"?"target":"source"])??[];T=[...T,...G]}if(!T)return null;const ie=(q?T.find(G=>G.id===q):T[0])??null,te=(ie==null?void 0:ie.position)??Ie.Top,{x:fe,y:M}=Mn(m.value,ie,te);let ne=null;p.value&&(o.value===At.Strict?ne=((N=p.value.handleBounds[P==="source"?"target":"source"])==null?void 0:N.find(G=>{var X;return G.id===((X=a.value)==null?void 0:X.id)}))||null:ne=((y=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:y.find(G=>{var X;return G.id===((X=a.value)==null?void 0:X.id)}))||null);const E=((x=a.value)==null?void 0:x.position)??(te?il[te]:null);if(!te||!E)return null;const S=r.value??c.value.type??sn.Bezier;let I="";const B={sourceX:fe,sourceY:M,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:E};return S===sn.Bezier?[I]=Jc(B):S===sn.Step?[I]=cl({...B,borderRadius:0}):S===sn.SmoothStep?[I]=cl(B):S===sn.SimpleBezier?[I]=ed(B):I=`M${fe},${M} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},h?n.h(h,{sourceX:fe,sourceY:M,sourcePosition:te,targetX:g.value.x,targetY:g.value.y,targetPosition:E,sourceNode:m.value,sourceHandle:ie,targetNode:p.value,targetHandle:ne,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):n.h("path",{d:I,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),n0=["id","markerWidth","markerHeight","markerUnits","orient"],o0={name:"MarkerType",compatConfig:{MODE:3}},i0=n.defineComponent({...o0,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,n0))}}),a0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},l0={name:"MarkerDefinitions",compatConfig:{MODE:3}},r0=n.defineComponent({...l0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Me(),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",a0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,c=>(n.openBlock(),n.createBlock(i0,{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))])]))}}),s0={name:"Edges",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Me();return(a,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(r0),(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(Mg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(e0),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(t0))],64))}}),d0=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:g,snapToGrid:b,snapGrid:_,nodeDragThreshold:N,nodesDraggable:y,elementsSelectable:x,nodesConnectable:q,nodesFocusable:P,hooks:K}=Me(),T=n.ref(null);n.provide(Fc,T),n.provide(Hc,e.id);const ie=n.inject(bi),te=n.getCurrentInstance(),fe=Kc(),{node:M,parentNode:ne}=Wc(e.id),{emit:E,on:S}=Qg(M,r),I=n.toRef(()=>typeof M.draggable>"u"?y.value:M.draggable),B=n.toRef(()=>typeof M.selectable>"u"?x.value:M.selectable),G=n.toRef(()=>typeof M.connectable>"u"?q.value:M.connectable),X=n.toRef(()=>typeof M.focusable>"u"?P.value:M.focusable),A=n.computed(()=>B.value||I.value||K.value.nodeClick.hasListeners()||K.value.nodeDoubleClick.hasListeners()||K.value.nodeMouseEnter.hasListeners()||K.value.nodeMouseMove.hasListeners()||K.value.nodeMouseLeave.hasListeners()),ae=n.toRef(()=>!!M.dimensions.width&&!!M.dimensions.height),se=n.computed(()=>{const O=M.type||"default",oe=ie==null?void 0:ie[`node-${O}`];if(oe)return oe;let j=M.template||f.value[O];if(typeof j=="string"&&te){const k=Object.keys(te.appContext.components);k&&k.includes(O)&&(j=n.resolveComponent(O,!1))}return j&&typeof j!="string"?j:(r.error(new Fe(Ue.NODE_TYPE_MISSING,j)),!1)}),ge=Gc({id:e.id,el:T,disabled:()=>!I.value,selectable:B,dragHandle:()=>M.dragHandle,onStart(O){E.dragStart(O)},onDrag(O){E.drag(O)},onStop(O){E.dragStop(O)},onClick(O){C(O)}}),_e=n.computed(()=>M.class instanceof Function?M.class(M):M.class),re=n.computed(()=>{const O=(M.style instanceof Function?M.style(M):M.style)||{},oe=M.width instanceof Function?M.width(M):M.width,j=M.height instanceof Function?M.height(M):M.height;return!O.width&&oe&&(O.width=typeof oe=="string"?oe:`${oe}px`),!O.height&&j&&(O.height=typeof j=="string"?j:`${j}px`),O}),ye=n.toRef(()=>Number(M.zIndex??re.value.zIndex??0));return u(O=>{(O.includes(e.id)||!O.length)&&$e()}),n.onMounted(()=>{n.watch(()=>M.hidden,(O=!1,oe,j)=>{!O&&T.value&&(e.resizeObserver.observe(T.value),j(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>M.type,()=>M.sourcePosition,()=>M.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),n.watch([()=>M.position.x,()=>M.position.y,()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.x},()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.y},()=>{var O;return(O=ne.value)==null?void 0:O.computedPosition.z},ye,()=>M.selected,()=>M.dimensions.height,()=>M.dimensions.width,()=>{var O;return(O=ne.value)==null?void 0:O.dimensions.height},()=>{var O;return(O=ne.value)==null?void 0:O.dimensions.width}],([O,oe,j,k,$,L])=>{const Q={x:O,y:oe,z:L+(m.value&&M.selected?1e3:0)};typeof j<"u"&&typeof k<"u"?M.computedPosition=Sg({x:j,y:k,z:$},Q):M.computedPosition=Q},{flush:"post",immediate:!0}),n.watch([()=>M.extent,h],([O,oe],[j,k])=>{(O!==j||oe!==k)&&be()}),M.extent==="parent"||typeof M.extent=="object"&&"range"in M.extent&&M.extent.range==="parent"?xa(()=>ae).toBe(!0).then(be):be(),()=>M.hidden?null:n.h("div",{ref:T,"data-id":M.id,class:["vue-flow__node",`vue-flow__node-${se.value===!1?"default":M.type||"default"}`,{[o.value]:I.value,dragging:ge==null?void 0:ge.value,draggable:I.value,selected:M.selected,selectable:B.value,parent:M.isParent},_e.value],style:{visibility:ae.value?"visible":"hidden",zIndex:M.computedPosition.z??ye.value,transform:`translate(${M.computedPosition.x}px,${M.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...re.value},tabIndex:X.value?0:void 0,role:X.value?"group":void 0,"aria-describedby":p.value?void 0:`${cc}-${t}`,"aria-label":M.ariaLabel,"aria-roledescription":"node",...M.domAttributes,onMouseenter:Se,onMousemove:Ce,onMouseleave:Y,onContextmenu:U,onClick:C,onDblclick:V,onKeydown:R},[n.h(se.value===!1?f.value.default:se.value,{id:M.id,type:M.type,data:M.data,events:{...M.events,...S},selected:M.selected,resizing:M.resizing,dragging:ge.value,connectable:G.value,position:M.computedPosition,dimensions:M.dimensions,isValidTargetPos:M.isValidTargetPos,isValidSourcePos:M.isValidSourcePos,parent:M.parentNode,parentNodeId:M.parentNode,zIndex:M.computedPosition.z??ye.value,targetPosition:M.targetPosition,sourcePosition:M.sourcePosition,label:M.label,dragHandle:M.dragHandle,onUpdateNodeInternals:$e})]);function be(){const O=M.computedPosition,{computedPosition:oe,position:j}=tl(M,b.value?gi(O,_.value):O,r.error,h.value,ne.value);(M.computedPosition.x!==oe.x||M.computedPosition.y!==oe.y)&&(M.computedPosition={...M.computedPosition,...oe}),(M.position.x!==j.x||M.position.y!==j.y)&&(M.position=j)}function $e(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function Se(O){ge!=null&&ge.value||E.mouseEnter({event:O,node:M})}function Ce(O){ge!=null&&ge.value||E.mouseMove({event:O,node:M})}function Y(O){ge!=null&&ge.value||E.mouseLeave({event:O,node:M})}function U(O){return E.contextMenu({event:O,node:M})}function V(O){return E.doubleClick({event:O,node:M})}function C(O){B.value&&(!i.value||!I.value||N.value>0)&&al(M,l.value,c,s,a,!1,T.value),E.click({event:O,node:M})}function R(O){if(!(ja(O)||p.value))if(uc.includes(O.key)&&B.value){const oe=O.key==="Escape";al(M,l.value,c,s,a,oe,T.value)}else I.value&&M.selected&&An[O.key]&&(O.preventDefault(),g.value=`Moved selected node ${O.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~M.position.x}, y: ${~~M.position.y}`,fe({x:An[O.key].x,y:An[O.key].y},O.shiftKey))}}});function u0(e={includeHiddenNodes:!1}){const{nodes:t}=Me();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 f0={class:"vue-flow__nodes vue-flow__container"},m0={name:"Nodes",compatConfig:{MODE:3}},p0=n.defineComponent({...m0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Me(),a=u0(),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",f0,[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(d0),{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 h0(){const{emits:e}=Me();n.onMounted(()=>{if(Dc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Fe(Ue.MISSING_STYLES))}})}const y0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),g0={name:"VueFlow",compatConfig:{MODE:3}},b0=n.defineComponent({...g0,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=Me(i),d=ob({modelValue:l,nodes:r,edges:s},i,c);return ab(o,c.hooks),Zb(),h0(),n.provide(bi,a),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(Yb,null,{default:n.withCtx(()=>[n.createVNode(c0),y0,n.createVNode(p0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(jb)],512))}}),_0={name:"Panel",compatConfig:{MODE:3}},ad=n.defineComponent({..._0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Me(),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))}}),pn=["red","amber","green","teal","blue","indigo","violet","pink"],ld={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function v0(e){return typeof e=="string"&&e in ld}const w0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},E0=.15;function k0(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 N0(e){if(typeof e!="string")return null;const t=k0(e);if(!t||t.s<E0)return null;let o=null,i=1/0;for(const a of pn){const l=Math.abs(t.h-w0[a]),r=Math.min(l,360-l);r<i&&(i=r,o=a)}return o}function Xe(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(v0(t))return t;const o=e==null?void 0:e.properties;return N0((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 I0={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)"},$0={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 rd(e,t=!1){return e?t?$0[e]:I0[e]:null}function Bn(e){return ld[e]}function Dn(e){return`var(--em-swatch-${e}-bar)`}const x0=["width","height","innerHTML"],S0=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,x0))}}),De=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=De(S0,[["__scopeId","data-v-04de464d"]]),C0={class:"em-inline-issue__msgs"},hn=De(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",C0,[(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"]]),R0={class:"em-mlang"},V0={class:"em-mlang__tabs",role:"tablist"},A0=["aria-selected","onClick"],T0={key:0,class:"em-mlang__dot"},fl=De(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",R0,[n.createElementVNode("div",V0,[(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",T0,"•")):n.createCommentVNode("",!0)],10,A0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(le.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(le.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"]]),M0=["disabled"],B0={class:"em-panel__sub-label"},D0={class:"em-field"},O0={class:"em-field"},L0={class:"em-field"},P0={class:"em-class"},z0={class:"em-field"},U0={class:"em-field"},H0={class:"em-field"},F0={class:"em-field"},G0={class:"em-multilang"},Y0={class:"em-multilang"},W0={class:"em-jpa"},K0={class:"em-field"},q0={class:"em-field"},X0={class:"em-field"},j0={class:"em-swatch"},Z0={class:"em-swatch__row"},J0=["title","onClick"],sd=De(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,l=n.computed(()=>a.state.logical.entities.find(M=>M.modelId===o.entityId)??null),r=n.computed(()=>l.value?a.state.layout.entityLayouts.find(M=>M.entityRef===l.value.modelId)??null:null),s=n.computed(()=>{var M;return Xe(((M=r.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],f=M=>M;function h(M){return M==="inherit"?"기본(따름)":M}function m(M){l.value&&a.updateEntity(l.value.modelId,M)}function p(M,ne,E){var I;const S=((I=l.value)==null?void 0:I.table)??{physicalName:""};m(M==="physicalName"?{table:{...S,physicalName:E}}:{table:{...S,logicalName:{...S.logicalName,[ne]:E}}})}function g(M){m({description:Object.keys(M).length?M:void 0})}function b(M,ne){var E;m({jpaAttrs:{...(E=l.value)==null?void 0:E.jpaAttrs,[M]:ne}})}function _(M,ne){b(M,ne)}const N=n.computed(()=>{var M,ne;return((ne=(M=l.value)==null?void 0:M.jpaAttrs)==null?void 0:ne.discriminatorType)??"inherit"}),y=n.computed(()=>{var M,ne;return!((ne=(M=l.value)==null?void 0:M.jpaAttrs)!=null&&ne.useDiscriminator)});function x(M){b("discriminatorType",M==="inherit"?void 0:M)}function q(M){m({hasPersonalInfo:M})}function P(M){m({superClass:M.trim()||void 0})}function K(M){m({schema:M.trim()||void 0})}function T(M){m({abstractClass:M})}const ie=n.computed(()=>{var M,ne;return((ne=(M=l.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:ne.join(", "))??""});function te(M){const ne=M.split(",").map(E=>E.trim()).filter(Boolean);m({declarationOfInterfaces:ne.length?ne:void 0})}function fe(M){l.value&&a.setEntitySwatch(l.value.modelId,M)}return(M,ne)=>{var E,S,I;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:ne[0]||(ne[0]=B=>i("toggle"))},[n.createElementVNode("span",B0,[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(hn,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",D0,[ne[13]||(ne[13]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-name",width:"100%","model-value":l.value.name,"onUpdate:modelValue":ne[1]||(ne[1]=B=>m({name:B}))},null,8,["model-value"])]),n.createElementVNode("label",O0,[ne[14]||(ne[14]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":l.value.stereotype,items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":ne[2]||(ne[2]=B=>m({stereotype:B}))},null,8,["model-value"])]),n.createElementVNode("label",L0,[ne[15]||(ne[15]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-package",width:"100%","model-value":l.value.packageName??"","onUpdate:modelValue":ne[3]||(ne[3]=B=>m({packageName:B}))},null,8,["model-value"])]),n.createElementVNode("fieldset",P0,[ne[18]||(ne[18]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",z0,[ne[16]||(ne[16]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":l.value.superClass??"","onUpdate:modelValue":ne[4]||(ne[4]=B=>P(B))},null,8,["model-value"])]),n.createElementVNode("label",U0,[ne[17]||(ne[17]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":ie.value,"onUpdate:modelValue":ne[5]||(ne[5]=B=>te(B))},null,8,["model-value"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!l.value.abstractClass,"onUpdate:modelValue":ne[6]||(ne[6]=B=>T(B))},null,8,["model-value"])]),n.createElementVNode("label",H0,[ne[19]||(ne[19]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=l.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":ne[7]||(ne[7]=B=>p("physicalName",null,B))},null,8,["model-value"])]),n.createElementVNode("label",F0,[ne[20]||(ne[20]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":l.value.schema??"","onUpdate:modelValue":ne[8]||(ne[8]=B=>K(B))},null,8,["model-value"])]),n.createElementVNode("fieldset",G0,[ne[21]||(ne[21]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,B=>{var G,X;return n.openBlock(),n.createElementBlock("label",{key:B,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(B),1),n.createVNode(n.unref(le.BSTextInput),{name:`ent-logical-${B}`,width:"100%","model-value":((X=(G=l.value.table)==null?void 0:G.logicalName)==null?void 0:X[B])??"","onUpdate:modelValue":A=>p("logicalName",B,A)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",Y0,[ne[22]||(ne[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":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",W0,[ne[26]||(ne[26]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,B=>{var G;return n.createVNode(n.unref(le.BSCheckbox),{key:B.key,name:`jpa-${B.key}`,class:"em-check",label:B.label,"model-value":!!((G=l.value.jpaAttrs)!=null&&G[B.key]),"onUpdate:modelValue":X=>_(B.key,X)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",K0,[ne[23]||(ne[23]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:y.value,"model-value":((S=l.value.jpaAttrs)==null?void 0:S.discriminatorColumnName)??"","onUpdate:modelValue":ne[9]||(ne[9]=B=>b("discriminatorColumnName",B.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",q0,[ne[24]||(ne[24]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(le.BSSelect),{disabled:y.value,"model-value":N.value,items:u,"value-provider":f,"label-provider":h,"onUpdate:modelValue":ne[10]||(ne[10]=B=>B&&x(B))},null,8,["disabled","model-value"])]),n.createElementVNode("label",X0,[ne[25]||(ne[25]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(le.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:y.value,"model-value":(I=l.value.jpaAttrs)==null?void 0:I.discriminatorLength,"onUpdate:modelValue":ne[11]||(ne[11]=B=>b("discriminatorLength",B||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(le.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",j0,[ne[27]||(ne[27]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",Z0,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:"없음",onClick:ne[12]||(ne[12]=B=>fe(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),B=>(n.openBlock(),n.createElementBlock("button",{key:B,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===B}]),style:n.normalizeStyle({background:n.unref(Dn)(B)}),title:n.unref(Bn)(B),onClick:G=>fe(B)},null,14,J0))),128))])])],64)):n.createCommentVNode("",!0)],8,M0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-c24d4686"]]),cd=["ko","en","ja","zh"];function Q0(e){if(e)for(const t of cd){const o=e[t];if(o)return o}}function ml(e){const t=Q0(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function e1(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 t1=["aria-expanded"],n1=["aria-selected","onClick","onMouseenter"],o1={key:0,class:"gcc__opt gcc__opt--empty"},dd=De(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(T=>T.groupCode===o.modelValue)),h=n.computed(()=>f.value?ml(f.value):"");n.watch(h,T=>{c.value||(s.value=T)},{immediate:!0});const m=n.computed(()=>s.value===h.value?o.items:e1(o.items,s.value));function p(){var ie;const T=(ie=a.value)==null?void 0:ie.getBoundingClientRect();T&&(u.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function g(){c.value=!0,p(),d.value=Math.max(0,m.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),document.addEventListener("mousedown",K)}function b(){c.value=!1,window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),document.removeEventListener("mousedown",K)}n.onBeforeUnmount(b);function _(){g(),n.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function N(){c.value||g(),d.value=0}function y(T){i("update:modelValue",T.groupCode),s.value=ml(T),b()}function x(){i("update:modelValue",void 0),s.value="",b()}function q(){s.value.trim()===""?x():(s.value=h.value,b())}function P(T){var ie;if(T.key==="ArrowDown")c.value||g(),d.value=Math.min(d.value+1,m.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")d.value=Math.max(d.value-1,0),T.preventDefault();else if(T.key==="Enter"){const te=m.value[d.value];te&&y(te),T.preventDefault()}else T.key==="Escape"&&(s.value=h.value,b(),(ie=l.value)==null||ie.blur())}function K(T){var te,fe;const ie=T.target;!((te=a.value)!=null&&te.contains(ie))&&!((fe=r.value)!=null&&fe.contains(ie))&&q()}return(T,ie)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:a,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":ie[0]||(ie[0]=te=>s.value=te),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:_,onInput:N,onKeydown:P},null,40,t1),[[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:ie[1]||(ie[1]=n.withModifiers(()=>{},["prevent"])),onClick:x},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(te,fe)=>(n.openBlock(),n.createElementBlock("li",{key:te.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":fe===d.value,"is-selected":te.groupCode===e.modelValue}]),role:"option","aria-selected":te.groupCode===e.modelValue,onMousedown:ie[2]||(ie[2]=n.withModifiers(()=>{},["prevent"])),onClick:M=>y(te),onMouseenter:M=>d.value=fe},n.toDisplayString(n.unref(ml)(te)),43,n1))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",o1,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),i1=["disabled"],a1={class:"em-aw__toolbar"},l1={class:"em-aw__count"},r1={class:"em-aw__scroll"},s1={class:"em-aw__table"},c1={key:0,class:"c-code"},d1=["colspan"],u1={class:"c-del"},f1={class:"c-flag"},m1={class:"c-flag"},p1={class:"c-flag"},h1={class:"c-flag"},y1={class:"c-flag"},g1={class:"c-flag"},b1={class:"c-flag"},_1={class:"c-flag"},v1={key:0},w1={class:"c-del"},E1=["colspan"],k1={class:"c-del"},N1={class:"em-aw__embed-label"},I1={class:"em-aw__ro"},$1={class:"em-aw__ro"},x1={class:"em-aw__ro"},S1={class:"em-aw__ro"},C1={colspan:"8"},R1=["colspan"],V1={key:0},$i="__OWN__",A1=De(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(D=>D.modelId===t.entityId)??null),a=n.computed(()=>{var D;return((D=i.value)==null?void 0:D.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var D;return(((D=i.value)==null?void 0:D.attributes)??[]).filter(v=>v.attrType!=="DIVIDER").length}),s=n.computed(()=>E.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(D){return D==="none"?"(없음)":D}const u=D=>D;function f(D,v){i.value&&o.updateAttribute(i.value.modelId,D.modelId,v)}function h(D,v){f(D,{naturalId:v||void 0,naturalIdMutable:v?D.naturalIdMutable:void 0})}function m(){return{naturalId:void 0,naturalIdMutable:void 0}}function p(D,v){f(D,{identifier:v,...v?m():{}})}function g(D,v){f(D,{transient:v||void 0,...v?m():{}})}function b(D){return!!D.transient}const _=D=>D.value,N=D=>D.label;function y(D,v){if(!v)return;const w=te.value.find(z=>z.type===v);if(w){const z=D.dbAttrs[0]??{modelId:D.modelId+".c",physicalName:D.name,dataType:"VARCHAR"};f(D,{type:v,customType:void 0,dbAttrs:[{...z,dataType:w.dataType,length:w.length,scale:w.scale}]});return}f(D,v===Ot?{type:v}:{type:v,customType:void 0})}function x(D,v){f(D,{customType:v.trim()===""?void 0:v})}function q(D,v){const z={...D.dbAttrs[0]??{modelId:D.modelId+".c",physicalName:D.name,dataType:"VARCHAR"},...v};v.dataType!==void 0&&!Bo.has(z.dataType)&&(z.scale=void 0),f(D,{dbAttrs:[z]})}function P(D){var v;return Bo.has(((v=D.dbAttrs[0])==null?void 0:v.dataType)??"")}function K(D,v,w){var z;q(D,{logicalName:{...(z=D.dbAttrs[0])==null?void 0:z.logicalName,[v]:w}})}function T(D){return D.personalInfoAttributeType??"none"}function ie(D,v){f(D,{personalInfoAttributeType:v==="none"?void 0:v})}const te=n.computed(()=>o.predefinedCustomTypeCatalog.value),fe=n.computed(()=>o.embeddableCatalog.value);function M(D){var v,w;return((v=D.label)==null?void 0:v.ko)??((w=D.label)==null?void 0:w.en)??D.type}function ne(D){!D||!i.value||o.addPredefinedEmbed(i.value.modelId,D)}const E=n.computed(()=>o.groupCodeCatalog.value);function S(D){var v;return((v=E.value.find(w=>w.groupCode===D.groupCode))==null?void 0:v.codes)??[]}function I(D){return["none",...S(D)]}function B(D){return D==="none"?"none":D.code}function G(D){var w,z;if(D==="none")return"(없음)";const v=((w=D.label)==null?void 0:w.ko)??((z=D.label)==null?void 0:z.en);return v?`${D.code} (${v})`:D.code}function X(D,v){i.value&&o.setAttributeGroupCode(i.value.modelId,D.modelId,v)}function A(D,v){f(D,{defaultValue:v==="none"?void 0:v})}function ae(D,v){f(D,{defaultValue:v.trim()===""?void 0:v})}function se(D){return D.attrType.startsWith("EMBED")&&D.dbAttrs.length>0}function ge(D,v,w){const z=D.dbAttrs.map((pe,J)=>{if(J!==v)return pe;const Z={...pe,...w};for(const W of Object.keys(w))w[W]===void 0&&delete Z[W];return Z});i.value&&o.setEmbedColumns(i.value.modelId,D.modelId,z)}function _e(D,v,w,z){var pe;ge(D,v,{logicalName:{...(pe=D.dbAttrs[v])==null?void 0:pe.logicalName,[w]:z}})}function re(D,v){var pe,J,Z;if(D.attrType==="EMBED_PREDEF"){const W=(pe=o.embeddableCatalog.value.find(de=>de.type===D.type))==null?void 0:pe.fields[v];return W?{name:W.name,physicalName:W.physicalName,dataType:W.dataType,length:W.length,shareable:W.shareable,logicalName:W.logicalName}:void 0}const w=(J=D.embedded)==null?void 0:J.embeddableRef;if(!w)return;const z=(Z=o.state.logical.entities.find(W=>W.modelId===w))==null?void 0:Z.attributes.flatMap(W=>W.dbAttrs)[v];return z?{physicalName:z.physicalName,dataType:z.dataType,length:z.length,scale:z.scale,logicalName:z.logicalName}:void 0}function ye(D,v){var w,z;return((w=re(D,v))==null?void 0:w.dataType)||((z=D.dbAttrs[v])==null?void 0:z.dataType)||""}function be(D,v){var w,z;return((w=re(D,v))==null?void 0:w.length)??((z=D.dbAttrs[v])==null?void 0:z.length)}function $e(D,v){var w,z;return((w=re(D,v))==null?void 0:w.scale)??((z=D.dbAttrs[v])==null?void 0:z.scale)}const Se=["inherit","true","false"];function Ce(D){return D==="inherit"?"기본(따름)":D}function Y(D){return(D==null?void 0:D.updatable)===void 0?"inherit":D.updatable?"true":"false"}function U(D,v,w){ge(D,v,{updatable:w==="inherit"?void 0:w==="true"})}function V(D,v){q(D,{updatable:v==="inherit"?void 0:v==="true"})}const C=["inherit","true","false"];function R(D){return D==="inherit"?"기본(따름)":D}function O(D){return(D==null?void 0:D.insertable)===void 0?"inherit":D.insertable?"true":"false"}function oe(D,v,w){ge(D,v,{insertable:w==="inherit"?void 0:w==="true"})}function j(D,v){q(D,{insertable:v==="inherit"?void 0:v==="true"})}const k=n.computed(()=>{var D;return Kn(((D=i.value)==null?void 0:D.attributes.flatMap(v=>v.dbAttrs))??[])}),$=n.computed(()=>{var D;return(((D=i.value)==null?void 0:D.attributes)??[]).filter(v=>v.attrType==="NORMAL"&&v.dbAttrs.length===1&&v.dbAttrs[0]).map(v=>({modelId:v.dbAttrs[0].modelId,label:v.dbAttrs[0].physicalName||v.name}))});function L(){return[$i,...$.value.map(D=>D.modelId)]}function Q(D){if(D===$i)return"전용 컬럼(OWN)";const v=$.value.find(w=>w.modelId===D);return v?`↗ ${v.label} (공유)`:D}function ce(D){return(D==null?void 0:D.sharedColumnRef)??$i}function me(D,v,w){ge(D,v,{sharedColumnRef:w===$i?void 0:w})}function he(D){return(D==null?void 0:D.sharedColumnRef)!=null}function ve(D){var v;return((v=Do(D,k.value))==null?void 0:v.physicalName)??""}return(D,v)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",a1,[n.createElementVNode("span",l1,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:v[0]||(v[0]=w=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"구분선",onClick:v[1]||(v[1]=w=>n.unref(o).addDivider(i.value.modelId))}),fe.value.length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:fe.value,"value-provider":w=>w.type,"label-provider":M,"onUpdate:modelValue":ne},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",r1,[n.createElementVNode("table",s1,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[v[2]||(v[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),v[3]||(v[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),v[4]||(v[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),v[5]||(v[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),v[6]||(v[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),v[7]||(v[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),v[8]||(v[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),v[9]||(v[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),v[10]||(v[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),v[11]||(v[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),v[12]||(v[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),v[13]||(v[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),v[14]||(v[14]=n.createElementVNode("th",{class:"c-flag"},"@NaturalId",-1)),v[15]||(v[15]=n.createElementVNode("th",{class:"c-flag"},"NID mutable",-1)),v[16]||(v[16]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),v[17]||(v[17]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),v[18]||(v[18]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),v[19]||(v[19]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),E.value.length?(n.openBlock(),n.createElementBlock("th",c1,"코드그룹")):n.createCommentVNode("",!0),v[20]||(v[20]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),v[21]||(v[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,w=>{var z,pe,J,Z,W,de,Ne,xe,H,ee,F;return n.openBlock(),n.createElementBlock(n.Fragment,{key:w.modelId},[w.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(w.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-divlabel-${w.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":w.name,"onUpdate:modelValue":ue=>f(w,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,d1),n.createElementVNode("td",u1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])])],2)):se(w)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(w.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-name-${w.modelId}`,width:"100%",placeholder:"이름","model-value":w.name,"onUpdate:modelValue":ue=>f(w,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-type-${w.modelId}`,width:"100%",disabled:"","model-value":w.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:E.value.length?18:17,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(w.dbAttrs.length)+"개",9,E1),n.createElementVNode("td",k1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(w.dbAttrs,(ue,Ae)=>{var Je,nt,Pe,kt,Xt,jt,Zt;return n.openBlock(),n.createElementBlock("tr",{key:ue.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",N1,"↳ "+n.toDisplayString(((Je=re(w,Ae))==null?void 0:Je.name)??((nt=re(w,Ae))==null?void 0:nt.physicalName)??`컬럼 ${Ae+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",I1,n.toDisplayString(ye(w,Ae)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-embed-logical-${ue.modelId}`,width:"100%",placeholder:((kt=(Pe=re(w,Ae))==null?void 0:Pe.logicalName)==null?void 0:kt.ko)??"논리명","model-value":((Xt=ue.logicalName)==null?void 0:Xt.ko)??"","onUpdate:modelValue":Ge=>_e(w,Ae,"ko",Ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-embed-col-${ue.modelId}`,width:"100%",disabled:he(ue),placeholder:((jt=re(w,Ae))==null?void 0:jt.physicalName)??"컬럼","model-value":he(ue)?ve(ue):ue.physicalName,"onUpdate:modelValue":Ge=>ge(w,Ae,{physicalName:Ge})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":ue.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",$1,n.toDisplayString(ye(w,Ae)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",x1,n.toDisplayString(be(w,Ae)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",S1,n.toDisplayString($e(w,Ae)??""),1)]),n.createElementVNode("td",C1,[(Zt=re(w,Ae))!=null&&Zt.shareable?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":ce(ue),items:L(),"value-provider":u,"label-provider":Q,"onUpdate:modelValue":Ge=>Ge&&me(w,Ae,Ge)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:he(ue),"model-value":he(ue)?"false":O(ue),items:C,"value-provider":u,"label-provider":R,"onUpdate:modelValue":Ge=>Ge&&oe(w,Ae,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:he(ue),"model-value":he(ue)?"false":Y(ue),items:Se,"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":Ge=>Ge&&U(w,Ae,Ge)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:E.value.length?4:3},null,8,R1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":l.value.has(w.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-name-${w.modelId}`,width:"100%",placeholder:"이름","model-value":w.name,"onUpdate:modelValue":ue=>f(w,{name:ue})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-type-${w.modelId}`,width:"100%",placeholder:"타입",disabled:!!w.groupCode,items:n.unref(Jl)(w.type,te.value),"value-provider":_,"label-provider":N,"model-value":w.type,"onUpdate:modelValue":ue=>y(w,ue)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),w.type===n.unref(Ot)?(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:0,name:`aw-customtype-${w.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":w.customType??"","onUpdate:modelValue":ue=>x(w,ue)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-logical-${w.modelId}`,width:"100%",placeholder:"논리명","model-value":((pe=(z=w.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:pe.ko)??"","onUpdate:modelValue":ue=>K(w,"ko",ue)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`aw-col-${w.modelId}`,width:"100%",placeholder:"컬럼",disabled:b(w),"model-value":((J=w.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ue=>q(w,{physicalName:ue})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":(Z=w.dbAttrs[0])==null?void 0:Z.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-dtype-${w.modelId}`,width:"100%",placeholder:"dataType",disabled:b(w),items:n.unref(jl)(((W=w.dbAttrs[0])==null?void 0:W.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(ra),"model-value":((de=w.dbAttrs[0])==null?void 0:de.dataType)??"","onUpdate:modelValue":ue=>ue&&q(w,{dataType:ue})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSNumberInput),{name:`aw-len-${w.modelId}`,width:"100%",placeholder:"len",disabled:b(w),"model-value":(Ne=w.dbAttrs[0])==null?void 0:Ne.length,"onUpdate:modelValue":ue=>q(w,{length:ue||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSNumberInput),{name:`aw-scale-${w.modelId}`,width:"100%",placeholder:"scale",disabled:b(w)||!P(w),"model-value":(xe=w.dbAttrs[0])==null?void 0:xe.scale,"onUpdate:modelValue":ue=>q(w,{scale:ue||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",f1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-pk-${w.modelId}`,"model-value":w.identifier,disabled:a.value||b(w),"onUpdate:modelValue":ue=>p(w,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",m1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nn-${w.modelId}`,"model-value":w.notNull,disabled:b(w),"onUpdate:modelValue":ue=>f(w,{notNull:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",p1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-uq-${w.modelId}`,"model-value":!!((H=w.dbAttrs[0])!=null&&H.unique),disabled:b(w),"onUpdate:modelValue":ue=>q(w,{unique:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",h1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-ai-${w.modelId}`,"model-value":!!((ee=w.dbAttrs[0])!=null&&ee.autoIncrement),disabled:b(w)||!w.identifier,"onUpdate:modelValue":ue=>q(w,{autoIncrement:ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",y1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-tr-${w.modelId}`,"model-value":!!w.transient,disabled:w.identifier,"onUpdate:modelValue":ue=>g(w,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",g1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nid-${w.modelId}`,"model-value":!!w.naturalId,disabled:w.identifier||b(w),"onUpdate:modelValue":ue=>h(w,ue)},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",b1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-nidm-${w.modelId}`,"model-value":!!w.naturalIdMutable,disabled:b(w)||!w.naturalId,"onUpdate:modelValue":ue=>f(w,{naturalIdMutable:ue||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",_1,[n.createVNode(n.unref(le.BSCheckbox),{name:`aw-mv-${w.modelId}`,"model-value":!!((F=w.dbAttrs[0])!=null&&F.multiValue),disabled:b(w),"onUpdate:modelValue":ue=>q(w,{multiValue:ue||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-ins-${w.modelId}`,width:"100%",disabled:b(w),"model-value":O(w.dbAttrs[0]),items:C,"value-provider":u,"label-provider":R,"onUpdate:modelValue":ue=>ue&&j(w,ue)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{name:`aw-upd-${w.modelId}`,width:"100%",disabled:b(w),"model-value":Y(w.dbAttrs[0]),items:Se,"value-provider":u,"label-provider":Ce,"onUpdate:modelValue":ue=>ue&&V(w,ue)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":T(w),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":ue=>ue&&ie(w,ue)},null,8,["model-value","onUpdate:modelValue"])]),E.value.length?(n.openBlock(),n.createElementBlock("td",v1,[n.createVNode(dd,{"model-value":w.groupCode,items:E.value,"onUpdate:modelValue":ue=>X(w,ue)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[S(w).length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":w.defaultValue??"none",items:I(w),"value-provider":B,"label-provider":G,"onUpdate:modelValue":ue=>ue&&A(w,ue)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:1,name:`aw-default-${w.modelId}`,width:"100%",placeholder:"기본값","model-value":w.defaultValue??"","onUpdate:modelValue":ue=>ae(w,ue)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",w1,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ue=>n.unref(o).removeAttribute(i.value.modelId,w.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",V1,[...v[22]||(v[22]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,i1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-d8326b9d"]]),T1=["disabled"],M1={class:"em-idxw__list"},B1={class:"em-idxw__list-head"},D1=["onClick"],O1={class:"em-idxw__item-name"},L1={key:0,class:"em-idxw__badge"},P1={class:"em-idxw__item-cnt"},z1={key:0,class:"em-idxw__empty"},U1={key:0,class:"em-idxw__edit"},H1={class:"em-idxw__form"},F1={class:"em-field em-idxw__name"},G1={class:"em-field"},Y1=["value"],W1={class:"em-idxw__transfer"},K1={class:"em-idxw__pane"},q1={class:"em-idxw__pane-head"},X1={class:"em-idxw__cols"},j1=["onClick"],Z1={key:0,class:"em-idxw__empty"},J1={class:"em-idxw__arrows"},Q1={class:"em-idxw__pane"},e_={class:"em-idxw__pane-head"},t_={class:"em-idxw__cols"},n_={class:"em-idxw__col-name"},o_={class:"em-idxw__col-ops"},i_=["disabled","onClick"],a_=["disabled","onClick"],l_=["onClick"],r_={key:0,class:"em-idxw__empty"},s_={key:1,class:"em-idxw__edit em-idxw__edit--empty"},c_=De(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(P=>P.modelId===t.entityId)??null),a=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.indexes)??[]}),l=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.attributes)??[]}),r=n.ref(null);n.watch(a,P=>{var K;P.some(T=>T.modelId===r.value)||(r.value=((K=P[0])==null?void 0:K.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(P=>P.modelId===r.value)??null),c=n.computed(()=>{var P;return new Set(((P=s.value)==null?void 0:P.columns.map(K=>K.columnRef))??[])}),d=n.computed(()=>l.value.filter(P=>!c.value.has(P.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(P){var T;const K=(T=P.dbAttrs[0])==null?void 0:T.physicalName;return K&&K!==P.name?`${P.name} (${K})`:P.name}function h(P){const K=l.value.find(T=>T.modelId===P);return K?f(K):P}function m(P,K){i.value&&o.updateIndex(i.value.modelId,P,K)}function p(){var K;if(!i.value)return;const P=Te();o.addIndex(i.value.modelId,{modelId:P,name:`idx_${(((K=i.value.indexes)==null?void 0:K.length)??0)+1}`,unique:!1,columns:[]}),r.value=P}function g(P){i.value&&o.removeIndex(i.value.modelId,P)}function b(P){s.value&&m(s.value.modelId,{parameters:P.trim()===""?void 0:P})}function _(P){const K=new Set(u.value);K.has(P)?K.delete(P):K.add(P),u.value=K}function N(){const P=s.value;if(!P||!u.value.size)return;const K=[...u.value].map(T=>({columnRef:T,descending:!1}));m(P.modelId,{columns:[...P.columns,...K]}),u.value=new Set}function y(P){const K=s.value;K&&m(K.modelId,{columns:K.columns.filter((T,ie)=>ie!==P)})}function x(P,K){const T=s.value;T&&m(T.modelId,{columns:T.columns.map((ie,te)=>te===P?{...ie,descending:K}:ie)})}function q(P,K){const T=s.value;if(!T)return;const ie=P+K;if(ie<0||ie>=T.columns.length)return;const te=[...T.columns];[te[P],te[ie]]=[te[ie],te[P]],m(T.modelId,{columns:te})}return(P,K)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",M1,[n.createElementVNode("div",B1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(a.value.length)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:p})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":T.modelId===r.value}]),onClick:ie=>r.value=T.modelId},[n.createElementVNode("span",O1,n.toDisplayString(T.name||"(이름 없음)"),1),T.unique?(n.openBlock(),n.createElementBlock("span",L1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",P1,n.toDisplayString(T.columns.length),1)],10,D1))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",z1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",U1,[n.createElementVNode("div",H1,[n.createElementVNode("label",F1,[K[4]||(K[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":K[0]||(K[0]=T=>m(s.value.modelId,{name:T}))},null,8,["model-value"]),n.createVNode(hn,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":K[1]||(K[1]=T=>m(s.value.modelId,{unique:T}))},null,8,["model-value"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:K[2]||(K[2]=T=>g(s.value.modelId))})]),n.createElementVNode("label",G1,[K[5]||(K[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:K[3]||(K[3]=T=>b(T.target.value))},null,40,Y1)]),n.createElementVNode("div",W1,[n.createElementVNode("div",K1,[n.createElementVNode("div",q1,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",X1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(T.modelId)}]),onClick:ie=>_(T.modelId)},n.toDisplayString(f(T)),11,j1))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Z1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",J1,[n.createVNode(n.unref(le.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:N},null,8,["disabled"])]),n.createElementVNode("div",Q1,[n.createElementVNode("div",e_,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",t_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(T,ie)=>(n.openBlock(),n.createElementBlock("li",{key:ie,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",n_,n.toDisplayString(h(T.columnRef)),1),n.createVNode(n.unref(le.BSCheckbox),{name:`idxw-desc-${ie}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":te=>x(ie,te)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",o_,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:ie===0,onClick:te=>q(ie,-1)},"↑",8,i_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:ie===s.value.columns.length-1,onClick:te=>q(ie,1)},"↓",8,a_),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:te=>y(ie)},"✕",8,l_)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",r_,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",s_,"인덱스를 선택하거나 추가하세요."))],8,T1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),d_={class:"em-op-src"},u_={class:"em-op-src__actions"},ud=De(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=le.useModalHandle(),i=n.ref(t.sourceCode);function a(){t.onSave(i.value),o.close()}return(l,r)=>(n.openBlock(),n.createBlock(n.unref(le.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",d_,[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",u_,[n.createVNode(n.unref(le.BSButton),{caption:"저장",onClick:a}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),f_=["disabled"],m_={class:"em-ow__toolbar"},p_={class:"em-ow__count"},h_={class:"em-ow__scroll"},y_={class:"em-ow__table"},g_={class:"c-del"},b_={key:0},__=De(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=le.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,g){a.value&&o.updateOperation(a.value.modelId,p.modelId,g)}function u(p,g,b){d(p,{description:{...p.description,[g]:b}})}function f(p){return p.personalInfoAttributeType??"none"}function h(p,g){d(p,{personalInfoAttributeType:g==="none"?void 0:g})}function m(p){i.openModal({component:ud,bind:{operationName:p.name,sourceCode:p.sourceCode??"",onSave:g=>d(p,{sourceCode:g})}})}return(p,g)=>{var b,_;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",m_,[n.createElementVNode("span",p_,"오퍼레이션 ("+n.toDisplayString(((b=a.value.operations)==null?void 0:b.length)??0)+")",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:g[0]||(g[0]=N=>n.unref(o).addOperation(a.value.modelId))})]),n.createElementVNode("div",h_,[n.createElementVNode("table",y_,[g[2]||(g[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var y;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":N.name,"onUpdate:modelValue":x=>d(N,{name:x})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:l,"value-provider":c,"label-provider":c,"onUpdate:modelValue":x=>x&&d(N,{visibility:x})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((y=N.description)==null?void 0:y.ko)??"","onUpdate:modelValue":x=>u(N,"ko",x)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":f(N),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":x=>x&&h(N,x)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(le.BSButton),{variant:"text",caption:N.sourceCode?"본문 ●":"본문",onClick:x=>m(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",g_,[n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:x=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(_=a.value.operations)!=null&&_.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",b_,[...g[1]||(g[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,f_)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),v_={class:"em-detail__tabs"},w_=["onClick"],E_=De(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=le.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(le.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",v_,[(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,w_)),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(A1,{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(__,{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 xi(e,t,o){e.openModal({component:E_,bind:{controller:n.markRaw(t),entityId:o}})}const fd=()=>crypto.randomUUID(),k_=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,N_=e=>e&&e[0].toLowerCase()+e.slice(1),I_=e=>e&&e[0].toUpperCase()+e.slice(1),$_=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function x_(e,t){return N_(e)+I_(t)}function S_(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=x_(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:$_(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,t)=>`${e}::${t}`;function C_(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((l,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==l.dataType||s.length!==l.length||s.scale!==l.scale}))&&(i.dbAttrs=t.dbAttrs.map((l,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??l.physicalName,logicalName:(s==null?void 0:s.logicalName)??l.logicalName,dataType:l.dataType,length:l.length,scale:l.scale}})),Object.keys(i).length?i:null}function R_(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 Ci(e,t,o=fd){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=>S_(e,f)),s=new Map(r.map(f=>[Si(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Si(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=Si(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=Si(f.associationRef,f.sourceAttributeRef),m=d.get(h);if(!m)i.add.push(R_(f,u++,o));else{const p=C_(m,f,o);p&&i.update.push({attributeId:m.modelId,patch:p})}}return i}function V_(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 A_(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function T_(e,t,o=fd){const i=new Map,a=A_(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=Ci(a,d,o);if(k_(u))continue;i.has(d)||i.set(d,u);const f=a.entities.find(h=>h.modelId===d);f&&V_(f,u),l.has(d)||r.push(d)}}return i}function M_(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Te(),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=Te();o.set(a.modelId,l),a.modelId=l;for(const r of a.dbAttrs)r.modelId=Te()}for(const a of t.indexes??[]){a.modelId=Te();for(const l of a.columns)l.columnRef=o.get(l.columnRef)??l.columnRef}return t}const yn=Symbol("editorController");function md(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function Ri(e,t){const o=[];for(const i of t.remove)o.push(Pt(e,i));for(const i of t.update)o.push(nn(e,i.attributeId,i.patch));for(const i of t.add)o.push(xt(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 T_(e,t,Te))o.push(...Ri(i,a));return o}function pd(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=Ci(e,t,Te),i=Ri(t,o),a=pd(e,t,o);return i.push(...Ln(a,t)),i}function hd(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Te()}))}function B_(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:Te(),name:h,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Te(),physicalName:h.toLowerCase(),dataType:"BIGINT"}]},i.push(xt(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,g=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:g.multiplicity,navigable:g.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(l.filter(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=Ci(r,t,Te);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(Pt(u.ownerId,u.dispId)),i.push(Ho(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...Ri(t,s));const c=pd(r,t,s);return i.push(...Ln(c,t)),i}function D_(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 x;return((x=y.embedded)==null?void 0:x.associationRef)===l.modelId}))continue;const u=Te(),f=d.attributes.reduce((y,x)=>Math.max(y,x.order),-1)+1,h=new Set(d.attributes.map(y=>y.name)),m=a(o.name);let p=m;for(let y=2;h.has(p);y++)p=`${m}${y}`;const g=o.attributes.filter(y=>!y.identifier&&!y.derivedFrom).flatMap(y=>y.dbAttrs).map(y=>({...y,modelId:Te()})),b={modelId:u,name:p,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:g,embedded:{associationRef:l.modelId,embeddableRef:t}};i.push(xt(c,b));const _=r?"end2":"end1",N=r?"end1":"end2";i.push(Ho(l.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Te()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function O_(e=md(),t={}){var oe,j;const o=n.reactive(e);let i=new ha(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),g=n.ref(!1),b=n.ref(0),_=n.ref(((oe=t.meta)==null?void 0:oe.schemaVersion)??1),N=n.ref(((j=t.meta)==null?void 0:j.opWriteEnabled)??!1),y=n.computed(()=>_.value>=2&&N.value),x=t.historyTransport,q=n.computed(()=>y.value&&x!==void 0),P=t.restoreTransport,K=n.ref(0),T=n.computed(()=>y.value&&te.value&&P!==void 0);async function ie(k){if(!P||!te.value)return{ok:!1,reason:"unavailable"};const $=await P(k);return $.ok&&K.value++,$}const te=n.ref(!(_.value>=2&&N.value===!1)),fe=n.ref("LOGICAL_PHYSICAL"),M=n.ref("straight"),ne=n.ref(!0),E=n.ref(!0),S=n.ref(null),I=n.computed(()=>{var k;return((k=S.value)==null?void 0:k.kind)==="attribute"?{entityId:S.value.entityId,attrId:S.value.anchor}:null}),B=n.computed(()=>{var k;return((k=S.value)==null?void 0:k.kind)==="attribute"?S.value.ids:[]}),G=n.computed(()=>{var k,$;return((k=S.value)==null?void 0:k.kind)==="entity"?S.value.id:(($=S.value)==null?void 0:$.kind)==="attribute"?S.value.entityId:null}),X=n.ref(null);let A=0;const ae=n.ref(null),se=n.ref(null);let ge=t.meta;function _e(){i.onChange(()=>{m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,b.value++})}_e();let re=null,ye=null;function be(){ye==null||ye(),ye=null,re=null}function $e(){if(be(),!y.value||!t.opTransport)return;const k=new Fr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:$=>{te.value=!1,se.value=$},onError:t.onOpError});k.seed((ge==null?void 0:ge.revSeed)??{}),ye=k.attach(i),re=k}$e();const Se=n.computed(()=>zl(o.logical,o.layout)),Ce=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:h.value,embeddableCatalog:a.value})),Y=n.computed(()=>tr(o.logical,Ce.value)),U=n.computed(()=>{const k=new Map;for(const $ of Y.value){if(!$.targetRef)continue;const L=k.get($.targetRef);L?L.push($):k.set($.targetRef,[$])}return k}),V=k=>{te.value&&i.execute(k)},C=(k,$,L)=>{const Q=nn(k,$,L),ce=On(o.logical,k,he=>he.map(ve=>ve.modelId===$?{...ve,...L}:ve)),me=Ln(ce,k);V(me.length?Le("속성 수정",[Q,...me]):Q)};function R(k){const $=k.map(D=>o.layout.entityLayouts.find(v=>v.entityRef===D)).filter(D=>!!D);if(!$.length)return{location:{x:40,y:40},size:{width:400,height:300}};let L=1/0,Q=1/0,ce=-1/0,me=-1/0;for(const D of $){const v=D.geo.size.width||220,w=D.geo.size.height||140;L=Math.min(L,D.geo.location.x),Q=Math.min(Q,D.geo.location.y),ce=Math.max(ce,D.geo.location.x+v),me=Math.max(me,D.geo.location.y+w)}const he=40,ve=28;return{location:{x:L-he,y:Q-he-ve},size:{width:ce-L+he*2,height:me-Q+he*2+ve}}}function O(k,$,L){var D;const Q=o.layout.groupLayouts.find(v=>v.groupRef===k),ce=(Q==null?void 0:Q.geo.location)??$,me=$.x-ce.x,he=$.y-ce.y,ve=[pr(k,$),...L.map(v=>Nn(v.id,v.location))];if(me||he){const v=new Set(((D=o.logical.groups.find(w=>w.modelId===k))==null?void 0:D.memberEntityRefs)??[]);for(const w of o.logical.associations){if(!v.has(w.end1.entityRef)||!v.has(w.end2.entityRef))continue;const z=o.layout.associationLayouts.find(pe=>pe.associationRef===w.modelId);z&&z.waypoints.length&&ve.push(xr(w.modelId,me,he))}for(const w of(Q==null?void 0:Q.memberNoteRefs)??[]){const z=o.layout.notes.find(pe=>pe.modelId===w);z&&ve.push(Jn(w,{x:z.geo.location.x+me,y:z.geo.location.y+he}))}}return ve}return{state:o,resolved:Se,issues:Y,issuesByRef:U,flagEntitiesWithoutRelations:h,canUndo:m,canRedo:p,dirty:g,revision:b,editable:te,schemaVersion:_,opWriteEnabled:N,opMode:y,opConflict:se,historyTransport:x,historyAvailable:q,restoreTransport:P,restoreAvailable:T,restoreToSeq:ie,reloadRequest:K,displayMode:fe,routingMode:M,showGrid:ne,showMinimap:E,selection:S,selectedAttr:I,selectedAttrIds:B,inspectedEntityId:G,focusRequest:X,clipboard:ae,embeddableCatalog:a,groupCodeCatalog:l,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(k){te.value=k&&y.value},setEmbeddableCatalog(k){a.value=k},setGroupCodeCatalog(k){l.value=k},setPredefinedCustomTypeCatalog(k){r.value=k},selectAttribute(k,$,L="replace"){const Q=S.value,ce=(Q==null?void 0:Q.kind)==="attribute"&&Q.entityId===k;if(L==="replace"||!ce){S.value={kind:"attribute",entityId:k,ids:[$],anchor:$};return}if(L==="toggle"){const z=Q.ids.includes($),pe=z?Q.ids.filter(Z=>Z!==$):[...Q.ids,$];if(!pe.length){S.value=null;return}const J=z&&Q.anchor===$?pe[pe.length-1]:z?Q.anchor:$;S.value={kind:"attribute",entityId:k,ids:pe,anchor:J};return}const me=o.logical.entities.find(z=>z.modelId===k),he=[...(me==null?void 0:me.attributes)??[]].sort((z,pe)=>z.order-pe.order).map(z=>z.modelId),ve=he.indexOf(Q.anchor),D=he.indexOf($);if(ve<0||D<0){S.value={kind:"attribute",entityId:k,ids:[$],anchor:$};return}const[v,w]=ve<=D?[ve,D]:[D,ve];S.value={kind:"attribute",entityId:k,ids:he.slice(v,w+1),anchor:Q.anchor}},moveAttributeFocus(k){const $=S.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const L=o.logical.entities.find(he=>he.modelId===$.entityId);if(!L||!L.attributes.length)return!1;const Q=L.attributes.findIndex(he=>he.modelId===$.anchor);if(Q<0)return!1;const ce=Math.min(Math.max(Q+k,0),L.attributes.length-1);if(ce===Q)return!0;const me=L.attributes[ce].modelId;return S.value={kind:"attribute",entityId:$.entityId,ids:[me],anchor:me},!0},nudgeSelectedAttributes(k){const $=S.value;if(($==null?void 0:$.kind)!=="attribute")return!1;const L=o.logical.entities.find(z=>z.modelId===$.entityId);if(!L)return!1;const Q=L.attributes,ce=new Set($.ids),me=Q.map((z,pe)=>ce.has(z.modelId)?pe:-1).filter(z=>z>=0);if(!me.length)return!1;const he=Math.min(...me),ve=Q.filter(z=>!ce.has(z.modelId)),D=Q.slice(0,he).filter(z=>!ce.has(z.modelId)).length;let v;if(k<0){if(D<=0)return!0;v=D-1}else{if(ve.length-D<=0)return!0;v=D+1}const w=Q.filter(z=>ce.has(z.modelId)).map(z=>z.modelId);return V(wa($.entityId,w,v)),!0},deleteSelection(){if(!te.value)return!1;const k=S.value;if(!k)return!1;if(k.kind==="attribute"){const $=k.ids;if(!$.length)return!1;$.length===1?V(Pt(k.entityId,$[0])):V(Le("속성 삭제",$.map(L=>Pt(k.entityId,L))))}else k.kind==="entity"?V(ga(k.id)):k.kind==="note"?V(Na(k.id)):k.kind==="group"?V(va(k.id)):V(ka(k.id));return S.value=null,!0},nudgeNodes(k,$,L){if(!k.length||$===0&&L===0)return!1;const Q=new Set(o.logical.entities.map(v=>v.modelId)),ce=new Set(o.logical.groups.map(v=>v.modelId)),me=new Set(o.layout.notes.map(v=>v.modelId)),he=new Set;for(const v of k){if(!ce.has(v))continue;const w=o.logical.groups.find(z=>z.modelId===v);for(const z of(w==null?void 0:w.memberEntityRefs)??[])he.add(z)}const ve=[],D=[];for(const v of k)if(ce.has(v)){const w=o.layout.groupLayouts.find(Z=>Z.groupRef===v);if(!w)continue;const z=o.logical.groups.find(Z=>Z.modelId===v),pe=((z==null?void 0:z.memberEntityRefs)??[]).map(Z=>{var de;const W=((de=o.layout.entityLayouts.find(Ne=>Ne.entityRef===Z))==null?void 0:de.geo.location)??{x:0,y:0};return{id:Z,location:{x:W.x+$,y:W.y+L}}}),J={x:w.geo.location.x+$,y:w.geo.location.y+L};ve.push(Le("그룹 이동",O(v,J,pe))),D.push("g:"+v)}else if(Q.has(v)){if(he.has(v))continue;const w=o.layout.entityLayouts.find(z=>z.entityRef===v);if(!w)continue;ve.push(Nn(v,{x:w.geo.location.x+$,y:w.geo.location.y+L})),D.push("e:"+v)}else if(me.has(v)){const w=o.layout.notes.find(z=>z.modelId===v);if(!w)continue;ve.push(Jn(v,{x:w.geo.location.x+$,y:w.geo.location.y+L})),D.push("n:"+v)}return ve.length?(V(Le("이동",ve,"nudge:"+D.sort().join(","))),!0):!1},requestFocus(k){X.value={id:k,nonce:++A}},undo:()=>{te.value&&i.undo()},redo:()=>{te.value&&i.redo()},markSaved:()=>{te.value&&(re==null||re.flush(),i.markSavePoint())},loadDiagram(k,$){be(),o.logical=k.logical,o.layout=k.layout,i=new ha(o),_e(),_.value=($==null?void 0:$.schemaVersion)??1,N.value=($==null?void 0:$.opWriteEnabled)??!1,te.value=!(_.value>=2&&N.value===!1),ge=$,se.value=null,S.value=null,m.value=i.canUndo,p.value=i.canRedo,g.value=i.isDirty,$e()},flush(){re==null||re.flush()},whenOpsSettled(){return(re==null?void 0:re.whenSettled())??Promise.resolve()},addEntity(k="NewEntity",$={x:80,y:80}){const L=Te(),Q={modelId:L,name:k,stereotype:"JPA_ENTITY",table:{physicalName:k.toLowerCase()},attributes:[{modelId:Te(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Te(),physicalName:"id",dataType:"BIGINT"}]}]};return V(ya(Q,{location:{...$},size:{width:220,height:140}})),L},renameEntity(k,$){V(sr(k,$))},updateEntity(k,$){const L=rr(k,$),Q=o.logical.entities.find(he=>he.modelId===k),ce=$.stereotype==="JPA_EMBEDDABLE"&&!!Q&&Q.stereotype!=="JPA_EMBEDDABLE",me=!!$.stereotype&&$.stereotype!=="JPA_EMBEDDABLE"&&!!Q&&Q.stereotype==="JPA_EMBEDDABLE";if(ce&&Q){const he=Q.attributes.filter(z=>z.identifier&&!z.derivedFrom).map(z=>nn(k,z.modelId,{identifier:!1})),ve=On({...o.logical,entities:o.logical.entities.map(z=>z.modelId===k?{...z,stereotype:"JPA_EMBEDDABLE"}:z)},k,z=>z.map(pe=>pe.identifier&&!pe.derivedFrom?{...pe,identifier:!1}:pe)),D=pl(ve,k),v=D_(o.logical,k),w=[L,...he,...D,...v];V(w.length>1?Le("임베더블 변환",w):L);return}if(me){const he=B_(o.logical,k),ve=[L,...he];V(ve.length>1?Le("엔터티 전환",ve):L);return}V(L)},moveEntity(k,$){V(Nn(k,$))},resizeEntity(k,$){V(cr(k,$))},removeEntity(k){V(ga(k))},setEntitySwatch(k,$){V(dr(k,$))},setEntityCollapsed(k,$){V(ur(k,$))},collapseAll(){V(ba(!0))},expandAll(){V(ba(!1))},setAttributeSwatch(k,$,L){V(zo(k,$,L))},dragGroup(k,$,L){V(Le("그룹 이동",O(k,$,L)))},resizeGroup(k,$){V(hr(k,$))},setGroupSwatch(k,$){V(yr(k,$))},updateGroup(k,$){V(fr(k,$))},createGroup(k,$){if(!k.length)return null;const L=[];for(const me of o.logical.groups)for(const he of k)me.memberEntityRefs.includes(he)&&L.push(Uo(me.modelId,he));const Q=Te(),ce={modelId:Q,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...k]};return L.push(_a(ce,R(k))),V(Le("그룹 생성",L)),S.value=null,Q},addEmptyGroup(k,$){const L=Te();return V(_a({modelId:L,name:$?{ko:$}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...k},size:{width:360,height:260}})),L},removeGroup(k){V(va(k))},dropEntity(k,$,L){var me;const Q=((me=o.logical.groups.find(he=>he.memberEntityRefs.includes(k)))==null?void 0:me.modelId)??null,ce=[Nn(k,$)];Q!==L&&(Q&&ce.push(Uo(Q,k)),L&&ce.push(mr(L,k))),V(Le("이동",ce))},ungroupEntity(k){const $=o.logical.groups.find(L=>L.memberEntityRefs.includes(k));$&&V(Uo($.modelId,k))},dropNote(k,$,L){var me;const Q=((me=o.layout.groupLayouts.find(he=>{var ve;return(ve=he.memberNoteRefs)==null?void 0:ve.includes(k)}))==null?void 0:me.groupRef)??null,ce=[Jn(k,$)];Q!==L&&(Q&&ce.push(Br(Q,k)),L&&ce.push(Mr(L,k))),V(Le("이동",ce))},addPredefinedEmbed(k,$){const L=a.value.find(D=>D.type===$),Q=o.logical.entities.find(D=>D.modelId===k);if(!L||!Q)return;const ce=Q.attributes.reduce((D,v)=>Math.max(D,v.order),-1)+1,me=Te(),he=L.fields.map(()=>({modelId:Te(),physicalName:"",dataType:""})),ve={modelId:me,name:L.defaultName,type:L.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:ce,dbAttrs:he};return V(xt(k,ve)),me},addAttribute(k,$={}){const L=o.logical.entities.find(w=>w.modelId===k),Q=L?L.attributes.length:0,ce=$.modelId??Te(),me=$.name??`field${Q}`,he={modelId:ce,name:me,type:$.type??sa,attrType:$.attrType??"NORMAL",identifier:$.identifier??!1,notNull:$.notNull??!1,order:Q,dbAttrs:$.dbAttrs??[{modelId:Te(),physicalName:me,dataType:"VARCHAR",length:255}],...$},ve=xt(k,he),D=On(o.logical,k,w=>[...w,he]),v=Ln(D,k);return V(v.length?Le("속성 추가",[ve,...v]):ve),ce},addDivider(k){const $=o.logical.entities.find(me=>me.modelId===k),L=$?$.attributes.length:0,Q=Te();return V(xt(k,{modelId:Q,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:L,dbAttrs:[]})),Q},updateAttribute(k,$,L){C(k,$,L)},setAttributeGroupCode(k,$,L){C(k,$,{groupCode:L,type:L?Wn:sa})},setEmbedColumns(k,$,L){var D,v;const Q=nn(k,$,{dbAttrs:L}),ce=(D=o.logical.entities.find(w=>w.modelId===k))==null?void 0:D.attributes.find(w=>w.modelId===$),me=(v=ce==null?void 0:ce.embedded)==null?void 0:v.associationRef,he=me?o.logical.associations.find(w=>w.modelId===me):void 0,ve=[];he&&me&&(he.end1.legacyEmbedRaw&&ve.push(In(me,"end1",{legacyEmbedRaw:void 0})),he.end2.legacyEmbedRaw&&ve.push(In(me,"end2",{legacyEmbedRaw:void 0}))),V(ve.length?Le("임베드 컬럼 수정",[Q,...ve]):Q)},removeAttribute(k,$){const L=Pt(k,$),Q=On(o.logical,k,me=>me.filter(he=>he.modelId!==$)),ce=Ln(Q,k);V(ce.length?Le("속성 삭제",[L,...ce]):L)},removeAttributes(k,$){var he;if(!$.length)return;const L=$.map(ve=>Pt(k,ve)),Q=new Set($),ce=On(o.logical,k,ve=>ve.filter(D=>!Q.has(D.modelId))),me=[...L,...Ln(ce,k)];V(me.length===1?me[0]:Le("속성 삭제",me)),((he=S.value)==null?void 0:he.kind)==="attribute"&&S.value.entityId===k&&(S.value=null)},setAttributeSwatches(k,$,L){$.length&&($.length===1?V(zo(k,$[0],L)):V(Le("속성 색상",$.map(Q=>zo(k,Q,L)))))},reorderAttributes(k,$,L){$.length&&V(wa(k,$,L))},addIndex(k,$){V(Er(k,$))},updateIndex(k,$,L){V(kr(k,$,L))},removeIndex(k,$){V(Nr(k,$))},addOperation(k,$={}){var he;const L=o.logical.entities.find(ve=>ve.modelId===k),Q=((he=L==null?void 0:L.operations)==null?void 0:he.length)??0,ce=$.modelId??Te(),me={modelId:ce,name:$.name??`method${Q}`,visibility:$.visibility??"PACKAGE",order:Q,...$};return V(gr(k,me)),ce},updateOperation(k,$,L){V(br(k,$,L))},removeOperation(k,$){V(_r(k,$))},reorderOperations(k,$,L){$.length&&V(vr(k,$,L))},setOperationSwatch(k,$,L){V(wr(k,$,L))},addAssociation(k,$,L,Q){const ce=Te(),me={modelId:ce,end1:{entityRef:k,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:L},end2:{entityRef:$,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},he={...o.logical,associations:[...o.logical.associations,me]},ve=Ci(he,$,Te),D=ve.add[0];D&&(me.end2.attributeRef=D.modelId);const v={associationRef:ce,waypoints:[],sourceColumnRef:L,targetColumnRef:(D==null?void 0:D.modelId)??Q},w=Ea(me,v),z=Ri($,ve);return V(z.length?Le("관계 추가",[w,...z]):w),ce},addEmbedAssociation(k,$){const L=o.logical.entities.find(de=>de.modelId===k),Q=o.logical.entities.find(de=>de.modelId===$);if(!L||!Q||Q.stereotype!=="JPA_EMBEDDABLE")return;const ce=Te(),me=Te(),he=Te(),ve=L.attributes.reduce((de,Ne)=>Math.max(de,Ne.order),-1)+1,D=hd(Q),v=de=>de&&de.charAt(0).toLowerCase()+de.slice(1),w=new Set(L.attributes.map(de=>de.name)),z=v(Q.name);let pe=z;for(let de=2;w.has(pe);de++)pe=`${z}${de}`;const J={modelId:me,name:pe,type:Q.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:ve,dbAttrs:D,embedded:{associationRef:ce,embeddableRef:$}},Z={modelId:ce,end1:{entityRef:k,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:he},end2:{entityRef:$,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:me}},W={associationRef:ce,waypoints:[],sourceColumnRef:me,targetColumnRef:void 0};return V(Le("임베드 추가",[xt(k,J),Ea(Z,W)])),ce},setEmbedCollectionMode(k,$){const L=o.logical.associations.find(v=>v.modelId===k);if(!L)return;let Q,ce;for(const v of o.logical.entities){const w=v.attributes.find(z=>{var pe;return((pe=z.embedded)==null?void 0:pe.associationRef)===k&&z.attrType==="EMBED_OWN"});if(w){Q=v.modelId,ce=w;break}}if(!Q||!ce)return;const me=ce.embedded.embeddableRef,he=L.end2.entityRef===me?"end2":"end1",ve=L[he],D=ve.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!($==="COLLECTION"?D:!D))if($==="COLLECTION")V(Le("임베드 컬렉션 전환",[nn(Q,ce.modelId,{dbAttrs:[]}),In(k,he,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...ve.jpa,collectionType:"LIST"}})]));else{const v=o.logical.entities.find(w=>w.modelId===me);if(!v)return;V(Le("임베드 단일 전환",[nn(Q,ce.modelId,{dbAttrs:hd(v)}),In(k,he,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...ve.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(k){const $=o.logical.associations.find(he=>he.modelId===k),L=ka(k);if(!$){V(L);return}for(const he of o.logical.entities){const ve=he.attributes.find(D=>{var v;return((v=D.embedded)==null?void 0:v.associationRef)===k});if(ve){V(Le("임베드 삭제",[L,Pt(he.modelId,ve.modelId)]));return}}const Q=$.end2.entityRef,ce={...o.logical,associations:o.logical.associations.filter(he=>he.modelId!==k)},me=pl(ce,Q);V(me.length?Le("관계 삭제",[L,...me]):L)},setAssociationIdentifying(k,$){const L=o.logical.associations.find(ve=>ve.modelId===k),Q=Ho(k,{identifying:$});if(!L||L.identifying===$){V(Q);return}const ce=L.end2.entityRef,me={...o.logical,associations:o.logical.associations.map(ve=>ve.modelId===k?{...ve,identifying:$}:ve)},he=pl(me,ce);V(he.length?Le("식별 관계 변경",[Q,...he]):Q)},updateAssociationEnd(k,$,L){V(In(k,$,L))},moveWaypoint(k,$,L){V(Ir(k,$,L))},addWaypoint(k,$,L){V(Cr(k,$,L))},removeWaypoint(k,$){V($r(k,$))},clearWaypoints(k){V(Sr(k))},addNote(k="메모",$={x:80,y:80}){const L=Te();return V(Rr({modelId:L,memo:k,geo:{location:{...$},size:{width:200,height:120}}})),L},removeNote(k){V(Na(k))},moveNote(k,$){V(Jn(k,$))},resizeNote(k,$){V(Vr(k,$))},setNoteMemo(k,$){V(Ar(k,$))},setNoteSwatch(k,$){V(Tr(k,$))},addNoteConnection(k,$){V(Dr(k,$))},removeNoteConnection(k,$){V(Or(k,$))},moveNoteConnectionWaypoint(k,$,L,Q){V(Lr(k,$,L,Q))},addNoteConnectionWaypoint(k,$,L,Q){V(Pr(k,$,L,Q))},removeNoteConnectionWaypoint(k,$,L){V(zr(k,$,L))},clearNoteConnectionWaypoints(k,$){V(Ur(k,$))},autoLayout(){const k=Fl(o.logical,o.layout);k.length&&V(Le("자동 배치",k.map($=>Nn($.id,$.location))))},copy(){const k=S.value;if((k==null?void 0:k.kind)==="attribute"){const me=o.logical.entities.find(ve=>ve.modelId===k.entityId);if(!me)return;const he=[...me.attributes].sort((ve,D)=>ve.order-D.order).filter(ve=>k.ids.includes(ve.modelId));if(!he.length)return;ae.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:he}));return}const $=G.value;if(!$)return;const L=o.logical.entities.find(me=>me.modelId===$),Q=o.layout.entityLayouts.find(me=>me.entityRef===$);if(!L)return;const ce=(Q==null?void 0:Q.geo)??{location:{x:80,y:80},size:{width:220,height:140}};ae.value=JSON.parse(JSON.stringify({kind:"entity",entity:L,geo:ce}))},paste(){if(!te.value)return;const k=ae.value;if(!k)return;if(k.kind==="attribute"){const Q=G.value;if(!Q)return;const ce=o.logical.entities.find(w=>w.modelId===Q);if(!ce)return;const me=new Set(ce.attributes.map(w=>w.name)),he=new Set(ce.attributes.flatMap(w=>w.dbAttrs.map(z=>z.physicalName))),ve=ce.attributes.length,D=[],v=k.attributes.map((w,z)=>{const pe=JSON.parse(JSON.stringify(w));pe.modelId=Te();for(const J of pe.dbAttrs)J.modelId=Te();me.has(pe.name)&&(pe.name=`${pe.name}_copy`);for(const J of pe.dbAttrs)J.physicalName&&he.has(J.physicalName)&&(J.physicalName=`${J.physicalName}_copy`);return pe.order=ve+z,D.push(pe.modelId),xt(Q,pe)});V(v.length===1?v[0]:Le("속성 붙여넣기",v)),S.value={kind:"attribute",entityId:Q,ids:D,anchor:D[D.length-1]};return}const $=M_(k.entity),L={location:{x:k.geo.location.x+40,y:k.geo.location.y+40},size:{...k.geo.size}};V(ya($,L)),S.value={kind:"entity",id:$.modelId}}}}const Vi=Symbol("groupHover"),yd=Symbol("groupDrag"),Pn=Symbol("relationHighlight"),L_={key:0,class:"em-sel","aria-hidden":"true"},P_=["title","aria-expanded","disabled"],z_={class:"em-entity__stereotype"},U_={key:1,class:"em-entity__name"},H_=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],F_=["onPointerdown"],G_={key:1,class:"em-entity__divider-label"},Y_=["title"],W_={class:"em-key-slot"},K_={class:"em-key-slot"},q_={key:0,class:"em-entity__type"},X_=["onClick"],j_={class:"em-entity__attrname"},Z_={class:"em-entity__type"},J_=["data-op"],Q_=["onPointerdown"],ev={class:"em-entity__op-vis","aria-hidden":"true"},tv=["title"],nv={key:4,class:"em-entity__footer"},gd=De(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(yn,null),i=le.useModal();function a(){o&&xi(i,o,t.id)}const l=n.inject(Vi,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)),h=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var J;return((J=o==null?void 0:o.selection.value)==null?void 0:J.kind)==="entity"&&o.selection.value.id===t.id}),p=n.computed(()=>!!t.selected&&!m.value),g=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),b=n.computed(()=>g.value.size>0);function _(J,Z){const W=Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,W)}const N=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),y=n.computed(()=>t.data.entity),x=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),q=n.computed(()=>t.data.collapsed??!1);function P(){s.value&&(o==null||o.setEntityCollapsed(t.id,!q.value))}const K=n.computed(()=>x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL"),T=n.computed(()=>{const J=x.value==="PHYSICAL"||x.value==="LOGICAL_PHYSICAL",Z={};for(const W of y.value.attributes){const de=W.attrType.startsWith("RELATION")&&W.dbAttrs.length>0;Z[W.modelId]={pk:W.identifier,fk:de&&J,required:W.notNull&&!W.identifier}}return Z});function ie(J){if(!J)return"";const Z=[];return J.pk&&J.fk?Z.push("PFK (식별 외래키)"):J.pk?Z.push("PK (기본키)"):J.fk&&Z.push("FK (외래키)"),J.required&&Z.push("필수 (NOT NULL)"),Z.join(" · ")}const te=n.computed(()=>{const J=ul(Xe(t.data.style)),Z={};return J&&(Z["--em-header-bg"]=J.bar,Z["--em-header-fg"]=J.barOn),Z});function fe(J){var Z,W;return(W=ul(Xe((Z=t.data.attributeStyles)==null?void 0:Z[J.modelId])))==null?void 0:W.text}const M=n.computed(()=>[...y.value.operations??[]].sort((J,Z)=>J.order-Z.order)),ne=n.computed(()=>x.value==="CLASS"&&M.value.length>0),E={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function S(J){return J?E[J]:"~"}function I(J){var Z,W;return(W=ul(Xe((Z=t.data.operationStyles)==null?void 0:Z[J.modelId])))==null?void 0:W.text}function B(J,Z,W){switch(x.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:W||J}];case"LOGICAL":return[Z?{text:Z}:{text:"(논리명)",missing:!0}];default:{const de=Z?{text:Z}:{text:"(논리명)",missing:!0};return W?[de,{text:` · ${W}`}]:[de]}}}function G(J){var Z,W,de;return X(J)?[{text:J.name}]:B(J.name,(W=(Z=J.dbAttrs[0])==null?void 0:Z.logicalName)==null?void 0:W.ko,((de=J.dbAttrs[0])==null?void 0:de.physicalName)??"")}function X(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function A(J){return J.attrType==="DIVIDER"}function ae(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const Z=o==null?void 0:o.embeddableCatalog.value.find(de=>de.type===J.type);if(!Z)return J.dbAttrs;const W=Kn(y.value.attributes.flatMap(de=>de.dbAttrs));return J.dbAttrs.map((de,Ne)=>{const xe=Z.fields[Ne],H=Do(de,W);return H?{...de,physicalName:H.physicalName,logicalName:de.logicalName??(xe==null?void 0:xe.logicalName),dataType:de.dataType||(xe==null?void 0:xe.dataType)||""}:xe?{...de,physicalName:de.physicalName||xe.physicalName,logicalName:de.logicalName??xe.logicalName,dataType:de.dataType||xe.dataType,length:de.length??xe.length}:de})}function se(J){var Z;return B(J.physicalName,(Z=J.logicalName)==null?void 0:Z.ko,J.physicalName)}function ge(J){const Z=Ql(J,(o==null?void 0:o.state.logical.associations)??[]);return da(x.value,J,Z)}const _e=n.computed(()=>{var J,Z,W;return B(y.value.name,(Z=(J=y.value.table)==null?void 0:J.logicalName)==null?void 0:Z.ko,((W=y.value.table)==null?void 0:W.physicalName)??"")}),re=n.ref(!1),ye=n.ref(""),be=n.ref(null);async function $e(){var J,Z;s.value&&(ye.value=y.value.name,re.value=!0,await n.nextTick(),(J=be.value)==null||J.focus(),(Z=be.value)==null||Z.select())}function Se(){if(!re.value)return;re.value=!1;const J=ye.value.trim();J&&J!==y.value.name&&(o==null||o.renameEntity(t.id,J))}function Ce(){o==null||o.addAttribute(t.id)}function Y(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:U,findNode:V}=Me(),C=n.ref(null),R=n.computed(()=>{const J=C.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let O=null;function oe(J){var de,Ne,xe;if(!s.value)return;J.stopPropagation();const Z=(de=V(t.id))==null?void 0:de.dimensions,W=U({x:J.clientX,y:J.clientY});O={fx:W.x,fy:W.y,w:(Z==null?void 0:Z.width)??((Ne=t.data.size)==null?void 0:Ne.width)??200,h:(Z==null?void 0:Z.height)??((xe=t.data.size)==null?void 0:xe.height)??120},J.target.setPointerCapture(J.pointerId)}function j(J){if(!O)return;const Z=U({x:J.clientX,y:J.clientY});C.value={width:Math.max(40,O.w+(Z.x-O.fx)),height:Math.max(40,O.h+(Z.y-O.fy))}}function k(J){var Z,W,de;if(O&&C.value&&o){const Ne=(Z=V(t.id))==null?void 0:Z.dimensions;o.resizeEntity(t.id,{width:Math.round((Ne==null?void 0:Ne.width)??C.value.width),height:Math.round((Ne==null?void 0:Ne.height)??C.value.height)})}O=null,C.value=null,(de=(W=J.target).releasePointerCapture)==null||de.call(W,J.pointerId)}const $=n.ref(null),L=n.ref(null);function Q(J,Z){if(!s.value)return;Z.stopPropagation(),Z.preventDefault();const W=g.value,de=W.has(J.modelId)?new Set(W):new Set([J.modelId]);L.value={ids:de,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId)}function ce(J){if(!L.value||!$.value)return;const Z=Array.from($.value.querySelectorAll(".em-entity__row"));if(!Z.length)return;let W=Z.length;for(let xe=0;xe<Z.length;xe++){const H=Z[xe].getBoundingClientRect();if(J.clientY<H.top+H.height/2){W=xe;break}}const de=Z[Z.length-1],Ne=W<Z.length?Z[W].offsetTop:de.offsetTop+de.offsetHeight;L.value={...L.value,dropIndex:W,lineY:Ne}}function me(){const J=L.value;if(L.value=null,!J||J.dropIndex<0)return;const Z=y.value.attributes,W=Z.filter(ee=>J.ids.has(ee.modelId)).map(ee=>ee.modelId),de=Z.filter((ee,F)=>J.ids.has(ee.modelId)&&F<J.dropIndex).length,Ne=J.dropIndex-de,xe=Z.filter(ee=>!J.ids.has(ee.modelId)).map(ee=>ee.modelId);[...xe.slice(0,Ne),...W,...xe.slice(Ne)].join(",")!==Z.map(ee=>ee.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,W,Ne))}function he(){L.value=null}const ve=n.ref(null),D=n.ref(null);function v(J,Z){s.value&&(Z.stopPropagation(),Z.preventDefault(),D.value={id:J.modelId,dropIndex:-1,lineY:0},Z.target.setPointerCapture(Z.pointerId))}function w(J){if(!D.value||!ve.value)return;const Z=Array.from(ve.value.querySelectorAll(".em-entity__op-row"));if(!Z.length)return;let W=Z.length;for(let xe=0;xe<Z.length;xe++){const H=Z[xe].getBoundingClientRect();if(J.clientY<H.top+H.height/2){W=xe;break}}const de=Z[Z.length-1],Ne=W<Z.length?Z[W].offsetTop:de.offsetTop+de.offsetHeight;D.value={...D.value,dropIndex:W,lineY:Ne}}function z(){const J=D.value;if(D.value=null,!J||J.dropIndex<0)return;const W=M.value.findIndex(Ne=>Ne.modelId===J.id);if(W<0)return;const de=J.dropIndex-(W<J.dropIndex?1:0);de!==W&&(o==null||o.reorderOperations(t.id,[J.id],de))}function pe(){D.value=null}return(J,Z)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":h.value,"is-dimmed":N.value,"is-selected":m.value,"is-multi-selected":p.value,"has-focused-attr":b.value}]),style:n.normalizeStyle(R.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:a},[m.value?(n.openBlock(),n.createElementBlock("div",L_,[...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(te.value),onDblclick:n.withModifiers($e,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:q.value?"펼치기":"접기","aria-expanded":!q.value,disabled:!s.value,onClick:n.withModifiers(P,["stop"]),onPointerdown:Z[0]||(Z[0]=n.withModifiers(()=>{},["stop"])),onDblclick:Z[1]||(Z[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(q.value?"▸":"▾"),41,P_),n.createElementVNode("span",z_,"«"+n.toDisplayString(y.value.stereotype)+"»",1),re.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:be,"onUpdate:modelValue":Z[2]||(Z[2]=W=>ye.value=W),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(Se,["enter"]),Z[3]||(Z[3]=n.withKeys(W=>re.value=!1,["esc"]))],onBlur:Se,onPointerdown:Z[4]||(Z[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,ye.value]]):(n.openBlock(),n.createElementBlock("span",U_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_e.value,(W,de)=>(n.openBlock(),n.createElementBlock("span",{key:de,class:n.normalizeClass({"em-entity__missing":W.missing})},n.toDisplayString(W.text),3))),128))]))],36),q.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$,class:"em-entity__attrs"},[L.value&&L.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${L.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value.attributes,W=>{var de,Ne,xe,H;return n.openBlock(),n.createElementBlock(n.Fragment,{key:W.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has(W.modelId),"is-dragging":(de=L.value)==null?void 0:de.ids.has(W.modelId),"is-embed":X(W),"is-divider":A(W),nodrag:A(W)&&s.value}]),"data-attr":W.modelId,onClick:n.withModifiers(ee=>_(W,ee),["stop"]),onPointerdown:ee=>A(W)?Q(W,ee):void 0,onPointermove:ee=>A(W)?ce(ee):void 0,onPointerup:ee=>A(W)?me():void 0,onPointercancel:ee=>A(W)?he():void 0},[s.value&&!A(W)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ee=>Q(W,ee),onPointermove:ce,onPointerup:me,onPointercancel:he,onClick:Z[5]||(Z[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,F_)):n.createCommentVNode("",!0),A(W)?(n.openBlock(),n.createElementBlock("span",G_,n.toDisplayString(W.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(fn),{id:`l:${W.modelId}`,type:"target",position:n.unref(Ie).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ie(T.value[W.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",W_,[(Ne=T.value[W.modelId])!=null&&Ne.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(xe=T.value[W.modelId])!=null&&xe.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",K_,[X(W)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(H=T.value[W.modelId])!=null&&H.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Y_),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:fe(W)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(G(W),(ee,F)=>(n.openBlock(),n.createElementBlock("span",{key:F,class:n.normalizeClass({"em-entity__missing":ee.missing})},n.toDisplayString(ee.text),3))),128))],4),ge(W)?(n.openBlock(),n.createElementBlock("span",q_,n.toDisplayString(ge(W)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(fn),{id:`r:${W.modelId}`,type:"source",position:n.unref(Ie).Right,class:"em-handle"},null,8,["id","position"])],64))],42,H_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(X(W)&&K.value?ae(W):[],ee=>(n.openBlock(),n.createElementBlock("li",{key:`${W.modelId}:${ee.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has(W.modelId)}]),onClick:n.withModifiers(F=>_(W,F),["stop"])},[Z[8]||(Z[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",j_,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se(ee),(F,ue)=>(n.openBlock(),n.createElementBlock("span",{key:ue,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))]),n.createElementVNode("span",Z_,n.toDisplayString(ee.dataType),1)],10,X_))),128))],64)}),128))],512)),!q.value&&ne.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:ve,class:"em-entity__ops"},[D.value&&D.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${D.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(M.value,W=>{var de;return n.openBlock(),n.createElementBlock("li",{key:W.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((de=D.value)==null?void 0:de.id)===W.modelId}]),"data-op":W.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ne=>v(W,Ne),onPointermove:w,onPointerup:z,onPointercancel:pe,onClick:Z[6]||(Z[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Q_)):n.createCommentVNode("",!0),n.createElementVNode("span",ev,n.toDisplayString(S(W.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:I(W)})},n.toDisplayString(W.name)+"()",5)],10,J_)}),128))],512)):M.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${M.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(M.value.length)+"개",1)],8,tv)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",nv,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:Ce},"+ 속성"),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:Y},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!re.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:oe,onPointermove:j,onPointerup:k},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3eac9bf0"]]),ov={key:0,class:"em-sel","aria-hidden":"true"},iv={class:"em-group__label"},av={class:"em-group__name"},lv={key:0,class:"em-group__pkg"},rv={key:1,class:"em-group__flag"},bd=De(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>Xe(t.data.style)),a=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),l=n.inject(yn,null),r=n.computed(()=>!!l&&l.editable.value),s=n.computed(()=>{var T;return!!t.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===t.id}),c=n.computed(()=>!!t.selected&&!s.value),d=n.inject(Vi,null),u=n.computed(()=>!!t.id&&(d==null?void 0:d.value)===t.id),f=n.inject(Pn,null);function h(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const p=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),g=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:b,findNode:_}=Me();let N=null,y=null;function x(T){var fe;if(!t.id||!r.value)return;T.stopPropagation();const ie=((fe=_(t.id))==null?void 0:fe.dimensions)??{width:400,height:300},te=b({x:T.clientX,y:T.clientY});N={fx:te.x,fy:te.y,w:ie.width,h:ie.height},T.target.setPointerCapture(T.pointerId)}function q(T){if(!N||!t.id)return;const ie=b({x:T.clientX,y:T.clientY});y={width:Math.max(160,N.w+(ie.x-N.fx)),height:Math.max(120,N.h+(ie.y-N.fy))};const te=_(t.id);te&&(te.style={width:`${y.width}px`,height:`${y.height}px`})}function P(T){var ie,te;N&&y&&t.id&&l&&l.resizeGroup(t.id,y),N=null,y=null,(te=(ie=T.target).releasePointerCapture)==null||te.call(ie,T.pointerId)}const K=n.computed(()=>{const T=o.value.name;return(T==null?void 0:T.ko)||(T==null?void 0:T.en)||(T==null?void 0:T.ja)||(T==null?void 0:T.zh)||o.value.packageName||"그룹"});return(T,ie)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":p.value,"is-dimmed":g.value,"is-selected":s.value,"is-multi-selected":c.value}]),style:n.normalizeStyle(a.value),onMouseenter:h,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",ov,[...ie[0]||(ie[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",iv,[n.createElementVNode("span",av,n.toDisplayString(K.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",lv,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",rv,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:x,onPointermove:q,onPointerup:P},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),sv={key:0,class:"em-sel","aria-hidden":"true"},cv={key:2,class:"em-note__text"},_d=De(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(yn,null),i=n.inject(Vi,null),a=n.inject(Pn,null),l=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>Xe(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 E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===t.id}),m=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!h.value),p=n.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===t.id}),g=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:Ie.Top},{id:"n-right",pos:Ie.Right},{id:"n-bottom",pos:Ie.Bottom},{id:"n-left",pos:Ie.Left}],N=n.ref(!1),y=n.ref(""),x=n.ref(null);async function q(){var E;r.value&&(y.value=l.value.memo,N.value=!0,await n.nextTick(),(E=x.value)==null||E.focus())}function P(){N.value&&(N.value=!1,y.value!==l.value.memo&&(o==null||o.setNoteMemo(t.id,y.value)))}const{screenToFlowCoordinate:K,findNode:T}=Me();let ie=null,te=null;function fe(E){var B;if(!r.value)return;E.stopPropagation();const S=((B=T(t.id))==null?void 0:B.dimensions)??l.value.geo.size,I=K({x:E.clientX,y:E.clientY});ie={fx:I.x,fy:I.y,w:S.width,h:S.height},E.target.setPointerCapture(E.pointerId)}function M(E){if(!ie)return;const S=K({x:E.clientX,y:E.clientY});te={width:Math.max(140,ie.w+(S.x-ie.fx)),height:Math.max(60,ie.h+(S.y-ie.fy))};const I=T(t.id);I&&(I.style={width:`${te.width}px`,height:`${te.height}px`})}function ne(E){var S,I;ie&&te&&o&&o.resizeNote(t.id,te),ie=null,te=null,(I=(S=E.target).releasePointerCapture)==null||I.call(S,E.pointerId)}return(E,S)=>(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":g.value}]),style:n.normalizeStyle(c.value),onDblclick:q,onPointerdown:d,onMouseenter:u,onMouseleave:f},[p.value?(n.openBlock(),n.createElementBlock("div",sv,[...S[4]||(S[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:x,"onUpdate:modelValue":S[0]||(S[0]=I=>y.value=I),class:"em-note__edit nodrag",onBlur:P,onKeydown:S[1]||(S[1]=n.withKeys(I=>N.value=!1,["esc"])),onPointerdown:S[2]||(S[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,y.value]]):(n.openBlock(),n.createElementBlock("div",cv,n.toDisplayString(l.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,I=>n.createVNode(n.unref(fn),{id:I.id,key:I.id,type:"source",position:I.pos,class:"em-note-handle",onPointerdown:S[3]||(S[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:fe,onPointermove:M,onPointerup:ne},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),dv=20,uv=22,fv=7,mv=22,vd=31,wd=7,pv=20,Ed=11,kd=11,hv=vd+wd;function yv(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function gv(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ai(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 Nd(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Ti(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Id(e,t,o,i){const a=i/2,l=e.x===t.x&&e.y===t.y?Math.PI/2:Nd(e,t);return[Ti(o,a,l-Math.PI/2),Ti(o,a,l+Math.PI/2)]}function $d(e,t,o,i){const a=t*180/Math.PI,r=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function xd(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=Ai(e,t,dv),[d,u]=Id(e,t,c,uv);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}),yv(o.multiplicity)){const f=Ai(e,t,vd);l.push({cx:f.x,cy:f.y,r:wd})}if(gv(o.multiplicity)){const f=Ai(e,t,fv),[h,m]=Id(e,t,f,mv);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=Ai(e,t,pv),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Nd(e,t),f=Ti(d,Ed/2,u-Math.PI/2),h=Ti(d,Ed/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=$d(s,c,kd,!0),u=$d(s,c,kd,!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 Sd=200,Cd=120,hl=24;function Rd(e){var a,l;if(!e)return{x:0,y:0,width:Sd,height:Cd};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Sd,i=((l=e.dimensions)==null?void 0:l.height)||Cd;return{x:t.x,y:t.y,width:o,height:i}}function Vd(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ad(e){const t=n.computed(()=>Rd(e.sourceNode())),o=n.computed(()=>Rd(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)<hl){const g=(f+h)/2;f=g-hl/2,h=g+hl/2}return{source:{x:u,y:f},target:{x:u,y:h}}}),l=n.computed(()=>e.waypoints()[0]??Vd(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??Vd(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ia(t.value,d,l.value.x):oa(t.value,l.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ia(o.value,d,r.value.x):oa(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"),bv=["d"],_v=["d"],vv=["d"],wv=["x1","y1","x2","y2"],Ev=["cx","cy","r"],kv=["x","y"],Nv=["x","y"],Iv=["cx","cy","onDblclick"],$v=["x","y","onPointerdown","onDblclick"],Td=De(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Me(),i=n.inject(yl),a=n.inject(yn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(yd,null),s=n.inject(Pn,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var Y;return((Y=a==null?void 0:a.selection.value)==null?void 0:Y.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 Y=r==null?void 0:r.value;if(!Y||!a)return null;const U=a.resolved.value.entities,V=R=>{var O;return(O=U.find(oe=>oe.entity.modelId===R))==null?void 0:O.groupRef},C=t.data.association;return V(C.end1.entityRef)===Y.groupId&&V(C.end2.entityRef)===Y.groupId?{dx:Y.dx,dy:Y.dy}:null}),h=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),p=n.ref({x:0,y:0}),g=n.computed(()=>{const Y=f.value;return h.value.map((U,V)=>V===m.value?p.value:Y?{x:U.x+Y.dx,y:U.y+Y.dy}:U)}),b=n.computed(()=>{var Y;return!!((Y=t.sourceNode.data)!=null&&Y.collapsed)}),_=n.computed(()=>{var Y;return!!((Y=t.targetNode.data)!=null&&Y.collapsed)}),{source:N,target:y,sourceSide:x,targetSide:q,isSelf:P}=Ad({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!b.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!_.value?t.targetY:void 0}),K=hv+4,T=n.computed(()=>P.value?Hl(N.value,y.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?ea(N.value,x.value,g.value,y.value,q.value,K):na(N.value,g.value,y.value)),ie=n.computed(()=>P.value||!l.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(N.value,x.value,g.value,y.value,q.value,K):aa(N.value,g.value,y.value).map((Y,U)=>({point:Y,segIndex:U}))),te=n.computed(()=>P.value||!l.value?[]:g.value);function fe(Y){switch(Y){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function M(Y,U){m.value=Y,p.value={...h.value[Y]},U.target.setPointerCapture(U.pointerId),U.stopPropagation()}function ne(Y){if(m.value<0)return;const U=o({x:Y.clientX,y:Y.clientY});p.value={x:U.x,y:U.y}}function E(Y){var U,V;m.value>=0&&i&&i.movePoint(t.id,m.value,{...p.value}),m.value=-1,(V=(U=Y.target).releasePointerCapture)==null||V.call(U,Y.pointerId)}function S(Y,U){U.stopPropagation(),i==null||i.removePoint(t.id,Y)}function I(Y,U){if(!i)return;const V=o({x:U.clientX,y:U.clientY});i.insertPoint(t.id,Y,{x:V.x,y:V.y})}const B=n.computed(()=>fe(t.data.association.end1.multiplicity)),G=n.computed(()=>fe(t.data.association.end2.multiplicity)),X=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),A=n.computed(()=>X.value==="class"),ae=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Y=Yn(x.value);return{x:N.value.x+Y.x*10,y:N.value.y+Y.y*10}}return g.value[0]??y.value}),se=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const U=Yn(q.value);return{x:y.value.x+U.x*10,y:y.value.y+U.y*10}}const Y=g.value;return Y[Y.length-1]??N.value}),ge=n.computed(()=>{const Y=t.data.association;return{multiplicity:Y.end1.multiplicity,navigable:Y.end1.navigable,composition:Y.end1.composition,otherNavigable:Y.end2.navigable}}),_e=n.computed(()=>{const Y=t.data.association;return{multiplicity:Y.end2.multiplicity,navigable:Y.end2.navigable,composition:Y.end2.composition,otherNavigable:Y.end1.navigable}}),re=n.computed(()=>xd(N.value,ae.value,ge.value,X.value)),ye=n.computed(()=>xd(y.value,se.value,_e.value,X.value)),be=n.computed(()=>[...re.value.lines,...ye.value.lines]),$e=n.computed(()=>[...re.value.circles,...ye.value.circles]),Se=n.computed(()=>[...re.value.polygons,...ye.value.polygons].map(Y=>`M${Y.points.map(U=>`${U.x},${U.y}`).join(" L")} Z`)),Ce=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(Y,U)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:T.value,fill:"none",class:"em-edge__hit"},null,8,bv),n.createElementVNode("path",{d:T.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,_v),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Se.value,(V,C)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${C}`,d:V,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ce.value])},null,10,vv))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(V,C)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${C}`,x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,class:n.normalizeClass(["em-edge__marker",Ce.value])},null,10,wv))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($e.value,(V,C)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${C}`,cx:V.cx,cy:V.cy,r:V.r,class:n.normalizeClass(["em-edge__marker",Ce.value])},null,10,Ev))),128)),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(B.value),11,kv),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(G.value),11,Nv)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ie.value,(V,C)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${C}`,cx:V.point.x,cy:V.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(R=>I(V.segIndex,R),["stop"])},null,42,Iv))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(te.value,(V,C)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${C}`,x:V.x-5,y:V.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:R=>M(C,R),onPointermove:ne,onPointerup:E,onDblclick:R=>S(C,R)},null,42,$v))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Tt=(e=>(e.Lines="lines",e.Dots="dots",e))(Tt||{});const Md=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]}`})},Bd=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Tt.Lines+"",Tt.Dots+"";const xv={[Tt.Dots]:"#81818a",[Tt.Lines]:"#eee"},Sv=["id","x","y","width","height","patternTransform"],Cv={key:2,height:"100",width:"100"},Rv=["fill"],Vv=["x","y","fill"],Av={name:"Background",compatConfig:{MODE:3}},Tv=n.defineComponent({...Av,props:{id:{},variant:{default:()=>Tt.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}=Me(),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||xv[e.variant||Tt.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(Tt).Lines?(n.openBlock(),n.createBlock(n.unref(Md),{key:0,size:r.lineWidth,color:l.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Tt).Dots?(n.openBlock(),n.createBlock(n.unref(Bd),{key:1,color:l.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",Cv,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,Rv)])):n.createCommentVNode("",!0)])],8,Sv)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Vv),n.renderSlot(r.$slots,"default",{id:a.value})],4))}}),Mv={name:"ControlButton",compatConfig:{MODE:3}},Bv=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Dv={type:"button",class:"vue-flow__controls-button"};function Ov(e,t,o,i,a,l){return n.openBlock(),n.createElementBlock("button",Dv,[n.renderSlot(e.$slots,"default")])}const Mi=Bv(Mv,[["render",Ov]]),Lv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Pv=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function zv(e,t){return n.openBlock(),n.createElementBlock("svg",Lv,Pv)}const Uv={render:zv},Hv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Fv=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Gv(e,t){return n.openBlock(),n.createElementBlock("svg",Hv,Fv)}const Yv={render:Gv},Wv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Kv=[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 qv(e,t){return n.openBlock(),n.createElementBlock("svg",Wv,Kv)}const Xv={render:qv},jv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Zv=[n.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 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 Jv(e,t){return n.openBlock(),n.createElementBlock("svg",jv,Zv)}const Qv={render:Jv},ew={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},tw=[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 nw(e,t){return n.openBlock(),n.createElementBlock("svg",ew,tw)}const ow={render:nw},iw={name:"Controls",compatConfig:{MODE:3}},aw=n.defineComponent({...iw,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>rc.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}=Me(),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 g(){r(),t("zoomIn")}function b(){s(),t("zoomOut")}function _(){c(e.fitViewParams),t("fitView")}function N(){l(!h.value),t("interactionChange",!h.value)}return(y,x)=>(n.openBlock(),n.createBlock(n.unref(ad),{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(Mi,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Uv))))])]),_:3},8,["disabled"])]),n.renderSlot(y.$slots,"control-zoom-out",{},()=>[n.createVNode(Mi,{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(Yv))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),y.showFitView?n.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Mi,{class:"vue-flow__controls-fitview",onClick:_},{default:n.withCtx(()=>[n.renderSlot(y.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Xv))))])]),_:3})]):n.createCommentVNode("",!0),y.showInteractive?n.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(n.openBlock(),n.createBlock(Mi,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[h.value?n.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(ow))))]):n.createCommentVNode("",!0),h.value?n.createCommentVNode("",!0):n.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(Qv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}});var lw={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 Bi(o)}function Bi(e){this._=e}function rw(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Bi.prototype=gl.prototype={constructor:Bi,on:function(e,t){var o=this._,i=rw(e+"",o),a,l=-1,r=i.length;if(arguments.length<2){for(;++l<r;)if((a=(e=i[l]).type)&&(a=sw(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]=Dd(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Dd(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Bi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,l;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,o)}};function sw(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Dd(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=lw,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 Od={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 Di(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Od.hasOwnProperty(t)?{space:Od[t],local:e}:e}function cw(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 dw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ld(e){var t=Di(e);return(t.local?dw:cw)(t)}function uw(){}function _l(e){return e==null?uw:function(){return this.querySelector(e)}}function fw(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 lt(i,this._parents)}function mw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pw(){return[]}function Pd(e){return e==null?pw:function(){return this.querySelectorAll(e)}}function hw(e){return function(){return mw(e.apply(this,arguments))}}function yw(e){typeof e=="function"?e=hw(e):e=Pd(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 lt(i,a)}function zd(e){return function(){return this.matches(e)}}function Ud(e){return function(t){return t.matches(e)}}var gw=Array.prototype.find;function bw(e){return function(){return gw.call(this.children,e)}}function _w(){return this.firstElementChild}function vw(e){return this.select(e==null?_w:bw(typeof e=="function"?e:Ud(e)))}var ww=Array.prototype.filter;function Ew(){return Array.from(this.children)}function kw(e){return function(){return ww.call(this.children,e)}}function Nw(e){return this.selectAll(e==null?Ew:kw(typeof e=="function"?e:Ud(e)))}function Iw(e){typeof e!="function"&&(e=zd(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 lt(i,this._parents)}function Hd(e){return new Array(e.length)}function $w(){return new lt(this._enter||this._groups.map(Hd),this._parents)}function Oi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Oi.prototype={constructor:Oi,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 xw(e){return function(){return e}}function Sw(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 Oi(e,l[r]);for(;r<c;++r)(s=t[r])&&(a[r]=s)}function Cw(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 Oi(e,l[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(h[s])===c&&(a[s]=c)}function Rw(e){return e.__data__}function Vw(e,t){if(!arguments.length)return Array.from(this,Rw);var o=t?Cw:Sw,i=this._parents,a=this._groups;typeof e!="function"&&(e=xw(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=Aw(e.call(u,u&&u.__data__,d,i)),p=m.length,g=s[d]=new Array(p),b=r[d]=new Array(p),_=c[d]=new Array(h);o(u,f,g,b,_,m,t);for(var N=0,y=0,x,q;N<p;++N)if(x=g[N]){for(N>=y&&(y=N+1);!(q=b[y])&&++y<p;);x._next=q||null}}return r=new lt(r,i),r._enter=s,r._exit=c,r}function Aw(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Tw(){return new lt(this._exit||this._groups.map(Hd),this._parents)}function Mw(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 Bw(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 lt(s,this._parents)}function Dw(){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 Ow(e){e||(e=Lw);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 lt(a,this._parents).order()}function Lw(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Pw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zw(){return Array.from(this)}function Uw(){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 Hw(){let e=0;for(const t of this)++e;return e}function Fw(){return!this.node()}function Gw(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 Yw(e){return function(){this.removeAttribute(e)}}function Ww(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kw(e,t){return function(){this.setAttribute(e,t)}}function qw(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xw(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function jw(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 Zw(e,t){var o=Di(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?Ww:Yw:typeof t=="function"?o.local?jw:Xw:o.local?qw:Kw)(o,t))}function Fd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Jw(e){return function(){this.style.removeProperty(e)}}function Qw(e,t,o){return function(){this.style.setProperty(e,t,o)}}function eE(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function tE(e,t,o){return arguments.length>1?this.each((t==null?Jw:typeof t=="function"?eE:Qw)(e,t,o??"")):zn(this.node(),e)}function zn(e,t){return e.style.getPropertyValue(t)||Fd(e).getComputedStyle(e,null).getPropertyValue(t)}function nE(e){return function(){delete this[e]}}function oE(e,t){return function(){this[e]=t}}function iE(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function aE(e,t){return arguments.length>1?this.each((t==null?nE:typeof t=="function"?iE:oE)(e,t)):this.node()[e]}function Gd(e){return e.trim().split(/^|\s+/)}function vl(e){return e.classList||new Yd(e)}function Yd(e){this._node=e,this._names=Gd(e.getAttribute("class")||"")}Yd.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 Wd(e,t){for(var o=vl(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function Kd(e,t){for(var o=vl(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function lE(e){return function(){Wd(this,e)}}function rE(e){return function(){Kd(this,e)}}function sE(e,t){return function(){(t.apply(this,arguments)?Wd:Kd)(this,e)}}function cE(e,t){var o=Gd(e+"");if(arguments.length<2){for(var i=vl(this.node()),a=-1,l=o.length;++a<l;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?sE:t?lE:rE)(o,t))}function dE(){this.textContent=""}function uE(e){return function(){this.textContent=e}}function fE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function mE(e){return arguments.length?this.each(e==null?dE:(typeof e=="function"?fE:uE)(e)):this.node().textContent}function pE(){this.innerHTML=""}function hE(e){return function(){this.innerHTML=e}}function yE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gE(e){return arguments.length?this.each(e==null?pE:(typeof e=="function"?yE:hE)(e)):this.node().innerHTML}function bE(){this.nextSibling&&this.parentNode.appendChild(this)}function _E(){return this.each(bE)}function vE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wE(){return this.each(vE)}function EE(e){var t=typeof e=="function"?e:Ld(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kE(){return null}function NE(e,t){var o=typeof e=="function"?e:Ld(e),i=t==null?kE:typeof t=="function"?t:_l(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function IE(){var e=this.parentNode;e&&e.removeChild(this)}function $E(){return this.each(IE)}function xE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function SE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function CE(e){return this.select(e?SE:xE)}function RE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function VE(e){return function(t){e.call(this,t,this.__data__)}}function AE(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 TE(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 ME(e,t,o){return function(){var i=this.__on,a,l=VE(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 BE(e,t,o){var i=AE(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?ME:TE,a=0;a<l;++a)this.each(s(i[a],t,o));return this}function qd(e,t,o){var i=Fd(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 DE(e,t){return function(){return qd(this,e,t)}}function OE(e,t){return function(){return qd(this,e,t.apply(this,arguments))}}function LE(e,t){return this.each((typeof t=="function"?OE:DE)(e,t))}function*PE(){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 Xd=[null];function lt(e,t){this._groups=e,this._parents=t}function vo(){return new lt([[document.documentElement]],Xd)}function zE(){return this}lt.prototype=vo.prototype={constructor:lt,select:fw,selectAll:yw,selectChild:vw,selectChildren:Nw,filter:Iw,data:Vw,enter:$w,exit:Tw,join:Mw,merge:Bw,selection:zE,order:Dw,sort:Ow,call:Pw,nodes:zw,node:Uw,size:Hw,empty:Fw,each:Gw,attr:Zw,style:tE,property:aE,classed:cE,text:mE,html:gE,raise:_E,lower:wE,append:EE,insert:NE,remove:$E,clone:CE,datum:RE,on:BE,dispatch:LE,[Symbol.iterator]:PE};function Wt(e){return typeof e=="string"?new lt([[document.querySelector(e)]],[document.documentElement]):new lt([[e]],Xd)}function UE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kt(e,t){if(e=UE(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 wl={capture:!0,passive:!1};function El(e){e.preventDefault(),e.stopImmediatePropagation()}function HE(e){var t=e.document.documentElement,o=Wt(e).on("dragstart.drag",El,wl);"onselectstart"in t?o.on("selectstart.drag",El,wl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function FE(e,t){var o=e.document.documentElement,i=Wt(e).on("dragstart.drag",null);t&&(i.on("click.drag",El,wl),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 kl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function jd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function wo(){}var Eo=.7,Li=1/Eo,Un="\\s*([+-]?\\d+)\\s*",ko="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",GE=/^#([0-9a-f]{3,8})$/,YE=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),WE=new RegExp(`^rgb\\(${wt},${wt},${wt}\\)$`),KE=new RegExp(`^rgba\\(${Un},${Un},${Un},${ko}\\)$`),qE=new RegExp(`^rgba\\(${wt},${wt},${wt},${ko}\\)$`),XE=new RegExp(`^hsl\\(${ko},${wt},${wt}\\)$`),jE=new RegExp(`^hsla\\(${ko},${wt},${wt},${ko}\\)$`),Zd={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};kl(wo,No,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Jd,formatHex:Jd,formatHex8:ZE,formatHsl:JE,formatRgb:Qd,toString:Qd});function Jd(){return this.rgb().formatHex()}function ZE(){return this.rgb().formatHex8()}function JE(){return iu(this).formatHsl()}function Qd(){return this.rgb().formatRgb()}function No(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=GE.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?eu(t):o===3?new tt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Pi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Pi(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=YE.exec(e))?new tt(t[1],t[2],t[3],1):(t=WE.exec(e))?new tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=KE.exec(e))?Pi(t[1],t[2],t[3],t[4]):(t=qE.exec(e))?Pi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=XE.exec(e))?ou(t[1],t[2]/100,t[3]/100,1):(t=jE.exec(e))?ou(t[1],t[2]/100,t[3]/100,t[4]):Zd.hasOwnProperty(e)?eu(Zd[e]):e==="transparent"?new tt(NaN,NaN,NaN,0):null}function eu(e){return new tt(e>>16&255,e>>8&255,e&255,1)}function Pi(e,t,o,i){return i<=0&&(e=t=o=NaN),new tt(e,t,o,i)}function QE(e){return e instanceof wo||(e=No(e)),e?(e=e.rgb(),new tt(e.r,e.g,e.b,e.opacity)):new tt}function Nl(e,t,o,i){return arguments.length===1?QE(e):new tt(e,t,o,i??1)}function tt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}kl(tt,Nl,jd(wo,{brighter(e){return e=e==null?Li:Math.pow(Li,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Eo:Math.pow(Eo,e),new tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tt(gn(this.r),gn(this.g),gn(this.b),zi(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:tu,formatHex:tu,formatHex8:ek,formatRgb:nu,toString:nu}));function tu(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}`}function ek(){return`#${bn(this.r)}${bn(this.g)}${bn(this.b)}${bn((isNaN(this.opacity)?1:this.opacity)*255)}`}function nu(){const e=zi(this.opacity);return`${e===1?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${e===1?")":`, ${e})`}`}function zi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bn(e){return e=gn(e),(e<16?"0":"")+e.toString(16)}function ou(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,o,i)}function iu(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof wo||(e=No(e)),!e)return new ft;if(e instanceof ft)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 ft(r,s,c,e.opacity)}function tk(e,t,o,i){return arguments.length===1?iu(e):new ft(e,t,o,i??1)}function ft(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}kl(ft,tk,jd(wo,{brighter(e){return e=e==null?Li:Math.pow(Li,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Eo:Math.pow(Eo,e),new ft(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 tt(Il(e>=240?e-240:e+120,a,i),Il(e,a,i),Il(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new ft(au(this.h),Ui(this.s),Ui(this.l),zi(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=zi(this.opacity);return`${e===1?"hsl(":"hsla("}${au(this.h)}, ${Ui(this.s)*100}%, ${Ui(this.l)*100}%${e===1?")":`, ${e})`}`}}));function au(e){return e=(e||0)%360,e<0?e+360:e}function Ui(e){return Math.max(0,Math.min(1,e||0))}function Il(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 lu=e=>()=>e;function nk(e,t){return function(o){return e+o*t}}function ok(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 ik(e){return(e=+e)==1?ru:function(t,o){return o-t?ok(t,o,e):lu(isNaN(t)?o:t)}}function ru(e,t){var o=t-e;return o?nk(e,o):lu(isNaN(e)?t:e)}const su=(function e(t){var o=ik(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=ru(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 $l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xl=new RegExp($l.source,"g");function ak(e){return function(){return e}}function lk(e){return function(t){return e(t)+""}}function rk(e,t){var o=$l.lastIndex=xl.lastIndex=0,i,a,l,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=$l.exec(e))&&(a=xl.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=xl.lastIndex;return o<t.length&&(l=t.slice(o),s[r]?s[r]+=l:s[++r]=l),s.length<2?c[0]?lk(c[0].x):ak(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,Sl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function du(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 Hi;function sk(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sl:du(t.a,t.b,t.c,t.d,t.e,t.f)}function ck(e){return e==null||(Hi||(Hi=document.createElementNS("http://www.w3.org/2000/svg","g")),Hi.setAttribute("transform",e),!(e=Hi.transform.baseVal.consolidate()))?Sl:(e=e.matrix,du(e.a,e.b,e.c,e.d,e.e,e.f))}function uu(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 g=m.push("translate(",null,t,null,o);p.push({i:g-4,x:qt(d,f)},{i:g-2,x:qt(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:qt(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:qt(d,u)}):u&&f.push(a(f)+"skewX("+u+i)}function c(d,u,f,h,m,p){if(d!==f||u!==h){var g=m.push(a(m)+"scale(",null,",",null,")");p.push({i:g-4,x:qt(d,f)},{i:g-2,x:qt(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,g=h.length,b;++p<g;)f[(b=h[p]).i]=b.x(m);return f.join("")}}}var dk=uu(sk,"px, ","px)","deg)"),uk=uu(ck,", ",")",")"),fk=1e-12;function fu(e){return((e=Math.exp(e))+1/e)/2}function mk(e){return((e=Math.exp(e))-1/e)/2}function pk(e){return((e=Math.exp(2*e))-1)/(e+1)}const hk=(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,g=m*m+p*p,b,_;if(g<fk)_=Math.log(h/d)/t,b=function(K){return[s+K*m,c+K*p,d*Math.exp(t*K*_)]};else{var N=Math.sqrt(g),y=(h*h-d*d+i*g)/(2*d*o*N),x=(h*h-d*d-i*g)/(2*h*o*N),q=Math.log(Math.sqrt(y*y+1)-y),P=Math.log(Math.sqrt(x*x+1)-x);_=(P-q)/t,b=function(K){var T=K*_,ie=fu(q),te=d/(o*N)*(ie*pk(t*T+q)-mk(q));return[s+te*m,c+te*p,d*ie/fu(t*T+q)]}}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 Hn=0,Io=0,$o=0,mu=1e3,Fi,xo,Gi=0,_n=0,Yi=0,So=typeof performance=="object"&&performance.now?performance:Date,pu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cl(){return _n||(pu(yk),_n=So.now()+Yi)}function yk(){_n=0}function Wi(){this._call=this._time=this._next=null}Wi.prototype=hu.prototype={constructor:Wi,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&&xo!==this&&(xo?xo._next=this:Fi=this,xo=this),this._call=e,this._time=o,Rl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rl())}};function hu(e,t,o){var i=new Wi;return i.restart(e,t,o),i}function gk(){Cl(),++Hn;for(var e=Fi,t;e;)(t=_n-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Hn}function yu(){_n=(Gi=So.now())+Yi,Hn=Io=0;try{gk()}finally{Hn=0,_k(),_n=0}}function bk(){var e=So.now(),t=e-Gi;t>mu&&(Yi-=t,Gi=e)}function _k(){for(var e,t=Fi,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:Fi=o);xo=e,Rl(i)}function Rl(e){if(!Hn){Io&&(Io=clearTimeout(Io));var t=e-_n;t>24?(e<1/0&&(Io=setTimeout(yu,e-So.now()-Yi)),$o&&($o=clearInterval($o))):($o||(Gi=So.now(),$o=setInterval(bk,mu)),Hn=1,pu(yu))}}function gu(e,t,o){var i=new Wi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var vk=gl("start","end","cancel","interrupt"),wk=[],bu=0,_u=1,Vl=2,Ki=3,vu=4,Al=5,qi=6;function Xi(e,t,o,i,a,l){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Ek(e,o,{name:t,index:i,group:a,on:vk,tween:wk,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:bu})}function Tl(e,t){var o=mt(e,t);if(o.state>bu)throw new Error("too late; already scheduled");return o}function Et(e,t){var o=mt(e,t);if(o.state>Ki)throw new Error("too late; already running");return o}function mt(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Ek(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=hu(l,0,o.time);function l(d){o.state=_u,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!==_u)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Ki)return gu(r);m.state===vu?(m.state=qi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=qi,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(gu(function(){o.state===Ki&&(o.state=vu,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=Ki,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=Al,1),f=-1,h=a.length;++f<h;)a[f].call(e,u);o.state===Al&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function ji(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=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}l&&delete e.__transition}}function kk(e){return this.each(function(){ji(this,e)})}function Nk(e,t){var o,i;return function(){var a=Et(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 Ik(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var l=Et(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 $k(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=mt(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?Nk:Ik)(o,e,t))}function Ml(e,t,o){var i=e._id;return e.each(function(){var a=Et(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return mt(a,i).value[t]}}function wu(e,t){var o;return(typeof t=="number"?qt:t instanceof No?su:(o=No(t))?(t=o,su):rk)(e,t)}function xk(e){return function(){this.removeAttribute(e)}}function Sk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ck(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 Rk(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 Vk(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 Ak(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 Tk(e,t){var o=Di(e),i=o==="transform"?uk:wu;return this.attrTween(e,typeof t=="function"?(o.local?Ak:Vk)(o,i,Ml(this,"attr."+e,t)):t==null?(o.local?Sk:xk)(o):(o.local?Rk:Ck)(o,i,t))}function Mk(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function Bk(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function Dk(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Bk(e,l)),o}return a._value=t,a}function Ok(e,t){var o,i;function a(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Mk(e,l)),o}return a._value=t,a}function Lk(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=Di(e);return this.tween(o,(i.local?Dk:Ok)(i,t))}function Pk(e,t){return function(){Tl(this,e).delay=+t.apply(this,arguments)}}function zk(e,t){return t=+t,function(){Tl(this,e).delay=t}}function Uk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Pk:zk)(t,e)):mt(this.node(),t).delay}function Hk(e,t){return function(){Et(this,e).duration=+t.apply(this,arguments)}}function Fk(e,t){return t=+t,function(){Et(this,e).duration=t}}function Gk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hk:Fk)(t,e)):mt(this.node(),t).duration}function Yk(e,t){if(typeof t!="function")throw new Error;return function(){Et(this,e).ease=t}}function Wk(e){var t=this._id;return arguments.length?this.each(Yk(t,e)):mt(this.node(),t).ease}function Kk(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Et(this,e).ease=o}}function qk(e){if(typeof e!="function")throw new Error;return this.each(Kk(this._id,e))}function Xk(e){typeof e!="function"&&(e=zd(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var l=t[a],r=l.length,s=i[a]=[],c,d=0;d<r;++d)(c=l[d])&&e.call(c,c.__data__,d,l)&&s.push(c);return new Mt(i,this._parents,this._name,this._id)}function jk(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 Mt(r,this._parents,this._name,this._id)}function Zk(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 Jk(e,t,o){var i,a,l=Zk(t)?Tl:Et;return function(){var r=l(this,e),s=r.on;s!==i&&(a=(i=s).copy()).on(t,o),r.on=a}}function Qk(e,t){var o=this._id;return arguments.length<2?mt(this.node(),o).on.on(e):this.each(Jk(o,e,t))}function eN(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function tN(){return this.on("end.remove",eN(this._id))}function nN(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,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,Xi(d[h],t,o,h,d,mt(u,o)));return new Mt(l,this._parents,t,o)}function oN(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Pd(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=mt(u,o),g=0,b=h.length;g<b;++g)(m=h[g])&&Xi(m,t,o,g,h,p);l.push(h),r.push(u)}return new Mt(l,r,t,o)}var iN=vo.prototype.constructor;function aN(){return new iN(this._groups,this._parents)}function lN(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 Eu(e){return function(){this.style.removeProperty(e)}}function rN(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 sN(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 cN(e,t){var o,i,a,l="style."+t,r="end."+l,s;return function(){var c=Et(this,e),d=c.on,u=c.value[l]==null?s||(s=Eu(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(r,a=u),c.on=i}}function dN(e,t,o){var i=(e+="")=="transform"?dk:wu;return t==null?this.styleTween(e,lN(e,i)).on("end.style."+e,Eu(e)):typeof t=="function"?this.styleTween(e,sN(e,i,Ml(this,"style."+e,t))).each(cN(this._id,e)):this.styleTween(e,rN(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 fN(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 mN(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,fN(e,t,o??""))}function pN(e){return function(){this.textContent=e}}function hN(e){return function(){var t=e(this);this.textContent=t??""}}function yN(e){return this.tween("text",typeof e=="function"?hN(Ml(this,"text",e)):pN(e==null?"":e+""))}function gN(e){return function(t){this.textContent=e.call(this,t)}}function bN(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&gN(a)),t}return i._value=e,i}function _N(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,bN(e))}function vN(){for(var e=this._name,t=this._id,o=ku(),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=mt(c,t);Xi(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Mt(i,this._parents,e,o)}function wN(){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=Et(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 EN=0;function Mt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ku(){return++EN}var Bt=vo.prototype;Mt.prototype={constructor:Mt,select:nN,selectAll:oN,selectChild:Bt.selectChild,selectChildren:Bt.selectChildren,filter:Xk,merge:jk,selection:aN,transition:vN,call:Bt.call,nodes:Bt.nodes,node:Bt.node,size:Bt.size,empty:Bt.empty,each:Bt.each,on:Qk,attr:Tk,attrTween:Lk,style:dN,styleTween:mN,text:yN,textTween:_N,remove:tN,tween:$k,delay:Uk,duration:Gk,ease:Wk,easeVarying:qk,end:wN,[Symbol.iterator]:Bt[Symbol.iterator]};function kN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var NN={time:null,delay:0,duration:250,ease:kN};function IN(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 Mt?(t=e._id,e=e._name):(t=ku(),(o=NN).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])&&Xi(c,e,t,d,r,o||IN(c,t));return new Mt(i,this._parents,e,t)}vo.prototype.interrupt=kk,vo.prototype.transition=$N;const Zi=e=>()=>e;function xN(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 Dt(e,t,o){this.k=e,this.x=t,this.y=o}Dt.prototype={constructor:Dt,scale:function(e){return e===1?this:new Dt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Dt(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 Dt(1,0,0);Dt.prototype;function Dl(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function SN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function CN(){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 Nu(){return this.__zoom||Bl}function RN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VN(){return navigator.maxTouchPoints||"ontouchstart"in this}function AN(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 TN(){var e=SN,t=CN,o=AN,i=RN,a=VN,l=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=hk,d=gl("start","zoom","end"),u,f,h,m=500,p=150,g=0,b=10;function _(E){E.property("__zoom",Nu).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ie).on("dblclick.zoom",te).filter(a).on("touchstart.zoom",fe).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",ne).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,S,I,B){var G=E.selection?E.selection():E;G.property("__zoom",Nu),E!==G?q(E,S,I,B):G.interrupt().each(function(){P(this,arguments).event(B).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},_.scaleBy=function(E,S,I,B){_.scaleTo(E,function(){var G=this.__zoom.k,X=typeof S=="function"?S.apply(this,arguments):S;return G*X},I,B)},_.scaleTo=function(E,S,I,B){_.transform(E,function(){var G=t.apply(this,arguments),X=this.__zoom,A=I==null?x(G):typeof I=="function"?I.apply(this,arguments):I,ae=X.invert(A),se=typeof S=="function"?S.apply(this,arguments):S;return o(y(N(X,se),A,ae),G,r)},I,B)},_.translateBy=function(E,S,I,B){_.transform(E,function(){return o(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),r)},null,B)},_.translateTo=function(E,S,I,B,G){_.transform(E,function(){var X=t.apply(this,arguments),A=this.__zoom,ae=B==null?x(X):typeof B=="function"?B.apply(this,arguments):B;return o(Bl.translate(ae[0],ae[1]).scale(A.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof I=="function"?-I.apply(this,arguments):-I),X,r)},B,G)};function N(E,S){return S=Math.max(l[0],Math.min(l[1],S)),S===E.k?E:new Dt(S,E.x,E.y)}function y(E,S,I){var B=S[0]-I[0]*E.k,G=S[1]-I[1]*E.k;return B===E.x&&G===E.y?E:new Dt(E.k,B,G)}function x(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function q(E,S,I,B){E.on("start.zoom",function(){P(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(B).end()}).tween("zoom",function(){var G=this,X=arguments,A=P(G,X).event(B),ae=t.apply(G,X),se=I==null?x(ae):typeof I=="function"?I.apply(G,X):I,ge=Math.max(ae[1][0]-ae[0][0],ae[1][1]-ae[0][1]),_e=G.__zoom,re=typeof S=="function"?S.apply(G,X):S,ye=c(_e.invert(se).concat(ge/_e.k),re.invert(se).concat(ge/re.k));return function(be){if(be===1)be=re;else{var $e=ye(be),Se=ge/$e[2];be=new Dt(Se,se[0]-$e[0]*Se,se[1]-$e[1]*Se)}A.zoom(null,be)}})}function P(E,S,I){return!I&&E.__zooming||new K(E,S)}function K(E,S){this.that=E,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,S),this.taps=0}K.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,S){return this.mouse&&E!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var S=Wt(this.that).datum();d.call(E,this.that,new xN(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),S)}};function T(E,...S){if(!e.apply(this,arguments))return;var I=P(this,S).event(E),B=this.__zoom,G=Math.max(l[0],Math.min(l[1],B.k*Math.pow(2,i.apply(this,arguments)))),X=Kt(E);if(I.wheel)(I.mouse[0][0]!==X[0]||I.mouse[0][1]!==X[1])&&(I.mouse[1]=B.invert(I.mouse[0]=X)),clearTimeout(I.wheel);else{if(B.k===G)return;I.mouse=[X,B.invert(X)],ji(this),I.start()}Co(E),I.wheel=setTimeout(A,p),I.zoom("mouse",o(y(N(B,G),I.mouse[0],I.mouse[1]),I.extent,r));function A(){I.wheel=null,I.end()}}function ie(E,...S){if(h||!e.apply(this,arguments))return;var I=E.currentTarget,B=P(this,S,!0).event(E),G=Wt(E.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",ge,!0),X=Kt(E,I),A=E.clientX,ae=E.clientY;HE(E.view),Dl(E),B.mouse=[X,this.__zoom.invert(X)],ji(this),B.start();function se(_e){if(Co(_e),!B.moved){var re=_e.clientX-A,ye=_e.clientY-ae;B.moved=re*re+ye*ye>g}B.event(_e).zoom("mouse",o(y(B.that.__zoom,B.mouse[0]=Kt(_e,I),B.mouse[1]),B.extent,r))}function ge(_e){G.on("mousemove.zoom mouseup.zoom",null),FE(_e.view,B.moved),Co(_e),B.event(_e).end()}}function te(E,...S){if(e.apply(this,arguments)){var I=this.__zoom,B=Kt(E.changedTouches?E.changedTouches[0]:E,this),G=I.invert(B),X=I.k*(E.shiftKey?.5:2),A=o(y(N(I,X),B,G),t.apply(this,S),r);Co(E),s>0?Wt(this).transition().duration(s).call(q,A,B,E):Wt(this).call(_.transform,A,B,E)}}function fe(E,...S){if(e.apply(this,arguments)){var I=E.touches,B=I.length,G=P(this,S,E.changedTouches.length===B).event(E),X,A,ae,se;for(Dl(E),A=0;A<B;++A)ae=I[A],se=Kt(ae,this),se=[se,this.__zoom.invert(se),ae.identifier],G.touch0?!G.touch1&&G.touch0[2]!==se[2]&&(G.touch1=se,G.taps=0):(G.touch0=se,X=!0,G.taps=1+!!u);u&&(u=clearTimeout(u)),X&&(G.taps<2&&(f=se[0],u=setTimeout(function(){u=null},m)),ji(this),G.start())}}function M(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A,ae,se;for(Co(E),X=0;X<G;++X)A=B[X],ae=Kt(A,this),I.touch0&&I.touch0[2]===A.identifier?I.touch0[0]=ae:I.touch1&&I.touch1[2]===A.identifier&&(I.touch1[0]=ae);if(A=I.that.__zoom,I.touch1){var ge=I.touch0[0],_e=I.touch0[1],re=I.touch1[0],ye=I.touch1[1],be=(be=re[0]-ge[0])*be+(be=re[1]-ge[1])*be,$e=($e=ye[0]-_e[0])*$e+($e=ye[1]-_e[1])*$e;A=N(A,Math.sqrt(be/$e)),ae=[(ge[0]+re[0])/2,(ge[1]+re[1])/2],se=[(_e[0]+ye[0])/2,(_e[1]+ye[1])/2]}else if(I.touch0)ae=I.touch0[0],se=I.touch0[1];else return;I.zoom("touch",o(y(A,ae,se),I.extent,r))}}function ne(E,...S){if(this.__zooming){var I=P(this,S).event(E),B=E.changedTouches,G=B.length,X,A;for(Dl(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),X=0;X<G;++X)A=B[X],I.touch0&&I.touch0[2]===A.identifier?delete I.touch0:I.touch1&&I.touch1[2]===A.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(A=Kt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<b)){var ae=Wt(this).on("dblclick.zoom");ae&&ae.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Zi(+E),_):i},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Zi(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Zi(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Zi([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(l[0]=+E[0],l[1]=+E[1],_):[l[0],l[1]]},_.translateExtent=function(E){return arguments.length?(r[0][0]=+E[0][0],r[1][0]=+E[1][0],r[0][1]=+E[0][1],r[1][1]=+E[1][1],_):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},_.constrain=function(E){return arguments.length?(o=E,_):o},_.duration=function(E){return arguments.length?(s=+E,_):s},_.interpolate=function(E){return arguments.length?(c=E,_):c},_.on=function(){var E=d.on.apply(d,arguments);return E===d?_:E},_.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,_):Math.sqrt(g)},_.tapDistance=function(E){return arguments.length?(b=+E,_):b},_}const Iu=Symbol("MiniMapSlots"),MN=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],BN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},DN=n.defineComponent({...BN,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(Iu),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,MN))],64)):n.createCommentVNode("",!0)}}),ON=["width","height","viewBox","aria-labelledby"],LN=["id"],PN=["d","fill","stroke","stroke-width"],zN={name:"MiniMap",compatConfig:{MODE:3}},UN=n.defineComponent({...zN,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}=Me(),g=n.ref();n.provide(Iu,o);const b=n.toRef(()=>{var G;return e.width??((G=i.style)==null?void 0:G.width)??a}),_=n.toRef(()=>{var G;return e.height??((G=i.style)==null?void 0:G.height)??l}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",y=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),x=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),q=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),P=n.computed(()=>Za(p.value.filter(G=>!G.hidden))),K=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})),T=n.computed(()=>p.value&&p.value.length?Ig(P.value,K.value):K.value),ie=n.computed(()=>{const G=T.value.width/b.value,X=T.value.height/_.value;return Math.max(G,X)}),te=n.computed(()=>{const G=ie.value*b.value,X=ie.value*_.value,A=e.offsetScale*ie.value;return{offset:A,x:T.value.x-(G-T.value.width)/2-A,y:T.value.y-(X-T.value.height)/2-A,width:G+A*2,height:X+A*2}}),fe=n.computed(()=>!te.value.x||!te.value.y?"":`
28
28
  M${te.value.x-te.value.offset},${te.value.y-te.value.offset}
29
29
  h${te.value.width+te.value.offset*2}
30
30
  v${te.value.height+te.value.offset*2}
@@ -37,5 +37,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
37
37
  h${-(K.value.width-2*e.maskBorderRadius)}
38
38
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
39
39
  v${-(K.value.height-2*e.maskBorderRadius)}
40
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(G=>{if(g.value){const X=Yt(g.value),A=ge=>{if(ge.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const _e=ge.sourceEvent.ctrlKey&&go()?10:1,re=-ge.sourceEvent.deltaY*(ge.sourceEvent.deltaMode===1?.05:ge.sourceEvent.deltaMode?1:.002)*e.zoomStep,ye=c.value.zoom*2**(re*_e);m.value.scaleTo(h.value,ye)},ae=ge=>{if(ge.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const _e=ie.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),re={x:c.value.x-ge.sourceEvent.movementX*_e,y:c.value.y-ge.sourceEvent.movementY*_e},ye=[[0,0],[u.value.width,u.value.height]],be=Tl.translate(re.x,re.y).scale(c.value.zoom),$e=m.value.constrain()(be,ye,d.value);m.value.transform(h.value,$e)},se=TN().wheelDelta(ge=>ja(ge)*(e.zoomStep/10)).on("zoom",e.pannable?ae:()=>{}).on("zoom.wheel",e.zoomable?A:()=>{});X.call(se),G(()=>{X.on("zoom",null)})}},{flush:"post"});function M(G){const[X,A]=Wt(G);t("click",{event:G,position:{x:X,y:A}})}function ne(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeClick(A),t("nodeClick",A)}function E(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeDoubleClick(A),t("nodeDblclick",A)}function S(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseEnter(A),t("nodeMouseenter",A)}function I(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseMove(A),t("nodeMousemove",A)}function B(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseLeave(A),t("nodeMouseleave",A)}return(G,X)=>(n.openBlock(),n.createBlock(n.unref(id),{position:G.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:G.pannable,zoomable:G.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:b.value,height:_.value,viewBox:[te.value.x,te.value.y,te.value.width,te.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:M},[G.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(G.ariaLabel),9,LN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),A=>(n.openBlock(),n.createBlock(DN,{id:A.id,key:A.id,f:"",position:A.computedPosition,dimensions:A.dimensions,selected:A.selected,dragging:A.dragging,style:n.normalizeStyle(A.style),class:n.normalizeClass(q.value(A)),color:y.value(A),"border-radius":G.nodeBorderRadius,"stroke-color":x.value(A),"stroke-width":G.nodeStrokeWidth,"shape-rendering":n.unref(N),type:A.type,hidden:A.hidden,onClick:ae=>ne(ae,A),onDblclick:ae=>E(ae,A),onMouseenter:ae=>S(ae,A),onMousemove:ae=>I(ae,A),onMouseleave:ae=>B(ae,A)},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:fe.value,fill:G.maskColor,stroke:G.maskStrokeColor,"stroke-width":G.maskStrokeWidth,"fill-rule":"evenodd"},null,8,PN)],8,ON))]),_:1},8,["position","class"]))}}),HN=["d"],FN=["cx","cy","onDblclick"],GN=["x","y","onPointerdown","onDblclick"],YN=De(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Me(),i=n.inject(pl),a=n.inject(yn,null),l=n.computed(()=>!!a&&a.editable.value),r=n.inject(Ln,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((T,ie)=>ie===d.value?u.value:T)),{source:h,target:m,sourceSide:p,targetSide:g}=Vd({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ea(h.value,p.value,f.value,m.value,g.value):na(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(h.value,p.value,f.value,m.value,g.value):aa(h.value,f.value,m.value).map((T,ie)=>({point:T,segIndex:ie})):[]),N=n.computed(()=>l.value?f.value:[]);function y(T,ie){d.value=T,u.value={...c.value[T]},ie.target.setPointerCapture(ie.pointerId),ie.stopPropagation()}function x(T){if(d.value<0)return;const ie=o({x:T.clientX,y:T.clientY});u.value={x:ie.x,y:ie.y}}function q(T){var ie,te;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(te=(ie=T.target).releasePointerCapture)==null||te.call(ie,T.pointerId)}function P(T,ie){ie.stopPropagation(),i==null||i.removePoint(t.id,T)}function K(T,ie){if(!i)return;const te=o({x:ie.clientX,y:ie.clientY});i.insertPoint(t.id,T,{x:te.x,y:te.y})}return(T,ie)=>(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,HN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(te,fe)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${fe}`,cx:te.point.x,cy:te.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(M=>K(te.segIndex,M),["stop"])},null,42,FN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(te,fe)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${fe}`,x:te.x-5,y:te.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>y(fe,M),onPointermove:x,onPointerup:q,onDblclick:M=>P(fe,M)},null,42,GN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),WN=["data-theme"],KN={key:0,class:"em-ctx__sep",role:"separator"},qN={key:1,class:"em-ctx__swatches"},XN={class:"em-ctx__swatches-label"},jN={class:"em-ctx__chips"},ZN=["onClick"],JN=["title","onClick"],QN=["disabled","onClick"],eI={class:"em-ctx__icon"},tI={class:"em-ctx__caption"},nI=De(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 g=l.value;if(!g)return;const b=g.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,(g,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",KN)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",qN,[n.createElementVNode("span",XN,n.toDisplayString(g.caption),1),n.createElementVNode("div",jN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":g.current===null}]),title:"없음",onClick:_=>h(g,null)},null,10,ZN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":g.current===_}]),style:n.normalizeStyle({background:n.unref(Bn)(_)}),title:n.unref(Mn)(_),onClick:N=>h(g,_)},null,14,JN))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":g.danger,"is-disabled":g.disabled}]),disabled:g.disabled,role:"menuitem",onClick:_=>f(g)},[n.createElementVNode("span",eI,[g.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",tI,n.toDisplayString(g.caption),1)],10,QN))],64))),128))],36)],8,WN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),Bl=[".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 Hn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function oI(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function iI(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 g=t(p.left,p.top+p.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const g=t(f,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(m(),u=g.top,f=g.left,h=g.bottom,d=s[p]):(d+=s[p],h=Math.max(h,g.bottom))}return m(),c}function Ji(e,t){const o=[];for(const i of e.querySelectorAll("*"))oI(i)&&(i.closest(Bl)||Hn(i)&&o.push(...iI(i,t)));return o}function Co(e){return Math.round(e*100)/100}function aI(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Bl)||!Hn(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="${Co(l.x)}" y="${Co(l.y)}" width="${Co(r.x-l.x)}" height="${Co(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 lI(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Hn(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=>Co(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 Iu(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Bl)||!Hn(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 Ro(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 Dl(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 rI(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||!Hn(p))continue;const g=p.firstElementChild;if(g)if(m.type==="group"){const b=Ro(g,o);Dl(s,b),i.push({...b,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...Ro(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ji(g,o)})}else if(m.type==="note"){const b={...Ro(g,o),texts:Ji(g,o),lines:Iu(g,g,o)};Dl(s,b),l.push(b)}else{const b=Ro(g,o);Dl(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const y=Ro(N,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:_.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:Ji(g,o),lines:Iu(g,g,o),icons:aI(g,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||!Hn(p))continue;const g=p.getAttribute("d");if(!g)continue;const b=getComputedStyle(p),_=b.strokeDasharray,N=lI(m);r.push({d:g,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:Ji(m,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:a,notes:l}}function $u(e){return Kl(rI(e))}function xu(e,t="diagram.svg"){const o=$u(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 Ol="nc:",Su=De(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=le.useModal(),l=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(w){s.x=w.clientX,s.y=w.clientY}const d=n.ref(null);n.provide(Vi,d);const u=n.ref(null);n.provide(hd,u);const f=n.ref(null),h=n.computed(()=>{const w=f.value,v=new Set;if(!w)return v;if(w.kind==="entity")v.add(w.id);else if(w.kind==="group"){const z=i.resolved.value.groups.find(pe=>pe.group.modelId===w.id);for(const pe of(z==null?void 0:z.group.memberEntityRefs)??[])v.add(pe)}return v}),m=n.computed(()=>{const w=f.value,v=new Set(h.value),z=new Set,pe=new Set;if(!w)return{related:v,edges:z,notes:pe};if(w.kind==="note"){pe.add(w.id);for(const Z of i.resolved.value.noteConnections)Z.noteRef===w.id&&v.add(Z.targetRef);return{related:v,edges:z,notes:pe}}const J=h.value;if(!J.size)return{related:v,edges:z,notes:pe};for(const Z of i.resolved.value.associations){const{end1:W,end2:de}=Z.association;(J.has(W.entityRef)||J.has(de.entityRef))&&(z.add(Z.association.modelId),v.add(W.entityRef),v.add(de.entityRef))}for(const Z of i.resolved.value.noteConnections)v.has(Z.targetRef)&&pe.add(Z.noteRef);return{related:v,edges:z,notes:pe}});n.provide(Ln,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:h,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var w;return((w=f.value)==null?void 0:w.kind)==="group"?f.value.id:null}),setEntityHover:w=>{u.value||r.value||(f.value=w?{kind:"entity",id:w}:null)},setGroupHover:w=>{u.value||r.value||(f.value=w?{kind:"group",id:w}:null)},setNoteHover:w=>{u.value||r.value||(f.value=w?{kind:"note",id:w}:null)}}),n.provide(yn,i);function p(w,v){return`${Ol}${w}:${v}`}function g(w){if(!w.startsWith(Ol))return null;const[v,z]=w.slice(Ol.length).split(":");return v&&z?{noteRef:v,targetRef:z}:null}n.provide(pl,{points:w=>{var z,pe;const v=g(w);return v?((z=i.resolved.value.noteConnections.find(J=>J.noteRef===v.noteRef&&J.targetRef===v.targetRef))==null?void 0:z.waypoints)??[]:((pe=i.resolved.value.associations.find(J=>J.association.modelId===w))==null?void 0:pe.waypoints)??[]},movePoint:(w,v,z)=>{const pe=g(w);pe?i.moveNoteConnectionWaypoint(pe.noteRef,pe.targetRef,v,z):i.moveWaypoint(w,v,z)},insertPoint:(w,v,z)=>{const pe=g(w);pe?i.addNoteConnectionWaypoint(pe.noteRef,pe.targetRef,v,z):i.addWaypoint(w,v,z)},removePoint:(w,v)=>{const z=g(w);z?i.removeNoteConnectionWaypoint(z.noteRef,z.targetRef,v):i.removeWaypoint(w,v)}});const b=Me(),{nodes:_,edges:N,findNode:y,findEdge:x,addNodes:q,addEdges:P,removeNodes:K,removeEdges:T,fitView:ie,setCenter:te,getViewport:fe,screenToFlowCoordinate:M,getSelectedNodes:ne,updateNodeInternals:E}=b,S=n.ref(!1);async function I(){S.value=!0,await n.nextTick(),await new Promise(w=>requestAnimationFrame(()=>w(null)));try{xu(b)}finally{S.value=!1}}t({exportSvg:I});function B(w){for(const v of i.resolved.value.groups){const{location:z,size:pe}=v.geo;if(w.x>=z.x&&w.x<=z.x+pe.width&&w.y>=z.y&&w.y<=z.y+pe.height)return v.group.modelId}return null}function G(){const w=i.resolved.value,v=new Map(w.groups.map(W=>[W.group.modelId,W.geo])),z=new Set(w.groups.map(W=>W.group.modelId)),pe=new Set([...z,...w.entities.map(W=>W.entity.modelId),...w.notes.map(W=>W.note.modelId)]);for(const W of[..._.value])pe.has(W.id)||K([W.id]);for(const W of w.groups){const de=W.group.modelId,ke={width:`${W.geo.size.width}px`,height:`${W.geo.size.height}px`},xe={group:W.group,style:W.style},H=y(de);H?(H.position={...W.geo.location},H.data=xe,H.style=ke):q([{id:de,type:"group",position:{...W.geo.location},style:ke,data:xe}])}for(const W of w.entities){const de=W.entity.modelId,ke=W.groupRef&&z.has(W.groupRef)?W.groupRef:void 0,xe={entity:W.entity,displayMode:i.displayMode.value,collapsed:W.collapsed,groupRef:ke,size:W.geo.size,style:W.style,attributeStyles:W.attributeStyles,operationStyles:W.operationStyles},H=ke?v.get(ke):void 0,ee=H?{x:W.geo.location.x-H.location.x,y:W.geo.location.y-H.location.y}:{...W.geo.location},F=y(de);F?(F.position=ee,F.data=xe,F.parentNode=ke):q([{id:de,type:"entity",position:ee,parentNode:ke,data:xe}])}for(const W of w.notes){const de=W.note,ke=de.modelId,xe=W.groupRef&&z.has(W.groupRef)?W.groupRef:void 0,H={note:de,groupRef:xe},ee={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},F=xe?v.get(xe):void 0,ue=F?{x:de.geo.location.x-F.location.x,y:de.geo.location.y-F.location.y}:{...de.geo.location},Ae=y(ke);Ae?(Ae.position=ue,Ae.data=H,Ae.style=ee,Ae.parentNode=xe):q([{id:ke,type:"note",position:ue,parentNode:xe,style:ee,data:H}])}const J=new Map(w.associations.map(W=>[W.association.modelId,W])),Z=new Set(w.noteConnections.map(W=>p(W.noteRef,W.targetRef)));for(const W of[...N.value])!J.has(W.id)&&!Z.has(W.id)&&T([W.id]);for(const[W,de]of J){const ke={id:W,type:"association",source:de.association.end1.entityRef,target:de.association.end2.entityRef,sourceHandle:de.sourceColumnRef?`r:${de.sourceColumnRef}`:void 0,targetHandle:de.targetColumnRef?`l:${de.targetColumnRef}`:void 0,data:{association:de.association,sourceColumnRef:de.sourceColumnRef,targetColumnRef:de.targetColumnRef}},xe=x(W);xe?(xe.data=ke.data,xe.sourceHandle=ke.sourceHandle,xe.targetHandle=ke.targetHandle):P([ke])}for(const W of w.noteConnections){const de=p(W.noteRef,W.targetRef),ke={noteRef:W.noteRef,targetRef:W.targetRef},xe=x(de);xe?xe.data=ke:P([{id:de,type:"note-connection",source:W.noteRef,target:W.targetRef,data:ke}])}X()}function X(){n.nextTick(()=>requestAnimationFrame(()=>E()))}function A(){const w=ne.value.map(z=>z.id);if(w.length)return w;const v=i.selection.value;return v&&(v.kind==="entity"||v.kind==="note"||v.kind==="group")?[v.id]:[]}function ae(w){var J;const v=w.target;if(v&&(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.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(((J=i.selection.value)==null?void 0:J.kind)==="attribute"){if(w.key==="ArrowUp"||w.key==="ArrowDown"){const ke=w.key==="ArrowDown"?1:-1;(w.altKey?i.nudgeSelectedAttributes(ke):i.moveAttributeFocus(ke))&&w.preventDefault()}return}const Z=w.shiftKey?10:1,W=w.key==="ArrowLeft"?-Z:w.key==="ArrowRight"?Z:0,de=w.key==="ArrowUp"?-Z:w.key==="ArrowDown"?Z:0;i.nudgeNodes(A(),W,de)&&w.preventDefault();return}if(!(w.metaKey||w.ctrlKey))return;const pe=w.key.toLowerCase();pe==="c"?(i.copy(),w.preventDefault()):pe==="v"?(i.paste(),w.preventDefault()):pe==="z"&&(w.shiftKey?i.redo():i.undo(),w.preventDefault())}n.onMounted(async()=>{G(),await n.nextTick(),ie(),window.addEventListener("keydown",ae),window.addEventListener("pointerup",se),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",ae),window.removeEventListener("pointerup",se),window.removeEventListener("pointermove",c)});function se(){d.value=null}function ge(){r.value=!0,f.value=null}function _e(){var pe;r.value=!1;const w=(pe=document.elementFromPoint(s.x,s.y))==null?void 0:pe.closest(".vue-flow__node"),v=w==null?void 0:w.dataset.id;if(!v){f.value=null;return}const z=w.classList.contains("vue-flow__node-group")?"group":w.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:z,id:v}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],G),n.watch(()=>i.revision.value,X),n.watch(()=>i.resolved.value,w=>{const v=f.value;if(!v)return;(v.kind==="entity"?w.entities.some(pe=>pe.entity.modelId===v.id):v.kind==="group"?w.groups.some(pe=>pe.group.modelId===v.id):w.notes.some(pe=>pe.note.modelId===v.id))||(f.value=null)});function re(w){const v=w.computedPosition??w.position,z=w.dimensions??{width:0,height:0};return{x:v.x+z.width/2,y:v.y+z.height/2}}function ye(w){const v=w.node;if(v){if(f.value=null,v.type==="group"){const z=i.resolved.value.groups.find(pe=>pe.group.modelId===v.id);u.value=z?{groupId:v.id,dx:v.position.x-z.geo.location.x,dy:v.position.y-z.geo.location.y}:null,d.value=null;return}if(v.type!=="entity"&&v.type!=="note"){d.value=null;return}d.value=B(re(v))}}function be(w){var pe;d.value=null,u.value=null;const v=(pe=w.nodes)!=null&&pe.length?w.nodes:[w.node],z=v.filter(J=>(J==null?void 0:J.type)==="group");if(z.length){for(const J of z){if(!J)continue;const Z=i.resolved.value.entities.filter(W=>W.groupRef===J.id).map(W=>{const de=y(W.entity.modelId),ke=(de==null?void 0:de.computedPosition)??(de==null?void 0:de.position)??{x:0,y:0};return{id:W.entity.modelId,location:{x:ke.x,y:ke.y}}});i.dragGroup(J.id,{x:J.position.x,y:J.position.y},Z)}return}for(const J of v){if(!J||J.type==="group")continue;const Z=J.computedPosition??J.position,W=J.dimensions??{width:0,height:0},de={x:Z.x+W.width/2,y:Z.y+W.height/2};J.type==="note"?i.dropNote(J.id,{x:Z.x,y:Z.y},B(de)):i.dropEntity(J.id,{x:Z.x,y:Z.y},B(de))}}function $e(w){var ke,xe,H,ee,F;if(!i.editable.value||!w.source||!w.target)return;const v=((ke=y(w.source))==null?void 0:ke.type)==="note",z=((xe=y(w.target))==null?void 0:xe.type)==="note";if(v||z){if(v&&z)return;const ue=v?w.source:w.target,Ae=v?w.target:w.source;((H=y(Ae))==null?void 0:H.type)==="entity"&&i.addNoteConnection(ue,Ae);return}const pe=ue=>{var Ae;return(Ae=i.state.logical.entities.find(Je=>Je.modelId===ue))==null?void 0:Ae.stereotype},J=pe(w.source)==="JPA_EMBEDDABLE",Z=pe(w.target)==="JPA_EMBEDDABLE";if(J||Z){if(J&&Z)return;const ue=J?w.source:w.target,Ae=J?w.target:w.source;i.addEmbedAssociation(Ae,ue);return}const W=(ee=w.sourceHandle)!=null&&ee.startsWith("r:")?w.sourceHandle.slice(2):void 0,de=(F=w.targetHandle)!=null&&F.startsWith("l:")?w.targetHandle.slice(2):void 0;i.addAssociation(w.source,w.target,W,de)}const Se=n.ref(null);function Ce(w,v){var pe;const z=i.state.layout.entityLayouts.find(J=>J.entityRef===w);return Xe((pe=z==null?void 0:z.attributeStyles)==null?void 0:pe[v])}function Y(w,v){var pe;const z=i.state.layout.entityLayouts.find(J=>J.entityRef===w);return Xe((pe=z==null?void 0:z.operationStyles)==null?void 0:pe[v])}function U(w){var v;return Xe((v=i.state.layout.groupLayouts.find(z=>z.groupRef===w))==null?void 0:v.style)}function V(w){var v;return Xe((v=i.state.layout.notes.find(z=>z.modelId===w))==null?void 0:v.style)}function C(w){var pe,J;if(w.preventDefault(),!i.editable.value)return;const v=()=>M({x:w.clientX,y:w.clientY}),z=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const Z=v();i.addEntity("NewEntity",{x:Z.x,y:Z.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const Z=v();i.addNote("메모",{x:Z.x,y:Z.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const Z=v();i.addEmptyGroup({x:Z.x,y:Z.y})}}];((pe=i.clipboard.value)==null?void 0:pe.kind)==="entity"&&z.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&z.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(J=Se.value)==null||J.open(w,z)}function R({event:w,node:v}){var H,ee,F,ue,Ae,Je,nt,Pe,kt,qt,Xt,jt,Ge,Vo,ve,Ye,Ao;const z=w;if(z.preventDefault(),!i.editable.value){if(v.type==="group"||v.type==="note")return;const Be=(ee=(H=z.target)==null?void 0:H.closest("[data-attr]"))==null?void 0:ee.dataset.attr;if(Be){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===v.id&&Qe.ids.includes(Be)||i.selectAttribute(v.id,Be);const It=((F=i.selection.value)==null?void 0:F.kind)==="attribute"&&i.selection.value.entityId===v.id?[...i.selection.value.ids]:[Be];(ue=Se.value)==null||ue.open(z,[{caption:It.length>1?`복사 (${It.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ae=Se.value)==null||Ae.open(z,[{caption:"상세 편집…",icon:"pencil",handler:()=>xi(a,i,v.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:v.id},i.copy()}}]);return}if(v.type==="group"){(Je=Se.value)==null||Je.open(z,[{type:"swatches",caption:"색상",current:U(v.id),onPick:Be=>i.setGroupSwatch(v.id,Be)},{type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(v.id)}]);return}if(v.type==="note"){(nt=Se.value)==null||nt.open(z,[{type:"swatches",caption:"색상",current:V(v.id),onPick:Be=>i.setNoteSwatch(v.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(v.id)}]);return}const pe=(kt=(Pe=z.target)==null?void 0:Pe.closest("[data-attr]"))==null?void 0:kt.dataset.attr;if(pe){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===v.id&&Be.ids.includes(pe)||i.selectAttribute(v.id,pe);const Nt=((qt=i.selection.value)==null?void 0:qt.kind)==="attribute"&&i.selection.value.entityId===v.id?[...i.selection.value.ids]:[pe],It=Nt.length>1,Fn=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(v.id)},{type:"swatches",caption:It?`색상 (${Nt.length})`:"색상",current:It?null:Ce(v.id,pe),onPick:ot=>i.setAttributeSwatches(v.id,Nt,ot)},{type:"separator"},{caption:It?`복사 (${Nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Zt=i.clipboard.value;(Zt==null?void 0:Zt.kind)==="attribute"&&Fn.push({caption:Zt.attributes.length>1?`속성 붙여넣기 (${Zt.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:v.id},i.paste()}}),Fn.push({type:"separator"},{caption:It?`속성 삭제 (${Nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(v.id,Nt)}),(Xt=Se.value)==null||Xt.open(z,Fn);return}const J=(Ge=(jt=z.target)==null?void 0:jt.closest("[data-op]"))==null?void 0:Ge.dataset.op;if(J){(Vo=Se.value)==null||Vo.open(z,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(v.id)},{type:"swatches",caption:"색상",current:Y(v.id,J),onPick:Be=>i.setOperationSwatch(v.id,J,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(v.id,J)}]);return}const Z=[{caption:"상세 편집…",icon:"pencil",handler:()=>xi(a,i,v.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(v.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(v.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Be=ne.value.filter(Qe=>Qe.type==="entity").map(Qe=>Qe.id);i.createGroup(Be.includes(v.id)&&Be.length?Be:[v.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(v.id,v.id)}],W=i.embeddableCatalog.value;if(W.length){Z.push({type:"separator"});for(const Be of W){const Qe=((ve=Be.label)==null?void 0:ve.ko)??((Ye=Be.label)==null?void 0:Ye.en)??Be.type;Z.push({caption:`임베더블 추가: ${Qe}`,icon:"link",handler:()=>i.addPredefinedEmbed(v.id,Be.type)})}}const de=i.resolved.value.entities.find(Be=>Be.entity.modelId===v.id);Z.push({type:"separator"}),Z.push({caption:de!=null&&de.collapsed?"펼치기":"접기",icon:de!=null&&de.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(v.id,!(de!=null&&de.collapsed))}),(de==null?void 0:de.groupRef)&&Z.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(v.id)}),Z.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:v.id},i.copy()}});const xe=i.clipboard.value;(xe==null?void 0:xe.kind)==="attribute"&&Z.push({caption:xe.attributes.length>1?`속성 붙여넣기 (${xe.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:v.id},i.paste()}}),Z.push({type:"separator"}),Z.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(v.id)}),(Ao=Se.value)==null||Ao.open(z,Z)}function O({event:w,edge:v}){var J,Z;const z=w;if(z.preventDefault(),!i.editable.value)return;const pe=g(v.id);if(pe){(J=Se.value)==null||J.open(z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(pe.noteRef,pe.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(pe.noteRef,pe.targetRef)}]);return}(Z=Se.value)==null||Z.open(z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(v.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(v.id)}])}function oe(w){return w==="group"?"group":w==="note"?"note":"entity"}function j({node:w}){if(ne.value.length>1){i.selection.value=null;return}i.selection.value={kind:oe(w.type),id:w.id}}function k({nodes:w}){w.length>1&&(i.selection.value=null)}function $({edge:w}){const v=g(w.id);i.selection.value=v?{kind:"note",id:v.noteRef}:{kind:"association",id:w.id}}function L(w){const v=i.selection.value;return!!v&&v.kind!=="attribute"&&v.id===w.id}function Q(w){var v,z;return L(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"?ld(Xe((v=w.data)==null?void 0:v.style),!0)??"var(--em-mm-group)":ld(Xe((z=w.data)==null?void 0:z.style))??"var(--em-mm-entity)"}function ce(w){return L(w)?"var(--em-selection)":w.type==="note"?"var(--em-note-accent)":w.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function me(w,v){te(w,v,{zoom:fe().zoom,duration:350})}n.watch(()=>i.focusRequest.value,w=>{if(!w)return;const v=y(w.id);if(!v)return;const z=v.computedPosition??v.position,pe=v.dimensions??{width:0,height:0};me(z.x+pe.width/2,z.y+pe.height/2)});function he({position:w}){me(w.x,w.y)}function we({node:w}){i.selection.value={kind:oe(w.type),id:w.id};const v=w.computedPosition??w.position,z=w.dimensions??{width:0,height:0};me(v.x+z.width/2,v.y+z.height/2)}function D({node:w}){ie({nodes:[w.id],duration:350,maxZoom:1.2,padding:.6})}return(w,v)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":l.value,"is-panning":r.value}])},[n.createVNode(n.unref(b0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!S.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(At).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ge,onMoveEnd:_e,onConnect:$e,onConnectStart:v[0]||(v[0]=z=>l.value=!0),onConnectEnd:v[1]||(v[1]=z=>l.value=!1),onNodeDrag:ye,onNodeDragStop:be,onNodeClick:j,onEdgeClick:$,onSelectionChange:k,onPaneClick:v[2]||(v[2]=z=>n.unref(i).selection.value=null),onPaneContextMenu:C,onNodeContextMenu:R,onEdgeContextMenu:O},{"node-group":n.withCtx(z=>[n.createVNode(gd,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"node-entity":n.withCtx(z=>[n.createVNode(yd,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"node-note":n.withCtx(z=>[n.createVNode(bd,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"edge-association":n.withCtx(z=>[n.createVNode(Ad,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"edge-note-connection":n.withCtx(z=>[n.createVNode(YN,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Tw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(av),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(UN),{key:1,pannable:"",width:224,height:160,"node-color":Q,"node-stroke-color":ce,"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:he,onNodeClick:we,onNodeDblclick:D})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(nI,{ref_key:"menuRef",ref:Se},null,512)],2))}}),[["__scopeId","data-v-46292641"]]),sI={class:"em-explorer em-scroll-overlay"},cI={class:"em-explorer__rows"},dI=["data-key","onClick","onDblclick"],uI=["onClick"],fI=["title"],mI={class:"em-key-slot"},pI={class:"em-key-slot"},hI={class:"em-explorer__label"},Cu=De(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=le.useModal(),l=n.computed(()=>{var E;const _=i.resolved.value,N=i.displayMode.value,y=S=>{var I,B,G;return To(N,S.name,(B=(I=S.table)==null?void 0:I.logicalName)==null?void 0:B.ko,(G=S.table)==null?void 0:G.physicalName)},x=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",q=S=>{const I=S.attrType.startsWith("RELATION")&&S.dbAttrs.length>0;return{icon:S.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:S.identifier,fk:I&&x}}},P=S=>S.attrType.startsWith("EMBED")&&S.dbAttrs.length>0,K=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",T=S=>{if(S.attrType!=="EMBED_PREDEF")return S.dbAttrs;const I=i.embeddableCatalog.value.find(B=>B.type===S.type);return I?S.dbAttrs.map((B,G)=>{const X=I.fields[G];return X?{...B,physicalName:B.physicalName||X.physicalName,logicalName:B.logicalName??X.logicalName,dataType:B.dataType||X.dataType,length:B.length??X.length}:B}):S.dbAttrs},ie=(S,I)=>{var A,ae,se;const B={entityId:I,attrId:S.modelId};if(P(S)){const ge=sa(N,S);return{key:`attr:${S.modelId}`,label:S.name+(ge?` : ${ge}`:""),icon:"table",attrRef:B,focusId:I,children:K?T(S).map(_e=>{var re;return{key:`attr:${S.modelId}:col:${_e.modelId}`,label:To(N,_e.physicalName,(re=_e.logicalName)==null?void 0:re.ko,_e.physicalName)+(_e.dataType?` : ${_e.dataType}`:""),icon:"field",attrRef:B,focusId:I,children:[]}}):[]}}const G=Jl(S,i.state.logical.associations),X=sa(N,S,G);return{key:`attr:${S.modelId}`,label:To(N,S.name,(ae=(A=S.dbAttrs[0])==null?void 0:A.logicalName)==null?void 0:ae.ko,(se=S.dbAttrs[0])==null?void 0:se.physicalName)+(X?` : ${X}`:""),...q(S),attrRef:B,focusId:I,children:[]}},te=S=>{const I=S.entity,B=[...I.attributes].sort((G,X)=>G.order-X.order);return{key:`entity:${I.modelId}`,label:y(I),icon:"table",selectKind:"entity",selectId:I.modelId,focusId:I.modelId,children:B.map(G=>ie(G,I.modelId))}},fe=new Map,M=[];for(const S of _.entities)if(S.groupRef){const I=fe.get(S.groupRef)??[];I.push(S),fe.set(S.groupRef,I)}else M.push(S);const ne=[];for(const S of _.groups){const I=S.group;ne.push({key:`group:${I.modelId}`,label:((E=I.name)==null?void 0:E.ko)||I.packageName||"(그룹)",icon:"folder",focusId:I.modelId,children:(fe.get(I.modelId)??[]).map(te)})}for(const S of M)ne.push(te(S));if(_.associations.length){const S=new Map(_.entities.map(I=>[I.entity.modelId,y(I.entity)]));ne.push({key:"section:associations",label:`관계 (${_.associations.length})`,icon:"arrow-lr",children:_.associations.map(I=>{const B=I.association,G=S.get(B.end1.entityRef)??B.end1.entityRef,X=S.get(B.end2.entityRef)??B.end2.entityRef;return{key:`assoc:${B.modelId}`,label:`${G} — ${X}`,icon:"arrow-lr",selectKind:"association",selectId:B.modelId,children:[]}})})}return _.notes.length&&ne.push({key:"section:notes",label:`노트 (${_.notes.length})`,icon:"note",children:_.notes.map(({note:S})=>{var I;return{key:`note:${S.modelId}`,label:((I=S.memo.split(`
41
- `)[0])==null?void 0:I.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:S.modelId,focusId:S.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:ne}});function r(_){return _?_.pk&&_.fk?"PFK (식별 외래키)":_.pk?"PK (기본키)":_.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(_){const N=new Set(s.value);N.has(_)?N.delete(_):N.add(_),s.value=N}const d=n.computed(()=>{const _=[],N=(y,x)=>{if(_.push({node:y,depth:x}),!s.value.has(y.key))for(const q of y.children)N(q,x+1)};return N(l.value,0),_}),u=n.computed(()=>{const _=[],N=y=>{if(y.children.length){y.key!=="root"&&_.push(y.key);for(const x of y.children)N(x)}};return N(l.value),_}),f=n.computed(()=>!u.value.some(_=>s.value.has(_)));function h(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:h,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(_){const N=i.selection.value;return _.attrRef?(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.attrRef.entityId&&N.ids.includes(_.attrRef.attrId):!!N&&N.kind!=="attribute"&&!!_.selectId&&_.selectKind===N.kind&&_.selectId===N.id}function p(_){const N=i.selection.value;return _.selectKind==="entity"&&(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.selectId}function g(_,N){if(_.attrRef){const y=N.shiftKey?"range":N.metaKey||N.ctrlKey?"toggle":"replace";i.selectAttribute(_.attrRef.entityId,_.attrRef.attrId,y)}else _.selectKind&&_.selectId&&(i.selection.value={kind:_.selectKind,id:_.selectId});_.focusId&&i.requestFocus(_.focusId)}function b(_){_.selectKind==="entity"&&_.selectId&&xi(a,i,_.selectId)}return(_,N)=>(n.openBlock(),n.createElementBlock("section",sI,[n.createElementVNode("div",cI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:y,depth:x})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":p(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+x*14+"px"}),onClick:q=>g(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(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,uI),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",mI,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",pI,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,fI)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",hI,n.toDisplayString(y.label),1)],46,dI))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),yI={class:"em-text-preview"},gI={class:"em-text-preview__pre"},bI={class:"em-text-preview__actions"},_I=De(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=le.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),le.showNotification("클립보드에 복사되었습니다.","info")}catch{le.showNotification("복사에 실패했습니다.","error")}}return(a,l)=>(n.openBlock(),n.createBlock(n.unref(le.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",yI,[n.createElementVNode("pre",gI,n.toDisplayString(t.text),1),n.createElementVNode("div",bI,[n.createVNode(n.unref(le.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"닫기",onClick:l[0]||(l[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),wI={class:"em-toolbar"},vI={class:"em-toolbar__mode"},Ru=De(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=le.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){const m=i.state.logical.entities.length;i.addEntity("NewEntity",{x:80+m*40,y:80+m*30})}function d(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const u=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(p=>p.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function h(){l.openModal({component:_I,bind:{text:Yl(i.state.logical)}})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",wI,[n.createVNode(n.unref(le.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]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(le.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]=g=>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.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"엔티티 추가",disabled:!n.unref(i).editable.value,onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:p[2]||(p[2]=g=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",vI,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(le.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[3]||(p[3]=g=>s.value=g),items:r,"value-provider":g=>g.v,"label-provider":g=>g.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:d},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(le.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[4]||(p[4]=g=>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(le.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[5]||(p[5]=g=>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(le.BSButton),{variant:"text",caption:u.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:u.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),p[12]||(p[12]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[6]||(p[6]=g=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",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(le.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=g=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b9382781"]]),EI=De(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(le.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(Ve,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),kI=["disabled"],NI={class:"em-panel__sub"},II={class:"em-nav"},$I={key:0,class:"em-nav__divider","aria-hidden":"true"},xI={key:1},SI=["onClick","onKeydown"],CI={class:"em-nav__name"},RI=["title"],VI={key:0,class:"em-panel__note"},AI=["data-attr-block"],TI={class:"em-attr__row"},MI={key:0,class:"em-attr__row"},BI={class:"em-attr__row"},DI={class:"em-attr__row"},OI={class:"em-attr__flags"},LI={class:"em-attr__pii"},PI={class:"em-attr__pii"},zI={class:"em-attr__pii"},UI={key:0,class:"em-attr__pii em-attr__codetop"},HI={class:"em-multilang"},FI={key:2,class:"em-embed-cols"},GI={class:"em-embed-col__label"},YI={class:"em-attr__row"},WI={class:"em-attr__row"},KI={key:0,class:"em-embed-upd"},qI={class:"em-embed-upd"},XI={class:"em-embed-upd"},jI={class:"em-swatch__row em-attr__swatch"},ZI=["onClick"],JI=["title","onClick"],QI={key:0,class:"em-attr__swatch-hint"},Qi="__OWN__",e$=De(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(H=>H.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(H=>H.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.attributes.filter(ee=>ee.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.attributes)??[]}),d=n.computed(()=>s.value.filter(H=>r.value.has(H.modelId)));function u(H){return{pk:H.identifier,fk:H.attrType.startsWith("RELATION")&&H.dbAttrs.length>0,required:H.notNull&&!H.identifier}}function f(H){const ee=u(H),F=[ee.pk&&"PK",ee.fk&&"FK",ee.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function h(H,ee){i.value&&o.selectAttribute(i.value.modelId,H.modelId,ee.shiftKey?"range":ee.metaKey||ee.ctrlKey?"toggle":"replace")}const m=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function p(H){return H==="none"?"(없음)":H}const g=H=>H;function b(H){var ee,F;return Xe((F=(ee=a.value)==null?void 0:ee.attributeStyles)==null?void 0:F[H.modelId])}function _(H){return r.value.size>1&&r.value.has(H.modelId)}function N(H,ee){if(!i.value)return;const F=_(H)?o.selectedAttrIds.value:[H.modelId];o.setAttributeSwatches(i.value.modelId,F,ee)}function y(H,ee){i.value&&o.updateAttribute(i.value.modelId,H.modelId,ee)}function x(H,ee){y(H,{naturalId:ee||void 0,naturalIdMutable:ee?H.naturalIdMutable:void 0})}function q(){return{naturalId:void 0,naturalIdMutable:void 0}}function P(H,ee){y(H,{identifier:ee,...ee?q():{}})}function K(H,ee){y(H,{transient:ee||void 0,...ee?q():{}})}function T(H){return!!H.transient}const ie=H=>H.value,te=H=>H.label;function fe(H,ee){if(!ee)return;const F=X.value.find(ue=>ue.type===ee);if(F){const ue=H.dbAttrs[0]??{modelId:H.modelId+".c",physicalName:H.name,dataType:"VARCHAR"};y(H,{type:ee,customType:void 0,dbAttrs:[{...ue,dataType:F.dataType,length:F.length,scale:F.scale}]});return}y(H,ee===Jt?{type:ee}:{type:ee,customType:void 0})}function M(H,ee){y(H,{customType:ee.trim()===""?void 0:ee})}function ne(H,ee){const ue={...H.dbAttrs[0]??{modelId:H.modelId+".c",physicalName:H.name,dataType:"VARCHAR"},...ee};ee.dataType!==void 0&&!Mo.has(ue.dataType)&&(ue.scale=void 0),y(H,{dbAttrs:[ue]})}function E(H){var ee;return Mo.has(((ee=H.dbAttrs[0])==null?void 0:ee.dataType)??"")}function S(H,ee,F){var ue;ne(H,{logicalName:{...(ue=H.dbAttrs[0])==null?void 0:ue.logicalName,[ee]:F}})}function I(H,ee){y(H,{description:Object.keys(ee).length?ee:void 0})}function B(H){return H.personalInfoAttributeType??"none"}function G(H,ee){y(H,{personalInfoAttributeType:ee==="none"?void 0:ee})}const X=n.computed(()=>o.predefinedCustomTypeCatalog.value),A=n.computed(()=>o.embeddableCatalog.value),ae=n.ref(void 0);function se(H){var ee,F;return((ee=H.label)==null?void 0:ee.ko)??((F=H.label)==null?void 0:F.en)??H.type}function ge(H){if(!H||!i.value)return;const ee=o.addPredefinedEmbed(i.value.modelId,H);ee&&o.selectAttribute(i.value.modelId,ee),ae.value=void 0}function _e(){if(!i.value)return;const H=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,H)}const re=n.computed(()=>o.groupCodeCatalog.value);function ye(H){var ee;return((ee=re.value.find(F=>F.groupCode===H.groupCode))==null?void 0:ee.codes)??[]}function be(H){return["none",...ye(H)]}function $e(H){return H==="none"?"none":H.code}function Se(H){var F,ue;if(H==="none")return"(없음)";const ee=((F=H.label)==null?void 0:F.ko)??((ue=H.label)==null?void 0:ue.en);return ee?`${H.code} (${ee})`:H.code}function Ce(H,ee){i.value&&o.setAttributeGroupCode(i.value.modelId,H.modelId,ee)}function Y(H,ee){y(H,{defaultValue:ee==="none"?void 0:ee})}function U(H,ee){y(H,{defaultValue:ee.trim()===""?void 0:ee})}function V(H){return H.attrType.startsWith("EMBED")&&H.dbAttrs.length>0}function C(H,ee,F){const ue=H.dbAttrs.map((Ae,Je)=>{if(Je!==ee)return Ae;const nt={...Ae,...F};for(const Pe of Object.keys(F))F[Pe]===void 0&&delete nt[Pe];return nt});i.value&&o.setEmbedColumns(i.value.modelId,H.modelId,ue)}function R(H,ee,F,ue){var Ae;C(H,ee,{logicalName:{...(Ae=H.dbAttrs[ee])==null?void 0:Ae.logicalName,[F]:ue}})}function O(H,ee){var Ae,Je,nt;if(H.attrType==="EMBED_PREDEF"){const Pe=(Ae=o.embeddableCatalog.value.find(kt=>kt.type===H.type))==null?void 0:Ae.fields[ee];return Pe?{name:Pe.name,physicalName:Pe.physicalName,dataType:Pe.dataType,length:Pe.length,shareable:Pe.shareable,logicalName:Pe.logicalName}:void 0}const F=(Je=H.embedded)==null?void 0:Je.embeddableRef;if(!F)return;const ue=(nt=o.state.logical.entities.find(Pe=>Pe.modelId===F))==null?void 0:nt.attributes.flatMap(Pe=>Pe.dbAttrs)[ee];return ue?{physicalName:ue.physicalName,dataType:ue.dataType,length:ue.length,scale:ue.scale,logicalName:ue.logicalName}:void 0}function oe(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.dataType)||((ue=H.dbAttrs[ee])==null?void 0:ue.dataType)||""}function j(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.length)??((ue=H.dbAttrs[ee])==null?void 0:ue.length)}function k(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.scale)??((ue=H.dbAttrs[ee])==null?void 0:ue.scale)}const $=["inherit","true","false"];function L(H){return H==="inherit"?"기본(따름)":H}function Q(H){return(H==null?void 0:H.updatable)===void 0?"inherit":H.updatable?"true":"false"}function ce(H,ee,F){C(H,ee,{updatable:F==="inherit"?void 0:F==="true"})}function me(H,ee){ne(H,{updatable:ee==="inherit"?void 0:ee==="true"})}const he=["inherit","true","false"];function we(H){return H==="inherit"?"기본(따름)":H}function D(H){return(H==null?void 0:H.insertable)===void 0?"inherit":H.insertable?"true":"false"}function w(H,ee,F){C(H,ee,{insertable:F==="inherit"?void 0:F==="true"})}function v(H,ee){ne(H,{insertable:ee==="inherit"?void 0:ee==="true"})}const z=n.computed(()=>{var H;return Wn(((H=i.value)==null?void 0:H.attributes.flatMap(ee=>ee.dbAttrs))??[])}),pe=n.computed(()=>{var H;return(((H=i.value)==null?void 0:H.attributes)??[]).filter(ee=>ee.attrType==="NORMAL"&&ee.dbAttrs.length===1&&ee.dbAttrs[0]).map(ee=>({modelId:ee.dbAttrs[0].modelId,label:ee.dbAttrs[0].physicalName||ee.name}))});function J(){return[Qi,...pe.value.map(H=>H.modelId)]}function Z(H){if(H===Qi)return"전용 컬럼(OWN)";const ee=pe.value.find(F=>F.modelId===H);return ee?`↗ ${ee.label} (공유)`:H}function W(H){return(H==null?void 0:H.sharedColumnRef)??Qi}function de(H,ee,F){C(H,ee,{sharedColumnRef:F===Qi?void 0:F})}function ke(H){return(H==null?void 0:H.sharedColumnRef)!=null}function xe(H){var ee;return((ee=Do(H,z.value))==null?void 0:ee.physicalName)??""}return(H,ee)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",NI,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:_e}),A.value.length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":ae.value,items:A.value,"value-provider":F=>F.type,"label-provider":se,"onUpdate:modelValue":ge},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",II,[(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",$I,[...ee[0]||(ee[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",xI,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:ue=>h(F,ue),onKeydown:[n.withKeys(n.withModifiers(ue=>h(F,ue),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ue=>h(F,ue),["prevent"]),["space"])]},[n.createElementVNode("span",CI,n.toDisplayString(F.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(F)},[u(F).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,RI)],42,SI)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",VI," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var ue,Ae,Je,nt,Pe,kt,qt,Xt,jt,Ge,Vo;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",TI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:"이름","model-value":F.name,"onUpdate:modelValue":ve=>y(F,{name:ve})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:"타입",disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Zl)(F.type,X.value),"value-provider":ie,"label-provider":te,"model-value":F.type,"onUpdate:modelValue":ve=>fe(F,ve)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ve=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])]),F.type===n.unref(Jt)?(n.openBlock(),n.createElementBlock("div",MI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":F.customType??"","onUpdate:modelValue":ve=>M(F,ve)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),V(F)?(n.openBlock(),n.createElementBlock("div",FI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(ve,Ye)=>{var Ao,Be,Qe,Nt,It,Fn,Zt;return n.openBlock(),n.createElementBlock("div",{key:ve.modelId,class:"em-embed-col"},[n.createElementVNode("span",GI,n.toDisplayString(((Ao=O(F,Ye))==null?void 0:Ao.name)??((Be=O(F,Ye))==null?void 0:Be.physicalName)??`컬럼 ${Ye+1}`),1),n.createElementVNode("div",YI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`embed-col-${ve.modelId}`,width:"100%",disabled:ke(ve),placeholder:((Qe=O(F,Ye))==null?void 0:Qe.physicalName)??"컬럼","model-value":ke(ve)?xe(ve):ve.physicalName,"onUpdate:modelValue":ot=>C(F,Ye,{physicalName:ot})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSTextInput),{name:`embed-dtype-${ve.modelId}`,width:"84px",disabled:"","model-value":oe(F,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(le.BSNumberInput),{name:`embed-len-${ve.modelId}`,width:"48px",disabled:"","model-value":j(F,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(le.BSNumberInput),{name:`embed-scale-${ve.modelId}`,width:"48px",disabled:"","model-value":k(F,Ye)},null,8,["name","model-value"])]),n.createVNode(hn,{controller:n.unref(o),"ref-id":ve.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",WI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`embed-logical-${ve.modelId}`,width:"100%",placeholder:((It=(Nt=O(F,Ye))==null?void 0:Nt.logicalName)==null?void 0:It.ko)??"논리명","model-value":((Fn=ve.logicalName)==null?void 0:Fn.ko)??"","onUpdate:modelValue":ot=>R(F,Ye,"ko",ot)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Zt=O(F,Ye))!=null&&Zt.shareable?(n.openBlock(),n.createElementBlock("label",KI,[ee[7]||(ee[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px","model-value":W(ve),items:J(),"value-provider":g,"label-provider":Z,"onUpdate:modelValue":ot=>ot&&de(F,Ye,ot)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",qI,[ee[8]||(ee[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px",disabled:ke(ve),"model-value":ke(ve)?"false":D(ve),items:he,"value-provider":g,"label-provider":we,"onUpdate:modelValue":ot=>ot&&w(F,Ye,ot)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",XI,[ee[9]||(ee[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px",disabled:ke(ve),"model-value":ke(ve)?"false":Q(ve),items:$,"value-provider":g,"label-provider":L,"onUpdate:modelValue":ot=>ot&&ce(F,Ye,ot)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",BI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-logical-${F.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ae=(ue=F.dbAttrs[0])==null?void 0:ue.logicalName)==null?void 0:Ae.ko)??"","onUpdate:modelValue":ve=>S(F,"ko",ve)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",DI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:"컬럼",disabled:T(F),"model-value":((Je=F.dbAttrs[0])==null?void 0:Je.physicalName)??"","onUpdate:modelValue":ve=>ne(F,{physicalName:ve})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:T(F),items:n.unref(ql)(((nt=F.dbAttrs[0])==null?void 0:nt.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(ra),"model-value":((Pe=F.dbAttrs[0])==null?void 0:Pe.dataType)??"","onUpdate:modelValue":ve=>ve&&ne(F,{dataType:ve})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:T(F),"model-value":(kt=F.dbAttrs[0])==null?void 0:kt.length,"onUpdate:modelValue":ve=>ne(F,{length:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:T(F)||!E(F),"model-value":(qt=F.dbAttrs[0])==null?void 0:qt.scale,"onUpdate:modelValue":ve=>ne(F,{scale:ve||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(hn,{controller:n.unref(o),"ref-id":(Xt=F.dbAttrs[0])==null?void 0:Xt.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",OI,[n.createVNode(n.unref(le.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:l.value||T(F),"onUpdate:modelValue":ve=>P(F,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:T(F),"onUpdate:modelValue":ve=>y(F,{notNull:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((jt=F.dbAttrs[0])!=null&&jt.unique),disabled:T(F),"onUpdate:modelValue":ve=>ne(F,{unique:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Ge=F.dbAttrs[0])!=null&&Ge.autoIncrement),disabled:T(F)||!F.identifier,"onUpdate:modelValue":ve=>ne(F,{autoIncrement:ve})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-tr-${F.modelId}`,label:"@Transient","model-value":!!F.transient,disabled:F.identifier,"onUpdate:modelValue":ve=>K(F,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||T(F),"onUpdate:modelValue":ve=>x(F,ve)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:T(F)||!F.naturalId,"onUpdate:modelValue":ve=>y(F,{naturalIdMutable:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((Vo=F.dbAttrs[0])!=null&&Vo.multiValue),disabled:T(F),"onUpdate:modelValue":ve=>ne(F,{multiValue:ve||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",LI,[ee[1]||(ee[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:T(F),"model-value":D(F.dbAttrs[0]),items:he,"value-provider":g,"label-provider":we,"onUpdate:modelValue":ve=>ve&&v(F,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",PI,[ee[2]||(ee[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:T(F),"model-value":Q(F.dbAttrs[0]),items:$,"value-provider":g,"label-provider":L,"onUpdate:modelValue":ve=>ve&&me(F,ve)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",zI,[ee[3]||(ee[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":B(F),items:m,"value-provider":g,"label-provider":p,"onUpdate:modelValue":ve=>ve&&G(F,ve)},null,8,["model-value","onUpdate:modelValue"])]),re.value.length?(n.openBlock(),n.createElementBlock("label",UI,[ee[4]||(ee[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(cd,{"model-value":F.groupCode,items:re.value,"onUpdate:modelValue":ve=>Ce(F,ve)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!re.value.length}])},[ee[5]||(ee[5]=n.createElementVNode("span",null,"기본값",-1)),ye(F).length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:be(F),"value-provider":$e,"label-provider":Se,"onUpdate:modelValue":ve=>ve&&Y(F,ve)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:"기본값","model-value":F.defaultValue??"","onUpdate:modelValue":ve=>U(F,ve)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",HI,[ee[6]||(ee[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(dl,{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":ve=>I(F,ve)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",jI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(F)===null}]),title:"없음",onClick:ve=>N(F,null)},"∅",10,ZI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),ve=>(n.openBlock(),n.createElementBlock("button",{key:ve,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(F)===ve}]),style:n.normalizeStyle({background:n.unref(Bn)(ve)}),title:n.unref(Mn)(ve),onClick:Ye=>N(F,ve)},null,14,JI))),128)),_(F)?(n.openBlock(),n.createElementBlock("span",QI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,AI)}),128))],8,kI)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-5b6c4296"]]),t$=["disabled"],n$={class:"em-panel__sub-label"},o$={class:"em-attr__row"},i$={class:"em-field em-idx-params"},a$=["value","onChange"],l$=De(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:Te(),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 g;const p=(g=l.value)==null?void 0:g.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:g}:b)})}function u(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:g}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((g,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var g;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",n$,[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(((g=l.value.indexes)==null?void 0:g.length)??0)+") ",1)]),n.createVNode(n.unref(le.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",o$,[n.createVNode(n.unref(le.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(le.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(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(hn,{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,(_,N)=>(n.openBlock(),n.createElementBlock("div",{key:N,class:"em-attr__row"},[n.createVNode(n.unref(le.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&d(b,N,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`idx-${b.modelId}-desc-${N}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":y=>u(b,N,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"−",onClick:y=>f(b,N)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",i$,[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,a$)])]))),128)):n.createCommentVNode("",!0)],8,t$)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),r$=["disabled"],s$={class:"em-panel__sub-label"},c$={class:"em-attr__row"},d$={class:"em-attr__row"},u$={class:"em-multilang"},f$={class:"em-attr__pii"},m$={class:"em-swatch__row em-attr__swatch"},p$=["onClick"],h$=["title","onClick"],y$=De(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=le.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 h(y,x){r.value&&a.updateOperation(r.value.modelId,y.modelId,x)}function m(y,x){h(y,{description:Object.keys(x).length?x:void 0})}function p(y){return y.personalInfoAttributeType??"none"}function g(y,x){h(y,{personalInfoAttributeType:x==="none"?void 0:x})}function b(y){var x,q;return Xe((q=(x=s.value)==null?void 0:x.operationStyles)==null?void 0:q[y.modelId])}function _(y,x){r.value&&a.setOperationSwatch(r.value.modelId,y.modelId,x)}function N(y){l.openModal({component:dd,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:x=>h(y,{sourceCode:x})}})}return(y,x)=>{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:x[1]||(x[1]=P=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",s$,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((q=r.value.operations)==null?void 0:q.length)??0)+") ",1)]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:x[0]||(x[0]=n.withModifiers(P=>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??[],P=>(n.openBlock(),n.createElementBlock("div",{key:P.modelId,class:"em-attr"},[n.createElementVNode("div",c$,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`op-name-${P.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":P.name,"onUpdate:modelValue":K=>h(P,{name:K})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{width:"96px","model-value":P.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":K=>K&&h(P,{visibility:K})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:K=>n.unref(a).removeOperation(r.value.modelId,P.modelId)},null,8,["onClick"])]),n.createElementVNode("div",d$,[n.createVNode(n.unref(le.BSButton),{variant:"text",caption:P.sourceCode?"본문 편집 ●":"본문 편집",onClick:K=>N(P)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",u$,[x[2]||(x[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(dl,{multiline:"",name:`op-desc-${P.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":K=>m(P,K)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",f$,[x[3]||(x[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":p(P),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":K=>K&&g(P,K)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",m$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(P)===null}]),title:"없음",onClick:K=>_(P,null)},"∅",10,p$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),K=>(n.openBlock(),n.createElementBlock("button",{key:K,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(P)===K}]),style:n.normalizeStyle({background:n.unref(Bn)(K)}),title:n.unref(Mn)(K),onClick:T=>_(P,K)},null,14,h$))),128))])]))),128)):n.createCommentVNode("",!0)],8,r$)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),g$={class:"em-panel__head"},b$={class:"em-panel__head-row"},_$={class:"em-panel__context"},w$=["disabled"],v$={key:0,class:"em-panel__note"},E$={key:1,class:"em-panel__note"},k$={key:2,class:"em-jpa"},N$={class:"em-field"},I$={class:"em-field"},$$={key:0,class:"em-field"},x$={class:"em-panel__sub"},S$={class:"em-field"},C$={class:"em-jpa"},R$={key:0,class:"em-panel__note"},V$={class:"em-jpa"},A$={class:"em-field"},T$={key:0,class:"em-panel__note"},M$={class:"em-field"},B$={class:"em-multilang"},D$={class:"em-field"},O$=["value"],L$={class:"em-field"},P$={class:"em-swatch"},z$={class:"em-swatch__row"},U$=["title","onClick"],H$={class:"em-panel__note"},F$={class:"em-field"},G$=["value"],Y$={class:"em-swatch"},W$={class:"em-swatch__row"},K$=["title","onClick"],Vu=De(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 Y=r.value;return Y?a.state.logical.entities.find(U=>U.modelId===Y)??null:null}),c=n.computed(()=>{var Y;return((Y=a.selectedAttr.value)==null?void 0:Y.attrId)??null}),d=n.computed(()=>new Set(a.selectedAttrIds.value)),u=n.computed(()=>c.value!==null),f=n.ref({});n.watch(u,()=>{f.value={}});function h(Y){return f.value[Y]??u.value}function m(Y){f.value={...f.value,[Y]:!h(Y)}}const p=n.computed(()=>{var V;const Y=s.value;if(!Y)return"엔티티";const U=(V=Y.table)==null?void 0:V.physicalName;return U?`${Y.name} (${U})`:Y.name}),g=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="association"?a.state.logical.associations.find(U=>U.modelId===Y.id)??null:null}),b=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="group"?a.state.logical.groups.find(U=>U.modelId===Y.id)??null:null}),_=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="note"?a.state.layout.notes.find(U=>U.modelId===Y.id)??null:null}),N=n.computed(()=>{var U,V;const Y=(U=b.value)==null?void 0:U.name;return(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((V=b.value)==null?void 0:V.packageName)||"그룹"}),y=n.computed(()=>{if(s.value){const Y=d.value.size;if(Y>1)return`엔티티 · ${s.value.name} › 속성 · ${Y}개`;if(c.value){const U=s.value.attributes.find(V=>V.modelId===c.value);return(U==null?void 0:U.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(U==null?void 0:U.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const Y=U=>{var V;return((V=a.state.logical.entities.find(C=>C.modelId===U))==null?void 0:V.name)??U};return`관계 · ${Y(g.value.end1.entityRef)} — ${Y(g.value.end2.entityRef)}`}return b.value?`그룹 · ${N.value}`:_.value?"노트":"선택된 항목 없음"}),x=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],q=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],P=["LIST","SET"],K=["inherit","LAZY","EAGER"],T=Y=>Y;function ie(Y){return Y==="inherit"?"기본(따름)":Y}const te=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function fe(Y,U){g.value&&a.updateAssociationEnd(g.value.modelId,Y,U)}function M(Y){g.value&&!te.value&&a.setAssociationIdentifying(g.value.modelId,Y)}function ne(Y){var U,V,C;return!!((C=(V=(U=g.value)==null?void 0:U[Y].jpa)==null?void 0:V.cascadeTypes)!=null&&C.includes("ALL"))}function E(Y,U,V){var O,oe;const C=(O=g.value)==null?void 0:O[Y];if(U==="ALL"&&V){fe(Y,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:["ALL"]}});return}const R=new Set(((oe=C==null?void 0:C.jpa)==null?void 0:oe.cascadeTypes)??[]);V?R.add(U):R.delete(U),fe(Y,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:[...R]}})}function S(Y,U){var C;const V=(C=g.value)==null?void 0:C[Y];fe(Y,{jpa:{...V==null?void 0:V.jpa,...U}})}function I(Y){var U,V;return((V=(U=g.value)==null?void 0:U[Y].jpa)==null?void 0:V.fetchType)??"inherit"}function B(Y,U){S(Y,{fetchType:U==="inherit"?void 0:U})}function G(Y){var V;const U=(V=g.value)==null?void 0:V[Y==="end1"?"end2":"end1"];return(U==null?void 0:U.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(U==null?void 0:U.multiplicity)==="ONE_OR_MORE_INSTANCES"}const X=n.computed(()=>{const Y=g.value;if(!Y)return null;for(const U of a.state.logical.entities){const V=U.attributes.find(O=>{var oe;return((oe=O.embedded)==null?void 0:oe.associationRef)===Y.modelId&&O.attrType==="EMBED_OWN"});if(!V)continue;const C=Y.end2.entityRef===V.embedded.embeddableRef?"end2":"end1",R=Y[C].jpa;return{which:C,isCollection:Y[C].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 A(Y){g.value&&a.setEmbedCollectionMode(g.value.modelId,Y?"COLLECTION":"SINGLE")}function ae(Y){const U=X.value;U&&S(U.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function se(Y){const U=X.value;U&&S(U.which,{collectionTable:Y.trim()||void 0})}function ge(Y){const U=X.value;U&&S(U.which,{orderColumn:Y.trim()||void 0})}function _e(Y){b.value&&a.updateGroup(b.value.modelId,Y)}function re(Y,U){var V;_e({name:{...(V=b.value)==null?void 0:V.name,[Y]:U}})}const ye=n.computed(()=>{var Y;return b.value?Xe((Y=a.state.layout.groupLayouts.find(U=>U.groupRef===b.value.modelId))==null?void 0:Y.style):null});function be(Y){b.value&&a.setGroupSwatch(b.value.modelId,Y)}function $e(Y){_.value&&a.setNoteMemo(_.value.modelId,Y)}const Se=n.computed(()=>{var Y;return Xe((Y=_.value)==null?void 0:Y.style)});function Ce(Y){_.value&&a.setNoteSwatch(_.value.modelId,Y)}return(Y,U)=>(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:U[0]||(U[0]=(...V)=>e.startResize&&e.startResize(...V))},null,34),n.createElementVNode("header",g$,[n.createElementVNode("div",b$,[U[12]||(U[12]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:U[1]||(U[1]=V=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",_$,n.toDisplayString(y.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(rd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("basics"),title:p.value,onToggle:U[2]||(U[2]=V=>m("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(e$,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(l$,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("index"),onToggle:U[3]||(U[3]=V=>m("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(y$,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("ops"),onToggle:U[4]||(U[4]=V=>m("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(le.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!g.value.identifying,disabled:te.value||!!X.value,"onUpdate:modelValue":M},null,8,["model-value","disabled"]),te.value?(n.openBlock(),n.createElementBlock("p",v$,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):X.value?(n.openBlock(),n.createElementBlock("p",E$,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),X.value?(n.openBlock(),n.createElementBlock("fieldset",k$,[U[16]||(U[16]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(le.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":X.value.isCollection,"onUpdate:modelValue":A},null,8,["model-value"]),X.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",N$,[U[13]||(U[13]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":X.value.collectionType,items:P,"value-provider":T,"label-provider":T,"onUpdate:modelValue":U[5]||(U[5]=V=>V&&ae(V))},null,8,["model-value"])]),n.createElementVNode("label",I$,[U[14]||(U[14]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":X.value.collectionTable,"onUpdate:modelValue":se},null,8,["model-value"])]),X.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",$$,[U[15]||(U[15]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":X.value.orderColumn,"onUpdate:modelValue":ge},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),U[17]||(U[17]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],V=>{var C,R,O,oe;return n.createElementVNode("div",{key:V,class:"em-end"},[n.createElementVNode("h4",x$,n.toDisplayString(V)+" → "+n.toDisplayString(g.value[V].entityRef),1),n.createElementVNode("label",S$,[U[18]||(U[18]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":g.value[V].multiplicity,items:x,"value-provider":T,"label-provider":T,disabled:((C=X.value)==null?void 0:C.which)===V,"onUpdate:modelValue":j=>fe(V,{multiplicity:j})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-navigable`,class:"em-check",label:"navigable","model-value":g.value[V].navigable,"onUpdate:modelValue":j=>fe(V,{navigable:j})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-composition`,class:"em-check",label:"composition","model-value":g.value[V].composition,"onUpdate:modelValue":j=>fe(V,{composition:j})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",C$,[U[19]||(U[19]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(q,j=>{var k,$;return n.createVNode(n.unref(le.BSCheckbox),{key:j,name:`${V}-cascade-${j}`,class:"em-check",label:j,"model-value":!!(($=(k=g.value[V].jpa)==null?void 0:k.cascadeTypes)!=null&&$.includes(j)),disabled:j!=="ALL"&&ne(V),"onUpdate:modelValue":L=>E(V,j,L)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ne(V)?(n.openBlock(),n.createElementBlock("p",R$,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",V$,[U[22]||(U[22]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",A$,[U[20]||(U[20]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":I(V),items:K,"value-provider":T,"label-provider":ie,"onUpdate:modelValue":j=>j&&B(V,j)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((R=g.value[V].jpa)!=null&&R.orphanRemoval),disabled:G(V),"onUpdate:modelValue":j=>S(V,{orphanRemoval:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),G(V)&&((O=g.value[V].jpa)!=null&&O.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",T$,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",M$,[U[21]||(U[21]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(le.BSTextInput),{name:`${V}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((oe=g.value[V].jpa)==null?void 0:oe.orderBy)??"","onUpdate:modelValue":j=>S(V,{orderBy:j.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",B$,[U[23]||(U[23]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,V=>{var C;return n.openBlock(),n.createElementBlock("label",{key:V,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(V),1),n.createVNode(n.unref(le.BSTextInput),{name:`grp-name-${V}`,width:"100%","model-value":((C=b.value.name)==null?void 0:C[V])??"","onUpdate:modelValue":R=>re(V,R)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",D$,[U[24]||(U[24]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:U[6]||(U[6]=V=>_e({description:V.target.value}))},null,40,O$)]),n.createElementVNode("label",L$,[U[25]||(U[25]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":U[7]||(U[7]=V=>_e({packageName:V}))},null,8,["model-value"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":U[8]||(U[8]=V=>_e({excludeDDLGeneration:V}))},null,8,["model-value"]),n.createElementVNode("fieldset",P$,[U[26]||(U[26]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",z$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:U[9]||(U[9]=V=>be(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===V}]),style:n.normalizeStyle({background:n.unref(Bn)(V)}),title:n.unref(Mn)(V),onClick:C=>be(V)},null,14,U$))),128))])]),n.createElementVNode("p",H$,"멤버 엔티티 "+n.toDisplayString(b.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",F$,[U[27]||(U[27]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.memo,rows:"6",onChange:U[10]||(U[10]=V=>$e(V.target.value))},null,40,G$)]),n.createElementVNode("fieldset",Y$,[U[28]||(U[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",W$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:"없음",onClick:U[11]||(U[11]=V=>Ce(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Se.value===V}]),style:n.normalizeStyle({background:n.unref(Bn)(V)}),title:n.unref(Mn)(V),onClick:C=>Ce(V)},null,14,K$))),128))])])],64)):n.createCommentVNode("",!0)],8,w$)],4))}}),[["__scopeId","data-v-c5358a75"]]),q$={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function X$(e){const t=e.split("-")[1];return t?q$[t]??t:e}function j$(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Z$=["title"],J$=["title","onClick"],Q$={key:0,class:"em-validation__body"},ex={class:"em-validation__opt"},tx={key:0,class:"em-validation__empty"},nx={key:1,class:"em-validation__empty"},ox={key:2,class:"em-validation__list"},ix=["onClick"],ax={class:"em-validation__item-msg"},lx={key:0,class:"em-validation__item-entity"},rx=["title"],sx=De(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const b of o.state.logical.entities)g.set(b.modelId,b.name);return g});function l(g){const b=j$(g);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 g={error:0,warning:0,info:0};for(const b of i.value)g[b.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,b)=>r[g.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:l(g),category:X$(g.ruleId)}))),f=n.ref(!1);function h(g){c.value[g]=!c.value[g]}function m(g){if(!f.value){f.value=!0;return}h(g)}function p(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,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,Z$),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:N=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,J$)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",Q$,[n.createElementVNode("label",ex,[n.createVNode(n.unref(le.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",tx,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",nx," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",ox,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:N,category:y},x)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${x}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:q=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",ax,[N?(n.openBlock(),n.createElementBlock("span",lx,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(y),9,rx)],10,ix))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),cx={class:"em-history"},dx={class:"em-history__head"},ux={class:"em-history__title"},fx={class:"em-history__head-actions"},mx=["disabled"],px={class:"em-history__filters"},hx={class:"em-history__filter"},yx={class:"em-history__body"},gx={key:0,class:"em-history__empty"},bx={key:1,class:"em-history__empty is-error"},_x={key:2,class:"em-history__empty"},wx={key:3,class:"em-history__list"},vx=["onClick"],Ex={class:"em-history__summary"},kx={class:"em-history__seq"},Nx={class:"em-history__gmeta"},Ix={class:"em-history__who"},$x={key:0,class:"em-history__time"},xx={key:1,class:"em-history__restored-from"},Sx={key:0,class:"em-history__detail"},Cx={class:"em-history__action-head"},Rx={class:"em-history__action-name"},Vx={key:0,class:"em-history__fields"},Ax={class:"em-history__fname"},Tx={key:0,class:"em-history__old"},Mx={class:"em-history__val"},Bx={key:1,class:"em-history__restore"},Dx=["disabled","onClick"],Ox=["disabled"],Lx=["onClick"],Px=De(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(A){s.value=A instanceof Error?A.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,A=>{A&&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(A=>[A.modelId,A]))),m=n.computed(()=>new Map(a.state.logical.associations.map(A=>[A.modelId,A]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(A=>{var ae;return[A.modelId,A.packageName||((ae=A.name)==null?void 0:ae.ko)||A.modelId]})));function g(A){var _e,re,ye,be,$e,Se,Ce;const ae=m.value.get(A);if(!ae)return"연관";if((_e=ae.description)!=null&&_e.trim())return ae.description.trim();const se=(be=(ye=h.value.get((re=ae.end1)==null?void 0:re.entityRef))==null?void 0:ye.name)==null?void 0:be.trim(),ge=(Ce=(Se=h.value.get(($e=ae.end2)==null?void 0:$e.entityRef))==null?void 0:Se.name)==null?void 0:Ce.trim();return se&&ge?`${se}→${ge}`:"연관"}function b(A){var ae,se,ge,_e;if(A.kind==="entity")return((se=(ae=h.value.get(A.ref))==null?void 0:ae.name)==null?void 0:se.trim())||"(이름 없음)";if(A.kind==="attribute"||A.kind==="operation"||A.kind==="index"){const re=A.entityRef?h.value.get(A.entityRef):void 0,be=((A.kind==="attribute"?re==null?void 0:re.attributes:A.kind==="operation"?re==null?void 0:re.operations:re==null?void 0:re.indexes)??[]).find(Se=>Se.modelId===A.ref),$e=(ge=re==null?void 0:re.name)==null?void 0:ge.trim();return`${$e?$e+".":""}${((_e=be==null?void 0:be.name)==null?void 0:_e.trim())||A.ref}`}return A.kind==="association"?g(A.ref):A.kind==="associationEnd"?`${g(A.ref)}(${A.end})`:A.kind==="group"?`그룹 ${p.value.get(A.ref)??A.ref}`:A.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),x=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],q=n.computed({get:()=>y.value,set:A=>{A&&(y.value=A)}}),P=n.computed(()=>ir(l.value)),K=n.computed(()=>P.value.length?P.value[0].seq:null),T=n.computed(()=>y.value==="all"?P.value:P.value.filter(A=>(A.kind??"edit")===y.value));function ie(A){return A===void 0?"—":A===null?"(비움)":typeof A=="object"?JSON.stringify(A):String(A)}function te(A){const ae=b(A.subject);if(A.verb==="add")return`${ae} 추가`;if(A.verb==="remove")return`${ae} 삭제`;if(A.fields.length===1){const se=A.fields[0];return`${ae}.${se.field} ${se.oldValue!==void 0?ie(se.oldValue)+"→":""}${ie(se.value)}`}return`${ae} ${A.fields.length}개 변경`}function fe(A){return A.actions.length===0?"변경 없음":A.actions.length===1?te(A.actions[0]):`${te(A.actions[0])} 외 ${A.actions.length-1}건`}const M=n.ref(new Set);function ne(A){const ae=new Set(M.value);ae.has(A)?ae.delete(A):ae.add(A),M.value=ae}function E(A){if(A==null)return"";const ae=new Date(A);return isNaN(ae.getTime())?String(A):ae.toLocaleString()}function S(A){return A.author||(A.origin?`(${A.origin})`:"—")}const I=n.ref(null),B=n.ref(!1);function G(A){I.value=A}async function X(A){B.value=!0;try{const ae=await a.restoreToSeq(A);ae.ok||(s.value=`복원 실패: ${ae.reason??"알 수 없음"}`)}finally{B.value=!1,I.value=null}}return(A,ae)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",cx,[n.createElementVNode("header",dx,[n.createElementVNode("div",ux,[n.createVNode(Ve,{name:"undo",size:15}),ae[4]||(ae[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",fx,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:ae[0]||(ae[0]=se=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,mx),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:ae[1]||(ae[1]=se=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",px,[n.createElementVNode("label",hx,[ae[5]||(ae[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(le.BSSelect),{modelValue:q.value,"onUpdate:modelValue":ae[2]||(ae[2]=se=>q.value=se),items:x,"value-provider":se=>se.v,"label-provider":se=>se.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",yx,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",gx,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",bx,n.toDisplayString(s.value),1)):T.value.length===0?(n.openBlock(),n.createElementBlock("p",_x,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",wx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,se=>(n.openBlock(),n.createElementBlock("li",{key:se.seq,class:n.normalizeClass(["em-history__group",[`is-${se.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ge=>ne(se.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":M.value.has(se.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${se.kind??"edit"}`])},n.toDisplayString(se.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",Ex,n.toDisplayString(fe(se)),1),n.createElementVNode("span",kx,"#"+n.toDisplayString(se.seq),1)],8,vx),n.createElementVNode("div",Nx,[n.createElementVNode("span",Ix,n.toDisplayString(S(se)),1),se.ts?(n.openBlock(),n.createElementBlock("span",$x,n.toDisplayString(E(se.ts)),1)):n.createCommentVNode("",!0),se.kind==="restore"&&se.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",xx,"← #"+n.toDisplayString(se.restoredFromSeq),1)):n.createCommentVNode("",!0)]),M.value.has(se.seq)?(n.openBlock(),n.createElementBlock("div",Sx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.actions,(ge,_e)=>(n.openBlock(),n.createElementBlock("div",{key:_e,class:"em-history__action"},[n.createElementVNode("div",Cx,[n.createVNode(Ve,{name:_[ge.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",Rx,n.toDisplayString(b(ge.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ge.verb}`])},n.toDisplayString(N[ge.verb]),3)]),ge.fields.length?(n.openBlock(),n.createElementBlock("ul",Vx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.fields,(re,ye)=>(n.openBlock(),n.createElementBlock("li",{key:ye,class:"em-history__field"},[n.createElementVNode("span",Ax,n.toDisplayString(re.field),1),re.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",Tx,n.toDisplayString(ie(re.oldValue)),1)):n.createCommentVNode("",!0),re.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",Mx,n.toDisplayString(ie(re.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&se.seq!==K.value?(n.openBlock(),n.createElementBlock("div",Bx,[I.value===se.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[ae[6]||(ae[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:B.value,onClick:ge=>X(se.seq)},"복원",8,Dx),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:B.value,onClick:ae[3]||(ae[3]=ge=>I.value=null)},"취소",8,Ox)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ge=>G(se.seq)},[n.createVNode(Ve,{name:"undo",size:12}),ae[7]||(ae[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,Lx))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-14fe445b"]]);function zx(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 Au(e){const t=n.ref(zx(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 Ux={class:"em-modeler"},Hx={class:"em-modeler__body"},Fx={class:"em-drawer__inner"},Gx={class:"em-drawer__head"},Yx={class:"em-drawer__actions"},Wx=["title"],Kx=De(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}=Au({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Au({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,g,b;return n.openBlock(),n.createElementBlock("div",Ux,[n.createVNode(Ru,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onToggleHistory:m[1]||(m[1]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",Hx,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",Fx,[n.createElementVNode("header",Gx,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",Yx,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=_=>{var N;return(N=f.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,Wx)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Cu,{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]=(..._)=>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[5]||(m[5]=_=>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(Su,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Vu,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[6]||(m[6]=_=>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]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(Px,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(sx,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-dc519653"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Yf,Ne.AssociationEdge=Ad,Ne.CommandStack=ma,Ne.DiagramCanvas=Su,Ne.DiagramExplorer=Cu,Ne.EDITOR=yn,Ne.EditModeToggle=EI,Ne.EditorToolbar=Ru,Ne.EntityModeler=Kx,Ne.EntityNode=yd,Ne.GroupNode=gd,Ne.NoteNode=bd,Ne.OpSyncAdapter=Hr,Ne.PHYSICAL_NAME_MAX_LENGTH=ca,Ne.PropertyPanel=Vu,Ne.RevCache=Ur,Ne.SYMBOLIC_OP_KINDS=Fr,Ne.SYMBOLIC_OP_SCHEMA=Qr,Ne.anchoredEdgePoint=ia,Ne.buildAgentBatch=Wf,Ne.buildDiagramSvg=$u,Ne.buildOrthogonalPath=ea,Ne.buildSelfLoopPath=zl,Ne.buildStraightPath=na,Ne.commands=$f,Ne.computeAutoLayout=Ul,Ne.createEditorController=O_,Ne.displayLabel=To,Ne.emptyState=fd,Ne.entityModelToText=Yl,Ne.estimateEntityHeight=Fl,Ne.exportDiagramSvg=xu,Ne.fromPersisted=am,Ne.indexColumnsByModelId=Wn,Ne.migrateLegacyMoney=rf,Ne.newId=Te,Ne.orthogonalMidpoints=ta,Ne.packEntityBoxes=Pu,Ne.physicalNameWarning=Oo,Ne.projectActionLog=ir,Ne.projectEntityAudit=nr,Ne.projectFieldAudit=Ot,Ne.rectExitPoint=oa,Ne.renderDiagramSvg=Kl,Ne.resolveDiagram=Ll,Ne.resolveSharedColumn=Do,Ne.resolveSymbolicOps=Bf,Ne.restoreDeepEqual=vn,Ne.segmentMidpoints=aa,Ne.sideDir=Gn,Ne.synthesizeRestoreOps=gf,Ne.toPersisted=_m,Ne.toPersistedV2=wm,Ne.validateModel=er,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
40
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(G=>{if(g.value){const X=Wt(g.value),A=ge=>{if(ge.sourceEvent.type!=="wheel"||!h.value||!m.value)return;const _e=ge.sourceEvent.ctrlKey&&bo()?10:1,re=-ge.sourceEvent.deltaY*(ge.sourceEvent.deltaMode===1?.05:ge.sourceEvent.deltaMode?1:.002)*e.zoomStep,ye=c.value.zoom*2**(re*_e);m.value.scaleTo(h.value,ye)},ae=ge=>{if(ge.sourceEvent.type!=="mousemove"||!h.value||!m.value)return;const _e=ie.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),re={x:c.value.x-ge.sourceEvent.movementX*_e,y:c.value.y-ge.sourceEvent.movementY*_e},ye=[[0,0],[u.value.width,u.value.height]],be=Bl.translate(re.x,re.y).scale(c.value.zoom),$e=m.value.constrain()(be,ye,d.value);m.value.transform(h.value,$e)},se=TN().wheelDelta(ge=>Ja(ge)*(e.zoomStep/10)).on("zoom",e.pannable?ae:()=>{}).on("zoom.wheel",e.zoomable?A:()=>{});X.call(se),G(()=>{X.on("zoom",null)})}},{flush:"post"});function M(G){const[X,A]=Kt(G);t("click",{event:G,position:{x:X,y:A}})}function ne(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeClick(A),t("nodeClick",A)}function E(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeDoubleClick(A),t("nodeDblclick",A)}function S(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseEnter(A),t("nodeMouseenter",A)}function I(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseMove(A),t("nodeMousemove",A)}function B(G,X){const A={event:G,node:X,connectedEdges:un([X],s.value)};f.miniMapNodeMouseLeave(A),t("nodeMouseleave",A)}return(G,X)=>(n.openBlock(),n.createBlock(n.unref(ad),{position:G.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:G.pannable,zoomable:G.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:b.value,height:_.value,viewBox:[te.value.x,te.value.y,te.value.width,te.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:M},[G.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(G.ariaLabel),9,LN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(p),A=>(n.openBlock(),n.createBlock(DN,{id:A.id,key:A.id,f:"",position:A.computedPosition,dimensions:A.dimensions,selected:A.selected,dragging:A.dragging,style:n.normalizeStyle(A.style),class:n.normalizeClass(q.value(A)),color:y.value(A),"border-radius":G.nodeBorderRadius,"stroke-color":x.value(A),"stroke-width":G.nodeStrokeWidth,"shape-rendering":n.unref(N),type:A.type,hidden:A.hidden,onClick:ae=>ne(ae,A),onDblclick:ae=>E(ae,A),onMouseenter:ae=>S(ae,A),onMousemove:ae=>I(ae,A),onMouseleave:ae=>B(ae,A)},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:fe.value,fill:G.maskColor,stroke:G.maskStrokeColor,"stroke-width":G.maskStrokeWidth,"fill-rule":"evenodd"},null,8,PN)],8,ON))]),_:1},8,["position","class"]))}}),HN=["d"],FN=["cx","cy","onDblclick"],GN=["x","y","onPointerdown","onDblclick"],YN=De(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Me(),i=n.inject(yl),a=n.inject(yn,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((T,ie)=>ie===d.value?u.value:T)),{source:h,target:m,sourceSide:p,targetSide:g}=Ad({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),b=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?ea(h.value,p.value,f.value,m.value,g.value):na(h.value,f.value,m.value)),_=n.computed(()=>l.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?ta(h.value,p.value,f.value,m.value,g.value):aa(h.value,f.value,m.value).map((T,ie)=>({point:T,segIndex:ie})):[]),N=n.computed(()=>l.value?f.value:[]);function y(T,ie){d.value=T,u.value={...c.value[T]},ie.target.setPointerCapture(ie.pointerId),ie.stopPropagation()}function x(T){if(d.value<0)return;const ie=o({x:T.clientX,y:T.clientY});u.value={x:ie.x,y:ie.y}}function q(T){var ie,te;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(te=(ie=T.target).releasePointerCapture)==null||te.call(ie,T.pointerId)}function P(T,ie){ie.stopPropagation(),i==null||i.removePoint(t.id,T)}function K(T,ie){if(!i)return;const te=o({x:ie.clientX,y:ie.clientY});i.insertPoint(t.id,T,{x:te.x,y:te.y})}return(T,ie)=>(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,HN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,(te,fe)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${fe}`,cx:te.point.x,cy:te.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(M=>K(te.segIndex,M),["stop"])},null,42,FN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(te,fe)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${fe}`,x:te.x-5,y:te.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:M=>y(fe,M),onPointermove:x,onPointerup:q,onDblclick:M=>P(fe,M)},null,42,GN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),WN=["data-theme"],KN={key:0,class:"em-ctx__sep",role:"separator"},qN={key:1,class:"em-ctx__swatches"},XN={class:"em-ctx__swatches-label"},jN={class:"em-ctx__chips"},ZN=["onClick"],JN=["title","onClick"],QN=["disabled","onClick"],eI={class:"em-ctx__icon"},tI={class:"em-ctx__caption"},nI=De(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 g=l.value;if(!g)return;const b=g.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,(g,b)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b},[g.type==="separator"?(n.openBlock(),n.createElementBlock("div",KN)):g.type==="swatches"?(n.openBlock(),n.createElementBlock("div",qN,[n.createElementVNode("span",XN,n.toDisplayString(g.caption),1),n.createElementVNode("div",jN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":g.current===null}]),title:"없음",onClick:_=>h(g,null)},null,10,ZN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),_=>(n.openBlock(),n.createElementBlock("button",{key:_,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":g.current===_}]),style:n.normalizeStyle({background:n.unref(Dn)(_)}),title:n.unref(Bn)(_),onClick:N=>h(g,_)},null,14,JN))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":g.danger,"is-disabled":g.disabled}]),disabled:g.disabled,role:"menuitem",onClick:_=>f(g)},[n.createElementVNode("span",eI,[g.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:g.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",tI,n.toDisplayString(g.caption),1)],10,QN))],64))),128))],36)],8,WN)):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 oI(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function iI(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 g=t(p.left,p.top+p.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=l.textContent??"",c=[];let d="",u=null,f=0,h=0;const m=()=>{const p=d.trim();if(p){const g=t(f,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:p})}d=""};for(let p=0;p<s.length;p++){a.setStart(l,p),a.setEnd(l,p+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(m(),u=g.top,f=g.left,h=g.bottom,d=s[p]):(d+=s[p],h=Math.max(h,g.bottom))}return m(),c}function Ji(e,t){const o=[];for(const i of e.querySelectorAll("*"))oI(i)&&(i.closest(Ol)||Fn(i)&&o.push(...iI(i,t)));return o}function Ro(e){return Math.round(e*100)/100}function aI(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 lI(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 $u(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 rI(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||!Fn(p))continue;const g=p.firstElementChild;if(g)if(m.type==="group"){const b=Vo(g,o);Ll(s,b),i.push({...b,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...Vo(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ji(g,o)})}else if(m.type==="note"){const b={...Vo(g,o),texts:Ji(g,o),lines:$u(g,g,o)};Ll(s,b),l.push(b)}else{const b=Vo(g,o);Ll(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const y=Vo(N,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:_.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:Ji(g,o),lines:$u(g,g,o),icons:aI(g,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||!Fn(p))continue;const g=p.getAttribute("d");if(!g)continue;const b=getComputedStyle(p),_=b.strokeDasharray,N=lI(m);r.push({d:g,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:Ji(m,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:a,notes:l}}function xu(e){return Xl(rI(e))}function Su(e,t="diagram.svg"){const o=xu(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 Pl="nc:",Cu=De(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=le.useModal(),l=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(v){s.x=v.clientX,s.y=v.clientY}const d=n.ref(null);n.provide(Vi,d);const u=n.ref(null);n.provide(yd,u);const f=n.ref(null),h=n.computed(()=>{const v=f.value,w=new Set;if(!v)return w;if(v.kind==="entity")w.add(v.id);else if(v.kind==="group"){const z=i.resolved.value.groups.find(pe=>pe.group.modelId===v.id);for(const pe of(z==null?void 0:z.group.memberEntityRefs)??[])w.add(pe)}return w}),m=n.computed(()=>{const v=f.value,w=new Set(h.value),z=new Set,pe=new Set;if(!v)return{related:w,edges:z,notes:pe};if(v.kind==="note"){pe.add(v.id);for(const Z of i.resolved.value.noteConnections)Z.noteRef===v.id&&w.add(Z.targetRef);return{related:w,edges:z,notes:pe}}const J=h.value;if(!J.size)return{related:w,edges:z,notes:pe};for(const Z of i.resolved.value.associations){const{end1:W,end2:de}=Z.association;(J.has(W.entityRef)||J.has(de.entityRef))&&(z.add(Z.association.modelId),w.add(W.entityRef),w.add(de.entityRef))}for(const Z of i.resolved.value.noteConnections)w.has(Z.targetRef)&&pe.add(Z.noteRef);return{related:w,edges:z,notes:pe}});n.provide(Pn,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:h,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var v;return((v=f.value)==null?void 0:v.kind)==="group"?f.value.id:null}),setEntityHover:v=>{u.value||r.value||(f.value=v?{kind:"entity",id:v}:null)},setGroupHover:v=>{u.value||r.value||(f.value=v?{kind:"group",id:v}:null)},setNoteHover:v=>{u.value||r.value||(f.value=v?{kind:"note",id:v}:null)}}),n.provide(yn,i);function p(v,w){return`${Pl}${v}:${w}`}function g(v){if(!v.startsWith(Pl))return null;const[w,z]=v.slice(Pl.length).split(":");return w&&z?{noteRef:w,targetRef:z}:null}n.provide(yl,{points:v=>{var z,pe;const w=g(v);return w?((z=i.resolved.value.noteConnections.find(J=>J.noteRef===w.noteRef&&J.targetRef===w.targetRef))==null?void 0:z.waypoints)??[]:((pe=i.resolved.value.associations.find(J=>J.association.modelId===v))==null?void 0:pe.waypoints)??[]},movePoint:(v,w,z)=>{const pe=g(v);pe?i.moveNoteConnectionWaypoint(pe.noteRef,pe.targetRef,w,z):i.moveWaypoint(v,w,z)},insertPoint:(v,w,z)=>{const pe=g(v);pe?i.addNoteConnectionWaypoint(pe.noteRef,pe.targetRef,w,z):i.addWaypoint(v,w,z)},removePoint:(v,w)=>{const z=g(v);z?i.removeNoteConnectionWaypoint(z.noteRef,z.targetRef,w):i.removeWaypoint(v,w)}});const b=Me(),{nodes:_,edges:N,findNode:y,findEdge:x,addNodes:q,addEdges:P,removeNodes:K,removeEdges:T,fitView:ie,setCenter:te,getViewport:fe,screenToFlowCoordinate:M,getSelectedNodes:ne,updateNodeInternals:E}=b,S=n.ref(!1);async function I(){S.value=!0,await n.nextTick(),await new Promise(v=>requestAnimationFrame(()=>v(null)));try{Su(b)}finally{S.value=!1}}t({exportSvg:I});function B(v){for(const w of i.resolved.value.groups){const{location:z,size:pe}=w.geo;if(v.x>=z.x&&v.x<=z.x+pe.width&&v.y>=z.y&&v.y<=z.y+pe.height)return w.group.modelId}return null}function G(){const v=i.resolved.value,w=new Map(v.groups.map(W=>[W.group.modelId,W.geo])),z=new Set(v.groups.map(W=>W.group.modelId)),pe=new Set([...z,...v.entities.map(W=>W.entity.modelId),...v.notes.map(W=>W.note.modelId)]);for(const W of[..._.value])pe.has(W.id)||K([W.id]);for(const W of v.groups){const de=W.group.modelId,Ne={width:`${W.geo.size.width}px`,height:`${W.geo.size.height}px`},xe={group:W.group,style:W.style},H=y(de);H?(H.position={...W.geo.location},H.data=xe,H.style=Ne):q([{id:de,type:"group",position:{...W.geo.location},style:Ne,data:xe}])}for(const W of v.entities){const de=W.entity.modelId,Ne=W.groupRef&&z.has(W.groupRef)?W.groupRef:void 0,xe={entity:W.entity,displayMode:i.displayMode.value,collapsed:W.collapsed,groupRef:Ne,size:W.geo.size,style:W.style,attributeStyles:W.attributeStyles,operationStyles:W.operationStyles},H=Ne?w.get(Ne):void 0,ee=H?{x:W.geo.location.x-H.location.x,y:W.geo.location.y-H.location.y}:{...W.geo.location},F=y(de);F?(F.position=ee,F.data=xe,F.parentNode=Ne):q([{id:de,type:"entity",position:ee,parentNode:Ne,data:xe}])}for(const W of v.notes){const de=W.note,Ne=de.modelId,xe=W.groupRef&&z.has(W.groupRef)?W.groupRef:void 0,H={note:de,groupRef:xe},ee={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},F=xe?w.get(xe):void 0,ue=F?{x:de.geo.location.x-F.location.x,y:de.geo.location.y-F.location.y}:{...de.geo.location},Ae=y(Ne);Ae?(Ae.position=ue,Ae.data=H,Ae.style=ee,Ae.parentNode=xe):q([{id:Ne,type:"note",position:ue,parentNode:xe,style:ee,data:H}])}const J=new Map(v.associations.map(W=>[W.association.modelId,W])),Z=new Set(v.noteConnections.map(W=>p(W.noteRef,W.targetRef)));for(const W of[...N.value])!J.has(W.id)&&!Z.has(W.id)&&T([W.id]);for(const[W,de]of J){const Ne={id:W,type:"association",source:de.association.end1.entityRef,target:de.association.end2.entityRef,sourceHandle:de.sourceColumnRef?`r:${de.sourceColumnRef}`:void 0,targetHandle:de.targetColumnRef?`l:${de.targetColumnRef}`:void 0,data:{association:de.association,sourceColumnRef:de.sourceColumnRef,targetColumnRef:de.targetColumnRef}},xe=x(W);xe?(xe.data=Ne.data,xe.sourceHandle=Ne.sourceHandle,xe.targetHandle=Ne.targetHandle):P([Ne])}for(const W of v.noteConnections){const de=p(W.noteRef,W.targetRef),Ne={noteRef:W.noteRef,targetRef:W.targetRef},xe=x(de);xe?xe.data=Ne:P([{id:de,type:"note-connection",source:W.noteRef,target:W.targetRef,data:Ne}])}X()}function X(){n.nextTick(()=>requestAnimationFrame(()=>E()))}function A(){const v=ne.value.map(z=>z.id);if(v.length)return v;const w=i.selection.value;return w&&(w.kind==="entity"||w.kind==="note"||w.kind==="group")?[w.id]:[]}function ae(v){var J;const w=v.target;if(w&&(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable))return;if(!i.editable.value){(v.metaKey||v.ctrlKey)&&v.key.toLowerCase()==="c"&&(i.copy(),v.preventDefault());return}if(v.key==="Delete"||v.key==="Backspace"){i.deleteSelection()&&v.preventDefault();return}if(v.key==="ArrowUp"||v.key==="ArrowDown"||v.key==="ArrowLeft"||v.key==="ArrowRight"){if(((J=i.selection.value)==null?void 0:J.kind)==="attribute"){if(v.key==="ArrowUp"||v.key==="ArrowDown"){const Ne=v.key==="ArrowDown"?1:-1;(v.altKey?i.nudgeSelectedAttributes(Ne):i.moveAttributeFocus(Ne))&&v.preventDefault()}return}const Z=v.shiftKey?10:1,W=v.key==="ArrowLeft"?-Z:v.key==="ArrowRight"?Z:0,de=v.key==="ArrowUp"?-Z:v.key==="ArrowDown"?Z:0;i.nudgeNodes(A(),W,de)&&v.preventDefault();return}if(!(v.metaKey||v.ctrlKey))return;const pe=v.key.toLowerCase();pe==="c"?(i.copy(),v.preventDefault()):pe==="v"?(i.paste(),v.preventDefault()):pe==="z"&&(v.shiftKey?i.redo():i.undo(),v.preventDefault())}n.onMounted(async()=>{G(),await n.nextTick(),ie(),window.addEventListener("keydown",ae),window.addEventListener("pointerup",se),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",ae),window.removeEventListener("pointerup",se),window.removeEventListener("pointermove",c)});function se(){d.value=null}function ge(){r.value=!0,f.value=null}function _e(){var pe;r.value=!1;const v=(pe=document.elementFromPoint(s.x,s.y))==null?void 0:pe.closest(".vue-flow__node"),w=v==null?void 0:v.dataset.id;if(!w){f.value=null;return}const z=v.classList.contains("vue-flow__node-group")?"group":v.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:z,id:w}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],G),n.watch(()=>i.revision.value,X),n.watch(()=>i.resolved.value,v=>{const w=f.value;if(!w)return;(w.kind==="entity"?v.entities.some(pe=>pe.entity.modelId===w.id):w.kind==="group"?v.groups.some(pe=>pe.group.modelId===w.id):v.notes.some(pe=>pe.note.modelId===w.id))||(f.value=null)});function re(v){const w=v.computedPosition??v.position,z=v.dimensions??{width:0,height:0};return{x:w.x+z.width/2,y:w.y+z.height/2}}function ye(v){const w=v.node;if(w){if(f.value=null,w.type==="group"){const z=i.resolved.value.groups.find(pe=>pe.group.modelId===w.id);u.value=z?{groupId:w.id,dx:w.position.x-z.geo.location.x,dy:w.position.y-z.geo.location.y}:null,d.value=null;return}if(w.type!=="entity"&&w.type!=="note"){d.value=null;return}d.value=B(re(w))}}function be(v){var pe;d.value=null,u.value=null;const w=(pe=v.nodes)!=null&&pe.length?v.nodes:[v.node],z=w.filter(J=>(J==null?void 0:J.type)==="group");if(z.length){for(const J of z){if(!J)continue;const Z=i.resolved.value.entities.filter(W=>W.groupRef===J.id).map(W=>{const de=y(W.entity.modelId),Ne=(de==null?void 0:de.computedPosition)??(de==null?void 0:de.position)??{x:0,y:0};return{id:W.entity.modelId,location:{x:Ne.x,y:Ne.y}}});i.dragGroup(J.id,{x:J.position.x,y:J.position.y},Z)}return}for(const J of w){if(!J||J.type==="group")continue;const Z=J.computedPosition??J.position,W=J.dimensions??{width:0,height:0},de={x:Z.x+W.width/2,y:Z.y+W.height/2};J.type==="note"?i.dropNote(J.id,{x:Z.x,y:Z.y},B(de)):i.dropEntity(J.id,{x:Z.x,y:Z.y},B(de))}}function $e(v){var Ne,xe,H,ee,F;if(!i.editable.value||!v.source||!v.target)return;const w=((Ne=y(v.source))==null?void 0:Ne.type)==="note",z=((xe=y(v.target))==null?void 0:xe.type)==="note";if(w||z){if(w&&z)return;const ue=w?v.source:v.target,Ae=w?v.target:v.source;((H=y(Ae))==null?void 0:H.type)==="entity"&&i.addNoteConnection(ue,Ae);return}const pe=ue=>{var Ae;return(Ae=i.state.logical.entities.find(Je=>Je.modelId===ue))==null?void 0:Ae.stereotype},J=pe(v.source)==="JPA_EMBEDDABLE",Z=pe(v.target)==="JPA_EMBEDDABLE";if(J||Z){if(J&&Z)return;const ue=J?v.source:v.target,Ae=J?v.target:v.source;i.addEmbedAssociation(Ae,ue);return}const W=(ee=v.sourceHandle)!=null&&ee.startsWith("r:")?v.sourceHandle.slice(2):void 0,de=(F=v.targetHandle)!=null&&F.startsWith("l:")?v.targetHandle.slice(2):void 0;i.addAssociation(v.source,v.target,W,de)}const Se=n.ref(null);function Ce(v,w){var pe;const z=i.state.layout.entityLayouts.find(J=>J.entityRef===v);return Xe((pe=z==null?void 0:z.attributeStyles)==null?void 0:pe[w])}function Y(v,w){var pe;const z=i.state.layout.entityLayouts.find(J=>J.entityRef===v);return Xe((pe=z==null?void 0:z.operationStyles)==null?void 0:pe[w])}function U(v){var w;return Xe((w=i.state.layout.groupLayouts.find(z=>z.groupRef===v))==null?void 0:w.style)}function V(v){var w;return Xe((w=i.state.layout.notes.find(z=>z.modelId===v))==null?void 0:w.style)}function C(v){var pe,J;if(v.preventDefault(),!i.editable.value)return;const w=()=>M({x:v.clientX,y:v.clientY}),z=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const Z=w();i.addEntity("NewEntity",{x:Z.x,y:Z.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const Z=w();i.addNote("메모",{x:Z.x,y:Z.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const Z=w();i.addEmptyGroup({x:Z.x,y:Z.y})}}];((pe=i.clipboard.value)==null?void 0:pe.kind)==="entity"&&z.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&z.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(J=Se.value)==null||J.open(v,z)}function R({event:v,node:w}){var H,ee,F,ue,Ae,Je,nt,Pe,kt,Xt,jt,Zt,Ge,Ao,we,Ye,To;const z=v;if(z.preventDefault(),!i.editable.value){if(w.type==="group"||w.type==="note")return;const Be=(ee=(H=z.target)==null?void 0:H.closest("[data-attr]"))==null?void 0:ee.dataset.attr;if(Be){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===w.id&&Qe.ids.includes(Be)||i.selectAttribute(w.id,Be);const It=((F=i.selection.value)==null?void 0:F.kind)==="attribute"&&i.selection.value.entityId===w.id?[...i.selection.value.ids]:[Be];(ue=Se.value)==null||ue.open(z,[{caption:It.length>1?`복사 (${It.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ae=Se.value)==null||Ae.open(z,[{caption:"상세 편집…",icon:"pencil",handler:()=>xi(a,i,w.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.copy()}}]);return}if(w.type==="group"){(Je=Se.value)==null||Je.open(z,[{type:"swatches",caption:"색상",current:U(w.id),onPick:Be=>i.setGroupSwatch(w.id,Be)},{type:"separator"},{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(w.id)}]);return}if(w.type==="note"){(nt=Se.value)==null||nt.open(z,[{type:"swatches",caption:"색상",current:V(w.id),onPick:Be=>i.setNoteSwatch(w.id,Be)},{type:"separator"},{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(w.id)}]);return}const pe=(kt=(Pe=z.target)==null?void 0:Pe.closest("[data-attr]"))==null?void 0:kt.dataset.attr;if(pe){const Be=i.selection.value;(Be==null?void 0:Be.kind)==="attribute"&&Be.entityId===w.id&&Be.ids.includes(pe)||i.selectAttribute(w.id,pe);const Nt=((Xt=i.selection.value)==null?void 0:Xt.kind)==="attribute"&&i.selection.value.entityId===w.id?[...i.selection.value.ids]:[pe],It=Nt.length>1,Gn=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(w.id)},{type:"swatches",caption:It?`색상 (${Nt.length})`:"색상",current:It?null:Ce(w.id,pe),onPick:ot=>i.setAttributeSwatches(w.id,Nt,ot)},{type:"separator"},{caption:It?`복사 (${Nt.length})`:"복사",icon:"copy",handler:()=>i.copy()}],Jt=i.clipboard.value;(Jt==null?void 0:Jt.kind)==="attribute"&&Gn.push({caption:Jt.attributes.length>1?`속성 붙여넣기 (${Jt.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.paste()}}),Gn.push({type:"separator"},{caption:It?`속성 삭제 (${Nt.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(w.id,Nt)}),(jt=Se.value)==null||jt.open(z,Gn);return}const J=(Ge=(Zt=z.target)==null?void 0:Zt.closest("[data-op]"))==null?void 0:Ge.dataset.op;if(J){(Ao=Se.value)==null||Ao.open(z,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(w.id)},{type:"swatches",caption:"색상",current:Y(w.id,J),onPick:Be=>i.setOperationSwatch(w.id,J,Be)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(w.id,J)}]);return}const Z=[{caption:"상세 편집…",icon:"pencil",handler:()=>xi(a,i,w.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(w.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(w.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Be=ne.value.filter(Qe=>Qe.type==="entity").map(Qe=>Qe.id);i.createGroup(Be.includes(w.id)&&Be.length?Be:[w.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(w.id,w.id)}],W=i.embeddableCatalog.value;if(W.length){Z.push({type:"separator"});for(const Be of W){const Qe=((we=Be.label)==null?void 0:we.ko)??((Ye=Be.label)==null?void 0:Ye.en)??Be.type;Z.push({caption:`임베더블 추가: ${Qe}`,icon:"link",handler:()=>i.addPredefinedEmbed(w.id,Be.type)})}}const de=i.resolved.value.entities.find(Be=>Be.entity.modelId===w.id);Z.push({type:"separator"}),Z.push({caption:de!=null&&de.collapsed?"펼치기":"접기",icon:de!=null&&de.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(w.id,!(de!=null&&de.collapsed))}),(de==null?void 0:de.groupRef)&&Z.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(w.id)}),Z.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.copy()}});const xe=i.clipboard.value;(xe==null?void 0:xe.kind)==="attribute"&&Z.push({caption:xe.attributes.length>1?`속성 붙여넣기 (${xe.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:w.id},i.paste()}}),Z.push({type:"separator"}),Z.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(w.id)}),(To=Se.value)==null||To.open(z,Z)}function O({event:v,edge:w}){var J,Z;const z=v;if(z.preventDefault(),!i.editable.value)return;const pe=g(w.id);if(pe){(J=Se.value)==null||J.open(z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(pe.noteRef,pe.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(pe.noteRef,pe.targetRef)}]);return}(Z=Se.value)==null||Z.open(z,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(w.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(w.id)}])}function oe(v){return v==="group"?"group":v==="note"?"note":"entity"}function j({node:v}){if(ne.value.length>1){i.selection.value=null;return}i.selection.value={kind:oe(v.type),id:v.id}}function k({nodes:v}){v.length>1&&(i.selection.value=null)}function $({edge:v}){const w=g(v.id);i.selection.value=w?{kind:"note",id:w.noteRef}:{kind:"association",id:v.id}}function L(v){const w=i.selection.value;return!!w&&w.kind!=="attribute"&&w.id===v.id}function Q(v){var w,z;return L(v)?v.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":v.type==="note"?"var(--em-note-soft)":v.type==="group"?rd(Xe((w=v.data)==null?void 0:w.style),!0)??"var(--em-mm-group)":rd(Xe((z=v.data)==null?void 0:z.style))??"var(--em-mm-entity)"}function ce(v){return L(v)?"var(--em-selection)":v.type==="note"?"var(--em-note-accent)":v.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function me(v,w){te(v,w,{zoom:fe().zoom,duration:350})}n.watch(()=>i.focusRequest.value,v=>{if(!v)return;const w=y(v.id);if(!w)return;const z=w.computedPosition??w.position,pe=w.dimensions??{width:0,height:0};me(z.x+pe.width/2,z.y+pe.height/2)});function he({position:v}){me(v.x,v.y)}function ve({node:v}){i.selection.value={kind:oe(v.type),id:v.id};const w=v.computedPosition??v.position,z=v.dimensions??{width:0,height:0};me(w.x+z.width/2,w.y+z.height/2)}function D({node:v}){ie({nodes:[v.id],duration:350,maxZoom:1.2,padding:.6})}return(v,w)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":l.value,"is-panning":r.value}])},[n.createVNode(n.unref(b0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!S.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(At).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ge,onMoveEnd:_e,onConnect:$e,onConnectStart:w[0]||(w[0]=z=>l.value=!0),onConnectEnd:w[1]||(w[1]=z=>l.value=!1),onNodeDrag:ye,onNodeDragStop:be,onNodeClick:j,onEdgeClick:$,onSelectionChange:k,onPaneClick:w[2]||(w[2]=z=>n.unref(i).selection.value=null),onPaneContextMenu:C,onNodeContextMenu:R,onEdgeContextMenu:O},{"node-group":n.withCtx(z=>[n.createVNode(bd,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"node-entity":n.withCtx(z=>[n.createVNode(gd,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"node-note":n.withCtx(z=>[n.createVNode(_d,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"edge-association":n.withCtx(z=>[n.createVNode(Td,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),"edge-note-connection":n.withCtx(z=>[n.createVNode(YN,n.normalizeProps(n.guardReactiveProps(z)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Tv),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(aw),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(UN),{key:1,pannable:"",width:224,height:160,"node-color":Q,"node-stroke-color":ce,"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:he,onNodeClick:ve,onNodeDblclick:D})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(nI,{ref_key:"menuRef",ref:Se},null,512)],2))}}),[["__scopeId","data-v-46292641"]]),sI={class:"em-explorer em-scroll-overlay"},cI={class:"em-explorer__rows"},dI=["data-key","onClick","onDblclick"],uI=["onClick"],fI=["title"],mI={class:"em-key-slot"},pI={class:"em-key-slot"},hI={class:"em-explorer__label"},Ru=De(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=le.useModal(),l=n.computed(()=>{var E;const _=i.resolved.value,N=i.displayMode.value,y=S=>{var I,B,G;return Mo(N,S.name,(B=(I=S.table)==null?void 0:I.logicalName)==null?void 0:B.ko,(G=S.table)==null?void 0:G.physicalName)},x=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",q=S=>{const I=S.attrType.startsWith("RELATION")&&S.dbAttrs.length>0;return{icon:S.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:S.identifier,fk:I&&x}}},P=S=>S.attrType.startsWith("EMBED")&&S.dbAttrs.length>0,K=N==="PHYSICAL"||N==="LOGICAL_PHYSICAL",T=S=>{if(S.attrType!=="EMBED_PREDEF")return S.dbAttrs;const I=i.embeddableCatalog.value.find(B=>B.type===S.type);return I?S.dbAttrs.map((B,G)=>{const X=I.fields[G];return X?{...B,physicalName:B.physicalName||X.physicalName,logicalName:B.logicalName??X.logicalName,dataType:B.dataType||X.dataType,length:B.length??X.length}:B}):S.dbAttrs},ie=(S,I)=>{var A,ae,se;const B={entityId:I,attrId:S.modelId};if(P(S)){const ge=da(N,S);return{key:`attr:${S.modelId}`,label:S.name+(ge?` : ${ge}`:""),icon:"table",attrRef:B,focusId:I,children:K?T(S).map(_e=>{var re;return{key:`attr:${S.modelId}:col:${_e.modelId}`,label:Mo(N,_e.physicalName,(re=_e.logicalName)==null?void 0:re.ko,_e.physicalName)+(_e.dataType?` : ${_e.dataType}`:""),icon:"field",attrRef:B,focusId:I,children:[]}}):[]}}const G=Ql(S,i.state.logical.associations),X=da(N,S,G);return{key:`attr:${S.modelId}`,label:Mo(N,S.name,(ae=(A=S.dbAttrs[0])==null?void 0:A.logicalName)==null?void 0:ae.ko,(se=S.dbAttrs[0])==null?void 0:se.physicalName)+(X?` : ${X}`:""),...q(S),attrRef:B,focusId:I,children:[]}},te=S=>{const I=S.entity,B=[...I.attributes].sort((G,X)=>G.order-X.order);return{key:`entity:${I.modelId}`,label:y(I),icon:"table",selectKind:"entity",selectId:I.modelId,focusId:I.modelId,children:B.map(G=>ie(G,I.modelId))}},fe=new Map,M=[];for(const S of _.entities)if(S.groupRef){const I=fe.get(S.groupRef)??[];I.push(S),fe.set(S.groupRef,I)}else M.push(S);const ne=[];for(const S of _.groups){const I=S.group;ne.push({key:`group:${I.modelId}`,label:((E=I.name)==null?void 0:E.ko)||I.packageName||"(그룹)",icon:"folder",focusId:I.modelId,children:(fe.get(I.modelId)??[]).map(te)})}for(const S of M)ne.push(te(S));if(_.associations.length){const S=new Map(_.entities.map(I=>[I.entity.modelId,y(I.entity)]));ne.push({key:"section:associations",label:`관계 (${_.associations.length})`,icon:"arrow-lr",children:_.associations.map(I=>{const B=I.association,G=S.get(B.end1.entityRef)??B.end1.entityRef,X=S.get(B.end2.entityRef)??B.end2.entityRef;return{key:`assoc:${B.modelId}`,label:`${G} — ${X}`,icon:"arrow-lr",selectKind:"association",selectId:B.modelId,children:[]}})})}return _.notes.length&&ne.push({key:"section:notes",label:`노트 (${_.notes.length})`,icon:"note",children:_.notes.map(({note:S})=>{var I;return{key:`note:${S.modelId}`,label:((I=S.memo.split(`
41
+ `)[0])==null?void 0:I.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:S.modelId,focusId:S.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:ne}});function r(_){return _?_.pk&&_.fk?"PFK (식별 외래키)":_.pk?"PK (기본키)":_.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(_){const N=new Set(s.value);N.has(_)?N.delete(_):N.add(_),s.value=N}const d=n.computed(()=>{const _=[],N=(y,x)=>{if(_.push({node:y,depth:x}),!s.value.has(y.key))for(const q of y.children)N(q,x+1)};return N(l.value,0),_}),u=n.computed(()=>{const _=[],N=y=>{if(y.children.length){y.key!=="root"&&_.push(y.key);for(const x of y.children)N(x)}};return N(l.value),_}),f=n.computed(()=>!u.value.some(_=>s.value.has(_)));function h(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:h,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(_){const N=i.selection.value;return _.attrRef?(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.attrRef.entityId&&N.ids.includes(_.attrRef.attrId):!!N&&N.kind!=="attribute"&&!!_.selectId&&_.selectKind===N.kind&&_.selectId===N.id}function p(_){const N=i.selection.value;return _.selectKind==="entity"&&(N==null?void 0:N.kind)==="attribute"&&N.entityId===_.selectId}function g(_,N){if(_.attrRef){const y=N.shiftKey?"range":N.metaKey||N.ctrlKey?"toggle":"replace";i.selectAttribute(_.attrRef.entityId,_.attrRef.attrId,y)}else _.selectKind&&_.selectId&&(i.selection.value={kind:_.selectKind,id:_.selectId});_.focusId&&i.requestFocus(_.focusId)}function b(_){_.selectKind==="entity"&&_.selectId&&xi(a,i,_.selectId)}return(_,N)=>(n.openBlock(),n.createElementBlock("section",sI,[n.createElementVNode("div",cI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:y,depth:x})=>(n.openBlock(),n.createElementBlock("div",{key:y.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(y),"is-focus-parent":p(y),"is-selectable":!!y.selectKind||!!y.attrRef||!!y.focusId}]),"data-key":y.key,style:n.normalizeStyle({paddingLeft:4+x*14+"px"}),onClick:q=>g(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(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,uI),y.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(y.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",mI,[y.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):y.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",pI,[y.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,fI)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:y.icon,size:15},null,8,["name"])),n.createElementVNode("span",hI,n.toDisplayString(y.label),1)],46,dI))),128))])]))}}),[["__scopeId","data-v-4fcb6509"]]),yI={class:"em-text-preview"},gI={class:"em-text-preview__pre"},bI={class:"em-text-preview__actions"},_I=De(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=le.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),le.showNotification("클립보드에 복사되었습니다.","info")}catch{le.showNotification("복사에 실패했습니다.","error")}}return(a,l)=>(n.openBlock(),n.createBlock(n.unref(le.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",yI,[n.createElementVNode("pre",gI,n.toDisplayString(t.text),1),n.createElementVNode("div",bI,[n.createVNode(n.unref(le.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"닫기",onClick:l[0]||(l[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),vI={class:"em-toolbar"},wI={class:"em-toolbar__mode"},Vu=De(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,l=le.useModal(),r=[{v:"LOGICAL",label:"논리"},{v:"PHYSICAL",label:"물리"},{v:"LOGICAL_PHYSICAL",label:"논리·물리"},{v:"CLASS",label:"클래스"}],s=n.computed({get:()=>i.displayMode.value,set:m=>i.displayMode.value=m});function c(){const m=i.state.logical.entities.length;i.addEntity("NewEntity",{x:80+m*40,y:80+m*30})}function d(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const u=n.computed(()=>{const m=i.resolved.value.entities;return m.length>0&&m.every(p=>p.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function h(){l.openModal({component:_I,bind:{text:Kl(i.state.logical)}})}return(m,p)=>(n.openBlock(),n.createElementBlock("div",vI,[n.createVNode(n.unref(le.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]=g=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(le.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]=g=>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.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"엔티티 추가",disabled:!n.unref(i).editable.value,onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:p[2]||(p[2]=g=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),p[11]||(p[11]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",wI,[p[8]||(p[8]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(le.BSSelect),{modelValue:s.value,"onUpdate:modelValue":p[3]||(p[3]=g=>s.value=g),items:r,"value-provider":g=>g.v,"label-provider":g=>g.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:n.unref(i).routingMode.value==="orthogonal"?"직각":"직선",tooltip:"연결선 모드 전환",onClick:d},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption"]),n.createVNode(n.unref(le.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[4]||(p[4]=g=>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(le.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[5]||(p[5]=g=>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(le.BSButton),{variant:"text",caption:u.value?"모두 펼치기":"모두 접기",disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:u.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),p[12]||(p[12]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:h},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:p[6]||(p[6]=g=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",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(le.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:"이력",tooltip:e.historyOpen?"변경 이력 닫기":"변경 이력 열기",onClick:p[7]||(p[7]=g=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","tooltip"])],64)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b9382781"]]),EI=De(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(le.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(Ve,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),kI=["disabled"],NI={class:"em-panel__sub"},II={class:"em-nav"},$I={key:0,class:"em-nav__divider","aria-hidden":"true"},xI={key:1},SI=["onClick","onKeydown"],CI={class:"em-nav__name"},RI=["title"],VI={key:0,class:"em-panel__note"},AI=["data-attr-block"],TI={class:"em-attr__row"},MI={key:0,class:"em-attr__row"},BI={class:"em-attr__row"},DI={class:"em-attr__row"},OI={class:"em-attr__flags"},LI={class:"em-attr__pii"},PI={class:"em-attr__pii"},zI={class:"em-attr__pii"},UI={key:0,class:"em-attr__pii em-attr__codetop"},HI={class:"em-multilang"},FI={key:2,class:"em-embed-cols"},GI={class:"em-embed-col__label"},YI={class:"em-attr__row"},WI={class:"em-attr__row"},KI={key:0,class:"em-embed-upd"},qI={class:"em-embed-upd"},XI={class:"em-embed-upd"},jI={class:"em-swatch__row em-attr__swatch"},ZI=["onClick"],JI=["title","onClick"],QI={key:0,class:"em-attr__swatch-hint"},Qi="__OWN__",e$=De(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(H=>H.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find(H=>H.entityRef===i.value.modelId)??null:null),l=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.attributes.filter(ee=>ee.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var H;return((H=i.value)==null?void 0:H.attributes)??[]}),d=n.computed(()=>s.value.filter(H=>r.value.has(H.modelId)));function u(H){return{pk:H.identifier,fk:H.attrType.startsWith("RELATION")&&H.dbAttrs.length>0,required:H.notNull&&!H.identifier}}function f(H){const ee=u(H),F=[ee.pk&&"PK",ee.fk&&"FK",ee.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function h(H,ee){i.value&&o.selectAttribute(i.value.modelId,H.modelId,ee.shiftKey?"range":ee.metaKey||ee.ctrlKey?"toggle":"replace")}const m=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function p(H){return H==="none"?"(없음)":H}const g=H=>H;function b(H){var ee,F;return Xe((F=(ee=a.value)==null?void 0:ee.attributeStyles)==null?void 0:F[H.modelId])}function _(H){return r.value.size>1&&r.value.has(H.modelId)}function N(H,ee){if(!i.value)return;const F=_(H)?o.selectedAttrIds.value:[H.modelId];o.setAttributeSwatches(i.value.modelId,F,ee)}function y(H,ee){i.value&&o.updateAttribute(i.value.modelId,H.modelId,ee)}function x(H,ee){y(H,{naturalId:ee||void 0,naturalIdMutable:ee?H.naturalIdMutable:void 0})}function q(){return{naturalId:void 0,naturalIdMutable:void 0}}function P(H,ee){y(H,{identifier:ee,...ee?q():{}})}function K(H,ee){y(H,{transient:ee||void 0,...ee?q():{}})}function T(H){return!!H.transient}const ie=H=>H.value,te=H=>H.label;function fe(H,ee){if(!ee)return;const F=X.value.find(ue=>ue.type===ee);if(F){const ue=H.dbAttrs[0]??{modelId:H.modelId+".c",physicalName:H.name,dataType:"VARCHAR"};y(H,{type:ee,customType:void 0,dbAttrs:[{...ue,dataType:F.dataType,length:F.length,scale:F.scale}]});return}y(H,ee===Ot?{type:ee}:{type:ee,customType:void 0})}function M(H,ee){y(H,{customType:ee.trim()===""?void 0:ee})}function ne(H,ee){const ue={...H.dbAttrs[0]??{modelId:H.modelId+".c",physicalName:H.name,dataType:"VARCHAR"},...ee};ee.dataType!==void 0&&!Bo.has(ue.dataType)&&(ue.scale=void 0),y(H,{dbAttrs:[ue]})}function E(H){var ee;return Bo.has(((ee=H.dbAttrs[0])==null?void 0:ee.dataType)??"")}function S(H,ee,F){var ue;ne(H,{logicalName:{...(ue=H.dbAttrs[0])==null?void 0:ue.logicalName,[ee]:F}})}function I(H,ee){y(H,{description:Object.keys(ee).length?ee:void 0})}function B(H){return H.personalInfoAttributeType??"none"}function G(H,ee){y(H,{personalInfoAttributeType:ee==="none"?void 0:ee})}const X=n.computed(()=>o.predefinedCustomTypeCatalog.value),A=n.computed(()=>o.embeddableCatalog.value),ae=n.ref(void 0);function se(H){var ee,F;return((ee=H.label)==null?void 0:ee.ko)??((F=H.label)==null?void 0:F.en)??H.type}function ge(H){if(!H||!i.value)return;const ee=o.addPredefinedEmbed(i.value.modelId,H);ee&&o.selectAttribute(i.value.modelId,ee),ae.value=void 0}function _e(){if(!i.value)return;const H=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,H)}const re=n.computed(()=>o.groupCodeCatalog.value);function ye(H){var ee;return((ee=re.value.find(F=>F.groupCode===H.groupCode))==null?void 0:ee.codes)??[]}function be(H){return["none",...ye(H)]}function $e(H){return H==="none"?"none":H.code}function Se(H){var F,ue;if(H==="none")return"(없음)";const ee=((F=H.label)==null?void 0:F.ko)??((ue=H.label)==null?void 0:ue.en);return ee?`${H.code} (${ee})`:H.code}function Ce(H,ee){i.value&&o.setAttributeGroupCode(i.value.modelId,H.modelId,ee)}function Y(H,ee){y(H,{defaultValue:ee==="none"?void 0:ee})}function U(H,ee){y(H,{defaultValue:ee.trim()===""?void 0:ee})}function V(H){return H.attrType.startsWith("EMBED")&&H.dbAttrs.length>0}function C(H,ee,F){const ue=H.dbAttrs.map((Ae,Je)=>{if(Je!==ee)return Ae;const nt={...Ae,...F};for(const Pe of Object.keys(F))F[Pe]===void 0&&delete nt[Pe];return nt});i.value&&o.setEmbedColumns(i.value.modelId,H.modelId,ue)}function R(H,ee,F,ue){var Ae;C(H,ee,{logicalName:{...(Ae=H.dbAttrs[ee])==null?void 0:Ae.logicalName,[F]:ue}})}function O(H,ee){var Ae,Je,nt;if(H.attrType==="EMBED_PREDEF"){const Pe=(Ae=o.embeddableCatalog.value.find(kt=>kt.type===H.type))==null?void 0:Ae.fields[ee];return Pe?{name:Pe.name,physicalName:Pe.physicalName,dataType:Pe.dataType,length:Pe.length,shareable:Pe.shareable,logicalName:Pe.logicalName}:void 0}const F=(Je=H.embedded)==null?void 0:Je.embeddableRef;if(!F)return;const ue=(nt=o.state.logical.entities.find(Pe=>Pe.modelId===F))==null?void 0:nt.attributes.flatMap(Pe=>Pe.dbAttrs)[ee];return ue?{physicalName:ue.physicalName,dataType:ue.dataType,length:ue.length,scale:ue.scale,logicalName:ue.logicalName}:void 0}function oe(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.dataType)||((ue=H.dbAttrs[ee])==null?void 0:ue.dataType)||""}function j(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.length)??((ue=H.dbAttrs[ee])==null?void 0:ue.length)}function k(H,ee){var F,ue;return((F=O(H,ee))==null?void 0:F.scale)??((ue=H.dbAttrs[ee])==null?void 0:ue.scale)}const $=["inherit","true","false"];function L(H){return H==="inherit"?"기본(따름)":H}function Q(H){return(H==null?void 0:H.updatable)===void 0?"inherit":H.updatable?"true":"false"}function ce(H,ee,F){C(H,ee,{updatable:F==="inherit"?void 0:F==="true"})}function me(H,ee){ne(H,{updatable:ee==="inherit"?void 0:ee==="true"})}const he=["inherit","true","false"];function ve(H){return H==="inherit"?"기본(따름)":H}function D(H){return(H==null?void 0:H.insertable)===void 0?"inherit":H.insertable?"true":"false"}function v(H,ee,F){C(H,ee,{insertable:F==="inherit"?void 0:F==="true"})}function w(H,ee){ne(H,{insertable:ee==="inherit"?void 0:ee==="true"})}const z=n.computed(()=>{var H;return Kn(((H=i.value)==null?void 0:H.attributes.flatMap(ee=>ee.dbAttrs))??[])}),pe=n.computed(()=>{var H;return(((H=i.value)==null?void 0:H.attributes)??[]).filter(ee=>ee.attrType==="NORMAL"&&ee.dbAttrs.length===1&&ee.dbAttrs[0]).map(ee=>({modelId:ee.dbAttrs[0].modelId,label:ee.dbAttrs[0].physicalName||ee.name}))});function J(){return[Qi,...pe.value.map(H=>H.modelId)]}function Z(H){if(H===Qi)return"전용 컬럼(OWN)";const ee=pe.value.find(F=>F.modelId===H);return ee?`↗ ${ee.label} (공유)`:H}function W(H){return(H==null?void 0:H.sharedColumnRef)??Qi}function de(H,ee,F){C(H,ee,{sharedColumnRef:F===Qi?void 0:F})}function Ne(H){return(H==null?void 0:H.sharedColumnRef)!=null}function xe(H){var ee;return((ee=Do(H,z.value))==null?void 0:ee.physicalName)??""}return(H,ee)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",NI,[n.createTextVNode("속성 ("+n.toDisplayString(s.value.length)+") ",1),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:_e}),A.value.length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":ae.value,items:A.value,"value-provider":F=>F.type,"label-provider":se,"onUpdate:modelValue":ge},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",II,[(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",$I,[...ee[0]||(ee[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",xI,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":r.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:ue=>h(F,ue),onKeydown:[n.withKeys(n.withModifiers(ue=>h(F,ue),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ue=>h(F,ue),["prevent"]),["space"])]},[n.createElementVNode("span",CI,n.toDisplayString(F.name||"(이름 없음)"),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(F)},[u(F).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,RI)],42,SI)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",VI," 위 목록에서 속성을 선택하면 편집 폼이 표시됩니다. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var ue,Ae,Je,nt,Pe,kt,Xt,jt,Zt,Ge,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",TI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:"이름","model-value":F.name,"onUpdate:modelValue":we=>y(F,{name:we})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:"타입",disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Jl)(F.type,X.value),"value-provider":ie,"label-provider":te,"model-value":F.type,"onUpdate:modelValue":we=>fe(F,we)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:we=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])]),F.type===n.unref(Ot)?(n.openBlock(),n.createElementBlock("div",MI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":F.customType??"","onUpdate:modelValue":we=>M(F,we)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),V(F)?(n.openBlock(),n.createElementBlock("div",FI,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(we,Ye)=>{var To,Be,Qe,Nt,It,Gn,Jt;return n.openBlock(),n.createElementBlock("div",{key:we.modelId,class:"em-embed-col"},[n.createElementVNode("span",GI,n.toDisplayString(((To=O(F,Ye))==null?void 0:To.name)??((Be=O(F,Ye))==null?void 0:Be.physicalName)??`컬럼 ${Ye+1}`),1),n.createElementVNode("div",YI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`embed-col-${we.modelId}`,width:"100%",disabled:Ne(we),placeholder:((Qe=O(F,Ye))==null?void 0:Qe.physicalName)??"컬럼","model-value":Ne(we)?xe(we):we.physicalName,"onUpdate:modelValue":ot=>C(F,Ye,{physicalName:ot})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSTextInput),{name:`embed-dtype-${we.modelId}`,width:"84px",disabled:"","model-value":oe(F,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(le.BSNumberInput),{name:`embed-len-${we.modelId}`,width:"48px",disabled:"","model-value":j(F,Ye)},null,8,["name","model-value"]),n.createVNode(n.unref(le.BSNumberInput),{name:`embed-scale-${we.modelId}`,width:"48px",disabled:"","model-value":k(F,Ye)},null,8,["name","model-value"])]),n.createVNode(hn,{controller:n.unref(o),"ref-id":we.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",WI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`embed-logical-${we.modelId}`,width:"100%",placeholder:((It=(Nt=O(F,Ye))==null?void 0:Nt.logicalName)==null?void 0:It.ko)??"논리명","model-value":((Gn=we.logicalName)==null?void 0:Gn.ko)??"","onUpdate:modelValue":ot=>R(F,Ye,"ko",ot)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Jt=O(F,Ye))!=null&&Jt.shareable?(n.openBlock(),n.createElementBlock("label",KI,[ee[7]||(ee[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px","model-value":W(we),items:J(),"value-provider":g,"label-provider":Z,"onUpdate:modelValue":ot=>ot&&de(F,Ye,ot)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",qI,[ee[8]||(ee[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px",disabled:Ne(we),"model-value":Ne(we)?"false":D(we),items:he,"value-provider":g,"label-provider":ve,"onUpdate:modelValue":ot=>ot&&v(F,Ye,ot)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",XI,[ee[9]||(ee[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"110px",disabled:Ne(we),"model-value":Ne(we)?"false":Q(we),items:$,"value-provider":g,"label-provider":L,"onUpdate:modelValue":ot=>ot&&ce(F,Ye,ot)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",BI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-logical-${F.modelId}`,width:"100%",placeholder:"논리명","model-value":((Ae=(ue=F.dbAttrs[0])==null?void 0:ue.logicalName)==null?void 0:Ae.ko)??"","onUpdate:modelValue":we=>S(F,"ko",we)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",DI,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:"컬럼",disabled:T(F),"model-value":((Je=F.dbAttrs[0])==null?void 0:Je.physicalName)??"","onUpdate:modelValue":we=>ne(F,{physicalName:we})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:T(F),items:n.unref(jl)(((nt=F.dbAttrs[0])==null?void 0:nt.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":g,"label-provider":n.unref(ra),"model-value":((Pe=F.dbAttrs[0])==null?void 0:Pe.dataType)??"","onUpdate:modelValue":we=>we&&ne(F,{dataType:we})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:T(F),"model-value":(kt=F.dbAttrs[0])==null?void 0:kt.length,"onUpdate:modelValue":we=>ne(F,{length:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:T(F)||!E(F),"model-value":(Xt=F.dbAttrs[0])==null?void 0:Xt.scale,"onUpdate:modelValue":we=>ne(F,{scale:we||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(hn,{controller:n.unref(o),"ref-id":(jt=F.dbAttrs[0])==null?void 0:jt.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",OI,[n.createVNode(n.unref(le.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:l.value||T(F),"onUpdate:modelValue":we=>P(F,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:T(F),"onUpdate:modelValue":we=>y(F,{notNull:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((Zt=F.dbAttrs[0])!=null&&Zt.unique),disabled:T(F),"onUpdate:modelValue":we=>ne(F,{unique:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Ge=F.dbAttrs[0])!=null&&Ge.autoIncrement),disabled:T(F)||!F.identifier,"onUpdate:modelValue":we=>ne(F,{autoIncrement:we})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.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(le.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||T(F),"onUpdate:modelValue":we=>x(F,we)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:T(F)||!F.naturalId,"onUpdate:modelValue":we=>y(F,{naturalIdMutable:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ao=F.dbAttrs[0])!=null&&Ao.multiValue),disabled:T(F),"onUpdate:modelValue":we=>ne(F,{multiValue:we||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",LI,[ee[1]||(ee[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:T(F),"model-value":D(F.dbAttrs[0]),items:he,"value-provider":g,"label-provider":ve,"onUpdate:modelValue":we=>we&&w(F,we)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",PI,[ee[2]||(ee[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%",disabled:T(F),"model-value":Q(F.dbAttrs[0]),items:$,"value-provider":g,"label-provider":L,"onUpdate:modelValue":we=>we&&me(F,we)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",zI,[ee[3]||(ee[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":B(F),items:m,"value-provider":g,"label-provider":p,"onUpdate:modelValue":we=>we&&G(F,we)},null,8,["model-value","onUpdate:modelValue"])]),re.value.length?(n.openBlock(),n.createElementBlock("label",UI,[ee[4]||(ee[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(dd,{"model-value":F.groupCode,items:re.value,"onUpdate:modelValue":we=>Ce(F,we)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!re.value.length}])},[ee[5]||(ee[5]=n.createElementVNode("span",null,"기본값",-1)),ye(F).length?(n.openBlock(),n.createBlock(n.unref(le.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:be(F),"value-provider":$e,"label-provider":Se,"onUpdate:modelValue":we=>we&&Y(F,we)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(le.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:"기본값","model-value":F.defaultValue??"","onUpdate:modelValue":we=>U(F,we)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",HI,[ee[6]||(ee[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=>I(F,we)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",jI,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(F)===null}]),title:"없음",onClick:we=>N(F,null)},"∅",10,ZI),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),we=>(n.openBlock(),n.createElementBlock("button",{key:we,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(F)===we}]),style:n.normalizeStyle({background:n.unref(Dn)(we)}),title:n.unref(Bn)(we),onClick:Ye=>N(F,we)},null,14,JI))),128)),_(F)?(n.openBlock(),n.createElementBlock("span",QI,"선택 "+n.toDisplayString(r.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,AI)}),128))],8,kI)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-5b6c4296"]]),t$=["disabled"],n$={class:"em-panel__sub-label"},o$={class:"em-attr__row"},i$={class:"em-field em-idx-params"},a$=["value","onChange"],l$=De(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:Te(),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 g;const p=(g=l.value)==null?void 0:g.attributes[0];p&&s(m.modelId,{columns:[...m.columns,{columnRef:p.modelId,descending:!1}]})}function d(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,columnRef:g}:b)})}function u(m,p,g){s(m.modelId,{columns:m.columns.map((b,_)=>_===p?{...b,descending:g}:b)})}function f(m,p){s(m.modelId,{columns:m.columns.filter((g,b)=>b!==p)})}function h(m,p){s(m.modelId,{parameters:p.trim()===""?void 0:p})}return(m,p)=>{var g;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",n$,[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(((g=l.value.indexes)==null?void 0:g.length)??0)+") ",1)]),n.createVNode(n.unref(le.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",o$,[n.createVNode(n.unref(le.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(le.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(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(a).removeIndex(l.value.modelId,b.modelId)},null,8,["onClick"])]),n.createVNode(hn,{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,(_,N)=>(n.openBlock(),n.createElementBlock("div",{key:N,class:"em-attr__row"},[n.createVNode(n.unref(le.BSSelect),{class:"grow","model-value":_.columnRef,items:l.value.attributes,"value-provider":y=>y.modelId,"label-provider":y=>y.name,"onUpdate:modelValue":y=>y&&d(b,N,y)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`idx-${b.modelId}-desc-${N}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":y=>u(b,N,y)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"−",onClick:y=>f(b,N)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"컬럼",onClick:_=>c(b)},null,8,["onClick"]),n.createElementVNode("label",i$,[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,a$)])]))),128)):n.createCommentVNode("",!0)],8,t$)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-dcc068ac"]]),r$=["disabled"],s$={class:"em-panel__sub-label"},c$={class:"em-attr__row"},d$={class:"em-attr__row"},u$={class:"em-multilang"},f$={class:"em-attr__pii"},m$={class:"em-swatch__row em-attr__swatch"},p$=["onClick"],h$=["title","onClick"],y$=De(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=le.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 h(y,x){r.value&&a.updateOperation(r.value.modelId,y.modelId,x)}function m(y,x){h(y,{description:Object.keys(x).length?x:void 0})}function p(y){return y.personalInfoAttributeType??"none"}function g(y,x){h(y,{personalInfoAttributeType:x==="none"?void 0:x})}function b(y){var x,q;return Xe((q=(x=s.value)==null?void 0:x.operationStyles)==null?void 0:q[y.modelId])}function _(y,x){r.value&&a.setOperationSwatch(r.value.modelId,y.modelId,x)}function N(y){l.openModal({component:ud,bind:{operationName:y.name,sourceCode:y.sourceCode??"",onSave:x=>h(y,{sourceCode:x})}})}return(y,x)=>{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:x[1]||(x[1]=P=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",s$,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" 오퍼레이션 ("+n.toDisplayString(((q=r.value.operations)==null?void 0:q.length)??0)+") ",1)]),n.createVNode(n.unref(le.BSButton),{variant:"text",caption:"추가",onClick:x[0]||(x[0]=n.withModifiers(P=>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??[],P=>(n.openBlock(),n.createElementBlock("div",{key:P.modelId,class:"em-attr"},[n.createElementVNode("div",c$,[n.createVNode(n.unref(le.BSTextInput),{class:"grow",name:`op-name-${P.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":P.name,"onUpdate:modelValue":K=>h(P,{name:K})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSSelect),{width:"96px","model-value":P.visibility??"PACKAGE",items:c,"value-provider":f,"label-provider":f,"onUpdate:modelValue":K=>K&&h(P,{visibility:K})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:K=>n.unref(a).removeOperation(r.value.modelId,P.modelId)},null,8,["onClick"])]),n.createElementVNode("div",d$,[n.createVNode(n.unref(le.BSButton),{variant:"text",caption:P.sourceCode?"본문 편집 ●":"본문 편집",onClick:K=>N(P)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",u$,[x[2]||(x[2]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(fl,{multiline:"",name:`op-desc-${P.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":P.description,"onUpdate:modelValue":K=>m(P,K)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",f$,[x[3]||(x[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(le.BSSelect),{width:"100%","model-value":p(P),items:d,"value-provider":f,"label-provider":u,"onUpdate:modelValue":K=>K&&g(P,K)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",m$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(P)===null}]),title:"없음",onClick:K=>_(P,null)},"∅",10,p$),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),K=>(n.openBlock(),n.createElementBlock("button",{key:K,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(P)===K}]),style:n.normalizeStyle({background:n.unref(Dn)(K)}),title:n.unref(Bn)(K),onClick:T=>_(P,K)},null,14,h$))),128))])]))),128)):n.createCommentVNode("",!0)],8,r$)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9c684fb9"]]),g$={class:"em-panel__head"},b$={class:"em-panel__head-row"},_$={class:"em-panel__context"},v$=["disabled"],w$={key:0,class:"em-panel__note"},E$={key:1,class:"em-panel__note"},k$={key:2,class:"em-jpa"},N$={class:"em-field"},I$={class:"em-field"},$$={key:0,class:"em-field"},x$={class:"em-panel__sub"},S$={class:"em-field"},C$={class:"em-jpa"},R$={key:0,class:"em-panel__note"},V$={class:"em-jpa"},A$={class:"em-field"},T$={key:0,class:"em-panel__note"},M$={class:"em-field"},B$={class:"em-multilang"},D$={class:"em-field"},O$=["value"],L$={class:"em-field"},P$={class:"em-swatch"},z$={class:"em-swatch__row"},U$=["title","onClick"],H$={class:"em-panel__note"},F$={class:"em-field"},G$=["value"],Y$={class:"em-swatch"},W$={class:"em-swatch__row"},K$=["title","onClick"],Au=De(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 Y=r.value;return Y?a.state.logical.entities.find(U=>U.modelId===Y)??null:null}),c=n.computed(()=>{var Y;return((Y=a.selectedAttr.value)==null?void 0:Y.attrId)??null}),d=n.computed(()=>new Set(a.selectedAttrIds.value)),u=n.computed(()=>c.value!==null),f=n.ref({});n.watch(u,()=>{f.value={}});function h(Y){return f.value[Y]??u.value}function m(Y){f.value={...f.value,[Y]:!h(Y)}}const p=n.computed(()=>{var V;const Y=s.value;if(!Y)return"엔티티";const U=(V=Y.table)==null?void 0:V.physicalName;return U?`${Y.name} (${U})`:Y.name}),g=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="association"?a.state.logical.associations.find(U=>U.modelId===Y.id)??null:null}),b=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="group"?a.state.logical.groups.find(U=>U.modelId===Y.id)??null:null}),_=n.computed(()=>{const Y=l.value;return(Y==null?void 0:Y.kind)==="note"?a.state.layout.notes.find(U=>U.modelId===Y.id)??null:null}),N=n.computed(()=>{var U,V;const Y=(U=b.value)==null?void 0:U.name;return(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((V=b.value)==null?void 0:V.packageName)||"그룹"}),y=n.computed(()=>{if(s.value){const Y=d.value.size;if(Y>1)return`엔티티 · ${s.value.name} › 속성 · ${Y}개`;if(c.value){const U=s.value.attributes.find(V=>V.modelId===c.value);return(U==null?void 0:U.attrType)==="DIVIDER"?`엔티티 · ${s.value.name} › 구분선`:`엔티티 · ${s.value.name} › 속성 · ${(U==null?void 0:U.name)??""}`}return`엔티티 · ${s.value.name}`}if(g.value){const Y=U=>{var V;return((V=a.state.logical.entities.find(C=>C.modelId===U))==null?void 0:V.name)??U};return`관계 · ${Y(g.value.end1.entityRef)} — ${Y(g.value.end2.entityRef)}`}return b.value?`그룹 · ${N.value}`:_.value?"노트":"선택된 항목 없음"}),x=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],q=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],P=["LIST","SET"],K=["inherit","LAZY","EAGER"],T=Y=>Y;function ie(Y){return Y==="inherit"?"기본(따름)":Y}const te=n.computed(()=>!!g.value&&g.value.end1.entityRef===g.value.end2.entityRef);function fe(Y,U){g.value&&a.updateAssociationEnd(g.value.modelId,Y,U)}function M(Y){g.value&&!te.value&&a.setAssociationIdentifying(g.value.modelId,Y)}function ne(Y){var U,V,C;return!!((C=(V=(U=g.value)==null?void 0:U[Y].jpa)==null?void 0:V.cascadeTypes)!=null&&C.includes("ALL"))}function E(Y,U,V){var O,oe;const C=(O=g.value)==null?void 0:O[Y];if(U==="ALL"&&V){fe(Y,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:["ALL"]}});return}const R=new Set(((oe=C==null?void 0:C.jpa)==null?void 0:oe.cascadeTypes)??[]);V?R.add(U):R.delete(U),fe(Y,{jpa:{...C==null?void 0:C.jpa,cascadeTypes:[...R]}})}function S(Y,U){var C;const V=(C=g.value)==null?void 0:C[Y];fe(Y,{jpa:{...V==null?void 0:V.jpa,...U}})}function I(Y){var U,V;return((V=(U=g.value)==null?void 0:U[Y].jpa)==null?void 0:V.fetchType)??"inherit"}function B(Y,U){S(Y,{fetchType:U==="inherit"?void 0:U})}function G(Y){var V;const U=(V=g.value)==null?void 0:V[Y==="end1"?"end2":"end1"];return(U==null?void 0:U.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(U==null?void 0:U.multiplicity)==="ONE_OR_MORE_INSTANCES"}const X=n.computed(()=>{const Y=g.value;if(!Y)return null;for(const U of a.state.logical.entities){const V=U.attributes.find(O=>{var oe;return((oe=O.embedded)==null?void 0:oe.associationRef)===Y.modelId&&O.attrType==="EMBED_OWN"});if(!V)continue;const C=Y.end2.entityRef===V.embedded.embeddableRef?"end2":"end1",R=Y[C].jpa;return{which:C,isCollection:Y[C].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 A(Y){g.value&&a.setEmbedCollectionMode(g.value.modelId,Y?"COLLECTION":"SINGLE")}function ae(Y){const U=X.value;U&&S(U.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function se(Y){const U=X.value;U&&S(U.which,{collectionTable:Y.trim()||void 0})}function ge(Y){const U=X.value;U&&S(U.which,{orderColumn:Y.trim()||void 0})}function _e(Y){b.value&&a.updateGroup(b.value.modelId,Y)}function re(Y,U){var V;_e({name:{...(V=b.value)==null?void 0:V.name,[Y]:U}})}const ye=n.computed(()=>{var Y;return b.value?Xe((Y=a.state.layout.groupLayouts.find(U=>U.groupRef===b.value.modelId))==null?void 0:Y.style):null});function be(Y){b.value&&a.setGroupSwatch(b.value.modelId,Y)}function $e(Y){_.value&&a.setNoteMemo(_.value.modelId,Y)}const Se=n.computed(()=>{var Y;return Xe((Y=_.value)==null?void 0:Y.style)});function Ce(Y){_.value&&a.setNoteSwatch(_.value.modelId,Y)}return(Y,U)=>(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:U[0]||(U[0]=(...V)=>e.startResize&&e.startResize(...V))},null,34),n.createElementVNode("header",g$,[n.createElementVNode("div",b$,[U[12]||(U[12]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:"접기",onClick:U[1]||(U[1]=V=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})])]),n.createElementVNode("p",_$,n.toDisplayString(y.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(sd,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("basics"),title:p.value,onToggle:U[2]||(U[2]=V=>m("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(e$,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(l$,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("index"),onToggle:U[3]||(U[3]=V=>m("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(y$,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:h("ops"),onToggle:U[4]||(U[4]=V=>m("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),g.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(le.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!g.value.identifying,disabled:te.value||!!X.value,"onUpdate:modelValue":M},null,8,["model-value","disabled"]),te.value?(n.openBlock(),n.createElementBlock("p",w$,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):X.value?(n.openBlock(),n.createElementBlock("p",E$,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),X.value?(n.openBlock(),n.createElementBlock("fieldset",k$,[U[16]||(U[16]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(le.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":X.value.isCollection,"onUpdate:modelValue":A},null,8,["model-value"]),X.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",N$,[U[13]||(U[13]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":X.value.collectionType,items:P,"value-provider":T,"label-provider":T,"onUpdate:modelValue":U[5]||(U[5]=V=>V&&ae(V))},null,8,["model-value"])]),n.createElementVNode("label",I$,[U[14]||(U[14]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":X.value.collectionTable,"onUpdate:modelValue":se},null,8,["model-value"])]),X.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",$$,[U[15]||(U[15]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":X.value.orderColumn,"onUpdate:modelValue":ge},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),U[17]||(U[17]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],V=>{var C,R,O,oe;return n.createElementVNode("div",{key:V,class:"em-end"},[n.createElementVNode("h4",x$,n.toDisplayString(V)+" → "+n.toDisplayString(g.value[V].entityRef),1),n.createElementVNode("label",S$,[U[18]||(U[18]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":g.value[V].multiplicity,items:x,"value-provider":T,"label-provider":T,disabled:((C=X.value)==null?void 0:C.which)===V,"onUpdate:modelValue":j=>fe(V,{multiplicity:j})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-navigable`,class:"em-check",label:"navigable","model-value":g.value[V].navigable,"onUpdate:modelValue":j=>fe(V,{navigable:j})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-composition`,class:"em-check",label:"composition","model-value":g.value[V].composition,"onUpdate:modelValue":j=>fe(V,{composition:j})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",C$,[U[19]||(U[19]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(q,j=>{var k,$;return n.createVNode(n.unref(le.BSCheckbox),{key:j,name:`${V}-cascade-${j}`,class:"em-check",label:j,"model-value":!!(($=(k=g.value[V].jpa)==null?void 0:k.cascadeTypes)!=null&&$.includes(j)),disabled:j!=="ALL"&&ne(V),"onUpdate:modelValue":L=>E(V,j,L)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ne(V)?(n.openBlock(),n.createElementBlock("p",R$,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",V$,[U[22]||(U[22]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",A$,[U[20]||(U[20]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(le.BSSelect),{"model-value":I(V),items:K,"value-provider":T,"label-provider":ie,"onUpdate:modelValue":j=>j&&B(V,j)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(le.BSCheckbox),{name:`${V}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((R=g.value[V].jpa)!=null&&R.orphanRemoval),disabled:G(V),"onUpdate:modelValue":j=>S(V,{orphanRemoval:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),G(V)&&((O=g.value[V].jpa)!=null&&O.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",T$,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",M$,[U[21]||(U[21]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(le.BSTextInput),{name:`${V}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((oe=g.value[V].jpa)==null?void 0:oe.orderBy)??"","onUpdate:modelValue":j=>S(V,{orderBy:j.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",B$,[U[23]||(U[23]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,V=>{var C;return n.openBlock(),n.createElementBlock("label",{key:V,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(V),1),n.createVNode(n.unref(le.BSTextInput),{name:`grp-name-${V}`,width:"100%","model-value":((C=b.value.name)==null?void 0:C[V])??"","onUpdate:modelValue":R=>re(V,R)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",D$,[U[24]||(U[24]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:U[6]||(U[6]=V=>_e({description:V.target.value}))},null,40,O$)]),n.createElementVNode("label",L$,[U[25]||(U[25]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(le.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":U[7]||(U[7]=V=>_e({packageName:V}))},null,8,["model-value"])]),n.createVNode(n.unref(le.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":U[8]||(U[8]=V=>_e({excludeDDLGeneration:V}))},null,8,["model-value"]),n.createElementVNode("fieldset",P$,[U[26]||(U[26]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",z$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ye.value===null}]),title:"없음",onClick:U[9]||(U[9]=V=>be(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":ye.value===V}]),style:n.normalizeStyle({background:n.unref(Dn)(V)}),title:n.unref(Bn)(V),onClick:C=>be(V)},null,14,U$))),128))])]),n.createElementVNode("p",H$,"멤버 엔티티 "+n.toDisplayString(b.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",F$,[U[27]||(U[27]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:_.value.memo,rows:"6",onChange:U[10]||(U[10]=V=>$e(V.target.value))},null,40,G$)]),n.createElementVNode("fieldset",Y$,[U[28]||(U[28]=n.createElementVNode("legend",null,"색상",-1)),n.createElementVNode("div",W$,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Se.value===null}]),title:"없음",onClick:U[11]||(U[11]=V=>Ce(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(pn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":Se.value===V}]),style:n.normalizeStyle({background:n.unref(Dn)(V)}),title:n.unref(Bn)(V),onClick:C=>Ce(V)},null,14,K$))),128))])])],64)):n.createCommentVNode("",!0)],8,v$)],4))}}),[["__scopeId","data-v-c5358a75"]]),q$={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function X$(e){const t=e.split("-")[1];return t?q$[t]??t:e}function j$(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Z$=["title"],J$=["title","onClick"],Q$={key:0,class:"em-validation__body"},ex={class:"em-validation__opt"},tx={key:0,class:"em-validation__empty"},nx={key:1,class:"em-validation__empty"},ox={key:2,class:"em-validation__list"},ix=["onClick"],ax={class:"em-validation__item-msg"},lx={key:0,class:"em-validation__item-entity"},rx=["title"],sx=De(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const b of o.state.logical.entities)g.set(b.modelId,b.name);return g});function l(g){const b=j$(g);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 g={error:0,warning:0,info:0};for(const b of i.value)g[b.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,b)=>r[g.severity].order-r[b.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:l(g),category:X$(g.ruleId)}))),f=n.ref(!1);function h(g){c.value[g]=!c.value[g]}function m(g){if(!f.value){f.value=!0;return}h(g)}function p(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,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,Z$),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:N=>m(_)},[n.createVNode(Ve,{name:r[_].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[_]),1)],10,J$)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",Q$,[n.createElementVNode("label",ex,[n.createVNode(n.unref(le.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",tx,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",nx," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",ox,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:_,entityName:N,category:y},x)=>(n.openBlock(),n.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${x}`,class:n.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:q=>p(_)},[n.createVNode(Ve,{name:r[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",ax,[N?(n.openBlock(),n.createElementBlock("span",lx,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(_.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},n.toDisplayString(y),9,rx)],10,ix))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-21432077"]]),cx={class:"em-history"},dx={class:"em-history__head"},ux={class:"em-history__title"},fx={class:"em-history__head-actions"},mx=["disabled"],px={class:"em-history__filters"},hx={class:"em-history__filter"},yx={class:"em-history__body"},gx={key:0,class:"em-history__empty"},bx={key:1,class:"em-history__empty is-error"},_x={key:2,class:"em-history__empty"},vx={key:3,class:"em-history__list"},wx=["onClick"],Ex={class:"em-history__summary"},kx={class:"em-history__seq"},Nx={class:"em-history__gmeta"},Ix={class:"em-history__who"},$x={key:0,class:"em-history__time"},xx={key:1,class:"em-history__restored-from"},Sx={key:0,class:"em-history__detail"},Cx={class:"em-history__action-head"},Rx={class:"em-history__action-name"},Vx={key:0,class:"em-history__fields"},Ax={class:"em-history__fname"},Tx={key:0,class:"em-history__old"},Mx={class:"em-history__val"},Bx={key:1,class:"em-history__restore"},Dx=["disabled","onClick"],Ox=["disabled"],Lx=["onClick"],Px=De(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(A){s.value=A instanceof Error?A.message:"이력을 불러오지 못했습니다."}finally{r.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,A=>{A&&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(A=>[A.modelId,A]))),m=n.computed(()=>new Map(a.state.logical.associations.map(A=>[A.modelId,A]))),p=n.computed(()=>new Map((a.state.logical.groups??[]).map(A=>{var ae;return[A.modelId,A.packageName||((ae=A.name)==null?void 0:ae.ko)||A.modelId]})));function g(A){var _e,re,ye,be,$e,Se,Ce;const ae=m.value.get(A);if(!ae)return"연관";if((_e=ae.description)!=null&&_e.trim())return ae.description.trim();const se=(be=(ye=h.value.get((re=ae.end1)==null?void 0:re.entityRef))==null?void 0:ye.name)==null?void 0:be.trim(),ge=(Ce=(Se=h.value.get(($e=ae.end2)==null?void 0:$e.entityRef))==null?void 0:Se.name)==null?void 0:Ce.trim();return se&&ge?`${se}→${ge}`:"연관"}function b(A){var ae,se,ge,_e;if(A.kind==="entity")return((se=(ae=h.value.get(A.ref))==null?void 0:ae.name)==null?void 0:se.trim())||"(이름 없음)";if(A.kind==="attribute"||A.kind==="operation"||A.kind==="index"){const re=A.entityRef?h.value.get(A.entityRef):void 0,be=((A.kind==="attribute"?re==null?void 0:re.attributes:A.kind==="operation"?re==null?void 0:re.operations:re==null?void 0:re.indexes)??[]).find(Se=>Se.modelId===A.ref),$e=(ge=re==null?void 0:re.name)==null?void 0:ge.trim();return`${$e?$e+".":""}${((_e=be==null?void 0:be.name)==null?void 0:_e.trim())||A.ref}`}return A.kind==="association"?g(A.ref):A.kind==="associationEnd"?`${g(A.ref)}(${A.end})`:A.kind==="group"?`그룹 ${p.value.get(A.ref)??A.ref}`:A.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"추가",update:"수정",remove:"삭제"},y=n.ref("all"),x=[{v:"all",label:"전체"},{v:"edit",label:"편집"},{v:"restore",label:"복원"}],q=n.computed({get:()=>y.value,set:A=>{A&&(y.value=A)}}),P=n.computed(()=>ar(l.value)),K=n.computed(()=>P.value.length?P.value[0].seq:null),T=n.computed(()=>y.value==="all"?P.value:P.value.filter(A=>(A.kind??"edit")===y.value));function ie(A){return A===void 0?"—":A===null?"(비움)":typeof A=="object"?JSON.stringify(A):String(A)}function te(A){const ae=b(A.subject);if(A.verb==="add")return`${ae} 추가`;if(A.verb==="remove")return`${ae} 삭제`;if(A.fields.length===1){const se=A.fields[0];return`${ae}.${se.field} ${se.oldValue!==void 0?ie(se.oldValue)+"→":""}${ie(se.value)}`}return`${ae} ${A.fields.length}개 변경`}function fe(A){return A.actions.length===0?"변경 없음":A.actions.length===1?te(A.actions[0]):`${te(A.actions[0])} 외 ${A.actions.length-1}건`}const M=n.ref(new Set);function ne(A){const ae=new Set(M.value);ae.has(A)?ae.delete(A):ae.add(A),M.value=ae}function E(A){if(A==null)return"";const ae=new Date(A);return isNaN(ae.getTime())?String(A):ae.toLocaleString()}function S(A){return A.author||(A.origin?`(${A.origin})`:"—")}const I=n.ref(null),B=n.ref(!1);function G(A){I.value=A}async function X(A){B.value=!0;try{const ae=await a.restoreToSeq(A);ae.ok||(s.value=`복원 실패: ${ae.reason??"알 수 없음"}`)}finally{B.value=!1,I.value=null}}return(A,ae)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",cx,[n.createElementVNode("header",dx,[n.createElementVNode("div",ux,[n.createVNode(Ve,{name:"undo",size:15}),ae[4]||(ae[4]=n.createElementVNode("span",null,"변경 이력",-1))]),n.createElementVNode("div",fx,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"새로고침",disabled:r.value,onClick:ae[0]||(ae[0]=se=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,mx),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:"닫기",onClick:ae[1]||(ae[1]=se=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})])])]),n.createElementVNode("div",px,[n.createElementVNode("label",hx,[ae[5]||(ae[5]=n.createElementVNode("span",null,"표시",-1)),n.createVNode(n.unref(le.BSSelect),{modelValue:q.value,"onUpdate:modelValue":ae[2]||(ae[2]=se=>q.value=se),items:x,"value-provider":se=>se.v,"label-provider":se=>se.label},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",yx,[r.value&&!c.value?(n.openBlock(),n.createElementBlock("p",gx,"이력을 불러오는 중…")):s.value?(n.openBlock(),n.createElementBlock("p",bx,n.toDisplayString(s.value),1)):T.value.length===0?(n.openBlock(),n.createElementBlock("p",_x,n.toDisplayString(c.value?"표시할 변경 이력이 없습니다.":"이력을 불러오세요."),1)):(n.openBlock(),n.createElementBlock("ul",vx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,se=>(n.openBlock(),n.createElementBlock("li",{key:se.seq,class:n.normalizeClass(["em-history__group",[`is-${se.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ge=>ne(se.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":M.value.has(se.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${se.kind??"edit"}`])},n.toDisplayString(se.kind==="restore"?"복원":"편집"),3),n.createElementVNode("span",Ex,n.toDisplayString(fe(se)),1),n.createElementVNode("span",kx,"#"+n.toDisplayString(se.seq),1)],8,wx),n.createElementVNode("div",Nx,[n.createElementVNode("span",Ix,n.toDisplayString(S(se)),1),se.ts?(n.openBlock(),n.createElementBlock("span",$x,n.toDisplayString(E(se.ts)),1)):n.createCommentVNode("",!0),se.kind==="restore"&&se.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",xx,"← #"+n.toDisplayString(se.restoredFromSeq),1)):n.createCommentVNode("",!0)]),M.value.has(se.seq)?(n.openBlock(),n.createElementBlock("div",Sx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se.actions,(ge,_e)=>(n.openBlock(),n.createElementBlock("div",{key:_e,class:"em-history__action"},[n.createElementVNode("div",Cx,[n.createVNode(Ve,{name:_[ge.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",Rx,n.toDisplayString(b(ge.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ge.verb}`])},n.toDisplayString(N[ge.verb]),3)]),ge.fields.length?(n.openBlock(),n.createElementBlock("ul",Vx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ge.fields,(re,ye)=>(n.openBlock(),n.createElementBlock("li",{key:ye,class:"em-history__field"},[n.createElementVNode("span",Ax,n.toDisplayString(re.field),1),re.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",Tx,n.toDisplayString(ie(re.oldValue)),1)):n.createCommentVNode("",!0),re.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",Mx,n.toDisplayString(ie(re.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&se.seq!==K.value?(n.openBlock(),n.createElementBlock("div",Bx,[I.value===se.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[ae[6]||(ae[6]=n.createElementVNode("span",{class:"em-history__confirm-msg"},"이 시점으로 되돌립니다.",-1)),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:B.value,onClick:ge=>X(se.seq)},"복원",8,Dx),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:B.value,onClick:ae[3]||(ae[3]=ge=>I.value=null)},"취소",8,Ox)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ge=>G(se.seq)},[n.createVNode(Ve,{name:"undo",size:12}),ae[7]||(ae[7]=n.createTextVNode(" 이 시점으로 복원 ",-1))],8,Lx))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-14fe445b"]]);function zx(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 Tu(e){const t=n.ref(zx(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 Ux={class:"em-modeler"},Hx={class:"em-modeler__body"},Fx={class:"em-drawer__inner"},Gx={class:"em-drawer__head"},Yx={class:"em-drawer__actions"},Wx=["title"],Kx=De(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}=Tu({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=Tu({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),f=n.ref(null);return(h,m)=>{var p,g,b;return n.openBlock(),n.createElementBlock("div",Ux,[n.createVNode(Vu,{controller:e.controller,"history-open":i.value,onExportSvg:m[0]||(m[0]=_=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onToggleHistory:m[1]||(m[1]=_=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",Hx,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",Fx,[n.createElementVNode("header",Gx,[m[9]||(m[9]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",Yx,[(p=f.value)!=null&&p.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(g=f.value)!=null&&g.allExpanded?"모두 접기":"모두 펼치기",onClick:m[2]||(m[2]=_=>{var N;return(N=f.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(b=f.value)!=null&&b.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,Wx)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:m[3]||(m[3]=_=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Ru,{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]=(..._)=>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[5]||(m[5]=_=>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(Cu,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(Au,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:m[6]||(m[6]=_=>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]=_=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],512),[[n.vShow,!o.value]])]),_:1}),n.createVNode(Px,{controller:e.controller,open:i.value,onClose:m[8]||(m[8]=_=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(sx,{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=Yf,Ee.AssociationEdge=Td,Ee.CUSTOM_TYPE_VALUE=Ot,Ee.CommandStack=ha,Ee.DEFAULT_JAVA_TYPE=sa,Ee.DiagramCanvas=Cu,Ee.DiagramExplorer=Ru,Ee.EDITOR=yn,Ee.EditModeToggle=EI,Ee.EditorToolbar=Vu,Ee.EntityModeler=Kx,Ee.EntityNode=gd,Ee.GROUP_CODE_ENUM_VALUE=Wn,Ee.GroupNode=bd,Ee.JAVA_TYPES=ca,Ee.NoteNode=_d,Ee.OpSyncAdapter=Fr,Ee.PHYSICAL_NAME_MAX_LENGTH=ua,Ee.PropertyPanel=Au,Ee.RevCache=Hr,Ee.SELECTABLE_JAVA_TYPES=Zl,Ee.SYMBOLIC_OP_KINDS=Gr,Ee.SYMBOLIC_OP_SCHEMA=es,Ee.anchoredEdgePoint=ia,Ee.buildAgentBatch=Wf,Ee.buildDiagramSvg=xu,Ee.buildOrthogonalPath=ea,Ee.buildSelfLoopPath=Hl,Ee.buildStraightPath=na,Ee.commands=$f,Ee.computeAutoLayout=Fl,Ee.createEditorController=O_,Ee.displayLabel=Mo,Ee.emptyState=md,Ee.entityModelToText=Kl,Ee.estimateEntityHeight=Yl,Ee.exportDiagramSvg=Su,Ee.fromPersisted=am,Ee.indexColumnsByModelId=Kn,Ee.javaTypeLabel=wn,Ee.migrateLegacyMoney=rf,Ee.newId=Te,Ee.orthogonalMidpoints=ta,Ee.packEntityBoxes=zu,Ee.physicalNameWarning=Oo,Ee.projectActionLog=ar,Ee.projectEntityAudit=or,Ee.projectFieldAudit=Lt,Ee.rectExitPoint=oa,Ee.renderDiagramSvg=Xl,Ee.resolveDiagram=zl,Ee.resolveSharedColumn=Do,Ee.resolveSymbolicOps=Bf,Ee.restoreDeepEqual=En,Ee.segmentMidpoints=aa,Ee.sideDir=Yn,Ee.synthesizeRestoreOps=gf,Ee.toPersisted=_m,Ee.toPersistedV2=vm,Ee.validateModel=tr,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));