@g1cloud/entity-modeler-next 5.0.0-alpha.1

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.
Files changed (70) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +42 -0
  3. package/dist/adapter/diagramAdapter.d.ts +44 -0
  4. package/dist/adapter/persisted.d.ts +245 -0
  5. package/dist/agent/buildAgentBatch.d.ts +16 -0
  6. package/dist/agent/resolver.d.ts +54 -0
  7. package/dist/agent/schema.d.ts +9 -0
  8. package/dist/agent/symbolicOp.d.ts +109 -0
  9. package/dist/command/commands.d.ts +108 -0
  10. package/dist/command/op.d.ts +80 -0
  11. package/dist/command/opSync.d.ts +89 -0
  12. package/dist/command/stack.d.ts +48 -0
  13. package/dist/command/types.d.ts +29 -0
  14. package/dist/core/autolayout.d.ts +12 -0
  15. package/dist/core/dbTypes.d.ts +45 -0
  16. package/dist/core/id.d.ts +2 -0
  17. package/dist/core/javaTypes.d.ts +52 -0
  18. package/dist/core/propagation.d.ts +49 -0
  19. package/dist/core/relationMarker.d.ts +44 -0
  20. package/dist/core/resolve.d.ts +63 -0
  21. package/dist/core/routing.d.ts +58 -0
  22. package/dist/core/sharedColumn.d.ts +19 -0
  23. package/dist/core/sqlReservedWords.d.ts +25 -0
  24. package/dist/core/svg.d.ts +98 -0
  25. package/dist/core/text.d.ts +8 -0
  26. package/dist/core/types.d.ts +400 -0
  27. package/dist/core/validation.d.ts +53 -0
  28. package/dist/editor/controller.d.ts +371 -0
  29. package/dist/entity-modeler-next.css +1 -0
  30. package/dist/entity-modeler.js +19943 -0
  31. package/dist/entity-modeler.umd.cjs +41 -0
  32. package/dist/index.d.ts +32 -0
  33. package/dist/view/AssociationEdge.vue.d.ts +16 -0
  34. package/dist/view/DiagramCanvas.vue.d.ts +9 -0
  35. package/dist/view/DiagramExplorer.vue.d.ts +11 -0
  36. package/dist/view/EditModeToggle.vue.d.ts +10 -0
  37. package/dist/view/EditorToolbar.vue.d.ts +10 -0
  38. package/dist/view/EmContextMenu.vue.d.ts +26 -0
  39. package/dist/view/EmIcon.vue.d.ts +12 -0
  40. package/dist/view/EntityAttributesWide.vue.d.ts +7 -0
  41. package/dist/view/EntityBasicsSection.vue.d.ts +7 -0
  42. package/dist/view/EntityColumnsSection.vue.d.ts +7 -0
  43. package/dist/view/EntityDetailModal.vue.d.ts +7 -0
  44. package/dist/view/EntityIndexSection.vue.d.ts +7 -0
  45. package/dist/view/EntityIndexesWide.vue.d.ts +7 -0
  46. package/dist/view/EntityModeler.vue.d.ts +6 -0
  47. package/dist/view/EntityNode.vue.d.ts +20 -0
  48. package/dist/view/EntityOperationsSection.vue.d.ts +7 -0
  49. package/dist/view/EntityOperationsWide.vue.d.ts +7 -0
  50. package/dist/view/EntityTextPreview.vue.d.ts +5 -0
  51. package/dist/view/GroupCodeCombobox.vue.d.ts +11 -0
  52. package/dist/view/GroupNode.vue.d.ts +11 -0
  53. package/dist/view/InlineIssueBadge.vue.d.ts +8 -0
  54. package/dist/view/MultiLangTextField.vue.d.ts +24 -0
  55. package/dist/view/NoteConnectionEdge.vue.d.ts +12 -0
  56. package/dist/view/NoteNode.vue.d.ts +11 -0
  57. package/dist/view/OperationSourceEditor.vue.d.ts +7 -0
  58. package/dist/view/PropertyPanel.vue.d.ts +6 -0
  59. package/dist/view/ValidationPanel.vue.d.ts +6 -0
  60. package/dist/view/diagramGeometry.d.ts +9 -0
  61. package/dist/view/exportSvg.d.ts +7 -0
  62. package/dist/view/groupCodeFilter.d.ts +8 -0
  63. package/dist/view/groupHover.d.ts +10 -0
  64. package/dist/view/openEntityDetail.d.ts +5 -0
  65. package/dist/view/relationHighlight.d.ts +38 -0
  66. package/dist/view/swatches.d.ts +37 -0
  67. package/dist/view/useFloatingRoute.d.ts +28 -0
  68. package/dist/view/validationDisplay.d.ts +10 -0
  69. package/dist/view/waypointController.d.ts +14 -0
  70. package/package.json +61 -0
@@ -0,0 +1,41 @@
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,te){"use strict";var Fx=Object.defineProperty;var Gx=(Ne,n,te)=>n in Ne?Fx(Ne,n,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[n]=te;var Le=(Ne,n,te)=>Gx(Ne,typeof n!="symbol"?n+"":n,te);const Qd={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function eu(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 _a(e,t,o={}){const i={...Qd,...o},l=new Map(e.entities.map(h=>[h.modelId,h])),a=new Map(e.associations.map(h=>[h.modelId,h])),r=new Map(t.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(t.associationLayouts.map(h=>[h.associationRef,h])),c=t.entityLayouts.map(h=>h.entityRef).filter(h=>!l.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!a.has(h)),u=new Map;for(const h of e.groups)for(const S of h.memberEntityRefs)u.set(S,h.modelId);const f=new Map;for(const h of t.groupLayouts)for(const S of h.memberNoteRefs??[])f.set(S,h.groupRef);let p=0;const m=e.entities.map(h=>{const S=u.get(h.modelId),X=r.get(h.modelId);if(X){const J={location:{x:X.geo.location.x,y:X.geo.location.y},size:{width:X.geo.size.width,height:X.geo.size.height}};return{entity:h,geo:J,collapsed:X.collapsed??!1,groupRef:S,style:X.style,attributeStyles:X.attributeStyles,operationStyles:X.operationStyles}}const W=eu(p++,i);return{entity:h,geo:W,collapsed:!1,groupRef:S}}),g=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),_=e.groups.map(h=>{const S=g.get(h.modelId),X=S?{location:{x:S.geo.location.x,y:S.geo.location.y},size:{width:S.geo.size.width,height:S.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:X,style:S==null?void 0:S.style}}),k=e.associations.map(h=>{const S=s.get(h.modelId);return{association:h,waypoints:(S==null?void 0:S.waypoints)??[],sourceColumnRef:S==null?void 0:S.sourceColumnRef,targetColumnRef:S==null?void 0:S.targetColumnRef}}),b=t.notes.map(h=>({note:{...h,geo:{location:{x:h.geo.location.x,y:h.geo.location.y},size:{width:h.geo.size.width,height:h.geo.size.height}}},groupRef:f.get(h.modelId)})),$=[];for(const h of t.notes)for(const S of h.connections??[])l.has(S.targetRef)&&$.push({noteRef:h.modelId,targetRef:S.targetRef,waypoints:S.waypoints.map(X=>({x:X.x,y:X.y}))});return{entities:m,associations:k,groups:_,notes:b,noteConnections:$,prunedEntityRefs:c,prunedAssociationRefs:d}}function kn(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 ln=.5;function va(e,t,o,i,l,a){const r=kn(t),s=kn(l),c={x:e.x+r.x*a,y:e.y+r.y*a},d={x:i.x+s.x*a,y:i.y+s.y*a},u=[c,...o,d],f=[];let p=e;const m=(k,b)=>{(Math.abs(k.x-p.x)>=ln||Math.abs(k.y-p.y)>=ln)&&(f.push({a:p,b:k,seg:b}),p=k)};m(c,0);let g=r.x!==0,_=c;for(let k=1;k<u.length;k++){const b=u[k],$=k<=o.length?k-1:o.length,h=Math.abs(b.x-_.x)<ln,S=Math.abs(b.y-_.y)<ln;h&&S||(h?(m(b,$),g=!1):S?(m(b,$),g=!0):g?(m({x:_.x,y:b.y},$),m(b,$),g=!0):(m({x:b.x,y:_.y},$),m(b,$),g=!1),_=b)}return m(i,o.length),f}function Bi(e,t,o,i,l,a=20){const r=va(e,t,o,i,l,a);let s=`M ${Ge(e.x)},${Ge(e.y)}`;for(const c of r)s+=` L ${Ge(c.b.x)},${Ge(c.b.y)}`;return s}const tu=14;function Di(e,t,o,i,l,a=20){return va(e,t,o,i,l,a).filter(r=>Math.hypot(r.b.x-r.a.x,r.b.y-r.a.y)>=tu).map(r=>({point:{x:(r.a.x+r.b.x)/2,y:(r.a.y+r.b.y)/2},segIndex:r.seg}))}function Ge(e){return Math.round(e*100)/100}const nu=36;function wa(e,t,o=nu){const i=Math.max(e.x,t.x)+o;return`M ${Ge(e.x)},${Ge(e.y)} L ${Ge(i)},${Ge(e.y)} L ${Ge(i)},${Ge(t.y)} L ${Ge(t.x)},${Ge(t.y)}`}function Oi(e,t,o){const i=[e,...t,o];let l=`M ${Ge(i[0].x)},${Ge(i[0].y)}`;for(let a=1;a<i.length;a++)l+=` L ${Ge(i[a].x)},${Ge(i[a].y)}`;return l}function ou(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Li(e,t){const o=ou(e),i=e.width/2,l=e.height/2,a=t.x-o.x,r=t.y-o.y;if(Math.abs(a)<ln&&Math.abs(r)<ln)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=a!==0?i/Math.abs(a):1/0,c=r!==0?l/Math.abs(r):1/0,d=Math.min(s,c),u={x:o.x+a*d,y:o.y+r*d},f=s<=c?a>=0?"right":"left":r>=0?"bottom":"top";return{point:u,side:f}}function Pi(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 zi(e,t,o){const i=[e,...t,o],l=[];for(let a=1;a<i.length;a++){const r=i[a-1],s=i[a];l.push({x:(r.x+s.x)/2,y:(r.y+s.y)/2})}return l}const iu={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ea(e,t,o={}){const i={...iu,...o},l=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),a=[];let r=0;for(const u of e.groups){const f=l.get(u.modelId),p=f?f.location:{x:0,y:0},m=f?f.size.width:800;f&&(r=Math.max(r,f.location.y+f.size.height));const g=Math.max(1,Math.floor((m-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,k)=>{const b=k%g,$=Math.floor(k/g);a.push({id:_,location:{x:p.x+i.pad+b*i.cellWidth,y:p.y+i.pad+i.headerHeight+$*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=r>0?r+40:i.pad;return c.forEach((u,f)=>{const p=f%i.ungroupedCols,m=Math.floor(f/i.ungroupedCols);a.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+m*i.cellHeight}})}),a}function go(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 Na(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 ka(e){var a,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||(((a=c.name)==null?void 0:a.ko)??c.modelId));const l=[];for(const c of e.entities){const d=(r=c.table)!=null&&r.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);l.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const f=[...c.attributes].sort((m,g)=>m.order-g.order);for(const m of f){if(m.attrType==="DIVIDER"){l.push(` ${"─".repeat(8)}${m.name?` ${m.name} ${"─".repeat(8)}`:""}`);continue}const g=m.dbAttrs[0],_=g!=null&&g.length?`(${g.length}${g.scale!=null?`,${g.scale}`:""})`:"",k=g?` → ${g.physicalName} ${g.dataType}${_}`:"",b=[m.identifier?"PK":"",m.notNull?"NOT NULL":"",g!=null&&g.unique?"UNIQUE":"",g!=null&&g.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);l.push(` - ${m.name}: ${m.type}${k}${b.length?` {${b.join(", ")}}`:""}`)}for(const m of c.indexes??[]){const g=m.columns.map(_=>`${o.get(_.columnRef)??_.columnRef}${_.descending?" DESC":""}`).join(", ");l.push(` index ${m.name}${m.unique?" UNIQUE":""}: ${g}`)}const p=[...c.operations??[]].sort((m,g)=>m.order-g.order);for(const m of p){const g=m.visibility?` {${m.visibility}}`:"",_=(s=m.description)!=null&&s.ko?` — ${m.description.ko}`:"";l.push(` method ${m.name}()${g}${_}`)}l.push("")}if(e.associations.length){l.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)":"";l.push(` ${d} ${Na(c.end1.multiplicity)} —— ${Na(c.end2.multiplicity)} ${u}${f}`)}}return l.join(`
2
+ `).trim()}function Ke(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function xe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function xa(e){return`<text ${[`x="${xe(e.x)}"`,`y="${xe(e.y)}"`,`fill="${Ke(e.fill)}"`,`font-size="${xe(e.fontSize)}"`,e.fontFamily?`font-family="${Ke(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ke(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ke(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ke(e.text)}</text>`}function lu(e){return`<line x1="${xe(e.x1)}" y1="${xe(e.y)}" x2="${xe(e.x2)}" y2="${xe(e.y)}" stroke="${Ke(e.stroke)}" stroke-width="${xe(e.strokeWidth??1)}" />`}function au(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 ru(e,t,o,i,l){return[`M${xe(e+l.tl)},${xe(t)}`,`L${xe(e+o-l.tr)},${xe(t)}`,l.tr?`Q${xe(e+o)},${xe(t)} ${xe(e+o)},${xe(t+l.tr)}`:"",`L${xe(e+o)},${xe(t+i-l.br)}`,l.br?`Q${xe(e+o)},${xe(t+i)} ${xe(e+o-l.br)},${xe(t+i)}`:"",`L${xe(e+l.bl)},${xe(t+i)}`,l.bl?`Q${xe(e)},${xe(t+i)} ${xe(e)},${xe(t+i-l.bl)}`:"",`L${xe(e)},${xe(t+l.tl)}`,l.tl?`Q${xe(e)},${xe(t)} ${xe(e+l.tl)},${xe(t)}`:"","Z"].filter(Boolean).join(" ")}function Ui(e){const t=au(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${Ke(e.fill)}"`,`stroke="${Ke(e.stroke)}"`,`stroke-width="${xe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ke(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${xe(e.opacity)}"`:""].filter(Boolean),a=[o?`<path d="${ru(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${xe(e.x)}" y="${xe(e.y)}" width="${xe(e.w)}" height="${xe(e.h)}" ${i.join(" ")} />`];for(const r of e.lines??[])a.push(lu(r));for(const r of e.texts)a.push(xa(r));for(const r of e.icons??[])a.push(r);return`<g>${a.join("")}</g>`}function su(e){const o=[`<path ${[`d="${Ke(e.d)}"`,'fill="none"',`stroke="${Ke(e.stroke)}"`,`stroke-width="${xe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ke(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(xa(i));return`<g>${o.join("")}</g>`}function $a(e){const{x:t,y:o,w:i,h:l}=e.viewBox,a=[];e.background&&a.push(`<rect x="${xe(t)}" y="${xe(o)}" width="${xe(i)}" height="${xe(l)}" fill="${Ke(e.background)}" />`);for(const r of e.groups)a.push(Ui(r));for(const r of e.edges)a.push(su(r));for(const r of e.entities)a.push(Ui(r));for(const r of e.notes)a.push(Ui(r));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${xe(t)} ${xe(o)} ${xe(i)} ${xe(l)}" width="${xe(i)}" height="${xe(l)}">`+a.join("")+"</svg>"}const cu=["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"],du=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"]),uu=cu.filter(e=>!du.has(e)),fu={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Hi(e){return fu[e]??e}const mu=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]);function Ia(e,t=uu){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Pt="CustomType",yo="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:"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:yo,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Pt,label:"CustomType"}],pu=new Map(Ca.map(e=>[e.value,e.label]));function xn(e){return pu.get(e)??e}const hu=new Set([yo,"CustomMoneyType"]),gu=Ca.filter(e=>!hu.has(e.value)).map(e=>e.value===Pt?{...e,label:"CustomType (사용자정의)"}:e);function Ra(e,t=[]){const o=t.map(l=>{var r,s;const a=((r=l.label)==null?void 0:r.ko)??((s=l.label)==null?void 0:s.en);return{value:l.type,label:a?`${l.type} (${a})`:l.type}}),i=[...gu,...o];return e&&!i.some(l=>l.value===e)?[{value:e,label:xn(e)},...i]:i}function yu(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Va(e,t){var l;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(a=>a.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity!=="EXACTLY_ONE_INSTANCE")return((l=i.jpa)==null?void 0:l.collectionType)??"LIST"}function Fi(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${xn(t.type)}>`:yu(t)?xn(t.type):e==="CLASS"?t.type===Pt&&t.customType||xn(t.type):Hi(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function $n(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function bo(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 Gi=63;function _o(e){if(!e)return null;const t=e.length;return t<=Gi?null:`물리명이 ${Gi}자를 초과했습니다 (${t}자) — 일부 DB에서 잘릴 수 있습니다`}function Aa(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function it(e){return!e||e.trim()===""}function In(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function bu(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const f=t.get(u.end1.entityRef)??[];f.push(u.end2.entityRef),t.set(u.end1.entityRef,f)}const o=0,i=1,l=2,a=new Map,r=[],s=[],c=new Set,d=u=>{a.set(u,i),r.push(u);for(const f of t.get(u)??[]){const p=a.get(f)??o;if(p===o)d(f);else if(p===i){const m=r.slice(r.indexOf(f)),g=[...m].sort().join(" ");c.has(g)||(c.add(g),s.push(m))}}r.pop(),a.set(u,l)};for(const u of e.entities)(a.get(u.modelId)??o)===o&&d(u.modelId);return s}function Yi(e,t){const o=new Map;for(const i of e){const l=t(i);l==null||l===""||o.set(l,(o.get(l)??0)+1)}return e.filter(i=>{const l=t(i);return l!=null&&l!==""&&(o.get(l)??0)>1})}function Ta(e,t){var a,r,s;const o=[];for(const c of Yi(e.entities,d=>d.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`엔티티 이름이 중복됩니다: "${c.name}"`});for(const c of e.entities){const d=c.attributes.filter(m=>m.attrType!=="DIVIDER");if(it(c.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:"엔티티 이름이 비어 있습니다"}),c.stereotype==="JPA_ENTITY"&&!c.abstractClass&&(d.some(m=>m.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 식별자(PK) 속성이 없습니다"}),it((a=c.table)==null?void 0:a.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다"})),c.stereotype==="JPA_EMBEDDABLE")for(const m of d.filter(g=>g.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`임베더블 타입은 식별자 속성을 가질 수 없습니다: "${m.name}"`});for(const m of d.filter(g=>g.identifier&&g.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "${m.name}"`});for(const m of d)if(!m.identifier)for(const g of m.dbAttrs)!g.autoIncrement&&it(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) 속성에만 쓸 수 있습니다 — 비식별 속성 "${m.name}"에 설정되어 있습니다`});!c.abstractClass&&d.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:"속성이 하나도 없는 엔티티입니다"}),(t==null?void 0:t.largeEntityThreshold)!=null&&d.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:c.modelId,message:`속성이 ${d.length}개로 많습니다 (임계치 ${t.largeEntityThreshold} 초과) — 분해를 검토하세요`});for(const m of Yi(d,g=>g.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:`속성 이름이 중복됩니다: "${m.name}"`});for(const m of d)it(m.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:m.modelId,contextRef:c.modelId,message:"속성 이름이 비어 있습니다"});const u=d.flatMap(m=>m.dbAttrs).filter(m=>m.sharedColumnRef==null);for(const m of Yi(u,g=>g.physicalName))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 중복됩니다: "${m.physicalName}"`});for(const m of u){const g=_o(m.physicalName);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!it(m.physicalName)&&t.reservedWords.has(m.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`컬럼 물리명이 SQL 예약어입니다: "${m.physicalName}"`}),t!=null&&t.selectableDataTypes&&!it(m.dataType)&&!t.selectableDataTypes.has(m.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`타겟 DB가 지원하지 않는 컬럼 타입입니다: "${m.dataType}"`}),!it(m.dataType)&&mu.has(m.dataType)&&!m.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:m.modelId,contextRef:c.modelId,message:`${m.dataType} 타입에 length가 지정되지 않았습니다`})}if((r=t==null?void 0:t.embeddableCatalog)!=null&&r.length){const m=$n(d.flatMap(g=>g.dbAttrs));for(const g of d){if(g.attrType!=="EMBED_PREDEF")continue;const _=t.embeddableCatalog.find(k=>k.type===g.type);_&&g.dbAttrs.forEach((k,b)=>{if(k.sharedColumnRef==null)return;const $=_.fields[b],h=m.get(k.sharedColumnRef);if(!$||!h)return;(h.dataType!==$.dataType||(h.length??null)!==($.length??null)||(h.scale??null)!==($.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:c.modelId,message:`공유 대상 컬럼의 타입(${Aa(h)})이 ${$.name??"컬럼"} 정의(${Aa($)})와 다릅니다`})})}}for(const m of d){const g=m.dbAttrs[0];if(!(g!=null&&g.multiValue))continue;m.type===yo&&g.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:g.modelId,contextRef:c.modelId,message:`다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재(${m.type||"타입 미지정"} / ${g.dataType||"dataType 미지정"})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다`})}const f=(s=c.table)==null?void 0:s.physicalName,p=_o(f);p&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:p}),t!=null&&t.reservedWords&&!it(f)&&t.reservedWords.has(f.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:c.modelId,message:`테이블 물리명이 SQL 예약어입니다: "${f}"`});for(const m of c.indexes??[]){const g=_o(m.name);g&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:g}),t!=null&&t.reservedWords&&!it(m.name)&&t.reservedWords.has(m.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:m.modelId,contextRef:c.modelId,message:`인덱스 이름이 SQL 예약어입니다: "${m.name}"`})}}const i=new Map;for(const c of e.entities)for(const d of c.attributes)d.attrType==="EMBED_OWN"&&d.embedded&&i.set(d.embedded.associationRef,d);for(const c of e.associations){In(c.end1.multiplicity)&&In(c.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:c.modelId,message:"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요"}),i.has(c.modelId)&&c.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:c.modelId,message:"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다"});for(const d of["end1","end2"]){const u=c[d].jpa;if(!u)continue;const f=u.cascadeTypes??[],p=f.includes("ALL"),m=f.includes("REMOVE");p&&f.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:c.modelId,message:`${d}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)`}),u.orphanRemoval&&(m||p)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:c.modelId,message:`${d}: orphanRemoval이 cascade ${p?"ALL":"REMOVE"}와 의미가 겹칩니다`}),In(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&&In(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에서만 유효합니다`}),!In(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 l=new Map(e.entities.map(c=>[c.modelId,c.name||c.modelId]));for(const c of bu(e)){const d=[...c,c[0]].map(u=>l.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(!it(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 Se(){return crypto.randomUUID()}class Wi{constructor(t){Le(this,"undoStack",[]);Le(this,"redoStack",[]);Le(this,"savePoint",null);Le(this,"listeners",new Set);Le(this,"commandListeners",new Set);Le(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const l of this.commandListeners)l(t,o,i)}}function Ma(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function Fe(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function je(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Me(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function gt(e,t,o){var i,l;return(l=(i=e.layout.notes.find(a=>a.modelId===t))==null?void 0:i.connections)==null?void 0:l.find(a=>a.targetRef===o)}function Ki(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=Ma(o,e.modelId);i>=0&&o.logical.entities.splice(i,1);const l=Fe(o,e.modelId);l>=0&&o.layout.entityLayouts.splice(l,1)},emitOps(){const o={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},i={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Xi(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const l=Ma(i,e);if(l<0)throw new Error(`엔티티 없음: ${e}`);const a=Fe(i,e),r=[];i.logical.associations.forEach((u,f)=>{o(u)&&r.push({item:u,index:f})});const s=new Set(r.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,f)=>{s.has(u.associationRef)&&c.push({item:u,index:f})});const d=[];i.logical.groups.forEach(u=>{const f=u.memberEntityRefs.indexOf(e);f>=0&&d.push({groupId:u.modelId,index:f})}),t={entity:{item:i.logical.entities[l],index:l},entityLayout:a>=0?{item:i.layout.entityLayouts[a],index:a}:void 0,assocs:r,assocLayouts:c,groupMemberships:d},[...c].sort((u,f)=>f.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...r].sort((u,f)=>f.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const f=i.logical.groups.find(p=>p.modelId===u.groupId);f==null||f.memberEntityRefs.splice(u.index,1)}a>=0&&i.layout.entityLayouts.splice(a,1),i.logical.entities.splice(l,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((l,a)=>l.index-a.index).forEach(l=>i.logical.associations.splice(l.index,0,l.item)),[...t.assocLayouts].sort((l,a)=>l.index-a.index).forEach(l=>i.layout.associationLayouts.splice(l.index,0,l.item));for(const l of t.groupMemberships){const a=i.logical.groups.find(r=>r.modelId===l.groupId);a==null||a.memberEntityRefs.splice(l.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],l=[];for(const a of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:a.item.modelId}),l.push({kind:"association.add",casUnit:"logical",associationRef:a.item.modelId,value:a.item});for(const a of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:a.item.associationRef,incidental:!0}),l.push({kind:"associationLayout.add",casUnit:"layout",associationRef:a.item.associationRef,value:a.item,incidental:!0});for(const a of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e}),l.push({kind:"group.addMember",casUnit:"logical",containerRef:a.groupId,groupRef:a.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),l.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),l.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:l.reverse()}}}}function Ba(e,t){const o={};return{label:"엔티티 수정",apply(i){const l=Me(i,e);for(const a of Object.keys(t))o[a]=l[a];Object.assign(l,t)},invert(i){Object.assign(Me(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:t}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Da(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const l=Me(i,e);o=l.name,l.name=t},invert(i){Me(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function an(e,t){let o=null;return{label:"엔티티 이동",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.location},a.location={...t}},invert(i){const l=Fe(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.location=o)},emitOps(){const i=l=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Oa(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l].geo;o={...a.size},a.size={...t}},invert(i){const l=Fe(i,e);l>=0&&o&&(i.layout.entityLayouts[l].geo.size=o)},emitOps(){const i=l=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function qi(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 La(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.style,a.style=qi(a.style,t)},invert(i){const l=Fe(i,e);l>=0&&(i.layout.entityLayouts[l].style=o)},emitOps(i){const l=Fe(i,e),a=l>=0?i.layout.entityLayouts[l].style:void 0,r=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[r(a)],invert:[r(o)]}}}}function Pa(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const l=Fe(i,e);if(l<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const a=i.layout.entityLayouts[l];o=a.collapsed,a.collapsed=t},invert(i){const l=Fe(i,e);l>=0&&(i.layout.entityLayouts[l].collapsed=o)},emitOps(){const i=l=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:l}});return{forward:[i(t)],invert:[i(o)]}}}}function Zi(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,l)=>{i.collapsed=t[l]})},emitOps(o){const i=[],l=[];return o.layout.entityLayouts.forEach((a,r)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:e}}),l.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:a.entityRef,value:{collapsed:t[r]}})}),{forward:i,invert:l}}}}function vo(e,t,o){let i;return{label:"속성 색상 변경",apply(l){const a=Fe(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.attributeStyles;const s={...r.attributeStyles},c=qi(s[t],o);c?s[t]=c:delete s[t],r.attributeStyles=Object.keys(s).length?s:void 0},invert(l){const a=Fe(l,e);a>=0&&(l.layout.entityLayouts[a].attributeStyles=i)},emitOps(l){const a=Fe(l,e),r=a>=0?l.layout.entityLayouts[a].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function ji(e,t){return{label:"그룹 추가",apply(o){o.logical.groups.push(e),o.layout.groupLayouts.push({groupRef:e.modelId,geo:t})},invert(o){const i=o.logical.groups.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.groups.splice(i,1);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e.modelId);l>=0&&o.layout.groupLayouts.splice(l,1)},emitOps(){const o={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},i={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t},incidental:!0};return{forward:[o,i],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function za(e,t){const o={},i=l=>{const a=l.logical.groups.find(r=>r.modelId===e);if(!a)throw new Error(`그룹 없음: ${e}`);return a};return{label:"그룹 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ji(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const l=o.layout.groupLayouts.findIndex(a=>a.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:l>=0?{item:o.layout.groupLayouts[l],index:l}:void 0},l>=0&&o.layout.groupLayouts.splice(l,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Ua(e,t){let o=!1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에 편입",apply(l){const a=i(l);a&&!a.memberEntityRefs.includes(t)&&(a.memberEntityRefs.push(t),o=!0)},invert(l){if(!o)return;const a=i(l),r=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1;r>=0&&a.memberEntityRefs.splice(r,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}:{forward:[],invert:[]}}}}function wo(e,t){let o=-1;const i=l=>l.logical.groups.find(a=>a.modelId===e);return{label:"그룹에서 제외",apply(l){const a=i(l);o=(a==null?void 0:a.memberEntityRefs.indexOf(t))??-1,o>=0&&a.memberEntityRefs.splice(o,1)},invert(l){var a;o<0||(a=i(l))==null||a.memberEntityRefs.splice(o,0,t)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:t}]}}}}function Ha(e,t){let o=null;return{label:"그룹 이동",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function Fa(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);if(!l)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.groupLayouts.find(a=>a.groupRef===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function yt(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Me(o,e).attributes.push(t)},invert(o){const i=Me(o,e),l=i.attributes.findIndex(a=>a.modelId===t.modelId);l>=0&&i.attributes.splice(l,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function zt(e,t,o){const i={},l=a=>{const r=Me(a,e).attributes.find(s=>s.modelId===t);if(!r)throw new Error(`속성 없음: ${t}`);return r};return{label:"속성 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t,patch:{...i}}]}}}}function It(e,t){let o=null;return{label:"속성 삭제",apply(i){const l=Me(i,e),a=l.attributes.findIndex(r=>r.modelId===t);if(a<0)throw new Error(`속성 없음: ${t}`);o={item:l.attributes[a],index:a},l.attributes.splice(a,1)},invert(i){o&&Me(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Qi(e,t,o){let i=null;return{label:"속성 재정렬",apply(l){const a=Me(l,e);i=a.attributes.map(f=>({...f}));const r=new Set(t),s=a.attributes.filter(f=>r.has(f.modelId)),c=a.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)];a.attributes.splice(0,a.attributes.length,...u),a.attributes.forEach((f,p)=>f.order=p)},invert(l){i&&Me(l,e).attributes.splice(0,1/0,...i)},emitOps(l){const a=Me(l,e).attributes.map(r=>({...r}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Ga(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const l=Me(i,e);l.operations||(l.operations=[],o=!0),l.operations.push(t)},invert(i){var r;const l=Me(i,e),a=((r=l.operations)==null?void 0:r.findIndex(s=>s.modelId===t.modelId))??-1;a>=0&&l.operations.splice(a,1),o&&l.operations&&l.operations.length===0&&(l.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Ya(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`메서드 없음: ${t}`);return r};return{label:"메서드 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t,patch:{...i}}]}}}}function Wa(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const l=Me(i,e),a=((s=l.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(a<0)throw new Error(`메서드 없음: ${t}`);const r=l.operations.length===1;o={item:l.operations[a],index:a,wasSole:r},l.operations.splice(a,1),r&&(l.operations=void 0)},invert(i){if(!o)return;const l=Me(i,e);l.operations||(l.operations=[]),l.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Ka(e,t,o){let i=null;return{label:"메서드 재정렬",apply(l){const a=Me(l,e),r=a.operations??[];i=r.map(p=>({...p}));const s=new Set(t),c=r.filter(p=>s.has(p.modelId)),d=r.filter(p=>!s.has(p.modelId)),u=Math.max(0,Math.min(o,d.length)),f=[...d.slice(0,u),...c,...d.slice(u)];r.splice(0,r.length,...f),r.forEach((p,m)=>p.order=m),a.operations=r},invert(l){if(!i)return;const a=Me(l,e);a.operations&&a.operations.splice(0,1/0,...i)},emitOps(l){const a=(Me(l,e).operations??[]).map(r=>({...r}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:a}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Xa(e,t,o){let i;return{label:"메서드 색상 변경",apply(l){const a=Fe(l,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=l.layout.entityLayouts[a];i=r.operationStyles;const s={...r.operationStyles},c=qi(s[t],o);c?s[t]=c:delete s[t],r.operationStyles=Object.keys(s).length?s:void 0},invert(l){const a=Fe(l,e);a>=0&&(l.layout.entityLayouts[a].operationStyles=i)},emitOps(l){const a=Fe(l,e),r=a>=0?l.layout.entityLayouts[a].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(r)],invert:[s(i)]}}}}function el(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(a=>a.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e.modelId);l>=0&&o.layout.associationLayouts.splice(l,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function tl(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const l=o.layout.associationLayouts.findIndex(a=>a.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:l>=0?{item:o.layout.associationLayouts[l],index:l}:void 0},l>=0&&o.layout.associationLayouts.splice(l,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Eo(e,t){const o={},i=l=>{const a=l.logical.associations.find(r=>r.modelId===e);if(!a)throw new Error(`관계 없음: ${e}`);return a};return{label:"관계 수정",apply(l){const a=i(l);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(l){Object.assign(i(l),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function rn(e,t,o){const i={},l=a=>{const r=a.logical.associations.find(s=>s.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r[t]};return{label:"관계 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function qa(e,t){return{label:"인덱스 추가",apply(o){const i=Me(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var a;const i=Me(o,e),l=((a=i.indexes)==null?void 0:a.findIndex(r=>r.modelId===t.modelId))??-1;l>=0&&i.indexes.splice(l,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Za(e,t,o){const i={},l=a=>{var s;const r=(s=Me(a,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!r)throw new Error(`인덱스 없음: ${t}`);return r};return{label:"인덱스 수정",apply(a){const r=l(a);for(const s of Object.keys(o))i[s]=r[s];Object.assign(r,o)},invert(a){Object.assign(l(a),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t,patch:{...i}}]}}}}function ja(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var r;const l=Me(i,e),a=((r=l.indexes)==null?void 0:r.findIndex(s=>s.modelId===t))??-1;if(a<0)throw new Error(`인덱스 없음: ${t}`);o={item:l.indexes[a],index:a},l.indexes.splice(a,1)},invert(i){o&&Me(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const lt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Sn=(e,t)=>{var o;return((o=je(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Ja(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(l){const a=je(l,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...a.waypoints[t]},a.waypoints.splice(t,1,{...o})},invert(l){const a=je(l,e);a&&i&&a.waypoints.splice(t,1,i)},emitOps(l){const a=Sn(l,e),r=a.map((s,c)=>c===t&&i?{...i}:s);return{forward:[lt(e,a)],invert:[lt(e,r)]}}}}function Qa(e,t){let o=null;return{label:"waypoint 제거",apply(i){const l=je(i,e);if(!l||!l.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...l.waypoints[t]},l.waypoints.splice(t,1)},invert(i){const l=je(i,e);l&&o&&l.waypoints.splice(t,0,o)},emitOps(i){const l=Sn(i,e),a=l.slice();return o&&a.splice(t,0,{...o}),{forward:[lt(e,l)],invert:[lt(e,a)]}}}}function er(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(l){const a=je(l,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);i=a.waypoints.map(r=>({...r})),a.waypoints=i.map(r=>({x:r.x+t,y:r.y+o}))},invert(l){const a=je(l,e);a&&i&&(a.waypoints=i)},emitOps(l){return{forward:[lt(e,Sn(l,e))],invert:[lt(e,i??[])]}}}}function tr(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=je(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(l=>({...l})),i.waypoints=[]},invert(o){const i=je(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[lt(e,Sn(o,e))],invert:[lt(e,t??[])]}}}}function nr(e,t,o){return{label:"waypoint 추가",apply(i){const l=je(i,e);if(!l)throw new Error(`관계 레이아웃 없음: ${e}`);l.waypoints.splice(t,0,{...o})},invert(i){const l=je(i,e);l==null||l.waypoints.splice(t,1)},emitOps(i){const l=Sn(i,e),a=l.slice();return a.splice(t,1),{forward:[lt(e,l)],invert:[lt(e,a)]}}}}function or(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 nl(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(l=>l.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Cn(e,t){let o=null;return{label:"노트 이동",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.location},l.geo.location={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.location=o)},emitOps(){const i=l=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function ir(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o={...l.geo.size},l.geo.size={...t}},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&o&&(l.geo.size=o)},emitOps(){const i=l=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...l}}});return{forward:[i(t)],invert:[i(o)]}}}}function lr(e,t){let o="";return{label:"노트 내용 변경",apply(i){const l=i.layout.notes.find(a=>a.modelId===e);if(!l)throw new Error(`노트 없음: ${e}`);o=l.memo,l.memo=t},invert(i){const l=i.layout.notes.find(a=>a.modelId===e);l&&(l.memo=o)},emitOps(){const i=l=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:l}});return{forward:[i(t)],invert:[i(o)]}}}}function ar(e,t){let o=!1,i=!1;const l=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에 노트 편입",apply(a){const r=l(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[],i=!0),!r.memberNoteRefs.includes(t)&&(r.memberNoteRefs.push(t),o=!0))},invert(a){if(!o)return;const r=l(a);if(!(r!=null&&r.memberNoteRefs))return;const s=r.memberNoteRefs.indexOf(t);s>=0&&r.memberNoteRefs.splice(s,1),i&&delete r.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}:{forward:[],invert:[]}}}}function rr(e,t){let o=-1;const i=l=>l.layout.groupLayouts.find(a=>a.groupRef===e);return{label:"그룹에서 노트 제외",apply(l){var r;const a=i(l);o=((r=a==null?void 0:a.memberNoteRefs)==null?void 0:r.indexOf(t))??-1,o>=0&&a.memberNoteRefs.splice(o,1)},invert(l){if(o<0)return;const a=i(l);a&&(a.memberNoteRefs||(a.memberNoteRefs=[]),a.memberNoteRefs.splice(o,0,t))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:t}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:t}]}}}}const St=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),No=(e,t,o)=>{var i;return((i=gt(e,t,o))==null?void 0:i.waypoints.map(l=>({...l})))??[]};function sr(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(l){const a=l.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);if(a.connections||(a.connections=[],i=!0),a.connections.some(r=>r.targetRef===t)){o=!1;return}a.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(l){if(!o)return;const a=l.layout.notes.find(s=>s.modelId===e);if(!(a!=null&&a.connections))return;const r=a.connections.findIndex(s=>s.targetRef===t);r>=0&&a.connections.splice(r,1),i&&delete a.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:{targetRef:t,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}]}:{forward:[],invert:[]}}}}function cr(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var r;const l=i.layout.notes.find(s=>s.modelId===e),a=((r=l==null?void 0:l.connections)==null?void 0:r.findIndex(s=>s.targetRef===t))??-1;if(!(l!=null&&l.connections)||a<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:l.connections[a],index:a},l.connections.splice(a,1)},invert(i){if(!o)return;const l=i.layout.notes.find(a=>a.modelId===e);l!=null&&l.connections&&l.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function dr(e,t,o,i){let l=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(a){const r=gt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);l={...r.waypoints[o]},r.waypoints.splice(o,1,{...i})},invert(a){const r=gt(a,e,t);r&&l&&r.waypoints.splice(o,1,l)},emitOps(a){const r=No(a,e,t),s=r.map((c,d)=>d===o&&l?{...l}:c);return{forward:[St(e,t,r)],invert:[St(e,t,s)]}}}}function ur(e,t,o,i){return{label:"waypoint 추가",apply(l){const a=gt(l,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);a.waypoints.splice(o,0,{...i})},invert(l){const a=gt(l,e,t);a==null||a.waypoints.splice(o,1)},emitOps(l){const a=No(l,e,t),r=a.slice();return r.splice(o,1),{forward:[St(e,t,a)],invert:[St(e,t,r)]}}}}function fr(e,t,o){let i=null;return{label:"waypoint 제거",apply(l){const a=gt(l,e,t);if(!a||!a.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...a.waypoints[o]},a.waypoints.splice(o,1)},invert(l){const a=gt(l,e,t);a&&i&&a.waypoints.splice(o,0,i)},emitOps(l){const a=No(l,e,t),r=a.slice();return i&&r.splice(o,0,{...i}),{forward:[St(e,t,a)],invert:[St(e,t,r)]}}}}function mr(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const l=gt(i,e,t);if(!l)throw new Error(`노트 연결 없음: ${e}→${t}`);o=l.waypoints.map(a=>({...a})),l.waypoints=[]},invert(i){const l=gt(i,e,t);l&&o&&(l.waypoints=o)},emitOps(i){return{forward:[St(e,t,No(i,e,t))],invert:[St(e,t,o??[])]}}}}function Be(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const l of t)l.apply(i)},invert(i){for(let l=t.length-1;l>=0;l--)t[l].invert(i)},emitOps(i){const l=t.map(a=>{if(!a.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${a.label}`);return a.emitOps(i)});return{forward:l.flatMap(a=>a.forward),invert:l.slice().reverse().flatMap(a=>a.invert)}}}}const _u=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:el,addAttribute:yt,addEntity:Ki,addEntityToGroup:Ua,addGroup:ji,addIndex:qa,addNote:or,addNoteConnection:sr,addNoteConnectionWaypoint:ur,addNoteToGroup:ar,addOperation:Ga,addWaypoint:nr,clearNoteConnectionWaypoints:mr,clearWaypoints:tr,composite:Be,moveEntity:an,moveGroup:Ha,moveNote:Cn,moveNoteConnectionWaypoint:dr,moveWaypoint:Ja,removeAssociation:tl,removeAttribute:It,removeEntity:Xi,removeEntityFromGroup:wo,removeGroup:Ji,removeIndex:ja,removeNote:nl,removeNoteConnection:cr,removeNoteConnectionWaypoint:fr,removeNoteFromGroup:rr,removeOperation:Wa,removeWaypoint:Qa,renameEntity:Da,reorderAttributes:Qi,reorderOperations:Ka,resizeEntity:Oa,resizeGroup:Fa,resizeNote:ir,setAllEntitiesCollapsed:Zi,setAttributeSwatch:vo,setEntityCollapsed:Pa,setEntitySwatch:La,setNoteMemo:lr,setOperationSwatch:Xa,translateWaypoints:er,updateAssociation:Eo,updateAssociationEnd:rn,updateAttribute:zt,updateEntity:Ba,updateGroup:za,updateIndex:Za,updateOperation:Ya},Symbol.toStringTag,{value:"Module"}));class pr{constructor(){Le(this,"revs",new Map);Le(this,"layoutVersion",0);Le(this,"logicalVersion",0)}seed(t){this.revs.clear();for(const[o,i]of Object.entries(t.revs??{}))this.revs.set(o,i);this.layoutVersion=t.layoutVersion??0,this.logicalVersion=t.logicalVersion??0}rev(t){return this.revs.get(t)??0}setRev(t,o){this.revs.set(t,o)}deleteRev(t){this.revs.delete(t)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class hr{constructor(t){Le(this,"cache",new pr);Le(this,"newClientOpId");Le(this,"debounceMs");Le(this,"emissions",new WeakMap);Le(this,"open",null);Le(this,"debounceHandle",null);Le(this,"queue",[]);Le(this,"sending",!1);Le(this,"_frozen",!1);Le(this,"stack",null);Le(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??Se,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,l,a)=>this.handle(i,l,a));return()=>{o(),this.stack===t&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(t=>this.settledWaiters.push(t)):Promise.resolve()}handle(t,o,i){var r;if(this._frozen)return;let l;if(o==="do"){const s=(r=t.emitOps)==null?void 0:r.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);l=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);l=s}const a=o==="undo"?l.invert:l.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=a,this.emissions.set(t,{forward:a,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,l),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:a,inv:l.invert},this.startDebounce();return}a.length&&this.enqueue(this.buildBatch(a))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let l=!1,a=!1;for(const r of t)if(r.casUnit==="logical")if(l=!0,r.containerRef)i.add(r.containerRef);else{const s=r.entityRef??r.associationRef??r.groupRef;s&&(r.kind.endsWith(".add")?this.cache.setRev(s,0):r.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else r.incidental||(a=!0);if(i.size){o.revs={};for(const r of i){const s=this.cache.rev(r);o.revs[r]=s,this.cache.setRev(r,s+1)}}return a&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),l&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,l;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(a){this.sending=!1,(l=(i=this.opts).onError)==null||l.call(i,a),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(t){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(t.revs))this.cache.setRev(o,i);this.cache.layoutVersion=t.layoutVersion,this.cache.logicalVersion=t.logicalVersion}}freeze(t){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,t),this.notifySettled()}notifySettled(){if(this.hasPending)return;const t=this.settledWaiters;this.settledWaiters=[];for(const o of t)o()}}const gr=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update"];function vu(e,t){const o=()=>e.entities.filter(a=>{var r;return((r=a.table)==null?void 0:r.physicalName)===t.ref}),i=()=>e.entities.filter(a=>a.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const l=o();return l.length?l:i()}function wu(e,t){const o=()=>e.attributes.filter(a=>a.name===t.ref),i=()=>e.attributes.filter(a=>a.dbAttrs.some(r=>r.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const l=o();return l.length?l:i()}function yr(e,t,o){return e.associations.filter(i=>{const l=[i.end1.entityRef,i.end2.entityRef];return l.includes(t)&&l.includes(o)})}function at(e,t){const o=vu(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 Eu(e,t){const o=wu(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 Nu(e,t,o={}){const i=o.mkId??Se,l=[],a=[];return t.forEach((r,s)=>{switch(r.kind){case"entity.add":{const c=i(),d={modelId:c,name:r.spec.name,stereotype:r.spec.stereotype??"JPA_ENTITY",attributes:[],...r.spec.physicalName?{table:{physicalName:r.spec.physicalName}}:{}};l.push({kind:"entity.add",casUnit:"logical",entityRef:c,value:d});break}case"entity.update":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,patch:r.patch});break}case"entity.remove":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:c.value.modelId});break}case"attribute.add":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}const d=i(),u=r.spec.physicalName!=null||r.spec.dataType!=null||r.spec.length!=null||r.spec.scale!=null,f={modelId:d,name:r.spec.name,type:r.spec.type,attrType:"NORMAL",identifier:r.spec.identifier??!1,notNull:r.spec.notNull??!1,order:c.value.attributes.length,dbAttrs:u?[{modelId:i(),physicalName:r.spec.physicalName??r.spec.name,dataType:r.spec.dataType??"",...r.spec.length?{length:r.spec.length}:{},...r.spec.scale?{scale:r.spec.scale}:{}}]:[]};l.push({kind:"attribute.add",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,value:f});break}case"attribute.update":case"attribute.remove":{const c=at(e,r.entity);if(!c.ok){a.push(rt(c.reason,s,r.entity,c.matches));break}const d=Eu(c.value,r.attribute);if(!d.ok){a.push(d.reason==="not-found"?{code:"attribute-not-found",opIndex:s,entity:r.entity,handle:r.attribute}:{code:"attribute-ambiguous",opIndex:s,entity:r.entity,handle:r.attribute,matches:d.matches});break}r.kind==="attribute.update"?l.push({kind:"attribute.update",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,attributeRef:d.value.modelId,patch:r.patch}):l.push({kind:"attribute.remove",casUnit:"logical",containerRef:c.value.modelId,entityRef:c.value.modelId,attributeRef:d.value.modelId});break}case"association.add":{const c=at(e,r.spec.from),d=at(e,r.spec.to);if(c.ok||a.push(rt(c.reason,s,r.spec.from,c.matches)),d.ok||a.push(rt(d.reason,s,r.spec.to,d.matches)),!c.ok||!d.ok)break;if(r.spec.identifying&&c.value.modelId===d.value.modelId){a.push({code:"self-identifying",opIndex:s,handle:{from:r.spec.from,to:r.spec.to}});break}const u=i(),f={modelId:u,...r.spec.identifying!=null?{identifying:r.spec.identifying}:{},end1:{entityRef:c.value.modelId,multiplicity:r.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:d.value.modelId,multiplicity:r.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:r.spec.composition??!1}};l.push({kind:"association.add",casUnit:"logical",associationRef:u,value:f});break}case"association.remove":{const c=at(e,r.association.from),d=at(e,r.association.to);if(c.ok||a.push(rt(c.reason,s,r.association.from,c.matches)),d.ok||a.push(rt(d.reason,s,r.association.to,d.matches)),!c.ok||!d.ok)break;const u=yr(e,c.value.modelId,d.value.modelId);if(u.length!==1){a.push(u.length===0?{code:"association-not-found",opIndex:s,handle:r.association}:{code:"association-ambiguous",opIndex:s,handle:r.association,matches:u.map(f=>f.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:u[0].modelId});break}case"association.update":{const c=br(e,r.association,s,a);if(!c)break;l.push({kind:"association.update",casUnit:"logical",containerRef:c.modelId,associationRef:c.modelId,patch:r.patch});break}case"associationEnd.update":{const c=br(e,r.association,s,a);if(!c)break;const d=r.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:c.modelId,associationRef:c.modelId,end:d,patch:r.patch});break}}}),a.length?{ok:!1,errors:a}:{ok:!0,ops:l}}function rt(e,t,o,i){return e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function br(e,t,o,i){const l=at(e,t.from),a=at(e,t.to);if(l.ok||i.push(rt(l.reason,o,t.from,l.matches)),a.ok||i.push(rt(a.reason,o,t.to,a.matches)),!l.ok||!a.ok)return null;const r=yr(e,l.value.modelId,a.value.modelId);return r.length!==1?(i.push(r.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:r.map(s=>s.modelId)}),null):r[0]}const ku={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xu={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},$u={type:"object",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."}},required:["name"],additionalProperties:!1},Iu={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String)."},identifier:{type:"boolean"},notNull:{type:"boolean"},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."}},required:["name","type"],additionalProperties:!1},_r={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Su={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{..._r,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{..._r,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},Cu={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function st(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Ru={"entity.add":st("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":st("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":st("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":st("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":st("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","attribute","patch"]}),"attribute.remove":st("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":st("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":st("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":st("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":st("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"]})},vr={anyOf:gr.map(e=>Ru[e])},Vu={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ku,assocHandle:xu,entitySpec:$u,attrSpec:Iu,assocSpec:Su,patch:Cu,symbolicOp:vr}};function Au(e,t,o,i={}){const l=i.mkClientOpId??Se,a=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&a.add(s.containerRef);const r={};if(a.size){r.revs={};for(const s of a)r.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:r,origin:i.origin??"agent",clientOpId:l()}}const wr={location:{x:0,y:0},size:{width:220,height:140}};function Er(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 Tu=/^[-=_*~\s]{3,}$/;function Mu(e){return e.attrType&&e.attrType!=="NORMAL"||!Tu.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Bu(e,t){return e.attrType==="DIVIDER"||Mu(e)?{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]}:{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Er)}}function Du(e){const{modelId:t,name:o,visibility:i,sourceCode:l,description:a,order:r,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:l,description:a?{ko:a}:void 0,order:r??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Ou(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 Lu(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(Bu),operations:(t=e.operations)==null?void 0:t.map(Du),indexes:(o=e.indexes)==null?void 0:o.map(Ou),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Pu(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??{...wr},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed}}function Nr(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 ol(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:Nr(e)}}function zu(e){var i,l;const t={modelId:e.modelId,description:e.description,end1:ol(e.end1),end2:ol(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(l=e.end2.attribute)==null?void 0:l.modelId,style:e.style};return{assoc:t,layout:o}}function kr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function xr(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function $r(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 Ir(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Er)}}function Uu(e,t,o){var k,b;const i=kr(e.end1.attribute),l=kr(e.end2.attribute);if(i===l)return zu(e);const a=i?e.end1:e.end2,r=i?e.end2:e.end1,s=a.attribute,c=(b=(k=s.dbAttrs)==null?void 0:k[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(r.endModel.refId),f=u?u.attributes.reduce(($,h)=>Math.max($,h.order),-1)+1:s.order??0,p={...Ir(s,f),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const m=($,h)=>({entityRef:$.endModel.refId,multiplicity:$.multiplicity,navigable:$.navigable,composition:$.composition,attributeRef:h?d:p.modelId,legacyNavRaw:h?void 0:$.attribute,jpa:Nr($)}),g={modelId:e.modelId,description:e.description,end1:m(e.end1,i),end2:m(e.end2,l)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:g.end1.attributeRef,targetColumnRef:g.end2.attributeRef,style:e.style};return{assoc:g,layout:_}}function Hu(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 Fu(e,t,o){var g;const i=((g=e.end1.attribute)==null?void 0:g.attrType)==="EMBED_OWN",l=i?e.end1:e.end2,a=i?e.end2:e.end1,r=l.attribute,s=t.get(a.endModel.refId),c=s?s.attributes.reduce((_,k)=>Math.max(_,k.order),-1)+1:r.order??0,d={...Ir(r,c),attrType:r.attrType??"EMBED_OWN",dbAttrs:(r.dbAttrs??[]).map(_=>Hu(_,o)),embedded:{associationRef:e.modelId,embeddableRef:l.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...ol(_),legacyEmbedRaw:_.attribute}),f={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,m={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:f,layout:m}}function Gu(e,t){var i,l,a,r;const o=[];for(const s of t){const c=(l=(i=s.end1)==null?void 0:i.endModel)==null?void 0:l.refId,d=(r=(a=s.end2)==null?void 0:a.endModel)==null?void 0:r.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Sr(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:l,style:a,connections:r,ownedConnections:s,...c}=e;let d=r;if(!d&&Array.isArray(s)){const u=Gu(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:l.location.x+t.x,y:l.location.y+t.y},size:l.size},style:a,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Yu(e){return(e.schemaVersion??1)>=2&&"logical"in e?Wu(e):Ku(e)}function Wu(e){const t=e.id??e.logical.modelId??"",o={},i=f=>{const{rev:p,...m}=f;return p!=null&&(o[f.modelId]=p),m},l=e.logical.entities.map(i),a=e.logical.associations.map(i),r=e.logical.groups.map(i),{version:s,...c}=e.layout,d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:l,associations:a,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 Ku(e){var b,$;const t=e.id??"",o=[],i=[],l=[],a=[],r=[],s=[],c=[],d=(h,S)=>{o.push(Lu(h));const X=Pu(h);X.geo={location:{x:X.geo.location.x+S.x,y:X.geo.location.y+S.y},size:X.geo.size},i.push(X);for(const W of h.ownedAssociations??[])c.push(W)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const f=[];for(const h of e.groups??[]){const S=h.entities??[];r.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:S.map(W=>W.modelId)});const X=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const W=(h.notes??[]).map(J=>J.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,memberNoteRefs:W.length?W:void 0})}for(const W of S)d(W,X);for(const W of h.notes??[])f.push(Sr(W,X))}const p=new Map(o.map(h=>[h.modelId,h])),m=new Map,g=new Map;for(const h of o)for(const S of h.attributes)for(const X of S.dbAttrs)m.set(X.modelId,S.modelId),g.set(X.modelId,X);for(const h of c)for(const S of[h.end1,h.end2]){const X=S.attribute;if(X&&((($=X.dbAttrs)==null?void 0:$.length)??0)>0)for(const W of X.dbAttrs)W.modelId&&m.set(W.modelId,X.modelId)}for(const h of c){const S=xr(h.end1.attribute),X=xr(h.end2.attribute),W=$r(h.end1)||$r(h.end2),{assoc:J,layout:T}=S!==X||W?Fu(h,p,g):Uu(h,p,m);l.push(J),a.push(T)}const _={logical:{modelId:t,packageName:e.packageName,entities:o,associations:l,groups:r},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:a,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Sr(h)),...f]}},k={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:k}}function Cr(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 Xu(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Cr),style:t}}function qu(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 Zu(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 Ct(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 ju(e,t){const o=t==null?void 0:t.attributes.find(i=>{var l;return i.modelId===((l=e.derivedFrom)==null?void 0:l.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,l)=>{var a;return{...Cr(i),targetModelId:(a=o==null?void 0:o.dbAttrs[l])==null?void 0:a.modelId}})}}function Ju(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 Qu(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 ef(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function tf(e,t){const o=(i,l)=>i===l?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:ef(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 nf(e,t,o){let i;for(const f of t.logical.entities){const p=f.attributes.find(m=>{var g;return((g=m.embedded)==null?void 0:g.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const l=i.embedded.embeddableRef,a=t.logical.entities.find(f=>f.modelId===l);if(!a)return;const r=a.attributes.flatMap(f=>f.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((f,p)=>tf(f,r[p]))},c=e.end1.entityRef===l,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Ct(e.end1,c?s:u),end2:Ct(e.end2,c?u:s)}}function of(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:Ct(e.end1,e.end1.legacyEmbedRaw),end2:Ct(e.end2,e.end2.legacyEmbedRaw)};const l=nf(e,t,i);if(l)return l;const a=!!e.end1.legacyNavRaw,r=!!e.end2.legacyNavRaw;if(a!==r){const s=a?e.end1:e.end2,c=a?e.end2:e.end1,d=t.logical.entities.find(g=>g.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(g=>g.modelId===s.attributeRef),f=t.logical.entities.find(g=>g.modelId===c.entityRef),p=u?ju(u,f):void 0,m=s.legacyNavRaw;return{...i,end1:Ct(e.end1,a?m:p),end2:Ct(e.end2,r?m:p)}}return{...i,end1:Ct(e.end1),end2:Ct(e.end2)}}function Rr(e,t,o,i,l={x:0,y:0}){var u,f;const a=t.layout.entityLayouts.find(p=>p.entityRef===e.modelId),r=t.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>t.layout.associationLayouts.find(m=>m.associationRef===p),c=(a==null?void 0:a.geo)??{...wr},d={location:{x:c.location.x-l.x,y:c.location.y-l.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var m;return Xu(p,(m=a==null?void 0:a.attributeStyles)==null?void 0:m[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var m;return qu(p,(m=a==null?void 0:a.operationStyles)==null?void 0:m[p.modelId])}),ownedAssociations:r.map(p=>of(p,t,s(p.modelId))),indexes:(f=e.indexes)==null?void 0:f.map(Zu),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:a==null?void 0:a.style,collapsed:a==null?void 0:a.collapsed}}function lf(e,t,o,i){const l=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),a=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),r=(l==null?void 0:l.geo.location)??{x:0,y:0},s=((l==null?void 0:l.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Vr(c,r));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:a.map(c=>Rr(c,t,o,i,r)),notes:s.length?s:void 0,geo:l==null?void 0:l.geo,style:l==null?void 0:l.style}}function Vr(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 af(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),l=Ju(e),a=Qu(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=>Rr(s,e,l,a)),groups:e.logical.groups.map(s=>lf(s,e,l,a)),notes:e.layout.notes.filter(s=>!r.has(s.modelId)).map(s=>Vr(s))}}function rf(e,t={}){var l,a,r;const o=((l=t.revSeed)==null?void 0:l.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((a=t.revSeed)==null?void 0:a.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((r=t.revSeed)==null?void 0:r.layoutVersion)??0}}}function Rn(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function bt(e){return typeof e=="function"?e():n.unref(e)}const sf=typeof window<"u"&&typeof document<"u",cf=e=>typeof e<"u",df=Object.prototype.toString,uf=e=>df.call(e)==="[object Object]",ff=()=>{};function mf(e,t){function o(...i){return new Promise((l,a)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(l).catch(a)})}return o}const Ar=e=>e();function pf(e=Ar){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const l=(...a)=>{t.value&&e(...a)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:l}}function Tr(e,t=!1,o="Timeout"){return new Promise((i,l)=>{setTimeout(t?()=>l(o):i,e)})}function hf(e,t,o={}){const{eventFilter:i=Ar,...l}=o;return n.watch(e,mf(i,t),l)}function sn(e,t,o={}){const{eventFilter:i,...l}=o,{eventFilter:a,pause:r,resume:s,isActive:c}=pf(i);return{stop:hf(e,t,{...l,eventFilter:a}),pause:r,resume:s,isActive:c}}function gf(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(l){var a;if((a=bt(t.replaceRef))!=null?a:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=l,e.value=s}else{const s={...e.value,[i]:l};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=l}}));return o}function il(e,t=!1){function o(f,{flush:p="sync",deep:m=!1,timeout:g,throwOnTimeout:_}={}){let k=null;const $=[new Promise(h=>{k=n.watch(e,S=>{f(S)!==t&&(k==null||k(),h(S))},{flush:p,deep:m,immediate:!0})})];return g!=null&&$.push(Tr(g,_).then(()=>bt(e)).finally(()=>k==null?void 0:k())),Promise.race($)}function i(f,p){if(!n.isRef(f))return o(S=>S===f,p);const{flush:m="sync",deep:g=!1,timeout:_,throwOnTimeout:k}=p??{};let b=null;const h=[new Promise(S=>{b=n.watch([e,f],([X,W])=>{t!==(X===W)&&(b==null||b(),S(X))},{flush:m,deep:g,immediate:!0})})];return _!=null&&h.push(Tr(_,k).then(()=>bt(e)).finally(()=>(b==null||b(),bt(e)))),Promise.race(h)}function l(f){return o(p=>!!p,f)}function a(f){return i(null,f)}function r(f){return i(void 0,f)}function s(f){return o(Number.isNaN,f)}function c(f,p){return o(m=>{const g=Array.from(m);return g.includes(f)||g.includes(bt(f))},p)}function d(f){return u(1,f)}function u(f=1,p){let m=-1;return o(()=>(m+=1,m>=f),p)}return Array.isArray(bt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return il(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:l,toBeNull:a,toBeNaN:s,toBeUndefined:r,changed:d,changedTimes:u,get not(){return il(e,!t)}}}function ll(e){return il(e)}function yf(e){var t;const o=bt(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Mr=sf?window:void 0;function Br(...e){let t,o,i,l;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,l]=e,t=Mr):[t,o,i,l]=e,!t)return ff;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const a=[],r=()=>{a.forEach(u=>u()),a.length=0},s=(u,f,p,m)=>(u.addEventListener(f,p,m),()=>u.removeEventListener(f,p,m)),c=n.watch(()=>[yf(t),bt(l)],([u,f])=>{if(r(),!u)return;const p=uf(f)?{...f}:f;a.push(...o.flatMap(m=>i.map(g=>s(u,m,g,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),r()};return Rn(d),d}function bf(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Dr(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:l=Mr,eventName:a="keydown",passive:r=!1,dedupe:s=!1}=i,c=bf(t);return Br(l,a,u=>{u.repeat&&bt(s)||c(u)&&o(u)},r)}function _f(e){return JSON.parse(JSON.stringify(e))}function al(e,t,o,i={}){var l,a,r;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:f,shouldEmit:p}=i,m=n.getCurrentInstance(),g=o||(m==null?void 0:m.emit)||((l=m==null?void 0:m.$emit)==null?void 0:l.bind(m))||((r=(a=m==null?void 0:m.proxy)==null?void 0:a.$emit)==null?void 0:r.bind(m==null?void 0:m.proxy));let _=d;t||(t="modelValue"),_=_||`update:${t.toString()}`;const k=h=>s?typeof s=="function"?s(h):_f(h):h,b=()=>cf(e[t])?k(e[t]):f,$=h=>{p?p(h)&&g(_,h):g(_,h)};if(c){const h=b(),S=n.ref(h);let X=!1;return n.watch(()=>e[t],W=>{X||(X=!0,S.value=k(W),n.nextTick(()=>X=!1))}),n.watch(S,W=>{!X&&(W!==e[t]||u)&&$(W)},{deep:u}),S}else return n.computed({get(){return b()},set(h){$(h)}})}var vf={value:()=>{}};function ko(){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 xo(o)}function xo(e){this._=e}function wf(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}xo.prototype=ko.prototype={constructor:xo,on:function(e,t){var o=this._,i=wf(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=Ef(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=Or(o[l],e.name,t);else if(t==null)for(l in o)o[l]=Or(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new xo(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function Ef(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function Or(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=vf,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var rl="http://www.w3.org/1999/xhtml";const Lr={svg:"http://www.w3.org/2000/svg",xhtml:rl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $o(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Lr.hasOwnProperty(t)?{space:Lr[t],local:e}:e}function Nf(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===rl&&t.documentElement.namespaceURI===rl?t.createElement(e):t.createElementNS(o,e)}}function kf(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pr(e){var t=$o(e);return(t.local?kf:Nf)(t)}function xf(){}function sl(e){return e==null?xf:function(){return this.querySelector(e)}}function $f(e){typeof e!="function"&&(e=sl(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),c,d,u=0;u<r;++u)(c=a[u])&&(d=e.call(c,c.__data__,u,a))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Xe(i,this._parents)}function If(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Sf(){return[]}function zr(e){return e==null?Sf:function(){return this.querySelectorAll(e)}}function Cf(e){return function(){return If(e.apply(this,arguments))}}function Rf(e){typeof e=="function"?e=Cf(e):e=zr(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),l.push(c));return new Xe(i,l)}function Ur(e){return function(){return this.matches(e)}}function Hr(e){return function(t){return t.matches(e)}}var Vf=Array.prototype.find;function Af(e){return function(){return Vf.call(this.children,e)}}function Tf(){return this.firstElementChild}function Mf(e){return this.select(e==null?Tf:Af(typeof e=="function"?e:Hr(e)))}var Bf=Array.prototype.filter;function Df(){return Array.from(this.children)}function Of(e){return function(){return Bf.call(this.children,e)}}function Lf(e){return this.selectAll(e==null?Df:Of(typeof e=="function"?e:Hr(e)))}function Pf(e){typeof e!="function"&&(e=Ur(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new Xe(i,this._parents)}function Fr(e){return new Array(e.length)}function zf(){return new Xe(this._enter||this._groups.map(Fr),this._parents)}function Io(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Io.prototype={constructor:Io,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 Uf(e){return function(){return e}}function Hf(e,t,o,i,l,a){for(var r=0,s,c=t.length,d=a.length;r<d;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new Io(e,a[r]);for(;r<c;++r)(s=t[r])&&(l[r]=s)}function Ff(e,t,o,i,l,a,r){var s,c,d=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?l[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(c=d.get(m))?(i[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new Io(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(l[s]=c)}function Gf(e){return e.__data__}function Yf(e,t){if(!arguments.length)return Array.from(this,Gf);var o=t?Ff:Hf,i=this._parents,l=this._groups;typeof e!="function"&&(e=Uf(e));for(var a=l.length,r=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var u=i[d],f=l[d],p=f.length,m=Wf(e.call(u,u&&u.__data__,d,i)),g=m.length,_=s[d]=new Array(g),k=r[d]=new Array(g),b=c[d]=new Array(p);o(u,f,_,k,b,m,t);for(var $=0,h=0,S,X;$<g;++$)if(S=_[$]){for($>=h&&(h=$+1);!(X=k[h])&&++h<g;);S._next=X||null}}return r=new Xe(r,i),r._enter=s,r._exit=c,r}function Wf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Kf(){return new Xe(this._exit||this._groups.map(Fr),this._parents)}function Xf(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function qf(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,g=0;g<f;++g)(m=d[g]||u[g])&&(p[g]=m);for(;c<l;++c)s[c]=o[c];return new Xe(s,this._parents)}function Zf(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function jf(e){e||(e=Jf);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,c=l[a]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new Xe(l,this._parents).order()}function Jf(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qf(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function em(){return Array.from(this)}function tm(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function nm(){let e=0;for(const t of this)++e;return e}function om(){return!this.node()}function im(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function lm(e){return function(){this.removeAttribute(e)}}function am(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rm(e,t){return function(){this.setAttribute(e,t)}}function sm(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cm(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function dm(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 um(e,t){var o=$o(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?am:lm:typeof t=="function"?o.local?dm:cm:o.local?sm:rm)(o,t))}function Gr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fm(e){return function(){this.style.removeProperty(e)}}function mm(e,t,o){return function(){this.style.setProperty(e,t,o)}}function pm(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function hm(e,t,o){return arguments.length>1?this.each((t==null?fm:typeof t=="function"?pm:mm)(e,t,o??"")):cn(this.node(),e)}function cn(e,t){return e.style.getPropertyValue(t)||Gr(e).getComputedStyle(e,null).getPropertyValue(t)}function gm(e){return function(){delete this[e]}}function ym(e,t){return function(){this[e]=t}}function bm(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function _m(e,t){return arguments.length>1?this.each((t==null?gm:typeof t=="function"?bm:ym)(e,t)):this.node()[e]}function Yr(e){return e.trim().split(/^|\s+/)}function cl(e){return e.classList||new Wr(e)}function Wr(e){this._node=e,this._names=Yr(e.getAttribute("class")||"")}Wr.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 Kr(e,t){for(var o=cl(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function Xr(e,t){for(var o=cl(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function vm(e){return function(){Kr(this,e)}}function wm(e){return function(){Xr(this,e)}}function Em(e,t){return function(){(t.apply(this,arguments)?Kr:Xr)(this,e)}}function Nm(e,t){var o=Yr(e+"");if(arguments.length<2){for(var i=cl(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?Em:t?vm:wm)(o,t))}function km(){this.textContent=""}function xm(e){return function(){this.textContent=e}}function $m(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Im(e){return arguments.length?this.each(e==null?km:(typeof e=="function"?$m:xm)(e)):this.node().textContent}function Sm(){this.innerHTML=""}function Cm(e){return function(){this.innerHTML=e}}function Rm(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vm(e){return arguments.length?this.each(e==null?Sm:(typeof e=="function"?Rm:Cm)(e)):this.node().innerHTML}function Am(){this.nextSibling&&this.parentNode.appendChild(this)}function Tm(){return this.each(Am)}function Mm(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bm(){return this.each(Mm)}function Dm(e){var t=typeof e=="function"?e:Pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Om(){return null}function Lm(e,t){var o=typeof e=="function"?e:Pr(e),i=t==null?Om:typeof t=="function"?t:sl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Pm(){var e=this.parentNode;e&&e.removeChild(this)}function zm(){return this.each(Pm)}function Um(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hm(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fm(e){return this.select(e?Hm:Um)}function Gm(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ym(e){return function(t){e.call(this,t,this.__data__)}}function Wm(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 Km(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function Xm(e,t,o){return function(){var i=this.__on,l,a=Ym(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function qm(e,t,o){var i=Wm(e+""),l,a=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(l=0,u=s[c];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?Xm:Km,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function qr(e,t,o){var i=Gr(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function Zm(e,t){return function(){return qr(this,e,t)}}function jm(e,t){return function(){return qr(this,e,t.apply(this,arguments))}}function Jm(e,t){return this.each((typeof t=="function"?jm:Zm)(e,t))}function*Qm(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var Zr=[null];function Xe(e,t){this._groups=e,this._parents=t}function Vn(){return new Xe([[document.documentElement]],Zr)}function ep(){return this}Xe.prototype=Vn.prototype={constructor:Xe,select:$f,selectAll:Rf,selectChild:Mf,selectChildren:Lf,filter:Pf,data:Yf,enter:zf,exit:Kf,join:Xf,merge:qf,selection:ep,order:Zf,sort:jf,call:Qf,nodes:em,node:tm,size:nm,empty:om,each:im,attr:um,style:hm,property:_m,classed:Nm,text:Im,html:Vm,raise:Tm,lower:Bm,append:Dm,insert:Lm,remove:zm,clone:Fm,datum:Gm,on:qm,dispatch:Jm,[Symbol.iterator]:Qm};function Je(e){return typeof e=="string"?new Xe([[document.querySelector(e)]],[document.documentElement]):new Xe([[e]],Zr)}function tp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ct(e,t){if(e=tp(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const np={passive:!1},An={capture:!0,passive:!1};function dl(e){e.stopImmediatePropagation()}function dn(e){e.preventDefault(),e.stopImmediatePropagation()}function jr(e){var t=e.document.documentElement,o=Je(e).on("dragstart.drag",dn,An);"onselectstart"in t?o.on("selectstart.drag",dn,An):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Jr(e,t){var o=e.document.documentElement,i=Je(e).on("dragstart.drag",null);t&&(i.on("click.drag",dn,An),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 So=e=>()=>e;function ul(e,{sourceEvent:t,subject:o,target:i,identifier:l,active:a,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:l,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}ul.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function op(e){return!e.ctrlKey&&!e.button}function ip(){return this.parentNode}function lp(e,t){return t??{x:e.x,y:e.y}}function ap(){return navigator.maxTouchPoints||"ontouchstart"in this}function rp(){var e=op,t=ip,o=lp,i=ap,l={},a=ko("start","drag","end"),r=0,s,c,d,u,f=0;function p(S){S.on("mousedown.drag",m).filter(i).on("touchstart.drag",k).on("touchmove.drag",b,np).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(S,X){if(!(u||!e.call(this,S,X))){var W=h(this,t.call(this,S,X),S,X,"mouse");W&&(Je(S.view).on("mousemove.drag",g,An).on("mouseup.drag",_,An),jr(S.view),dl(S),d=!1,s=S.clientX,c=S.clientY,W("start",S))}}function g(S){if(dn(S),!d){var X=S.clientX-s,W=S.clientY-c;d=X*X+W*W>f}l.mouse("drag",S)}function _(S){Je(S.view).on("mousemove.drag mouseup.drag",null),Jr(S.view,d),dn(S),l.mouse("end",S)}function k(S,X){if(e.call(this,S,X)){var W=S.changedTouches,J=t.call(this,S,X),T=W.length,ee,F;for(ee=0;ee<T;++ee)(F=h(this,J,S,X,W[ee].identifier,W[ee]))&&(dl(S),F("start",S,W[ee]))}}function b(S){var X=S.changedTouches,W=X.length,J,T;for(J=0;J<W;++J)(T=l[X[J].identifier])&&(dn(S),T("drag",S,X[J]))}function $(S){var X=S.changedTouches,W=X.length,J,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),J=0;J<W;++J)(T=l[X[J].identifier])&&(dl(S),T("end",S,X[J]))}function h(S,X,W,J,T,ee){var F=a.copy(),K=ct(ee||W,X),O,fe,w;if((w=o.call(S,new ul("beforestart",{sourceEvent:W,target:p,identifier:T,active:r,x:K[0],y:K[1],dx:0,dy:0,dispatch:F}),J))!=null)return O=w.x-K[0]||0,fe=w.y-K[1]||0,function R(x,G,H){var Z=K,A;switch(x){case"start":l[T]=R,A=r++;break;case"end":delete l[T],--r;case"drag":K=ct(H||G,X),A=r;break}F.call(x,S,new ul(x,{sourceEvent:G,subject:w,target:p,identifier:T,active:A,x:K[0]+O,y:K[1]+fe,dx:K[0]-Z[0],dy:K[1]-Z[1],dispatch:F}),J)}}return p.filter=function(S){return arguments.length?(e=typeof S=="function"?S:So(!!S),p):e},p.container=function(S){return arguments.length?(t=typeof S=="function"?S:So(S),p):t},p.subject=function(S){return arguments.length?(o=typeof S=="function"?S:So(S),p):o},p.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:So(!!S),p):i},p.on=function(){var S=a.on.apply(a,arguments);return S===a?p:S},p.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,p):Math.sqrt(f)},p}function fl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Qr(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Tn(){}var Mn=.7,Co=1/Mn,un="\\s*([+-]?\\d+)\\s*",Bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sp=/^#([0-9a-f]{3,8})$/,cp=new RegExp(`^rgb\\(${un},${un},${un}\\)$`),dp=new RegExp(`^rgb\\(${dt},${dt},${dt}\\)$`),up=new RegExp(`^rgba\\(${un},${un},${un},${Bn}\\)$`),fp=new RegExp(`^rgba\\(${dt},${dt},${dt},${Bn}\\)$`),mp=new RegExp(`^hsl\\(${Bn},${dt},${dt}\\)$`),pp=new RegExp(`^hsla\\(${Bn},${dt},${dt},${Bn}\\)$`),es={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};fl(Tn,Ut,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ts,formatHex:ts,formatHex8:hp,formatHsl:gp,formatRgb:ns,toString:ns});function ts(){return this.rgb().formatHex()}function hp(){return this.rgb().formatHex8()}function gp(){return rs(this).formatHsl()}function ns(){return this.rgb().formatRgb()}function Ut(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=sp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?os(t):o===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Ro(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Ro(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=cp.exec(e))?new Ye(t[1],t[2],t[3],1):(t=dp.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=up.exec(e))?Ro(t[1],t[2],t[3],t[4]):(t=fp.exec(e))?Ro(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mp.exec(e))?as(t[1],t[2]/100,t[3]/100,1):(t=pp.exec(e))?as(t[1],t[2]/100,t[3]/100,t[4]):es.hasOwnProperty(e)?os(es[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function os(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function Ro(e,t,o,i){return i<=0&&(e=t=o=NaN),new Ye(e,t,o,i)}function yp(e){return e instanceof Tn||(e=Ut(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function ml(e,t,o,i){return arguments.length===1?yp(e):new Ye(e,t,o,i??1)}function Ye(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}fl(Ye,ml,Qr(Tn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mn:Math.pow(Mn,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Ht(this.r),Ht(this.g),Ht(this.b),Vo(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:is,formatHex:is,formatHex8:bp,formatRgb:ls,toString:ls}));function is(){return`#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}`}function bp(){return`#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}${Ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function ls(){const e=Vo(this.opacity);return`${e===1?"rgb(":"rgba("}${Ht(this.r)}, ${Ht(this.g)}, ${Ht(this.b)}${e===1?")":`, ${e})`}`}function Vo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ht(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ft(e){return e=Ht(e),(e<16?"0":"")+e.toString(16)}function as(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new Qe(e,t,o,i)}function rs(e){if(e instanceof Qe)return new Qe(e.h,e.s,e.l,e.opacity);if(e instanceof Tn||(e=Ut(e)),!e)return new Qe;if(e instanceof Qe)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,c=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?a+l:2-a-l,r*=60):s=c>0&&c<1?0:r,new Qe(r,s,c,e.opacity)}function _p(e,t,o,i){return arguments.length===1?rs(e):new Qe(e,t,o,i??1)}function Qe(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}fl(Qe,_p,Qr(Tn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new Qe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mn:Math.pow(Mn,e),new Qe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new Ye(pl(e>=240?e-240:e+120,l,i),pl(e,l,i),pl(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new Qe(ss(this.h),Ao(this.s),Ao(this.l),Vo(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=Vo(this.opacity);return`${e===1?"hsl(":"hsla("}${ss(this.h)}, ${Ao(this.s)*100}%, ${Ao(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ss(e){return e=(e||0)%360,e<0?e+360:e}function Ao(e){return Math.max(0,Math.min(1,e||0))}function pl(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 hl=e=>()=>e;function vp(e,t){return function(o){return e+o*t}}function wp(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 Ep(e){return(e=+e)==1?cs:function(t,o){return o-t?wp(t,o,e):hl(isNaN(t)?o:t)}}function cs(e,t){var o=t-e;return o?vp(e,o):hl(isNaN(e)?t:e)}const To=(function e(t){var o=Ep(t);function i(l,a){var r=o((l=ml(l)).r,(a=ml(a)).r),s=o(l.g,a.g),c=o(l.b,a.b),d=cs(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=c(u),l.opacity=d(u),l+""}}return i.gamma=e,i})(1);function Np(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),l;return function(a){for(l=0;l<o;++l)i[l]=e[l]*(1-a)+t[l]*a;return i}}function kp(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xp(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,l=new Array(i),a=new Array(o),r;for(r=0;r<i;++r)l[r]=Dn(e[r],t[r]);for(;r<o;++r)a[r]=t[r];return function(s){for(r=0;r<i;++r)a[r]=l[r](s);return a}}function $p(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function ut(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ip(e,t){var o={},i={},l;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(l in t)l in e?o[l]=Dn(e[l],t[l]):i[l]=t[l];return function(a){for(l in o)i[l]=o[l](a);return i}}var gl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yl=new RegExp(gl.source,"g");function Sp(e){return function(){return e}}function Cp(e){return function(t){return e(t)+""}}function ds(e,t){var o=gl.lastIndex=yl.lastIndex=0,i,l,a,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=gl.exec(e))&&(l=yl.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,c.push({i:r,x:ut(i,l)})),o=yl.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?c[0]?Cp(c[0].x):Sp(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 Dn(e,t){var o=typeof t,i;return t==null||o==="boolean"?hl(t):(o==="number"?ut:o==="string"?(i=Ut(t))?(t=i,To):ds:t instanceof Ut?To:t instanceof Date?$p:kp(t)?Np:Array.isArray(t)?xp:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ip:ut)(e,t)}var us=180/Math.PI,bl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fs(e,t,o,i,l,a){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:l,translateY:a,rotate:Math.atan2(t,e)*us,skewX:Math.atan(c)*us,scaleX:r,scaleY:s}}var Mo;function Rp(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?bl:fs(t.a,t.b,t.c,t.d,t.e,t.f)}function Vp(e){return e==null||(Mo||(Mo=document.createElementNS("http://www.w3.org/2000/svg","g")),Mo.setAttribute("transform",e),!(e=Mo.transform.baseVal.consolidate()))?bl:(e=e.matrix,fs(e.a,e.b,e.c,e.d,e.e,e.f))}function ms(e,t,o,i){function l(d){return d.length?d.pop()+" ":""}function a(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);g.push({i:_-4,x:ut(d,f)},{i:_-2,x:ut(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:ut(d,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:ut(d,u)}):u&&f.push(l(f)+"skewX("+u+i)}function c(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push(l(m)+"scale(",null,",",null,")");g.push({i:_-4,x:ut(d,f)},{i:_-2,x:ut(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),a(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var g=-1,_=p.length,k;++g<_;)f[(k=p[g]).i]=k.x(m);return f.join("")}}}var Ap=ms(Rp,"px, ","px)","deg)"),Tp=ms(Vp,", ",")",")"),Mp=1e-12;function ps(e){return((e=Math.exp(e))+1/e)/2}function Bp(e){return((e=Math.exp(e))-1/e)/2}function Dp(e){return((e=Math.exp(2*e))-1)/(e+1)}const Bo=(function e(t,o,i){function l(a,r){var s=a[0],c=a[1],d=a[2],u=r[0],f=r[1],p=r[2],m=u-s,g=f-c,_=m*m+g*g,k,b;if(_<Mp)b=Math.log(p/d)/t,k=function(J){return[s+J*m,c+J*g,d*Math.exp(t*J*b)]};else{var $=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*$),S=(p*p-d*d-i*_)/(2*p*o*$),X=Math.log(Math.sqrt(h*h+1)-h),W=Math.log(Math.sqrt(S*S+1)-S);b=(W-X)/t,k=function(J){var T=J*b,ee=ps(X),F=d/(o*$)*(ee*Dp(t*T+X)-Bp(X));return[s+F*m,c+F*g,d*ee/ps(t*T+X)]}}return k.duration=b*1e3*t/Math.SQRT2,k}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,c=s*s;return e(r,s,c)},l})(Math.SQRT2,2,4);var fn=0,On=0,Ln=0,hs=1e3,Do,Pn,Oo=0,Gt=0,Lo=0,zn=typeof performance=="object"&&performance.now?performance:Date,gs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _l(){return Gt||(gs(Op),Gt=zn.now()+Lo)}function Op(){Gt=0}function Po(){this._call=this._time=this._next=null}Po.prototype=ys.prototype={constructor:Po,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?_l():+o)+(t==null?0:+t),!this._next&&Pn!==this&&(Pn?Pn._next=this:Do=this,Pn=this),this._call=e,this._time=o,vl()},stop:function(){this._call&&(this._call=null,this._time=1/0,vl())}};function ys(e,t,o){var i=new Po;return i.restart(e,t,o),i}function Lp(){_l(),++fn;for(var e=Do,t;e;)(t=Gt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--fn}function bs(){Gt=(Oo=zn.now())+Lo,fn=On=0;try{Lp()}finally{fn=0,zp(),Gt=0}}function Pp(){var e=zn.now(),t=e-Oo;t>hs&&(Lo-=t,Oo=e)}function zp(){for(var e,t=Do,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:Do=o);Pn=e,vl(i)}function vl(e){if(!fn){On&&(On=clearTimeout(On));var t=e-Gt;t>24?(e<1/0&&(On=setTimeout(bs,e-zn.now()-Lo)),Ln&&(Ln=clearInterval(Ln))):(Ln||(Oo=zn.now(),Ln=setInterval(Pp,hs)),fn=1,gs(bs))}}function _s(e,t,o){var i=new Po;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var Up=ko("start","end","cancel","interrupt"),Hp=[],vs=0,ws=1,wl=2,zo=3,Es=4,El=5,Uo=6;function Ho(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;Fp(e,o,{name:t,index:i,group:l,on:Up,tween:Hp,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:vs})}function Nl(e,t){var o=et(e,t);if(o.state>vs)throw new Error("too late; already scheduled");return o}function ft(e,t){var o=et(e,t);if(o.state>zo)throw new Error("too late; already running");return o}function et(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Fp(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=ys(a,0,o.time);function a(d){o.state=ws,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==ws)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===zo)return _s(r);m.state===Es?(m.state=Uo,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Uo,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(_s(function(){o.state===zo&&(o.state=Es,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=wl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===wl){for(o.state=zo,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=El,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===El&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Uo,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Fo(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>wl&&i.state<El,i.state=Uo,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function Gp(e){return this.each(function(){Fo(this,e)})}function Yp(e,t){var o,i;return function(){var l=ft(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function Wp(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=ft(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},c=0,d=l.length;c<d;++c)if(l[c].name===t){l[c]=s;break}c===d&&l.push(s)}a.tween=l}}function Kp(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=et(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?Yp:Wp)(o,e,t))}function kl(e,t,o){var i=e._id;return e.each(function(){var l=ft(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return et(l,i).value[t]}}function Ns(e,t){var o;return(typeof t=="number"?ut:t instanceof Ut?To:(o=Ut(t))?(t=o,To):ds)(e,t)}function Xp(e){return function(){this.removeAttribute(e)}}function qp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zp(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function jp(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function Jp(e,t,o){var i,l,a;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===l?a:(l=c,a=t(i=r,s)))}}function Qp(e,t,o){var i,l,a;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===l?a:(l=c,a=t(i=r,s)))}}function eh(e,t){var o=$o(e),i=o==="transform"?Tp:Ns;return this.attrTween(e,typeof t=="function"?(o.local?Qp:Jp)(o,i,kl(this,"attr."+e,t)):t==null?(o.local?qp:Xp)(o):(o.local?jp:Zp)(o,i,t))}function th(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function nh(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function oh(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&nh(e,a)),o}return l._value=t,l}function ih(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&th(e,a)),o}return l._value=t,l}function lh(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=$o(e);return this.tween(o,(i.local?oh:ih)(i,t))}function ah(e,t){return function(){Nl(this,e).delay=+t.apply(this,arguments)}}function rh(e,t){return t=+t,function(){Nl(this,e).delay=t}}function sh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ah:rh)(t,e)):et(this.node(),t).delay}function ch(e,t){return function(){ft(this,e).duration=+t.apply(this,arguments)}}function dh(e,t){return t=+t,function(){ft(this,e).duration=t}}function uh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ch:dh)(t,e)):et(this.node(),t).duration}function fh(e,t){if(typeof t!="function")throw new Error;return function(){ft(this,e).ease=t}}function mh(e){var t=this._id;return arguments.length?this.each(fh(t,e)):et(this.node(),t).ease}function ph(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ft(this,e).ease=o}}function hh(e){if(typeof e!="function")throw new Error;return this.each(ph(this._id,e))}function gh(e){typeof e!="function"&&(e=Ur(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new _t(i,this._parents,this._name,this._id)}function yh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new _t(r,this._parents,this._name,this._id)}function bh(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 _h(e,t,o){var i,l,a=bh(t)?Nl:ft;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function vh(e,t){var o=this._id;return arguments.length<2?et(this.node(),o).on.on(e):this.each(_h(o,e,t))}function wh(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Eh(){return this.on("end.remove",wh(this._id))}function Nh(e){var t=this._name,o=this._id;typeof e!="function"&&(e=sl(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],c=s.length,d=a[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Ho(d[p],t,o,p,d,et(u,o)));return new _t(a,this._parents,t,o)}function kh(e){var t=this._name,o=this._id;typeof e!="function"&&(e=zr(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,g=et(u,o),_=0,k=p.length;_<k;++_)(m=p[_])&&Ho(m,t,o,_,p,g);a.push(p),r.push(u)}return new _t(a,r,t,o)}var xh=Vn.prototype.constructor;function $h(){return new xh(this._groups,this._parents)}function Ih(e,t){var o,i,l;return function(){var a=cn(this,e),r=(this.style.removeProperty(e),cn(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function ks(e){return function(){this.style.removeProperty(e)}}function Sh(e,t,o){var i,l=o+"",a;return function(){var r=cn(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function Ch(e,t,o){var i,l,a;return function(){var r=cn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),cn(this,e))),r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s))}}function Rh(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var c=ft(this,e),d=c.on,u=c.value[a]==null?s||(s=ks(t)):void 0;(d!==o||l!==u)&&(i=(o=d).copy()).on(r,l=u),c.on=i}}function Vh(e,t,o){var i=(e+="")=="transform"?Ap:Ns;return t==null?this.styleTween(e,Ih(e,i)).on("end.style."+e,ks(e)):typeof t=="function"?this.styleTween(e,Ch(e,i,kl(this,"style."+e,t))).each(Rh(this._id,e)):this.styleTween(e,Sh(e,i,t),o).on("end.style."+e,null)}function Ah(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function Th(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&Ah(e,r,o)),i}return a._value=t,a}function Mh(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,Th(e,t,o??""))}function Bh(e){return function(){this.textContent=e}}function Dh(e){return function(){var t=e(this);this.textContent=t??""}}function Oh(e){return this.tween("text",typeof e=="function"?Dh(kl(this,"text",e)):Bh(e==null?"":e+""))}function Lh(e){return function(t){this.textContent=e.call(this,t)}}function Ph(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&Lh(l)),t}return i._value=e,i}function zh(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,Ph(e))}function Uh(){for(var e=this._name,t=this._id,o=xs(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=et(c,t);Ho(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _t(i,this._parents,e,o)}function Hh(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},c={value:function(){--l===0&&a()}};o.each(function(){var d=ft(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}),l===0&&a()})}var Fh=0;function _t(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function xs(){return++Fh}var vt=Vn.prototype;_t.prototype={constructor:_t,select:Nh,selectAll:kh,selectChild:vt.selectChild,selectChildren:vt.selectChildren,filter:gh,merge:yh,selection:$h,transition:Uh,call:vt.call,nodes:vt.nodes,node:vt.node,size:vt.size,empty:vt.empty,each:vt.each,on:vh,attr:eh,attrTween:lh,style:Vh,styleTween:Mh,text:Oh,textTween:zh,remove:Eh,tween:Kp,delay:sh,duration:uh,ease:mh,easeVarying:hh,end:Hh,[Symbol.iterator]:vt[Symbol.iterator]};function Gh(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yh={time:null,delay:0,duration:250,ease:Gh};function Wh(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 Kh(e){var t,o;e instanceof _t?(t=e._id,e=e._name):(t=xs(),(o=Yh).time=_l(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Ho(c,e,t,d,r,o||Wh(c,t));return new _t(i,this._parents,e,t)}Vn.prototype.interrupt=Gp,Vn.prototype.transition=Kh;const Go=e=>()=>e;function Xh(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function wt(e,t,o){this.k=e,this.x=t,this.y=o}wt.prototype={constructor:wt,scale:function(e){return e===1?this:new wt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new wt(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 mn=new wt(1,0,0);wt.prototype;function xl(e){e.stopImmediatePropagation()}function Un(e){e.preventDefault(),e.stopImmediatePropagation()}function qh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zh(){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 $s(){return this.__zoom||mn}function jh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qh(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function eg(){var e=qh,t=Zh,o=Qh,i=jh,l=Jh,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Bo,d=ko("start","zoom","end"),u,f,p,m=500,g=150,_=0,k=10;function b(w){w.property("__zoom",$s).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ee).on("dblclick.zoom",F).filter(l).on("touchstart.zoom",K).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",fe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(w,R,x,G){var H=w.selection?w.selection():w;H.property("__zoom",$s),w!==H?X(w,R,x,G):H.interrupt().each(function(){W(this,arguments).event(G).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(w,R,x,G){b.scaleTo(w,function(){var H=this.__zoom.k,Z=typeof R=="function"?R.apply(this,arguments):R;return H*Z},x,G)},b.scaleTo=function(w,R,x,G){b.transform(w,function(){var H=t.apply(this,arguments),Z=this.__zoom,A=x==null?S(H):typeof x=="function"?x.apply(this,arguments):x,U=Z.invert(A),Q=typeof R=="function"?R.apply(this,arguments):R;return o(h($(Z,Q),A,U),H,r)},x,G)},b.translateBy=function(w,R,x,G){b.transform(w,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof x=="function"?x.apply(this,arguments):x),t.apply(this,arguments),r)},null,G)},b.translateTo=function(w,R,x,G,H){b.transform(w,function(){var Z=t.apply(this,arguments),A=this.__zoom,U=G==null?S(Z):typeof G=="function"?G.apply(this,arguments):G;return o(mn.translate(U[0],U[1]).scale(A.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof x=="function"?-x.apply(this,arguments):-x),Z,r)},G,H)};function $(w,R){return R=Math.max(a[0],Math.min(a[1],R)),R===w.k?w:new wt(R,w.x,w.y)}function h(w,R,x){var G=R[0]-x[0]*w.k,H=R[1]-x[1]*w.k;return G===w.x&&H===w.y?w:new wt(w.k,G,H)}function S(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function X(w,R,x,G){w.on("start.zoom",function(){W(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){W(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,Z=arguments,A=W(H,Z).event(G),U=t.apply(H,Z),Q=x==null?S(U):typeof x=="function"?x.apply(H,Z):x,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),pe=H.__zoom,de=typeof R=="function"?R.apply(H,Z):R,q=c(pe.invert(Q).concat(me/pe.k),de.invert(Q).concat(me/de.k));return function(ce){if(ce===1)ce=de;else{var Ee=q(ce),$e=me/Ee[2];ce=new wt($e,Q[0]-Ee[0]*$e,Q[1]-Ee[1]*$e)}A.zoom(null,ce)}})}function W(w,R,x){return!x&&w.__zooming||new J(w,R)}function J(w,R){this.that=w,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,R),this.taps=0}J.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,R){return this.mouse&&w!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var R=Je(this.that).datum();d.call(w,this.that,new Xh(w,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),R)}};function T(w,...R){if(!e.apply(this,arguments))return;var x=W(this,R).event(w),G=this.__zoom,H=Math.max(a[0],Math.min(a[1],G.k*Math.pow(2,i.apply(this,arguments)))),Z=ct(w);if(x.wheel)(x.mouse[0][0]!==Z[0]||x.mouse[0][1]!==Z[1])&&(x.mouse[1]=G.invert(x.mouse[0]=Z)),clearTimeout(x.wheel);else{if(G.k===H)return;x.mouse=[Z,G.invert(Z)],Fo(this),x.start()}Un(w),x.wheel=setTimeout(A,g),x.zoom("mouse",o(h($(G,H),x.mouse[0],x.mouse[1]),x.extent,r));function A(){x.wheel=null,x.end()}}function ee(w,...R){if(p||!e.apply(this,arguments))return;var x=w.currentTarget,G=W(this,R,!0).event(w),H=Je(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",me,!0),Z=ct(w,x),A=w.clientX,U=w.clientY;jr(w.view),xl(w),G.mouse=[Z,this.__zoom.invert(Z)],Fo(this),G.start();function Q(pe){if(Un(pe),!G.moved){var de=pe.clientX-A,q=pe.clientY-U;G.moved=de*de+q*q>_}G.event(pe).zoom("mouse",o(h(G.that.__zoom,G.mouse[0]=ct(pe,x),G.mouse[1]),G.extent,r))}function me(pe){H.on("mousemove.zoom mouseup.zoom",null),Jr(pe.view,G.moved),Un(pe),G.event(pe).end()}}function F(w,...R){if(e.apply(this,arguments)){var x=this.__zoom,G=ct(w.changedTouches?w.changedTouches[0]:w,this),H=x.invert(G),Z=x.k*(w.shiftKey?.5:2),A=o(h($(x,Z),G,H),t.apply(this,R),r);Un(w),s>0?Je(this).transition().duration(s).call(X,A,G,w):Je(this).call(b.transform,A,G,w)}}function K(w,...R){if(e.apply(this,arguments)){var x=w.touches,G=x.length,H=W(this,R,w.changedTouches.length===G).event(w),Z,A,U,Q;for(xl(w),A=0;A<G;++A)U=x[A],Q=ct(U,this),Q=[Q,this.__zoom.invert(Q),U.identifier],H.touch0?!H.touch1&&H.touch0[2]!==Q[2]&&(H.touch1=Q,H.taps=0):(H.touch0=Q,Z=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),Z&&(H.taps<2&&(f=Q[0],u=setTimeout(function(){u=null},m)),Fo(this),H.start())}}function O(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A,U,Q;for(Un(w),Z=0;Z<H;++Z)A=G[Z],U=ct(A,this),x.touch0&&x.touch0[2]===A.identifier?x.touch0[0]=U:x.touch1&&x.touch1[2]===A.identifier&&(x.touch1[0]=U);if(A=x.that.__zoom,x.touch1){var me=x.touch0[0],pe=x.touch0[1],de=x.touch1[0],q=x.touch1[1],ce=(ce=de[0]-me[0])*ce+(ce=de[1]-me[1])*ce,Ee=(Ee=q[0]-pe[0])*Ee+(Ee=q[1]-pe[1])*Ee;A=$(A,Math.sqrt(ce/Ee)),U=[(me[0]+de[0])/2,(me[1]+de[1])/2],Q=[(pe[0]+q[0])/2,(pe[1]+q[1])/2]}else if(x.touch0)U=x.touch0[0],Q=x.touch0[1];else return;x.zoom("touch",o(h(A,U,Q),x.extent,r))}}function fe(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A;for(xl(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),Z=0;Z<H;++Z)A=G[Z],x.touch0&&x.touch0[2]===A.identifier?delete x.touch0:x.touch1&&x.touch1[2]===A.identifier&&delete x.touch1;if(x.touch1&&!x.touch0&&(x.touch0=x.touch1,delete x.touch1),x.touch0)x.touch0[1]=this.__zoom.invert(x.touch0[0]);else if(x.end(),x.taps===2&&(A=ct(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<k)){var U=Je(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Go(+w),b):i},b.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Go(!!w),b):e},b.touchable=function(w){return arguments.length?(l=typeof w=="function"?w:Go(!!w),b):l},b.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Go([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),b):t},b.scaleExtent=function(w){return arguments.length?(a[0]=+w[0],a[1]=+w[1],b):[a[0],a[1]]},b.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(w){return arguments.length?(o=w,b):o},b.duration=function(w){return arguments.length?(s=+w,b):s},b.interpolate=function(w){return arguments.length?(c=w,b):c},b.on=function(){var w=d.on.apply(d,arguments);return w===d?b:w},b.clickDistance=function(w){return arguments.length?(_=(w=+w)*w,b):Math.sqrt(_)},b.tapDistance=function(w){return arguments.length?(k=+w,b):k},b}var ve=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ve||{}),$l=(e=>(e.Partial="partial",e.Full="full",e))($l||{}),Yt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Yt||{}),Et=(e=>(e.Strict="strict",e.Loose="loose",e))(Et||{}),Il=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Il||{}),Hn=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Hn||{}),Is=(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))(Is||{});const tg=["INPUT","SELECT","TEXTAREA"],ng=typeof document<"u"?document:null;function Sl(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,l=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,a=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return tg.includes(i==null?void 0:i.nodeName)||l||!!a}function og(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ss(e,t,o,i){const l=t.replace("+",`
3
+ `).replace(`
4
+
5
+ `,`
6
+ +`).split(`
7
+ `).map(r=>r.trim().toLowerCase());if(l.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const a=l.every((r,s)=>o.has(r)&&Array.from(o.values())[s]===l[s]);return i&&o.delete(e.toLowerCase()),a}function ig(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=lg(o.code,e);return Array.isArray(e)?e.some(l=>Ss(o[i],l,t,o.type==="keyup")):Ss(o[i],e,t,o.type==="keyup")}}function lg(e,t){return t.includes(e)?"code":"key"}function Fn(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??ng),i=n.shallowRef(n.toValue(e)===!0);let l=!1;const a=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}),Br(["blur","contextmenu"],s),Dr((...d)=>r(...d),d=>{var u,f;const p=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,m=n.toValue(t==null?void 0:t.preventDefault)??!1;if(l=og(d),(!l||l&&!p)&&Sl(d))return;const _=((f=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:f[0])||d.target,k=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!m&&(l||!k)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Dr((...d)=>r(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!l||l&&!u)&&Sl(d))return;l=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){l=!1,a.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"?ig(d,a):d}return i}const Cs="vue-flow__node-desc",Rs="vue-flow__edge-desc",ag="vue-flow__aria-live",Vs=["Enter"," ","Escape"],pn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Yo(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Wo(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 Ko(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Wt(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function As(e,t){return{x:Wt(e.x,t[0][0],t[1][0]),y:Wt(e.y,t[0][1],t[1][1])}}function Ts(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Rt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Kt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Rt(e)}function Gn(e){return Kt(e)&&"computedPosition"in e}function Xo(e){return!Number.isNaN(e)&&Number.isFinite(e)}function rg(e){return Xo(e.width)&&Xo(e.height)&&Xo(e.x)&&Xo(e.y)}function sg(e,t,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:n.markRaw({width:0,height:0}),computedPosition:n.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Ms(e,t,o){var i,l;const a={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(l=e.targetHandle)==null?void 0:l.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ze(e.data)?e.data:{},events:n.markRaw(ze(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??a,e,{id:e.id.toString()})}function Bs(e,t,o,i){const l=typeof e=="string"?e:e.id,a=new Set,r=i==="source"?"target":"source";for(const s of o)s[r]===l&&a.add(s[i]);return t.filter(s=>a.has(s.id))}function cg(...e){if(e.length===3){const[a,r,s]=e;return Bs(a,r,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Rt(a)&&a.source===i).map(a=>o.find(r=>Kt(r)&&r.id===a.target))}function dg(...e){if(e.length===3){const[a,r,s]=e;return Bs(a,r,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(a=>Rt(a)&&a.target===i).map(a=>o.find(r=>Kt(r)&&r.id===a.source))}function Ds({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function ug(e,t){return t.some(o=>Rt(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 Yn({x:e,y:t},{x:o,y:i,zoom:l}){return{x:e*l+o,y:t*l+i}}function Wn({x:e,y:t},{x:o,y:i,zoom:l},a=!1,r=[1,1]){const s={x:(e-o)/l,y:(t-i)/l};return a?Zo(s,r):s}function Os(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 qo({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function Ls({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function fg(e,t){return Ls(Os(qo(e),qo(t)))}function Cl(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=Os(t,qo({...i.computedPosition,...i.dimensions}))}return Ls(t)}function Ps(e,t,o={x:0,y:0,zoom:1},i=!1,l=!1){const a={...Wn(t,o),width:t.width/o.zoom,height:t.height/o.zoom},r=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,f=c.width??s.width??null,p=c.height??s.height??null;if(l&&!d||u)continue;const m=Wo(a,Yo(s)),g=f===null||p===null,_=i&&m>0,k=(f??0)*(p??0);(g||_||m>=k||s.dragging)&&r.push(s)}return r}function Xt(e,t){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return t.filter(i=>o.has(i.source)||o.has(i.target))}function hn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(t*o*.01)}return qn(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function mg(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=hn(e,o),l=hn(e,t);return{top:i,right:l,bottom:i,left:l,x:l*2,y:i*2}}if(typeof e=="object"){const i=hn(e.top??e.y??0,o),l=hn(e.bottom??e.y??0,o),a=hn(e.left??e.x??0,t),r=hn(e.right??e.x??0,t);return{top:i,right:r,bottom:l,left:a,x:a+r,y:i+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function pg(e,t,o,i,l,a){const{x:r,y:s}=Yn(e,{x:t,y:o,zoom:i}),{x:c,y:d}=Yn({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=l-c,f=a-d;return{left:Math.floor(r),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(f)}}function zs(e,t,o,i,l,a=.1){const r=mg(a,t,o),s=(t-r.x)/e.width,c=(o-r.y)/e.height,d=Math.min(s,c),u=Wt(d,i,l),f=e.x+e.width/2,p=e.y+e.height/2,m=t/2-f*u,g=o/2-p*u,_=pg(e,m,g,u,t,o),k={left:Math.min(_.left-r.left,0),top:Math.min(_.top-r.top,0),right:Math.min(_.right-r.right,0),bottom:Math.min(_.bottom-r.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:u}}function hg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Us(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Us(o,t):!1}function Kn(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Rl(e){const t=e.ctrlKey&&Xn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Hs(e,t,o){return e<t?Wt(Math.abs(e-t),1,t)/t:e>o?-Wt(Math.abs(e-o),1,t)/t:0}function Fs(e,t,o=15,i=40){const l=Hs(e.x,i,t.width-i)*o,a=Hs(e.y,i,t.height-i)*o;return[l,a]}function Vl(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let l={};if(typeof t.style=="function"?l={...t.style(t)}:t.style&&(l={...t.style}),l.width=l.width??`${t.dimensions.width}px`,l.height=l.height??`${t.dimensions.height}px`,o>0)if(typeof l.width=="string"){const a=Number(l.width.replace("px",""));l.width=`${a+o}px`}else l.width+=o;if(i>0)if(typeof l.height=="string"){const a=Number(l.height.replace("px",""));l.height=`${a+i}px`}else l.height+=i;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof l.width=="string"){const r=Number(l.width.replace("px",""));l.width=`${r+a}px`}else l.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof l.height=="string"){const r=Number(l.height.replace("px",""));l.height=`${r+a}px`}else l.height+=a;e.position.y=0}t.dimensions.width=Number(l.width.toString().replace("px","")),t.dimensions.height=Number(l.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const r=t.style;return{...r(a),...l}}:t.style={...t.style,...l}}}}function Gs(e,t){var o,i;const l=e.filter(r=>r.type==="add"||r.type==="remove");for(const r of l)if(r.type==="add")t.findIndex(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 a=t.map(r=>r.id);for(const r of t)for(const s of e)if(s.id===r.id)switch(s.type){case"select":r.selected=s.selected;break;case"position":if(Gn(r)&&(typeof s.position<"u"&&(r.position=s.position),typeof s.dragging<"u"&&(r.dragging=s.dragging),r.expandParent&&r.parentNode)){const c=t[a.indexOf(r.parentNode)];c&&Gn(c)&&Vl(r,c)}break;case"dimensions":if(Gn(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[a.indexOf(r.parentNode)];c&&Gn(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Vl(r,c):n.nextTick(()=>{Vl(r,c)}))}break}return t}function Vt(e,t){return{id:e,type:"select",selected:t}}function Ys(e){return{item:e,type:"add"}}function Ws(e){return{id:e,type:"remove"}}function Ks(e,t,o,i,l){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:l||null,type:"remove"}}function At(e,t=new Set,o=!1){const i=[];for(const[l,a]of e){const r=t.has(l);!(a.selected===void 0&&!r)&&a.selected!==r&&(o&&(a.selected=r),i.push(Vt(a.id,r)))}return i}const Xs=()=>{};function _e(e){const t=new Set;let o=Xs,i=()=>!1;const l=()=>t.size>0||i(),a=p=>{o=p},r=()=>{o=Xs},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{t.delete(p)};return{on:p=>{t.add(p);const m=()=>d(p);return Rn(m),{off:m}},off:d,trigger:p=>{const m=[o];return l()?m.push(...t):e&&m.push(e),Promise.allSettled(m.map(g=>g(p)))},hasListeners:l,listeners:t,setEmitter:a,removeEmitter:r,setHasEmitListeners:s,removeHasEmitListeners:c}}function qs(e,t,o){let i=e;do{if(i&&i.matches(t))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function gg(e,t,o,i){var l,a;const r=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Us(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-((l=c.computedPosition)==null?void 0:l.x)||0,y:o.y-((a=c.computedPosition)==null?void 0:a.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 Al({id:e,dragItems:t,findNode:o}){const i=[];for(const l of t){const a=o(l.id);a&&i.push(a)}return[e?i.find(l=>l.id===e):i[0],i]}function Zs(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 yg(e,t,o){const[i,l,a,r]=typeof e!="string"?Zs(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+r,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-l,o.computedPosition.y+o.dimensions.height-a]]:!1}function bg(e,t,o,i){let l=e.extent||o;if((l==="parent"||!Array.isArray(l)&&(l==null?void 0:l.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const a=yg(l,e,i);a&&(l=a)}else t(new Ue(Pe.NODE_EXTENT_INVALID,e.id)),l=o;else if(Array.isArray(l)){const a=(i==null?void 0:i.computedPosition.x)||0,r=(i==null?void 0:i.computedPosition.y)||0;l=[[l[0][0]+a,l[0][1]+r],[l[1][0]+a,l[1][1]+r]]}else if(l!=="parent"&&(l!=null&&l.range)&&Array.isArray(l.range)){const[a,r,s,c]=Zs(l.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;l=[[l.range[0][0]+d+c,l.range[0][1]+u+a],[l.range[1][0]+d-r,l.range[1][1]+u-s]]}return l==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:l}function _g({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function Tl(e,t,o,i,l){const a=_g(e.dimensions,bg(e,o,i,l)),r=As(t,a);return{position:{x:r.x-((l==null?void 0:l.computedPosition.x)||0),y:r.y-((l==null?void 0:l.computedPosition.y)||0)},computedPosition:r}}function gn(e,t,o=ve.Left,i=!1){const l=((t==null?void 0:t.x)??0)+e.computedPosition.x,a=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:s}=t??Ng(e);if(i)return{x:l+r/2,y:a+s/2};switch((t==null?void 0:t.position)??o){case ve.Top:return{x:l+r/2,y:a};case ve.Right:return{x:l+r,y:a+s/2};case ve.Bottom:return{x:l+r/2,y:a+s};case ve.Left:return{x:l,y:a+s/2}}}function js(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function vg({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:l,targetHeight:a,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+l),y2:Math.max(e.y+i,t.y+a)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=qo({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:r/c.zoom,height:s/c.zoom}),f=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(f*p)>0}function wg(e,t,o=!1){const i=typeof e.zIndex=="number";let l=i?e.zIndex:0;const a=t(e.source),r=t(e.target);return!a||!r?0:(o&&(l=i?e.zIndex:Math.max(a.computedPosition.z||0,r.computedPosition.z||0)),l)}var Pe=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(Pe||{});const Js={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
+ Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
9
+ Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
10
+ Node: ${e}
11
+ Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
12
+ Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
13
+ Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
14
+ Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
15
+ Edge: ${e}
16
+ Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
17
+ Edge: ${e}
18
+ Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
19
+ Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,o)=>`Edge source and target are the same
20
+ Edge: ${e}
21
+ Source: ${t}
22
+ Target: ${o}`,EDGE_SOURCE_TARGET_MISSING:(e,t,o)=>`Edge source or target is missing
23
+ Edge: ${e}
24
+ Source: ${t}
25
+ Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
26
+ Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
27
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Ue extends Error{constructor(t,...o){var i;super((i=Js[t])==null?void 0:i.call(Js,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Ml(e){return"clientX"in e}function Eg(e){return"sourceEvent"in e}function mt(e,t){const o=Ml(e);let i,l;return o?(i=e.clientX,l=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,l=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,l=e.changedTouches[0].clientY):(i=0,l=0),{x:i-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}}const Xn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ng(e){var t,o;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function Zo(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const kg=()=>!0;function Bl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function xg(e,t,o){const i=[],l={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const a of t.values())Wo(l,Yo(a))>0&&i.push(a);return i}const $g=250;function Ig(e,t,o,i){var l,a;let r=[],s=Number.POSITIVE_INFINITY;const c=xg(e,o,t+$g);for(const d of c){const u=[...((l=d.handleBounds)==null?void 0:l.source)??[],...((a=d.handleBounds)==null?void 0:a.target)??[]];for(const f of u){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:p,y:m}=gn(d,f,f.position,!0),g=Math.sqrt((p-e.x)**2+(m-e.y)**2);g>t||(g<s?(r=[{...f,x:p,y:m}],s=g):g===s&&r.push({...f,x:p,y:m}))}}if(!r.length)return null;if(r.length>1){const d=i.type==="source"?"target":"source";return r.find(u=>u.type===d)??r[0]}return r[0]}function Qs(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:l,fromType:a,doc:r,lib:s,flowId:c,isValidConnection:d=kg},u,f,p,m){const g=a==="target",_=t?r.querySelector(`.${s}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:k,y:b}=mt(e),$=r.elementFromPoint(k,b),h=$!=null&&$.classList.contains(`${s}-flow__handle`)?$:_,S={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const X=ec(void 0,h),W=h.getAttribute("data-nodeid"),J=h.getAttribute("data-handleid"),T=h.classList.contains("connectable"),ee=h.classList.contains("connectableend");if(!W||!X)return S;const F={source:g?W:i,sourceHandle:g?J:l,target:g?i:W,targetHandle:g?l:J};S.connection=F;const O=T&&ee&&(o===Et.Strict?g&&X==="source"||!g&&X==="target":W!==i||J!==l);S.isValid=O&&d(F,{nodes:f,edges:u,sourceNode:p(F.source),targetNode:p(F.target)}),S.toHandle=tc(W,X,J,m,o,!0)}return S}function ec(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Sg(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function Cg(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function tc(e,t,o,i,l,a=!1){var r,s,c;const d=i.get(e);if(!d)return null;const u=l===Et.Strict?(r=d.handleBounds)==null?void 0:r[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],f=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return f&&a?{...f,...gn(d,f,f.position,!0)}:f}const Dl={[ve.Left]:ve.Right,[ve.Right]:ve.Left,[ve.Top]:ve.Bottom,[ve.Bottom]:ve.Top},Rg=["production","prod"];function qn(e,...t){nc()&&console.warn(`[Vue Flow]: ${e}`,...t)}function nc(){return!Rg.includes(process.env.NODE_ENV||"")}function oc(e,t,o,i,l){const a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a!=null&&a.length?Array.from(a).map(r=>{const s=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:e,nodeId:l,position:r.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Ko(r)}}):null}function Ol(e,t,o,i,l,a=!1,r){l.value=!1,e.selected?(a||e.selected&&t)&&(i([e]),n.nextTick(()=>{r.blur()})):o([e])}function ze(e){return typeof n.unref(e)<"u"}function Vg(e,t,o,i){if(!e||!e.source||!e.target)return o(new Ue(Pe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let l;return Rt(e)?l=e:l={...e,id:Ds(e)},l=Ms(l,void 0,i),ug(l,t)?!1:l}function Ag(e,t,o,i,l){if(!t.source||!t.target)return l(new Ue(Pe.EDGE_INVALID,e.id)),!1;if(!o)return l(new Ue(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...r}=e;return{...r,id:i?Ds(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ic(e,t,o){const i={},l=[];for(let a=0;a<e.length;++a){const r=e[a];if(!Kt(r)){o(new Ue(Pe.NODE_INVALID,r==null?void 0:r.id)||`[ID UNKNOWN|INDEX ${a}]`);continue}const s=sg(r,t(r.id),r.parentNode);r.parentNode&&(i[r.parentNode]=!0),l[a]=s}for(const a of l){const r=t(a.parentNode)||l.find(s=>s.id===a.parentNode);a.parentNode&&!r&&o(new Ue(Pe.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||i[a.id])&&(i[a.id]&&(a.isParent=!0),r&&(r.isParent=!0))}return l}function lc(e,t,o,i,l,a){let r=l;const s=i.get(r)||new Map;i.set(r,s.set(o,t)),r=`${l}-${e}`;const c=i.get(r)||new Map;if(i.set(r,c.set(o,t)),a){r=`${l}-${e}-${a}`;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:l,target:a,sourceHandle:r=null,targetHandle:s=null}=i,c={edgeId:i.id,source:l,target:a,sourceHandle:r,targetHandle:s},d=`${l}-${r}--${a}-${s}`,u=`${a}-${s}--${l}-${r}`;lc("source",c,u,e,l,r),lc("target",c,d,e,a,s)}}function ac(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Pl(e,t,o,i,l,a,r,s){const c=[];for(const d of e){const u=Rt(d)?d:Vg(d,s,l,a);if(!u)continue;const f=o(u.source),p=o(u.target);if(!f||!p){l(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){l(new Ue(Pe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){l(new Ue(Pe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:r,sourceNode:f,targetNode:p})){l(new Ue(Pe.EDGE_INVALID,u.id));continue}const m=i(u.id);c.push({...Ms(u,m,a),sourceNode:f,targetNode:p})}return c}const rc=Symbol("vueFlow"),sc=Symbol("nodeId"),cc=Symbol("nodeRef"),Tg=Symbol("edgeId"),Mg=Symbol("edgeRef"),jo=Symbol("slots");function dc(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:l,nodeLookup:a,nodeExtent:r,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:f,panBy:p,findNode:m,multiSelectionActive:g,nodesSelectionActive:_,selectNodesOnDrag:k,removeSelectedElements:b,addSelectedNodes:$,updateNodePositions:h,emits:S}=Ce(),{onStart:X,onDrag:W,onStop:J,onClick:T,el:ee,disabled:F,id:K,selectable:O,dragHandle:fe}=e,w=n.shallowRef(!1);let R=[],x,G=null,H={x:void 0,y:void 0},Z={x:0,y:0},A=null,U=!1,Q=!1,me=0,pe=!1;const de=Og(),q=({x:N,y:I})=>{H={x:N,y:I};let v=!1;if(R=R.map(E=>{const C={x:N-E.distance.x,y:I-E.distance.y},{computedPosition:D}=Tl(E,o.value?Zo(C,i.value):C,S.error,r.value,E.parentNode?m(E.parentNode):void 0);return v=v||E.position.x!==D.x||E.position.y!==D.y,E.position=D,E}),Q=Q||v,!!v&&(h(R,!0,!0),w.value=!0,A)){const[E,C]=Al({id:K,dragItems:R,findNode:m});W({event:A,node:E,nodes:C})}},ce=()=>{if(!G)return;const[N,I]=Fs(Z,G,u.value);if(N!==0||I!==0){const v={x:(H.x??0)-N/c.value.zoom,y:(H.y??0)-I/c.value.zoom};p({x:N,y:I})&&q(v)}me=requestAnimationFrame(ce)},Ee=(N,I)=>{U=!0;const v=m(K);!k.value&&!g.value&&v&&(v.selected||b()),v&&n.toValue(O)&&k.value&&Ol(v,g.value,$,b,_,!1,I);const E=de(N.sourceEvent);if(H=E,R=gg(a.value,f.value,E,K),R.length){const[C,D]=Al({id:K,dragItems:R,findNode:m});X({event:N.sourceEvent,node:C,nodes:D})}},$e=(N,I)=>{var v;N.sourceEvent.type==="touchmove"&&N.sourceEvent.touches.length>1||(Q=!1,s.value===0&&Ee(N,I),H=de(N.sourceEvent),G=((v=t.value)==null?void 0:v.getBoundingClientRect())||null,Z=mt(N.sourceEvent,G))},ke=(N,I)=>{const v=de(N.sourceEvent);if(!pe&&U&&d.value&&(pe=!0,ce()),!U){const E=v.xSnapped-(H.x??0),C=v.ySnapped-(H.y??0);Math.sqrt(E*E+C*C)>s.value&&Ee(N,I)}(H.x!==v.xSnapped||H.y!==v.ySnapped)&&R.length&&U&&(A=N.sourceEvent,Z=mt(N.sourceEvent,G),q(v))},he=N=>{let I=!1;if(!U&&!w.value&&!g.value){const v=N.sourceEvent,E=de(v),C=E.xSnapped-(H.x??0),D=E.ySnapped-(H.y??0),B=Math.sqrt(C*C+D*D);B!==0&&B<=s.value&&(T==null||T(v),I=!0)}if(R.length&&!I){Q&&(h(R,!1,!1),Q=!1);const[v,E]=Al({id:K,dragItems:R,findNode:m});J({event:N.sourceEvent,node:v,nodes:E})}R=[],w.value=!1,pe=!1,U=!1,H={x:void 0,y:void 0},cancelAnimationFrame(me)};return n.watch([()=>n.toValue(F),ee],([N,I],v,E)=>{if(I){const C=Je(I);N||(x=rp().on("start",D=>$e(D,I)).on("drag",D=>ke(D,I)).on("end",D=>he(D)).filter(D=>{const B=D.target,oe=n.toValue(fe);return!D.button&&(!l.value||!qs(B,`.${l.value}`,I)&&(!oe||qs(B,oe,I)))}),C.call(x)),E(()=>{C.on(".drag",null),x&&(x.on("start",null),x.on("drag",null),x.on("end",null))})}}),w}function Bg(){return{doubleClick:_e(),click:_e(),mouseEnter:_e(),mouseMove:_e(),mouseLeave:_e(),contextMenu:_e(),updateStart:_e(),update:_e(),updateEnd:_e()}}function Dg(e,t){const o=Bg();return o.doubleClick.on(i=>{var l,a;t.edgeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.edgeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.edgeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.edgeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.edgeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.edgeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.updateStart.on(i=>{var l,a;t.edgeUpdateStart(i),(a=(l=e.events)==null?void 0:l.updateStart)==null||a.call(l,i)}),o.update.on(i=>{var l,a;t.edgeUpdate(i),(a=(l=e.events)==null?void 0:l.update)==null||a.call(l,i)}),o.updateEnd.on(i=>{var l,a;t.edgeUpdateEnd(i),(a=(l=e.events)==null?void 0:l.updateEnd)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function Og(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=Ce();return l=>{var a;const r=((a=i.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},s=Eg(l)?l.sourceEvent:l,{x:c,y:d}=mt(s,r),u=Wn({x:c,y:d},e.value),{x:f,y:p}=o.value?Zo(u,t.value):u;return{xSnapped:f,ySnapped:p,...u}}}function Jo(){return!0}function uc({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:l,onEdgeUpdate:a,onEdgeUpdateEnd:r}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:g,autoPanSpeed:_,findNode:k,panBy:b,startConnection:$,updateConnection:h,endConnection:S,emits:X,viewport:W,edges:J,nodes:T,isValidConnection:ee,nodeLookup:F}=Ce();let K=null,O=!1,fe=null;function w(x){var G;const H=n.toValue(o)==="target",Z=Ml(x),A=Ts(x.target),U=x.currentTarget;if(U&&(Z&&x.button===0||!Z)){let Q=function(V){v=mt(V,he),q=Ig(Wn(v,W.value,!1,[1,1]),u.value,F.value,D),E||(C(),E=!0);const M=Qs(V,{handle:q,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:H?"target":"source",isValidConnection:de,doc:A,lib:"vue",flowId:s,nodeLookup:F.value},J.value,T.value,k,F.value);fe=M.handleDomNode,K=M.connection,O=Cg(!!q,M.isValid);const y={...le,isValid:O,to:M.toHandle&&O?Yn({x:M.toHandle.x,y:M.toHandle.y},W.value):v,toHandle:M.toHandle,toPosition:O&&M.toHandle?M.toHandle.position:Dl[D.position],toNode:M.toHandle?F.value.get(M.toHandle.nodeId):null};if(O&&q&&(le!=null&&le.toHandle)&&y.toHandle&&le.toHandle.type===y.toHandle.type&&le.toHandle.nodeId===y.toHandle.nodeId&&le.toHandle.id===y.toHandle.id&&le.to.x===y.to.x&&le.to.y===y.to.y)return;const L=q??M.toHandle;if(h(L&&O?Yn({x:L.x,y:L.y},W.value):v,L,Sg(!!L,O)),le=y,!q&&!O&&!fe)return Bl(I);K&&K.source!==K.target&&fe&&(Bl(I),I=fe,fe.classList.add("connecting","vue-flow__handle-connecting"),fe.classList.toggle("valid",!!O),fe.classList.toggle("vue-flow__handle-valid",!!O))},me=function(V){"touches"in V&&V.touches.length>0||((q||fe)&&K&&O&&(a?a(V,K):X.connect(K)),X.connectEnd(V),l&&(r==null||r(V)),Bl(I),cancelAnimationFrame(ce),S(V),E=!1,O=!1,K=null,fe=null,A.removeEventListener("mousemove",Q),A.removeEventListener("mouseup",me),A.removeEventListener("touchmove",Q),A.removeEventListener("touchend",me))};const pe=k(n.toValue(t));let de=n.toValue(i)||ee.value||Jo;!de&&pe&&(de=(H?pe.isValidSourcePos:pe.isValidTargetPos)||Jo);let q,ce=0;const{x:Ee,y:$e}=mt(x),ke=ec(n.toValue(l),U),he=(G=c.value)==null?void 0:G.getBoundingClientRect();if(!he||!ke)return;const N=tc(n.toValue(t),ke,n.toValue(e),F.value,d.value);if(!N)return;let I,v=mt(x,he),E=!1;const C=()=>{if(!g.value)return;const[V,M]=Fs(v,he,_.value);b({x:V,y:M}),ce=requestAnimationFrame(C)},D={...N,nodeId:n.toValue(t),type:ke,position:N.position},B=F.value.get(n.toValue(t)),ie={inProgress:!0,isValid:null,from:gn(B,D,ve.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:B,to:v,toHandle:null,toPosition:Dl[D.position],toNode:null};$({nodeId:n.toValue(t),id:n.toValue(e),type:ke,position:(U==null?void 0:U.getAttribute("data-handlepos"))||ve.Top,...v},{x:Ee-he.left,y:$e-he.top}),X.connectStart({event:x,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:ke});let le=ie;A.addEventListener("mousemove",Q),A.addEventListener("mouseup",me),A.addEventListener("touchmove",Q),A.addEventListener("touchend",me)}}function R(x){var G,H;if(!f.value)return;const Z=n.toValue(o)==="target";if(!p.value){X.clickConnectStart({event:x,nodeId:n.toValue(t),handleId:n.toValue(e)}),$({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:ve.Top,...mt(x)},void 0,!0);return}let A=n.toValue(i)||ee.value||Jo;const U=k(n.toValue(t));if(!A&&U&&(A=(Z?U.isValidSourcePos:U.isValidTargetPos)||Jo),U&&(typeof U.connectable>"u"?m.value:U.connectable)===!1)return;const Q=Ts(x.target),me=Qs(x,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:ve.Top,...mt(x)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:A,doc:Q,lib:"vue",flowId:s,nodeLookup:F.value},J.value,T.value,k,F.value),pe=((G=me.connection)==null?void 0:G.source)===((H=me.connection)==null?void 0:H.target);me.isValid&&me.connection&&!pe&&X.connect(me.connection),X.clickConnectEnd(x),S(x,!0)}return{handlePointerDown:w,handleClick:R}}function Lg(){return n.inject(sc,"")}function fc(e){const t=e??Lg()??"",o=n.inject(cc,n.ref(null)),{findNode:i,edges:l,emits:a}=Ce(),r=i(t);return r||a.error(new Ue(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:r,parentNode:n.computed(()=>i(r.parentNode)),connectedEdges:n.computed(()=>Xt([r],l.value))}}function Pg(){return{doubleClick:_e(),click:_e(),mouseEnter:_e(),mouseMove:_e(),mouseLeave:_e(),contextMenu:_e(),dragStart:_e(),drag:_e(),dragStop:_e()}}function zg(e,t){const o=Pg();return o.doubleClick.on(i=>{var l,a;t.nodeDoubleClick(i),(a=(l=e.events)==null?void 0:l.doubleClick)==null||a.call(l,i)}),o.click.on(i=>{var l,a;t.nodeClick(i),(a=(l=e.events)==null?void 0:l.click)==null||a.call(l,i)}),o.mouseEnter.on(i=>{var l,a;t.nodeMouseEnter(i),(a=(l=e.events)==null?void 0:l.mouseEnter)==null||a.call(l,i)}),o.mouseMove.on(i=>{var l,a;t.nodeMouseMove(i),(a=(l=e.events)==null?void 0:l.mouseMove)==null||a.call(l,i)}),o.mouseLeave.on(i=>{var l,a;t.nodeMouseLeave(i),(a=(l=e.events)==null?void 0:l.mouseLeave)==null||a.call(l,i)}),o.contextMenu.on(i=>{var l,a;t.nodeContextMenu(i),(a=(l=e.events)==null?void 0:l.contextMenu)==null||a.call(l,i)}),o.dragStart.on(i=>{var l,a;t.nodeDragStart(i),(a=(l=e.events)==null?void 0:l.dragStart)==null||a.call(l,i)}),o.drag.on(i=>{var l,a;t.nodeDrag(i),(a=(l=e.events)==null?void 0:l.drag)==null||a.call(l,i)}),o.dragStop.on(i=>{var l,a;t.nodeDragStop(i),(a=(l=e.events)==null?void 0:l.dragStop)==null||a.call(l,i)}),Object.entries(o).reduce((i,[l,a])=>(i.emit[l]=a.trigger,i.on[l]=a.on,i),{emit:{},on:{}})}function mc(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:l,snapToGrid:a,nodesDraggable:r,emits:s}=Ce();return(c,d=!1)=>{const u=a.value?l.value[0]:5,f=a.value?l.value[1]:5,p=d?4:1,m=c.x*u*p,g=c.y*f*p,_=[];for(const k of e.value)if(k.draggable||r&&typeof k.draggable>"u"){const b={x:k.computedPosition.x+m,y:k.computedPosition.y+g},{position:$}=Tl(k,b,s.error,t.value,k.parentNode?i(k.parentNode):void 0);_.push({id:k.id,position:$,from:k.position,distance:{x:c.x,y:c.y},dimensions:k.dimensions})}o(_,!0,!1)}}const Qo=.1,Ug=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Tt(){return qn("Viewport not initialized yet."),Promise.resolve(!1)}const Hg={zoomIn:Tt,zoomOut:Tt,zoomTo:Tt,fitView:Tt,setCenter:Tt,fitBounds:Tt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Tt,setTransform:Tt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Fg(e){function t(i,l){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((l==null?void 0:l.interpolate)==="linear"?Dn:Bo).scaleBy(zl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{a(!0)}),i):a(!1)})}function o(i,l,a,r){return new Promise(s=>{var c;const{x:d,y:u}=As({x:-i,y:-l},e.translateExtent),f=mn.translate(-d,-u).scale(a);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((r==null?void 0:r.interpolate)==="linear"?Dn:Bo).transform(zl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),f):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:l=>t(1.2,l),zoomOut:l=>t(1/1.2,l),zoomTo:(l,a)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Dn:Bo).scaleTo(zl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),l):r(!1)}),setViewport:(l,a)=>o(l.x,l.y,l.zoom,a),setTransform:(l,a)=>o(l.x,l.y,l.zoom,a),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(l={padding:Qo,includeHiddenNodes:!1,duration:0})=>{var a,r;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((l==null?void 0:l.includeHiddenNodes)||!p.hidden)&&(!((a=l.nodes)!=null&&a.length)||(r=l.nodes)!=null&&r.length&&l.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Cl(s),{x:d,y:u,zoom:f}=zs(c,e.dimensions.width,e.dimensions.height,l.minZoom??e.minZoom,l.maxZoom??e.maxZoom,l.padding??Qo);return o(d,u,f,l)},setCenter:(l,a,r)=>{const s=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:e.maxZoom,c=e.dimensions.width/2-l*s,d=e.dimensions.height/2-a*s;return o(c,d,s,r)},fitBounds:(l,a={padding:Qo})=>{const{x:r,y:s,zoom:c}=zs(l,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,a.padding??Qo);return o(r,s,c,a)},project:l=>Wn(l,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x-a,y:l.y-r};return Wn(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:l=>{if(e.vueFlowRef){const{x:a,y:r}=e.vueFlowRef.getBoundingClientRect(),s={x:l.x+a,y:l.y+r};return Yn(s,e.viewport)}return{x:0,y:0}}}:Hg)}function zl(e,t=0,o=Ug,i=()=>{}){const l=typeof t=="number"&&t>0;return l||i(),l?e.transition().duration(t).ease(o).on("end",i):e}function Gg(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const l=()=>{i.run(()=>{let _,k,b=!!(o.nodes.value.length||o.edges.value.length);_=sn([e.modelValue,()=>{var $,h;return(h=($=e.modelValue)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setElements($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([$,h])=>{var S;(S=e.modelValue)!=null&&S.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...$,...h],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},a=()=>{i.run(()=>{let _,k,b=!!o.nodes.value.length;_=sn([e.nodes,()=>{var $,h;return(h=($=e.nodes)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setNodes($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.nodes,()=>o.nodes.value.length],([$])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...$],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},r=()=>{i.run(()=>{let _,k,b=!!o.edges.value.length;_=sn([e.edges,()=>{var $,h;return(h=($=e.edges)==null?void 0:$.value)==null?void 0:h.length}],([$])=>{$&&Array.isArray($)&&(k==null||k.pause(),o.setEdges($),!k&&!b&&$.length?b=!0:k==null||k.resume())}),k=sn([o.edges,()=>o.edges.value.length],([$])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...$],n.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),n.onScopeDispose(()=>{_==null||_.stop(),k==null||k.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&ze(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&ze(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&ze(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&ze(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{ze(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async k=>{let b=k;typeof t.autoConnect=="function"&&(b=await t.autoConnect(k)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{ze(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(k,b,$)=>{k?o.onConnect(_):o.hooks.value.connect.off(_),$(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const k of Object.keys(t)){const b=k;if(!_.includes(b)){const $=n.toRef(()=>t[b]),h=o[b];n.isRef(h)&&i.run(()=>{n.watch($,S=>{ze(S)&&(h.value=S)},{immediate:!0})})}}};(()=>{l(),a(),r(),c(),s(),d(),u(),f(),p(),m()})()}),()=>i.stop()}function Yg(){return{edgesChange:_e(),nodesChange:_e(),nodeDoubleClick:_e(),nodeClick:_e(),nodeMouseEnter:_e(),nodeMouseMove:_e(),nodeMouseLeave:_e(),nodeContextMenu:_e(),nodeDragStart:_e(),nodeDrag:_e(),nodeDragStop:_e(),nodesInitialized:_e(),miniMapNodeClick:_e(),miniMapNodeDoubleClick:_e(),miniMapNodeMouseEnter:_e(),miniMapNodeMouseMove:_e(),miniMapNodeMouseLeave:_e(),connect:_e(),connectStart:_e(),connectEnd:_e(),clickConnectStart:_e(),clickConnectEnd:_e(),paneReady:_e(),init:_e(),move:_e(),moveStart:_e(),moveEnd:_e(),selectionDragStart:_e(),selectionDrag:_e(),selectionDragStop:_e(),selectionContextMenu:_e(),selectionStart:_e(),selectionEnd:_e(),viewportChangeStart:_e(),viewportChange:_e(),viewportChangeEnd:_e(),paneScroll:_e(),paneClick:_e(),paneContextMenu:_e(),paneMouseEnter:_e(),paneMouseMove:_e(),paneMouseLeave:_e(),edgeContextMenu:_e(),edgeMouseEnter:_e(),edgeMouseMove:_e(),edgeMouseLeave:_e(),edgeDoubleClick:_e(),edgeClick:_e(),edgeUpdateStart:_e(),edgeUpdate:_e(),edgeUpdateEnd:_e(),updateNodeInternals:_e(),error:_e(e=>qn(e.message))}}function Wg(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[l,a]of Object.entries(t.value)){const r=s=>{e(l,s)};a.setEmitter(r),Rn(a.removeEmitter),a.setHasEmitListeners(()=>i(l)),Rn(a.removeHasEmitListeners)}});function i(l){var a;const r=Kg(l);return!!((a=o==null?void 0:o.vnode.props)==null?void 0:a[r])}}function Kg(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(l,a)=>a.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function pc(){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:$l.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Hn.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:Yt.Bezier,style:{}},connectionMode:Et.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:Xn()?"Meta":"Control",zoomActivationKeyCode:Xn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Yg(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const Xg=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function qg(e,t,o){const i=Fg(e),l=v=>{const E=v??[];e.hooks.updateNodeInternals.trigger(E)},a=v=>dg(v,e.nodes,e.edges),r=v=>cg(v,e.nodes,e.edges),s=v=>Xt(v,e.edges),c=({id:v,type:E,nodeId:C})=>{var D;const B=v?`-${E}-${v}`:`-${E}`;return Array.from(((D=e.connectionLookup.get(`${C}${B}`))==null?void 0:D.values())??[])},d=v=>{if(v)return t.value.get(v)},u=v=>{if(v)return o.value.get(v)},f=(v,E,C)=>{var D,B;const oe=[];for(const ie of v){const le={id:ie.id,type:"position",dragging:C,from:ie.from};if(E&&(le.position=ie.position,ie.parentNode)){const V=d(ie.parentNode);le.position={x:le.position.x-(((D=V==null?void 0:V.computedPosition)==null?void 0:D.x)??0),y:le.position.y-(((B=V==null?void 0:V.computedPosition)==null?void 0:B.y)??0)}}oe.push(le)}oe!=null&&oe.length&&e.hooks.nodesChange.trigger(oe)},p=v=>{if(!e.vueFlowRef)return;const E=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!E)return;const C=window.getComputedStyle(E),{m22:D}=new window.DOMMatrixReadOnly(C.transform),B=[];for(const oe of v){const ie=oe,le=d(ie.id);if(le){const V=Ko(ie.nodeElement);if(!!(V.width&&V.height&&(le.dimensions.width!==V.width||le.dimensions.height!==V.height||ie.forceUpdate))){const y=ie.nodeElement.getBoundingClientRect();le.dimensions=V,le.handleBounds.source=oc("source",ie.nodeElement,y,D,le.id),le.handleBounds.target=oc("target",ie.nodeElement,y,D,le.id),B.push({id:le.id,type:"dimensions",dimensions:V})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),B.length&&e.hooks.nodesChange.trigger(B)},m=(v,E)=>{const C=new Set,D=new Set;for(const ie of v)Kt(ie)?C.add(ie.id):Rt(ie)&&D.add(ie.id);const B=At(t.value,C,!0),oe=At(o.value,D);if(e.multiSelectionActive){for(const ie of C)B.push(Vt(ie,E));for(const ie of D)oe.push(Vt(ie,E))}B.length&&e.hooks.nodesChange.trigger(B),oe.length&&e.hooks.edgesChange.trigger(oe)},g=v=>{if(e.multiSelectionActive){const E=v.map(C=>Vt(C.id,!0));e.hooks.nodesChange.trigger(E);return}e.hooks.nodesChange.trigger(At(t.value,new Set(v.map(E=>E.id)),!0)),e.hooks.edgesChange.trigger(At(o.value))},_=v=>{if(e.multiSelectionActive){const E=v.map(C=>Vt(C.id,!0));e.hooks.edgesChange.trigger(E);return}e.hooks.edgesChange.trigger(At(o.value,new Set(v.map(E=>E.id)))),e.hooks.nodesChange.trigger(At(t.value,new Set,!0))},k=v=>{m(v,!0)},b=v=>{const C=(v||e.nodes).map(D=>(D.selected=!1,Vt(D.id,!1)));e.hooks.nodesChange.trigger(C)},$=v=>{const C=(v||e.edges).map(D=>(D.selected=!1,Vt(D.id,!1)));e.hooks.edgesChange.trigger(C)},h=v=>{if(!v||!v.length)return m([],!1);const E=v.reduce((C,D)=>{const B=Vt(D.id,!1);return Kt(D)?C.nodes.push(B):C.edges.push(B),C},{nodes:[],edges:[]});E.nodes.length&&e.hooks.nodesChange.trigger(E.nodes),E.edges.length&&e.hooks.edgesChange.trigger(E.edges)},S=v=>{var E;(E=e.d3Zoom)==null||E.scaleExtent([v,e.maxZoom]),e.minZoom=v},X=v=>{var E;(E=e.d3Zoom)==null||E.scaleExtent([e.minZoom,v]),e.maxZoom=v},W=v=>{var E;(E=e.d3Zoom)==null||E.translateExtent(v),e.translateExtent=v},J=v=>{e.nodeExtent=v,l()},T=v=>{var E;(E=e.d3Zoom)==null||E.clickDistance(v)},ee=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},F=v=>{const E=v instanceof Function?v(e.nodes):v;!e.initialized&&!E.length||(e.nodes=ic(E,d,e.hooks.error.trigger))},K=v=>{const E=v instanceof Function?v(e.edges):v;if(!e.initialized&&!E.length)return;const C=Pl(E,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Ll(e.connectionLookup,o.value,C),e.edges=C},O=v=>{const E=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!E.length||(F(E.filter(Kt)),K(E.filter(Rt)))},fe=v=>{let E=v instanceof Function?v(e.nodes):v;E=Array.isArray(E)?E:[E];const C=ic(E,d,e.hooks.error.trigger),D=[];for(const B of C)D.push(Ys(B));D.length&&e.hooks.nodesChange.trigger(D)},w=v=>{let E=v instanceof Function?v(e.edges):v;E=Array.isArray(E)?E:[E];const C=Pl(E,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),D=[];for(const B of C)D.push(Ys(B));D.length&&e.hooks.edgesChange.trigger(D)},R=(v,E=!0,C=!1)=>{const D=v instanceof Function?v(e.nodes):v,B=Array.isArray(D)?D:[D],oe=[],ie=[];function le(M){const y=s(M);for(const L of y)(!ze(L.deletable)||L.deletable)&&ie.push(Ks(L.id,L.source,L.target,L.sourceHandle,L.targetHandle))}function V(M){const y=[];for(const L of e.nodes)L.parentNode===M&&y.push(L);if(y.length){for(const L of y)oe.push(Ws(L.id));E&&le(y);for(const L of y)V(L.id)}}for(const M of B){const y=typeof M=="string"?d(M):M;y&&(ze(y.deletable)&&!y.deletable||(oe.push(Ws(y.id)),E&&le([y]),C&&V(y.id)))}ie.length&&e.hooks.edgesChange.trigger(ie),oe.length&&e.hooks.nodesChange.trigger(oe)},x=v=>{const E=v instanceof Function?v(e.edges):v,C=Array.isArray(E)?E:[E],D=[];for(const B of C){const oe=typeof B=="string"?u(B):B;oe&&(ze(oe.deletable)&&!oe.deletable||D.push(Ks(typeof B=="string"?B:B.id,oe.source,oe.target,oe.sourceHandle,oe.targetHandle)))}e.hooks.edgesChange.trigger(D)},G=(v,E,C=!0)=>{const D=u(v.id);if(!D)return!1;const B=e.edges.indexOf(D),oe=Ag(v,E,D,C,e.hooks.error.trigger);if(oe){const[ie]=Pl([oe],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((le,V)=>V===B?ie:le),Ll(e.connectionLookup,o.value,[ie]),ie}return!1},H=(v,E,C={replace:!1})=>{const D=u(v);if(!D)return;const B=typeof E=="function"?E(D):E;D.data=C.replace?B:{...D.data,...B}},Z=v=>Gs(v,e.nodes),A=v=>{const E=Gs(v,e.edges);return Ll(e.connectionLookup,o.value,E),E},U=(v,E,C={replace:!1})=>{const D=d(v);if(!D)return;const B=typeof E=="function"?E(D):E;C.replace?e.nodes.splice(e.nodes.indexOf(D),1,B):Object.assign(D,B)},Q=(v,E,C={replace:!1})=>{const D=d(v);if(!D)return;const B=typeof E=="function"?E(D):E;D.data=C.replace?B:{...D.data,...B}},me=(v,E,C=!1)=>{C?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,E&&(e.connectionPosition=E)},pe=(v,E=null,C=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=E,e.connectionStatus=C)},de=(v,E)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,E?e.connectionClickStartHandle=null:e.connectionStartHandle=null},q=v=>{const E=rg(v),C=E?null:Gn(v)?v:d(v.id);return!E&&!C?[null,null,E]:[E?v:Yo(C),C,E]},ce=(v,E=!0,C=e.nodes)=>{const[D,B,oe]=q(v);if(!D)return[];const ie=[];for(const le of C||e.nodes){if(!oe&&(le.id===B.id||!le.computedPosition))continue;const V=Yo(le),M=Wo(V,D);(E&&M>0||M>=V.width*V.height||M>=Number(D.width)*Number(D.height))&&ie.push(le)}return ie},Ee=(v,E,C=!0)=>{const[D]=q(v);if(!D)return!1;const B=Wo(D,E);return C&&B>0||B>=Number(D.width)*Number(D.height)},$e=v=>{const{viewport:E,dimensions:C,d3Zoom:D,d3Selection:B,translateExtent:oe}=e;if(!D||!B||!v.x&&!v.y)return!1;const ie=mn.translate(E.x+v.x,E.y+v.y).scale(E.zoom),le=[[0,0],[C.width,C.height]],V=D.constrain()(ie,le,oe),M=e.viewport.x!==V.x||e.viewport.y!==V.y||e.viewport.zoom!==V.k;return D.transform(B,V),M},ke=v=>{const E=v instanceof Function?v(e):v,C=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ze(E.defaultEdgeOptions)&&(e.defaultEdgeOptions=E.defaultEdgeOptions);const D=E.modelValue||E.nodes||E.edges?[]:void 0;D&&(E.modelValue&&D.push(...E.modelValue),E.nodes&&D.push(...E.nodes),E.edges&&D.push(...E.edges),O(D));const B=()=>{ze(E.maxZoom)&&X(E.maxZoom),ze(E.minZoom)&&S(E.minZoom),ze(E.translateExtent)&&W(E.translateExtent)};for(const oe of Object.keys(E)){const ie=oe,le=E[ie];![...Xg,...C].includes(ie)&&ze(le)&&(e[ie]=le)}ll(()=>e.d3Zoom).not.toBeNull().then(B),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:p,setElements:O,setNodes:F,setEdges:K,addNodes:fe,addEdges:w,removeNodes:R,removeEdges:x,findNode:d,findEdge:u,updateEdge:G,updateEdgeData:H,updateNode:U,updateNodeData:Q,applyEdgeChanges:A,applyNodeChanges:Z,addSelectedElements:k,addSelectedNodes:g,addSelectedEdges:_,setMinZoom:S,setMaxZoom:X,setTranslateExtent:W,setNodeExtent:J,setPaneClickDistance:T,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:$,startConnection:me,updateConnection:pe,endConnection:de,setInteractive:ee,setState:ke,getIntersectingNodes:ce,getIncomers:a,getOutgoers:r,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ee,panBy:$e,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,E)=>i.value.zoomTo(v,E),setViewport:(v,E)=>i.value.setViewport(v,E),setTransform:(v,E)=>i.value.setTransform(v,E),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,E,C)=>i.value.setCenter(v,E,C),fitBounds:(v,E)=>i.value.fitBounds(v,E),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],E=[];for(const C of e.nodes){const{computedPosition:D,handleBounds:B,selected:oe,dimensions:ie,isParent:le,resizing:V,dragging:M,events:y,...L}=C;v.push(L)}for(const C of e.edges){const{selected:D,sourceNode:B,targetNode:oe,events:ie,...le}=C;E.push(le)}return JSON.parse(JSON.stringify({nodes:v,edges:E,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(E=>{const{nodes:C,edges:D,position:B,zoom:oe,viewport:ie}=v;C&&F(C),D&&K(D);const[le,V]=ie!=null&&ie.x&&(ie!=null&&ie.y)?[ie.x,ie.y]:B??[null,null];if(le&&V){const M=(ie==null?void 0:ie.zoom)||oe||e.viewport.zoom;return ll(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:le,y:V,zoom:M}).then(()=>{E(!0)})})}else E(!0)}),updateNodeInternals:l,viewportHelper:i,$reset:()=>{const v=pc();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const E=mn.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(Wt(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),C=e.viewportRef.getBoundingClientRect(),D=[[0,0],[C.width,C.height]],B=e.d3Zoom.constrain()(E,D,v.translateExtent);e.d3Zoom.transform(e.d3Selection,B)}ke(v)},$destroy:()=>{}}}const Zg=["data-id","data-handleid","data-nodeid","data-handlepos"],jg={name:"Handle",compatConfig:{MODE:3}},qt=n.defineComponent({...jg,props:{id:{default:null},type:{},position:{default:()=>ve.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),l=n.toRef(()=>o.isValidConnection??null),{id:a,connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:f,noPanClassName:p}=Ce(),{id:m,node:g,nodeEl:_,connectedEdges:k}=fc(),b=n.ref(),$=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),S=n.toRef(()=>{var K,O,fe,w,R,x;return((K=r.value)==null?void 0:K.nodeId)===m&&((O=r.value)==null?void 0:O.id)===e.id&&((fe=r.value)==null?void 0:fe.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===m&&((R=c.value)==null?void 0:R.id)===e.id&&((x=c.value)==null?void 0:x.type)===i.value}),X=n.toRef(()=>{var K,O,fe;return((K=s.value)==null?void 0:K.nodeId)===m&&((O=s.value)==null?void 0:O.id)===e.id&&((fe=s.value)==null?void 0:fe.type)===i.value}),{handlePointerDown:W,handleClick:J}=uc({nodeId:m,handleId:e.id,isValidConnection:l,type:i}),T=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!k.value.some(K=>{const O=K[`${i.value}Handle`];return K[i.value]!==m?!1:O?O===e.id:!0}):typeof e.connectable=="number"?k.value.filter(K=>{const O=K[`${i.value}Handle`];return K[i.value]!==m?!1:O?O===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(g,k.value):ze(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var K;if(!g.dimensions.width||!g.dimensions.height)return;const O=(K=g.handleBounds[i.value])==null?void 0:K.find(Z=>Z.id===e.id);if(!d.value||O)return;const fe=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!b.value||!fe||!e.id)return;const w=_.value.getBoundingClientRect(),R=b.value.getBoundingClientRect(),x=window.getComputedStyle(fe),{m22:G}=new window.DOMMatrixReadOnly(x.transform),H={id:e.id,position:e.position,x:(R.left-w.left)/G,y:(R.top-w.top)/G,type:i.value,nodeId:m,...Ko(b.value)};g.handleBounds[i.value]=[...g.handleBounds[i.value]??[],H]});function ee(K){const O=Ml(K);T.value&&$.value&&(O&&K.button===0||!O)&&W(K)}function F(K){!m||!s.value&&!$.value||T.value&&J(K)}return t({handleClick:J,handlePointerDown:W,onClick:F,onPointerDown:ee}),(K,O)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(a)}-${n.unref(m)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(m),"data-handlepos":K.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${K.position}`,`vue-flow__handle-${e.id}`,n.unref(f),n.unref(p),i.value,{connectable:T.value,connecting:X.value,connectablestart:$.value,connectableend:h.value,connectionindicator:T.value&&($.value&&!S.value||h.value&&S.value)}]]),onMousedown:ee,onTouchstartPassive:ee,onClick:F},[n.renderSlot(K.$slots,"default",{id:K.id})],42,Zg))}}),ei=function({sourcePosition:e=ve.Bottom,targetPosition:t=ve.Top,label:o,connectable:i=!0,isValidTargetPos:l,isValidSourcePos:a,data:r}){const s=r.label??o;return[n.h(qt,{type:"target",position:t,connectable:i,isValidConnection:l}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(qt,{type:"source",position:e,connectable:i,isValidConnection:a})]};ei.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ei.inheritAttrs=!1,ei.compatConfig={MODE:3};const Jg=ei,ti=function({targetPosition:e=ve.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:l}){const a=l.label??t;return[n.h(qt,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a])]};ti.props=["targetPosition","label","isValidTargetPos","connectable","data"],ti.inheritAttrs=!1,ti.compatConfig={MODE:3};const Qg=ti,ni=function({sourcePosition:e=ve.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:l}){const a=l.label??t;return[typeof a!="string"&&a?n.h(a):n.h(n.Fragment,[a]),n.h(qt,{type:"source",position:e,connectable:o,isValidConnection:i})]};ni.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ni.inheritAttrs=!1,ni.compatConfig={MODE:3};const ey=ni,ty=["transform"],ny=["width","height","x","y","rx","ry"],oy=["y"],iy={name:"EdgeText",compatConfig:{MODE:3}},ly=n.defineComponent({...iy,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(l),n.watch([()=>e.x,()=>e.y,o,()=>e.label],l);function l(){if(!o.value)return;const a=o.value.getBBox();(a.width!==t.value.width||a.height!==t.value.height)&&(t.value=a)}return(a,r)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*a.labelBgPadding[0]}px`,height:`${t.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:n.normalizeStyle(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,ny)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(a.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:a.labelStyle}),[n.renderSlot(a.$slots,"default",{},()=>[typeof a.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(a.label),1)],64))])],16,oy)],8,ty))}}),ay=["id","d","marker-end","marker-start"],ry=["d","stroke-width"],sy={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},oi=n.defineComponent({...sy,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),l=n.ref(null),a=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:l}),(r,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(a),{id:r.id,ref_key:"pathEl",ref:o,d:r.path,class:"vue-flow__edge-path","marker-end":r.markerEnd,"marker-start":r.markerStart}),null,16,ay),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,ry)):n.createCommentVNode("",!0),r.label&&r.labelX&&r.labelY?(n.openBlock(),n.createBlock(ly,{key:1,ref_key:"labelEl",ref:l,x:r.labelX,y:r.labelY,label:r.label,"label-show-bg":r.labelShowBg,"label-bg-style":r.labelBgStyle,"label-bg-padding":r.labelBgPadding,"label-bg-border-radius":r.labelBgBorderRadius,"label-style":r.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):n.createCommentVNode("",!0)],64))}});function hc({sourceX:e,sourceY:t,targetX:o,targetY:i}){const l=Math.abs(o-e)/2,a=o<e?o+l:o-l,r=Math.abs(i-t)/2,s=i<t?i+r:i-r;return[a,s,l,r]}function gc({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:l,sourceControlY:a,targetControlX:r,targetControlY:s}){const c=e*.125+l*.375+r*.375+o*.125,d=t*.125+a*.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 yc({pos:e,x1:t,y1:o,x2:i,y2:l,c:a}){let r,s;switch(e){case ve.Left:r=t-ii(t-i,a),s=o;break;case ve.Right:r=t+ii(i-t,a),s=o;break;case ve.Top:r=t,s=o-ii(o-l,a);break;case ve.Bottom:r=t,s=o+ii(l-o,a);break}return[r,s]}function bc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top,curvature:s=.25}=e,[c,d]=yc({pos:i,x1:t,y1:o,x2:l,y2:a,c:s}),[u,f]=yc({pos:r,x1:l,y1:a,x2:t,y2:o,c:s}),[p,m,g,_]=gc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:f});return[`M${t},${o} C${c},${d} ${u},${f} ${l},${a}`,p,m,g,_]}function _c({pos:e,x1:t,y1:o,x2:i,y2:l}){let a,r;switch(e){case ve.Left:case ve.Right:a=.5*(t+i),r=o;break;case ve.Top:case ve.Bottom:a=t,r=.5*(o+l);break}return[a,r]}function vc(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top}=e,[s,c]=_c({pos:i,x1:t,y1:o,x2:l,y2:a}),[d,u]=_c({pos:r,x1:l,y1:a,x2:t,y2:o}),[f,p,m,g]=gc({sourceX:t,sourceY:o,targetX:l,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${l},${a}`,f,p,m,g]}const wc={[ve.Left]:{x:-1,y:0},[ve.Right]:{x:1,y:0},[ve.Top]:{x:0,y:-1},[ve.Bottom]:{x:0,y:1}};function cy({source:e,sourcePosition:t=ve.Bottom,target:o}){return t===ve.Left||t===ve.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 Ec(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function dy({source:e,sourcePosition:t=ve.Bottom,target:o,targetPosition:i=ve.Top,center:l,offset:a}){const r=wc[t],s=wc[i],c={x:e.x+r.x*a,y:e.y+r.y*a},d={x:o.x+s.x*a,y:o.y+s.y*a},u=cy({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",p=u[f];let m,g,_;const k={x:0,y:0},b={x:0,y:0},[$,h,S,X]=hc({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(r[f]*s[f]===-1){g=l.x??$,_=l.y??h;const J=[{x:g,y:c.y},{x:g,y:d.y}],T=[{x:c.x,y:_},{x:d.x,y:_}];r[f]===p?m=f==="x"?J:T:m=f==="x"?T:J}else{const J=[{x:c.x,y:d.y}],T=[{x:d.x,y:c.y}];if(f==="x"?m=r.x===p?T:J:m=r.y===p?J:T,t===i){const fe=Math.abs(e[f]-o[f]);if(fe<=a){const w=Math.min(a-1,a-fe);r[f]===p?k[f]=(c[f]>e[f]?-1:1)*w:b[f]=(d[f]>o[f]?-1:1)*w}}if(t!==i){const fe=f==="x"?"y":"x",w=r[f]===s[fe],R=c[fe]>d[fe],x=c[fe]<d[fe];(r[f]===1&&(!w&&R||w&&x)||r[f]!==1&&(!w&&x||w&&R))&&(m=f==="x"?J:T)}const ee={x:c.x+k.x,y:c.y+k.y},F={x:d.x+b.x,y:d.y+b.y},K=Math.max(Math.abs(ee.x-m[0].x),Math.abs(F.x-m[0].x)),O=Math.max(Math.abs(ee.y-m[0].y),Math.abs(F.y-m[0].y));K>=O?(g=(ee.x+F.x)/2,_=m[0].y):(g=m[0].x,_=(ee.y+F.y)/2)}return[[e,{x:c.x+k.x,y:c.y+k.y},...m,{x:d.x+b.x,y:d.y+b.y},o],g,_,S,X]}function uy(e,t,o,i){const l=Math.min(Ec(e,t)/2,Ec(t,o)/2,i),{x:a,y:r}=t;if(e.x===a&&a===o.x||e.y===r&&r===o.y)return`L${a} ${r}`;if(e.y===r){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${a+l*d},${r}Q ${a},${r} ${a},${r+l*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${a},${r+l*c}Q ${a},${r} ${a+l*s},${r}`}function Ul(e){const{sourceX:t,sourceY:o,sourcePosition:i=ve.Bottom,targetX:l,targetY:a,targetPosition:r=ve.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[f,p,m,g,_]=dy({source:{x:t,y:o},sourcePosition:i,target:{x:l,y:a},targetPosition:r,center:{x:c,y:d},offset:u});return[f.reduce((b,$,h)=>{let S;return h>0&&h<f.length-1?S=uy(f[h-1],$,f[h+1],s):S=`${h===0?"M":"L"}${$.x} ${$.y}`,b+=S,b},""),p,m,g,_]}function fy(e){const{sourceX:t,sourceY:o,targetX:i,targetY:l}=e,[a,r,s,c]=hc({sourceX:t,sourceY:o,targetX:i,targetY:l});return[`M ${t},${o}L ${i},${l}`,a,r,s,c]}const my=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=fy(e);return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),Nc=n.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=Ul({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),py=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(Nc,{...e,...t,borderRadius:0})}}),hy=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=bc({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),gy=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,l]=vc({...e,sourcePosition:e.sourcePosition??ve.Bottom,targetPosition:e.targetPosition??ve.Top});return n.h(oi,{path:o,labelX:i,labelY:l,...t,...e})}}}),yy={input:ey,default:Jg,output:Qg},by={default:hy,straight:my,step:py,smoothstep:Nc,simplebezier:gy};function _y(e,t,o){const i=n.computed(()=>_=>t.value.get(_)),l=n.computed(()=>_=>o.value.get(_)),a=n.computed(()=>{const _={...by,...e.edgeTypes},k=Object.keys(_);for(const b of e.edges)b.type&&!k.includes(b.type)&&(_[b.type]=b.type);return _}),r=n.computed(()=>{const _={...yy,...e.nodeTypes},k=Object.keys(_);for(const b of e.nodes)b.type&&!k.includes(b.type)&&(_[b.type]=b.type);return _}),s=n.computed(()=>e.onlyRenderVisibleElements?Ps(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const k of e.edges){const b=t.value.get(k.source),$=t.value.get(k.target);vg({sourcePos:b.computedPosition||{x:0,y:0},targetPos:$.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:$.dimensions.width,targetHeight:$.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(k)}return _}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const _=[];for(const k of e.nodes)k.selected&&_.push(k);return _}),f=n.computed(()=>{const _=[];for(const k of e.edges)k.selected&&_.push(k);return _}),p=n.computed(()=>[...u.value,...f.value]),m=n.computed(()=>{const _=[];for(const k of e.nodes)k.dimensions.width&&k.dimensions.height&&k.handleBounds!==void 0&&_.push(k);return _}),g=n.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:i,getEdge:l,getElements:d,getEdgeTypes:a,getNodeTypes:r,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:m,areNodesInitialized:g}}class Zt{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)??Zt.instance;return Zt.instance=i??new Zt,o&&(o.config.globalProperties.$vueFlowStorage=Zt.instance),Zt.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=pc(),l=n.reactive(i),a={};for(const[p,m]of Object.entries(l.hooks)){const g=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;a[g]=m.on}const r={};for(const[p,m]of Object.entries(l.hooks))r[p]=m.trigger;const s=n.computed(()=>{const p=new Map;for(const m of l.nodes)p.set(m.id,m);return p}),c=n.computed(()=>{const p=new Map;for(const m of l.edges)p.set(m.id,m);return p}),d=_y(l,s,c),u=qg(l,s,c);u.setState({...l,...o});const f={...a,...d,...u,...gf(l),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 Ce(e){const t=Zt.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",l=i?e:{id:e},a=l.id,r=a??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(rc,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=a??t.getId(),d=t.create(c,l);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(f,p,m)=>{const g=k=>{d.applyNodeChanges(k)},_=k=>{d.applyEdgeChanges(k)};f?(d.onNodesChange(g),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(g),d.hooks.value.edgesChange.off(_)),m(()=>{d.hooks.value.nodesChange.off(g),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),Rn(()=>{if(s){const f=t.get(s.id);f?f.$destroy():qn(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(l);if(o&&(n.provide(rc,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new Ue(Pe.USEVUEFLOW_OPTIONS))}return s}function vy(e){const{emits:t,dimensions:o}=Ce();let i;n.onMounted(()=>{const l=()=>{var a,r;if(!e.value||!(((r=(a=e.value).checkVisibility)==null?void 0:r.call(a))??!0))return;const s=Ko(e.value);(s.width===0||s.height===0)&&t.error(new Ue(Pe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};l(),window.addEventListener("resize",l),e.value&&(i=new ResizeObserver(()=>l()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",l),i&&e.value&&i.unobserve(e.value)})})}const wy={name:"UserSelection",compatConfig:{MODE:3}},Ey=n.defineComponent({...wy,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))}}),Ny=["tabIndex"],ky={name:"NodesSelection",compatConfig:{MODE:3}},xy=n.defineComponent({...ky,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:l,disableKeyboardA11y:a,userSelectionActive:r}=Ce(),s=mc(),c=n.ref(null),d=dc({el:c,onStart(g){t.selectionDragStart(g),t.nodeDragStart(g)},onDrag(g){t.selectionDrag(g),t.nodeDrag(g)},onStop(g){t.selectionDragStop(g),t.nodeDragStop(g)}});n.onMounted(()=>{var g;a.value||(g=c.value)==null||g.focus({preventScroll:!0})});const u=n.computed(()=>Cl(i.value)),f=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(g){t.selectionContextMenu({event:g,nodes:i.value})}function m(g){a.value||pn[g.key]&&(g.preventDefault(),s({x:pn[g.key].x,y:pn[g.key].y},g.shiftKey))}return(g,_)=>!n.unref(r)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(l)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(f.value),tabIndex:n.unref(a)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,Ny)],6)):n.createCommentVNode("",!0)}});function $y(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Iy={name:"Pane",compatConfig:{MODE:3}},Sy=n.defineComponent({...Iy,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:l,userSelectionActive:a,removeSelectedElements:r,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:f,removeNodes:p,removeEdges:m,selectionMode:g,deleteKeyCode:_,multiSelectionKeyCode:k,multiSelectionActive:b,edgeLookup:$,nodeLookup:h,connectionLookup:S,defaultEdgeOptions:X,connectionStartHandle:W,panOnDrag:J}=Ce(),T=n.shallowRef(null),ee=n.shallowRef(new Set),F=n.shallowRef(new Set),K=n.shallowRef(null),O=n.toRef(()=>c.value&&(e.isSelecting||a.value)),fe=n.toRef(()=>W.value!==null);let w=!1,R=!1;const x=Fn(_,{actInsideInputWithModifier:!1}),G=Fn(k);n.watch(x,de=>{de&&(p(f.value),m(u.value),d.value=!1)}),n.watch(G,de=>{b.value=de});function H(de,q){return ce=>{ce.target===q&&(de==null||de(ce))}}function Z(de){if(w||fe.value){w=!1;return}l.paneClick(de),r(),d.value=!1}function A(de){var q;if(Array.isArray(J.value)&&((q=J.value)!=null&&q.includes(2))){de.preventDefault();return}l.paneContextMenu(de)}function U(de){l.paneScroll(de)}function Q(de){var q,ce,Ee;if(K.value=((q=t.value)==null?void 0:q.getBoundingClientRect())??null,!c.value||!e.isSelecting||de.button!==0||de.target!==T.value||!K.value)return;(Ee=(ce=de.target)==null?void 0:ce.setPointerCapture)==null||Ee.call(ce,de.pointerId);const{x:$e,y:ke}=$y(de,K.value);R=!0,w=!1,r(),s.value={width:0,height:0,startX:$e,startY:ke,x:$e,y:ke},l.selectionStart(de)}function me(de){var q;if(!K.value||!s.value)return;w=!0;const{x:ce,y:Ee}=mt(de,K.value),{startX:$e=0,startY:ke=0}=s.value,he={startX:$e,startY:ke,x:ce<$e?ce:$e,y:Ee<ke?Ee:ke,width:Math.abs(ce-$e),height:Math.abs(Ee-ke)},N=ee.value,I=F.value;ee.value=new Set(Ps(o.value,he,i.value,g.value===$l.Partial,!0).map(E=>E.id)),F.value=new Set;const v=((q=X.value)==null?void 0:q.selectable)??!0;for(const E of ee.value){const C=S.value.get(E);if(C)for(const{edgeId:D}of C.values()){const B=$.value.get(D);B&&(B.selectable??v)&&F.value.add(D)}}if(!ac(N,ee.value)){const E=At(h.value,ee.value,!0);l.nodesChange(E)}if(!ac(I,F.value)){const E=At($.value,F.value);l.edgesChange(E)}s.value=he,a.value=!0,d.value=!1}function pe(de){var q;de.button!==0||!R||((q=de.target)==null||q.releasePointerCapture(de.pointerId),!a.value&&s.value&&de.target===T.value&&Z(de),a.value=!1,s.value=null,d.value=ee.value.size>0,l.selectionEnd(de),e.selectionKeyPressed&&(w=!1),R=!1)}return(de,q)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:T,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:de.isSelecting}]),onClick:q[0]||(q[0]=ce=>O.value?void 0:H(Z,T.value)(ce)),onContextmenu:q[1]||(q[1]=ce=>H(A,T.value)(ce)),onWheelPassive:q[2]||(q[2]=ce=>H(U,T.value)(ce)),onPointerenter:q[3]||(q[3]=ce=>O.value?void 0:n.unref(l).paneMouseEnter(ce)),onPointerdown:q[4]||(q[4]=ce=>O.value?Q(ce):n.unref(l).paneMouseMove(ce)),onPointermove:q[5]||(q[5]=ce=>O.value?me(ce):n.unref(l).paneMouseMove(ce)),onPointerup:q[6]||(q[6]=ce=>O.value?pe(ce):void 0),onPointerleave:q[7]||(q[7]=ce=>n.unref(l).paneMouseLeave(ce))},[n.renderSlot(de.$slots,"default"),n.unref(a)&&n.unref(s)?(n.openBlock(),n.createBlock(Ey,{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(xy,{key:1})):n.createCommentVNode("",!0)],34))}}),Cy={name:"Transform",compatConfig:{MODE:3}},Ry=n.defineComponent({...Cy,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=Ce(),l=n.computed(()=>o.value?!i.value:!1),a=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(r,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:a.value,opacity:l.value?0:void 0})},[n.renderSlot(r.$slots,"default")],4))}}),Vy={name:"Viewport",compatConfig:{MODE:3}},Ay=n.defineComponent({...Vy,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:l,zoomActivationKeyCode:a,selectionKeyCode:r,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:g,preventScrolling:_,noWheelClassName:k,noPanClassName:b,emits:$,connectionStartHandle:h,userSelectionActive:S,paneDragging:X,d3Zoom:W,d3Selection:J,d3ZoomHandler:T,viewport:ee,viewportRef:F,paneClickDistance:K}=Ce();vy(F);const O=n.shallowRef(!1),fe=n.shallowRef(!1);let w=null,R=!1,x=0,G={x:0,y:0,zoom:0};const H=Fn(s),Z=Fn(r),A=Fn(a),U=n.toRef(()=>(!Z.value||Z.value&&r.value===!0)&&(H.value||f.value)),Q=n.toRef(()=>H.value||c.value),me=n.toRef(()=>r.value===!0&&U.value!==!0),pe=n.toRef(()=>Z.value&&r.value!==!0||S.value||me.value),de=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!F.value){qn("Viewport element is missing");return}const ke=F.value,he=ke.getBoundingClientRect(),N=eg().clickDistance(K.value).scaleExtent([t.value,o.value]).translateExtent(l.value),I=Je(ke).call(N),v=I.on("wheel.zoom"),E=mn.translate(i.value.x??0,i.value.y??0).scale(Wt(i.value.zoom??1,t.value,o.value)),C=[[0,0],[he.width,he.height]],D=N.constrain()(E,C,l.value);N.transform(I,D),N.wheelDelta(Rl),W.value=N,J.value=I,T.value=v,ee.value={x:D.x,y:D.y,zoom:D.k},N.on("start",B=>{var oe;if(!B.sourceEvent)return null;x=B.sourceEvent.button,O.value=!0;const ie=Ee(B.transform);((oe=B.sourceEvent)==null?void 0:oe.type)==="mousedown"&&(X.value=!0),G=ie,$.viewportChangeStart(ie),$.moveStart({event:B,flowTransform:ie})}),N.on("end",B=>{if(!B.sourceEvent)return null;if(O.value=!1,X.value=!1,q(U.value,x??0)&&!R&&$.paneContextMenu(B.sourceEvent),R=!1,ce(G,B.transform)){const oe=Ee(B.transform);G=oe,$.viewportChangeEnd(oe),$.moveEnd({event:B,flowTransform:oe})}}),N.filter(B=>{var oe;const ie=A.value||g.value,le=m.value&&B.ctrlKey,V=B.button,M=B.type==="wheel";if(V===1&&B.type==="mousedown"&&($e(B,"vue-flow__node")||$e(B,"vue-flow__edge")))return!0;if(!U.value&&!ie&&!Q.value&&!p.value&&!m.value||S.value||de.value&&!M||!p.value&&B.type==="dblclick"||$e(B,k.value)&&M||$e(B,b.value)&&(!M||Q.value&&M&&!A.value)||!m.value&&B.ctrlKey&&M||!ie&&!Q.value&&!le&&M)return!1;if(!m&&B.type==="touchstart"&&((oe=B.touches)==null?void 0:oe.length)>1)return B.preventDefault(),!1;if(!U.value&&(B.type==="mousedown"||B.type==="touchstart")||me.value&&Array.isArray(f.value)&&f.value.includes(0)&&V===0||Array.isArray(f.value)&&!f.value.includes(V)&&(B.type==="mousedown"||B.type==="touchstart"))return!1;const y=Array.isArray(f.value)&&f.value.includes(V)||r.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!V||V<=1;return(!B.ctrlKey||H.value||M)&&y}),n.watch([S,U],()=>{S.value&&!O.value?N.on("zoom",null):S.value||N.on("zoom",B=>{ee.value={x:B.transform.x,y:B.transform.y,zoom:B.transform.k};const oe=Ee(B.transform);R=q(U.value,x??0),$.viewportChange(oe),$.move({event:B,flowTransform:oe})})},{immediate:!0}),n.watch([S,Q,d,A,m,_,k],()=>{Q.value&&!A.value&&!S.value?I.on("wheel.zoom",B=>{if($e(B,k.value))return!1;const oe=A.value||g.value,ie=m.value&&B.ctrlKey;if(!(!_.value||Q.value||oe||ie))return!1;B.preventDefault(),B.stopImmediatePropagation();const V=I.property("__zoom").k||1,M=Xn();if(!H.value&&B.ctrlKey&&m.value&&M){const ge=ct(B),P=Rl(B),Y=V*2**P;N.scaleTo(I,Y,ge,B);return}const y=B.deltaMode===1?20:1;let L=d.value===Hn.Vertical?0:B.deltaX*y,ae=d.value===Hn.Horizontal?0:B.deltaY*y;!M&&B.shiftKey&&d.value!==Hn.Vertical&&!L&&ae&&(L=ae,ae=0),N.translateBy(I,-(L/V)*u.value,-(ae/V)*u.value);const ue=Ee(I.property("__zoom"));w&&clearTimeout(w),fe.value?($.move({event:B,flowTransform:ue}),$.viewportChange(ue),w=setTimeout(()=>{$.moveEnd({event:B,flowTransform:ue}),$.viewportChangeEnd(ue),fe.value=!1},150)):(fe.value=!0,$.moveStart({event:B,flowTransform:ue}),$.viewportChangeStart(ue))},{passive:!1}):typeof v<"u"&&I.on("wheel.zoom",function(B,oe){const ie=!_.value&&B.type==="wheel"&&!B.ctrlKey,le=A.value||g.value,V=m.value&&B.ctrlKey;if(!le&&!c.value&&!V&&B.type==="wheel"||ie||$e(B,k.value))return null;B.preventDefault(),v.call(this,B,oe)},{passive:!1})},{immediate:!0})});function q(ke,he){return he===2&&Array.isArray(ke)&&ke.includes(2)}function ce(ke,he){return ke.x!==he.x&&!Number.isNaN(he.x)||ke.y!==he.y&&!Number.isNaN(he.y)||ke.zoom!==he.k&&!Number.isNaN(he.k)}function Ee(ke){return{x:ke.x,y:ke.y,zoom:ke.k}}function $e(ke,he){return ke.target.closest(`.${he}`)}return(ke,he)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:F,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(Sy,{"is-selecting":pe.value,"selection-key-pressed":n.unref(Z),class:n.normalizeClass({connecting:de.value,dragging:n.unref(X),draggable:n.unref(f)===!0||Array.isArray(n.unref(f))&&n.unref(f).includes(0)})},{default:n.withCtx(()=>[n.createVNode(Ry,null,{default:n.withCtx(()=>[n.renderSlot(ke.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Ty=["id"],My=["id"],By=["id"],Dy={name:"A11yDescriptions",compatConfig:{MODE:3}},Oy=n.defineComponent({...Dy,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=Ce();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Cs)}-${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,Ty),n.createElementVNode("div",{id:`${n.unref(Rs)}-${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,My),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(ag)}-${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,By))],64))}});function Ly(){const e=Ce();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Py(e,t,o){return o===ve.Left?e-t:o===ve.Right?e+t:e}function zy(e,t,o){return o===ve.Top?e-t:o===ve.Bottom?e+t:e}const Hl=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=ve.Top,type:l}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${l}`,cx:Py(t,e,i),cy:zy(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Hl.props=["radius","centerX","centerY","position","type"],Hl.compatConfig={MODE:3};const kc=Hl,Uy=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:l,emits:a,nodesSelectionActive:r,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:f,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:g,elementsSelectable:_,edgesUpdatable:k,edgesFocusable:b,hooks:$}=Ce(),h=n.computed(()=>u(e.id)),{emit:S,on:X}=Dg(h.value,a),W=n.inject(jo),J=n.getCurrentInstance(),T=n.ref(!1),ee=n.ref(!1),F=n.ref(""),K=n.ref(null),O=n.ref("source"),fe=n.ref(null),w=n.toRef(()=>typeof h.value.selectable>"u"?_.value:h.value.selectable),R=n.toRef(()=>typeof h.value.updatable>"u"?k.value:h.value.updatable),x=n.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);n.provide(Tg,e.id),n.provide(Mg,fe);const G=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),H=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),Z=n.computed(()=>{const E=h.value.type||"default",C=W==null?void 0:W[`edge-${E}`];if(C)return C;let D=h.value.template??c.value[E];if(typeof D=="string"&&J){const B=Object.keys(J.appContext.components);B&&B.includes(E)&&(D=n.resolveComponent(E,!1))}return D&&typeof D!="string"?D:(a.error(new Ue(Pe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:A}=uc({nodeId:F,handleId:K,type:O,isValidConnection:p,edgeUpdaterType:O,onEdgeUpdate:me,onEdgeUpdateEnd:pe});return()=>{const E=f(h.value.source),C=f(h.value.target),D="pathOptions"in h.value?h.value.pathOptions:{};if(!E&&!C)return a.error(new Ue(Pe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!E)return a.error(new Ue(Pe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!C)return a.error(new Ue(Pe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||E.hidden||C.hidden)return null;let B;i.value===Et.Strict?B=E.handleBounds.source:B=[...E.handleBounds.source||[],...E.handleBounds.target||[]];const oe=js(B,h.value.sourceHandle);let ie;i.value===Et.Strict?ie=C.handleBounds.target:ie=[...C.handleBounds.target||[],...C.handleBounds.source||[]];const le=js(ie,h.value.targetHandle),V=(oe==null?void 0:oe.position)||ve.Bottom,M=(le==null?void 0:le.position)||ve.Top,{x:y,y:L}=gn(E,oe,V),{x:ae,y:ue}=gn(C,le,M);return h.value.sourceX=y,h.value.sourceY=L,h.value.targetX=ae,h.value.targetY=ue,n.h("g",{ref:fe,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${Z.value===!1?"default":h.value.type||"default"}`,s.value,G.value,{updating:T.value,selected:h.value.selected,animated:h.value.animated,inactive:!w.value&&!$.value.edgeClick.hasListeners()}],tabIndex:x.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":x.value?`${Rs}-${t}`:void 0,"aria-roledescription":"edge",role:x.value?"group":"img",...h.value.domAttributes,onClick:q,onContextmenu:ce,onDblclick:Ee,onMouseenter:$e,onMousemove:ke,onMouseleave:he,onKeyDown:x.value?v:void 0},[ee.value?null:n.h(Z.value===!1?c.value.default:Z.value,{id:e.id,sourceNode:E,targetNode:C,source:h.value.source,target:h.value.target,type:h.value.type,updatable:R.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...X},style:H.value,markerStart:`url('#${Kn(h.value.markerStart,t)}')`,markerEnd:`url('#${Kn(h.value.markerEnd,t)}')`,sourcePosition:V,targetPosition:M,sourceX:y,sourceY:L,targetX:ae,targetY:ue,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...D}),[R.value==="source"||R.value===!0?[n.h("g",{onMousedown:N,onMouseenter:U,onMouseout:Q},n.h(kc,{position:V,centerX:y,centerY:L,radius:l.value,type:"source","data-type":"source"}))]:null,R.value==="target"||R.value===!0?[n.h("g",{onMousedown:I,onMouseenter:U,onMouseout:Q},n.h(kc,{position:M,centerX:ae,centerY:ue,radius:l.value,type:"target","data-type":"target"}))]:null]])};function U(){T.value=!0}function Q(){T.value=!1}function me(E,C){S.update({event:E,edge:h.value,connection:C})}function pe(E){S.updateEnd({event:E,edge:h.value}),ee.value=!1}function de(E,C){E.button===0&&(ee.value=!0,F.value=C?h.value.target:h.value.source,K.value=(C?h.value.targetHandle:h.value.sourceHandle)??null,O.value=C?"target":"source",S.updateStart({event:E,edge:h.value}),A(E))}function q(E){var C;const D={event:E,edge:h.value};w.value&&(r.value=!1,h.value.selected&&m.value?(d([h.value]),(C=fe.value)==null||C.blur()):o([h.value])),S.click(D)}function ce(E){S.contextMenu({event:E,edge:h.value})}function Ee(E){S.doubleClick({event:E,edge:h.value})}function $e(E){S.mouseEnter({event:E,edge:h.value})}function ke(E){S.mouseMove({event:E,edge:h.value})}function he(E){S.mouseLeave({event:E,edge:h.value})}function N(E){de(E,!0)}function I(E){de(E,!1)}function v(E){var C;!g.value&&Vs.includes(E.key)&&w.value&&(E.key==="Escape"?((C=fe.value)==null||C.blur(),d([u(e.id)])):o([u(e.id)]))}}}),Hy=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:l,connectionPosition:a,connectionLineType:r,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:f}=Ce(),p=(e=n.inject(jo))==null?void 0:e["connection-line"],m=n.computed(()=>{var $;return f(($=i.value)==null?void 0:$.nodeId)}),g=n.computed(()=>{var $;return f(($=l.value)==null?void 0:$.nodeId)??null}),_=n.computed(()=>({x:(a.value.x-u.value.x)/u.value.zoom,y:(a.value.y-u.value.y)/u.value.zoom})),k=n.computed(()=>c.value.markerStart?`url(#${Kn(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${Kn(c.value.markerEnd,t)})`:"");return()=>{var $,h,S;if(!m.value||!i.value)return null;const X=i.value.id,W=i.value.type,J=m.value.handleBounds;let T=(J==null?void 0:J[W])??[];if(o.value===Et.Loose){const H=(J==null?void 0:J[W==="source"?"target":"source"])??[];T=[...T,...H]}if(!T)return null;const ee=(X?T.find(H=>H.id===X):T[0])??null,F=(ee==null?void 0:ee.position)??ve.Top,{x:K,y:O}=gn(m.value,ee,F);let fe=null;g.value&&(o.value===Et.Strict?fe=(($=g.value.handleBounds[W==="source"?"target":"source"])==null?void 0:$.find(H=>{var Z;return H.id===((Z=l.value)==null?void 0:Z.id)}))||null:fe=((h=[...g.value.handleBounds.source??[],...g.value.handleBounds.target??[]])==null?void 0:h.find(H=>{var Z;return H.id===((Z=l.value)==null?void 0:Z.id)}))||null);const w=((S=l.value)==null?void 0:S.position)??(F?Dl[F]:null);if(!F||!w)return null;const R=r.value??c.value.type??Yt.Bezier;let x="";const G={sourceX:K,sourceY:O,sourcePosition:F,targetX:_.value.x,targetY:_.value.y,targetPosition:w};return R===Yt.Bezier?[x]=bc(G):R===Yt.Step?[x]=Ul({...G,borderRadius:0}):R===Yt.SmoothStep?[x]=Ul(G):R===Yt.SimpleBezier?[x]=vc(G):x=`M${K},${O} ${_.value.x},${_.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},p?n.h(p,{sourceX:K,sourceY:O,sourcePosition:F,targetX:_.value.x,targetY:_.value.y,targetPosition:w,sourceNode:m.value,sourceHandle:ee,targetNode:g.value,targetHandle:fe,markerEnd:b.value,markerStart:k.value,connectionStatus:d.value}):n.h("path",{d:x,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":k.value})))}}}),Fy=["id","markerWidth","markerHeight","markerUnits","orient"],Gy={name:"MarkerType",compatConfig:{MODE:3}},Yy=n.defineComponent({...Gy,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(Il).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(Il).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,Fy))}}),Wy={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ky={name:"MarkerDefinitions",compatConfig:{MODE:3}},Xy=n.defineComponent({...Ky,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:l}=Ce(),a=n.computed(()=>{const r=new Set,s=[],c=d=>{if(d){const u=Kn(d,t);r.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||l.value}):s.push({id:u,color:l.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",Wy,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,c=>(n.openBlock(),n.createBlock(Yy,{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))])]))}}),qy={name:"Edges",compatConfig:{MODE:3}},Zy=n.defineComponent({...qy,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=Ce();return(l,a)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Xy),(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(wg)(r,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(Uy),{id:r.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(Hy))],64))}}),jy=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:l,multiSelectionActive:a,emits:r,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:g,ariaLiveMessage:_,snapToGrid:k,snapGrid:b,nodeDragThreshold:$,nodesDraggable:h,elementsSelectable:S,nodesConnectable:X,nodesFocusable:W,hooks:J}=Ce(),T=n.ref(null);n.provide(cc,T),n.provide(sc,e.id);const ee=n.inject(jo),F=n.getCurrentInstance(),K=mc(),{node:O,parentNode:fe}=fc(e.id),{emit:w,on:R}=zg(O,r),x=n.toRef(()=>typeof O.draggable>"u"?h.value:O.draggable),G=n.toRef(()=>typeof O.selectable>"u"?S.value:O.selectable),H=n.toRef(()=>typeof O.connectable>"u"?X.value:O.connectable),Z=n.toRef(()=>typeof O.focusable>"u"?W.value:O.focusable),A=n.computed(()=>G.value||x.value||J.value.nodeClick.hasListeners()||J.value.nodeDoubleClick.hasListeners()||J.value.nodeMouseEnter.hasListeners()||J.value.nodeMouseMove.hasListeners()||J.value.nodeMouseLeave.hasListeners()),U=n.toRef(()=>!!O.dimensions.width&&!!O.dimensions.height),Q=n.computed(()=>{const C=O.type||"default",D=ee==null?void 0:ee[`node-${C}`];if(D)return D;let B=O.template||f.value[C];if(typeof B=="string"&&F){const oe=Object.keys(F.appContext.components);oe&&oe.includes(C)&&(B=n.resolveComponent(C,!1))}return B&&typeof B!="string"?B:(r.error(new Ue(Pe.NODE_TYPE_MISSING,B)),!1)}),me=dc({id:e.id,el:T,disabled:()=>!x.value,selectable:G,dragHandle:()=>O.dragHandle,onStart(C){w.dragStart(C)},onDrag(C){w.drag(C)},onStop(C){w.dragStop(C)},onClick(C){v(C)}}),pe=n.computed(()=>O.class instanceof Function?O.class(O):O.class),de=n.computed(()=>{const C=(O.style instanceof Function?O.style(O):O.style)||{},D=O.width instanceof Function?O.width(O):O.width,B=O.height instanceof Function?O.height(O):O.height;return!C.width&&D&&(C.width=typeof D=="string"?D:`${D}px`),!C.height&&B&&(C.height=typeof B=="string"?B:`${B}px`),C}),q=n.toRef(()=>Number(O.zIndex??de.value.zIndex??0));return u(C=>{(C.includes(e.id)||!C.length)&&Ee()}),n.onMounted(()=>{n.watch(()=>O.hidden,(C=!1,D,B)=>{!C&&T.value&&(e.resizeObserver.observe(T.value),B(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>O.type,()=>O.sourcePosition,()=>O.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),n.watch([()=>O.position.x,()=>O.position.y,()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.x},()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.y},()=>{var C;return(C=fe.value)==null?void 0:C.computedPosition.z},q,()=>O.selected,()=>O.dimensions.height,()=>O.dimensions.width,()=>{var C;return(C=fe.value)==null?void 0:C.dimensions.height},()=>{var C;return(C=fe.value)==null?void 0:C.dimensions.width}],([C,D,B,oe,ie,le])=>{const V={x:C,y:D,z:le+(m.value&&O.selected?1e3:0)};typeof B<"u"&&typeof oe<"u"?O.computedPosition=hg({x:B,y:oe,z:ie},V):O.computedPosition=V},{flush:"post",immediate:!0}),n.watch([()=>O.extent,p],([C,D],[B,oe])=>{(C!==B||D!==oe)&&ce()}),O.extent==="parent"||typeof O.extent=="object"&&"range"in O.extent&&O.extent.range==="parent"?ll(()=>U).toBe(!0).then(ce):ce(),()=>O.hidden?null:n.h("div",{ref:T,"data-id":O.id,class:["vue-flow__node",`vue-flow__node-${Q.value===!1?"default":O.type||"default"}`,{[o.value]:x.value,dragging:me==null?void 0:me.value,draggable:x.value,selected:O.selected,selectable:G.value,parent:O.isParent},pe.value],style:{visibility:U.value?"visible":"hidden",zIndex:O.computedPosition.z??q.value,transform:`translate(${O.computedPosition.x}px,${O.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...de.value},tabIndex:Z.value?0:void 0,role:Z.value?"group":void 0,"aria-describedby":g.value?void 0:`${Cs}-${t}`,"aria-label":O.ariaLabel,"aria-roledescription":"node",...O.domAttributes,onMouseenter:$e,onMousemove:ke,onMouseleave:he,onContextmenu:N,onClick:v,onDblclick:I,onKeydown:E},[n.h(Q.value===!1?f.value.default:Q.value,{id:O.id,type:O.type,data:O.data,events:{...O.events,...R},selected:O.selected,resizing:O.resizing,dragging:me.value,connectable:H.value,position:O.computedPosition,dimensions:O.dimensions,isValidTargetPos:O.isValidTargetPos,isValidSourcePos:O.isValidSourcePos,parent:O.parentNode,parentNodeId:O.parentNode,zIndex:O.computedPosition.z??q.value,targetPosition:O.targetPosition,sourcePosition:O.sourcePosition,label:O.label,dragHandle:O.dragHandle,onUpdateNodeInternals:Ee})]);function ce(){const C=O.computedPosition,{computedPosition:D,position:B}=Tl(O,k.value?Zo(C,b.value):C,r.error,p.value,fe.value);(O.computedPosition.x!==D.x||O.computedPosition.y!==D.y)&&(O.computedPosition={...O.computedPosition,...D}),(O.position.x!==B.x||O.position.y!==B.y)&&(O.position=B)}function Ee(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function $e(C){me!=null&&me.value||w.mouseEnter({event:C,node:O})}function ke(C){me!=null&&me.value||w.mouseMove({event:C,node:O})}function he(C){me!=null&&me.value||w.mouseLeave({event:C,node:O})}function N(C){return w.contextMenu({event:C,node:O})}function I(C){return w.doubleClick({event:C,node:O})}function v(C){G.value&&(!i.value||!x.value||$.value>0)&&Ol(O,a.value,c,s,l,!1,T.value),w.click({event:C,node:O})}function E(C){if(!(Sl(C)||g.value))if(Vs.includes(C.key)&&G.value){const D=C.key==="Escape";Ol(O,a.value,c,s,l,D,T.value)}else x.value&&O.selected&&pn[C.key]&&(C.preventDefault(),_.value=`Moved selected node ${C.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~O.position.x}, y: ${~~O.position.y}`,K({x:pn[C.key].x,y:pn[C.key].y},C.shiftKey))}}});function Jy(e={includeHiddenNodes:!1}){const{nodes:t}=Ce();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 Qy={class:"vue-flow__nodes vue-flow__container"},e0={name:"Nodes",compatConfig:{MODE:3}},t0=n.defineComponent({...e0,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Ce(),l=Jy(),a=n.ref();return n.watch(l,r=>{r&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{a.value=new ResizeObserver(r=>{const s=r.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var r;return(r=a.value)==null?void 0:r.disconnect()}),(r,s)=>(n.openBlock(),n.createElementBlock("div",Qy,[a.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,f)=>{const p=[c.id];if(f&&f.key===c.id&&n.isMemoSame(f,p))return f;const m=(n.openBlock(),n.createBlock(n.unref(jy),{id:c.id,key:c.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):n.createCommentVNode("",!0)]))}});function n0(){const{emits:e}=Ce();n.onMounted(()=>{if(nc()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ue(Pe.MISSING_STYLES))}})}const o0=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),i0={name:"VueFlow",compatConfig:{MODE:3}},l0=n.defineComponent({...i0,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const i=e,l=n.useSlots(),a=al(i,"modelValue",o),r=al(i,"nodes",o),s=al(i,"edges",o),c=Ce(i),d=Gg({modelValue:a,nodes:r,edges:s},i,c);return Wg(o,c.hooks),Ly(),n0(),n.provide(jo,l),n.onUnmounted(d),t(c),(u,f)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(Ay,null,{default:n.withCtx(()=>[n.createVNode(Zy),o0,n.createVNode(t0),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(Oy)],512))}}),a0={name:"Panel",compatConfig:{MODE:3}},xc=n.defineComponent({...a0,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=Ce(),i=n.computed(()=>`${t.position}`.split("-"));return(l,a)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(l.$slots,"default")],6))}}),Zn=["red","amber","green","teal","blue","indigo","violet","pink"],$c={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function r0(e){return typeof e=="string"&&e in $c}const s0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},c0=.15;function d0(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,l=parseInt(o.slice(2,4),16)/255,a=parseInt(o.slice(4,6),16)/255,r=Math.max(i,l,a),s=Math.min(i,l,a),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=(l-a)/c%6:r===l?f=(a-i)/c+2:f=(i-l)/c+4,f*=60,f<0&&(f+=360)),{h:f,s:u,l:d}}function u0(e){if(typeof e!="string")return null;const t=d0(e);if(!t||t.s<c0)return null;let o=null,i=1/0;for(const l of Zn){const a=Math.abs(t.h-s0[l]),r=Math.min(a,360-a);r<i&&(i=r,o=l)}return o}function tt(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(r0(t))return t;const o=e==null?void 0:e.properties;return u0((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Fl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const f0={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)"},m0={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 Ic(e,t=!1){return e?t?m0[e]:f0[e]:null}function li(e){return $c[e]}function ai(e){return`var(--em-swatch-${e}-bar)`}const p0=["width","height","innerHTML"],h0=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"/>',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"/>',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,p0))}}),Ae=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},Ve=Ae(h0,[["__scopeId","data-v-b5f4c4ba"]]),g0={class:"em-inline-issue__msgs"},jt=Ae(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},i=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),l=n.computed(()=>{let a=null;for(const r of i.value)(a===null||o[r.severity].order<o[a].order)&&(a=r.severity);return a});return(a,r)=>l.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${l.value}`])},[n.createVNode(Ve,{name:o[l.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",g0,[(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"]]),y0={class:"em-mlang"},b0={class:"em-mlang__tabs",role:"tablist"},_0=["aria-selected","onClick"],v0={key:0,class:"em-mlang__dot"},Gl=Ae(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function l(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const a=n.ref(l());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(a.value)||(a.value=l())});function r(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[a.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[a.value]:u[a.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",y0,[n.createElementVNode("div",b0,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,f=>(n.openBlock(),n.createElementBlock("button",{key:f,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":a.value===f}]),role:"tab","aria-selected":a.value===f,onClick:p=>a.value=f},[n.createTextVNode(n.toDisplayString(f),1),r(f)?(n.openBlock(),n.createElementBlock("span",v0,"•")):n.createCommentVNode("",!0)],10,_0))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(te.BSTextArea),{key:0,name:`${e.name}-${a.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(te.BSTextInput),{key:1,name:`${e.name}-${a.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),w0=["disabled"],E0={class:"em-field"},N0={class:"em-field"},k0={class:"em-field"},x0={class:"em-class"},$0={class:"em-field"},I0={class:"em-field"},S0={class:"em-field"},C0={class:"em-field"},R0={class:"em-multilang"},V0={class:"em-multilang"},A0={class:"em-jpa"},T0={class:"em-field"},M0={class:"em-field"},B0={class:"em-field"},D0={class:"em-swatch"},O0={class:"em-swatch__row"},L0=["title","onClick"],Sc=Ae(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(F=>F.modelId===t.entityId)??null),l=n.computed(()=>i.value?o.state.layout.entityLayouts.find(F=>F.entityRef===i.value.modelId)??null:null),a=n.computed(()=>{var F;return tt(((F=l.value)==null?void 0:F.style)??void 0)}),r=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],s=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],c=["inherit","STRING","CHAR","INTEGER"],d=F=>F;function u(F){return F==="inherit"?"기본(따름)":F}function f(F){i.value&&o.updateEntity(i.value.modelId,F)}function p(F,K,O){var w;const fe=((w=i.value)==null?void 0:w.table)??{physicalName:""};f(F==="physicalName"?{table:{...fe,physicalName:O}}:{table:{...fe,logicalName:{...fe.logicalName,[K]:O}}})}function m(F){f({description:Object.keys(F).length?F:void 0})}function g(F,K){var O;f({jpaAttrs:{...(O=i.value)==null?void 0:O.jpaAttrs,[F]:K}})}function _(F,K){g(F,K)}const k=n.computed(()=>{var F,K;return((K=(F=i.value)==null?void 0:F.jpaAttrs)==null?void 0:K.discriminatorType)??"inherit"}),b=n.computed(()=>{var F,K;return!((K=(F=i.value)==null?void 0:F.jpaAttrs)!=null&&K.useDiscriminator)});function $(F){g("discriminatorType",F==="inherit"?void 0:F)}function h(F){f({hasPersonalInfo:F})}function S(F){f({superClass:F.trim()||void 0})}function X(F){f({schema:F.trim()||void 0})}function W(F){f({abstractClass:F})}const J=n.computed(()=>{var F,K;return((K=(F=i.value)==null?void 0:F.declarationOfInterfaces)==null?void 0:K.join(", "))??""});function T(F){const K=F.split(",").map(O=>O.trim()).filter(Boolean);f({declarationOfInterfaces:K.length?K:void 0})}function ee(F){i.value&&o.setEntitySwatch(i.value.modelId,F)}return(F,K)=>{var O,fe,w;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createVNode(jt,{controller:n.unref(o),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",E0,[K[12]||(K[12]=n.createElementVNode("span",null,"이름",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":i.value.name,"onUpdate:modelValue":K[0]||(K[0]=R=>f({name:R}))},null,8,["model-value"])]),n.createElementVNode("label",N0,[K[13]||(K[13]=n.createElementVNode("span",null,"스테레오타입",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":i.value.stereotype,items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":K[1]||(K[1]=R=>f({stereotype:R}))},null,8,["model-value"])]),n.createElementVNode("label",k0,[K[14]||(K[14]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":i.value.packageName??"","onUpdate:modelValue":K[2]||(K[2]=R=>f({packageName:R}))},null,8,["model-value"])]),n.createElementVNode("fieldset",x0,[K[17]||(K[17]=n.createElementVNode("legend",null,"클래스",-1)),n.createElementVNode("label",$0,[K[15]||(K[15]=n.createElementVNode("span",null,"부모 클래스",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:"예: BaseEntity","model-value":i.value.superClass??"","onUpdate:modelValue":K[3]||(K[3]=R=>S(R))},null,8,["model-value"])]),n.createElementVNode("label",I0,[K[16]||(K[16]=n.createElementVNode("span",null,"구현 인터페이스",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:"콤마로 구분 (예: Serializable, Cloneable)","model-value":J.value,"onUpdate:modelValue":K[4]||(K[4]=R=>T(R))},null,8,["model-value"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:"추상 클래스","model-value":!!i.value.abstractClass,"onUpdate:modelValue":K[5]||(K[5]=R=>W(R))},null,8,["model-value"])]),n.createElementVNode("label",S0,[K[18]||(K[18]=n.createElementVNode("span",null,"테이블(물리)",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((O=i.value.table)==null?void 0:O.physicalName)??"","onUpdate:modelValue":K[6]||(K[6]=R=>p("physicalName",null,R))},null,8,["model-value"])]),n.createElementVNode("label",C0,[K[19]||(K[19]=n.createElementVNode("span",null,"스키마",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:"예: sales, master","model-value":i.value.schema??"","onUpdate:modelValue":K[7]||(K[7]=R=>X(R))},null,8,["model-value"])]),n.createElementVNode("fieldset",R0,[K[20]||(K[20]=n.createElementVNode("legend",null,"테이블 논리명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).languages.value,R=>{var x,G;return n.openBlock(),n.createElementBlock("label",{key:R,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(R),1),n.createVNode(n.unref(te.BSTextInput),{name:`ent-logical-${R}`,width:"100%","model-value":((G=(x=i.value.table)==null?void 0:x.logicalName)==null?void 0:G[R])??"","onUpdate:modelValue":H=>p("logicalName",R,H)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",V0,[K[21]||(K[21]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:"ent-desc",languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":i.value.description,"onUpdate:modelValue":m},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",A0,[K[25]||(K[25]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(s,R=>{var x;return n.createVNode(n.unref(te.BSCheckbox),{key:R.key,name:`jpa-${R.key}`,class:"em-check",label:R.label,"model-value":!!((x=i.value.jpaAttrs)!=null&&x[R.key]),"onUpdate:modelValue":G=>_(R.key,G)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",T0,[K[22]||(K[22]=n.createElementVNode("span",null,"Discriminator 컬럼명",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:"예: DTYPE",disabled:b.value,"model-value":((fe=i.value.jpaAttrs)==null?void 0:fe.discriminatorColumnName)??"","onUpdate:modelValue":K[8]||(K[8]=R=>g("discriminatorColumnName",R.trim()||void 0))},null,8,["disabled","model-value"])]),n.createElementVNode("label",M0,[K[23]||(K[23]=n.createElementVNode("span",null,"Discriminator 타입",-1)),n.createVNode(n.unref(te.BSSelect),{disabled:b.value,"model-value":k.value,items:c,"value-provider":d,"label-provider":u,"onUpdate:modelValue":K[9]||(K[9]=R=>R&&$(R))},null,8,["disabled","model-value"])]),n.createElementVNode("label",B0,[K[24]||(K[24]=n.createElementVNode("span",null,"Discriminator 길이",-1)),n.createVNode(n.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:b.value,"model-value":(w=i.value.jpaAttrs)==null?void 0:w.discriminatorLength,"onUpdate:modelValue":K[10]||(K[10]=R=>g("discriminatorLength",R||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:"개인정보 포함 (hasPersonalInfo)","model-value":!!i.value.hasPersonalInfo,"onUpdate:modelValue":h},null,8,["model-value"]),n.createElementVNode("fieldset",D0,[K[26]||(K[26]=n.createElementVNode("legend",null,"헤더 색상",-1)),n.createElementVNode("div",O0,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":a.value===null}]),title:"없음",onClick:K[11]||(K[11]=R=>ee(null))},"∅",2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),R=>(n.openBlock(),n.createElementBlock("button",{key:R,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":a.value===R}]),style:n.normalizeStyle({background:n.unref(ai)(R)}),title:n.unref(li)(R),onClick:x=>ee(R)},null,14,L0))),128))])])],8,w0)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a8c7f667"]]),Cc=["ko","en","ja","zh"];function P0(e){if(e)for(const t of Cc){const o=e[t];if(o)return o}}function Yl(e){const t=P0(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function z0(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Cc.some(l=>{var a,r;return(r=(a=i.label)==null?void 0:a[l])==null?void 0:r.toLowerCase().includes(o)})):e}const U0=["aria-expanded"],H0=["aria-selected","onClick","onMouseenter"],F0={key:0,class:"gcc__opt gcc__opt--empty"},Rc=Ae(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,l=n.ref(),a=n.ref(),r=n.ref(),s=n.ref(""),c=n.ref(!1),d=n.ref(-1),u=n.ref({}),f=n.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),p=n.computed(()=>f.value?Yl(f.value):"");n.watch(p,T=>{c.value||(s.value=T)},{immediate:!0});const m=n.computed(()=>s.value===p.value?o.items:z0(o.items,s.value));function g(){var ee;const T=(ee=l.value)==null?void 0:ee.getBoundingClientRect();T&&(u.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function _(){c.value=!0,g(),d.value=Math.max(0,m.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",J)}function k(){c.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",J)}n.onBeforeUnmount(k);function b(){_(),n.nextTick(()=>{var T;return(T=a.value)==null?void 0:T.select()})}function $(){c.value||_(),d.value=0}function h(T){i("update:modelValue",T.groupCode),s.value=Yl(T),k()}function S(){i("update:modelValue",void 0),s.value="",k()}function X(){s.value.trim()===""?S():(s.value=p.value,k())}function W(T){var ee;if(T.key==="ArrowDown")c.value||_(),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 F=m.value[d.value];F&&h(F),T.preventDefault()}else T.key==="Escape"&&(s.value=p.value,k(),(ee=a.value)==null||ee.blur())}function J(T){var F,K;const ee=T.target;!((F=l.value)!=null&&F.contains(ee))&&!((K=r.value)!=null&&K.contains(ee))&&X()}return(T,ee)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:l,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:a,"onUpdate:modelValue":ee[0]||(ee[0]=F=>s.value=F),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":c.value,placeholder:"코드그룹 검색/선택",onFocus:b,onInput:$,onKeydown:W},null,40,U0),[[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:ee[1]||(ee[1]=n.withModifiers(()=>{},["prevent"])),onClick:S},"(없음)",32),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(m.value,(F,K)=>(n.openBlock(),n.createElementBlock("li",{key:F.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":K===d.value,"is-selected":F.groupCode===e.modelValue}]),role:"option","aria-selected":F.groupCode===e.modelValue,onMousedown:ee[2]||(ee[2]=n.withModifiers(()=>{},["prevent"])),onClick:O=>h(F),onMouseenter:O=>d.value=K},n.toDisplayString(n.unref(Yl)(F)),43,H0))),128)),m.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",F0,"일치하는 코드그룹 없음"))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-3f798ab1"]]),G0=["disabled"],Y0={class:"em-aw__toolbar"},W0={class:"em-aw__count"},K0={class:"em-aw__scroll"},X0={class:"em-aw__table"},q0={key:0,class:"c-code"},Z0=["colspan"],j0={class:"c-del"},J0={class:"c-flag"},Q0={class:"c-flag"},e1={class:"c-flag"},t1={class:"c-flag"},n1={class:"c-flag"},o1={class:"c-flag"},i1={key:0},l1={class:"c-del"},a1=["colspan"],r1={class:"c-del"},s1={class:"em-aw__embed-label"},c1={class:"em-aw__ro"},d1={class:"em-aw__ro"},u1={class:"em-aw__ro"},f1={class:"em-aw__ro"},m1={colspan:"5"},p1=["colspan"],h1={key:0},ri="__OWN__",g1=Ae(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(V=>V.modelId===t.entityId)??null),l=n.computed(()=>{var V;return((V=i.value)==null?void 0:V.stereotype)==="JPA_EMBEDDABLE"}),a=n.computed(()=>new Set(o.selectedAttrIds.value)),r=n.computed(()=>{var V;return(((V=i.value)==null?void 0:V.attributes)??[]).filter(M=>M.attrType!=="DIVIDER").length}),s=n.computed(()=>ee.value.length?16:15),c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(V){return V==="none"?"(없음)":V}const u=V=>V;function f(V,M){i.value&&o.updateAttribute(i.value.modelId,V.modelId,M)}function p(V){return!!V.transient}const m=V=>V.value,g=V=>V.label;function _(V,M){if(!M)return;const y=X.value.find(L=>L.type===M);if(y){const L=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};f(V,{type:M,customType:void 0,dbAttrs:[{...L,dataType:y.dataType,length:y.length,scale:y.scale}]});return}f(V,M===Pt?{type:M}:{type:M,customType:void 0})}function k(V,M){f(V,{customType:M.trim()===""?void 0:M})}function b(V,M){const y=V.dbAttrs[0]??{modelId:V.modelId+".c",physicalName:V.name,dataType:"VARCHAR"};f(V,{dbAttrs:[{...y,...M}]})}function $(V,M,y){var L;b(V,{logicalName:{...(L=V.dbAttrs[0])==null?void 0:L.logicalName,[M]:y}})}function h(V){return V.personalInfoAttributeType??"none"}function S(V,M){f(V,{personalInfoAttributeType:M==="none"?void 0:M})}const X=n.computed(()=>o.predefinedCustomTypeCatalog.value),W=n.computed(()=>o.embeddableCatalog.value);function J(V){var M,y;return((M=V.label)==null?void 0:M.ko)??((y=V.label)==null?void 0:y.en)??V.type}function T(V){!V||!i.value||o.addPredefinedEmbed(i.value.modelId,V)}const ee=n.computed(()=>o.groupCodeCatalog.value);function F(V){var M;return((M=ee.value.find(y=>y.groupCode===V.groupCode))==null?void 0:M.codes)??[]}function K(V){return["none",...F(V)]}function O(V){return V==="none"?"none":V.code}function fe(V){var y,L;if(V==="none")return"(없음)";const M=((y=V.label)==null?void 0:y.ko)??((L=V.label)==null?void 0:L.en);return M?`${V.code} (${M})`:V.code}function w(V,M){i.value&&o.setAttributeGroupCode(i.value.modelId,V.modelId,M)}function R(V,M){f(V,{defaultValue:M==="none"?void 0:M})}function x(V,M){f(V,{defaultValue:M.trim()===""?void 0:M})}function G(V){return V.attrType.startsWith("EMBED")&&V.dbAttrs.length>0}function H(V,M,y){const L=V.dbAttrs.map((ae,ue)=>{if(ue!==M)return ae;const ge={...ae,...y};for(const P of Object.keys(y))y[P]===void 0&&delete ge[P];return ge});i.value&&o.setEmbedColumns(i.value.modelId,V.modelId,L)}function Z(V,M,y,L){var ae;H(V,M,{logicalName:{...(ae=V.dbAttrs[M])==null?void 0:ae.logicalName,[y]:L}})}function A(V,M){var ae,ue,ge;if(V.attrType==="EMBED_PREDEF"){const P=(ae=o.embeddableCatalog.value.find(Y=>Y.type===V.type))==null?void 0:ae.fields[M];return P?{name:P.name,physicalName:P.physicalName,dataType:P.dataType,length:P.length,shareable:P.shareable,logicalName:P.logicalName}:void 0}const y=(ue=V.embedded)==null?void 0:ue.embeddableRef;if(!y)return;const L=(ge=o.state.logical.entities.find(P=>P.modelId===y))==null?void 0:ge.attributes.flatMap(P=>P.dbAttrs)[M];return L?{physicalName:L.physicalName,dataType:L.dataType,length:L.length,scale:L.scale,logicalName:L.logicalName}:void 0}function U(V,M){var y,L;return((y=A(V,M))==null?void 0:y.dataType)||((L=V.dbAttrs[M])==null?void 0:L.dataType)||""}function Q(V,M){var y,L;return((y=A(V,M))==null?void 0:y.length)??((L=V.dbAttrs[M])==null?void 0:L.length)}function me(V,M){var y,L;return((y=A(V,M))==null?void 0:y.scale)??((L=V.dbAttrs[M])==null?void 0:L.scale)}const pe=["inherit","true","false"];function de(V){return V==="inherit"?"기본(따름)":V}function q(V){return(V==null?void 0:V.updatable)===void 0?"inherit":V.updatable?"true":"false"}function ce(V,M,y){H(V,M,{updatable:y==="inherit"?void 0:y==="true"})}function Ee(V,M){b(V,{updatable:M==="inherit"?void 0:M==="true"})}const $e=["inherit","true","false"];function ke(V){return V==="inherit"?"기본(따름)":V}function he(V){return(V==null?void 0:V.insertable)===void 0?"inherit":V.insertable?"true":"false"}function N(V,M,y){H(V,M,{insertable:y==="inherit"?void 0:y==="true"})}function I(V,M){b(V,{insertable:M==="inherit"?void 0:M==="true"})}const v=n.computed(()=>{var V;return $n(((V=i.value)==null?void 0:V.attributes.flatMap(M=>M.dbAttrs))??[])}),E=n.computed(()=>{var V;return(((V=i.value)==null?void 0:V.attributes)??[]).filter(M=>M.attrType==="NORMAL"&&M.dbAttrs.length===1&&M.dbAttrs[0]).map(M=>({modelId:M.dbAttrs[0].modelId,label:M.dbAttrs[0].physicalName||M.name}))});function C(){return[ri,...E.value.map(V=>V.modelId)]}function D(V){if(V===ri)return"전용 컬럼(OWN)";const M=E.value.find(y=>y.modelId===V);return M?`↗ ${M.label} (공유)`:V}function B(V){return(V==null?void 0:V.sharedColumnRef)??ri}function oe(V,M,y){H(V,M,{sharedColumnRef:y===ri?void 0:y})}function ie(V){return(V==null?void 0:V.sharedColumnRef)!=null}function le(V){var M;return((M=bo(V,v.value))==null?void 0:M.physicalName)??""}return(V,M)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",Y0,[n.createElementVNode("span",W0,"속성 ("+n.toDisplayString(r.value)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:M[0]||(M[0]=y=>n.unref(o).addAttribute(i.value.modelId))}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"구분선",onClick:M[1]||(M[1]=y=>n.unref(o).addDivider(i.value.modelId))}),W.value.length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"140px",placeholder:"임베더블 추가","model-value":void 0,items:W.value,"value-provider":y=>y.type,"label-provider":J,"onUpdate:modelValue":T},null,8,["items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",K0,[n.createElementVNode("table",X0,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[M[2]||(M[2]=n.createElementVNode("th",{class:"c-name"},"이름",-1)),M[3]||(M[3]=n.createElementVNode("th",{class:"c-type"},"타입",-1)),M[4]||(M[4]=n.createElementVNode("th",{class:"c-logical"},"논리명",-1)),M[5]||(M[5]=n.createElementVNode("th",{class:"c-col"},"컬럼(물리)",-1)),M[6]||(M[6]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),M[7]||(M[7]=n.createElementVNode("th",{class:"c-len"},"len",-1)),M[8]||(M[8]=n.createElementVNode("th",{class:"c-scale"},"scale",-1)),M[9]||(M[9]=n.createElementVNode("th",{class:"c-flag"},"Primary Key",-1)),M[10]||(M[10]=n.createElementVNode("th",{class:"c-flag"},"Not Null",-1)),M[11]||(M[11]=n.createElementVNode("th",{class:"c-flag"},"Unique",-1)),M[12]||(M[12]=n.createElementVNode("th",{class:"c-flag"},"Auto Increment",-1)),M[13]||(M[13]=n.createElementVNode("th",{class:"c-flag"},"@Transient",-1)),M[14]||(M[14]=n.createElementVNode("th",{class:"c-flag"},"Multi-Value (Set)",-1)),M[15]||(M[15]=n.createElementVNode("th",{class:"c-ins"},"insertable",-1)),M[16]||(M[16]=n.createElementVNode("th",{class:"c-upd"},"updatable",-1)),M[17]||(M[17]=n.createElementVNode("th",{class:"c-pii"},"개인정보",-1)),ee.value.length?(n.openBlock(),n.createElementBlock("th",q0,"코드그룹")):n.createCommentVNode("",!0),M[18]||(M[18]=n.createElementVNode("th",{class:"c-default"},"기본값",-1)),M[19]||(M[19]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,y=>{var L,ae,ue,ge,P,Y,z,j,ne,se,be;return n.openBlock(),n.createElementBlock(n.Fragment,{key:y.modelId},[y.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":a.value.has(y.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-divlabel-${y.modelId}`,width:"100%",placeholder:"구분선 라벨(선택)","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:s.value,class:"em-aw__divider-note"},"── 시각 구획 ──",8,Z0),n.createElementVNode("td",j0,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2)):G(y)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":a.value.has(y.modelId)}])},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-name-${y.modelId}`,width:"100%",placeholder:"이름","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-type-${y.modelId}`,width:"100%",disabled:"","model-value":y.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:ee.value.length?15:14,class:"em-aw__embed-note"},"임베더블 — 하위 컬럼 "+n.toDisplayString(y.dbAttrs.length)+"개",9,a1),n.createElementVNode("td",r1,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.dbAttrs,(re,we)=>{var Ie,Re,Ze,Ot,Lt,ye,Oe;return n.openBlock(),n.createElementBlock("tr",{key:re.modelId,class:"em-aw__embed-col"},[n.createElementVNode("td",s1,"↳ "+n.toDisplayString(((Ie=A(y,we))==null?void 0:Ie.name)??((Re=A(y,we))==null?void 0:Re.physicalName)??`컬럼 ${we+1}`),1),n.createElementVNode("td",null,[n.createElementVNode("span",c1,n.toDisplayString(U(y,we)),1)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-embed-logical-${re.modelId}`,width:"100%",placeholder:((Ot=(Ze=A(y,we))==null?void 0:Ze.logicalName)==null?void 0:Ot.ko)??"논리명","model-value":((Lt=re.logicalName)==null?void 0:Lt.ko)??"","onUpdate:modelValue":He=>Z(y,we,"ko",He)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-embed-col-${re.modelId}`,width:"100%",disabled:ie(re),placeholder:((ye=A(y,we))==null?void 0:ye.physicalName)??"컬럼","model-value":ie(re)?le(re):re.physicalName,"onUpdate:modelValue":He=>H(y,we,{physicalName:He})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":re.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",d1,n.toDisplayString(U(y,we)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",u1,n.toDisplayString(Q(y,we)??""),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",f1,n.toDisplayString(me(y,we)??""),1)]),n.createElementVNode("td",m1,[(Oe=A(y,we))!=null&&Oe.shareable?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":B(re),items:C(),"value-provider":u,"label-provider":D,"onUpdate:modelValue":He=>He&&oe(y,we,He)},null,8,["model-value","items","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:ie(re),"model-value":ie(re)?"false":he(re),items:$e,"value-provider":u,"label-provider":ke,"onUpdate:modelValue":He=>He&&N(y,we,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:ie(re),"model-value":ie(re)?"false":q(re),items:pe,"value-provider":u,"label-provider":de,"onUpdate:modelValue":He=>He&&ce(y,we,He)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:ee.value.length?3:2},null,8,p1)])}),128))],64)):(n.openBlock(),n.createElementBlock("tr",{key:1,class:n.normalizeClass({"is-focused":a.value.has(y.modelId)})},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-name-${y.modelId}`,width:"100%",placeholder:"이름","model-value":y.name,"onUpdate:modelValue":re=>f(y,{name:re})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-type-${y.modelId}`,width:"100%",placeholder:"타입",disabled:!!y.groupCode,items:n.unref(Ra)(y.type,X.value),"value-provider":m,"label-provider":g,"model-value":y.type,"onUpdate:modelValue":re=>_(y,re)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),y.type===n.unref(Pt)?(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:0,name:`aw-customtype-${y.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":y.customType??"","onUpdate:modelValue":re=>k(y,re)},null,8,["name","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-logical-${y.modelId}`,width:"100%",placeholder:"논리명","model-value":((ae=(L=y.dbAttrs[0])==null?void 0:L.logicalName)==null?void 0:ae.ko)??"","onUpdate:modelValue":re=>$(y,"ko",re)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`aw-col-${y.modelId}`,width:"100%",placeholder:"컬럼",disabled:p(y),"model-value":((ue=y.dbAttrs[0])==null?void 0:ue.physicalName)??"","onUpdate:modelValue":re=>b(y,{physicalName:re})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":(ge=y.dbAttrs[0])==null?void 0:ge.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-dtype-${y.modelId}`,width:"100%",placeholder:"dataType",disabled:p(y),items:n.unref(Ia)(((P=y.dbAttrs[0])==null?void 0:P.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":u,"label-provider":n.unref(Hi),"model-value":((Y=y.dbAttrs[0])==null?void 0:Y.dataType)??"","onUpdate:modelValue":re=>re&&b(y,{dataType:re})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSNumberInput),{name:`aw-len-${y.modelId}`,width:"100%",placeholder:"len",disabled:p(y),"model-value":(z=y.dbAttrs[0])==null?void 0:z.length,"onUpdate:modelValue":re=>b(y,{length:re||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSNumberInput),{name:`aw-scale-${y.modelId}`,width:"100%",placeholder:"scale",disabled:p(y),"model-value":(j=y.dbAttrs[0])==null?void 0:j.scale,"onUpdate:modelValue":re=>b(y,{scale:re||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",J0,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-pk-${y.modelId}`,"model-value":y.identifier,disabled:l.value||p(y),"onUpdate:modelValue":re=>f(y,{identifier:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",Q0,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-nn-${y.modelId}`,"model-value":y.notNull,disabled:p(y),"onUpdate:modelValue":re=>f(y,{notNull:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",e1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-uq-${y.modelId}`,"model-value":!!((ne=y.dbAttrs[0])!=null&&ne.unique),disabled:p(y),"onUpdate:modelValue":re=>b(y,{unique:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",t1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-ai-${y.modelId}`,"model-value":!!((se=y.dbAttrs[0])!=null&&se.autoIncrement),disabled:p(y)||!y.identifier,"onUpdate:modelValue":re=>b(y,{autoIncrement:re})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",n1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-tr-${y.modelId}`,"model-value":!!y.transient,disabled:y.identifier,"onUpdate:modelValue":re=>f(y,{transient:re||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",o1,[n.createVNode(n.unref(te.BSCheckbox),{name:`aw-mv-${y.modelId}`,"model-value":!!((be=y.dbAttrs[0])!=null&&be.multiValue),disabled:p(y),"onUpdate:modelValue":re=>b(y,{multiValue:re||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-ins-${y.modelId}`,width:"100%",disabled:p(y),"model-value":he(y.dbAttrs[0]),items:$e,"value-provider":u,"label-provider":ke,"onUpdate:modelValue":re=>re&&I(y,re)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{name:`aw-upd-${y.modelId}`,width:"100%",disabled:p(y),"model-value":q(y.dbAttrs[0]),items:pe,"value-provider":u,"label-provider":de,"onUpdate:modelValue":re=>re&&Ee(y,re)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":h(y),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":re=>re&&S(y,re)},null,8,["model-value","onUpdate:modelValue"])]),ee.value.length?(n.openBlock(),n.createElementBlock("td",i1,[n.createVNode(Rc,{"model-value":y.groupCode,items:ee.value,"onUpdate:modelValue":re=>w(y,re)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("td",null,[F(y).length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":y.defaultValue??"none",items:K(y),"value-provider":O,"label-provider":fe,"onUpdate:modelValue":re=>re&&R(y,re)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:1,name:`aw-default-${y.modelId}`,width:"100%",placeholder:"기본값","model-value":y.defaultValue??"","onUpdate:modelValue":re=>x(y,re)},null,8,["name","model-value","onUpdate:modelValue"]))]),n.createElementVNode("td",l1,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:re=>n.unref(o).removeAttribute(i.value.modelId,y.modelId)},null,8,["onClick"])])],2))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",h1,[...M[20]||(M[20]=[n.createElementVNode("td",{colspan:"99",class:"em-aw__empty"},"속성 없음 — '추가'로 생성",-1)])]))])])])],8,G0)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-eaf1fd75"]]),y1=["disabled"],b1={class:"em-idxw__list"},_1={class:"em-idxw__list-head"},v1=["onClick"],w1={class:"em-idxw__item-name"},E1={key:0,class:"em-idxw__badge"},N1={class:"em-idxw__item-cnt"},k1={key:0,class:"em-idxw__empty"},x1={key:0,class:"em-idxw__edit"},$1={class:"em-idxw__form"},I1={class:"em-field em-idxw__name"},S1={class:"em-field"},C1=["value"],R1={class:"em-idxw__transfer"},V1={class:"em-idxw__pane"},A1={class:"em-idxw__pane-head"},T1={class:"em-idxw__cols"},M1=["onClick"],B1={key:0,class:"em-idxw__empty"},D1={class:"em-idxw__arrows"},O1={class:"em-idxw__pane"},L1={class:"em-idxw__pane-head"},P1={class:"em-idxw__cols"},z1={class:"em-idxw__col-name"},U1={class:"em-idxw__col-ops"},H1=["disabled","onClick"],F1=["disabled","onClick"],G1=["onClick"],Y1={key:0,class:"em-idxw__empty"},W1={key:1,class:"em-idxw__edit em-idxw__edit--empty"},K1=Ae(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(W=>W.modelId===t.entityId)??null),l=n.computed(()=>{var W;return((W=i.value)==null?void 0:W.indexes)??[]}),a=n.computed(()=>{var W;return((W=i.value)==null?void 0:W.attributes)??[]}),r=n.ref(null);n.watch(l,W=>{var J;W.some(T=>T.modelId===r.value)||(r.value=((J=W[0])==null?void 0:J.modelId)??null)},{immediate:!0});const s=n.computed(()=>l.value.find(W=>W.modelId===r.value)??null),c=n.computed(()=>{var W;return new Set(((W=s.value)==null?void 0:W.columns.map(J=>J.columnRef))??[])}),d=n.computed(()=>a.value.filter(W=>!c.value.has(W.modelId))),u=n.ref(new Set);n.watch(r,()=>u.value=new Set);function f(W){var T;const J=(T=W.dbAttrs[0])==null?void 0:T.physicalName;return J&&J!==W.name?`${W.name} (${J})`:W.name}function p(W){const J=a.value.find(T=>T.modelId===W);return J?f(J):W}function m(W,J){i.value&&o.updateIndex(i.value.modelId,W,J)}function g(){var J;if(!i.value)return;const W=Se();o.addIndex(i.value.modelId,{modelId:W,name:`idx_${(((J=i.value.indexes)==null?void 0:J.length)??0)+1}`,unique:!1,columns:[]}),r.value=W}function _(W){i.value&&o.removeIndex(i.value.modelId,W)}function k(W){s.value&&m(s.value.modelId,{parameters:W.trim()===""?void 0:W})}function b(W){const J=new Set(u.value);J.has(W)?J.delete(W):J.add(W),u.value=J}function $(){const W=s.value;if(!W||!u.value.size)return;const J=[...u.value].map(T=>({columnRef:T,descending:!1}));m(W.modelId,{columns:[...W.columns,...J]}),u.value=new Set}function h(W){const J=s.value;J&&m(J.modelId,{columns:J.columns.filter((T,ee)=>ee!==W)})}function S(W,J){const T=s.value;T&&m(T.modelId,{columns:T.columns.map((ee,F)=>F===W?{...ee,descending:J}:ee)})}function X(W,J){const T=s.value;if(!T)return;const ee=W+J;if(ee<0||ee>=T.columns.length)return;const F=[...T.columns];[F[W],F[ee]]=[F[ee],F[W]],m(T.modelId,{columns:F})}return(W,J)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",b1,[n.createElementVNode("div",_1,[n.createElementVNode("span",null,"인덱스 ("+n.toDisplayString(l.value.length)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:g})]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,T=>(n.openBlock(),n.createElementBlock("li",{key:T.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":T.modelId===r.value}]),onClick:ee=>r.value=T.modelId},[n.createElementVNode("span",w1,n.toDisplayString(T.name||"(이름 없음)"),1),T.unique?(n.openBlock(),n.createElementBlock("span",E1,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",N1,n.toDisplayString(T.columns.length),1)],10,v1))),128)),l.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",k1,"인덱스 없음 — '추가'로 생성"))])]),s.value?(n.openBlock(),n.createElementBlock("section",x1,[n.createElementVNode("div",$1,[n.createElementVNode("label",I1,[J[4]||(J[4]=n.createElementVNode("span",null,"인덱스명",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":J[0]||(J[0]=T=>m(s.value.modelId,{name:T}))},null,8,["model-value"]),n.createVNode(jt,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":J[1]||(J[1]=T=>m(s.value.modelId,{unique:T}))},null,8,["model-value"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:"인덱스 삭제",onClick:J[2]||(J[2]=T=>_(s.value.modelId))})]),n.createElementVNode("label",S1,[J[5]||(J[5]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A' AND deleted = false",onChange:J[3]||(J[3]=T=>k(T.target.value))},null,40,C1)]),n.createElementVNode("div",R1,[n.createElementVNode("div",V1,[n.createElementVNode("div",A1,"가용 컬럼 ("+n.toDisplayString(d.value.length)+")",1),n.createElementVNode("ul",T1,[(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:ee=>b(T.modelId)},n.toDisplayString(f(T)),11,M1))),128)),d.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",B1,"모든 컬럼 사용됨"))])]),n.createElementVNode("div",D1,[n.createVNode(n.unref(te.BSButton),{caption:"추가 →",disabled:!u.value.size,onClick:$},null,8,["disabled"])]),n.createElementVNode("div",O1,[n.createElementVNode("div",L1,"인덱스 컬럼 ("+n.toDisplayString(s.value.columns.length)+")",1),n.createElementVNode("ul",P1,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(T,ee)=>(n.openBlock(),n.createElementBlock("li",{key:ee,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",z1,n.toDisplayString(p(T.columnRef)),1),n.createVNode(n.unref(te.BSCheckbox),{name:`idxw-desc-${ee}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":F=>S(ee,F)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",U1,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"위로",disabled:ee===0,onClick:F=>X(ee,-1)},"↑",8,H1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:"아래로",disabled:ee===s.value.columns.length-1,onClick:F=>X(ee,1)},"↓",8,F1),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:"제거",onClick:F=>h(ee)},"✕",8,G1)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",Y1,"컬럼 없음 — 좌측에서 추가"))])])])])):(n.openBlock(),n.createElementBlock("section",W1,"인덱스를 선택하거나 추가하세요."))],8,y1)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-46db4ab5"]]),X1={class:"em-op-src"},q1={class:"em-op-src__actions"},Vc=Ae(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function}},setup(e){const t=e,o=te.useModalHandle(),i=n.ref(t.sourceCode);function l(){t.onSave(i.value),o.close()}return(a,r)=>(n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:`본문 — ${t.operationName}()`},{default:n.withCtx(()=>[n.createElementVNode("div",X1,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":r[0]||(r[0]=s=>i.value=s),class:"em-op-src__area",spellcheck:"false",placeholder:"// Java 구현 코드"},null,512),[[n.vModelText,i.value]]),n.createElementVNode("div",q1,[n.createVNode(n.unref(te.BSButton),{caption:"저장",onClick:l}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:r[1]||(r[1]=s=>n.unref(o).close())})])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-acb84aec"]]),Z1=["disabled"],j1={class:"em-ow__toolbar"},J1={class:"em-ow__count"},Q1={class:"em-ow__scroll"},eb={class:"em-ow__table"},tb={class:"c-del"},nb={key:0},ob=Ae(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModal(),l=n.computed(()=>o.state.logical.entities.find(g=>g.modelId===t.entityId)??null),a=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],r=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(g){return g==="none"?"(없음)":g}const c=g=>g;function d(g,_){l.value&&o.updateOperation(l.value.modelId,g.modelId,_)}function u(g,_,k){d(g,{description:{...g.description,[_]:k}})}function f(g){return g.personalInfoAttributeType??"none"}function p(g,_){d(g,{personalInfoAttributeType:_==="none"?void 0:_})}function m(g){i.openModal({component:Vc,bind:{operationName:g.name,sourceCode:g.sourceCode??"",onSave:_=>d(g,{sourceCode:_})}})}return(g,_)=>{var k,b;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",j1,[n.createElementVNode("span",J1,"오퍼레이션 ("+n.toDisplayString(((k=l.value.operations)==null?void 0:k.length)??0)+")",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:_[0]||(_[0]=$=>n.unref(o).addOperation(l.value.modelId))})]),n.createElementVNode("div",Q1,[n.createElementVNode("table",eb,[_[2]||(_[2]=n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",{class:"c-name"},"이름"),n.createElementVNode("th",{class:"c-vis"},"visibility"),n.createElementVNode("th",{class:"c-desc"},"설명"),n.createElementVNode("th",{class:"c-pii"},"개인정보"),n.createElementVNode("th",{class:"c-src"},"본문"),n.createElementVNode("th",{class:"c-del"})])],-1)),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value.operations??[],$=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:$.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`ow-name-${$.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":$.name,"onUpdate:modelValue":S=>d($,{name:S})},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":$.visibility??"PACKAGE",items:a,"value-provider":c,"label-provider":c,"onUpdate:modelValue":S=>S&&d($,{visibility:S})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSTextInput),{name:`ow-desc-${$.modelId}`,width:"100%",placeholder:"설명(ko)","model-value":((h=$.description)==null?void 0:h.ko)??"","onUpdate:modelValue":S=>u($,"ko",S)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":f($),items:r,"value-provider":c,"label-provider":s,"onUpdate:modelValue":S=>S&&p($,S)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(te.BSButton),{variant:"text",caption:$.sourceCode?"본문 ●":"본문",onClick:S=>m($)},null,8,["caption","onClick"])]),n.createElementVNode("td",tb,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:S=>n.unref(o).removeOperation(l.value.modelId,$.modelId)},null,8,["onClick"])])])}),128)),(b=l.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",nb,[..._[1]||(_[1]=[n.createElementVNode("td",{colspan:"6",class:"em-ow__empty"},"오퍼레이션 없음 — '추가'로 생성",-1)])]))])])])],8,Z1)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-a621eb69"]]),ib={key:0,class:"em-detail"},lb={class:"em-detail__tabs"},ab=["onClick"],rb=Ae(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModalHandle(),l=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(l,s=>{s||i.close()});const a=[{key:"basics",label:"기본"},{key:"columns",label:"속성"},{key:"indexes",label:"인덱스"},{key:"operations",label:"오퍼레이션"}],r=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:`엔티티 — ${((d=l.value)==null?void 0:d.name)??""}`},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",ib,[n.createElementVNode("nav",lb,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(a,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":r.value===u.key}]),onClick:f=>r.value=u.key},n.toDisplayString(u.label),11,ab)),64)),c[1]||(c[1]=n.createElementVNode("span",{class:"em-detail__spacer"},null,-1)),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:c[0]||(c[0]=u=>n.unref(i).close())})]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[r.value==="basics"?(n.openBlock(),n.createBlock(Sc,{key:0,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="columns"?(n.openBlock(),n.createBlock(g1,{key:1,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):r.value==="indexes"?(n.openBlock(),n.createBlock(K1,{key:2,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(ob,{key:3,controller:n.unref(o),"entity-id":l.value.modelId},null,8,["controller","entity-id"]))],2)])):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-6e30603a"]]);function si(e,t,o){e.openModal({component:rb,bind:{controller:n.markRaw(t),entityId:o}})}const Ac=()=>crypto.randomUUID(),sb=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,cb=e=>e&&e[0].toLowerCase()+e.slice(1),db=e=>e&&e[0].toUpperCase()+e.slice(1),ub=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function fb(e,t){return cb(e)+db(t)}function mb(e,t){const o=e.entities.find(r=>r.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const l=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(r=>r.identifier&&(r.attrType==="NORMAL"||r.attrType==="RELATION_OWN")).sort((r,s)=>r.order-s.order).map(r=>{const s=fb(o.name,r.name);return{associationRef:t.modelId,sourceAttributeRef:r.modelId,name:s,type:r.type,identifier:l,notNull:l,dbAttrs:r.dbAttrs.map(c=>({physicalName:ub(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const ci=(e,t)=>`${e}::${t}`;function pb(e,t,o){const i={};return e.type!==t.type&&(i.type=t.type),e.identifier!==t.identifier&&(i.identifier=t.identifier),e.notNull!==t.notNull&&(i.notNull=t.notNull),(e.dbAttrs.length!==t.dbAttrs.length||t.dbAttrs.some((a,r)=>{const s=e.dbAttrs[r];return!s||s.dataType!==a.dataType||s.length!==a.length||s.scale!==a.scale}))&&(i.dbAttrs=t.dbAttrs.map((a,r)=>{const s=e.dbAttrs[r];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??a.physicalName,logicalName:(s==null?void 0:s.logicalName)??a.logicalName,dataType:a.dataType,length:a.length,scale:a.scale}})),Object.keys(i).length?i:null}function hb(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 di(e,t,o=Ac){const i={add:[],update:[],remove:[]},l=e.entities.find(f=>f.modelId===t);if(!l)return i;const a=e.associations.filter(f=>f.end2.entityRef===t),r=l.stereotype==="JPA_EMBEDDABLE"?[]:a.flatMap(f=>mb(e,f)),s=new Map(r.map(f=>[ci(f.associationRef,f.sourceAttributeRef),f])),c=l.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ci(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const p=ci(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(f.modelId)}let u=l.attributes.reduce((f,p)=>Math.max(f,p.order),-1)+1;for(const f of r){const p=ci(f.associationRef,f.sourceAttributeRef),m=d.get(p);if(!m)i.add.push(hb(f,u++,o));else{const g=pb(m,f,o);g&&i.update.push({attributeId:m.modelId,patch:g})}}return i}function gb(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(l=>l.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function yb(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function bb(e,t,o=Ac){const i=new Map,l=yb(e),a=new Set,r=[t];for(;r.length;){const s=r.shift();if(a.has(s))continue;a.add(s);const c=new Set(l.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=di(l,d,o);if(sb(u))continue;i.has(d)||i.set(d,u);const f=l.entities.find(p=>p.modelId===d);f&&gb(f,u),a.has(d)||r.push(d)}}return i}function _b(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=Se(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const l of t.attributes){const a=Se();o.set(l.modelId,a),l.modelId=a;for(const r of l.dbAttrs)r.modelId=Se()}for(const l of t.indexes??[]){l.modelId=Se();for(const a of l.columns)a.columnRef=o.get(a.columnRef)??a.columnRef}return t}const Jt=Symbol("editorController");function Tc(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ui(e,t){const o=[];for(const i of t.remove)o.push(It(e,i));for(const i of t.update)o.push(zt(e,i.attributeId,i.patch));for(const i of t.add)o.push(yt(e,i));return o}function yn(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function bn(e,t){const o=[];for(const[i,l]of bb(e,t,Se))o.push(...ui(i,l));return o}function Mc(e,t,o){const i=new Set(o.remove);return yn(e,t,l=>[...l.filter(a=>!i.has(a.modelId)).map(a=>{const r=o.update.find(s=>s.attributeId===a.modelId);return r?{...a,...r.patch}:a}),...o.add])}function Wl(e,t){const o=di(e,t,Se),i=ui(t,o),l=Mc(e,t,o);return i.push(...bn(l,t)),i}function Bc(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:Se()}))}function vb(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let l;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((m,g)=>Math.max(m,g.order),-1)+1,f=new Set(o.attributes.map(m=>m.name));let p="id";for(let m=2;f.has(p);m++)p=`id${m}`;l={modelId:Se(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:Se(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(yt(t,l))}const a=[];for(const u of e.entities)for(const f of u.attributes){if(((d=f.embedded)==null?void 0:d.embeddableRef)!==t)continue;const p=e.associations.find(k=>k.modelId===f.embedded.associationRef);if(!p)continue;const m=p.end1.entityRef===u.modelId,g=m?p.end1:p.end2,_=m?p.end2:p.end1;a.push({ownerId:u.modelId,dispId:f.modelId,assocId:p.modelId,end1:{entityRef:u.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:t,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1}})}const r={...e,entities:e.entities.map(u=>{if(u.modelId===t)return l?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,l]}:{...u,stereotype:"JPA_ENTITY"};const f=new Set(a.filter(p=>p.ownerId===u.modelId).map(p=>p.dispId));return f.size?{...u,attributes:u.attributes.filter(p=>!f.has(p.modelId))}:u}),associations:e.associations.map(u=>{const f=a.find(p=>p.assocId===u.modelId);return f?{...u,end1:f.end1,end2:f.end2}:u})},s=di(r,t,Se);for(const u of a){const f=s.add.find(p=>{var m;return((m=p.derivedFrom)==null?void 0:m.associationRef)===u.assocId});f&&(u.end2.attributeRef=f.modelId)}for(const u of a)i.push(It(u.ownerId,u.dispId)),i.push(Eo(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ui(t,s));const c=Mc(r,t,s);return i.push(...bn(c,t)),i}function wb(e,t){const o=e.entities.find(a=>a.modelId===t);if(!o)return[];const i=[],l=a=>a&&a.charAt(0).toLowerCase()+a.slice(1);for(const a of e.associations){if(a.end1.entityRef===a.end2.entityRef)continue;const r=a.end1.entityRef===t,s=a.end2.entityRef===t;if(!r&&!s)continue;const c=r?a.end2.entityRef:a.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var S;return((S=h.embedded)==null?void 0:S.associationRef)===a.modelId}))continue;const u=Se(),f=d.attributes.reduce((h,S)=>Math.max(h,S.order),-1)+1,p=new Set(d.attributes.map(h=>h.name)),m=l(o.name);let g=m;for(let h=2;p.has(g);h++)g=`${m}${h}`;const _=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:Se()})),k={modelId:u,name:g,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:_,embedded:{associationRef:a.modelId,embeddableRef:t}};i.push(yt(c,k));const b=r?"end2":"end1",$=r?"end1":"end2";i.push(Eo(a.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Se()},[$]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Eb(e=Tc(),t={}){var ke,he;const o=n.reactive(e);let i=new Wi(o);const l=n.ref(t.embeddableCatalog??[]),a=n.ref(t.groupCodeCatalog??[]),r=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.languages??["ko","en","ja","zh"]),c=n.ref(t.userLanguage??"ko"),d=n.ref(t.reservedWords),u=n.ref(t.selectableDataTypes),f=n.ref(t.largeEntityThreshold),p=n.ref(t.flagEntitiesWithoutRelations??!1),m=n.ref(!1),g=n.ref(!1),_=n.ref(!1),k=n.ref(((ke=t.meta)==null?void 0:ke.schemaVersion)??1),b=n.ref(((he=t.meta)==null?void 0:he.opWriteEnabled)??!1),$=n.computed(()=>k.value>=2&&b.value),h=n.ref(!(k.value>=2&&b.value===!1)),S=n.ref("LOGICAL_PHYSICAL"),X=n.ref("straight"),W=n.ref(!0),J=n.ref(!0),T=n.ref(null),ee=n.computed(()=>{var N;return((N=T.value)==null?void 0:N.kind)==="attribute"?{entityId:T.value.entityId,attrId:T.value.anchor}:null}),F=n.computed(()=>{var N;return((N=T.value)==null?void 0:N.kind)==="attribute"?T.value.ids:[]}),K=n.computed(()=>{var N,I;return((N=T.value)==null?void 0:N.kind)==="entity"?T.value.id:((I=T.value)==null?void 0:I.kind)==="attribute"?T.value.entityId:null}),O=n.ref(null);let fe=0;const w=n.ref(null),R=n.ref(null);let x=t.meta;function G(){i.onChange(()=>{m.value=i.canUndo,g.value=i.canRedo,_.value=i.isDirty})}G();let H=null,Z=null;function A(){Z==null||Z(),Z=null,H=null}function U(){if(A(),!$.value||!t.opTransport)return;const N=new hr({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:I=>{h.value=!1,R.value=I}});N.seed((x==null?void 0:x.revSeed)??{}),Z=N.attach(i),H=N}U();const Q=n.computed(()=>_a(o.logical,o.layout)),me=n.computed(()=>({reservedWords:d.value,selectableDataTypes:u.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:p.value,embeddableCatalog:l.value})),pe=n.computed(()=>Ta(o.logical,me.value)),de=n.computed(()=>{const N=new Map;for(const I of pe.value){if(!I.targetRef)continue;const v=N.get(I.targetRef);v?v.push(I):N.set(I.targetRef,[I])}return N}),q=N=>{h.value&&i.execute(N)},ce=(N,I,v)=>{const E=zt(N,I,v),C=yn(o.logical,N,B=>B.map(oe=>oe.modelId===I?{...oe,...v}:oe)),D=bn(C,N);q(D.length?Be("속성 수정",[E,...D]):E)};function Ee(N){const I=N.map(ie=>o.layout.entityLayouts.find(le=>le.entityRef===ie)).filter(ie=>!!ie);if(!I.length)return{location:{x:40,y:40},size:{width:400,height:300}};let v=1/0,E=1/0,C=-1/0,D=-1/0;for(const ie of I){const le=ie.geo.size.width||220,V=ie.geo.size.height||140;v=Math.min(v,ie.geo.location.x),E=Math.min(E,ie.geo.location.y),C=Math.max(C,ie.geo.location.x+le),D=Math.max(D,ie.geo.location.y+V)}const B=40,oe=28;return{location:{x:v-B,y:E-B-oe},size:{width:C-v+B*2,height:D-E+B*2+oe}}}function $e(N,I,v){var ie;const E=o.layout.groupLayouts.find(le=>le.groupRef===N),C=(E==null?void 0:E.geo.location)??I,D=I.x-C.x,B=I.y-C.y,oe=[Ha(N,I),...v.map(le=>an(le.id,le.location))];if(D||B){const le=new Set(((ie=o.logical.groups.find(V=>V.modelId===N))==null?void 0:ie.memberEntityRefs)??[]);for(const V of o.logical.associations){if(!le.has(V.end1.entityRef)||!le.has(V.end2.entityRef))continue;const M=o.layout.associationLayouts.find(y=>y.associationRef===V.modelId);M&&M.waypoints.length&&oe.push(er(V.modelId,D,B))}for(const V of(E==null?void 0:E.memberNoteRefs)??[]){const M=o.layout.notes.find(y=>y.modelId===V);M&&oe.push(Cn(V,{x:M.geo.location.x+D,y:M.geo.location.y+B}))}}return oe}return{state:o,resolved:Q,issues:pe,issuesByRef:de,flagEntitiesWithoutRelations:p,canUndo:m,canRedo:g,dirty:_,editable:h,schemaVersion:k,opWriteEnabled:b,opMode:$,opConflict:R,displayMode:S,routingMode:X,showGrid:W,showMinimap:J,selection:T,selectedAttr:ee,selectedAttrIds:F,inspectedEntityId:K,focusRequest:O,clipboard:w,embeddableCatalog:l,groupCodeCatalog:a,predefinedCustomTypeCatalog:r,languages:s,userLanguage:c,selectableDataTypes:u,setEditable(N){h.value=N&&$.value},setEmbeddableCatalog(N){l.value=N},setGroupCodeCatalog(N){a.value=N},setPredefinedCustomTypeCatalog(N){r.value=N},selectAttribute(N,I,v="replace"){const E=T.value,C=(E==null?void 0:E.kind)==="attribute"&&E.entityId===N;if(v==="replace"||!C){T.value={kind:"attribute",entityId:N,ids:[I],anchor:I};return}if(v==="toggle"){const M=E.ids.includes(I),y=M?E.ids.filter(ae=>ae!==I):[...E.ids,I];if(!y.length){T.value=null;return}const L=M&&E.anchor===I?y[y.length-1]:M?E.anchor:I;T.value={kind:"attribute",entityId:N,ids:y,anchor:L};return}const D=o.logical.entities.find(M=>M.modelId===N),B=[...(D==null?void 0:D.attributes)??[]].sort((M,y)=>M.order-y.order).map(M=>M.modelId),oe=B.indexOf(E.anchor),ie=B.indexOf(I);if(oe<0||ie<0){T.value={kind:"attribute",entityId:N,ids:[I],anchor:I};return}const[le,V]=oe<=ie?[oe,ie]:[ie,oe];T.value={kind:"attribute",entityId:N,ids:B.slice(le,V+1),anchor:E.anchor}},moveAttributeFocus(N){const I=T.value;if((I==null?void 0:I.kind)!=="attribute")return!1;const v=o.logical.entities.find(B=>B.modelId===I.entityId);if(!v||!v.attributes.length)return!1;const E=v.attributes.findIndex(B=>B.modelId===I.anchor);if(E<0)return!1;const C=Math.min(Math.max(E+N,0),v.attributes.length-1);if(C===E)return!0;const D=v.attributes[C].modelId;return T.value={kind:"attribute",entityId:I.entityId,ids:[D],anchor:D},!0},nudgeSelectedAttributes(N){const I=T.value;if((I==null?void 0:I.kind)!=="attribute")return!1;const v=o.logical.entities.find(M=>M.modelId===I.entityId);if(!v)return!1;const E=v.attributes,C=new Set(I.ids),D=E.map((M,y)=>C.has(M.modelId)?y:-1).filter(M=>M>=0);if(!D.length)return!1;const B=Math.min(...D),oe=E.filter(M=>!C.has(M.modelId)),ie=E.slice(0,B).filter(M=>!C.has(M.modelId)).length;let le;if(N<0){if(ie<=0)return!0;le=ie-1}else{if(oe.length-ie<=0)return!0;le=ie+1}const V=E.filter(M=>C.has(M.modelId)).map(M=>M.modelId);return q(Qi(I.entityId,V,le)),!0},deleteSelection(){if(!h.value)return!1;const N=T.value;if(!N)return!1;if(N.kind==="attribute"){const I=N.ids;if(!I.length)return!1;I.length===1?q(It(N.entityId,I[0])):q(Be("속성 삭제",I.map(v=>It(N.entityId,v))))}else N.kind==="entity"?q(Xi(N.id)):N.kind==="note"?q(nl(N.id)):N.kind==="group"?q(Ji(N.id)):q(tl(N.id));return T.value=null,!0},nudgeNodes(N,I,v){if(!N.length||I===0&&v===0)return!1;const E=new Set(o.logical.entities.map(le=>le.modelId)),C=new Set(o.logical.groups.map(le=>le.modelId)),D=new Set(o.layout.notes.map(le=>le.modelId)),B=new Set;for(const le of N){if(!C.has(le))continue;const V=o.logical.groups.find(M=>M.modelId===le);for(const M of(V==null?void 0:V.memberEntityRefs)??[])B.add(M)}const oe=[],ie=[];for(const le of N)if(C.has(le)){const V=o.layout.groupLayouts.find(ae=>ae.groupRef===le);if(!V)continue;const M=o.logical.groups.find(ae=>ae.modelId===le),y=((M==null?void 0:M.memberEntityRefs)??[]).map(ae=>{var ge;const ue=((ge=o.layout.entityLayouts.find(P=>P.entityRef===ae))==null?void 0:ge.geo.location)??{x:0,y:0};return{id:ae,location:{x:ue.x+I,y:ue.y+v}}}),L={x:V.geo.location.x+I,y:V.geo.location.y+v};oe.push(Be("그룹 이동",$e(le,L,y))),ie.push("g:"+le)}else if(E.has(le)){if(B.has(le))continue;const V=o.layout.entityLayouts.find(M=>M.entityRef===le);if(!V)continue;oe.push(an(le,{x:V.geo.location.x+I,y:V.geo.location.y+v})),ie.push("e:"+le)}else if(D.has(le)){const V=o.layout.notes.find(M=>M.modelId===le);if(!V)continue;oe.push(Cn(le,{x:V.geo.location.x+I,y:V.geo.location.y+v})),ie.push("n:"+le)}return oe.length?(q(Be("이동",oe,"nudge:"+ie.sort().join(","))),!0):!1},requestFocus(N){O.value={id:N,nonce:++fe}},undo:()=>{h.value&&i.undo()},redo:()=>{h.value&&i.redo()},markSaved:()=>{h.value&&(H==null||H.flush(),i.markSavePoint())},loadDiagram(N,I){A(),o.logical=N.logical,o.layout=N.layout,i=new Wi(o),G(),k.value=(I==null?void 0:I.schemaVersion)??1,b.value=(I==null?void 0:I.opWriteEnabled)??!1,h.value=!(k.value>=2&&b.value===!1),x=I,R.value=null,T.value=null,m.value=i.canUndo,g.value=i.canRedo,_.value=i.isDirty,U()},flush(){H==null||H.flush()},whenOpsSettled(){return(H==null?void 0:H.whenSettled())??Promise.resolve()},addEntity(N="NewEntity",I={x:80,y:80}){const v=Se(),E={modelId:v,name:N,stereotype:"JPA_ENTITY",table:{physicalName:N.toLowerCase()},attributes:[{modelId:Se(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Se(),physicalName:"id",dataType:"BIGINT"}]}]};return q(Ki(E,{location:{...I},size:{width:220,height:140}})),v},renameEntity(N,I){q(Da(N,I))},updateEntity(N,I){const v=Ba(N,I),E=o.logical.entities.find(B=>B.modelId===N),C=I.stereotype==="JPA_EMBEDDABLE"&&!!E&&E.stereotype!=="JPA_EMBEDDABLE",D=!!I.stereotype&&I.stereotype!=="JPA_EMBEDDABLE"&&!!E&&E.stereotype==="JPA_EMBEDDABLE";if(C&&E){const B=E.attributes.filter(M=>M.identifier&&!M.derivedFrom).map(M=>zt(N,M.modelId,{identifier:!1})),oe=yn({...o.logical,entities:o.logical.entities.map(M=>M.modelId===N?{...M,stereotype:"JPA_EMBEDDABLE"}:M)},N,M=>M.map(y=>y.identifier&&!y.derivedFrom?{...y,identifier:!1}:y)),ie=Wl(oe,N),le=wb(o.logical,N),V=[v,...B,...ie,...le];q(V.length>1?Be("임베더블 변환",V):v);return}if(D){const B=vb(o.logical,N),oe=[v,...B];q(oe.length>1?Be("엔터티 전환",oe):v);return}q(v)},moveEntity(N,I){q(an(N,I))},resizeEntity(N,I){q(Oa(N,I))},removeEntity(N){q(Xi(N))},setEntitySwatch(N,I){q(La(N,I))},setEntityCollapsed(N,I){q(Pa(N,I))},collapseAll(){q(Zi(!0))},expandAll(){q(Zi(!1))},setAttributeSwatch(N,I,v){q(vo(N,I,v))},dragGroup(N,I,v){q(Be("그룹 이동",$e(N,I,v)))},resizeGroup(N,I){q(Fa(N,I))},updateGroup(N,I){q(za(N,I))},createGroup(N,I){if(!N.length)return null;const v=[];for(const D of o.logical.groups)for(const B of N)D.memberEntityRefs.includes(B)&&v.push(wo(D.modelId,B));const E=Se(),C={modelId:E,name:I?{ko:I}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...N]};return v.push(ji(C,Ee(N))),q(Be("그룹 생성",v)),T.value=null,E},addEmptyGroup(N,I){const v=Se();return q(ji({modelId:v,name:I?{ko:I}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...N},size:{width:360,height:260}})),v},removeGroup(N){q(Ji(N))},dropEntity(N,I,v){var D;const E=((D=o.logical.groups.find(B=>B.memberEntityRefs.includes(N)))==null?void 0:D.modelId)??null,C=[an(N,I)];E!==v&&(E&&C.push(wo(E,N)),v&&C.push(Ua(v,N))),q(Be("이동",C))},ungroupEntity(N){const I=o.logical.groups.find(v=>v.memberEntityRefs.includes(N));I&&q(wo(I.modelId,N))},dropNote(N,I,v){var D;const E=((D=o.layout.groupLayouts.find(B=>{var oe;return(oe=B.memberNoteRefs)==null?void 0:oe.includes(N)}))==null?void 0:D.groupRef)??null,C=[Cn(N,I)];E!==v&&(E&&C.push(rr(E,N)),v&&C.push(ar(v,N))),q(Be("이동",C))},addPredefinedEmbed(N,I){const v=l.value.find(ie=>ie.type===I),E=o.logical.entities.find(ie=>ie.modelId===N);if(!v||!E)return;const C=E.attributes.reduce((ie,le)=>Math.max(ie,le.order),-1)+1,D=Se(),B=v.fields.map(()=>({modelId:Se(),physicalName:"",dataType:""})),oe={modelId:D,name:v.defaultName,type:v.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:C,dbAttrs:B};return q(yt(N,oe)),D},addAttribute(N,I={}){const v=o.logical.entities.find(V=>V.modelId===N),E=v?v.attributes.length:0,C=I.modelId??Se(),D=I.name??`field${E}`,B={modelId:C,name:D,type:I.type??Sa,attrType:I.attrType??"NORMAL",identifier:I.identifier??!1,notNull:I.notNull??!1,order:E,dbAttrs:I.dbAttrs??[{modelId:Se(),physicalName:D,dataType:"VARCHAR",length:255}],...I},oe=yt(N,B),ie=yn(o.logical,N,V=>[...V,B]),le=bn(ie,N);return q(le.length?Be("속성 추가",[oe,...le]):oe),C},addDivider(N){const I=o.logical.entities.find(D=>D.modelId===N),v=I?I.attributes.length:0,E=Se();return q(yt(N,{modelId:E,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:v,dbAttrs:[]})),E},updateAttribute(N,I,v){ce(N,I,v)},setAttributeGroupCode(N,I,v){ce(N,I,{groupCode:v,type:v?yo:Sa})},setEmbedColumns(N,I,v){var ie,le;const E=zt(N,I,{dbAttrs:v}),C=(ie=o.logical.entities.find(V=>V.modelId===N))==null?void 0:ie.attributes.find(V=>V.modelId===I),D=(le=C==null?void 0:C.embedded)==null?void 0:le.associationRef,B=D?o.logical.associations.find(V=>V.modelId===D):void 0,oe=[];B&&D&&(B.end1.legacyEmbedRaw&&oe.push(rn(D,"end1",{legacyEmbedRaw:void 0})),B.end2.legacyEmbedRaw&&oe.push(rn(D,"end2",{legacyEmbedRaw:void 0}))),q(oe.length?Be("임베드 컬럼 수정",[E,...oe]):E)},removeAttribute(N,I){const v=It(N,I),E=yn(o.logical,N,D=>D.filter(B=>B.modelId!==I)),C=bn(E,N);q(C.length?Be("속성 삭제",[v,...C]):v)},removeAttributes(N,I){var B;if(!I.length)return;const v=I.map(oe=>It(N,oe)),E=new Set(I),C=yn(o.logical,N,oe=>oe.filter(ie=>!E.has(ie.modelId))),D=[...v,...bn(C,N)];q(D.length===1?D[0]:Be("속성 삭제",D)),((B=T.value)==null?void 0:B.kind)==="attribute"&&T.value.entityId===N&&(T.value=null)},setAttributeSwatches(N,I,v){I.length&&(I.length===1?q(vo(N,I[0],v)):q(Be("속성 색상",I.map(E=>vo(N,E,v)))))},reorderAttributes(N,I,v){I.length&&q(Qi(N,I,v))},addIndex(N,I){q(qa(N,I))},updateIndex(N,I,v){q(Za(N,I,v))},removeIndex(N,I){q(ja(N,I))},addOperation(N,I={}){var B;const v=o.logical.entities.find(oe=>oe.modelId===N),E=((B=v==null?void 0:v.operations)==null?void 0:B.length)??0,C=I.modelId??Se(),D={modelId:C,name:I.name??`method${E}`,visibility:I.visibility??"PACKAGE",order:E,...I};return q(Ga(N,D)),C},updateOperation(N,I,v){q(Ya(N,I,v))},removeOperation(N,I){q(Wa(N,I))},reorderOperations(N,I,v){I.length&&q(Ka(N,I,v))},setOperationSwatch(N,I,v){q(Xa(N,I,v))},addAssociation(N,I,v,E){const C=Se(),D={modelId:C,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:v},end2:{entityRef:I,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},B={...o.logical,associations:[...o.logical.associations,D]},oe=di(B,I,Se),ie=oe.add[0];ie&&(D.end2.attributeRef=ie.modelId);const le={associationRef:C,waypoints:[],sourceColumnRef:v,targetColumnRef:(ie==null?void 0:ie.modelId)??E},V=el(D,le),M=ui(I,oe);return q(M.length?Be("관계 추가",[V,...M]):V),C},addEmbedAssociation(N,I){const v=o.logical.entities.find(ge=>ge.modelId===N),E=o.logical.entities.find(ge=>ge.modelId===I);if(!v||!E||E.stereotype!=="JPA_EMBEDDABLE")return;const C=Se(),D=Se(),B=Se(),oe=v.attributes.reduce((ge,P)=>Math.max(ge,P.order),-1)+1,ie=Bc(E),le=ge=>ge&&ge.charAt(0).toLowerCase()+ge.slice(1),V=new Set(v.attributes.map(ge=>ge.name)),M=le(E.name);let y=M;for(let ge=2;V.has(y);ge++)y=`${M}${ge}`;const L={modelId:D,name:y,type:E.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:oe,dbAttrs:ie,embedded:{associationRef:C,embeddableRef:I}},ae={modelId:C,end1:{entityRef:N,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:B},end2:{entityRef:I,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:D}},ue={associationRef:C,waypoints:[],sourceColumnRef:D,targetColumnRef:void 0};return q(Be("임베드 추가",[yt(N,L),el(ae,ue)])),C},setEmbedCollectionMode(N,I){const v=o.logical.associations.find(le=>le.modelId===N);if(!v)return;let E,C;for(const le of o.logical.entities){const V=le.attributes.find(M=>{var y;return((y=M.embedded)==null?void 0:y.associationRef)===N&&M.attrType==="EMBED_OWN"});if(V){E=le.modelId,C=V;break}}if(!E||!C)return;const D=C.embedded.embeddableRef,B=v.end2.entityRef===D?"end2":"end1",oe=v[B],ie=oe.multiplicity!=="EXACTLY_ONE_INSTANCE";if(!(I==="COLLECTION"?ie:!ie))if(I==="COLLECTION")q(Be("임베드 컬렉션 전환",[zt(E,C.modelId,{dbAttrs:[]}),rn(N,B,{multiplicity:"ZERO_OR_MORE_INSTANCES",jpa:{...oe.jpa,collectionType:"LIST"}})]));else{const le=o.logical.entities.find(V=>V.modelId===D);if(!le)return;q(Be("임베드 단일 전환",[zt(E,C.modelId,{dbAttrs:Bc(le)}),rn(N,B,{multiplicity:"EXACTLY_ONE_INSTANCE",jpa:{...oe.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(N){const I=o.logical.associations.find(B=>B.modelId===N),v=tl(N);if(!I){q(v);return}for(const B of o.logical.entities){const oe=B.attributes.find(ie=>{var le;return((le=ie.embedded)==null?void 0:le.associationRef)===N});if(oe){q(Be("임베드 삭제",[v,It(B.modelId,oe.modelId)]));return}}const E=I.end2.entityRef,C={...o.logical,associations:o.logical.associations.filter(B=>B.modelId!==N)},D=Wl(C,E);q(D.length?Be("관계 삭제",[v,...D]):v)},setAssociationIdentifying(N,I){const v=o.logical.associations.find(oe=>oe.modelId===N),E=Eo(N,{identifying:I});if(!v||v.identifying===I){q(E);return}const C=v.end2.entityRef,D={...o.logical,associations:o.logical.associations.map(oe=>oe.modelId===N?{...oe,identifying:I}:oe)},B=Wl(D,C);q(B.length?Be("식별 관계 변경",[E,...B]):E)},updateAssociationEnd(N,I,v){q(rn(N,I,v))},moveWaypoint(N,I,v){q(Ja(N,I,v))},addWaypoint(N,I,v){q(nr(N,I,v))},removeWaypoint(N,I){q(Qa(N,I))},clearWaypoints(N){q(tr(N))},addNote(N="메모",I={x:80,y:80}){const v=Se();return q(or({modelId:v,memo:N,geo:{location:{...I},size:{width:200,height:120}}})),v},removeNote(N){q(nl(N))},moveNote(N,I){q(Cn(N,I))},resizeNote(N,I){q(ir(N,I))},setNoteMemo(N,I){q(lr(N,I))},addNoteConnection(N,I){q(sr(N,I))},removeNoteConnection(N,I){q(cr(N,I))},moveNoteConnectionWaypoint(N,I,v,E){q(dr(N,I,v,E))},addNoteConnectionWaypoint(N,I,v,E){q(ur(N,I,v,E))},removeNoteConnectionWaypoint(N,I,v){q(fr(N,I,v))},clearNoteConnectionWaypoints(N,I){q(mr(N,I))},autoLayout(){const N=Ea(o.logical,o.layout);N.length&&q(Be("자동 배치",N.map(I=>an(I.id,I.location))))},copy(){const N=T.value;if((N==null?void 0:N.kind)==="attribute"){const D=o.logical.entities.find(oe=>oe.modelId===N.entityId);if(!D)return;const B=[...D.attributes].sort((oe,ie)=>oe.order-ie.order).filter(oe=>N.ids.includes(oe.modelId));if(!B.length)return;w.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:B}));return}const I=K.value;if(!I)return;const v=o.logical.entities.find(D=>D.modelId===I),E=o.layout.entityLayouts.find(D=>D.entityRef===I);if(!v)return;const C=(E==null?void 0:E.geo)??{location:{x:80,y:80},size:{width:220,height:140}};w.value=JSON.parse(JSON.stringify({kind:"entity",entity:v,geo:C}))},paste(){if(!h.value)return;const N=w.value;if(!N)return;if(N.kind==="attribute"){const E=K.value;if(!E)return;const C=o.logical.entities.find(V=>V.modelId===E);if(!C)return;const D=new Set(C.attributes.map(V=>V.name)),B=new Set(C.attributes.flatMap(V=>V.dbAttrs.map(M=>M.physicalName))),oe=C.attributes.length,ie=[],le=N.attributes.map((V,M)=>{const y=JSON.parse(JSON.stringify(V));y.modelId=Se();for(const L of y.dbAttrs)L.modelId=Se();D.has(y.name)&&(y.name=`${y.name}_copy`);for(const L of y.dbAttrs)L.physicalName&&B.has(L.physicalName)&&(L.physicalName=`${L.physicalName}_copy`);return y.order=oe+M,ie.push(y.modelId),yt(E,y)});q(le.length===1?le[0]:Be("속성 붙여넣기",le)),T.value={kind:"attribute",entityId:E,ids:ie,anchor:ie[ie.length-1]};return}const I=_b(N.entity),v={location:{x:N.geo.location.x+40,y:N.geo.location.y+40},size:{...N.geo.size}};q(Ki(I,v)),T.value={kind:"entity",id:I.modelId}}}}const fi=Symbol("groupHover"),Dc=Symbol("groupDrag"),_n=Symbol("relationHighlight"),Nb={key:0,class:"em-sel","aria-hidden":"true"},kb=["title","aria-expanded","disabled"],xb={class:"em-entity__stereotype"},$b={key:1,class:"em-entity__name"},Ib=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Sb=["onPointerdown"],Cb={key:1,class:"em-entity__divider-label"},Rb=["title"],Vb={class:"em-key-slot"},Ab={class:"em-key-slot"},Tb={key:0,class:"em-entity__type"},Mb=["onClick"],Bb={class:"em-entity__attrname"},Db={class:"em-entity__type"},Ob=["data-op"],Lb=["onPointerdown"],Pb={class:"em-entity__op-vis","aria-hidden":"true"},zb=["title"],Ub={key:4,class:"em-entity__footer"},Oc=Ae(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(Jt,null),i=te.useModal();function l(){o&&si(i,o,t.id)}const a=n.inject(fi,null),r=n.inject(_n,null),s=n.computed(()=>!!o&&o.editable.value);function c(){a&&(a.value=t.data.groupRef??null)}function d(){r==null||r.setEntityHover(t.id)}function u(){r==null||r.setEntityHover(null)}const f=n.computed(()=>!!r&&r.primaryEntityIds.value.has(t.id)),p=n.computed(()=>!!r&&r.relatedEntityIds.value.has(t.id)&&!f.value),m=n.computed(()=>{var j;return((j=o==null?void 0:o.selection.value)==null?void 0:j.kind)==="entity"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!m.value),_=n.computed(()=>{var j;return o&&((j=o.selectedAttr.value)==null?void 0:j.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),k=n.computed(()=>_.value.size>0);function b(j,ne){const se=ne.shiftKey?"range":ne.metaKey||ne.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,j.modelId,se)}const $=n.computed(()=>!!r&&r.active.value&&!r.relatedEntityIds.value.has(t.id)&&!m.value),h=n.computed(()=>t.data.entity),S=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),X=n.computed(()=>t.data.collapsed??!1);function W(){s.value&&(o==null||o.setEntityCollapsed(t.id,!X.value))}const J=n.computed(()=>S.value==="PHYSICAL"||S.value==="LOGICAL_PHYSICAL"),T=n.computed(()=>{const j=S.value==="PHYSICAL"||S.value==="LOGICAL_PHYSICAL",ne={};for(const se of h.value.attributes){const be=se.attrType.startsWith("RELATION")&&se.dbAttrs.length>0;ne[se.modelId]={pk:se.identifier,fk:be&&j}}return ne});function ee(j){return j?j.pk&&j.fk?"PFK (식별 외래키)":j.pk?"PK (기본키)":j.fk?"FK (외래키)":"":""}const F=n.computed(()=>{const j=Fl(tt(t.data.style)),ne={};return j&&(ne["--em-header-bg"]=j.bar,ne["--em-header-fg"]=j.barOn),ne});function K(j){var ne,se;return(se=Fl(tt((ne=t.data.attributeStyles)==null?void 0:ne[j.modelId])))==null?void 0:se.text}const O=n.computed(()=>[...h.value.operations??[]].sort((j,ne)=>j.order-ne.order)),fe=n.computed(()=>S.value==="CLASS"&&O.value.length>0),w={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function R(j){return j?w[j]:"~"}function x(j){var ne,se;return(se=Fl(tt((ne=t.data.operationStyles)==null?void 0:ne[j.modelId])))==null?void 0:se.text}function G(j,ne,se){switch(S.value){case"CLASS":return[{text:j}];case"PHYSICAL":return[{text:se||j}];case"LOGICAL":return[ne?{text:ne}:{text:"(논리명)",missing:!0}];default:{const be=ne?{text:ne}:{text:"(논리명)",missing:!0};return se?[be,{text:` · ${se}`}]:[be]}}}function H(j){var ne,se,be;return Z(j)?[{text:j.name}]:G(j.name,(se=(ne=j.dbAttrs[0])==null?void 0:ne.logicalName)==null?void 0:se.ko,((be=j.dbAttrs[0])==null?void 0:be.physicalName)??"")}function Z(j){return j.attrType.startsWith("EMBED")&&j.dbAttrs.length>0}function A(j){return j.attrType==="DIVIDER"}function U(j){if(j.attrType!=="EMBED_PREDEF")return j.dbAttrs;const ne=o==null?void 0:o.embeddableCatalog.value.find(be=>be.type===j.type);if(!ne)return j.dbAttrs;const se=$n(h.value.attributes.flatMap(be=>be.dbAttrs));return j.dbAttrs.map((be,re)=>{const we=ne.fields[re],Ie=bo(be,se);return Ie?{...be,physicalName:Ie.physicalName,logicalName:be.logicalName??(we==null?void 0:we.logicalName),dataType:be.dataType||(we==null?void 0:we.dataType)||""}:we?{...be,physicalName:be.physicalName||we.physicalName,logicalName:be.logicalName??we.logicalName,dataType:be.dataType||we.dataType,length:be.length??we.length}:be})}function Q(j){var ne;return G(j.physicalName,(ne=j.logicalName)==null?void 0:ne.ko,j.physicalName)}function me(j){const ne=Va(j,(o==null?void 0:o.state.logical.associations)??[]);return Fi(S.value,j,ne)}const pe=n.computed(()=>{var j,ne,se;return G(h.value.name,(ne=(j=h.value.table)==null?void 0:j.logicalName)==null?void 0:ne.ko,((se=h.value.table)==null?void 0:se.physicalName)??"")}),de=n.ref(!1),q=n.ref(""),ce=n.ref(null);async function Ee(){var j,ne;s.value&&(q.value=h.value.name,de.value=!0,await n.nextTick(),(j=ce.value)==null||j.focus(),(ne=ce.value)==null||ne.select())}function $e(){if(!de.value)return;de.value=!1;const j=q.value.trim();j&&j!==h.value.name&&(o==null||o.renameEntity(t.id,j))}function ke(){o==null||o.addAttribute(t.id)}function he(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:N,findNode:I}=Ce(),v=n.ref(null),E=n.computed(()=>{const j=v.value??t.data.size;return j?{width:`${j.width}px`,height:`${j.height}px`}:void 0});let C=null;function D(j){var be,re,we;if(!s.value)return;j.stopPropagation();const ne=(be=I(t.id))==null?void 0:be.dimensions,se=N({x:j.clientX,y:j.clientY});C={fx:se.x,fy:se.y,w:(ne==null?void 0:ne.width)??((re=t.data.size)==null?void 0:re.width)??200,h:(ne==null?void 0:ne.height)??((we=t.data.size)==null?void 0:we.height)??120},j.target.setPointerCapture(j.pointerId)}function B(j){if(!C)return;const ne=N({x:j.clientX,y:j.clientY});v.value={width:Math.max(40,C.w+(ne.x-C.fx)),height:Math.max(40,C.h+(ne.y-C.fy))}}function oe(j){var ne,se,be;if(C&&v.value&&o){const re=(ne=I(t.id))==null?void 0:ne.dimensions;o.resizeEntity(t.id,{width:Math.round((re==null?void 0:re.width)??v.value.width),height:Math.round((re==null?void 0:re.height)??v.value.height)})}C=null,v.value=null,(be=(se=j.target).releasePointerCapture)==null||be.call(se,j.pointerId)}const ie=n.ref(null),le=n.ref(null);function V(j,ne){if(!s.value)return;ne.stopPropagation(),ne.preventDefault();const se=_.value,be=se.has(j.modelId)?new Set(se):new Set([j.modelId]);le.value={ids:be,dropIndex:-1,lineY:0},ne.target.setPointerCapture(ne.pointerId)}function M(j){if(!le.value||!ie.value)return;const ne=Array.from(ie.value.querySelectorAll(".em-entity__row"));if(!ne.length)return;let se=ne.length;for(let we=0;we<ne.length;we++){const Ie=ne[we].getBoundingClientRect();if(j.clientY<Ie.top+Ie.height/2){se=we;break}}const be=ne[ne.length-1],re=se<ne.length?ne[se].offsetTop:be.offsetTop+be.offsetHeight;le.value={...le.value,dropIndex:se,lineY:re}}function y(){const j=le.value;if(le.value=null,!j||j.dropIndex<0)return;const ne=h.value.attributes,se=ne.filter(Re=>j.ids.has(Re.modelId)).map(Re=>Re.modelId),be=ne.filter((Re,Ze)=>j.ids.has(Re.modelId)&&Ze<j.dropIndex).length,re=j.dropIndex-be,we=ne.filter(Re=>!j.ids.has(Re.modelId)).map(Re=>Re.modelId);[...we.slice(0,re),...se,...we.slice(re)].join(",")!==ne.map(Re=>Re.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,se,re))}function L(){le.value=null}const ae=n.ref(null),ue=n.ref(null);function ge(j,ne){s.value&&(ne.stopPropagation(),ne.preventDefault(),ue.value={id:j.modelId,dropIndex:-1,lineY:0},ne.target.setPointerCapture(ne.pointerId))}function P(j){if(!ue.value||!ae.value)return;const ne=Array.from(ae.value.querySelectorAll(".em-entity__op-row"));if(!ne.length)return;let se=ne.length;for(let we=0;we<ne.length;we++){const Ie=ne[we].getBoundingClientRect();if(j.clientY<Ie.top+Ie.height/2){se=we;break}}const be=ne[ne.length-1],re=se<ne.length?ne[se].offsetTop:be.offsetTop+be.offsetHeight;ue.value={...ue.value,dropIndex:se,lineY:re}}function Y(){const j=ue.value;if(ue.value=null,!j||j.dropIndex<0)return;const se=O.value.findIndex(re=>re.modelId===j.id);if(se<0)return;const be=j.dropIndex-(se<j.dropIndex?1:0);be!==se&&(o==null||o.reorderOperations(t.id,[j.id],be))}function z(){ue.value=null}return(j,ne)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":$.value,"is-selected":m.value,"is-multi-selected":g.value,"has-focused-attr":k.value}]),style:n.normalizeStyle(E.value),onPointerdown:c,onMouseenter:d,onMouseleave:u,onDblclick:l},[m.value?(n.openBlock(),n.createElementBlock("div",Nb,[...ne[7]||(ne[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(F.value),onDblclick:n.withModifiers(Ee,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:X.value?"펼치기":"접기","aria-expanded":!X.value,disabled:!s.value,onClick:n.withModifiers(W,["stop"]),onPointerdown:ne[0]||(ne[0]=n.withModifiers(()=>{},["stop"])),onDblclick:ne[1]||(ne[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(X.value?"▸":"▾"),41,kb),n.createElementVNode("span",xb,"«"+n.toDisplayString(h.value.stereotype)+"»",1),de.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:ce,"onUpdate:modelValue":ne[2]||(ne[2]=se=>q.value=se),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys($e,["enter"]),ne[3]||(ne[3]=n.withKeys(se=>de.value=!1,["esc"]))],onBlur:$e,onPointerdown:ne[4]||(ne[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,q.value]]):(n.openBlock(),n.createElementBlock("span",$b,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(pe.value,(se,be)=>(n.openBlock(),n.createElementBlock("span",{key:be,class:n.normalizeClass({"em-entity__missing":se.missing})},n.toDisplayString(se.text),3))),128))]))],36),X.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:ie,class:"em-entity__attrs"},[le.value&&le.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${le.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.attributes,se=>{var be,re,we;return n.openBlock(),n.createElementBlock(n.Fragment,{key:se.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":_.value.has(se.modelId),"is-dragging":(be=le.value)==null?void 0:be.ids.has(se.modelId),"is-embed":Z(se),"is-divider":A(se),nodrag:A(se)&&s.value}]),"data-attr":se.modelId,onClick:n.withModifiers(Ie=>b(se,Ie),["stop"]),onPointerdown:Ie=>A(se)?V(se,Ie):void 0,onPointermove:Ie=>A(se)?M(Ie):void 0,onPointerup:Ie=>A(se)?y():void 0,onPointercancel:Ie=>A(se)?L():void 0},[s.value&&!A(se)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ie=>V(se,Ie),onPointermove:M,onPointerup:y,onPointercancel:L,onClick:ne[5]||(ne[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Sb)):n.createCommentVNode("",!0),A(se)?(n.openBlock(),n.createElementBlock("span",Cb,n.toDisplayString(se.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(qt),{id:`l:${se.modelId}`,type:"target",position:n.unref(ve).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:ee(T.value[se.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",Vb,[(re=T.value[se.modelId])!=null&&re.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",Ab,[Z(se)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(we=T.value[se.modelId])!=null&&we.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,Rb),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:K(se)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(H(se),(Ie,Re)=>(n.openBlock(),n.createElementBlock("span",{key:Re,class:n.normalizeClass({"em-entity__missing":Ie.missing})},n.toDisplayString(Ie.text),3))),128))],4),me(se)?(n.openBlock(),n.createElementBlock("span",Tb,n.toDisplayString(me(se)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(qt),{id:`r:${se.modelId}`,type:"source",position:n.unref(ve).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Ib),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Z(se)&&J.value?U(se):[],Ie=>(n.openBlock(),n.createElementBlock("li",{key:`${se.modelId}:${Ie.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":_.value.has(se.modelId)}]),onClick:n.withModifiers(Re=>b(se,Re),["stop"])},[ne[8]||(ne[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",Bb,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Q(Ie),(Re,Ze)=>(n.openBlock(),n.createElementBlock("span",{key:Ze,class:n.normalizeClass({"em-entity__missing":Re.missing})},n.toDisplayString(Re.text),3))),128))]),n.createElementVNode("span",Db,n.toDisplayString(Ie.dataType),1)],10,Mb))),128))],64)}),128))],512)),!X.value&&fe.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:ae,class:"em-entity__ops"},[ue.value&&ue.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${ue.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(O.value,se=>{var be;return n.openBlock(),n.createElementBlock("li",{key:se.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((be=ue.value)==null?void 0:be.id)===se.modelId}]),"data-op":se.modelId},[s.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:re=>ge(se,re),onPointermove:P,onPointerup:Y,onPointercancel:z,onClick:ne[6]||(ne[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,Lb)):n.createCommentVNode("",!0),n.createElementVNode("span",Pb,n.toDisplayString(R(se.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:x(se)})},n.toDisplayString(se.name)+"()",5)],10,Ob)}),128))],512)):O.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:`오퍼레이션 ${O.value.length}개 — 클래스 표시 모드에서 펼쳐 보입니다`},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,"오퍼레이션 "+n.toDisplayString(O.value.length)+"개",1)],8,zb)):n.createCommentVNode("",!0),s.value?(n.openBlock(),n.createElementBlock("footer",Ub,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ke},"+ 속성"),ne[9]||(ne[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:he},"+ 구분선")])):n.createCommentVNode("",!0),s.value&&!de.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:D,onPointermove:B,onPointerup:oe},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-1feee466"]]),Hb={key:0,class:"em-sel","aria-hidden":"true"},Fb={class:"em-group__label"},Gb={class:"em-group__name"},Yb={key:0,class:"em-group__pkg"},Wb={key:1,class:"em-group__flag"},Lc=Ae(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>tt(t.data.style)),l=n.computed(()=>i.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${i.value}-bar) 14%, transparent)`}:{}),a=n.inject(Jt,null),r=n.computed(()=>!!a&&a.editable.value),s=n.computed(()=>{var T;return!!t.id&&((T=a==null?void 0:a.selection.value)==null?void 0:T.kind)==="group"&&a.selection.value.id===t.id}),c=n.computed(()=>!!t.selected&&!s.value),d=n.inject(fi,null),u=n.computed(()=>!!t.id&&(d==null?void 0:d.value)===t.id),f=n.inject(_n,null);function p(){t.id&&(f==null||f.setGroupHover(t.id))}function m(){f==null||f.setGroupHover(null)}const g=n.computed(()=>!!f&&f.hoverGroupId.value===t.id),_=n.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==t.id),{screenToFlowCoordinate:k,findNode:b}=Ce();let $=null,h=null;function S(T){var K;if(!t.id||!r.value)return;T.stopPropagation();const ee=((K=b(t.id))==null?void 0:K.dimensions)??{width:400,height:300},F=k({x:T.clientX,y:T.clientY});$={fx:F.x,fy:F.y,w:ee.width,h:ee.height},T.target.setPointerCapture(T.pointerId)}function X(T){if(!$||!t.id)return;const ee=k({x:T.clientX,y:T.clientY});h={width:Math.max(160,$.w+(ee.x-$.fx)),height:Math.max(120,$.h+(ee.y-$.fy))};const F=b(t.id);F&&(F.style={width:`${h.width}px`,height:`${h.height}px`})}function W(T){var ee,F;$&&h&&t.id&&a&&a.resizeGroup(t.id,h),$=null,h=null,(F=(ee=T.target).releasePointerCapture)==null||F.call(ee,T.pointerId)}const J=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,ee)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":u.value,"is-hover-origin":g.value,"is-dimmed":_.value,"is-selected":s.value,"is-multi-selected":c.value}]),style:n.normalizeStyle(l.value),onMouseenter:p,onMouseleave:m},[s.value?(n.openBlock(),n.createElementBlock("div",Hb,[...ee[0]||(ee[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",Fb,[n.createElementVNode("span",Gb,n.toDisplayString(J.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",Yb,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",Wb,"DDL 제외")):n.createCommentVNode("",!0)]),r.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:S,onPointermove:X,onPointerup:W},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-461d87c2"]]),Kb={key:0,class:"em-sel","aria-hidden":"true"},Xb={key:2,class:"em-note__text"},Pc=Ae(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(Jt,null),i=n.inject(fi,null),l=n.inject(_n,null),a=n.computed(()=>t.data.note),r=n.computed(()=>!!o&&o.editable.value);function s(){i&&(i.value=t.data.groupRef??null)}function c(){l==null||l.setNoteHover(t.id)}function d(){l==null||l.setNoteHover(null)}const u=n.computed(()=>{var O;return((O=l==null?void 0:l.source.value)==null?void 0:O.kind)==="note"&&l.source.value.id===t.id}),f=n.computed(()=>!!l&&l.relatedNoteIds.value.has(t.id)&&!u.value),p=n.computed(()=>{var O;return((O=o==null?void 0:o.selection.value)==null?void 0:O.kind)==="note"&&o.selection.value.id===t.id}),m=n.computed(()=>!!t.selected&&!p.value),g=n.computed(()=>!!l&&l.active.value&&!l.relatedNoteIds.value.has(t.id)&&!p.value),_=[{id:"n-top",pos:ve.Top},{id:"n-right",pos:ve.Right},{id:"n-bottom",pos:ve.Bottom},{id:"n-left",pos:ve.Left}],k=n.ref(!1),b=n.ref(""),$=n.ref(null);async function h(){var O;r.value&&(b.value=a.value.memo,k.value=!0,await n.nextTick(),(O=$.value)==null||O.focus())}function S(){k.value&&(k.value=!1,b.value!==a.value.memo&&(o==null||o.setNoteMemo(t.id,b.value)))}const{screenToFlowCoordinate:X,findNode:W}=Ce();let J=null,T=null;function ee(O){var R;if(!r.value)return;O.stopPropagation();const fe=((R=W(t.id))==null?void 0:R.dimensions)??a.value.geo.size,w=X({x:O.clientX,y:O.clientY});J={fx:w.x,fy:w.y,w:fe.width,h:fe.height},O.target.setPointerCapture(O.pointerId)}function F(O){if(!J)return;const fe=X({x:O.clientX,y:O.clientY});T={width:Math.max(140,J.w+(fe.x-J.fx)),height:Math.max(60,J.h+(fe.y-J.fy))};const w=W(t.id);w&&(w.style={width:`${T.width}px`,height:`${T.height}px`})}function K(O){var fe,w;J&&T&&o&&o.resizeNote(t.id,T),J=null,T=null,(w=(fe=O.target).releasePointerCapture)==null||w.call(fe,O.pointerId)}return(O,fe)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":u.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":p.value,"is-multi-selected":m.value}]),onDblclick:h,onPointerdown:s,onMouseenter:c,onMouseleave:d},[p.value?(n.openBlock(),n.createElementBlock("div",Kb,[...fe[4]||(fe[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),k.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:$,"onUpdate:modelValue":fe[0]||(fe[0]=w=>b.value=w),class:"em-note__edit nodrag",onBlur:S,onKeydown:fe[1]||(fe[1]=n.withKeys(w=>k.value=!1,["esc"])),onPointerdown:fe[2]||(fe[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,b.value]]):(n.openBlock(),n.createElementBlock("div",Xb,n.toDisplayString(a.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(_,w=>n.createVNode(n.unref(qt),{id:w.id,key:w.id,type:"source",position:w.pos,class:"em-note-handle",onPointerdown:fe[3]||(fe[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),r.value&&!k.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:ee,onPointermove:F,onPointerup:K},null,32)):n.createCommentVNode("",!0)],34))}}),[["__scopeId","data-v-07983822"]]),qb=20,Zb=22,jb=7,Jb=22,zc=31,Uc=7,Qb=20,Hc=11,Fc=11,e_=zc+Uc;function t_(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function n_(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function mi(e,t,o){const i=t.x-e.x,l=t.y-e.y,a=Math.hypot(i,l)||1;return{x:e.x+i*o/a,y:e.y+l*o/a}}function Gc(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function pi(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function Yc(e,t,o,i){const l=i/2,a=e.x===t.x&&e.y===t.y?Math.PI/2:Gc(e,t);return[pi(o,l,a-Math.PI/2),pi(o,l,a+Math.PI/2)]}function Wc(e,t,o,i){const l=t*180/Math.PI,r=(l>=0?i?l-20:l+20:i?l+20:l-20)*Math.PI/180;return{x:Math.sin(r)*o+e.x,y:Math.cos(r)*o+e.y}}function Kc(e,t,o,i){const l=[],a=[],r=[];if(e.x===t.x&&e.y===t.y)return{lines:l,circles:a,polygons:r};if(i==="db"){const c=mi(e,t,qb),[d,u]=Yc(e,t,c,Zb);if(l.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),l.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),t_(o.multiplicity)){const f=mi(e,t,zc);a.push({cx:f.x,cy:f.y,r:Uc})}if(n_(o.multiplicity)){const f=mi(e,t,jb),[p,m]=Yc(e,t,f,Jb);l.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),l.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y}),l.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y})}return{lines:l,circles:a,polygons:r}}let s=e;if(o.composition){const c=mi(e,t,Qb),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Gc(e,t),f=pi(d,Hc/2,u-Math.PI/2),p=pi(d,Hc/2,u+Math.PI/2);r.push({points:[e,f,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=Wc(s,c,Fc,!0),u=Wc(s,c,Fc,!1);l.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),l.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:l,circles:a,polygons:r}}const Xc=200,qc=120,Kl=24;function Zc(e){var l,a;if(!e)return{x:0,y:0,width:Xc,height:qc};const t=e.computedPosition??e.position??{x:0,y:0},o=((l=e.dimensions)==null?void 0:l.width)||Xc,i=((a=e.dimensions)==null?void 0:a.height)||qc;return{x:t.x,y:t.y,width:o,height:i}}function jc(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Jc(e){const t=n.computed(()=>Zc(e.sourceNode())),o=n.computed(()=>Zc(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),l=n.computed(()=>{var m,g;const d=t.value,u=d.x+d.width;let f=((m=e.sourceRowY)==null?void 0:m.call(e))??d.y+d.height/3,p=((g=e.targetRowY)==null?void 0:g.call(e))??d.y+d.height*2/3;if(Math.abs(p-f)<Kl){const _=(f+p)/2;f=_-Kl/2,p=_+Kl/2}return{source:{x:u,y:f},target:{x:u,y:p}}}),a=n.computed(()=>e.waypoints()[0]??jc(o.value)),r=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??jc(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Pi(t.value,d,a.value.x):Li(t.value,a.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Pi(o.value,d,r.value.x):Li(o.value,r.value)});return{source:n.computed(()=>i.value?l.value.source:s.value.point),target:n.computed(()=>i.value?l.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 Xl=Symbol("waypointController"),o_=["d"],i_=["d"],l_=["d"],a_=["x1","y1","x2","y2"],r_=["cx","cy","r"],s_=["x","y"],c_=["x","y"],d_=["cx","cy","onDblclick"],u_=["x","y","onPointerdown","onDblclick"],Qc=Ae(n.defineComponent({__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ce(),i=n.inject(Xl),l=n.inject(Jt,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(Dc,null),s=n.inject(_n,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var he;return((he=l==null?void 0:l.selection.value)==null?void 0:he.kind)==="association"&&l.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),f=n.computed(()=>{const he=r==null?void 0:r.value;if(!he||!l)return null;const N=l.resolved.value.entities,I=E=>{var C;return(C=N.find(D=>D.entity.modelId===E))==null?void 0:C.groupRef},v=t.data.association;return I(v.end1.entityRef)===he.groupId&&I(v.end2.entityRef)===he.groupId?{dx:he.dx,dy:he.dy}:null}),p=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),m=n.ref(-1),g=n.ref({x:0,y:0}),_=n.computed(()=>{const he=f.value;return p.value.map((N,I)=>I===m.value?g.value:he?{x:N.x+he.dx,y:N.y+he.dy}:N)}),k=n.computed(()=>{var he;return!!((he=t.sourceNode.data)!=null&&he.collapsed)}),b=n.computed(()=>{var he;return!!((he=t.targetNode.data)!=null&&he.collapsed)}),{source:$,target:h,sourceSide:S,targetSide:X,isSelf:W}=Jc({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>_.value,sourceRowY:()=>t.data.sourceColumnRef&&!k.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),J=e_+4,T=n.computed(()=>W.value?wa($.value,h.value):(l==null?void 0:l.routingMode.value)==="orthogonal"?Bi($.value,S.value,_.value,h.value,X.value,J):Oi($.value,_.value,h.value)),ee=n.computed(()=>W.value||!a.value?[]:(l==null?void 0:l.routingMode.value)==="orthogonal"?Di($.value,S.value,_.value,h.value,X.value,J):zi($.value,_.value,h.value).map((he,N)=>({point:he,segIndex:N}))),F=n.computed(()=>W.value||!a.value?[]:_.value);function K(he){switch(he){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 O(he,N){m.value=he,g.value={...p.value[he]},N.target.setPointerCapture(N.pointerId),N.stopPropagation()}function fe(he){if(m.value<0)return;const N=o({x:he.clientX,y:he.clientY});g.value={x:N.x,y:N.y}}function w(he){var N,I;m.value>=0&&i&&i.movePoint(t.id,m.value,{...g.value}),m.value=-1,(I=(N=he.target).releasePointerCapture)==null||I.call(N,he.pointerId)}function R(he,N){N.stopPropagation(),i==null||i.removePoint(t.id,he)}function x(he,N){if(!i)return;const I=o({x:N.clientX,y:N.clientY});i.insertPoint(t.id,he,{x:I.x,y:I.y})}const G=n.computed(()=>K(t.data.association.end1.multiplicity)),H=n.computed(()=>K(t.data.association.end2.multiplicity)),Z=n.computed(()=>(l==null?void 0:l.displayMode.value)==="CLASS"?"class":"db"),A=n.computed(()=>Z.value==="class"),U=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const he=kn(S.value);return{x:$.value.x+he.x*10,y:$.value.y+he.y*10}}return _.value[0]??h.value}),Q=n.computed(()=>{if((l==null?void 0:l.routingMode.value)==="orthogonal"){const N=kn(X.value);return{x:h.value.x+N.x*10,y:h.value.y+N.y*10}}const he=_.value;return he[he.length-1]??$.value}),me=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end1.multiplicity,navigable:he.end1.navigable,composition:he.end1.composition,otherNavigable:he.end2.navigable}}),pe=n.computed(()=>{const he=t.data.association;return{multiplicity:he.end2.multiplicity,navigable:he.end2.navigable,composition:he.end2.composition,otherNavigable:he.end1.navigable}}),de=n.computed(()=>Kc($.value,U.value,me.value,Z.value)),q=n.computed(()=>Kc(h.value,Q.value,pe.value,Z.value)),ce=n.computed(()=>[...de.value.lines,...q.value.lines]),Ee=n.computed(()=>[...de.value.circles,...q.value.circles]),$e=n.computed(()=>[...de.value.polygons,...q.value.polygons].map(he=>`M${he.points.map(N=>`${N.x},${N.y}`).join(" L")} Z`)),ke=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(he,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:T.value,fill:"none",class:"em-edge__hit"},null,8,o_),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,i_),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($e.value,(I,v)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${v}`,d:I,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",ke.value])},null,10,l_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.value,(I,v)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${v}`,x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,class:n.normalizeClass(["em-edge__marker",ke.value])},null,10,a_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Ee.value,(I,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${v}`,cx:I.cx,cy:I.cy,r:I.r,class:n.normalizeClass(["em-edge__marker",ke.value])},null,10,r_))),128)),A.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref($).x+8,y:n.unref($).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(G.value),11,s_),n.createElementVNode("text",{x:n.unref(h).x-8,y:n.unref(h).y-6,"text-anchor":"end",class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(H.value),11,c_)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ee.value,(I,v)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${v}`,cx:I.point.x,cy:I.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(E=>x(I.segIndex,E),["stop"])},null,42,d_))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,(I,v)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${v}`,x:I.x-5,y:I.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:E=>O(v,E),onPointermove:fe,onPointerup:w,onDblclick:E=>R(v,E)},null,42,u_))),128))],64))}}),[["__scopeId","data-v-71d5ef34"]]);var Nt=(e=>(e.Lines="lines",e.Dots="dots",e))(Nt||{});const ed=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]}`})},td=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Nt.Lines+"",Nt.Dots+"";const f_={[Nt.Dots]:"#81818a",[Nt.Lines]:"#eee"},m_=["id","x","y","width","height","patternTransform"],p_={key:2,height:"100",width:"100"},h_=["fill"],g_=["x","y","fill"],y_={name:"Background",compatConfig:{MODE:3}},b_=n.defineComponent({...y_,props:{id:{},variant:{default:()=>Nt.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}=Ce(),i=n.computed(()=>{const r=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*r||1,c*r||1],u=e.size*r,[f,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],m=[f*r||1+d[0]/2,p*r||1+d[1]/2];return{scaledGap:d,offset:m,size:u}}),l=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),a=n.toRef(()=>e.color||e.patternColor||f_[e.variant||Nt.Dots]);return(r,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${r.height>100?100:r.height}%`,width:`${r.width>100?100:r.width}%`})},[n.renderSlot(r.$slots,"pattern-container",{id:l.value},()=>[n.createElementVNode("pattern",{id:l.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(r.$slots,"pattern",{},()=>[r.variant===n.unref(Nt).Lines?(n.openBlock(),n.createBlock(n.unref(ed),{key:0,size:r.lineWidth,color:a.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):r.variant===n.unref(Nt).Dots?(n.openBlock(),n.createBlock(n.unref(td),{key:1,color:a.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),r.bgColor?(n.openBlock(),n.createElementBlock("svg",p_,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:r.bgColor},null,8,h_)])):n.createCommentVNode("",!0)])],8,m_)]),n.createElementVNode("rect",{x:r.x,y:r.y,width:"100%",height:"100%",fill:`url(#${l.value})`},null,8,g_),n.renderSlot(r.$slots,"default",{id:l.value})],4))}}),__={name:"ControlButton",compatConfig:{MODE:3}},v_=(e,t)=>{const o=e.__vccOpts||e;for(const[i,l]of t)o[i]=l;return o},w_={type:"button",class:"vue-flow__controls-button"};function E_(e,t,o,i,l,a){return n.openBlock(),n.createElementBlock("button",w_,[n.renderSlot(e.$slots,"default")])}const hi=v_(__,[["render",E_]]),N_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},k_=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function x_(e,t){return n.openBlock(),n.createElementBlock("svg",N_,k_)}const $_={render:x_},I_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},S_=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function C_(e,t){return n.openBlock(),n.createElementBlock("svg",I_,S_)}const R_={render:C_},V_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},A_=[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 T_(e,t){return n.openBlock(),n.createElementBlock("svg",V_,A_)}const M_={render:T_},B_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},D_=[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 O_(e,t){return n.openBlock(),n.createElementBlock("svg",B_,D_)}const L_={render:O_},P_={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},z_=[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 U_(e,t){return n.openBlock(),n.createElementBlock("svg",P_,z_)}const H_={render:U_},F_={name:"Controls",compatConfig:{MODE:3}},G_=n.defineComponent({...F_,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Is.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:l,setInteractive:a,zoomIn:r,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:f}=Ce(),p=n.toRef(()=>o.value||i.value||l.value),m=n.toRef(()=>d.value.zoom<=u.value),g=n.toRef(()=>d.value.zoom>=f.value);function _(){r(),t("zoomIn")}function k(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function $(){a(!p.value),t("interactionChange",!p.value)}return(h,S)=>(n.openBlock(),n.createBlock(n.unref(xc),{class:"vue-flow__controls",position:h.position},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"top"),h.showZoom?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.renderSlot(h.$slots,"control-zoom-in",{},()=>[n.createVNode(hi,{class:"vue-flow__controls-zoomin",disabled:g.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref($_))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(hi,{class:"vue-flow__controls-zoomout",disabled:m.value,onClick:k},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(R_))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(hi,{class:"vue-flow__controls-fitview",onClick:b},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-fit-view",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(M_))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(hi,{key:0,class:"vue-flow__controls-interactive",onClick:$},{default:n.withCtx(()=>[p.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(H_))))]):n.createCommentVNode("",!0),p.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(L_))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Y_={value:()=>{}};function ql(){for(var e=0,t=arguments.length,o={},i;e<t;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new gi(o)}function gi(e){this._=e}function W_(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",l=o.indexOf(".");if(l>=0&&(i=o.slice(l+1),o=o.slice(0,l)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}gi.prototype=ql.prototype={constructor:gi,on:function(e,t){var o=this._,i=W_(e+"",o),l,a=-1,r=i.length;if(arguments.length<2){for(;++a<r;)if((l=(e=i[a]).type)&&(l=K_(o[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<r;)if(l=(e=i[a]).type)o[l]=nd(o[l],e.name,t);else if(t==null)for(l in o)o[l]=nd(o[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new gi(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var o=new Array(l),i=0,l,a;i<l;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,l=a.length;i<l;++i)a[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],l=0,a=i.length;l<a;++l)i[l].value.apply(t,o)}};function K_(e,t){for(var o=0,i=e.length,l;o<i;++o)if((l=e[o]).name===t)return l.value}function nd(e,t,o){for(var i=0,l=e.length;i<l;++i)if(e[i].name===t){e[i]=Y_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var Zl="http://www.w3.org/1999/xhtml";const od={svg:"http://www.w3.org/2000/svg",xhtml:Zl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),od.hasOwnProperty(t)?{space:od[t],local:e}:e}function X_(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Zl&&t.documentElement.namespaceURI===Zl?t.createElement(e):t.createElementNS(o,e)}}function q_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function id(e){var t=yi(e);return(t.local?q_:X_)(t)}function Z_(){}function jl(e){return e==null?Z_:function(){return this.querySelector(e)}}function j_(e){typeof e!="function"&&(e=jl(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=new Array(r),c,d,u=0;u<r;++u)(c=a[u])&&(d=e.call(c,c.__data__,u,a))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new qe(i,this._parents)}function J_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Q_(){return[]}function ld(e){return e==null?Q_:function(){return this.querySelectorAll(e)}}function ev(e){return function(){return J_(e.apply(this,arguments))}}function tv(e){typeof e=="function"?e=ev(e):e=ld(e);for(var t=this._groups,o=t.length,i=[],l=[],a=0;a<o;++a)for(var r=t[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&(i.push(e.call(c,c.__data__,d,r)),l.push(c));return new qe(i,l)}function ad(e){return function(){return this.matches(e)}}function rd(e){return function(t){return t.matches(e)}}var nv=Array.prototype.find;function ov(e){return function(){return nv.call(this.children,e)}}function iv(){return this.firstElementChild}function lv(e){return this.select(e==null?iv:ov(typeof e=="function"?e:rd(e)))}var av=Array.prototype.filter;function rv(){return Array.from(this.children)}function sv(e){return function(){return av.call(this.children,e)}}function cv(e){return this.selectAll(e==null?rv:sv(typeof e=="function"?e:rd(e)))}function dv(e){typeof e!="function"&&(e=ad(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new qe(i,this._parents)}function sd(e){return new Array(e.length)}function uv(){return new qe(this._enter||this._groups.map(sd),this._parents)}function bi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bi.prototype={constructor:bi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fv(e){return function(){return e}}function mv(e,t,o,i,l,a){for(var r=0,s,c=t.length,d=a.length;r<d;++r)(s=t[r])?(s.__data__=a[r],i[r]=s):o[r]=new bi(e,a[r]);for(;r<c;++r)(s=t[r])&&(l[r]=s)}function pv(e,t,o,i,l,a,r){var s,c,d=new Map,u=t.length,f=a.length,p=new Array(u),m;for(s=0;s<u;++s)(c=t[s])&&(p[s]=m=r.call(c,c.__data__,s,t)+"",d.has(m)?l[s]=c:d.set(m,c));for(s=0;s<f;++s)m=r.call(e,a[s],s,a)+"",(c=d.get(m))?(i[s]=c,c.__data__=a[s],d.delete(m)):o[s]=new bi(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(p[s])===c&&(l[s]=c)}function hv(e){return e.__data__}function gv(e,t){if(!arguments.length)return Array.from(this,hv);var o=t?pv:mv,i=this._parents,l=this._groups;typeof e!="function"&&(e=fv(e));for(var a=l.length,r=new Array(a),s=new Array(a),c=new Array(a),d=0;d<a;++d){var u=i[d],f=l[d],p=f.length,m=yv(e.call(u,u&&u.__data__,d,i)),g=m.length,_=s[d]=new Array(g),k=r[d]=new Array(g),b=c[d]=new Array(p);o(u,f,_,k,b,m,t);for(var $=0,h=0,S,X;$<g;++$)if(S=_[$]){for($>=h&&(h=$+1);!(X=k[h])&&++h<g;);S._next=X||null}}return r=new qe(r,i),r._enter=s,r._exit=c,r}function yv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bv(){return new qe(this._exit||this._groups.map(sd),this._parents)}function _v(e,t,o){var i=this.enter(),l=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),o==null?a.remove():o(a),i&&l?i.merge(l).order():l}function vv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,l=o.length,a=i.length,r=Math.min(l,a),s=new Array(l),c=0;c<r;++c)for(var d=o[c],u=i[c],f=d.length,p=s[c]=new Array(f),m,g=0;g<f;++g)(m=d[g]||u[g])&&(p[g]=m);for(;c<l;++c)s[c]=o[c];return new qe(s,this._parents)}function wv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],l=i.length-1,a=i[l],r;--l>=0;)(r=i[l])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function Ev(e){e||(e=Nv);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var o=this._groups,i=o.length,l=new Array(i),a=0;a<i;++a){for(var r=o[a],s=r.length,c=l[a]=new Array(s),d,u=0;u<s;++u)(d=r[u])&&(c[u]=d);c.sort(t)}return new qe(l,this._parents).order()}function Nv(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xv(){return Array.from(this)}function $v(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length;l<a;++l){var r=i[l];if(r)return r}return null}function Iv(){let e=0;for(const t of this)++e;return e}function Sv(){return!this.node()}function Cv(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var l=t[o],a=0,r=l.length,s;a<r;++a)(s=l[a])&&e.call(s,s.__data__,a,l);return this}function Rv(e){return function(){this.removeAttribute(e)}}function Vv(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Av(e,t){return function(){this.setAttribute(e,t)}}function Tv(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mv(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Bv(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 Dv(e,t){var o=yi(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((t==null?o.local?Vv:Rv:typeof t=="function"?o.local?Bv:Mv:o.local?Tv:Av)(o,t))}function cd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ov(e){return function(){this.style.removeProperty(e)}}function Lv(e,t,o){return function(){this.style.setProperty(e,t,o)}}function Pv(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function zv(e,t,o){return arguments.length>1?this.each((t==null?Ov:typeof t=="function"?Pv:Lv)(e,t,o??"")):vn(this.node(),e)}function vn(e,t){return e.style.getPropertyValue(t)||cd(e).getComputedStyle(e,null).getPropertyValue(t)}function Uv(e){return function(){delete this[e]}}function Hv(e,t){return function(){this[e]=t}}function Fv(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Gv(e,t){return arguments.length>1?this.each((t==null?Uv:typeof t=="function"?Fv:Hv)(e,t)):this.node()[e]}function dd(e){return e.trim().split(/^|\s+/)}function Jl(e){return e.classList||new ud(e)}function ud(e){this._node=e,this._names=dd(e.getAttribute("class")||"")}ud.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 fd(e,t){for(var o=Jl(e),i=-1,l=t.length;++i<l;)o.add(t[i])}function md(e,t){for(var o=Jl(e),i=-1,l=t.length;++i<l;)o.remove(t[i])}function Yv(e){return function(){fd(this,e)}}function Wv(e){return function(){md(this,e)}}function Kv(e,t){return function(){(t.apply(this,arguments)?fd:md)(this,e)}}function Xv(e,t){var o=dd(e+"");if(arguments.length<2){for(var i=Jl(this.node()),l=-1,a=o.length;++l<a;)if(!i.contains(o[l]))return!1;return!0}return this.each((typeof t=="function"?Kv:t?Yv:Wv)(o,t))}function qv(){this.textContent=""}function Zv(e){return function(){this.textContent=e}}function jv(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jv(e){return arguments.length?this.each(e==null?qv:(typeof e=="function"?jv:Zv)(e)):this.node().textContent}function Qv(){this.innerHTML=""}function ew(e){return function(){this.innerHTML=e}}function tw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nw(e){return arguments.length?this.each(e==null?Qv:(typeof e=="function"?tw:ew)(e)):this.node().innerHTML}function ow(){this.nextSibling&&this.parentNode.appendChild(this)}function iw(){return this.each(ow)}function lw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function aw(){return this.each(lw)}function rw(e){var t=typeof e=="function"?e:id(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function sw(){return null}function cw(e,t){var o=typeof e=="function"?e:id(e),i=t==null?sw:typeof t=="function"?t:jl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function dw(){var e=this.parentNode;e&&e.removeChild(this)}function uw(){return this.each(dw)}function fw(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mw(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pw(e){return this.select(e?mw:fw)}function hw(e){return arguments.length?this.property("__data__",e):this.node().__data__}function gw(e){return function(t){e.call(this,t,this.__data__)}}function yw(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 bw(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,l=t.length,a;o<l;++o)a=t[o],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function _w(e,t,o){return function(){var i=this.__on,l,a=gw(t);if(i){for(var r=0,s=i.length;r<s;++r)if((l=i[r]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=o),l.value=t;return}}this.addEventListener(e.type,a,o),l={type:e.type,name:e.name,value:t,listener:a,options:o},i?i.push(l):this.__on=[l]}}function vw(e,t,o){var i=yw(e+""),l,a=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(l=0,u=s[c];l<a;++l)if((r=i[l]).type===u.type&&r.name===u.name)return u.value}return}for(s=t?_w:bw,l=0;l<a;++l)this.each(s(i[l],t,o));return this}function pd(e,t,o){var i=cd(e),l=i.CustomEvent;typeof l=="function"?l=new l(t,o):(l=i.document.createEvent("Event"),o?(l.initEvent(t,o.bubbles,o.cancelable),l.detail=o.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function ww(e,t){return function(){return pd(this,e,t)}}function Ew(e,t){return function(){return pd(this,e,t.apply(this,arguments))}}function Nw(e,t){return this.each((typeof t=="function"?Ew:ww)(e,t))}function*kw(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],l=0,a=i.length,r;l<a;++l)(r=i[l])&&(yield r)}var hd=[null];function qe(e,t){this._groups=e,this._parents=t}function jn(){return new qe([[document.documentElement]],hd)}function xw(){return this}qe.prototype=jn.prototype={constructor:qe,select:j_,selectAll:tv,selectChild:lv,selectChildren:cv,filter:dv,data:gv,enter:uv,exit:bv,join:_v,merge:vv,selection:xw,order:wv,sort:Ev,call:kv,nodes:xv,node:$v,size:Iv,empty:Sv,each:Cv,attr:Dv,style:zv,property:Gv,classed:Xv,text:Jv,html:nw,raise:iw,lower:aw,append:rw,insert:cw,remove:uw,clone:pw,datum:hw,on:vw,dispatch:Nw,[Symbol.iterator]:kw};function Mt(e){return typeof e=="string"?new qe([[document.querySelector(e)]],[document.documentElement]):new qe([[e]],hd)}function $w(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Bt(e,t){if(e=$w(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ql={capture:!0,passive:!1};function ea(e){e.preventDefault(),e.stopImmediatePropagation()}function Iw(e){var t=e.document.documentElement,o=Mt(e).on("dragstart.drag",ea,Ql);"onselectstart"in t?o.on("selectstart.drag",ea,Ql):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Sw(e,t){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);t&&(i.on("click.drag",ea,Ql),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 ta(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function gd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Jn(){}var Qn=.7,_i=1/Qn,wn="\\s*([+-]?\\d+)\\s*",eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Cw=/^#([0-9a-f]{3,8})$/,Rw=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Vw=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Aw=new RegExp(`^rgba\\(${wn},${wn},${wn},${eo}\\)$`),Tw=new RegExp(`^rgba\\(${pt},${pt},${pt},${eo}\\)$`),Mw=new RegExp(`^hsl\\(${eo},${pt},${pt}\\)$`),Bw=new RegExp(`^hsla\\(${eo},${pt},${pt},${eo}\\)$`),yd={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};ta(Jn,to,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bd,formatHex:bd,formatHex8:Dw,formatHsl:Ow,formatRgb:_d,toString:_d});function bd(){return this.rgb().formatHex()}function Dw(){return this.rgb().formatHex8()}function Ow(){return kd(this).formatHsl()}function _d(){return this.rgb().formatRgb()}function to(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Cw.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?vd(t):o===3?new We(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?vi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?vi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Rw.exec(e))?new We(t[1],t[2],t[3],1):(t=Vw.exec(e))?new We(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Aw.exec(e))?vi(t[1],t[2],t[3],t[4]):(t=Tw.exec(e))?vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Mw.exec(e))?Nd(t[1],t[2]/100,t[3]/100,1):(t=Bw.exec(e))?Nd(t[1],t[2]/100,t[3]/100,t[4]):yd.hasOwnProperty(e)?vd(yd[e]):e==="transparent"?new We(NaN,NaN,NaN,0):null}function vd(e){return new We(e>>16&255,e>>8&255,e&255,1)}function vi(e,t,o,i){return i<=0&&(e=t=o=NaN),new We(e,t,o,i)}function Lw(e){return e instanceof Jn||(e=to(e)),e?(e=e.rgb(),new We(e.r,e.g,e.b,e.opacity)):new We}function na(e,t,o,i){return arguments.length===1?Lw(e):new We(e,t,o,i??1)}function We(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}ta(We,na,gd(Jn,{brighter(e){return e=e==null?_i:Math.pow(_i,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qn:Math.pow(Qn,e),new We(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new We(Qt(this.r),Qt(this.g),Qt(this.b),wi(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:wd,formatHex:wd,formatHex8:Pw,formatRgb:Ed,toString:Ed}));function wd(){return`#${en(this.r)}${en(this.g)}${en(this.b)}`}function Pw(){return`#${en(this.r)}${en(this.g)}${en(this.b)}${en((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ed(){const e=wi(this.opacity);return`${e===1?"rgb(":"rgba("}${Qt(this.r)}, ${Qt(this.g)}, ${Qt(this.b)}${e===1?")":`, ${e})`}`}function wi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Qt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function en(e){return e=Qt(e),(e<16?"0":"")+e.toString(16)}function Nd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new nt(e,t,o,i)}function kd(e){if(e instanceof nt)return new nt(e.h,e.s,e.l,e.opacity);if(e instanceof Jn||(e=to(e)),!e)return new nt;if(e instanceof nt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,l=Math.min(t,o,i),a=Math.max(t,o,i),r=NaN,s=a-l,c=(a+l)/2;return s?(t===a?r=(o-i)/s+(o<i)*6:o===a?r=(i-t)/s+2:r=(t-o)/s+4,s/=c<.5?a+l:2-a-l,r*=60):s=c>0&&c<1?0:r,new nt(r,s,c,e.opacity)}function zw(e,t,o,i){return arguments.length===1?kd(e):new nt(e,t,o,i??1)}function nt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}ta(nt,zw,gd(Jn,{brighter(e){return e=e==null?_i:Math.pow(_i,e),new nt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qn:Math.pow(Qn,e),new nt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,l=2*o-i;return new We(oa(e>=240?e-240:e+120,l,i),oa(e,l,i),oa(e<120?e+240:e-120,l,i),this.opacity)},clamp(){return new nt(xd(this.h),Ei(this.s),Ei(this.l),wi(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=wi(this.opacity);return`${e===1?"hsl(":"hsla("}${xd(this.h)}, ${Ei(this.s)*100}%, ${Ei(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xd(e){return e=(e||0)%360,e<0?e+360:e}function Ei(e){return Math.max(0,Math.min(1,e||0))}function oa(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 $d=e=>()=>e;function Uw(e,t){return function(o){return e+o*t}}function Hw(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 Fw(e){return(e=+e)==1?Id:function(t,o){return o-t?Hw(t,o,e):$d(isNaN(t)?o:t)}}function Id(e,t){var o=t-e;return o?Uw(e,o):$d(isNaN(e)?t:e)}const Sd=(function e(t){var o=Fw(t);function i(l,a){var r=o((l=na(l)).r,(a=na(a)).r),s=o(l.g,a.g),c=o(l.b,a.b),d=Id(l.opacity,a.opacity);return function(u){return l.r=r(u),l.g=s(u),l.b=c(u),l.opacity=d(u),l+""}}return i.gamma=e,i})(1);function Dt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var ia=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,la=new RegExp(ia.source,"g");function Gw(e){return function(){return e}}function Yw(e){return function(t){return e(t)+""}}function Ww(e,t){var o=ia.lastIndex=la.lastIndex=0,i,l,a,r=-1,s=[],c=[];for(e=e+"",t=t+"";(i=ia.exec(e))&&(l=la.exec(t));)(a=l.index)>o&&(a=t.slice(o,a),s[r]?s[r]+=a:s[++r]=a),(i=i[0])===(l=l[0])?s[r]?s[r]+=l:s[++r]=l:(s[++r]=null,c.push({i:r,x:Dt(i,l)})),o=la.lastIndex;return o<t.length&&(a=t.slice(o),s[r]?s[r]+=a:s[++r]=a),s.length<2?c[0]?Yw(c[0].x):Gw(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 Cd=180/Math.PI,aa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Rd(e,t,o,i,l,a){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:l,translateY:a,rotate:Math.atan2(t,e)*Cd,skewX:Math.atan(c)*Cd,scaleX:r,scaleY:s}}var Ni;function Kw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?aa:Rd(t.a,t.b,t.c,t.d,t.e,t.f)}function Xw(e){return e==null||(Ni||(Ni=document.createElementNS("http://www.w3.org/2000/svg","g")),Ni.setAttribute("transform",e),!(e=Ni.transform.baseVal.consolidate()))?aa:(e=e.matrix,Rd(e.a,e.b,e.c,e.d,e.e,e.f))}function Vd(e,t,o,i){function l(d){return d.length?d.pop()+" ":""}function a(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push("translate(",null,t,null,o);g.push({i:_-4,x:Dt(d,f)},{i:_-2,x:Dt(u,p)})}else(f||p)&&m.push("translate("+f+t+p+o)}function r(d,u,f,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:f.push(l(f)+"rotate(",null,i)-2,x:Dt(d,u)})):u&&f.push(l(f)+"rotate("+u+i)}function s(d,u,f,p){d!==u?p.push({i:f.push(l(f)+"skewX(",null,i)-2,x:Dt(d,u)}):u&&f.push(l(f)+"skewX("+u+i)}function c(d,u,f,p,m,g){if(d!==f||u!==p){var _=m.push(l(m)+"scale(",null,",",null,")");g.push({i:_-4,x:Dt(d,f)},{i:_-2,x:Dt(u,p)})}else(f!==1||p!==1)&&m.push(l(m)+"scale("+f+","+p+")")}return function(d,u){var f=[],p=[];return d=e(d),u=e(u),a(d.translateX,d.translateY,u.translateX,u.translateY,f,p),r(d.rotate,u.rotate,f,p),s(d.skewX,u.skewX,f,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,f,p),d=u=null,function(m){for(var g=-1,_=p.length,k;++g<_;)f[(k=p[g]).i]=k.x(m);return f.join("")}}}var qw=Vd(Kw,"px, ","px)","deg)"),Zw=Vd(Xw,", ",")",")"),jw=1e-12;function Ad(e){return((e=Math.exp(e))+1/e)/2}function Jw(e){return((e=Math.exp(e))-1/e)/2}function Qw(e){return((e=Math.exp(2*e))-1)/(e+1)}const eE=(function e(t,o,i){function l(a,r){var s=a[0],c=a[1],d=a[2],u=r[0],f=r[1],p=r[2],m=u-s,g=f-c,_=m*m+g*g,k,b;if(_<jw)b=Math.log(p/d)/t,k=function(J){return[s+J*m,c+J*g,d*Math.exp(t*J*b)]};else{var $=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*$),S=(p*p-d*d-i*_)/(2*p*o*$),X=Math.log(Math.sqrt(h*h+1)-h),W=Math.log(Math.sqrt(S*S+1)-S);b=(W-X)/t,k=function(J){var T=J*b,ee=Ad(X),F=d/(o*$)*(ee*Qw(t*T+X)-Jw(X));return[s+F*m,c+F*g,d*ee/Ad(t*T+X)]}}return k.duration=b*1e3*t/Math.SQRT2,k}return l.rho=function(a){var r=Math.max(.001,+a),s=r*r,c=s*s;return e(r,s,c)},l})(Math.SQRT2,2,4);var En=0,no=0,oo=0,Td=1e3,ki,io,xi=0,tn=0,$i=0,lo=typeof performance=="object"&&performance.now?performance:Date,Md=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ra(){return tn||(Md(tE),tn=lo.now()+$i)}function tE(){tn=0}function Ii(){this._call=this._time=this._next=null}Ii.prototype=Bd.prototype={constructor:Ii,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ra():+o)+(t==null?0:+t),!this._next&&io!==this&&(io?io._next=this:ki=this,io=this),this._call=e,this._time=o,sa()},stop:function(){this._call&&(this._call=null,this._time=1/0,sa())}};function Bd(e,t,o){var i=new Ii;return i.restart(e,t,o),i}function nE(){ra(),++En;for(var e=ki,t;e;)(t=tn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--En}function Dd(){tn=(xi=lo.now())+$i,En=no=0;try{nE()}finally{En=0,iE(),tn=0}}function oE(){var e=lo.now(),t=e-xi;t>Td&&($i-=t,xi=e)}function iE(){for(var e,t=ki,o,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:ki=o);io=e,sa(i)}function sa(e){if(!En){no&&(no=clearTimeout(no));var t=e-tn;t>24?(e<1/0&&(no=setTimeout(Dd,e-lo.now()-$i)),oo&&(oo=clearInterval(oo))):(oo||(xi=lo.now(),oo=setInterval(oE,Td)),En=1,Md(Dd))}}function Od(e,t,o){var i=new Ii;return t=t==null?0:+t,i.restart(l=>{i.stop(),e(l+t)},t,o),i}var lE=ql("start","end","cancel","interrupt"),aE=[],Ld=0,Pd=1,ca=2,Si=3,zd=4,da=5,Ci=6;function Ri(e,t,o,i,l,a){var r=e.__transition;if(!r)e.__transition={};else if(o in r)return;rE(e,o,{name:t,index:i,group:l,on:lE,tween:aE,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Ld})}function ua(e,t){var o=ot(e,t);if(o.state>Ld)throw new Error("too late; already scheduled");return o}function ht(e,t){var o=ot(e,t);if(o.state>Si)throw new Error("too late; already running");return o}function ot(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function rE(e,t,o){var i=e.__transition,l;i[t]=o,o.timer=Bd(a,0,o.time);function a(d){o.state=Pd,o.timer.restart(r,o.delay,o.time),o.delay<=d&&r(d-o.delay)}function r(d){var u,f,p,m;if(o.state!==Pd)return c();for(u in i)if(m=i[u],m.name===o.name){if(m.state===Si)return Od(r);m.state===zd?(m.state=Ci,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[u]):+u<t&&(m.state=Ci,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete i[u])}if(Od(function(){o.state===Si&&(o.state=zd,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ca,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ca){for(o.state=Si,l=new Array(p=o.tween.length),u=0,f=-1;u<p;++u)(m=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(l[++f]=m);l.length=f+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=da,1),f=-1,p=l.length;++f<p;)l[f].call(e,u);o.state===da&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ci,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Vi(e,t){var o=e.__transition,i,l,a=!0,r;if(o){t=t==null?null:t+"";for(r in o){if((i=o[r]).name!==t){a=!1;continue}l=i.state>ca&&i.state<da,i.state=Ci,i.timer.stop(),i.on.call(l?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[r]}a&&delete e.__transition}}function sE(e){return this.each(function(){Vi(this,e)})}function cE(e,t){var o,i;return function(){var l=ht(this,e),a=l.tween;if(a!==o){i=o=a;for(var r=0,s=i.length;r<s;++r)if(i[r].name===t){i=i.slice(),i.splice(r,1);break}}l.tween=i}}function dE(e,t,o){var i,l;if(typeof o!="function")throw new Error;return function(){var a=ht(this,e),r=a.tween;if(r!==i){l=(i=r).slice();for(var s={name:t,value:o},c=0,d=l.length;c<d;++c)if(l[c].name===t){l[c]=s;break}c===d&&l.push(s)}a.tween=l}}function uE(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=ot(this.node(),o).tween,l=0,a=i.length,r;l<a;++l)if((r=i[l]).name===e)return r.value;return null}return this.each((t==null?cE:dE)(o,e,t))}function fa(e,t,o){var i=e._id;return e.each(function(){var l=ht(this,i);(l.value||(l.value={}))[t]=o.apply(this,arguments)}),function(l){return ot(l,i).value[t]}}function Ud(e,t){var o;return(typeof t=="number"?Dt:t instanceof to?Sd:(o=to(t))?(t=o,Sd):Ww)(e,t)}function fE(e){return function(){this.removeAttribute(e)}}function mE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pE(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttribute(e);return r===l?null:r===i?a:a=t(i=r,o)}}function hE(e,t,o){var i,l=o+"",a;return function(){var r=this.getAttributeNS(e.space,e.local);return r===l?null:r===i?a:a=t(i=r,o)}}function gE(e,t,o){var i,l,a;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===l?a:(l=c,a=t(i=r,s)))}}function yE(e,t,o){var i,l,a;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===l?a:(l=c,a=t(i=r,s)))}}function bE(e,t){var o=yi(e),i=o==="transform"?Zw:Ud;return this.attrTween(e,typeof t=="function"?(o.local?yE:gE)(o,i,fa(this,"attr."+e,t)):t==null?(o.local?mE:fE)(o):(o.local?hE:pE)(o,i,t))}function _E(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function vE(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function wE(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&vE(e,a)),o}return l._value=t,l}function EE(e,t){var o,i;function l(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&_E(e,a)),o}return l._value=t,l}function NE(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var i=yi(e);return this.tween(o,(i.local?wE:EE)(i,t))}function kE(e,t){return function(){ua(this,e).delay=+t.apply(this,arguments)}}function xE(e,t){return t=+t,function(){ua(this,e).delay=t}}function $E(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kE:xE)(t,e)):ot(this.node(),t).delay}function IE(e,t){return function(){ht(this,e).duration=+t.apply(this,arguments)}}function SE(e,t){return t=+t,function(){ht(this,e).duration=t}}function CE(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?IE:SE)(t,e)):ot(this.node(),t).duration}function RE(e,t){if(typeof t!="function")throw new Error;return function(){ht(this,e).ease=t}}function VE(e){var t=this._id;return arguments.length?this.each(RE(t,e)):ot(this.node(),t).ease}function AE(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;ht(this,e).ease=o}}function TE(e){if(typeof e!="function")throw new Error;return this.each(AE(this._id,e))}function ME(e){typeof e!="function"&&(e=ad(e));for(var t=this._groups,o=t.length,i=new Array(o),l=0;l<o;++l)for(var a=t[l],r=a.length,s=i[l]=[],c,d=0;d<r;++d)(c=a[d])&&e.call(c,c.__data__,d,a)&&s.push(c);return new kt(i,this._parents,this._name,this._id)}function BE(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,l=o.length,a=Math.min(i,l),r=new Array(i),s=0;s<a;++s)for(var c=t[s],d=o[s],u=c.length,f=r[s]=new Array(u),p,m=0;m<u;++m)(p=c[m]||d[m])&&(f[m]=p);for(;s<i;++s)r[s]=t[s];return new kt(r,this._parents,this._name,this._id)}function DE(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 OE(e,t,o){var i,l,a=DE(t)?ua:ht;return function(){var r=a(this,e),s=r.on;s!==i&&(l=(i=s).copy()).on(t,o),r.on=l}}function LE(e,t){var o=this._id;return arguments.length<2?ot(this.node(),o).on.on(e):this.each(OE(o,e,t))}function PE(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function zE(){return this.on("end.remove",PE(this._id))}function UE(e){var t=this._name,o=this._id;typeof e!="function"&&(e=jl(e));for(var i=this._groups,l=i.length,a=new Array(l),r=0;r<l;++r)for(var s=i[r],c=s.length,d=a[r]=new Array(c),u,f,p=0;p<c;++p)(u=s[p])&&(f=e.call(u,u.__data__,p,s))&&("__data__"in u&&(f.__data__=u.__data__),d[p]=f,Ri(d[p],t,o,p,d,ot(u,o)));return new kt(a,this._parents,t,o)}function HE(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ld(e));for(var i=this._groups,l=i.length,a=[],r=[],s=0;s<l;++s)for(var c=i[s],d=c.length,u,f=0;f<d;++f)if(u=c[f]){for(var p=e.call(u,u.__data__,f,c),m,g=ot(u,o),_=0,k=p.length;_<k;++_)(m=p[_])&&Ri(m,t,o,_,p,g);a.push(p),r.push(u)}return new kt(a,r,t,o)}var FE=jn.prototype.constructor;function GE(){return new FE(this._groups,this._parents)}function YE(e,t){var o,i,l;return function(){var a=vn(this,e),r=(this.style.removeProperty(e),vn(this,e));return a===r?null:a===o&&r===i?l:l=t(o=a,i=r)}}function Hd(e){return function(){this.style.removeProperty(e)}}function WE(e,t,o){var i,l=o+"",a;return function(){var r=vn(this,e);return r===l?null:r===i?a:a=t(i=r,o)}}function KE(e,t,o){var i,l,a;return function(){var r=vn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),vn(this,e))),r===c?null:r===i&&c===l?a:(l=c,a=t(i=r,s))}}function XE(e,t){var o,i,l,a="style."+t,r="end."+a,s;return function(){var c=ht(this,e),d=c.on,u=c.value[a]==null?s||(s=Hd(t)):void 0;(d!==o||l!==u)&&(i=(o=d).copy()).on(r,l=u),c.on=i}}function qE(e,t,o){var i=(e+="")=="transform"?qw:Ud;return t==null?this.styleTween(e,YE(e,i)).on("end.style."+e,Hd(e)):typeof t=="function"?this.styleTween(e,KE(e,i,fa(this,"style."+e,t))).each(XE(this._id,e)):this.styleTween(e,WE(e,i,t),o).on("end.style."+e,null)}function ZE(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function jE(e,t,o){var i,l;function a(){var r=t.apply(this,arguments);return r!==l&&(i=(l=r)&&ZE(e,r,o)),i}return a._value=t,a}function JE(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,jE(e,t,o??""))}function QE(e){return function(){this.textContent=e}}function eN(e){return function(){var t=e(this);this.textContent=t??""}}function tN(e){return this.tween("text",typeof e=="function"?eN(fa(this,"text",e)):QE(e==null?"":e+""))}function nN(e){return function(t){this.textContent=e.call(this,t)}}function oN(e){var t,o;function i(){var l=e.apply(this,arguments);return l!==o&&(t=(o=l)&&nN(l)),t}return i._value=e,i}function iN(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oN(e))}function lN(){for(var e=this._name,t=this._id,o=Fd(),i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)if(c=r[d]){var u=ot(c,t);Ri(c,e,o,d,r,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new kt(i,this._parents,e,o)}function aN(){var e,t,o=this,i=o._id,l=o.size();return new Promise(function(a,r){var s={value:r},c={value:function(){--l===0&&a()}};o.each(function(){var d=ht(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),l===0&&a()})}var rN=0;function kt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Fd(){return++rN}var xt=jn.prototype;kt.prototype={constructor:kt,select:UE,selectAll:HE,selectChild:xt.selectChild,selectChildren:xt.selectChildren,filter:ME,merge:BE,selection:GE,transition:lN,call:xt.call,nodes:xt.nodes,node:xt.node,size:xt.size,empty:xt.empty,each:xt.each,on:LE,attr:bE,attrTween:NE,style:qE,styleTween:JE,text:tN,textTween:iN,remove:zE,tween:uE,delay:$E,duration:CE,ease:VE,easeVarying:TE,end:aN,[Symbol.iterator]:xt[Symbol.iterator]};function sN(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cN={time:null,delay:0,duration:250,ease:sN};function dN(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function uN(e){var t,o;e instanceof kt?(t=e._id,e=e._name):(t=Fd(),(o=cN).time=ra(),e=e==null?null:e+"");for(var i=this._groups,l=i.length,a=0;a<l;++a)for(var r=i[a],s=r.length,c,d=0;d<s;++d)(c=r[d])&&Ri(c,e,t,d,r,o||dN(c,t));return new kt(i,this._parents,e,t)}jn.prototype.interrupt=sE,jn.prototype.transition=uN;const Ai=e=>()=>e;function fN(e,{sourceEvent:t,target:o,transform:i,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:l}})}function $t(e,t,o){this.k=e,this.x=t,this.y=o}$t.prototype={constructor:$t,scale:function(e){return e===1?this:new $t(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $t(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ma=new $t(1,0,0);$t.prototype;function pa(e){e.stopImmediatePropagation()}function ao(e){e.preventDefault(),e.stopImmediatePropagation()}function mN(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pN(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Gd(){return this.__zoom||ma}function hN(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gN(){return navigator.maxTouchPoints||"ontouchstart"in this}function yN(e,t,o){var i=e.invertX(t[0][0])-o[0][0],l=e.invertX(t[1][0])-o[1][0],a=e.invertY(t[0][1])-o[0][1],r=e.invertY(t[1][1])-o[1][1];return e.translate(l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}function bN(){var e=mN,t=pN,o=yN,i=hN,l=gN,a=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],s=250,c=eE,d=ql("start","zoom","end"),u,f,p,m=500,g=150,_=0,k=10;function b(w){w.property("__zoom",Gd).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",ee).on("dblclick.zoom",F).filter(l).on("touchstart.zoom",K).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",fe).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(w,R,x,G){var H=w.selection?w.selection():w;H.property("__zoom",Gd),w!==H?X(w,R,x,G):H.interrupt().each(function(){W(this,arguments).event(G).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(w,R,x,G){b.scaleTo(w,function(){var H=this.__zoom.k,Z=typeof R=="function"?R.apply(this,arguments):R;return H*Z},x,G)},b.scaleTo=function(w,R,x,G){b.transform(w,function(){var H=t.apply(this,arguments),Z=this.__zoom,A=x==null?S(H):typeof x=="function"?x.apply(this,arguments):x,U=Z.invert(A),Q=typeof R=="function"?R.apply(this,arguments):R;return o(h($(Z,Q),A,U),H,r)},x,G)},b.translateBy=function(w,R,x,G){b.transform(w,function(){return o(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof x=="function"?x.apply(this,arguments):x),t.apply(this,arguments),r)},null,G)},b.translateTo=function(w,R,x,G,H){b.transform(w,function(){var Z=t.apply(this,arguments),A=this.__zoom,U=G==null?S(Z):typeof G=="function"?G.apply(this,arguments):G;return o(ma.translate(U[0],U[1]).scale(A.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof x=="function"?-x.apply(this,arguments):-x),Z,r)},G,H)};function $(w,R){return R=Math.max(a[0],Math.min(a[1],R)),R===w.k?w:new $t(R,w.x,w.y)}function h(w,R,x){var G=R[0]-x[0]*w.k,H=R[1]-x[1]*w.k;return G===w.x&&H===w.y?w:new $t(w.k,G,H)}function S(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function X(w,R,x,G){w.on("start.zoom",function(){W(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){W(this,arguments).event(G).end()}).tween("zoom",function(){var H=this,Z=arguments,A=W(H,Z).event(G),U=t.apply(H,Z),Q=x==null?S(U):typeof x=="function"?x.apply(H,Z):x,me=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),pe=H.__zoom,de=typeof R=="function"?R.apply(H,Z):R,q=c(pe.invert(Q).concat(me/pe.k),de.invert(Q).concat(me/de.k));return function(ce){if(ce===1)ce=de;else{var Ee=q(ce),$e=me/Ee[2];ce=new $t($e,Q[0]-Ee[0]*$e,Q[1]-Ee[1]*$e)}A.zoom(null,ce)}})}function W(w,R,x){return!x&&w.__zooming||new J(w,R)}function J(w,R){this.that=w,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,R),this.taps=0}J.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,R){return this.mouse&&w!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var R=Mt(this.that).datum();d.call(w,this.that,new fN(w,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),R)}};function T(w,...R){if(!e.apply(this,arguments))return;var x=W(this,R).event(w),G=this.__zoom,H=Math.max(a[0],Math.min(a[1],G.k*Math.pow(2,i.apply(this,arguments)))),Z=Bt(w);if(x.wheel)(x.mouse[0][0]!==Z[0]||x.mouse[0][1]!==Z[1])&&(x.mouse[1]=G.invert(x.mouse[0]=Z)),clearTimeout(x.wheel);else{if(G.k===H)return;x.mouse=[Z,G.invert(Z)],Vi(this),x.start()}ao(w),x.wheel=setTimeout(A,g),x.zoom("mouse",o(h($(G,H),x.mouse[0],x.mouse[1]),x.extent,r));function A(){x.wheel=null,x.end()}}function ee(w,...R){if(p||!e.apply(this,arguments))return;var x=w.currentTarget,G=W(this,R,!0).event(w),H=Mt(w.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",me,!0),Z=Bt(w,x),A=w.clientX,U=w.clientY;Iw(w.view),pa(w),G.mouse=[Z,this.__zoom.invert(Z)],Vi(this),G.start();function Q(pe){if(ao(pe),!G.moved){var de=pe.clientX-A,q=pe.clientY-U;G.moved=de*de+q*q>_}G.event(pe).zoom("mouse",o(h(G.that.__zoom,G.mouse[0]=Bt(pe,x),G.mouse[1]),G.extent,r))}function me(pe){H.on("mousemove.zoom mouseup.zoom",null),Sw(pe.view,G.moved),ao(pe),G.event(pe).end()}}function F(w,...R){if(e.apply(this,arguments)){var x=this.__zoom,G=Bt(w.changedTouches?w.changedTouches[0]:w,this),H=x.invert(G),Z=x.k*(w.shiftKey?.5:2),A=o(h($(x,Z),G,H),t.apply(this,R),r);ao(w),s>0?Mt(this).transition().duration(s).call(X,A,G,w):Mt(this).call(b.transform,A,G,w)}}function K(w,...R){if(e.apply(this,arguments)){var x=w.touches,G=x.length,H=W(this,R,w.changedTouches.length===G).event(w),Z,A,U,Q;for(pa(w),A=0;A<G;++A)U=x[A],Q=Bt(U,this),Q=[Q,this.__zoom.invert(Q),U.identifier],H.touch0?!H.touch1&&H.touch0[2]!==Q[2]&&(H.touch1=Q,H.taps=0):(H.touch0=Q,Z=!0,H.taps=1+!!u);u&&(u=clearTimeout(u)),Z&&(H.taps<2&&(f=Q[0],u=setTimeout(function(){u=null},m)),Vi(this),H.start())}}function O(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A,U,Q;for(ao(w),Z=0;Z<H;++Z)A=G[Z],U=Bt(A,this),x.touch0&&x.touch0[2]===A.identifier?x.touch0[0]=U:x.touch1&&x.touch1[2]===A.identifier&&(x.touch1[0]=U);if(A=x.that.__zoom,x.touch1){var me=x.touch0[0],pe=x.touch0[1],de=x.touch1[0],q=x.touch1[1],ce=(ce=de[0]-me[0])*ce+(ce=de[1]-me[1])*ce,Ee=(Ee=q[0]-pe[0])*Ee+(Ee=q[1]-pe[1])*Ee;A=$(A,Math.sqrt(ce/Ee)),U=[(me[0]+de[0])/2,(me[1]+de[1])/2],Q=[(pe[0]+q[0])/2,(pe[1]+q[1])/2]}else if(x.touch0)U=x.touch0[0],Q=x.touch0[1];else return;x.zoom("touch",o(h(A,U,Q),x.extent,r))}}function fe(w,...R){if(this.__zooming){var x=W(this,R).event(w),G=w.changedTouches,H=G.length,Z,A;for(pa(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),Z=0;Z<H;++Z)A=G[Z],x.touch0&&x.touch0[2]===A.identifier?delete x.touch0:x.touch1&&x.touch1[2]===A.identifier&&delete x.touch1;if(x.touch1&&!x.touch0&&(x.touch0=x.touch1,delete x.touch1),x.touch0)x.touch0[1]=this.__zoom.invert(x.touch0[0]);else if(x.end(),x.taps===2&&(A=Bt(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<k)){var U=Mt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Ai(+w),b):i},b.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ai(!!w),b):e},b.touchable=function(w){return arguments.length?(l=typeof w=="function"?w:Ai(!!w),b):l},b.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Ai([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),b):t},b.scaleExtent=function(w){return arguments.length?(a[0]=+w[0],a[1]=+w[1],b):[a[0],a[1]]},b.translateExtent=function(w){return arguments.length?(r[0][0]=+w[0][0],r[1][0]=+w[1][0],r[0][1]=+w[0][1],r[1][1]=+w[1][1],b):[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},b.constrain=function(w){return arguments.length?(o=w,b):o},b.duration=function(w){return arguments.length?(s=+w,b):s},b.interpolate=function(w){return arguments.length?(c=w,b):c},b.on=function(){var w=d.on.apply(d,arguments);return w===d?b:w},b.clickDistance=function(w){return arguments.length?(_=(w=+w)*w,b):Math.sqrt(_)},b.tapDistance=function(w){return arguments.length?(k=+w,b):k},b}const Yd=Symbol("MiniMapSlots"),_N=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],vN={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},wN=n.defineComponent({...vN,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const o=e,i=n.inject(Yd),l=n.useAttrs(),a=n.toRef(()=>l.style??{});function r(f){t("click",f)}function s(f){t("dblclick",f)}function c(f){t("mouseenter",f)}function d(f){t("mousemove",f)}function u(f){t("mouseleave",f)}return(f,p)=>!f.hidden&&f.dimensions.width!==0&&f.dimensions.height!==0?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(i)[`node-${o.type}`]?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(i)[`node-${o.type}`]),n.normalizeProps(n.mergeProps({key:0},{...o,...f.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:f.id},f.$attrs,{class:["vue-flow__minimap-node",{selected:f.selected,dragging:f.dragging}],x:f.position.x,y:f.position.y,rx:f.borderRadius,ry:f.borderRadius,width:f.dimensions.width,height:f.dimensions.height,fill:f.color||a.value.background||a.value.backgroundColor,stroke:f.strokeColor,"stroke-width":f.strokeWidth,"shape-rendering":f.shapeRendering,onClick:r,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,_N))],64)):n.createCommentVNode("",!0)}}),EN=["width","height","viewBox","aria-labelledby"],NN=["id"],kN=["d","fill","stroke","stroke-width"],xN={name:"MiniMap",compatConfig:{MODE:3}},$N=n.defineComponent({...xN,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),l=200,a=150,{id:r,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:f,d3Selection:p,d3Zoom:m,getNodesInitialized:g}=Ce(),_=n.ref();n.provide(Yd,o);const k=n.toRef(()=>{var H;return e.width??((H=i.style)==null?void 0:H.width)??l}),b=n.toRef(()=>{var H;return e.height??((H=i.style)==null?void 0:H.height)??a}),$=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),S=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),X=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),W=n.computed(()=>Cl(g.value.filter(H=>!H.hidden))),J=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(()=>g.value&&g.value.length?fg(W.value,J.value):J.value),ee=n.computed(()=>{const H=T.value.width/k.value,Z=T.value.height/b.value;return Math.max(H,Z)}),F=n.computed(()=>{const H=ee.value*k.value,Z=ee.value*b.value,A=e.offsetScale*ee.value;return{offset:A,x:T.value.x-(H-T.value.width)/2-A,y:T.value.y-(Z-T.value.height)/2-A,width:H+A*2,height:Z+A*2}}),K=n.computed(()=>!F.value.x||!F.value.y?"":`
28
+ M${F.value.x-F.value.offset},${F.value.y-F.value.offset}
29
+ h${F.value.width+F.value.offset*2}
30
+ v${F.value.height+F.value.offset*2}
31
+ h${-F.value.width-F.value.offset*2}z
32
+ M${J.value.x+e.maskBorderRadius},${J.value.y}
33
+ h${J.value.width-2*e.maskBorderRadius}
34
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
35
+ v${J.value.height-2*e.maskBorderRadius}
36
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
37
+ h${-(J.value.width-2*e.maskBorderRadius)}
38
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
39
+ v${-(J.value.height-2*e.maskBorderRadius)}
40
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(H=>{if(_.value){const Z=Mt(_.value),A=me=>{if(me.sourceEvent.type!=="wheel"||!p.value||!m.value)return;const pe=me.sourceEvent.ctrlKey&&Xn()?10:1,de=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*e.zoomStep,q=c.value.zoom*2**(de*pe);m.value.scaleTo(p.value,q)},U=me=>{if(me.sourceEvent.type!=="mousemove"||!p.value||!m.value)return;const pe=ee.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),de={x:c.value.x-me.sourceEvent.movementX*pe,y:c.value.y-me.sourceEvent.movementY*pe},q=[[0,0],[u.value.width,u.value.height]],ce=ma.translate(de.x,de.y).scale(c.value.zoom),Ee=m.value.constrain()(ce,q,d.value);m.value.transform(p.value,Ee)},Q=bN().wheelDelta(me=>Rl(me)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?A:()=>{});Z.call(Q),H(()=>{Z.on("zoom",null)})}},{flush:"post"});function O(H){const[Z,A]=Bt(H);t("click",{event:H,position:{x:Z,y:A}})}function fe(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeClick(A),t("nodeClick",A)}function w(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeDoubleClick(A),t("nodeDblclick",A)}function R(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseEnter(A),t("nodeMouseenter",A)}function x(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseMove(A),t("nodeMousemove",A)}function G(H,Z){const A={event:H,node:Z,connectedEdges:Xt([Z],s.value)};f.miniMapNodeMouseLeave(A),t("nodeMouseleave",A)}return(H,Z)=>(n.openBlock(),n.createBlock(n.unref(xc),{position:H.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:H.pannable,zoomable:H.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:_,width:k.value,height:b.value,viewBox:[F.value.x,F.value.y,F.value.width,F.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(r)}`,onClick:O},[H.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(r)}`},n.toDisplayString(H.ariaLabel),9,NN)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(g),A=>(n.openBlock(),n.createBlock(wN,{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(X.value(A)),color:h.value(A),"border-radius":H.nodeBorderRadius,"stroke-color":S.value(A),"stroke-width":H.nodeStrokeWidth,"shape-rendering":n.unref($),type:A.type,hidden:A.hidden,onClick:U=>fe(U,A),onDblclick:U=>w(U,A),onMouseenter:U=>R(U,A),onMousemove:U=>x(U,A),onMouseleave:U=>G(U,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:K.value,fill:H.maskColor,stroke:H.maskStrokeColor,"stroke-width":H.maskStrokeWidth,"fill-rule":"evenodd"},null,8,kN)],8,EN))]),_:1},8,["position","class"]))}}),IN=["d"],SN=["cx","cy","onDblclick"],CN=["x","y","onPointerdown","onDblclick"],RN=Ae(n.defineComponent({__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=Ce(),i=n.inject(Xl),l=n.inject(Jt,null),a=n.computed(()=>!!l&&l.editable.value),r=n.inject(_n,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,ee)=>ee===d.value?u.value:T)),{source:p,target:m,sourceSide:g,targetSide:_}=Jc({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>f.value}),k=n.computed(()=>(l==null?void 0:l.routingMode.value)==="orthogonal"?Bi(p.value,g.value,f.value,m.value,_.value):Oi(p.value,f.value,m.value)),b=n.computed(()=>a.value?(l==null?void 0:l.routingMode.value)==="orthogonal"?Di(p.value,g.value,f.value,m.value,_.value):zi(p.value,f.value,m.value).map((T,ee)=>({point:T,segIndex:ee})):[]),$=n.computed(()=>a.value?f.value:[]);function h(T,ee){d.value=T,u.value={...c.value[T]},ee.target.setPointerCapture(ee.pointerId),ee.stopPropagation()}function S(T){if(d.value<0)return;const ee=o({x:T.clientX,y:T.clientY});u.value={x:ee.x,y:ee.y}}function X(T){var ee,F;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(F=(ee=T.target).releasePointerCapture)==null||F.call(ee,T.pointerId)}function W(T,ee){ee.stopPropagation(),i==null||i.removePoint(t.id,T)}function J(T,ee){if(!i)return;const F=o({x:ee.clientX,y:ee.clientY});i.insertPoint(t.id,T,{x:F.x,y:F.y})}return(T,ee)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:k.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,IN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(F,K)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${K}`,cx:F.point.x,cy:F.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(O=>J(F.segIndex,O),["stop"])},null,42,SN))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList($.value,(F,K)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${K}`,x:F.x-5,y:F.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:O=>h(K,O),onPointermove:S,onPointerup:X,onDblclick:O=>W(K,O)},null,42,CN))),128))],64))}}),[["__scopeId","data-v-4c93c9c3"]]),VN=["data-theme"],AN={key:0,class:"em-ctx__sep",role:"separator"},TN={key:1,class:"em-ctx__swatches"},MN={class:"em-ctx__swatches-label"},BN={class:"em-ctx__chips"},DN=["onClick"],ON=["title","onClick"],LN=["disabled","onClick"],PN={class:"em-ctx__icon"},zN={class:"em-ctx__caption"},UN=Ae(n.defineComponent({__name:"EmContextMenu",setup(e,{expose:t}){const o=n.ref(!1),i=n.ref([]),l=n.ref(void 0),a=n.ref(null),r=n.reactive({x:0,y:0}),s=8;async function c(m,g){var b;i.value=g,l.value=(b=m.target)!=null&&b.closest('[data-theme="dark"]')?"dark":void 0,r.x=m.clientX,r.y=m.clientY,o.value=!0,window.addEventListener("keydown",u),window.addEventListener("resize",d),await n.nextTick();const _=a.value;if(!_)return;const k=_.getBoundingClientRect();r.x+k.width>window.innerWidth-s&&(r.x=Math.max(s,window.innerWidth-s-k.width)),r.y+k.height>window.innerHeight-s&&(r.y=Math.max(s,window.innerHeight-s-k.height))}function d(){o.value&&(o.value=!1,i.value=[],window.removeEventListener("keydown",u),window.removeEventListener("resize",d))}function u(m){m.key==="Escape"&&(m.stopPropagation(),d())}function f(m){m.disabled||(m.handler(),d())}function p(m,g){m.onPick(g),d()}return n.onBeforeUnmount(d),t({open:c,close:d}),(m,g)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[o.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:d,onContextmenu:n.withModifiers(d,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:a,class:"em-ctx",style:n.normalizeStyle({left:r.x+"px",top:r.y+"px"}),role:"menu",onContextmenu:g[0]||(g[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value,(_,k)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:k},[_.type==="separator"?(n.openBlock(),n.createElementBlock("div",AN)):_.type==="swatches"?(n.openBlock(),n.createElementBlock("div",TN,[n.createElementVNode("span",MN,n.toDisplayString(_.caption),1),n.createElementVNode("div",BN,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":_.current===null}]),title:"없음",onClick:b=>p(_,null)},null,10,DN),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),b=>(n.openBlock(),n.createElementBlock("button",{key:b,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":_.current===b}]),style:n.normalizeStyle({background:n.unref(ai)(b)}),title:n.unref(li)(b),onClick:$=>p(_,b)},null,14,ON))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":_.danger,"is-disabled":_.disabled}]),disabled:_.disabled,role:"menuitem",onClick:b=>f(_)},[n.createElementVNode("span",PN,[_.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:_.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",zN,n.toDisplayString(_.caption),1)],10,LN))],64))),128))],36)],8,VN)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-77a7a1b5"]]),ha=[".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 Nn(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function HN(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function FN(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},l=document.createRange();l.selectNodeContents(e);const a=e.firstChild,r=l.getClientRects();if(!a||a.nodeType!==3||r.length<=1){const g=r.length?l.getBoundingClientRect():e.getBoundingClientRect();if(g.width===0&&g.height===0)return[];const _=t(g.left,g.top+g.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=a.textContent??"",c=[];let d="",u=null,f=0,p=0;const m=()=>{const g=d.trim();if(g){const _=t(f,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:g})}d=""};for(let g=0;g<s.length;g++){l.setStart(a,g),l.setEnd(a,g+1);const _=l.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(m(),u=_.top,f=_.left,p=_.bottom,d=s[g]):(d+=s[g],p=Math.max(p,_.bottom))}return m(),c}function Ti(e,t){const o=[];for(const i of e.querySelectorAll("*"))HN(i)&&(i.closest(ha)||Nn(i)&&o.push(...FN(i,t)));return o}function ro(e){return Math.round(e*100)/100}function GN(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(ha)||!Nn(i))continue;const l=i.getBoundingClientRect();if(l.width===0||l.height===0)continue;const a=t(l.left,l.top),r=t(l.right,l.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ro(a.x)}" y="${ro(a.y)}" width="${ro(r.x-a.x)}" height="${ro(r.y-a.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function YN(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Nn(o))continue;const i=getComputedStyle(o),l=i.stroke,a=parseFloat(i.strokeWidth)||1.5,r=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),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="${l}" stroke-width="${a}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${l}" stroke-width="${a}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${r}" stroke="${l}" stroke-width="${a}" stroke-linejoin="round" />`)}return t}function Wd(e,t,o){const i=[];for(const l of e.querySelectorAll("*")){if(l===t||l.closest(ha)||!Nn(l))continue;const a=getComputedStyle(l),r=parseFloat(a.borderTopWidth);if(!r)continue;const s=l.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:a.borderTopColor,strokeWidth:r})}return i}function so(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),l=t(o.left,o.top),a=t(o.right,o.bottom),r=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:l.x,y:l.y,w:a.x-l.x,h:a.y-l.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:r?"6 4":void 0,radius:s}}function ga(e,t){e.minX=Math.min(e.minX,t.x),e.minY=Math.min(e.minY,t.y),e.maxX=Math.max(e.maxX,t.x+t.w),e.maxY=Math.max(e.maxY,t.y+t.h)}function WN(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(m,g)=>e.screenToFlowCoordinate({x:m,y:g}),i=[],l=[],a=[],r=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const m of e.nodes.value){const g=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(m.id)}"]`);if(!g||!Nn(g))continue;const _=g.firstElementChild;if(_)if(m.type==="group"){const k=so(_,o);ga(s,k),i.push({...k,texts:[]});const b=_.querySelector(".em-group__label");b&&i.push({...so(b,o),stroke:"none",texts:[]}),i.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ti(_,o)})}else if(m.type==="note"){const k={...so(_,o),texts:Ti(_,o),lines:Wd(_,_,o)};ga(s,k),a.push(k)}else{const k=so(_,o);ga(s,k);const b=k.radius??{tl:0,tr:0};l.push({...k,stroke:"none",texts:[]});const $=_.querySelector(".em-entity__header");if($){const h=so($,o);l.push({x:k.x,y:k.y,w:k.w,h:h.y+h.h-k.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}l.push({...k,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Ti(_,o),lines:Wd(_,_,o),icons:GN(_,o)}),l.push({...k,fill:"none",texts:[]})}}for(const m of t.querySelectorAll(".vue-flow__edge")){const g=m.querySelector("path.em-edge__path, path.em-note-edge__path");if(!g||!Nn(g))continue;const _=g.getAttribute("d");if(!_)continue;const k=getComputedStyle(g),b=k.strokeDasharray,$=YN(m);r.push({d:_,stroke:k.stroke,strokeWidth:parseFloat(k.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Ti(m,o),markers:$.length?$:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:r,entities:l,notes:a}}function Kd(e){return $a(WN(e))}function Xd(e,t="diagram.svg"){const o=Kd(e),i=new Blob([o],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(i);try{const a=document.createElement("a");a.href=l,a.download=t,document.body.appendChild(a),a.click(),a.remove()}finally{URL.revokeObjectURL(l)}}const ya="nc:",qd=Ae(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=te.useModal(),a=n.ref(!1),r=n.ref(!1),s={x:0,y:0};function c(y){s.x=y.clientX,s.y=y.clientY}const d=n.ref(null);n.provide(fi,d);const u=n.ref(null);n.provide(Dc,u);const f=n.ref(null),p=n.computed(()=>{const y=f.value,L=new Set;if(!y)return L;if(y.kind==="entity")L.add(y.id);else if(y.kind==="group"){const ae=i.resolved.value.groups.find(ue=>ue.group.modelId===y.id);for(const ue of(ae==null?void 0:ae.group.memberEntityRefs)??[])L.add(ue)}return L}),m=n.computed(()=>{const y=f.value,L=new Set(p.value),ae=new Set,ue=new Set;if(!y)return{related:L,edges:ae,notes:ue};if(y.kind==="note"){ue.add(y.id);for(const P of i.resolved.value.noteConnections)P.noteRef===y.id&&L.add(P.targetRef);return{related:L,edges:ae,notes:ue}}const ge=p.value;if(!ge.size)return{related:L,edges:ae,notes:ue};for(const P of i.resolved.value.associations){const{end1:Y,end2:z}=P.association;(ge.has(Y.entityRef)||ge.has(z.entityRef))&&(ae.add(P.association.modelId),L.add(Y.entityRef),L.add(z.entityRef))}for(const P of i.resolved.value.noteConnections)L.has(P.targetRef)&&ue.add(P.noteRef);return{related:L,edges:ae,notes:ue}});n.provide(_n,{source:f,active:n.computed(()=>f.value!==null),primaryEntityIds:p,relatedEntityIds:n.computed(()=>m.value.related),relatedEdgeIds:n.computed(()=>m.value.edges),relatedNoteIds:n.computed(()=>m.value.notes),hoverGroupId:n.computed(()=>{var y;return((y=f.value)==null?void 0:y.kind)==="group"?f.value.id:null}),setEntityHover:y=>{u.value||r.value||(f.value=y?{kind:"entity",id:y}:null)},setGroupHover:y=>{u.value||r.value||(f.value=y?{kind:"group",id:y}:null)},setNoteHover:y=>{u.value||r.value||(f.value=y?{kind:"note",id:y}:null)}}),n.provide(Jt,i);function g(y,L){return`${ya}${y}:${L}`}function _(y){if(!y.startsWith(ya))return null;const[L,ae]=y.slice(ya.length).split(":");return L&&ae?{noteRef:L,targetRef:ae}:null}n.provide(Xl,{points:y=>{var ae,ue;const L=_(y);return L?((ae=i.resolved.value.noteConnections.find(ge=>ge.noteRef===L.noteRef&&ge.targetRef===L.targetRef))==null?void 0:ae.waypoints)??[]:((ue=i.resolved.value.associations.find(ge=>ge.association.modelId===y))==null?void 0:ue.waypoints)??[]},movePoint:(y,L,ae)=>{const ue=_(y);ue?i.moveNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,ae):i.moveWaypoint(y,L,ae)},insertPoint:(y,L,ae)=>{const ue=_(y);ue?i.addNoteConnectionWaypoint(ue.noteRef,ue.targetRef,L,ae):i.addWaypoint(y,L,ae)},removePoint:(y,L)=>{const ae=_(y);ae?i.removeNoteConnectionWaypoint(ae.noteRef,ae.targetRef,L):i.removeWaypoint(y,L)}});const k=Ce(),{nodes:b,edges:$,findNode:h,findEdge:S,addNodes:X,addEdges:W,removeNodes:J,removeEdges:T,fitView:ee,setCenter:F,getViewport:K,screenToFlowCoordinate:O,getSelectedNodes:fe}=k,w=n.ref(!1);async function R(){w.value=!0,await n.nextTick(),await new Promise(y=>requestAnimationFrame(()=>y(null)));try{Xd(k)}finally{w.value=!1}}t({exportSvg:R});function x(y){for(const L of i.resolved.value.groups){const{location:ae,size:ue}=L.geo;if(y.x>=ae.x&&y.x<=ae.x+ue.width&&y.y>=ae.y&&y.y<=ae.y+ue.height)return L.group.modelId}return null}function G(){const y=i.resolved.value,L=new Map(y.groups.map(Y=>[Y.group.modelId,Y.geo])),ae=new Set(y.groups.map(Y=>Y.group.modelId)),ue=new Set([...ae,...y.entities.map(Y=>Y.entity.modelId),...y.notes.map(Y=>Y.note.modelId)]);for(const Y of[...b.value])ue.has(Y.id)||J([Y.id]);for(const Y of y.groups){const z=Y.group.modelId,j={width:`${Y.geo.size.width}px`,height:`${Y.geo.size.height}px`},ne={group:Y.group,style:Y.style},se=h(z);se?(se.position={...Y.geo.location},se.data=ne,se.style=j):X([{id:z,type:"group",position:{...Y.geo.location},style:j,data:ne}])}for(const Y of y.entities){const z=Y.entity.modelId,j=Y.groupRef&&ae.has(Y.groupRef)?Y.groupRef:void 0,ne={entity:Y.entity,displayMode:i.displayMode.value,collapsed:Y.collapsed,groupRef:j,size:Y.geo.size,style:Y.style,attributeStyles:Y.attributeStyles,operationStyles:Y.operationStyles},se=j?L.get(j):void 0,be=se?{x:Y.geo.location.x-se.location.x,y:Y.geo.location.y-se.location.y}:{...Y.geo.location},re=h(z);re?(re.position=be,re.data=ne,re.parentNode=j):X([{id:z,type:"entity",position:be,parentNode:j,data:ne}])}for(const Y of y.notes){const z=Y.note,j=z.modelId,ne=Y.groupRef&&ae.has(Y.groupRef)?Y.groupRef:void 0,se={note:z,groupRef:ne},be={width:`${z.geo.size.width}px`,height:`${z.geo.size.height}px`},re=ne?L.get(ne):void 0,we=re?{x:z.geo.location.x-re.location.x,y:z.geo.location.y-re.location.y}:{...z.geo.location},Ie=h(j);Ie?(Ie.position=we,Ie.data=se,Ie.style=be,Ie.parentNode=ne):X([{id:j,type:"note",position:we,parentNode:ne,style:be,data:se}])}const ge=new Map(y.associations.map(Y=>[Y.association.modelId,Y])),P=new Set(y.noteConnections.map(Y=>g(Y.noteRef,Y.targetRef)));for(const Y of[...$.value])!ge.has(Y.id)&&!P.has(Y.id)&&T([Y.id]);for(const[Y,z]of ge){const j={id:Y,type:"association",source:z.association.end1.entityRef,target:z.association.end2.entityRef,sourceHandle:z.sourceColumnRef?`r:${z.sourceColumnRef}`:void 0,targetHandle:z.targetColumnRef?`l:${z.targetColumnRef}`:void 0,data:{association:z.association,sourceColumnRef:z.sourceColumnRef,targetColumnRef:z.targetColumnRef}},ne=S(Y);ne?(ne.data=j.data,ne.sourceHandle=j.sourceHandle,ne.targetHandle=j.targetHandle):W([j])}for(const Y of y.noteConnections){const z=g(Y.noteRef,Y.targetRef),j={noteRef:Y.noteRef,targetRef:Y.targetRef},ne=S(z);ne?ne.data=j:W([{id:z,type:"note-connection",source:Y.noteRef,target:Y.targetRef,data:j}])}}function H(){const y=fe.value.map(ae=>ae.id);if(y.length)return y;const L=i.selection.value;return L&&(L.kind==="entity"||L.kind==="note"||L.kind==="group")?[L.id]:[]}function Z(y){var ge;const L=y.target;if(L&&(L.tagName==="INPUT"||L.tagName==="TEXTAREA"||L.isContentEditable))return;if(!i.editable.value){(y.metaKey||y.ctrlKey)&&y.key.toLowerCase()==="c"&&(i.copy(),y.preventDefault());return}if(y.key==="Delete"||y.key==="Backspace"){i.deleteSelection()&&y.preventDefault();return}if(y.key==="ArrowUp"||y.key==="ArrowDown"||y.key==="ArrowLeft"||y.key==="ArrowRight"){if(((ge=i.selection.value)==null?void 0:ge.kind)==="attribute"){if(y.key==="ArrowUp"||y.key==="ArrowDown"){const j=y.key==="ArrowDown"?1:-1;(y.altKey?i.nudgeSelectedAttributes(j):i.moveAttributeFocus(j))&&y.preventDefault()}return}const P=y.shiftKey?10:1,Y=y.key==="ArrowLeft"?-P:y.key==="ArrowRight"?P:0,z=y.key==="ArrowUp"?-P:y.key==="ArrowDown"?P:0;i.nudgeNodes(H(),Y,z)&&y.preventDefault();return}if(!(y.metaKey||y.ctrlKey))return;const ue=y.key.toLowerCase();ue==="c"?(i.copy(),y.preventDefault()):ue==="v"?(i.paste(),y.preventDefault()):ue==="z"&&(y.shiftKey?i.redo():i.undo(),y.preventDefault())}n.onMounted(async()=>{G(),await n.nextTick(),ee(),window.addEventListener("keydown",Z),window.addEventListener("pointerup",A),window.addEventListener("pointermove",c,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Z),window.removeEventListener("pointerup",A),window.removeEventListener("pointermove",c)});function A(){d.value=null}function U(){r.value=!0,f.value=null}function Q(){var ue;r.value=!1;const y=(ue=document.elementFromPoint(s.x,s.y))==null?void 0:ue.closest(".vue-flow__node"),L=y==null?void 0:y.dataset.id;if(!L){f.value=null;return}const ae=y.classList.contains("vue-flow__node-group")?"group":y.classList.contains("vue-flow__node-note")?"note":"entity";f.value={kind:ae,id:L}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],G),n.watch(()=>i.resolved.value,y=>{const L=f.value;if(!L)return;(L.kind==="entity"?y.entities.some(ue=>ue.entity.modelId===L.id):L.kind==="group"?y.groups.some(ue=>ue.group.modelId===L.id):y.notes.some(ue=>ue.note.modelId===L.id))||(f.value=null)});function me(y){const L=y.computedPosition??y.position,ae=y.dimensions??{width:0,height:0};return{x:L.x+ae.width/2,y:L.y+ae.height/2}}function pe(y){const L=y.node;if(L){if(f.value=null,L.type==="group"){const ae=i.resolved.value.groups.find(ue=>ue.group.modelId===L.id);u.value=ae?{groupId:L.id,dx:L.position.x-ae.geo.location.x,dy:L.position.y-ae.geo.location.y}:null,d.value=null;return}if(L.type!=="entity"&&L.type!=="note"){d.value=null;return}d.value=x(me(L))}}function de(y){var ue;d.value=null,u.value=null;const L=(ue=y.nodes)!=null&&ue.length?y.nodes:[y.node],ae=L.filter(ge=>(ge==null?void 0:ge.type)==="group");if(ae.length){for(const ge of ae){if(!ge)continue;const P=i.resolved.value.entities.filter(Y=>Y.groupRef===ge.id).map(Y=>{const z=h(Y.entity.modelId),j=(z==null?void 0:z.computedPosition)??(z==null?void 0:z.position)??{x:0,y:0};return{id:Y.entity.modelId,location:{x:j.x,y:j.y}}});i.dragGroup(ge.id,{x:ge.position.x,y:ge.position.y},P)}return}for(const ge of L){if(!ge||ge.type==="group")continue;const P=ge.computedPosition??ge.position,Y=ge.dimensions??{width:0,height:0},z={x:P.x+Y.width/2,y:P.y+Y.height/2};ge.type==="note"?i.dropNote(ge.id,{x:P.x,y:P.y},x(z)):i.dropEntity(ge.id,{x:P.x,y:P.y},x(z))}}function q(y){var j,ne,se,be,re;if(!i.editable.value||!y.source||!y.target)return;const L=((j=h(y.source))==null?void 0:j.type)==="note",ae=((ne=h(y.target))==null?void 0:ne.type)==="note";if(L||ae){if(L&&ae)return;const we=L?y.source:y.target,Ie=L?y.target:y.source;((se=h(Ie))==null?void 0:se.type)==="entity"&&i.addNoteConnection(we,Ie);return}const ue=we=>{var Ie;return(Ie=i.state.logical.entities.find(Re=>Re.modelId===we))==null?void 0:Ie.stereotype},ge=ue(y.source)==="JPA_EMBEDDABLE",P=ue(y.target)==="JPA_EMBEDDABLE";if(ge||P){if(ge&&P)return;const we=ge?y.source:y.target,Ie=ge?y.target:y.source;i.addEmbedAssociation(Ie,we);return}const Y=(be=y.sourceHandle)!=null&&be.startsWith("r:")?y.sourceHandle.slice(2):void 0,z=(re=y.targetHandle)!=null&&re.startsWith("l:")?y.targetHandle.slice(2):void 0;i.addAssociation(y.source,y.target,Y,z)}const ce=n.ref(null);function Ee(y,L){var ue;const ae=i.state.layout.entityLayouts.find(ge=>ge.entityRef===y);return tt((ue=ae==null?void 0:ae.attributeStyles)==null?void 0:ue[L])}function $e(y,L){var ue;const ae=i.state.layout.entityLayouts.find(ge=>ge.entityRef===y);return tt((ue=ae==null?void 0:ae.operationStyles)==null?void 0:ue[L])}function ke(y){var ue,ge;if(y.preventDefault(),!i.editable.value)return;const L=()=>O({x:y.clientX,y:y.clientY}),ae=[{caption:"엔티티 추가",icon:"add-entity",handler:()=>{const P=L();i.addEntity("NewEntity",{x:P.x,y:P.y})}},{caption:"노트 추가",icon:"note",handler:()=>{const P=L();i.addNote("메모",{x:P.x,y:P.y})}},{caption:"그룹 추가",icon:"folder",handler:()=>{const P=L();i.addEmptyGroup({x:P.x,y:P.y})}}];((ue=i.clipboard.value)==null?void 0:ue.kind)==="entity"&&ae.push({caption:"붙여넣기",icon:"clipboard",handler:()=>i.paste()}),i.resolved.value.entities.length>0&&ae.push({type:"separator"},{caption:"모두 접기",icon:"collapse-all",handler:()=>i.collapseAll()},{caption:"모두 펼치기",icon:"expand-all",handler:()=>i.expandAll()}),(ge=ce.value)==null||ge.open(y,ae)}function he({event:y,node:L}){var se,be,re,we,Ie,Re,Ze,Ot,Lt,ye,Oe,He,co,uo,fo,mo,po;const ae=y;if(ae.preventDefault(),!i.editable.value){if(L.type==="group"||L.type==="note")return;const Te=(be=(se=ae.target)==null?void 0:se.closest("[data-attr]"))==null?void 0:be.dataset.attr;if(Te){const De=i.selection.value;(De==null?void 0:De.kind)==="attribute"&&De.entityId===L.id&&De.ids.includes(Te)||i.selectAttribute(L.id,Te);const on=((re=i.selection.value)==null?void 0:re.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[Te];(we=ce.value)==null||we.open(ae,[{caption:on.length>1?`복사 (${on.length})`:"복사",icon:"copy",handler:()=>i.copy()}]);return}(Ie=ce.value)==null||Ie.open(ae,[{caption:"상세 편집…",icon:"pencil",handler:()=>si(l,i,L.id)},{caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}}]);return}if(L.type==="group"){(Re=ce.value)==null||Re.open(ae,[{caption:"그룹 해제",icon:"trash",danger:!0,handler:()=>i.removeGroup(L.id)}]);return}if(L.type==="note"){(Ze=ce.value)==null||Ze.open(ae,[{caption:"노트 삭제",icon:"trash",danger:!0,handler:()=>i.removeNote(L.id)}]);return}const ue=(Lt=(Ot=ae.target)==null?void 0:Ot.closest("[data-attr]"))==null?void 0:Lt.dataset.attr;if(ue){const Te=i.selection.value;(Te==null?void 0:Te.kind)==="attribute"&&Te.entityId===L.id&&Te.ids.includes(ue)||i.selectAttribute(L.id,ue);const nn=((ye=i.selection.value)==null?void 0:ye.kind)==="attribute"&&i.selection.value.entityId===L.id?[...i.selection.value.ids]:[ue],on=nn.length>1,ba=[{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{type:"swatches",caption:on?`색상 (${nn.length})`:"색상",current:on?null:Ee(L.id,ue),onPick:Hx=>i.setAttributeSwatches(L.id,nn,Hx)},{type:"separator"},{caption:on?`복사 (${nn.length})`:"복사",icon:"copy",handler:()=>i.copy()}],ho=i.clipboard.value;(ho==null?void 0:ho.kind)==="attribute"&&ba.push({caption:ho.attributes.length>1?`속성 붙여넣기 (${ho.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),ba.push({type:"separator"},{caption:on?`속성 삭제 (${nn.length})`:"속성 삭제",icon:"trash",danger:!0,handler:()=>i.removeAttributes(L.id,nn)}),(Oe=ce.value)==null||Oe.open(ae,ba);return}const ge=(co=(He=ae.target)==null?void 0:He.closest("[data-op]"))==null?void 0:co.dataset.op;if(ge){(uo=ce.value)==null||uo.open(ae,[{caption:"오퍼레이션 추가",icon:"method",handler:()=>i.addOperation(L.id)},{type:"swatches",caption:"색상",current:$e(L.id,ge),onPick:Te=>i.setOperationSwatch(L.id,ge,Te)},{type:"separator"},{caption:"오퍼레이션 삭제",icon:"trash",danger:!0,handler:()=>i.removeOperation(L.id,ge)}]);return}const P=[{caption:"상세 편집…",icon:"pencil",handler:()=>si(l,i,L.id)},{type:"separator"},{caption:"속성 추가",icon:"field",handler:()=>i.addAttribute(L.id)},{caption:"메서드 추가",icon:"method",handler:()=>i.addOperation(L.id)},{caption:"그룹으로 묶기",icon:"folder",handler:()=>{const Te=fe.value.filter(De=>De.type==="entity").map(De=>De.id);i.createGroup(Te.includes(L.id)&&Te.length?Te:[L.id])}},{caption:"셀프 연관 추가",icon:"arrow-lr",handler:()=>i.addAssociation(L.id,L.id)}],Y=i.embeddableCatalog.value;if(Y.length){P.push({type:"separator"});for(const Te of Y){const De=((fo=Te.label)==null?void 0:fo.ko)??((mo=Te.label)==null?void 0:mo.en)??Te.type;P.push({caption:`임베더블 추가: ${De}`,icon:"link",handler:()=>i.addPredefinedEmbed(L.id,Te.type)})}}const z=i.resolved.value.entities.find(Te=>Te.entity.modelId===L.id);P.push({type:"separator"}),P.push({caption:z!=null&&z.collapsed?"펼치기":"접기",icon:z!=null&&z.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(L.id,!(z!=null&&z.collapsed))}),(z==null?void 0:z.groupRef)&&P.push({caption:"그룹에서 빼기",icon:"folder",handler:()=>i.ungroupEntity(L.id)}),P.push({caption:"복사",icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.copy()}});const ne=i.clipboard.value;(ne==null?void 0:ne.kind)==="attribute"&&P.push({caption:ne.attributes.length>1?`속성 붙여넣기 (${ne.attributes.length})`:"속성 붙여넣기",icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:L.id},i.paste()}}),P.push({type:"separator"}),P.push({caption:"엔티티 삭제",icon:"trash",danger:!0,handler:()=>i.removeEntity(L.id)}),(po=ce.value)==null||po.open(ae,P)}function N({event:y,edge:L}){var ge,P;const ae=y;if(ae.preventDefault(),!i.editable.value)return;const ue=_(L.id);if(ue){(ge=ce.value)==null||ge.open(ae,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ue.noteRef,ue.targetRef)},{type:"separator"},{caption:"연결 삭제",icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ue.noteRef,ue.targetRef)}]);return}(P=ce.value)==null||P.open(ae,[{caption:"꺾은선 풀기",icon:"route",handler:()=>i.clearWaypoints(L.id)},{type:"separator"},{caption:"관계 삭제",icon:"trash",danger:!0,handler:()=>i.removeAssociation(L.id)}])}function I(y){return y==="group"?"group":y==="note"?"note":"entity"}function v({node:y}){if(fe.value.length>1){i.selection.value=null;return}i.selection.value={kind:I(y.type),id:y.id}}function E({nodes:y}){y.length>1&&(i.selection.value=null)}function C({edge:y}){const L=_(y.id);i.selection.value=L?{kind:"note",id:L.noteRef}:{kind:"association",id:y.id}}function D(y){const L=i.selection.value;return!!L&&L.kind!=="attribute"&&L.id===y.id}function B(y){var L,ae;return D(y)?y.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":y.type==="note"?"var(--em-note-soft)":y.type==="group"?Ic(tt((L=y.data)==null?void 0:L.style),!0)??"var(--em-mm-group)":Ic(tt((ae=y.data)==null?void 0:ae.style))??"var(--em-mm-entity)"}function oe(y){return D(y)?"var(--em-selection)":y.type==="note"?"var(--em-note-accent)":y.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ie(y,L){F(y,L,{zoom:K().zoom,duration:350})}n.watch(()=>i.focusRequest.value,y=>{if(!y)return;const L=h(y.id);if(!L)return;const ae=L.computedPosition??L.position,ue=L.dimensions??{width:0,height:0};ie(ae.x+ue.width/2,ae.y+ue.height/2)});function le({position:y}){ie(y.x,y.y)}function V({node:y}){i.selection.value={kind:I(y.type),id:y.id};const L=y.computedPosition??y.position,ae=y.dimensions??{width:0,height:0};ie(L.x+ae.width/2,L.y+ae.height/2)}function M({node:y}){ee({nodes:[y.id],duration:350,maxZoom:1.2,padding:.6})}return(y,L)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":a.value,"is-panning":r.value}])},[n.createVNode(n.unref(l0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!w.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(Et).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:U,onMoveEnd:Q,onConnect:q,onConnectStart:L[0]||(L[0]=ae=>a.value=!0),onConnectEnd:L[1]||(L[1]=ae=>a.value=!1),onNodeDrag:pe,onNodeDragStop:de,onNodeClick:v,onEdgeClick:C,onSelectionChange:E,onPaneClick:L[2]||(L[2]=ae=>n.unref(i).selection.value=null),onPaneContextMenu:ke,onNodeContextMenu:he,onEdgeContextMenu:N},{"node-group":n.withCtx(ae=>[n.createVNode(Lc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"node-entity":n.withCtx(ae=>[n.createVNode(Oc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"node-note":n.withCtx(ae=>[n.createVNode(Pc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"edge-association":n.withCtx(ae=>[n.createVNode(Qc,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),"edge-note-connection":n.withCtx(ae=>[n.createVNode(RN,n.normalizeProps(n.guardReactiveProps(ae)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(b_),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(G_),{"show-interactive":!1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref($N),{key:1,pannable:"",width:224,height:160,"node-color":B,"node-stroke-color":oe,"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:le,onNodeClick:V,onNodeDblclick:M})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),n.createVNode(UN,{ref_key:"menuRef",ref:ce},null,512)],2))}}),[["__scopeId","data-v-8123eaa4"]]),KN={class:"em-explorer"},XN={class:"em-explorer__rows"},qN=["data-key","onClick","onDblclick"],ZN=["onClick"],jN=["title"],JN={class:"em-key-slot"},QN={class:"em-key-slot"},ek={class:"em-explorer__label"},Zd=Ae(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,l=te.useModal(),a=n.computed(()=>{var w;const b=i.resolved.value,$=i.displayMode.value,h=R=>{var x,G,H;return go($,R.name,(G=(x=R.table)==null?void 0:x.logicalName)==null?void 0:G.ko,(H=R.table)==null?void 0:H.physicalName)},S=$==="PHYSICAL"||$==="LOGICAL_PHYSICAL",X=R=>{const x=R.attrType.startsWith("RELATION")&&R.dbAttrs.length>0;return{icon:R.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:R.identifier,fk:x&&S}}},W=R=>R.attrType.startsWith("EMBED")&&R.dbAttrs.length>0,J=$==="PHYSICAL"||$==="LOGICAL_PHYSICAL",T=R=>{if(R.attrType!=="EMBED_PREDEF")return R.dbAttrs;const x=i.embeddableCatalog.value.find(G=>G.type===R.type);return x?R.dbAttrs.map((G,H)=>{const Z=x.fields[H];return Z?{...G,physicalName:G.physicalName||Z.physicalName,logicalName:G.logicalName??Z.logicalName,dataType:G.dataType||Z.dataType,length:G.length??Z.length}:G}):R.dbAttrs},ee=(R,x)=>{var A,U,Q;const G={entityId:x,attrId:R.modelId};if(W(R)){const me=Fi($,R);return{key:`attr:${R.modelId}`,label:R.name+(me?` : ${me}`:""),icon:"table",attrRef:G,focusId:x,children:J?T(R).map(pe=>{var de;return{key:`attr:${R.modelId}:col:${pe.modelId}`,label:go($,pe.physicalName,(de=pe.logicalName)==null?void 0:de.ko,pe.physicalName)+(pe.dataType?` : ${pe.dataType}`:""),icon:"field",attrRef:G,focusId:x,children:[]}}):[]}}const H=Va(R,i.state.logical.associations),Z=Fi($,R,H);return{key:`attr:${R.modelId}`,label:go($,R.name,(U=(A=R.dbAttrs[0])==null?void 0:A.logicalName)==null?void 0:U.ko,(Q=R.dbAttrs[0])==null?void 0:Q.physicalName)+(Z?` : ${Z}`:""),...X(R),attrRef:G,focusId:x,children:[]}},F=R=>{const x=R.entity,G=[...x.attributes].sort((H,Z)=>H.order-Z.order);return{key:`entity:${x.modelId}`,label:h(x),icon:"table",selectKind:"entity",selectId:x.modelId,focusId:x.modelId,children:G.map(H=>ee(H,x.modelId))}},K=new Map,O=[];for(const R of b.entities)if(R.groupRef){const x=K.get(R.groupRef)??[];x.push(R),K.set(R.groupRef,x)}else O.push(R);const fe=[];for(const R of b.groups){const x=R.group;fe.push({key:`group:${x.modelId}`,label:((w=x.name)==null?void 0:w.ko)||x.packageName||"(그룹)",icon:"folder",focusId:x.modelId,children:(K.get(x.modelId)??[]).map(F)})}for(const R of O)fe.push(F(R));if(b.associations.length){const R=new Map(b.entities.map(x=>[x.entity.modelId,h(x.entity)]));fe.push({key:"section:associations",label:`관계 (${b.associations.length})`,icon:"arrow-lr",children:b.associations.map(x=>{const G=x.association,H=R.get(G.end1.entityRef)??G.end1.entityRef,Z=R.get(G.end2.entityRef)??G.end2.entityRef;return{key:`assoc:${G.modelId}`,label:`${H} — ${Z}`,icon:"arrow-lr",selectKind:"association",selectId:G.modelId,children:[]}})})}return b.notes.length&&fe.push({key:"section:notes",label:`노트 (${b.notes.length})`,icon:"note",children:b.notes.map(({note:R})=>{var x;return{key:`note:${R.modelId}`,label:((x=R.memo.split(`
41
+ `)[0])==null?void 0:x.slice(0,30))||"(빈 노트)",icon:"note",selectKind:"note",selectId:R.modelId,focusId:R.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||"다이어그램",icon:"network",children:fe}});function r(b){return b?b.pk&&b.fk?"PFK (식별 외래키)":b.pk?"PK (기본키)":b.fk?"FK (외래키)":"":""}const s=n.ref(new Set);function c(b){const $=new Set(s.value);$.has(b)?$.delete(b):$.add(b),s.value=$}const d=n.computed(()=>{const b=[],$=(h,S)=>{if(b.push({node:h,depth:S}),!s.value.has(h.key))for(const X of h.children)$(X,S+1)};return $(a.value,0),b}),u=n.computed(()=>{const b=[],$=h=>{if(h.children.length){h.key!=="root"&&b.push(h.key);for(const S of h.children)$(S)}};return $(a.value),b}),f=n.computed(()=>!u.value.some(b=>s.value.has(b)));function p(){s.value=f.value?new Set(u.value):new Set}t({toggleAll:p,allExpanded:f,hasExpandable:n.computed(()=>u.value.length>0)});function m(b){const $=i.selection.value;return b.attrRef?($==null?void 0:$.kind)==="attribute"&&$.entityId===b.attrRef.entityId&&$.ids.includes(b.attrRef.attrId):!!$&&$.kind!=="attribute"&&!!b.selectId&&b.selectKind===$.kind&&b.selectId===$.id}function g(b){const $=i.selection.value;return b.selectKind==="entity"&&($==null?void 0:$.kind)==="attribute"&&$.entityId===b.selectId}function _(b,$){if(b.attrRef){const h=$.shiftKey?"range":$.metaKey||$.ctrlKey?"toggle":"replace";i.selectAttribute(b.attrRef.entityId,b.attrRef.attrId,h)}else b.selectKind&&b.selectId&&(i.selection.value={kind:b.selectKind,id:b.selectId});b.focusId&&i.requestFocus(b.focusId)}function k(b){b.selectKind==="entity"&&b.selectId&&si(l,i,b.selectId)}return(b,$)=>(n.openBlock(),n.createElementBlock("section",KN,[n.createElementVNode("div",XN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,({node:h,depth:S})=>(n.openBlock(),n.createElementBlock("div",{key:h.key,class:n.normalizeClass(["em-explorer__row",{"is-active":m(h),"is-focus-parent":g(h),"is-selectable":!!h.selectKind||!!h.attrRef||!!h.focusId}]),"data-key":h.key,style:n.normalizeStyle({paddingLeft:4+S*14+"px"}),onClick:X=>_(h,X),onDblclick:X=>k(h)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!h.children.length,"is-open":!s.value.has(h.key)}]),onClick:n.withModifiers(X=>h.children.length&&c(h.key),["stop"])},[h.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,ZN),h.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:r(h.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",JN,[h.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):h.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:h.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",QN,[h.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,jN)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:h.icon,size:15},null,8,["name"])),n.createElementVNode("span",ek,n.toDisplayString(h.label),1)],46,qN))),128))])]))}}),[["__scopeId","data-v-eba61575"]]),tk={class:"em-text-preview"},nk={class:"em-text-preview__pre"},ok={class:"em-text-preview__actions"},ik=Ae(n.defineComponent({__name:"EntityTextPreview",props:{text:{}},setup(e){const t=e,o=te.useModalHandle();async function i(){try{await navigator.clipboard.writeText(t.text),te.showNotification("클립보드에 복사되었습니다.","info")}catch{te.showNotification("복사에 실패했습니다.","error")}}return(l,a)=>(n.openBlock(),n.createBlock(n.unref(te.BSModalFrame),{title:"코드생성 입력 (논리 모델 텍스트)"},{default:n.withCtx(()=>[n.createElementVNode("div",tk,[n.createElementVNode("pre",nk,n.toDisplayString(t.text),1),n.createElementVNode("div",ok,[n.createVNode(n.unref(te.BSButton),{caption:"복사",onClick:i}),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"닫기",onClick:a[0]||(a[0]=r=>n.unref(o).close())})])])]),_:1}))}}),[["__scopeId","data-v-b6e12b4b"]]),lk={class:"em-toolbar"},ak={class:"em-toolbar__mode"},jd=Ae(n.defineComponent({__name:"EditorToolbar",props:{controller:{}},emits:["exportSvg"],setup(e,{emit:t}){const i=e.controller,l=t,a=te.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(g=>g.collapsed)});function f(){u.value?i.expandAll():i.collapseAll()}function p(){a.openModal({component:ik,bind:{text:ka(i.state.logical)}})}return(m,g)=>(n.openBlock(),n.createElementBlock("div",lk,[n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"실행 취소",disabled:!n.unref(i).canUndo.value||!n.unref(i).editable.value,onClick:g[0]||(g[0]=_=>n.unref(i).undo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["disabled"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"다시 실행",disabled:!n.unref(i).canRedo.value||!n.unref(i).editable.value,onClick:g[1]||(g[1]=_=>n.unref(i).redo())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["disabled"]),g[8]||(g[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(te.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(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"자동 배치",disabled:!n.unref(i).editable.value,onClick:g[2]||(g[2]=_=>n.unref(i).autoLayout())},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:16})]),_:1},8,["disabled"]),g[9]||(g[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",ak,[g[7]||(g[7]=n.createTextVNode(" 표시 ",-1)),n.createVNode(n.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[3]||(g[3]=_=>s.value=_),items:r,"value-provider":_=>_.v,"label-provider":_=>_.label},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(te.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(te.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:"그리드",tooltip:n.unref(i).showGrid.value?"그리드 끄기":"그리드 켜기",onClick:g[4]||(g[4]=_=>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(te.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:"미니맵",tooltip:n.unref(i).showMinimap.value?"미니맵 끄기":"미니맵 켜기",onClick:g[5]||(g[5]=_=>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(te.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"]),g[10]||(g[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"텍스트 보기",onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1}),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:"SVG 내보내기",onClick:g[6]||(g[6]=_=>l("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1})]))}}),[["__scopeId","data-v-72d12e28"]]),rk=Ae(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=t;return(i,l)=>(n.openBlock(),n.createBlock(n.unref(te.BSButton),{variant:"text",class:n.normalizeClass(["em-mode-toggle",{"is-view":!e.editable}]),disabled:!e.opMode,caption:e.editable?"편집 모드":"조회 모드",title:e.opMode?e.editable?"클릭하면 조회 모드로 전환":"클릭하면 편집 모드로 전환":"이 다이어그램은 조회 전용입니다",onClick:l[0]||(l[0]=a=>o("toggle"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:e.editable?"pencil":"eye",size:14},null,8,["name"])]),_:1},8,["class","disabled","caption","title"]))}}),[["__scopeId","data-v-ae148426"]]),sk=["disabled"],ck={class:"em-panel__sub"},dk=["data-attr-block"],uk={class:"em-attr__row"},fk={key:0,class:"em-attr__row"},mk={class:"em-attr__row"},pk={class:"em-attr__row"},hk={class:"em-attr__flags"},gk={class:"em-attr__pii"},yk={class:"em-attr__pii"},bk={class:"em-attr__pii"},_k={key:0,class:"em-attr__pii em-attr__codetop"},vk={class:"em-multilang"},wk={key:2,class:"em-embed-cols"},Ek={class:"em-embed-col__label"},Nk={class:"em-attr__row"},kk={class:"em-attr__row"},xk={key:0,class:"em-embed-upd"},$k={class:"em-embed-upd"},Ik={class:"em-embed-upd"},Sk={class:"em-swatch__row em-attr__swatch"},Ck=["onClick"],Rk=["title","onClick"],Vk={key:0,class:"em-attr__swatch-hint"},Mi="__OWN__",Ak=Ae(n.defineComponent({__name:"EntityColumnsSection",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),l=n.computed(()=>i.value?o.state.layout.entityLayouts.find(P=>P.entityRef===i.value.modelId)??null:null),a=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>{var P;return((P=o.selectedAttr.value)==null?void 0:P.attrId)??null}),s=n.computed(()=>new Set(o.selectedAttrIds.value)),c=n.computed(()=>{var P;return((P=i.value)==null?void 0:P.attributes.filter(Y=>Y.attrType!=="DIVIDER"))??[]}),d=n.ref(null);n.watch(r,async P=>{var Y,z;P&&(await n.nextTick(),(z=(Y=d.value)==null?void 0:Y.querySelector(`[data-attr-block="${P}"]`))==null||z.scrollIntoView({block:"nearest",behavior:"smooth"}))});const u=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function f(P){return P==="none"?"(없음)":P}const p=P=>P;function m(P){var Y,z;return tt((z=(Y=l.value)==null?void 0:Y.attributeStyles)==null?void 0:z[P.modelId])}function g(P){return s.value.size>1&&s.value.has(P.modelId)}function _(P,Y){if(!i.value)return;const z=g(P)?o.selectedAttrIds.value:[P.modelId];o.setAttributeSwatches(i.value.modelId,z,Y)}function k(P,Y){i.value&&o.updateAttribute(i.value.modelId,P.modelId,Y)}function b(P){return!!P.transient}const $=P=>P.value,h=P=>P.label;function S(P,Y){if(!Y)return;const z=K.value.find(j=>j.type===Y);if(z){const j=P.dbAttrs[0]??{modelId:P.modelId+".c",physicalName:P.name,dataType:"VARCHAR"};k(P,{type:Y,customType:void 0,dbAttrs:[{...j,dataType:z.dataType,length:z.length,scale:z.scale}]});return}k(P,Y===Pt?{type:Y}:{type:Y,customType:void 0})}function X(P,Y){k(P,{customType:Y.trim()===""?void 0:Y})}function W(P,Y){const z=P.dbAttrs[0]??{modelId:P.modelId+".c",physicalName:P.name,dataType:"VARCHAR"};k(P,{dbAttrs:[{...z,...Y}]})}function J(P,Y,z){var j;W(P,{logicalName:{...(j=P.dbAttrs[0])==null?void 0:j.logicalName,[Y]:z}})}function T(P,Y){k(P,{description:Object.keys(Y).length?Y:void 0})}function ee(P){return P.personalInfoAttributeType??"none"}function F(P,Y){k(P,{personalInfoAttributeType:Y==="none"?void 0:Y})}const K=n.computed(()=>o.predefinedCustomTypeCatalog.value),O=n.computed(()=>o.embeddableCatalog.value),fe=n.ref(void 0);function w(P){var Y,z;return((Y=P.label)==null?void 0:Y.ko)??((z=P.label)==null?void 0:z.en)??P.type}function R(P){!P||!i.value||(o.addPredefinedEmbed(i.value.modelId,P),fe.value=void 0)}const x=n.computed(()=>o.groupCodeCatalog.value);function G(P){var Y;return((Y=x.value.find(z=>z.groupCode===P.groupCode))==null?void 0:Y.codes)??[]}function H(P){return["none",...G(P)]}function Z(P){return P==="none"?"none":P.code}function A(P){var z,j;if(P==="none")return"(없음)";const Y=((z=P.label)==null?void 0:z.ko)??((j=P.label)==null?void 0:j.en);return Y?`${P.code} (${Y})`:P.code}function U(P,Y){i.value&&o.setAttributeGroupCode(i.value.modelId,P.modelId,Y)}function Q(P,Y){k(P,{defaultValue:Y==="none"?void 0:Y})}function me(P,Y){k(P,{defaultValue:Y.trim()===""?void 0:Y})}function pe(P){return P.attrType.startsWith("EMBED")&&P.dbAttrs.length>0}function de(P,Y,z){const j=P.dbAttrs.map((ne,se)=>{if(se!==Y)return ne;const be={...ne,...z};for(const re of Object.keys(z))z[re]===void 0&&delete be[re];return be});i.value&&o.setEmbedColumns(i.value.modelId,P.modelId,j)}function q(P,Y,z,j){var ne;de(P,Y,{logicalName:{...(ne=P.dbAttrs[Y])==null?void 0:ne.logicalName,[z]:j}})}function ce(P,Y){var ne,se,be;if(P.attrType==="EMBED_PREDEF"){const re=(ne=o.embeddableCatalog.value.find(we=>we.type===P.type))==null?void 0:ne.fields[Y];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const z=(se=P.embedded)==null?void 0:se.embeddableRef;if(!z)return;const j=(be=o.state.logical.entities.find(re=>re.modelId===z))==null?void 0:be.attributes.flatMap(re=>re.dbAttrs)[Y];return j?{physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,logicalName:j.logicalName}:void 0}function Ee(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.dataType)||((j=P.dbAttrs[Y])==null?void 0:j.dataType)||""}function $e(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.length)??((j=P.dbAttrs[Y])==null?void 0:j.length)}function ke(P,Y){var z,j;return((z=ce(P,Y))==null?void 0:z.scale)??((j=P.dbAttrs[Y])==null?void 0:j.scale)}const he=["inherit","true","false"];function N(P){return P==="inherit"?"기본(따름)":P}function I(P){return(P==null?void 0:P.updatable)===void 0?"inherit":P.updatable?"true":"false"}function v(P,Y,z){de(P,Y,{updatable:z==="inherit"?void 0:z==="true"})}function E(P,Y){W(P,{updatable:Y==="inherit"?void 0:Y==="true"})}const C=["inherit","true","false"];function D(P){return P==="inherit"?"기본(따름)":P}function B(P){return(P==null?void 0:P.insertable)===void 0?"inherit":P.insertable?"true":"false"}function oe(P,Y,z){de(P,Y,{insertable:z==="inherit"?void 0:z==="true"})}function ie(P,Y){W(P,{insertable:Y==="inherit"?void 0:Y==="true"})}const le=n.computed(()=>{var P;return $n(((P=i.value)==null?void 0:P.attributes.flatMap(Y=>Y.dbAttrs))??[])}),V=n.computed(()=>{var P;return(((P=i.value)==null?void 0:P.attributes)??[]).filter(Y=>Y.attrType==="NORMAL"&&Y.dbAttrs.length===1&&Y.dbAttrs[0]).map(Y=>({modelId:Y.dbAttrs[0].modelId,label:Y.dbAttrs[0].physicalName||Y.name}))});function M(){return[Mi,...V.value.map(P=>P.modelId)]}function y(P){if(P===Mi)return"전용 컬럼(OWN)";const Y=V.value.find(z=>z.modelId===P);return Y?`↗ ${Y.label} (공유)`:P}function L(P){return(P==null?void 0:P.sharedColumnRef)??Mi}function ae(P,Y,z){de(P,Y,{sharedColumnRef:z===Mi?void 0:z})}function ue(P){return(P==null?void 0:P.sharedColumnRef)!=null}function ge(P){var Y;return((Y=bo(P,le.value))==null?void 0:Y.physicalName)??""}return(P,Y)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,ref_key:"sectionEl",ref:d,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",ck,[n.createTextVNode("속성 ("+n.toDisplayString(c.value.length)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:Y[0]||(Y[0]=z=>n.unref(o).addAttribute(i.value.modelId))}),O.value.length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"120px",placeholder:"임베더블 추가","model-value":fe.value,items:O.value,"value-provider":z=>z.type,"label-provider":w,"onUpdate:modelValue":R},null,8,["model-value","items","value-provider"])):n.createCommentVNode("",!0)]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,z=>{var j,ne,se,be,re,we,Ie,Re,Ze,Ot,Lt;return n.openBlock(),n.createElementBlock("div",{key:z.modelId,class:n.normalizeClass(["em-attr",{"is-focused":s.value.has(z.modelId)}]),"data-attr-block":z.modelId},[n.createElementVNode("div",uk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-name-${z.modelId}`,width:"100%",placeholder:"이름","model-value":z.name,"onUpdate:modelValue":ye=>k(z,{name:ye})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{name:`attr-type-${z.modelId}`,width:"84px",placeholder:"타입",disabled:z.attrType.startsWith("EMBED")||!!z.groupCode,items:n.unref(Ra)(z.type,K.value),"value-provider":$,"label-provider":h,"model-value":z.type,"onUpdate:modelValue":ye=>S(z,ye)},null,8,["name","disabled","items","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,z.modelId)},null,8,["onClick"])]),z.type===n.unref(Pt)?(n.openBlock(),n.createElementBlock("div",fk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${z.modelId}`,width:"100%",placeholder:"커스텀 타입명","model-value":z.customType??"","onUpdate:modelValue":ye=>X(z,ye)},null,8,["name","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),pe(z)?(n.openBlock(),n.createElementBlock("div",wk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(z.dbAttrs,(ye,Oe)=>{var He,co,uo,fo,mo,po,Te;return n.openBlock(),n.createElementBlock("div",{key:ye.modelId,class:"em-embed-col"},[n.createElementVNode("span",Ek,n.toDisplayString(((He=ce(z,Oe))==null?void 0:He.name)??((co=ce(z,Oe))==null?void 0:co.physicalName)??`컬럼 ${Oe+1}`),1),n.createElementVNode("div",Nk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`embed-col-${ye.modelId}`,width:"100%",disabled:ue(ye),placeholder:((uo=ce(z,Oe))==null?void 0:uo.physicalName)??"컬럼","model-value":ue(ye)?ge(ye):ye.physicalName,"onUpdate:modelValue":De=>de(z,Oe,{physicalName:De})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSTextInput),{name:`embed-dtype-${ye.modelId}`,width:"84px",disabled:"","model-value":Ee(z,Oe)},null,8,["name","model-value"]),n.createVNode(n.unref(te.BSNumberInput),{name:`embed-len-${ye.modelId}`,width:"48px",disabled:"","model-value":$e(z,Oe)},null,8,["name","model-value"]),n.createVNode(n.unref(te.BSNumberInput),{name:`embed-scale-${ye.modelId}`,width:"48px",disabled:"","model-value":ke(z,Oe)},null,8,["name","model-value"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":ye.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",kk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`embed-logical-${ye.modelId}`,width:"100%",placeholder:((mo=(fo=ce(z,Oe))==null?void 0:fo.logicalName)==null?void 0:mo.ko)??"논리명","model-value":((po=ye.logicalName)==null?void 0:po.ko)??"","onUpdate:modelValue":De=>q(z,Oe,"ko",De)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),(Te=ce(z,Oe))!=null&&Te.shareable?(n.openBlock(),n.createElementBlock("label",xk,[Y[7]||(Y[7]=n.createElementVNode("span",null,"통화 컬럼",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px","model-value":L(ye),items:M(),"value-provider":p,"label-provider":y,"onUpdate:modelValue":De=>De&&ae(z,Oe,De)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",$k,[Y[8]||(Y[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px",disabled:ue(ye),"model-value":ue(ye)?"false":B(ye),items:C,"value-provider":p,"label-provider":D,"onUpdate:modelValue":De=>De&&oe(z,Oe,De)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Ik,[Y[9]||(Y[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"110px",disabled:ue(ye),"model-value":ue(ye)?"false":I(ye),items:he,"value-provider":p,"label-provider":N,"onUpdate:modelValue":De=>De&&v(z,Oe,De)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",mk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-logical-${z.modelId}`,width:"100%",placeholder:"논리명","model-value":((ne=(j=z.dbAttrs[0])==null?void 0:j.logicalName)==null?void 0:ne.ko)??"","onUpdate:modelValue":ye=>J(z,"ko",ye)},null,8,["name","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",pk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`attr-col-${z.modelId}`,width:"100%",placeholder:"컬럼",disabled:b(z),"model-value":((se=z.dbAttrs[0])==null?void 0:se.physicalName)??"","onUpdate:modelValue":ye=>W(z,{physicalName:ye})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{name:`attr-dtype-${z.modelId}`,width:"84px",placeholder:"dataType",disabled:b(z),items:n.unref(Ia)(((be=z.dbAttrs[0])==null?void 0:be.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":p,"label-provider":n.unref(Hi),"model-value":((re=z.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ye=>ye&&W(z,{dataType:ye})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSNumberInput),{name:`attr-len-${z.modelId}`,width:"48px",placeholder:"len",disabled:b(z),"model-value":(we=z.dbAttrs[0])==null?void 0:we.length,"onUpdate:modelValue":ye=>W(z,{length:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSNumberInput),{name:`attr-scale-${z.modelId}`,width:"48px",placeholder:"scale",disabled:b(z),"model-value":(Ie=z.dbAttrs[0])==null?void 0:Ie.scale,"onUpdate:modelValue":ye=>W(z,{scale:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":(Re=z.dbAttrs[0])==null?void 0:Re.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",hk,[n.createVNode(n.unref(te.BSCheckbox),{name:`attr-pk-${z.modelId}`,label:"Primary Key","model-value":z.identifier,disabled:a.value||b(z),"onUpdate:modelValue":ye=>k(z,{identifier:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-nn-${z.modelId}`,label:"Not Null","model-value":z.notNull,disabled:b(z),"onUpdate:modelValue":ye=>k(z,{notNull:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-uq-${z.modelId}`,label:"Unique","model-value":!!((Ze=z.dbAttrs[0])!=null&&Ze.unique),disabled:b(z),"onUpdate:modelValue":ye=>W(z,{unique:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-ai-${z.modelId}`,label:"Auto Increment","model-value":!!((Ot=z.dbAttrs[0])!=null&&Ot.autoIncrement),disabled:b(z)||!z.identifier,"onUpdate:modelValue":ye=>W(z,{autoIncrement:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-tr-${z.modelId}`,label:"@Transient","model-value":!!z.transient,disabled:z.identifier,"onUpdate:modelValue":ye=>k(z,{transient:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`attr-mv-${z.modelId}`,label:"Multi-Value (Set)","model-value":!!((Lt=z.dbAttrs[0])!=null&&Lt.multiValue),disabled:b(z),"onUpdate:modelValue":ye=>W(z,{multiValue:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",gk,[Y[1]||(Y[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:b(z),"model-value":B(z.dbAttrs[0]),items:C,"value-provider":p,"label-provider":D,"onUpdate:modelValue":ye=>ye&&ie(z,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",yk,[Y[2]||(Y[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%",disabled:b(z),"model-value":I(z.dbAttrs[0]),items:he,"value-provider":p,"label-provider":N,"onUpdate:modelValue":ye=>ye&&E(z,ye)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",bk,[Y[3]||(Y[3]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":ee(z),items:u,"value-provider":p,"label-provider":f,"onUpdate:modelValue":ye=>ye&&F(z,ye)},null,8,["model-value","onUpdate:modelValue"])]),x.value.length?(n.openBlock(),n.createElementBlock("label",_k,[Y[4]||(Y[4]=n.createElementVNode("span",null,"코드그룹",-1)),n.createVNode(Rc,{"model-value":z.groupCode,items:x.value,"onUpdate:modelValue":ye=>U(z,ye)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!x.value.length}])},[Y[5]||(Y[5]=n.createElementVNode("span",null,"기본값",-1)),G(z).length?(n.openBlock(),n.createBlock(n.unref(te.BSSelect),{key:0,width:"100%","model-value":z.defaultValue??"none",items:H(z),"value-provider":Z,"label-provider":A,"onUpdate:modelValue":ye=>ye&&Q(z,ye)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(te.BSTextInput),{key:1,name:`attr-default-${z.modelId}`,width:"100%",placeholder:"기본값","model-value":z.defaultValue??"","onUpdate:modelValue":ye=>me(z,ye)},null,8,["name","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",vk,[Y[6]||(Y[6]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:`attr-desc-${z.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":z.description,"onUpdate:modelValue":ye=>T(z,ye)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",Sk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":m(z)===null}]),title:"없음",onClick:ye=>_(z,null)},"∅",10,Ck),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),ye=>(n.openBlock(),n.createElementBlock("button",{key:ye,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":m(z)===ye}]),style:n.normalizeStyle({background:n.unref(ai)(ye)}),title:n.unref(li)(ye),onClick:Oe=>_(z,ye)},null,14,Rk))),128)),g(z)?(n.openBlock(),n.createElementBlock("span",Vk,"선택 "+n.toDisplayString(s.value.size)+"개 일괄",1)):n.createCommentVNode("",!0)])],10,dk)}),128))],8,sk)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-4383b724"]]),Tk=["disabled"],Mk={class:"em-panel__sub"},Bk={class:"em-attr__row"},Dk={class:"em-field em-idx-params"},Ok=["value","onChange"],Lk=Ae(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(f=>f.modelId===t.entityId)??null);function l(){var p;if(!i.value)return;const f=i.value.attributes[0];o.addIndex(i.value.modelId,{modelId:Se(),name:`idx_${(((p=i.value.indexes)==null?void 0:p.length)??0)+1}`,unique:!1,columns:f?[{columnRef:f.modelId,descending:!1}]:[]})}function a(f,p){i.value&&o.updateIndex(i.value.modelId,f,p)}function r(f){var m;const p=(m=i.value)==null?void 0:m.attributes[0];p&&a(f.modelId,{columns:[...f.columns,{columnRef:p.modelId,descending:!1}]})}function s(f,p,m){a(f.modelId,{columns:f.columns.map((g,_)=>_===p?{...g,columnRef:m}:g)})}function c(f,p,m){a(f.modelId,{columns:f.columns.map((g,_)=>_===p?{...g,descending:m}:g)})}function d(f,p){a(f.modelId,{columns:f.columns.filter((m,g)=>g!==p)})}function u(f,p){a(f.modelId,{parameters:p.trim()===""?void 0:p})}return(f,p)=>{var m;return i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",Mk,[n.createTextVNode("인덱스 ("+n.toDisplayString(((m=i.value.indexes)==null?void 0:m.length)??0)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:l})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.indexes??[],g=>(n.openBlock(),n.createElementBlock("div",{key:g.modelId,class:"em-attr"},[n.createElementVNode("div",Bk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`idx-name-${g.modelId}`,width:"100%",placeholder:"인덱스명","model-value":g.name,"onUpdate:modelValue":_=>a(g.modelId,{name:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`idx-uq-${g.modelId}`,class:"em-check",label:"UQ","model-value":g.unique,"onUpdate:modelValue":_=>a(g.modelId,{unique:_})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_=>n.unref(o).removeIndex(i.value.modelId,g.modelId)},null,8,["onClick"])]),n.createVNode(jt,{controller:n.unref(o),"ref-id":g.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(g.columns,(_,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(te.BSSelect),{class:"grow","model-value":_.columnRef,items:i.value.attributes,"value-provider":b=>b.modelId,"label-provider":b=>b.name,"onUpdate:modelValue":b=>b&&s(g,k,b)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`idx-${g.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":_.descending,"onUpdate:modelValue":b=>c(g,k,b)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"−",onClick:b=>d(g,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"컬럼",onClick:_=>r(g)},null,8,["onClick"]),n.createElementVNode("label",Dk,[p[0]||(p[0]=n.createElementVNode("span",null,"조건 (partial index)",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:g.parameters??"",rows:"2",placeholder:"예: WHERE status = 'A'",onChange:_=>u(g,_.target.value)},null,40,Ok)])]))),128))],8,Tk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-63401907"]]),Pk=["disabled"],zk={class:"em-panel__sub"},Uk={class:"em-attr__row"},Hk={class:"em-attr__row"},Fk={class:"em-multilang"},Gk={class:"em-attr__pii"},Yk={class:"em-swatch__row em-attr__swatch"},Wk=["onClick"],Kk=["title","onClick"],Xk=Ae(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=te.useModal(),l=n.computed(()=>o.state.logical.entities.find(b=>b.modelId===t.entityId)??null),a=n.computed(()=>l.value?o.state.layout.entityLayouts.find(b=>b.entityRef===l.value.modelId)??null:null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],s=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function c(b){return b==="none"?"(없음)":b}const d=b=>b;function u(b,$){l.value&&o.updateOperation(l.value.modelId,b.modelId,$)}function f(b,$){u(b,{description:Object.keys($).length?$:void 0})}function p(b){return b.personalInfoAttributeType??"none"}function m(b,$){u(b,{personalInfoAttributeType:$==="none"?void 0:$})}function g(b){var $,h;return tt((h=($=a.value)==null?void 0:$.operationStyles)==null?void 0:h[b.modelId])}function _(b,$){l.value&&o.setOperationSwatch(l.value.modelId,b.modelId,$)}function k(b){i.openModal({component:Vc,bind:{operationName:b.name,sourceCode:b.sourceCode??"",onSave:$=>u(b,{sourceCode:$})}})}return(b,$)=>{var h;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",zk,[n.createTextVNode("오퍼레이션 ("+n.toDisplayString(((h=l.value.operations)==null?void 0:h.length)??0)+") ",1),n.createVNode(n.unref(te.BSButton),{variant:"text",caption:"추가",onClick:$[0]||($[0]=S=>n.unref(o).addOperation(l.value.modelId))})]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value.operations??[],S=>(n.openBlock(),n.createElementBlock("div",{key:S.modelId,class:"em-attr"},[n.createElementVNode("div",Uk,[n.createVNode(n.unref(te.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:"오퍼레이션명","model-value":S.name,"onUpdate:modelValue":X=>u(S,{name:X})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:r,"value-provider":d,"label-provider":d,"onUpdate:modelValue":X=>X&&u(S,{visibility:X})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:X=>n.unref(o).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),n.createElementVNode("div",Hk,[n.createVNode(n.unref(te.BSButton),{variant:"text",caption:S.sourceCode?"본문 편집 ●":"본문 편집",onClick:X=>k(S)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",Fk,[$[1]||($[1]=n.createElementVNode("legend",null,"설명",-1)),n.createVNode(Gl,{multiline:"",name:`op-desc-${S.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":X=>f(S,X)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",Gk,[$[2]||($[2]=n.createElementVNode("span",null,"개인정보",-1)),n.createVNode(n.unref(te.BSSelect),{width:"100%","model-value":p(S),items:s,"value-provider":d,"label-provider":c,"onUpdate:modelValue":X=>X&&m(S,X)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",Yk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(S)===null}]),title:"없음",onClick:X=>_(S,null)},"∅",10,Wk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Zn),X=>(n.openBlock(),n.createElementBlock("button",{key:X,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":g(S)===X}]),style:n.normalizeStyle({background:n.unref(ai)(X)}),title:n.unref(li)(X),onClick:W=>_(S,X)},null,14,Kk))),128))])]))),128))],8,Pk)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-cd38ffcd"]]),qk={class:"em-panel"},Zk={class:"em-panel__head"},jk={class:"em-panel__context"},Jk=["disabled"],Qk={key:0,class:"em-panel__note"},ex={key:1,class:"em-panel__note"},tx={key:2,class:"em-jpa"},nx={class:"em-field"},ox={class:"em-field"},ix={key:0,class:"em-field"},lx={class:"em-panel__sub"},ax={class:"em-field"},rx={class:"em-jpa"},sx={key:0,class:"em-panel__note"},cx={class:"em-jpa"},dx={class:"em-field"},ux={key:0,class:"em-panel__note"},fx={class:"em-field"},mx={class:"em-multilang"},px={class:"em-field"},hx=["value"],gx={class:"em-field"},yx={class:"em-panel__note"},bx={key:3,class:"em-field"},_x=["value"],Jd=Ae(n.defineComponent({__name:"PropertyPanel",props:{controller:{}},setup(e){const o=e.controller,i=n.computed(()=>o.selection.value),l=n.computed(()=>o.inspectedEntityId.value),a=n.computed(()=>{const A=l.value;return A?o.state.logical.entities.find(U=>U.modelId===A)??null:null}),r=n.computed(()=>{var A;return((A=o.selectedAttr.value)==null?void 0:A.attrId)??null}),s=n.computed(()=>new Set(o.selectedAttrIds.value)),c=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="association"?o.state.logical.associations.find(U=>U.modelId===A.id)??null:null}),d=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="group"?o.state.logical.groups.find(U=>U.modelId===A.id)??null:null}),u=n.computed(()=>{const A=i.value;return(A==null?void 0:A.kind)==="note"?o.state.layout.notes.find(U=>U.modelId===A.id)??null:null}),f=n.computed(()=>{var U,Q;const A=(U=d.value)==null?void 0:U.name;return(A==null?void 0:A.ko)||(A==null?void 0:A.en)||(A==null?void 0:A.ja)||(A==null?void 0:A.zh)||((Q=d.value)==null?void 0:Q.packageName)||"그룹"}),p=n.computed(()=>{if(a.value){const A=s.value.size;if(A>1)return`엔티티 · ${a.value.name} › 속성 · ${A}개`;if(r.value){const U=a.value.attributes.find(Q=>Q.modelId===r.value);return(U==null?void 0:U.attrType)==="DIVIDER"?`엔티티 · ${a.value.name} › 구분선`:`엔티티 · ${a.value.name} › 속성 · ${(U==null?void 0:U.name)??""}`}return`엔티티 · ${a.value.name}`}if(c.value){const A=U=>{var Q;return((Q=o.state.logical.entities.find(me=>me.modelId===U))==null?void 0:Q.name)??U};return`관계 · ${A(c.value.end1.entityRef)} — ${A(c.value.end2.entityRef)}`}return d.value?`그룹 · ${f.value}`:u.value?"노트":"선택된 항목 없음"}),m=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],g=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],_=["LIST","SET"],k=["inherit","LAZY","EAGER"],b=A=>A;function $(A){return A==="inherit"?"기본(따름)":A}const h=n.computed(()=>!!c.value&&c.value.end1.entityRef===c.value.end2.entityRef);function S(A,U){c.value&&o.updateAssociationEnd(c.value.modelId,A,U)}function X(A){c.value&&!h.value&&o.setAssociationIdentifying(c.value.modelId,A)}function W(A){var U,Q,me;return!!((me=(Q=(U=c.value)==null?void 0:U[A].jpa)==null?void 0:Q.cascadeTypes)!=null&&me.includes("ALL"))}function J(A,U,Q){var de,q;const me=(de=c.value)==null?void 0:de[A];if(U==="ALL"&&Q){S(A,{jpa:{...me==null?void 0:me.jpa,cascadeTypes:["ALL"]}});return}const pe=new Set(((q=me==null?void 0:me.jpa)==null?void 0:q.cascadeTypes)??[]);Q?pe.add(U):pe.delete(U),S(A,{jpa:{...me==null?void 0:me.jpa,cascadeTypes:[...pe]}})}function T(A,U){var me;const Q=(me=c.value)==null?void 0:me[A];S(A,{jpa:{...Q==null?void 0:Q.jpa,...U}})}function ee(A){var U,Q;return((Q=(U=c.value)==null?void 0:U[A].jpa)==null?void 0:Q.fetchType)??"inherit"}function F(A,U){T(A,{fetchType:U==="inherit"?void 0:U})}function K(A){var Q;const U=(Q=c.value)==null?void 0:Q[A==="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 O=n.computed(()=>{const A=c.value;if(!A)return null;for(const U of o.state.logical.entities){const Q=U.attributes.find(de=>{var q;return((q=de.embedded)==null?void 0:q.associationRef)===A.modelId&&de.attrType==="EMBED_OWN"});if(!Q)continue;const me=A.end2.entityRef===Q.embedded.embeddableRef?"end2":"end1",pe=A[me].jpa;return{which:me,isCollection:A[me].multiplicity!=="EXACTLY_ONE_INSTANCE",collectionType:(pe==null?void 0:pe.collectionType)??"LIST",collectionTable:(pe==null?void 0:pe.collectionTable)??"",orderColumn:(pe==null?void 0:pe.orderColumn)??""}}return null});function fe(A){c.value&&o.setEmbedCollectionMode(c.value.modelId,A?"COLLECTION":"SINGLE")}function w(A){const U=O.value;U&&T(U.which,A==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function R(A){const U=O.value;U&&T(U.which,{collectionTable:A.trim()||void 0})}function x(A){const U=O.value;U&&T(U.which,{orderColumn:A.trim()||void 0})}function G(A){d.value&&o.updateGroup(d.value.modelId,A)}function H(A,U){var Q;G({name:{...(Q=d.value)==null?void 0:Q.name,[A]:U}})}function Z(A){u.value&&o.setNoteMemo(u.value.modelId,A)}return(A,U)=>(n.openBlock(),n.createElementBlock("aside",qk,[n.createElementVNode("header",Zk,[U[5]||(U[5]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("p",jk,n.toDisplayString(p.value),1)]),n.createElementVNode("fieldset",{class:"em-panel__body",disabled:!n.unref(o).editable.value},[a.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Sc,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Ak,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Lk,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]),n.createVNode(Xk,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])],64)):n.createCommentVNode("",!0),c.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:"identifying (식별 관계)","model-value":!!c.value.identifying,disabled:h.value||!!O.value,"onUpdate:modelValue":X},null,8,["model-value","disabled"]),h.value?(n.openBlock(),n.createElementBlock("p",Qk,"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).")):O.value?(n.openBlock(),n.createElementBlock("p",ex,"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).")):n.createCommentVNode("",!0),O.value?(n.openBlock(),n.createElementBlock("fieldset",tx,[U[9]||(U[9]=n.createElementVNode("legend",null,"임베드",-1)),n.createVNode(n.unref(te.BSCheckbox),{name:"embed-collection",class:"em-check",label:"컬렉션 (@ElementCollection)","model-value":O.value.isCollection,"onUpdate:modelValue":fe},null,8,["model-value"]),O.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",nx,[U[6]||(U[6]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":O.value.collectionType,items:_,"value-provider":b,"label-provider":b,"onUpdate:modelValue":U[0]||(U[0]=Q=>Q&&w(Q))},null,8,["model-value"])]),n.createElementVNode("label",ox,[U[7]||(U[7]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:"미지정 시 코드젠 폴백","model-value":O.value.collectionTable,"onUpdate:modelValue":R},null,8,["model-value"])]),O.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",ix,[U[8]||(U[8]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:"미지정 시 순서 비보존","model-value":O.value.orderColumn,"onUpdate:modelValue":x},null,8,["model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),U[10]||(U[10]=n.createElementVNode("p",{class:"em-panel__note"},"카디널리티는 이 토글로 변경됩니다 (임베더블 end 다중성 직접 편집 대신).",-1))])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],Q=>{var me,pe,de,q;return n.createElementVNode("div",{key:Q,class:"em-end"},[n.createElementVNode("h4",lx,n.toDisplayString(Q)+" → "+n.toDisplayString(c.value[Q].entityRef),1),n.createElementVNode("label",ax,[U[11]||(U[11]=n.createElementVNode("span",null,"다중성",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":c.value[Q].multiplicity,items:m,"value-provider":b,"label-provider":b,disabled:((me=O.value)==null?void 0:me.which)===Q,"onUpdate:modelValue":ce=>S(Q,{multiplicity:ce})},null,8,["model-value","disabled","onUpdate:modelValue"])]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-navigable`,class:"em-check",label:"navigable","model-value":c.value[Q].navigable,"onUpdate:modelValue":ce=>S(Q,{navigable:ce})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-composition`,class:"em-check",label:"composition","model-value":c.value[Q].composition,"onUpdate:modelValue":ce=>S(Q,{composition:ce})},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("fieldset",rx,[U[12]||(U[12]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(g,ce=>{var Ee,$e;return n.createVNode(n.unref(te.BSCheckbox),{key:ce,name:`${Q}-cascade-${ce}`,class:"em-check",label:ce,"model-value":!!(($e=(Ee=c.value[Q].jpa)==null?void 0:Ee.cascadeTypes)!=null&&$e.includes(ce)),disabled:ce!=="ALL"&&W(Q),"onUpdate:modelValue":ke=>J(Q,ce,ke)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),W(Q)?(n.openBlock(),n.createElementBlock("p",sx,"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).")):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",cx,[U[15]||(U[15]=n.createElementVNode("legend",null,"JPA 상세",-1)),n.createElementVNode("label",dx,[U[13]||(U[13]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(te.BSSelect),{"model-value":ee(Q),items:k,"value-provider":b,"label-provider":$,"onUpdate:modelValue":ce=>ce&&F(Q,ce)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(te.BSCheckbox),{name:`${Q}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((pe=c.value[Q].jpa)!=null&&pe.orphanRemoval),disabled:K(Q),"onUpdate:modelValue":ce=>T(Q,{orphanRemoval:ce})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),K(Q)&&((de=c.value[Q].jpa)!=null&&de.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",ux,"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).")):n.createCommentVNode("",!0),n.createElementVNode("label",fx,[U[14]||(U[14]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(te.BSTextInput),{name:`${Q}-orderby`,width:"100%",placeholder:"예: name ASC","model-value":((q=c.value[Q].jpa)==null?void 0:q.orderBy)??"","onUpdate:modelValue":ce=>T(Q,{orderBy:ce.trim()||void 0})},null,8,["name","model-value","onUpdate:modelValue"])])])])}),64))],64)):n.createCommentVNode("",!0),d.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",mx,[U[16]||(U[16]=n.createElementVNode("legend",null,"그룹명",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).languages.value,Q=>{var me;return n.openBlock(),n.createElementBlock("label",{key:Q,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(Q),1),n.createVNode(n.unref(te.BSTextInput),{name:`grp-name-${Q}`,width:"100%","model-value":((me=d.value.name)==null?void 0:me[Q])??"","onUpdate:modelValue":pe=>H(Q,pe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",px,[U[17]||(U[17]=n.createElementVNode("span",null,"설명",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:d.value.description??"",rows:"3",onChange:U[1]||(U[1]=Q=>G({description:Q.target.value}))},null,40,hx)]),n.createElementVNode("label",gx,[U[18]||(U[18]=n.createElementVNode("span",null,"패키지",-1)),n.createVNode(n.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":d.value.packageName??"","onUpdate:modelValue":U[2]||(U[2]=Q=>G({packageName:Q}))},null,8,["model-value"])]),n.createVNode(n.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:"DDL 생성 제외","model-value":d.value.excludeDDLGeneration,"onUpdate:modelValue":U[3]||(U[3]=Q=>G({excludeDDLGeneration:Q}))},null,8,["model-value"]),n.createElementVNode("p",yx,"멤버 엔티티 "+n.toDisplayString(d.value.memberEntityRefs.length)+"개",1)],64)):n.createCommentVNode("",!0),u.value?(n.openBlock(),n.createElementBlock("label",bx,[U[19]||(U[19]=n.createElementVNode("span",null,"메모",-1)),n.createElementVNode("textarea",{class:"em-textarea",value:u.value.memo,rows:"6",onChange:U[4]||(U[4]=Q=>Z(Q.target.value))},null,40,_x)])):n.createCommentVNode("",!0)],8,Jk)]))}}),[["__scopeId","data-v-cca729a3"]]),vx={NAME:"이름",JPA:"JPA",TYPE:"타입",DSN:"설계"};function wx(e){const t=e.split("-")[1];return t?vx[t]??t:e}function Ex(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Nx=["title"],kx=["title","onClick"],xx={key:0,class:"em-validation__body"},$x={class:"em-validation__opt"},Ix={key:0,class:"em-validation__empty"},Sx={key:1,class:"em-validation__empty"},Cx={key:2,class:"em-validation__list"},Rx=["onClick"],Vx={class:"em-validation__item-msg"},Ax={key:0,class:"em-validation__item-entity"},Tx=["title"],Mx=Ae(n.defineComponent({__name:"ValidationPanel",props:{controller:{}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),l=n.computed(()=>{const _=new Map;for(const k of o.state.logical.entities)_.set(k.modelId,k.name);return _});function a(_){const k=Ex(_);if(!k)return null;const b=l.value.get(k);return b===void 0?null:b.trim()===""?"(이름 없음)":b}const r={error:{order:0,icon:"alert-circle",label:"오류"},warning:{order:1,icon:"alert-triangle",label:"경고"},info:{order:2,icon:"info",label:"정보"}},s=n.computed(()=>{const _={error:0,warning:0,info:0};for(const k of i.value)_[k.severity]++;return _}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,k)=>r[_.severity].order-r[k.severity].order)),u=n.computed(()=>d.value.map(_=>({issue:_,entityName:a(_),category:wx(_.ruleId)}))),f=n.ref(!1);function p(_){c.value[_]=!c.value[_]}function m(_){if(!f.value){f.value=!0;return}p(_)}function g(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,k)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":f.value}])},[n.createElementVNode("header",{class:"em-validation__head",onClick:k[1]||(k[1]=b=>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"]),k[3]||(k[3]=n.createElementVNode("span",{class:"em-validation__title"},"검증",-1))],8,Nx),n.createElementVNode("div",{class:"em-validation__counts",onClick:k[0]||(k[0]=n.withModifiers(()=>{},["stop"]))},[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["error","warning","info"],b=>n.createElementVNode("button",{key:b,type:"button",class:n.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:f.value?`${r[b].label} ${c.value[b]?"숨기기":"표시"}`:"검증 패널 펼치기",onClick:$=>m(b)},[n.createVNode(Ve,{name:r[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,kx)),64))])]),f.value?(n.openBlock(),n.createElementBlock("div",xx,[n.createElementVNode("label",$x,[n.createVNode(n.unref(te.BSCheckbox),{name:"val-flag-norel",label:"관계 없는 엔티티 검사","model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":k[2]||(k[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",Ix,"검증 이슈가 없습니다.")):d.value.length===0?(n.openBlock(),n.createElementBlock("p",Sx," 표시할 이슈가 없습니다 (필터 적용 중). ")):(n.openBlock(),n.createElementBlock("ul",Cx,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:$,category:h},S)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${S}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:X=>g(b)},[n.createVNode(Ve,{name:r[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",Vx,[$?(n.openBlock(),n.createElementBlock("span",Ax,n.toDisplayString($),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(b.message),1)]),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(h),9,Tx)],10,Rx))),128))]))])):n.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-bc9e6f86"]]),Bx={class:"em-modeler"},Dx={class:"em-modeler__body"},Ox={class:"em-drawer__inner"},Lx={class:"em-drawer__head"},Px={class:"em-drawer__actions"},zx=["title"],Ux=Ae(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(null),i=n.ref(null);return(l,a)=>{var r,s,c;return n.openBlock(),n.createElementBlock("div",Bx,[n.createVNode(jd,{controller:e.controller,onExportSvg:a[0]||(a[0]=d=>{var u;return(u=o.value)==null?void 0:u.exportSvg()})},null,8,["controller"]),n.createElementVNode("div",Dx,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}])},[n.createElementVNode("div",Ox,[n.createElementVNode("header",Lx,[a[4]||(a[4]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",Px,[(r=i.value)!=null&&r.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:(s=i.value)!=null&&s.allExpanded?"모두 접기":"모두 펼치기",onClick:a[1]||(a[1]=d=>{var u;return(u=i.value)==null?void 0:u.toggleAll()})},[n.createVNode(Ve,{name:(c=i.value)!=null&&c.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,zx)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:"접기",onClick:a[2]||(a[2]=d=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})])])]),n.createVNode(Zd,{ref_key:"explorer",ref:i,controller:e.controller},null,8,["controller"])])],2),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:a[3]||(a[3]=d=>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}])},[n.createVNode(qd,{ref_key:"canvas",ref:o,controller:e.controller},null,8,["controller"])],2),n.createVNode(Jd,{controller:e.controller},null,8,["controller"])]),n.createVNode(Mx,{controller:e.controller},null,8,["controller"])])}}}),[["__scopeId","data-v-ab7aefbd"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Vu,Ne.AssociationEdge=Qc,Ne.CommandStack=Wi,Ne.DiagramCanvas=qd,Ne.DiagramExplorer=Zd,Ne.EDITOR=Jt,Ne.EditModeToggle=rk,Ne.EditorToolbar=jd,Ne.EntityModeler=Ux,Ne.EntityNode=Oc,Ne.GroupNode=Lc,Ne.NoteNode=Pc,Ne.OpSyncAdapter=hr,Ne.PHYSICAL_NAME_MAX_LENGTH=Gi,Ne.PropertyPanel=Jd,Ne.RevCache=pr,Ne.SYMBOLIC_OP_KINDS=gr,Ne.SYMBOLIC_OP_SCHEMA=vr,Ne.anchoredEdgePoint=Pi,Ne.buildAgentBatch=Au,Ne.buildDiagramSvg=Kd,Ne.buildOrthogonalPath=Bi,Ne.buildSelfLoopPath=wa,Ne.buildStraightPath=Oi,Ne.commands=_u,Ne.computeAutoLayout=Ea,Ne.createEditorController=Eb,Ne.displayLabel=go,Ne.emptyState=Tc,Ne.entityModelToText=ka,Ne.exportDiagramSvg=Xd,Ne.fromPersisted=Yu,Ne.indexColumnsByModelId=$n,Ne.newId=Se,Ne.orthogonalMidpoints=Di,Ne.physicalNameWarning=_o,Ne.rectExitPoint=Li,Ne.renderDiagramSvg=$a,Ne.resolveDiagram=_a,Ne.resolveSharedColumn=bo,Ne.resolveSymbolicOps=Nu,Ne.segmentMidpoints=zi,Ne.sideDir=kn,Ne.toPersisted=af,Ne.toPersistedV2=rf,Ne.validateModel=Ta,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));