@g1cloud/entity-modeler-next 5.0.0-beta.1 → 5.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,62 +1,62 @@
1
- (function(_e,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):(_e=typeof globalThis<"u"?globalThis:_e||self,n(_e.EntityModeler={},_e.Vue,_e.OpenBlueseaCore))})(this,(function(_e,n,oe){"use strict";var IT=Object.defineProperty;var CT=(_e,n,oe)=>n in _e?IT(_e,n,{enumerable:!0,configurable:!0,writable:!0,value:oe}):_e[n]=oe;var qe=(_e,n,oe)=>CT(_e,typeof n!="symbol"?n+"":n,oe);const vf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function xf(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 Vl(e,t,o={}){const i={...vf,...o},a=new Map(e.entities.map(h=>[h.modelId,h])),r=new Map(e.associations.map(h=>[h.modelId,h])),l=new Map(t.entityLayouts.map(h=>[h.entityRef,h])),s=new Map(t.associationLayouts.map(h=>[h.associationRef,h])),c=t.entityLayouts.map(h=>h.entityRef).filter(h=>!a.has(h)),d=t.associationLayouts.map(h=>h.associationRef).filter(h=>!r.has(h)),u=new Map;for(const h of e.groups)for(const k of h.memberEntityRefs)u.set(k,h.modelId);const m=new Map;for(const h of t.groupLayouts)for(const k of h.memberNoteRefs??[])m.set(k,h.groupRef);let f=0;const p=e.entities.map(h=>{const k=u.get(h.modelId),P=l.get(h.modelId);if(P){const G={location:{x:P.geo.location.x,y:P.geo.location.y},size:{width:P.geo.size.width,height:P.geo.size.height}};return{entity:h,geo:G,collapsed:P.collapsed??!1,locked:P.locked??!1,groupRef:k,style:P.style,attributeStyles:P.attributeStyles,operationStyles:P.operationStyles}}const A=xf(f++,i);return{entity:h,geo:A,collapsed:!1,locked:!1,groupRef:k}}),y=new Map(t.groupLayouts.map(h=>[h.groupRef,h])),g=e.groups.map(h=>{const k=y.get(h.modelId),P=k?{location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:h,geo:P,style:k==null?void 0:k.style,locked:(k==null?void 0:k.locked)??!1}}),_=e.associations.map(h=>{const k=s.get(h.modelId);return{association:h,waypoints:(k==null?void 0:k.waypoints)??[],sourceColumnRef:k==null?void 0:k.sourceColumnRef,targetColumnRef:k==null?void 0:k.targetColumnRef}}),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:m.get(h.modelId)})),N=[];for(const h of t.notes)for(const k of h.connections??[])a.has(k.targetRef)&&N.push({noteRef:h.modelId,targetRef:k.targetRef,waypoints:k.waypoints.map(P=>({x:P.x,y:P.y}))});return{entities:p,associations:_,groups:g,notes:b,noteConnections:N,prunedEntityRefs:c,prunedAssociationRefs:d}}function ho(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 Dn=.5;function Ml(e,t,o,i,a,r){const l=ho(t),s=ho(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let f=e;const p=(_,b)=>{(Math.abs(_.x-f.x)>=Dn||Math.abs(_.y-f.y)>=Dn)&&(m.push({a:f,b:_,seg:b}),f=_)};p(c,0);let y=l.x!==0,g=c;for(let _=1;_<u.length;_++){const b=u[_],N=_<=o.length?_-1:o.length,h=Math.abs(b.x-g.x)<Dn,k=Math.abs(b.y-g.y)<Dn;h&&k||(h?(p(b,N),y=!1):k?(p(b,N),y=!0):y?(p({x:g.x,y:b.y},N),p(b,N),y=!0):(p({x:b.x,y:g.y},N),p(b,N),y=!1),g=b)}return p(i,o.length),m}function La(e,t,o,i,a,r=20){const l=Ml(e,t,o,i,a,r);let s=`M ${dt(e.x)},${dt(e.y)}`;for(const c of l)s+=` L ${dt(c.b.x)},${dt(c.b.y)}`;return s}const If=14;function Pa(e,t,o,i,a,r=20){return Ml(e,t,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=If).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function dt(e){return Math.round(e*100)/100}const Cf=36;function Bl(e,t,o=Cf){const i=Math.max(e.x,t.x)+o;return`M ${dt(e.x)},${dt(e.y)} L ${dt(i)},${dt(e.y)} L ${dt(i)},${dt(t.y)} L ${dt(t.x)},${dt(t.y)}`}function za(e,t,o){const i=[e,...t,o];let a=`M ${dt(i[0].x)},${dt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${dt(i[r].x)},${dt(i[r].y)}`;return a}function Sf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ua(e,t){const o=Sf(e),i=e.width/2,a=e.height/2,r=t.x-o.x,l=t.y-o.y;if(Math.abs(r)<Dn&&Math.abs(l)<Dn)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Fa(e,t,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:t},side:i?"right":"left"}}function Ha(e,t,o){const i=[e,...t,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const $f={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Dl(e,t,o={}){const i={...$f,...o},a=new Map(t.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),f=m?m.location:{x:0,y:0},p=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((p-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,_)=>{const b=_%y,N=Math.floor(_/y);r.push({id:g,location:{x:f.x+i.pad+b*i.cellWidth,y:f.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const f=m%i.ungroupedCols,p=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+f*i.cellWidth,y:d+p*i.cellHeight}})}),r}const Ol={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Ll(e,t={}){const o={...Ol,...t},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Ga(e,t={}){const o={...Ol,...t},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Ll(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}const si="inherited:";function Pl(e,t){return`${si}${e}:${t}`}function yo(e){return e.startsWith(si)}function ja(e){if(!yo(e))return null;const t=e.slice(si.length),o=t.indexOf(":");if(o<0)return null;const i=t.slice(0,o),a=t.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function go(e,t){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(t.some(r=>r.name===e.name))return[];const o=e.superClass||((a=t.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=t.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Pl(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}function ci(e,t,o,i,a="(논리명)"){switch(e){case"CLASS":return t;case"PHYSICAL":return i||t;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}function zl(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 Ul(e){var r,l,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||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${c.name}${d} «${c.stereotype}»${u?` [${u}]`:""}`);const m=[...c.attributes].sort((p,y)=>p.order-y.order);for(const p of m){if(p.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${p.name?` ${p.name} ${"─".repeat(8)}`:""}`);continue}const y=p.dbAttrs[0],g=y!=null&&y.length?`(${y.length}${y.scale!=null?`,${y.scale}`:""})`:"",_=y?` → ${y.physicalName} ${y.dataType}${g}`:"",b=[p.identifier?"PK":"",p.notNull?"NOT NULL":"",y!=null&&y.unique?"UNIQUE":"",y!=null&&y.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${p.name}: ${p.type}${_}${b.length?` {${b.join(", ")}}`:""}`)}for(const p of c.indexes??[]){const y=p.columns.map(g=>{var _;return`${o.get(g.columnRef)??((_=ja(g.columnRef))==null?void 0:_.field)??g.columnRef}${g.descending?" DESC":""}`}).join(", ");a.push(` index ${p.name}${p.unique?" UNIQUE":""}: ${y}`)}const f=[...c.operations??[]].sort((p,y)=>p.order-y.order);for(const p of f){const y=p.visibility?` {${p.visibility}}`:"",g=(s=p.description)!=null&&s.ko?` — ${p.description.ko}`:"";a.push(` method ${p.name}()${y}${g}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=t.get(c.end1.entityRef)??c.end1.entityRef,u=t.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${zl(c.end1.multiplicity)} —— ${zl(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
2
- `).trim()}function Rf(e){return e==="CLASS"?"class":"er"}function Ka(e,t){return t==="class"?Bf(e):Tf(e)}function bo(e,t){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||t}function Ya(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Fl(e,t){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=bo(t(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Af(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}function Hl(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 Gl(e,t){return(t==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function Tf(e){var i,a;const t=Fl(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),o=["erDiagram"];for(const r of e.entities){const l=t.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${l}`);continue}o.push(` ${l} {`);for(const c of s){const d=c.dbAttrs[0],u=bo((d==null?void 0:d.dataType)||c.type,"unknown"),m=bo((d==null?void 0:d.physicalName)||c.name,"col"),f=[c.identifier?"PK":"",Af(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),p=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",y=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,g=Ya([y,p].filter(Boolean).join(" ")),_=[` ${u} ${m}`];f&&_.push(f);let b=_.join(" ");g&&(b+=` "${g}"`),o.push(b)}o.push(" }")}for(const r of e.associations){const l=t.get(r.end1.entityRef),s=t.get(r.end2.entityRef);if(!l||!s)continue;const c=`${Gl(r.end1.multiplicity,"left")}--${Gl(r.end2.multiplicity,"right")}`,d=Ya(r.description);o.push(` ${l} ${c} ${s} : "${d}"`)}return o.join(`
3
- `)}function Vf(e){return e&&e!=="UNDEFINED"?e:null}function Mf(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Bf(e){const t=Fl(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=t.get(i.modelId),r=[],l=Vf(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${Mf(c.type)} ${bo(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${bo(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=t.get(i.end1.entityRef),r=t.get(i.end2.entityRef);if(!a||!r)continue;const l=Df(i),s=Ya(i.description),c=` ${a} "${Hl(i.end1.multiplicity)}" ${l} "${Hl(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
- `)}function Df(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function De(){return crypto.randomUUID()}const Of={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},Lf={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function Pf(e,t){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(p=>p.trim()).filter(Boolean));let d,u,m;if(i!=null){const p=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(p){d=Number(p[1]),p[2]!=null&&(u=Number(p[2]));const y=i.slice(0,p.index).trim();y&&(m=y)}else i.trim()&&(m=i.trim())}const f={modelId:De(),physicalName:s,dataType:l};return d!=null&&(f.length=d),u!=null&&(f.scale=u),c.has("UK")&&(f.unique=!0),m&&(f.logicalName={ko:m}),{modelId:De(),name:s,type:l,attrType:c.has("FK")?"RELATION_OWN":"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:t,dbAttrs:[f]}}function jl(e){const t=e.split(`
5
- `),o=[],i=new Map,a=[],r=c=>{const d=i.get(c);if(d)return d;const u={modelId:De(),name:c,stereotype:"JPA_ENTITY",table:{physicalName:c},attributes:[]};return o.push(u),i.set(c,u),u};let l=null;for(const c of t){const d=c.trim();if(!d||d==="erDiagram"||d.startsWith("%%"))continue;if(l){if(d==="}"){l=null;continue}const f=Pf(d,l.attributes.length);f&&l.attributes.push(f);continue}const u=d.match(/^(\S+)\s*\{$/);if(u){l=r(u[1]);continue}const m=d.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(m&&/--|\.\./.test(m[2])){const[f,p]=m[2].split(/--|\.\./);let y=(m[4]??"").trim();const g=y.match(/^"([^"]*)"$/);g&&(y=g[1]),a.push({left:m[1],right:m[3],cardL:f??"",cardR:p??"",label:y});continue}/^\S+$/.test(d)&&r(d)}const s=a.map(c=>{const d=r(c.left),u=r(c.right);return{modelId:De(),description:c.label||void 0,end1:{entityRef:d.modelId,multiplicity:Of[c.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:Lf[c.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return{modelId:De(),entities:o,associations:s,groups:[]}}function Kl(e){const t=jl(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yl={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},zf=Object.keys(Yl).sort((e,t)=>t.length-e.length),Wl=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,On=`${Wl}(?:\\.${Wl})*`,Uf=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s*\(([\s\S]*)\)\s*$`,"i"),Ff=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Hf=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${On})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${On})\s*\(([^)]*)\)`,"i"),Gf=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${On})\s+ON\s+(${On})\s*\(([^)]*)\)`,"i");function bt(e){let t=e.trim().replace(/[";`\[\]]/g,"");const o=t.lastIndexOf(".");return o>=0&&(t=t.slice(o+1)),t}function dn(e){const t=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(t.push(i),i=""):i+=a;return i.trim()&&t.push(i),t.map(a=>a.trim()).filter(Boolean)}function jf(e){const t=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!t)return null;const o=bt(t[1]),i=t[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const _ of zf)if(a.startsWith(_)){const b=Yl[_];r=b.dataType,l=!!b.autoIncrement;let N=i.slice(_.length);const h=N.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),N=N.slice(h[0].length)),d=N,u=!0;break}if(!u){const _=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);_&&(r=_[1].toUpperCase(),_[2]!=null&&(s=Number(_[2])),_[3]!=null&&(c=Number(_[3])),d=_[4]??"")}const m=d.toUpperCase(),f=/\bPRIMARY\s+KEY\b/.test(m),p=f||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),g={modelId:De(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),y&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:f,attr:{modelId:De(),name:o,type:r,attrType:"NORMAL",identifier:f,notNull:p,order:0,dbAttrs:[g]}}}function Kf(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function ql(e){const t=e.match(/\(([^)]*)\)/);return t?dn(t[1]).map(bt):[]}function Wa(e){const t=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(d=>d.trim()).filter(Boolean);for(const d of c){const u=d.match(Uf);if(!u)continue;const m=bt(u[1]),f=u[2],p={modelId:De(),name:m,stereotype:"JPA_ENTITY",table:{physicalName:m},attributes:[]},y=new Map,g=[];let _=0;for(const b of dn(f)){if(Kf(b)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(b))g.push(...ql(b));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(b))for(const k of ql(b)){const P=y.get(k.toLowerCase());P!=null&&P.dbAttrs[0]&&(P.dbAttrs[0].unique=!0)}const h=b.match(Ff);h&&l.push({childTable:m,childCols:dn(h[1]).map(bt),parentTable:bt(h[2]),parentCols:dn(h[3]).map(bt)});continue}const N=jf(b);if(!N){t.push(`컬럼 정의 해석 실패: ${b.slice(0,40)}`);continue}N.attr.order=_++,p.attributes.push(N.attr),y.set(N.attr.name.toLowerCase(),N.attr)}for(const b of g){const N=y.get(b.toLowerCase());N&&(N.identifier=!0,N.notNull=!0)}o.push(p),i.set(m.toLowerCase(),p);for(const[b,N]of y)a.set(`${m.toLowerCase()}.${b}`,N)}for(const d of c){const u=d.match(Hf);u&&l.push({childTable:bt(u[1]),childCols:dn(u[2]).map(bt),parentTable:bt(u[3]),parentCols:dn(u[4]).map(bt)})}for(const d of l){const u=i.get(d.childTable.toLowerCase()),m=i.get(d.parentTable.toLowerCase());if(!u||!m){t.push(`FK 대상 테이블 없음: ${d.childTable}→${d.parentTable}`);continue}const f={modelId:De(),end1:{entityRef:m.modelId,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:u.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};d.childCols.forEach((p,y)=>{const g=a.get(`${d.childTable.toLowerCase()}.${p.toLowerCase()}`),_=a.get(`${d.parentTable.toLowerCase()}.${(d.parentCols[y]??"").toLowerCase()}`);g&&(g.attrType="RELATION_OWN",g.derivedFrom={associationRef:f.modelId,sourceAttributeRef:(_==null?void 0:_.modelId)??""},y===0&&(f.end2.attributeRef=g.modelId))}),r.push(f)}for(const d of c){const u=d.match(Gf);if(!u)continue;const m=bt(u[3]),f=i.get(m.toLowerCase());if(!f){t.push(`인덱스 대상 테이블 없음: ${m}`);continue}const y=dn(u[4]).map(_=>bt(_.replace(/\s+(ASC|DESC)$/i,""))).map(_=>{var b,N;return(N=(b=a.get(`${m.toLowerCase()}.${_.toLowerCase()}`))==null?void 0:b.dbAttrs[0])==null?void 0:N.modelId}).filter(_=>!!_).map(_=>({columnRef:_,descending:!1}));if(!y.length)continue;const g={modelId:De(),name:bt(u[2]),unique:!!u[1],columns:y};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:De(),entities:o,associations:r,groups:[]},warnings:t}}function Xl(e){const{logical:t}=Wa(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(t.entities.length||1)))),a=Ga(t.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:De(),logicalModelRef:t.modelId,entityLayouts:a,associationLayouts:t.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:t,layout:r}}const Yf=["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"],Wf=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"]),qf=Yf.filter(e=>!Wf.has(e)),Xf={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function qa(e){return Xf[e]??e}const Jf=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),_o=new Set(["NUMERIC","DECIMAL"]);function Jl(e,t=qf){const o=[...t];return e&&!o.includes(e)?[e,...o]:o}const Rt="CustomType",Ln="GroupCodeEnum",Xa="String",di=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Ln,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:Rt,label:"CustomType"}],Zf=new Map(di.map(e=>[e.value,e.label]));function Pn(e){return Zf.get(e)??e}const Qf=new Set([Ln,"CustomMoneyType"]),Zl=di.filter(e=>!Qf.has(e.value)).map(e=>e.value===Rt?{...e,label:"CustomType (사용자정의)"}:e);function Ql(e,t=[]){const o=t.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...Zl,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:Pn(e)},...i]:i}function ep(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function Ja(e,t){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=t.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((r=i.jpa)==null?void 0:r.collectionType)??"LIST"}function Za(e,t,o){var i;return t.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&t.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${Pn(t.type)}>`:ep(t)?Pn(t.type):e==="CLASS"?t.type===Rt&&t.customType||Pn(t.type):qa(((i=t.dbAttrs[0])==null?void 0:i.dataType)??"")}function ui(e,t){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=t.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function un(e,t){return ui(e,t).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function mn(e){const t=new Map;for(const o of e)t.set(o.modelId,o);return t}function zn(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 ko=63;function mi(e){if(!e)return null;const t=e.length;return t>ko?t:null}function es(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Nt(e){return!e||e.trim()===""}function Eo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function tp(e){const t=new Map;for(const u of e.associations){if(u.identifying!==!0||u.end1.entityRef===u.end2.entityRef)continue;const m=t.get(u.end1.entityRef)??[];m.push(u.end2.entityRef),t.set(u.end1.entityRef,m)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=u=>{r.set(u,i),l.push(u);for(const m of t.get(u)??[]){const f=r.get(m)??o;if(f===o)d(m);else if(f===i){const p=l.slice(l.indexOf(m)),y=[...p].sort().join(" ");c.has(y)||(c.add(y),s.push(p))}}l.pop(),r.set(u,a)};for(const u of e.entities)(r.get(u.modelId)??o)===o&&d(u.modelId);return s}function fi(e,t,o,i,a){var r,l,s,c,d;if(!Nt(t.physicalName))return t.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(u=>u.type===e.type))==null?void 0:l.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const u=(c=e.embedded)==null?void 0:c.embeddableRef;if(u==null)return"";const m=(d=i.entities.find(f=>f.modelId===u))==null?void 0:d.attributes.flatMap(f=>f.dbAttrs)[o];return(m==null?void 0:m.physicalName)??""}return t.physicalName??""}function Qa(e,t){const o=new Map;for(const i of e){const a=t(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=t(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function ts(e,t){var r,l,s,c,d;const o=[];for(const u of Qa(e.entities,m=>m.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:u.name}});for(const u of e.entities){const m=u.attributes.filter(h=>h.attrType!=="DIVIDER");if(Nt(u.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:u.modelId}),u.stereotype==="JPA_ENTITY"&&!u.abstractClass&&(m.some(h=>h.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:u.modelId}),Nt((r=u.table)==null?void 0:r.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:u.modelId})),u.stereotype==="JPA_EMBEDDABLE")for(const h of m.filter(k=>k.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.identifier&&k.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)if(!h.identifier)for(const k of h.dbAttrs)!k.autoIncrement&&Nt(k.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:k.autoIncrement?{name:h.name}:{name:h.name,seq:k.sequenceName??""}});for(const h of m.filter(k=>k.naturalId&&k.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&k.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m.filter(k=>k.naturalId&&!k.notNull&&!k.identifier&&!k.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});!u.abstractClass&&m.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:u.modelId}),(t==null?void 0:t.largeEntityThreshold)!=null&&m.length>t.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:u.modelId,params:{count:m.length,threshold:t.largeEntityThreshold}});for(const h of Qa(m,k=>k.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of m)Nt(h.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:h.modelId,contextRef:u.modelId});const f=m.flatMap(h=>h.dbAttrs).filter(h=>h.sharedColumnRef==null),p=m.flatMap(h=>h.dbAttrs.map((k,P)=>({col:k,name:fi(h,k,P,e,t)})).filter(k=>k.col.sharedColumnRef==null));for(const h of Qa(p,k=>k.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:h.col.modelId,contextRef:u.modelId,params:{name:h.name}});for(const h of f){const k=mi(h.physicalName);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.physicalName)&&t.reservedWords.has(h.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.physicalName}}),t!=null&&t.selectableDataTypes&&!Nt(h.dataType)&&!t.selectableDataTypes.has(h.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}}),!Nt(h.dataType)&&Jf.has(h.dataType)&&!h.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:h.modelId,contextRef:u.modelId,params:{dataType:h.dataType}})}if((l=t==null?void 0:t.embeddableCatalog)!=null&&l.length){const h=mn(un(u,e.entities));for(const k of m){if(k.attrType!=="EMBED_PREDEF")continue;const P=t.embeddableCatalog.find(A=>A.type===k.type);P&&k.dbAttrs.forEach((A,G)=>{if(A.sharedColumnRef==null)return;const K=P.fields[G],v=h.get(A.sharedColumnRef);if(!K||!v)return;(v.dataType!==K.dataType||(v.length??null)!==(K.length??null)||(v.scale??null)!==(K.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:u.modelId,params:{targetType:es(v),metaName:K.name,metaType:es(K)}})})}}for(const h of m){const k=h.dbAttrs[0];if(!(k!=null&&k.multiValue))continue;h.type===Ln&&k.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:k.modelId,contextRef:u.modelId,params:{type:h.type||"",dataType:k.dataType||""}})}const y=(s=u.table)==null?void 0:s.physicalName,g=mi(y);g!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{max:ko,len:g}}),t!=null&&t.reservedWords&&!Nt(y)&&t.reservedWords.has(y.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:u.modelId,params:{name:y}});const _=new Set;for(const h of u.attributes){_.add(h.modelId);for(const k of h.dbAttrs)_.add(k.modelId)}const b=new Set(go(u,(t==null?void 0:t.superClassCatalog)??[]).map(h=>h.modelId)),N=(((c=t==null?void 0:t.superClassCatalog)==null?void 0:c.length)??0)>0;for(const h of u.indexes??[]){const k=mi(h.name);k!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{max:ko,len:k}}),t!=null&&t.reservedWords&&!Nt(h.name)&&t.reservedWords.has(h.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:{name:h.name}});for(const P of h.columns){const A=P.columnRef;if(_.has(A)||b.has(A))continue;const G=yo(A);G&&!N||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:h.modelId,contextRef:u.modelId,params:G?{name:h.name,field:((d=ja(A))==null?void 0:d.field)??A}:{name:h.name}})}}}const i=new Map;for(const u of e.entities)for(const m of u.attributes)m.attrType==="EMBED_OWN"&&m.embedded&&i.set(m.embedded.associationRef,m);for(const u of e.associations){Eo(u.end1.multiplicity)&&Eo(u.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:u.modelId}),i.has(u.modelId)&&u.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:u.modelId});for(const m of["end1","end2"]){const f=u[m].jpa;if(!f)continue;const p=f.cascadeTypes??[],y=p.includes("ALL"),g=p.includes("REMOVE");y&&p.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&(g||y)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:u.modelId,params:{which:m,cascade:y?"ALL":"REMOVE"}}),Eo(u[m].multiplicity)&&f.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.orphanRemoval&&Eo(u[m==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:u.modelId,params:{which:m}}),!Eo(u[m].multiplicity)&&(f.collectionType||f.collectionTable||f.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}}),f.collectionType==="SET"&&f.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:u.modelId,params:{which:m}})}}const a=new Map(e.entities.map(u=>[u.modelId,u.name||u.modelId]));for(const u of tp(e)){const m=[...u,u[0]].map(f=>a.get(f)??f).join(" → ");for(const f of u)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:f,params:{path:m}})}if(t!=null&&t.flagEntitiesWithoutRelations){const u=new Set;for(const f of e.associations)u.add(f.end1.entityRef),u.add(f.end2.entityRef);const m=new Map(e.entities.map(f=>[f.name,f.modelId]));for(const f of e.entities){for(const p of f.attributes)p.embedded&&(u.add(f.modelId),u.add(p.embedded.embeddableRef));if(!Nt(f.superClass)){u.add(f.modelId);const p=m.get(f.superClass);p&&u.add(p)}}for(const f of e.entities)u.has(f.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:f.modelId})}return o}function np(){return"postgres"}function ns(e,t="postgres",o){return lp(e,o)}const No=e=>e==null||e.trim()==="";function er(e){return[...e.attributes].filter(t=>t.attrType!=="DIVIDER"&&!t.transient).sort((t,o)=>t.order-o.order)}function op(e){return e.entities.filter(t=>t.stereotype!=="JPA_EMBEDDABLE")}function os(e){var t;return((t=e.table)==null?void 0:t.physicalName)||e.name}const ip={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function ap(e){const t=e.dataType;if(e.autoIncrement){if(t==="BIGINT")return"bigserial";if(t==="SMALLINT")return"smallserial";if(t==="INTEGER")return"serial"}return t==="NUMERIC"||t==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:t==="CHAR"||t==="NCHAR"?e.length!=null?`char(${e.length})`:"char":t==="VARCHAR"||t==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":ip[t]??t.toLowerCase()}function rp(e,t,o){const i=[];for(const a of er(e))a.dbAttrs.forEach((r,l)=>{if(r.sharedColumnRef!=null)return;const s=fi(a,r,l,t,o);No(s)||i.push({attr:a,col:r,name:s})});return i}function lp(e,t){const o=op(e),i=new Map,a=new Map,r=new Map;for(const u of e.entities)for(const m of u.attributes)i.set(m.modelId,u),m.dbAttrs.forEach((f,p)=>{const y=fi(m,f,p,e,t);p===0&&a.set(m.modelId,y),r.set(f.modelId,y)});const l=[],s=[],c=[];for(const u of o){const m=os(u),f=rp(u,e,t);if(f.length===0)continue;const p=f.map(({attr:b,col:N,name:h})=>{const k=[` ${h} ${ap(N)}`];return b.notNull&&!b.identifier&&k.push("NOT NULL"),N.unique&&k.push("UNIQUE"),k.join(" ")}),y=er(u).filter(b=>b.identifier).map(b=>a.get(b.modelId)).filter(b=>!No(b));y.length&&p.push(` PRIMARY KEY (${y.join(", ")})`),l.push(`CREATE TABLE ${m} (
6
- ${p.join(`,
1
+ (function(Ee,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(Ee=typeof globalThis<"u"?globalThis:Ee||self,t(Ee.EntityModeler={},Ee.Vue,Ee.OpenBlueseaCore))})(this,(function(Ee,t,le){"use strict";var $2=Object.defineProperty;var R2=(Ee,t,le)=>t in Ee?$2(Ee,t,{enumerable:!0,configurable:!0,writable:!0,value:le}):Ee[t]=le;var Ze=(Ee,t,le)=>R2(Ee,typeof t!="symbol"?t+"":t,le);const Uf={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Ff(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Kl(e,n,o={}){const i={...Uf,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),r=new Map(e.associations.map(g=>[g.modelId,g])),l=new Map(n.entityLayouts.map(g=>[g.entityRef,g])),s=new Map(n.associationLayouts.map(g=>[g.associationRef,g])),c=n.entityLayouts.map(g=>g.entityRef).filter(g=>!a.has(g)),d=n.associationLayouts.map(g=>g.associationRef).filter(g=>!r.has(g)),m=new Map;for(const g of e.groups)for(const N of g.memberEntityRefs)m.set(N,g.modelId);const u=new Map;for(const g of n.groupLayouts)for(const N of g.memberNoteRefs??[])u.set(N,g.groupRef);let p=0;const y=e.entities.map(g=>{const N=m.get(g.modelId),V=l.get(g.modelId);if(V){const I={location:{x:V.geo.location.x,y:V.geo.location.y},size:{width:V.geo.size.width,height:V.geo.size.height}};return{entity:g,geo:I,collapsed:V.collapsed??!1,locked:V.locked??!1,groupRef:N,style:V.style,attributeStyles:V.attributeStyles,operationStyles:V.operationStyles}}const T=Ff(p++,i);return{entity:g,geo:T,collapsed:!1,locked:!1,groupRef:N}}),f=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),b=e.groups.map(g=>{const N=f.get(g.modelId),V=N?{location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:V,style:N==null?void 0:N.style,locked:(N==null?void 0:N.locked)??!1}}),h=e.associations.map(g=>{const N=s.get(g.modelId);return{association:g,waypoints:(N==null?void 0:N.waypoints)??[],sourceColumnRef:N==null?void 0:N.sourceColumnRef,targetColumnRef:N==null?void 0:N.targetColumnRef}}),_=n.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:u.get(g.modelId)})),E=[];for(const g of n.notes)for(const N of g.connections??[])a.has(N.targetRef)&&E.push({noteRef:g.modelId,targetRef:N.targetRef,waypoints:N.waypoints.map(V=>({x:V.x,y:V.y}))});return{entities:y,associations:h,groups:b,notes:_,noteConnections:E,prunedEntityRefs:c,prunedAssociationRefs:d}}function bo(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 Un=.5;function Yl(e,n,o,i,a,r){const l=bo(n),s=bo(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},m=[c,...o,d],u=[];let p=e;const y=(h,_)=>{(Math.abs(h.x-p.x)>=Un||Math.abs(h.y-p.y)>=Un)&&(u.push({a:p,b:h,seg:_}),p=h)};y(c,0);let f=l.x!==0,b=c;for(let h=1;h<m.length;h++){const _=m[h],E=h<=o.length?h-1:o.length,g=Math.abs(_.x-b.x)<Un,N=Math.abs(_.y-b.y)<Un;g&&N||(g?(y(_,E),f=!1):N?(y(_,E),f=!0):f?(y({x:b.x,y:_.y},E),y(_,E),f=!0):(y({x:_.x,y:b.y},E),y(_,E),f=!1),b=_)}return y(i,o.length),u}function Ka(e,n,o,i,a,r=20){const l=Yl(e,n,o,i,a,r);let s=`M ${dt(e.x)},${dt(e.y)}`;for(const c of l)s+=` L ${dt(c.b.x)},${dt(c.b.y)}`;return s}const Hf=14;function Ya(e,n,o,i,a,r=20){return Yl(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Hf).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function dt(e){return Math.round(e*100)/100}const jf=36;function ql(e,n,o=jf){const i=Math.max(e.x,n.x)+o;return`M ${dt(e.x)},${dt(e.y)} L ${dt(i)},${dt(e.y)} L ${dt(i)},${dt(n.y)} L ${dt(n.x)},${dt(n.y)}`}function qa(e,n,o){const i=[e,...n,o];let a=`M ${dt(i[0].x)},${dt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${dt(i[r].x)},${dt(i[r].y)}`;return a}function Gf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wa(e,n){const o=Gf(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Un&&Math.abs(l)<Un)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),m={x:o.x+r*d,y:o.y+l*d},u=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:m,side:u}}function Xa(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Ja(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const Kf={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Wl(e,n,o={}){const i={...Kf,...o},a=new Map(n.groupLayouts.map(m=>[m.groupRef,m.geo])),r=[];let l=0;for(const m of e.groups){const u=a.get(m.modelId),p=u?u.location:{x:0,y:0},y=u?u.size.width:800;u&&(l=Math.max(l,u.location.y+u.size.height));const f=Math.max(1,Math.floor((y-i.pad*2)/i.cellWidth));m.memberEntityRefs.forEach((b,h)=>{const _=h%f,E=Math.floor(h/f);r.push({id:b,location:{x:p.x+i.pad+_*i.cellWidth,y:p.y+i.pad+i.headerHeight+E*i.cellHeight}})})}const s=new Set(e.groups.flatMap(m=>m.memberEntityRefs)),c=e.entities.filter(m=>!s.has(m.modelId)),d=l>0?l+40:i.pad;return c.forEach((m,u)=>{const p=u%i.ungroupedCols,y=Math.floor(u/i.ungroupedCols);r.push({id:m.modelId,location:{x:i.pad+p*i.cellWidth,y:d+y*i.cellHeight}})}),r}const Xl={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Jl(e,n={}){const o={...Xl,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Za(e,n={}){const o={...Xl,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Jl(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),m=a[s];return a[s]=m+c+o.gap,{id:r.id,location:{x:d,y:m},size:{width:o.boxWidth,height:c}}})}const fi="inherited:";function Zl(e,n){return`${fi}${e}:${n}`}function _o(e){return e.startsWith(fi)}function Qa(e){if(!_o(e))return null;const n=e.slice(fi.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function ko(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Zl(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Yf={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Eo(e){return Yf[e]??e}function pi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}function Ql(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 es(e){var r,l,s;const n=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||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",m=i.get(c.modelId);a.push(`## ${c.name}${d} «${Eo(c.stereotype)}»${m?` [${m}]`:""}`);const u=[...c.attributes].sort((y,f)=>y.order-f.order);for(const y of u){if(y.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${y.name?` ${y.name} ${"─".repeat(8)}`:""}`);continue}const f=y.dbAttrs[0],b=f!=null&&f.length?`(${f.length}${f.scale!=null?`,${f.scale}`:""})`:"",h=f?` → ${f.physicalName} ${f.dataType}${b}`:"",_=[y.identifier?"PK":"",y.notNull?"NOT NULL":"",f!=null&&f.unique?"UNIQUE":"",f!=null&&f.autoIncrement?"AUTO_INCREMENT":""].filter(Boolean);a.push(` - ${y.name}: ${y.type}${h}${_.length?` {${_.join(", ")}}`:""}`)}for(const y of c.indexes??[]){const f=y.columns.map(b=>{var h;return`${o.get(b.columnRef)??((h=Qa(b.columnRef))==null?void 0:h.field)??b.columnRef}${b.descending?" DESC":""}`}).join(", ");a.push(` index ${y.name}${y.unique?" UNIQUE":""}: ${f}`)}const p=[...c.operations??[]].sort((y,f)=>y.order-f.order);for(const y of p){const f=y.visibility?` {${y.visibility}}`:"",b=(s=y.description)!=null&&s.ko?` — ${y.description.ko}`:"";a.push(` method ${y.name}()${f}${b}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=n.get(c.end1.entityRef)??c.end1.entityRef,m=n.get(c.end2.entityRef)??c.end2.entityRef,u=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ql(c.end1.multiplicity)} —— ${Ql(c.end2.multiplicity)} ${m}${u}`)}}return a.join(`
2
+ `).trim()}const qf=e=>e&&e[0].toLowerCase()+e.slice(1);function hi(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function yi(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 Wf(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function gi(e,n){const o=qf(e);return n?Wf(o):o}function ts(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Xf(e){return e==="CLASS"?"class":"er"}function er(e,n){return n==="class"?tp(e):Zf(e)}function No(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function tr(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function ns(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=No(n(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Jf(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const os=yi;function is(e,n){return(n==="left"?{NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"}:{NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"})[e]}function Zf(e){var i,a;const n=ns(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),o=["erDiagram"];for(const r of e.entities){const l=n.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){o.push(` ${l}`);continue}o.push(` ${l} {`);for(const c of s){const d=c.dbAttrs[0],m=No((d==null?void 0:d.dataType)||c.type,"unknown"),u=No((d==null?void 0:d.physicalName)||c.name,"col"),p=[c.identifier?"PK":"",Jf(c)?"FK":"",d!=null&&d.unique?"UK":""].filter(Boolean).join(", "),y=d!=null&&d.length?`(${d.length}${d.scale!=null?`,${d.scale}`:""})`:"",f=(a=(i=c.dbAttrs[0])==null?void 0:i.logicalName)==null?void 0:a.ko,b=tr([f,y].filter(Boolean).join(" ")),h=[` ${m} ${u}`];p&&h.push(p);let _=h.join(" ");b&&(_+=` "${b}"`),o.push(_)}o.push(" }")}for(const r of e.associations){const l=n.get(r.end1.entityRef),s=n.get(r.end2.entityRef);if(!l||!s)continue;const c=`${is(r.end1.multiplicity,"left")}--${is(r.end2.multiplicity,"right")}`,d=tr(r.description);o.push(` ${l} ${c} ${s} : "${d}"`)}return o.join(`
3
+ `)}function Qf(e){return e&&e!=="UNDEFINED"?Eo(e):null}function ep(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function tp(e){const n=ns(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=Qf(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${ep(c.type)} ${No(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,m)=>d.order-m.order))r.push(` +${No(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=n.get(i.end1.entityRef),r=n.get(i.end2.entityRef);if(!a||!r)continue;const l=np(i),s=tr(i.description),c=` ${a} "${os(i.end1.multiplicity)}" ${l} "${os(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
4
+ `)}function np(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Ue(){return crypto.randomUUID()}const op={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},ip={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function ap(e,n){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(y=>y.trim()).filter(Boolean));let d,m,u;if(i!=null){const y=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(y){d=Number(y[1]),y[2]!=null&&(m=Number(y[2]));const f=i.slice(0,y.index).trim();f&&(u=f)}else i.trim()&&(u=i.trim())}const p={modelId:Ue(),physicalName:s,dataType:l};return d!=null&&(p.length=d),m!=null&&(p.scale=m),c.has("UK")&&(p.unique=!0),u&&(p.logicalName={ko:u}),{modelId:Ue(),name:s,type:l,attrType:c.has("FK")?"RELATION_OWN":"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]}}function as(e){const n=e.split(`
5
+ `),o=[],i=new Map,a=[],r=c=>{const d=i.get(c);if(d)return d;const m={modelId:Ue(),name:c,stereotype:"JPA_ENTITY",table:{physicalName:c},attributes:[]};return o.push(m),i.set(c,m),m};let l=null;for(const c of n){const d=c.trim();if(!d||d==="erDiagram"||d.startsWith("%%"))continue;if(l){if(d==="}"){l=null;continue}const p=ap(d,l.attributes.length);p&&l.attributes.push(p);continue}const m=d.match(/^(\S+)\s*\{$/);if(m){l=r(m[1]);continue}const u=d.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(u&&/--|\.\./.test(u[2])){const[p,y]=u[2].split(/--|\.\./);let f=(u[4]??"").trim();const b=f.match(/^"([^"]*)"$/);b&&(f=b[1]),a.push({left:u[1],right:u[3],cardL:p??"",cardR:y??"",label:f});continue}/^\S+$/.test(d)&&r(d)}const s=a.map(c=>{const d=r(c.left),m=r(c.right);return{modelId:Ue(),description:c.label||void 0,end1:{entityRef:d.modelId,multiplicity:op[c.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:m.modelId,multiplicity:ip[c.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return{modelId:Ue(),entities:o,associations:s,groups:[]}}function rs(e){const n=as(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Za(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Ue(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const ls={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},rp=Object.keys(ls).sort((e,n)=>n.length-e.length),ss=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Fn=`${ss}(?:\\.${ss})*`,lp=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Fn})\s*\(([\s\S]*)\)\s*$`,"i"),sp=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Fn})\s*\(([^)]*)\)`,"i"),cp=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Fn})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Fn})\s*\(([^)]*)\)`,"i"),dp=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Fn})\s+ON\s+(${Fn})\s*\(([^)]*)\)`,"i");function bt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function un(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function up(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=bt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,m=!1;for(const h of rp)if(a.startsWith(h)){const _=ls[h];r=_.dataType,l=!!_.autoIncrement;let E=i.slice(h.length);const g=E.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);g&&(s=Number(g[1]),g[2]!=null&&(c=Number(g[2])),E=E.slice(g[0].length)),d=E,m=!0;break}if(!m){const h=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);h&&(r=h[1].toUpperCase(),h[2]!=null&&(s=Number(h[2])),h[3]!=null&&(c=Number(h[3])),d=h[4]??"")}const u=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(u),y=p||/\bNOT\s+NULL\b/.test(u),f=/\bUNIQUE\b/.test(u),b={modelId:Ue(),physicalName:o,dataType:r};return s!=null&&(b.length=s),c!=null&&(b.scale=c),f&&(b.unique=!0),l&&(b.autoIncrement=!0),{primaryKey:p,attr:{modelId:Ue(),name:o,type:r,attrType:"NORMAL",identifier:p,notNull:y,order:0,dbAttrs:[b]}}}function mp(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function cs(e){const n=e.match(/\(([^)]*)\)/);return n?un(n[1]).map(bt):[]}function nr(e){const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(d=>d.trim()).filter(Boolean);for(const d of c){const m=d.match(lp);if(!m)continue;const u=bt(m[1]),p=m[2],y={modelId:Ue(),name:u,stereotype:"JPA_ENTITY",table:{physicalName:u},attributes:[]},f=new Map,b=[];let h=0;for(const _ of un(p)){if(mp(_)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(_))b.push(...cs(_));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(_))for(const N of cs(_)){const V=f.get(N.toLowerCase());V!=null&&V.dbAttrs[0]&&(V.dbAttrs[0].unique=!0)}const g=_.match(sp);g&&l.push({childTable:u,childCols:un(g[1]).map(bt),parentTable:bt(g[2]),parentCols:un(g[3]).map(bt)});continue}const E=up(_);if(!E){n.push(`컬럼 정의 해석 실패: ${_.slice(0,40)}`);continue}E.attr.order=h++,y.attributes.push(E.attr),f.set(E.attr.name.toLowerCase(),E.attr)}for(const _ of b){const E=f.get(_.toLowerCase());E&&(E.identifier=!0,E.notNull=!0)}o.push(y),i.set(u.toLowerCase(),y);for(const[_,E]of f)a.set(`${u.toLowerCase()}.${_}`,E)}for(const d of c){const m=d.match(cp);m&&l.push({childTable:bt(m[1]),childCols:un(m[2]).map(bt),parentTable:bt(m[3]),parentCols:un(m[4]).map(bt)})}for(const d of l){const m=i.get(d.childTable.toLowerCase()),u=i.get(d.parentTable.toLowerCase());if(!m||!u){n.push(`FK 대상 테이블 없음: ${d.childTable}→${d.parentTable}`);continue}const p={modelId:Ue(),end1:{entityRef:u.modelId,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};d.childCols.forEach((y,f)=>{const b=a.get(`${d.childTable.toLowerCase()}.${y.toLowerCase()}`),h=a.get(`${d.parentTable.toLowerCase()}.${(d.parentCols[f]??"").toLowerCase()}`);b&&(b.attrType="RELATION_OWN",b.derivedFrom={associationRef:p.modelId,sourceAttributeRef:(h==null?void 0:h.modelId)??""},f===0&&(p.end2.attributeRef=b.modelId))}),r.push(p)}for(const d of c){const m=d.match(dp);if(!m)continue;const u=bt(m[3]),p=i.get(u.toLowerCase());if(!p){n.push(`인덱스 대상 테이블 없음: ${u}`);continue}const f=un(m[4]).map(h=>bt(h.replace(/\s+(ASC|DESC)$/i,""))).map(h=>{var _,E;return(E=(_=a.get(`${u.toLowerCase()}.${h.toLowerCase()}`))==null?void 0:_.dbAttrs[0])==null?void 0:E.modelId}).filter(h=>!!h).map(h=>({columnRef:h,descending:!1}));if(!f.length)continue;const b={modelId:Ue(),name:bt(m[2]),unique:!!m[1],columns:f};p.indexes=[...p.indexes??[],b]}return{logical:{modelId:Ue(),entities:o,associations:r,groups:[]},warnings:n}}function ds(e){const{logical:n}=nr(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Za(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Ue(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const fp=["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"],pp=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"]),hp=fp.filter(e=>!pp.has(e)),yp={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function or(e){return yp[e]??e}const gp=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),wo=new Set(["NUMERIC","DECIMAL"]);function us(e,n=hp){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const At="CustomType",Hn="GroupCodeEnum",ir="String",bi=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Hn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:At,label:"CustomType"}],bp=new Map(bi.map(e=>[e.value,e.label]));function jn(e){return bp.get(e)??e}const _p=new Set([Hn,"CustomMoneyType"]),ms=bi.filter(e=>!_p.has(e.value)).map(e=>e.value===At?{...e,label:"CustomType (사용자정의)"}:e);function fs(e,n=[]){const o=n.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...ms,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:jn(e)},...i]:i}function kp(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function ar(e,n){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=n.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((r=i.jpa)==null?void 0:r.collectionType)??"LIST"}function rr(e,n,o){var i;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${jn(n.type)}>`:kp(n)?jn(n.type):e==="CLASS"?n.type===At&&n.customType||jn(n.type):or(((i=n.dbAttrs[0])==null?void 0:i.dataType)??"")}function _i(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function mn(e,n){return _i(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function fn(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Gn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}const vo=63;function ki(e){if(!e)return null;const n=e.length;return n>vo?n:null}function ps(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Nt(e){return!e||e.trim()===""}function Io(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ep(e){const n=new Map;for(const m of e.associations){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const u=n.get(m.end1.entityRef)??[];u.push(m.end2.entityRef),n.set(m.end1.entityRef,u)}const o=0,i=1,a=2,r=new Map,l=[],s=[],c=new Set,d=m=>{r.set(m,i),l.push(m);for(const u of n.get(m)??[]){const p=r.get(u)??o;if(p===o)d(u);else if(p===i){const y=l.slice(l.indexOf(u)),f=[...y].sort().join(" ");c.has(f)||(c.add(f),s.push(y))}}l.pop(),r.set(m,a)};for(const m of e.entities)(r.get(m.modelId)??o)===o&&d(m.modelId);return s}function Ei(e,n,o,i,a){var r,l,s,c,d;if(!Nt(n.physicalName))return n.physicalName;if(e.attrType==="EMBED_PREDEF")return((s=(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(m=>m.type===e.type))==null?void 0:l.fields[o])==null?void 0:s.physicalName)??"";if(e.attrType==="EMBED_OWN"){const m=(c=e.embedded)==null?void 0:c.embeddableRef;if(m==null)return"";const u=(d=i.entities.find(p=>p.modelId===m))==null?void 0:d.attributes.flatMap(p=>p.dbAttrs)[o];return(u==null?void 0:u.physicalName)??""}return n.physicalName??""}function lr(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function hs(e,n){var r,l,s,c,d,m,u,p,y;const o=[];for(const f of lr(e.entities,b=>b.name))o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:f.modelId,params:{name:f.name}});for(const f of e.entities){const b=f.attributes.filter(I=>I.attrType!=="DIVIDER");if(Nt(f.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:f.modelId}),f.stereotype==="JPA_ENTITY"&&!f.abstractClass&&(b.some(I=>I.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:f.modelId}),Nt((r=f.table)==null?void 0:r.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:f.modelId})),f.stereotype==="JPA_EMBEDDABLE")for(const I of b.filter(z=>z.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of b.filter(z=>z.identifier&&z.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of b)if(!I.identifier)for(const z of I.dbAttrs)!z.autoIncrement&&Nt(z.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:z.modelId,contextRef:f.modelId,params:z.autoIncrement?{name:I.name}:{name:I.name,seq:z.sequenceName??""}});for(const I of b.filter(z=>z.naturalId&&z.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of b.filter(z=>z.naturalId&&z.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of b.filter(z=>z.naturalId&&!z.notNull&&!z.identifier&&!z.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});!f.abstractClass&&b.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:f.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&b.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:f.modelId,params:{count:b.length,threshold:n.largeEntityThreshold}});for(const I of lr(b,z=>z.name))o.push({ruleId:"CHK-NAME-1",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of b)Nt(I.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"attribute",targetRef:I.modelId,contextRef:f.modelId});const h=b.flatMap(I=>I.dbAttrs).filter(I=>I.sharedColumnRef==null),_=b.flatMap(I=>I.dbAttrs.map((z,w)=>({col:z,name:Ei(I,z,w,e,n)})).filter(z=>z.col.sharedColumnRef==null));for(const I of lr(_,z=>z.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:I.col.modelId,contextRef:f.modelId,params:{name:I.name}});for(const I of h){const z=ki(I.physicalName);z!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:f.modelId,params:{max:vo,len:z}}),n!=null&&n.reservedWords&&!Nt(I.physicalName)&&n.reservedWords.has(I.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.physicalName}}),n!=null&&n.selectableDataTypes&&!Nt(I.dataType)&&!n.selectableDataTypes.has(I.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:f.modelId,params:{dataType:I.dataType}}),!Nt(I.dataType)&&gp.has(I.dataType)&&!I.length&&o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:f.modelId,params:{dataType:I.dataType}})}if((l=n==null?void 0:n.embeddableCatalog)!=null&&l.length){const I=fn(mn(f,e.entities));for(const z of b){if(z.attrType!=="EMBED_PREDEF")continue;const w=n.embeddableCatalog.find(x=>x.type===z.type);w&&z.dbAttrs.forEach((x,F)=>{if(x.sharedColumnRef==null)return;const C=w.fields[F],se=I.get(x.sharedColumnRef);if(!C||!se)return;(se.dataType!==C.dataType||(se.length??null)!==(C.length??null)||(se.scale??null)!==(C.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:x.modelId,contextRef:f.modelId,params:{targetType:ps(se),metaName:C.name,metaType:ps(C)}})})}}for(const I of b){const z=I.dbAttrs[0];if(!(z!=null&&z.multiValue))continue;I.type===Hn&&z.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:z.modelId,contextRef:f.modelId,params:{type:I.type||"",dataType:z.dataType||""}})}const E=(s=f.table)==null?void 0:s.physicalName,g=ki(E);g!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:f.modelId,params:{max:vo,len:g}}),n!=null&&n.reservedWords&&!Nt(E)&&n.reservedWords.has(E.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:f.modelId,params:{name:E}});const N=new Set;for(const I of f.attributes){N.add(I.modelId);for(const z of I.dbAttrs)N.add(z.modelId)}const V=new Set(ko(f,(n==null?void 0:n.superClassCatalog)??[]).map(I=>I.modelId)),T=(((c=n==null?void 0:n.superClassCatalog)==null?void 0:c.length)??0)>0;for(const I of f.indexes??[]){const z=ki(I.name);z!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:f.modelId,params:{max:vo,len:z}}),n!=null&&n.reservedWords&&!Nt(I.name)&&n.reservedWords.has(I.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:f.modelId,params:{name:I.name}});for(const w of I.columns){const x=w.columnRef;if(N.has(x)||V.has(x))continue;const F=_o(x);F&&!T||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:f.modelId,params:F?{name:I.name,field:((d=Qa(x))==null?void 0:d.field)??x}:{name:I.name}})}}}const i=new Map;for(const f of e.entities)for(const b of f.attributes)b.attrType==="EMBED_OWN"&&b.embedded&&i.set(b.embedded.associationRef,b);for(const f of e.associations){if(Io(f.end1.multiplicity)&&Io(f.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:f.modelId}),i.has(f.modelId)&&f.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:f.modelId}),!i.has(f.modelId)){const b=!!f.end2.attributeRef&&(((u=(m=f.end2.jpa)==null?void 0:m.cascadeTypes)==null?void 0:u.length)??0)>0,h=!!f.end1.attributeRef&&f.end1.navigable&&(((y=(p=f.end1.jpa)==null?void 0:p.cascadeTypes)==null?void 0:y.length)??0)>0;b&&h&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:f.modelId})}for(const b of["end1","end2"]){const h=f[b].jpa;if(!h)continue;const _=h.cascadeTypes??[],E=_.includes("ALL"),g=_.includes("REMOVE");E&&_.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:f.modelId,params:{which:b}}),h.orphanRemoval&&(g||E)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:f.modelId,params:{which:b,cascade:E?"ALL":"REMOVE"}}),Io(f[b].multiplicity)&&h.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:f.modelId,params:{which:b}}),h.orphanRemoval&&Io(f[b==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:f.modelId,params:{which:b}}),!Io(f[b].multiplicity)&&(h.collectionType||h.collectionTable||h.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:f.modelId,params:{which:b}}),h.collectionType==="SET"&&h.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:f.modelId,params:{which:b}})}}const a=new Map(e.entities.map(f=>[f.modelId,f.name||f.modelId]));for(const f of Ep(e)){const b=[...f,f[0]].map(h=>a.get(h)??h).join(" → ");for(const h of f)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:h,params:{path:b}})}if(n!=null&&n.flagEntitiesWithoutRelations){const f=new Set;for(const h of e.associations)f.add(h.end1.entityRef),f.add(h.end2.entityRef);const b=new Map(e.entities.map(h=>[h.name,h.modelId]));for(const h of e.entities){for(const _ of h.attributes)_.embedded&&(f.add(h.modelId),f.add(_.embedded.embeddableRef));if(!Nt(h.superClass)){f.add(h.modelId);const _=b.get(h.superClass);_&&f.add(_)}}for(const h of e.entities)f.has(h.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:h.modelId})}return o}function Np(){return"postgres"}function ys(e,n="postgres",o){return Cp(e,o)}const xo=e=>e==null||e.trim()==="";function sr(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function wp(e){return e.entities.filter(n=>n.stereotype!=="JPA_EMBEDDABLE")}function gs(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const vp={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function Ip(e){const n=e.dataType;if(e.autoIncrement){if(n==="BIGINT")return"bigserial";if(n==="SMALLINT")return"smallserial";if(n==="INTEGER")return"serial"}return n==="NUMERIC"||n==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:n==="CHAR"||n==="NCHAR"?e.length!=null?`char(${e.length})`:"char":n==="VARCHAR"||n==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":vp[n]??n.toLowerCase()}function xp(e,n,o){const i=[];for(const a of sr(e))a.dbAttrs.forEach((r,l)=>{if(r.sharedColumnRef!=null)return;const s=Ei(a,r,l,n,o);xo(s)||i.push({attr:a,col:r,name:s})});return i}function Cp(e,n){const o=wp(e),i=new Map,a=new Map,r=new Map;for(const m of e.entities)for(const u of m.attributes)i.set(u.modelId,m),u.dbAttrs.forEach((p,y)=>{const f=Ei(u,p,y,e,n);y===0&&a.set(u.modelId,f),r.set(p.modelId,f)});const l=[],s=[],c=[];for(const m of o){const u=gs(m),p=xp(m,e,n);if(p.length===0)continue;const y=p.map(({attr:_,col:E,name:g})=>{const N=[` ${g} ${Ip(E)}`];return _.notNull&&!_.identifier&&N.push("NOT NULL"),E.unique&&N.push("UNIQUE"),N.join(" ")}),f=sr(m).filter(_=>_.identifier).map(_=>a.get(_.modelId)).filter(_=>!xo(_));f.length&&y.push(` PRIMARY KEY (${f.join(", ")})`),l.push(`CREATE TABLE ${u} (
6
+ ${y.join(`,
7
7
  `)}
8
- );`);const g=new Map;for(const b of er(u)){const N=b.derivedFrom;if(!N)continue;const h=a.get(b.modelId),k=i.get(N.sourceAttributeRef),P=a.get(N.sourceAttributeRef);if(No(h)||!k||No(P))continue;const A=g.get(N.associationRef)??{childCols:[],parentTable:os(k),parentCols:[]};A.childCols.push(h),A.parentCols.push(P),g.set(N.associationRef,A)}let _=0;for(const b of g.values()){const N=`fk_${m}_${b.parentTable}${g.size>1?`_${++_}`:""}`;s.push(`ALTER TABLE ${m} ADD CONSTRAINT ${N} FOREIGN KEY (${b.childCols.join(", ")}) REFERENCES ${b.parentTable} (${b.parentCols.join(", ")});`)}for(const b of u.indexes??[]){const N=b.columns.map(k=>r.get(k.columnRef)).filter(k=>!No(k));if(!N.length)continue;const h=b.name||`ix_${m}_${N.join("_")}`;c.push(`CREATE ${b.unique?"UNIQUE ":""}INDEX ${h} ON ${m} (${N.join(", ")});`)}}return[l.join(`
8
+ );`);const b=new Map;for(const _ of sr(m)){const E=_.derivedFrom;if(!E)continue;const g=a.get(_.modelId),N=i.get(E.sourceAttributeRef),V=a.get(E.sourceAttributeRef);if(xo(g)||!N||xo(V))continue;const T=b.get(E.associationRef)??{childCols:[],parentTable:gs(N),parentCols:[]};T.childCols.push(g),T.parentCols.push(V),b.set(E.associationRef,T)}let h=0;for(const _ of b.values()){const E=`fk_${u}_${_.parentTable}${b.size>1?`_${++h}`:""}`;s.push(`ALTER TABLE ${u} ADD CONSTRAINT ${E} FOREIGN KEY (${_.childCols.join(", ")}) REFERENCES ${_.parentTable} (${_.parentCols.join(", ")});`)}for(const _ of m.indexes??[]){const E=_.columns.map(N=>r.get(N.columnRef)).filter(N=>!xo(N));if(!E.length)continue;const g=_.name||`ix_${u}_${E.join("_")}`;c.push(`CREATE ${_.unique?"UNIQUE ":""}INDEX ${g} ON ${u} (${E.join(", ")});`)}}return[l.join(`
9
9
 
10
10
  `),s.join(`
11
11
  `),c.join(`
12
- `)].filter(u=>u.length).join(`
12
+ `)].filter(m=>m.length).join(`
13
13
 
14
- `)}const tr="entity-modeler-diagram",nr=1;class fn extends Error{constructor(t){super(t),this.name="InvalidDiagramJsonError"}}function is(e,t){return JSON.stringify({format:tr,version:nr,logical:e,layout:t},null,2)}const pi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Un=e=>Array.isArray(e)?e:[];function as(e){let t;try{t=JSON.parse(e)}catch{throw new fn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!pi(t))throw new fn("최상위가 객체가 아닙니다.");if(t.format!==tr)throw new fn(`형식이 아닙니다(format=${String(t.format)}).`);if(typeof t.version!="number"||t.version>nr)throw new fn(`지원하지 않는 버전(version=${String(t.version)}).`);const o=t.logical;if(!pi(o)||!Array.isArray(o.entities))throw new fn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!pi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new fn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Un(o.associations),groups:Un(o.groups)},a=pi(t.layout)?t.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Un(a.entityLayouts),associationLayouts:Un(a.associationLayouts),groupLayouts:Un(a.groupLayouts),notes:Un(a.notes)};return{logical:i,layout:r}}const sp=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function _t(e){return e.replace(sp,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Le(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function rs(e){return`<text ${[`x="${Le(e.x)}"`,`y="${Le(e.y)}"`,`fill="${_t(e.fill)}"`,`font-size="${Le(e.fontSize)}"`,e.fontFamily?`font-family="${_t(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${_t(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${_t(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${_t(e.text)}</text>`}function cp(e){return`<line x1="${Le(e.x1)}" y1="${Le(e.y)}" x2="${Le(e.x2)}" y2="${Le(e.y)}" stroke="${_t(e.stroke)}" stroke-width="${Le(e.strokeWidth??1)}" />`}function dp(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 up(e,t,o,i,a){return[`M${Le(e+a.tl)},${Le(t)}`,`L${Le(e+o-a.tr)},${Le(t)}`,a.tr?`Q${Le(e+o)},${Le(t)} ${Le(e+o)},${Le(t+a.tr)}`:"",`L${Le(e+o)},${Le(t+i-a.br)}`,a.br?`Q${Le(e+o)},${Le(t+i)} ${Le(e+o-a.br)},${Le(t+i)}`:"",`L${Le(e+a.bl)},${Le(t+i)}`,a.bl?`Q${Le(e)},${Le(t+i)} ${Le(e)},${Le(t+i-a.bl)}`:"",`L${Le(e)},${Le(t+a.tl)}`,a.tl?`Q${Le(e)},${Le(t)} ${Le(e+a.tl)},${Le(t)}`:"","Z"].filter(Boolean).join(" ")}function or(e){const t=dp(e.radius),o=t.tl||t.tr||t.br||t.bl,i=[`fill="${_t(e.fill)}"`,`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Le(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${up(e.x,e.y,e.w,e.h,t)}" ${i.join(" ")} />`:`<rect x="${Le(e.x)}" y="${Le(e.y)}" width="${Le(e.w)}" height="${Le(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(cp(l));for(const l of e.texts)r.push(rs(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function mp(e){const o=[`<path ${[`d="${_t(e.d)}"`,'fill="none"',`stroke="${_t(e.stroke)}"`,`stroke-width="${Le(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(rs(i));return`<g>${o.join("")}</g>`}function ls(e){const{x:t,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Le(t)}" y="${Le(o)}" width="${Le(i)}" height="${Le(a)}" fill="${_t(e.background)}" />`);for(const l of e.groups)r.push(or(l));for(const l of e.edges)r.push(mp(l));for(const l of e.entities)r.push(or(l));for(const l of e.notes)r.push(or(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Le(t)} ${Le(o)} ${Le(i)} ${Le(a)}" width="${Le(i)}" height="${Le(a)}">`+r.join("")+"</svg>"}function ir(e,t){var r,l,s;const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=t.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}const Fn="javax.persistence",We={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},hi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function fp(e){if(!e)return;if(hi[e])return{simpleName:e,fqn:hi[e]};const t=Object.entries(hi).find(([,o])=>o===e);return t?{simpleName:t[0],fqn:t[1]}:void 0}function pp(e,t,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of t){const l=i.get(r);l&&a.push(bp(l,e,o))}return a}class ss{constructor(){qe(this,"imports",new Set);qe(this,"body",[]);qe(this,"fillIns",[])}import(t){t.includes(".")&&!t.startsWith("java.lang.")&&this.imports.add(t)}jpa(t){this.import(`${Fn}.${t}`)}line(t=""){this.body.push(t)}fillIn(t){this.fillIns.push(t)}render(t){const o=[`package ${t};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
14
+ `)}const cr="entity-modeler-diagram",dr=1;class pn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function bs(e,n){return JSON.stringify({format:cr,version:dr,logical:e,layout:n},null,2)}const Ni=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Kn=e=>Array.isArray(e)?e:[];function _s(e){let n;try{n=JSON.parse(e)}catch{throw new pn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Ni(n))throw new pn("최상위가 객체가 아닙니다.");if(n.format!==cr)throw new pn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>dr)throw new pn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Ni(o)||!Array.isArray(o.entities))throw new pn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Ni(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new pn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Kn(o.associations),groups:Kn(o.groups)},a=Ni(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Kn(a.entityLayouts),associationLayouts:Kn(a.associationLayouts),groupLayouts:Kn(a.groupLayouts),notes:Kn(a.notes)};return{logical:i,layout:r}}const Sp=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function _t(e){return e.replace(Sp,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Fe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function ks(e){return`<text ${[`x="${Fe(e.x)}"`,`y="${Fe(e.y)}"`,`fill="${_t(e.fill)}"`,`font-size="${Fe(e.fontSize)}"`,e.fontFamily?`font-family="${_t(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${_t(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${_t(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${_t(e.text)}</text>`}function $p(e){return`<line x1="${Fe(e.x1)}" y1="${Fe(e.y)}" x2="${Fe(e.x2)}" y2="${Fe(e.y)}" stroke="${_t(e.stroke)}" stroke-width="${Fe(e.strokeWidth??1)}" />`}function Rp(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 Ap(e,n,o,i,a){return[`M${Fe(e+a.tl)},${Fe(n)}`,`L${Fe(e+o-a.tr)},${Fe(n)}`,a.tr?`Q${Fe(e+o)},${Fe(n)} ${Fe(e+o)},${Fe(n+a.tr)}`:"",`L${Fe(e+o)},${Fe(n+i-a.br)}`,a.br?`Q${Fe(e+o)},${Fe(n+i)} ${Fe(e+o-a.br)},${Fe(n+i)}`:"",`L${Fe(e+a.bl)},${Fe(n+i)}`,a.bl?`Q${Fe(e)},${Fe(n+i)} ${Fe(e)},${Fe(n+i-a.bl)}`:"",`L${Fe(e)},${Fe(n+a.tl)}`,a.tl?`Q${Fe(e)},${Fe(n)} ${Fe(e+a.tl)},${Fe(n)}`:"","Z"].filter(Boolean).join(" ")}function ur(e){const n=Rp(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${_t(e.fill)}"`,`stroke="${_t(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Fe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Ap(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Fe(e.x)}" y="${Fe(e.y)}" width="${Fe(e.w)}" height="${Fe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push($p(l));for(const l of e.texts)r.push(ks(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function Tp(e){const o=[`<path ${[`d="${_t(e.d)}"`,'fill="none"',`stroke="${_t(e.stroke)}"`,`stroke-width="${Fe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${_t(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(ks(i));return`<g>${o.join("")}</g>`}function Es(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Fe(n)}" y="${Fe(o)}" width="${Fe(i)}" height="${Fe(a)}" fill="${_t(e.background)}" />`);for(const l of e.groups)r.push(ur(l));for(const l of e.edges)r.push(Tp(l));for(const l of e.entities)r.push(ur(l));for(const l of e.notes)r.push(ur(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Fe(n)} ${Fe(o)} ${Fe(i)} ${Fe(a)}" width="${Fe(i)}" height="${Fe(a)}">`+r.join("")+"</svg>"}function mr(e,n){var r,l,s;const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}const Yn="javax.persistence",Xe={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},wi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Vp(e){if(!e)return;if(wi[e])return{simpleName:e,fqn:wi[e]};const n=Object.entries(wi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Mp(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&a.push(Lp(l,e,o))}return a}class Ns{constructor(){Ze(this,"imports",new Set);Ze(this,"body",[]);Ze(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${Yn}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
15
15
  `)+`
16
- `}}function cs(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function hp(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(t,o)=>o.toUpperCase()):""}function Hn(e,t){t&&(e.import(We.lombokGetter),e.line(" @Getter"))}const yp=["ko","en","ja","zh"];function ar(e,t){if(!e)return[];const o=yp.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${t} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${t}/**`,`${t} * <ul>`,...o,`${t} * </ul>`,`${t} */`]}function yi(e,t,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...di,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Ln){if(i){const c=[`${Fn}.Enumerated`,`${Fn}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${Fn}.Enumerated`,`${Fn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===Rt){const c=fp(t),d=c?`CustomType '${t}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${t??"(미지정)"}`;return{...a,type:t||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${Fn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=hi[e];if(s)return{type:e,primitive:!1,imports:[s,We.jdbcTypeCode,We.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function ds(e){return e.attributes.filter(t=>t.identifier&&(t.attrType==="NORMAL"||t.attrType==="RELATION_OWN")).sort((t,o)=>t.order-o.order)}function rr(e,t,o,i=new Set){if(e.attrType!=="RELATION_OWN")return yi(e.type,e.customType,o,e.groupCode).type;const a=t.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return yi(e.type,e.customType,o).type;const r=ds(a);return r.length>=2?`${a.name}PK`:r.length===1?rr(r[0],t,o,new Set([...i,a.modelId])):yi(e.type,e.customType,o).type}function gp(e,t,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!t)return!1;const i=!sr(t.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function bp(e,t,o){var K,v,T,H,C,ae;if(e.stereotype==="JPA_EMBEDDABLE")return _p(e,t,o);const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi);const l=new Map(t.entities.map(E=>[E.modelId,E])),s=r,c=Cp(e,o,i),d=new Map;for(const E of t.associations)E.end2.attributeRef&&d.set(E.end2.attributeRef,{assoc:E,role:"owner"}),E.end1.attributeRef&&E.end1.navigable&&d.set(E.end1.attributeRef,{assoc:E,role:"inverse"});const u=ds(e),m=new Set(u.filter(E=>E.attrType==="NORMAL").flatMap(E=>E.dbAttrs.map(Y=>Y.physicalName)).filter(Boolean)),f=new Set;for(const E of u)gp(E,(K=d.get(E.modelId))==null?void 0:K.assoc,m)&&f.add(E.modelId);const p=u.filter(E=>!f.has(E.modelId)),y=p.length>=2,g=p.length===1,_=`${a}PK`,b=E=>f.has(E.modelId)?"mapsId":E.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator);const h=["@Entity"];h.push(Np(e,o,i)),h.push('@SuppressWarnings("serial")'),h.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${r}.${a}.${_}`),h.push(`@IdClass(${a}.${_}.class)`)),(v=e.jpaAttrs)!=null&&v.useDynamicInsert&&(h.push("@DynamicInsert"),i.import(We.dynamicInsert)),(T=e.jpaAttrs)!=null&&T.useDynamicUpdate&&(h.push("@DynamicUpdate"),i.import(We.dynamicUpdate)),(H=e.jpaAttrs)!=null&&H.useCacheable&&(h.push("@Cacheable"),i.jpa("Cacheable")),N&&(i.import(We.lombokNoArgs),i.import(We.lombokAccessLevel),h.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const E of ar((C=e.table)==null?void 0:C.logicalName,""))i.line(E);for(const E of h)i.line(E);i.line(`public class ${a}${c} {`);const k=e.attributes.filter(E=>E.attrType!=="DIVIDER").sort((E,Y)=>E.order-Y.order),P=(ae=e.jpaAttrs)!=null&&ae.useVersion?u.length?u[u.length-1].modelId:null:void 0,A=[];for(const E of k){if(E.attrType.startsWith("EMBED"))A.push(...hs(E,e,t,o,i));else if(E.attrType==="RELATION_OWN"){const Y=d.get(E.modelId);Y&&A.push(vp(E,Y.assoc,s,l,b(E),N,t,o,i))}else if(E.attrType==="RELATION_REF"){const Y=d.get(E.modelId);Y&&A.push(xp(E,Y.assoc,s,l,N,t,o,i))}else A.push(fs(E,a,o,i));E.modelId===P&&us(i,A,N)}P===null&&us(i,A,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),ms(A,i,N),y&&(i.import(We.jsonBackReference),i.import(We.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${_} getPK() {`),i.line(` return (${_}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Sp(_,p.map(E=>({type:rr(E,t,o),name:E.name})),N,i)),i.line("}");let G;return y?G=$p(a,_,r):g&&(G=Rp(a,r,rr(p[0],t,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:G}}function us(e,t,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||t.push({type:"int",name:"dataVersion",category:0})}function ms(e,t,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;t.line(""),t.line(` public ${a.type} get${cs(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(t.import("java.util.Collections"),t.line(` return Collections.${r}(this.${a.name});`)):t.line(` return ${a.name};`),t.line(" }")}}function _p(e,t,o){var c;const i=new ss,a=e.name;let r=wo(e,t,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${gi}')`),r=gi),i.jpa("Embeddable"),i.import(We.jsonIdentityInfo),i.import(We.jsogGenerator),i.import(We.serializable);for(const d of ar((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const l=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,u)=>d.order-u.order),s=[];for(const d of l){if(d.attrType.startsWith("EMBED")){s.push(...hs(d,e,t,o,i));continue}s.push(fs(d,a,o,i))}return ms(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function fs(e,t,o,i){const a=e.dbAttrs[0],r=e.name||hp(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${t}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=yi(e.type,e.customType,o,e.groupCode);for(const d of l.imports)i.import(d);for(const d of l.fillIns)i.fillIn(`${t}.${r}: ${d}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${t}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of ar(a==null?void 0:a.logicalName," "))i.line(d);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(We.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Ip(e,a,i)}`);for(const d of l.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Hn(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(Hn(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function ps(e,t,o){var r,l;if(e.attrType==="EMBED_PREDEF"){const s=(r=o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var u,m;return{fieldName:((u=s==null?void 0:s.fields[d])==null?void 0:u.name)??"",defaultPhysical:((m=s==null?void 0:s.fields[d])==null?void 0:m.physicalName)??""}})}const i=(l=e.embedded)!=null&&l.embeddableRef?t.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function kp(e,t,o,i,a){const r=mn(un(t,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],u=zn(s,r);if(!d||!d.fieldName){(u||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${t.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(u){l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u.physicalName}", insertable = false, updatable = false))`);return}const m=s.physicalName||d.defaultPhysical;m&&m!==d.defaultPhysical&&l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${m}"))`)}),l}function hs(e,t,o,i,a){var m,f,p,y;const r=t.name,l=wo(t,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(_=>_.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const _=wo(g,o,i);_&&_!==l&&a.import(`${_}.${g.name}`)}}if(e.type==="Money")return[Ep(e,t,o,i,a)];const c=ps(e,o,i),d=kp(e,t,o,c,a),u=Ja(e,o.associations);if(a.line(""),u){const g=o.associations.find(P=>{var A;return P.modelId===((A=e.embedded)==null?void 0:A.associationRef)}),_=g?g.end2.entityRef===((f=e.embedded)==null?void 0:f.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(p=_==null?void 0:_.jpa)==null?void 0:p.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),lr(d,a);const N=u==="SET";!N&&((y=_==null?void 0:_.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${_.jpa.orderColumn}")`)),a.import(N?"java.util.Set":"java.util.List"),a.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${s}>`:`List<${s}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${k};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),lr(d,a),Hn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Ep(e,t,o,i,a){a.jpa("Embedded"),a.import(We.compositeType),a.import(We.money),a.import(We.moneyUserType);const r=ps(e,o,i),l=mn(un(t,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var _,b;const u=((_=r[d])==null?void 0:_.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),m=zn(c,l),f=((b=r[d])==null?void 0:b.defaultPhysical)||"",p=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!p||p===f))return[];const g=[`name = "${m?m.physicalName:p||f}"`];return e.notNull&&g.push("nullable = false"),m?g.push("insertable = false","updatable = false"):(c.insertable===!1&&g.push("insertable = false"),c.updatable===!1&&g.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${g.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),lr(s,a),Hn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function lr(e,t){e.length!==0&&(t.jpa("AttributeOverride"),t.jpa("AttributeOverrides"),t.jpa("Column"),t.line(" @AttributeOverrides({"),e.forEach((o,i)=>t.line(` ${o}${i<e.length-1?",":""}`)),t.line(" })"))}function Np(e,t,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const r=new Map;for(const d of e.attributes)for(const u of d.dbAttrs)r.set(u.modelId,u.physicalName);for(const d of go(e,t.superClassCatalog??[]))r.set(d.modelId,d.physicalName);const l=a.map(d=>{const u=[];for(const f of d.columns){const p=r.get(f.columnRef);p?u.push(p):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${f.columnRef}) — 카탈로그 확인`)}const m=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${u.join(", ")}"${m})`});if(l.length===1)return`@Table(name = "${i}", indexes = { ${l[0]} })`;const s=l.map(d=>` ${d}`).join(`,
16
+ `}}function ws(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Bp(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function qn(e,n){n&&(e.import(Xe.lombokGetter),e.line(" @Getter"))}const Dp=["ko","en","ja","zh"];function fr(e,n){if(!e)return[];const o=Dp.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function vi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...bi,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Hn){if(i){const c=[`${Yn}.Enumerated`,`${Yn}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${Yn}.Enumerated`,`${Yn}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===At){const c=Vp(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType")return{type:"Money",primitive:!1,imports:["net.g1project.bluecomm.money.Money",`${Yn}.Convert`],fieldAnnotations:["@Convert(converter = net.g1project.bluecomm.money.MoneyAttributeConverter.class)"],fillIns:[]};const s=wi[e];if(s)return{type:e,primitive:!1,imports:[s,Xe.jdbcTypeCode,Xe.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],m=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),m.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:m}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function vs(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function pr(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return vi(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return vi(e.type,e.customType,o).type;const r=vs(a);return r.length>=2?`${a.name}PK`:r.length===1?pr(r[0],n,o,new Set([...i,a.modelId])):vi(e.type,e.customType,o).type}function Op(e,n,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!n)return!1;const i=!yr(n.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function Lp(e,n,o){var z,w,x,F,C,se;if(e.stereotype==="JPA_EMBEDDABLE")return Pp(e,n,o);const i=new Ns,a=e.name;let r=Co(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${Ii}')`),r=Ii);const l=new Map(n.entities.map(k=>[k.modelId,k])),s=r,c=Yp(e,o,i),d=new Map;for(const k of n.associations)k.end2.attributeRef&&d.set(k.end2.attributeRef,{assoc:k,role:"owner"}),k.end1.attributeRef&&k.end1.navigable&&d.set(k.end1.attributeRef,{assoc:k,role:"inverse"});const m=vs(e),u=new Set(m.filter(k=>k.attrType==="NORMAL").flatMap(k=>k.dbAttrs.map(G=>G.physicalName)).filter(Boolean)),p=new Set;for(const k of m)Op(k,(z=d.get(k.modelId))==null?void 0:z.assoc,u)&&p.add(k.modelId);const y=m.filter(k=>!p.has(k.modelId)),f=y.length>=2,b=y.length===1,h=`${a}PK`,_=k=>p.has(k.modelId)?"mapsId":k.identifier?"id":"none",E=o.lombok!==!1;i.jpa("Entity"),i.import(Xe.jsonIdentityInfo),i.import(Xe.jsogGenerator);const g=["@Entity"];g.push(Fp(e,o,i)),g.push('@SuppressWarnings("serial")'),g.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),f&&(i.jpa("IdClass"),i.import(`${r}.${a}.${h}`),g.push(`@IdClass(${a}.${h}.class)`)),(w=e.jpaAttrs)!=null&&w.useDynamicInsert&&(g.push("@DynamicInsert"),i.import(Xe.dynamicInsert)),(x=e.jpaAttrs)!=null&&x.useDynamicUpdate&&(g.push("@DynamicUpdate"),i.import(Xe.dynamicUpdate)),(F=e.jpaAttrs)!=null&&F.useCacheable&&(g.push("@Cacheable"),i.jpa("Cacheable")),E&&(i.import(Xe.lombokNoArgs),i.import(Xe.lombokAccessLevel),g.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const k of fr((C=e.table)==null?void 0:C.logicalName,""))i.line(k);for(const k of g)i.line(k);i.line(`public class ${a}${c} {`);const N=e.attributes.filter(k=>k.attrType!=="DIVIDER").sort((k,G)=>k.order-G.order),V=(se=e.jpaAttrs)!=null&&se.useVersion?m.length?m[m.length-1].modelId:null:void 0,T=[];for(const k of N){if(k.attrType.startsWith("EMBED"))T.push(...$s(k,e,n,o,i));else if(k.attrType==="RELATION_OWN"){const G=d.get(k.modelId);G&&T.push(jp(k,G.assoc,s,l,_(k),E,n,o,i))}else if(k.attrType==="RELATION_REF"){const G=d.get(k.modelId);G&&T.push(Gp(k,G.assoc,s,l,E,n,o,i))}else T.push(Cs(k,a,o,i));k.modelId===V&&Is(i,T,E)}V===null&&Is(i,T,E),E||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),xs(T,i,E),f&&(i.import(Xe.jsonBackReference),i.import(Xe.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${h} getPK() {`),i.line(` return (${h}) HibernateBeanUtil.getPK(this);`),i.line(" }"),qp(h,y.map(k=>({type:pr(k,n,o),name:k.name})),E,i)),i.line("}");let I;return f?I=Wp(a,h,r):b&&(I=Xp(a,r,pr(y[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:I}}function Is(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function xs(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${ws(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function Pp(e,n,o){var c;const i=new Ns,a=e.name;let r=Co(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${Ii}')`),r=Ii),i.jpa("Embeddable"),i.import(Xe.jsonIdentityInfo),i.import(Xe.jsogGenerator),i.import(Xe.serializable);for(const d of fr((c=e.table)==null?void 0:c.logicalName,""))i.line(d);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)"),i.line(`public class ${a} implements Serializable {`);const l=e.attributes.filter(d=>d.attrType!=="DIVIDER").sort((d,m)=>d.order-m.order),s=[];for(const d of l){if(d.attrType.startsWith("EMBED")){s.push(...$s(d,e,n,o,i));continue}s.push(Cs(d,a,o,i))}return xs(s,i,o.lombok!==!1),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Cs(e,n,o,i){const a=e.dbAttrs[0],r=e.name||Bp(a==null?void 0:a.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${r}: 속성 이름 미지정 — 물리명 '${(a==null?void 0:a.physicalName)??""}'에서 파생, 모델 정정 필요`);const l=vi(e.type,e.customType,o,e.groupCode);for(const d of l.imports)i.import(d);for(const d of l.fillIns)i.fillIn(`${n}.${r}: ${d}`);const s=(a==null?void 0:a.multiValue)===!0,c=s?`Set<${l.type}>`:l.type;s&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${r}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const d of fr(a==null?void 0:a.logicalName," "))i.line(d);e.identifier&&(i.jpa("Id"),i.line(" @Id"),a!=null&&a.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(Xe.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${Kp(e,a,i)}`);for(const d of l.fieldAnnotations)i.line(` ${d}`);return s?(i.line(` // TODO [손채움]: ${r} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),qn(i,o.lombok!==!1),i.line(` private ${c} ${r} = new LinkedHashSet<>();`)):(qn(i,o.lombok!==!1),i.line(` private ${c} ${r};`)),{type:c,name:r,category:0}}function Ss(e,n,o){var r,l;if(e.attrType==="EMBED_PREDEF"){const s=(r=o.embeddableCatalog)==null?void 0:r.find(c=>c.type===e.type);return e.dbAttrs.map((c,d)=>{var m,u;return{fieldName:((m=s==null?void 0:s.fields[d])==null?void 0:m.name)??"",defaultPhysical:((u=s==null?void 0:s.fields[d])==null?void 0:u.physicalName)??""}})}const i=(l=e.embedded)!=null&&l.embeddableRef?n.entities.find(s=>s.modelId===e.embedded.embeddableRef):void 0,a=[];if(i)for(const s of i.attributes.filter(c=>c.attrType!=="DIVIDER"))for(const c of s.dbAttrs)c.physicalName&&a.push({fieldName:s.name,defaultPhysical:c.physicalName});return a}function zp(e,n,o,i,a){const r=fn(mn(n,o.entities)),l=[];return e.dbAttrs.forEach((s,c)=>{const d=i[c],m=Gn(s,r);if(!d||!d.fieldName){(m||s.physicalName&&s.physicalName!==(d==null?void 0:d.defaultPhysical))&&a.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${c}] @AttributeOverride 필드명 미해소(카탈로그/임베더블 확인)`);return}if(m){l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${m.physicalName}", insertable = false, updatable = false))`);return}const u=s.physicalName||d.defaultPhysical;u&&u!==d.defaultPhysical&&l.push(`@AttributeOverride(name = "${d.fieldName}", column = @Column(name = "${u}"))`)}),l}function $s(e,n,o,i,a){var u,p,y,f;const r=n.name,l=Co(n,o,i);let s=e.type;if(e.attrType==="EMBED_OWN"){const b=(u=e.embedded)!=null&&u.embeddableRef?o.entities.find(h=>h.modelId===e.embedded.embeddableRef):void 0;if(b){s=b.name;const h=Co(b,o,i);h&&h!==l&&a.import(`${h}.${b.name}`)}}if(e.type==="Money")return[Up(e,n,o,i,a)];const c=Ss(e,o,i),d=zp(e,n,o,c,a),m=ar(e,o.associations);if(a.line(""),m){const b=o.associations.find(V=>{var T;return V.modelId===((T=e.embedded)==null?void 0:T.associationRef)}),h=b?b.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?b.end2:b.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const _=(y=h==null?void 0:h.jpa)==null?void 0:y.collectionTable;_?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${_}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),hr(d,a);const E=m==="SET";!E&&((f=h==null?void 0:h.jpa)!=null&&f.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${h.jpa.orderColumn}")`)),a.import(E?"java.util.Set":"java.util.List"),a.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const g=E?`Set<${s}>`:`List<${s}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${g} ${e.name} = ${N};`),[{type:g,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),hr(d,a),qn(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Up(e,n,o,i,a){a.jpa("Embedded"),a.import(Xe.compositeType),a.import(Xe.money),a.import(Xe.moneyUserType);const r=Ss(e,o,i),l=fn(mn(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var h,_;const m=((h=r[d])==null?void 0:h.fieldName)||(d===0?"amount":d===1?"currency":`field${d}`),u=Gn(c,l),p=((_=r[d])==null?void 0:_.defaultPhysical)||"",y=c.physicalName||"",f=c.insertable===!1||c.updatable===!1;if(!u&&!f&&(!y||y===p))return[];const b=[`name = "${u?u.physicalName:y||p}"`];return e.notNull&&b.push("nullable = false"),u?b.push("insertable = false","updatable = false"):(c.insertable===!1&&b.push("insertable = false"),c.updatable===!1&&b.push("updatable = false")),[`@AttributeOverride(name = "${m}", column = @Column(${b.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),hr(s,a),qn(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function hr(e,n){e.length!==0&&(n.jpa("AttributeOverride"),n.jpa("AttributeOverrides"),n.jpa("Column"),n.line(" @AttributeOverrides({"),e.forEach((o,i)=>n.line(` ${o}${i<e.length-1?",":""}`)),n.line(" })"))}function Fp(e,n,o){var c;o.jpa("Table");const i=((c=e.table)==null?void 0:c.physicalName)??"",a=e.indexes??[];if(a.length===0)return`@Table(name = "${i}")`;o.jpa("Index");const r=new Map;for(const d of e.attributes)for(const m of d.dbAttrs)r.set(m.modelId,m.physicalName);for(const d of ko(e,n.superClassCatalog??[]))r.set(d.modelId,d.physicalName);const l=a.map(d=>{const m=[];for(const p of d.columns){const y=r.get(p.columnRef);y?m.push(y):o.fillIn(`${e.name}.@Index(${d.name}): 컬럼 참조 미해소(${p.columnRef}) — 카탈로그 확인`)}const u=d.unique?", unique = true":"";return`@Index(name = "${d.name}", columnList = "${m.join(", ")}"${u})`});if(l.length===1)return`@Table(name = "${i}", indexes = { ${l[0]} })`;const s=l.map(d=>` ${d}`).join(`,
17
17
  `);return`@Table(name = "${i}", indexes = {
18
18
  ${s}
19
- })`}function sr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function wp(e,t,o){var r;const i=o.get(t.end1.entityRef);if(e.derivedFrom){const l=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(l!=null&&l.dbAttrs[0])return l.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(l=>l.identifier&&l.dbAttrs.length>0);return(r=a==null?void 0:a.dbAttrs[0])==null?void 0:r.physicalName}function ys(e,t,o,i,a){if(!e)return;const r=wo(e,o,i);r&&r!==t&&a.import(`${r}.${e.name}`)}function vp(e,t,o,i,a,r,l,s,c){var N,h;const d=i.get(t.end1.entityRef),u=(d==null?void 0:d.name)??t.end1.entityRef,m=sr(t.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),ys(d,o,l,s,c);const f=t.end2.jpa,p=[];e.notNull&&p.push("optional = false"),f!=null&&f.fetchType&&(c.jpa("FetchType"),p.push(`fetch = FetchType.${f.fetchType}`)),(N=f==null?void 0:f.cascadeTypes)!=null&&N.length&&(c.jpa("CascadeType"),p.push(`cascade = { ${f.cascadeTypes.map(k=>`CascadeType.${k}`).join(", ")} }`));const y=e.dbAttrs[0];c.jpa("JoinColumn");const g=wp(e,t,i),_=(y==null?void 0:y.physicalName)||g||"",b=[];return _?b.push(`name = "${_}"`):c.fillIn(`${((h=i.get(t.end2.entityRef))==null?void 0:h.name)??""}.${e.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),g&&b.push(`referencedColumnName = "${g}"`),e.notNull&&b.push("nullable = false"),(y==null?void 0:y.insertable)===!1&&b.push("insertable = false"),(y==null?void 0:y.updatable)===!1&&b.push("updatable = false"),c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${p.length?`(${p.join(", ")})`:""}`),c.line(` @JoinColumn(${b.join(", ")})`),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Hn(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function xp(e,t,o,i,a,r,l,s){const c=i.get(t.end2.entityRef),d=(c==null?void 0:c.name)??t.end2.entityRef;ys(c,o,r,l,s);const u=c==null?void 0:c.attributes.find(P=>P.modelId===t.end2.attributeRef),m=(u==null?void 0:u.name)??"",f=sr(t.end2.multiplicity);if(s.line(""),!f)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),Hn(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const p=t.end1.jpa,y=t.end1.composition||t.end2.composition;let g=(p==null?void 0:p.cascadeTypes)??[],_=p==null?void 0:p.orphanRemoval;y&&g.length===0&&(g=["ALL"],_==null&&(_=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),b.push(`cascade = { ${g.map(P=>`CascadeType.${P}`).join(", ")} }`)),_&&b.push("orphanRemoval = true"),p!=null&&p.fetchType&&(s.jpa("FetchType"),b.push(`fetch = FetchType.${p.fetchType}`)),s.line(` @OneToMany(${b.join(", ")})`),p!=null&&p.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${p.orderBy}")`));const N=(p==null?void 0:p.collectionType)==="SET";s.import(N?"java.util.Set":"java.util.List"),s.import(N?"java.util.LinkedHashSet":"java.util.ArrayList");const h=N?`Set<${d}>`:`List<${d}>`,k=N?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${k};`),{type:h,name:e.name,category:1,collection:!0}}function Ip(e,t,o){o.jpa("Column");const i=[`name = "${(t==null?void 0:t.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),t){const a=_o.has(t.dataType);t.length!=null&&i.push(a?`precision = ${t.length}`:`length = ${t.length}`),t.scale!=null&&i.push(`scale = ${t.scale}`),t.insertable===!1&&i.push("insertable = false"),t.updatable===!1&&i.push("updatable = false"),t.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function Cp(e,t,o){var l;const i=t.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function Sp(e,t,o,i){i.import(We.serializable),i.import(We.objects),i.import(We.jsonUtils),o&&i.import(We.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of t)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${t.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of t)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of t)i.line(""),i.line(` public ${a.type} get${cs(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${t.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${t.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function $p(e,t,o){const i=[`${o}.${e}`,`${o}.${e}.${t}`,We.jpaRepository,We.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${t}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
19
+ })`}function yr(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Hp(e,n,o){var r;const i=o.get(n.end1.entityRef);if(e.derivedFrom){const l=i==null?void 0:i.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef);if(l!=null&&l.dbAttrs[0])return l.dbAttrs[0].physicalName}const a=i==null?void 0:i.attributes.find(l=>l.identifier&&l.dbAttrs.length>0);return(r=a==null?void 0:a.dbAttrs[0])==null?void 0:r.physicalName}function Rs(e,n,o,i,a){if(!e)return;const r=Co(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function jp(e,n,o,i,a,r,l,s,c){var E,g;const d=i.get(n.end1.entityRef),m=(d==null?void 0:d.name)??n.end1.entityRef,u=yr(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(u),Rs(d,o,l,s,c);const p=n.end2.jpa,y=[];e.notNull&&y.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),y.push(`fetch = FetchType.${p.fetchType}`)),(E=p==null?void 0:p.cascadeTypes)!=null&&E.length&&(c.jpa("CascadeType"),y.push(`cascade = { ${p.cascadeTypes.map(N=>`CascadeType.${N}`).join(", ")} }`));const f=e.dbAttrs[0];c.jpa("JoinColumn");const b=Hp(e,n,i),h=(f==null?void 0:f.physicalName)||b||"",_=[];return h?_.push(`name = "${h}"`):c.fillIn(`${((g=i.get(n.end2.entityRef))==null?void 0:g.name)??""}.${e.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),b&&_.push(`referencedColumnName = "${b}"`),e.notNull&&_.push("nullable = false"),(f==null?void 0:f.insertable)===!1&&_.push("insertable = false"),(f==null?void 0:f.updatable)===!1&&_.push("updatable = false"),c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${u}${y.length?`(${y.join(", ")})`:""}`),c.line(` @JoinColumn(${_.join(", ")})`),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),qn(c,r),c.line(` private ${m} ${e.name};`),{type:m,name:e.name,category:2}}function Gp(e,n,o,i,a,r,l,s){const c=i.get(n.end2.entityRef),d=(c==null?void 0:c.name)??n.end2.entityRef;Rs(c,o,r,l,s);const m=c==null?void 0:c.attributes.find(V=>V.modelId===n.end2.attributeRef),u=(m==null?void 0:m.name)??"",p=yr(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${u}")`),qn(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const y=n.end1.jpa,f=n.end1.composition||n.end2.composition;let b=(y==null?void 0:y.cascadeTypes)??[],h=y==null?void 0:y.orphanRemoval;f&&b.length===0&&(b=["ALL"],h==null&&(h=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const _=[`mappedBy = "${u}"`];b.length&&(s.jpa("CascadeType"),_.push(`cascade = { ${b.map(V=>`CascadeType.${V}`).join(", ")} }`)),h&&_.push("orphanRemoval = true"),y!=null&&y.fetchType&&(s.jpa("FetchType"),_.push(`fetch = FetchType.${y.fetchType}`)),s.line(` @OneToMany(${_.join(", ")})`),y!=null&&y.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${y.orderBy}")`));const E=(y==null?void 0:y.collectionType)==="SET";s.import(E?"java.util.Set":"java.util.List"),s.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const g=E?`Set<${d}>`:`List<${d}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${g} ${e.name} = ${N};`),{type:g,name:e.name,category:1,collection:!0}}function Kp(e,n,o){o.jpa("Column");const i=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&i.push("nullable = false"),n){const a=wo.has(n.dataType);n.length!=null&&i.push(a?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&i.push(`scale = ${n.scale}`),n.insertable===!1&&i.push("insertable = false"),n.updatable===!1&&i.push("updatable = false"),n.unique&&i.push("unique = true")}return`@Column(${i.join(", ")})`}function Yp(e,n,o){var l;const i=n.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function qp(e,n,o,i){i.import(Xe.serializable),i.import(Xe.objects),i.import(Xe.jsonUtils),o&&i.import(Xe.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of n)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${n.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of n)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of n)i.line(""),i.line(` public ${a.type} get${ws(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${n.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${n.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function Wp(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,Xe.jpaRepository,Xe.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${n}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
20
20
  `)+`
21
- `}}function Rp(e,t,o){const i=[`${t}.${e}`,We.jpaRepository,We.querydslExecutor].sort(),a=[`package ${t};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
21
+ `}}function Xp(e,n,o){const i=[`${n}.${e}`,Xe.jpaRepository,Xe.querydslExecutor].sort(),a=[`package ${n};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
22
22
  `)+`
23
- `}}const gi="com.example",Ap="command.domain";function wo(e,t,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=t.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),r=a!=null&&a.packageName?`.${a.packageName}`:"",l=i.layerSuffix??Ap,s=l?`.${l}`:"";return`${i.basePackage}${r}${s}`}return t.packageName||""}const Tp="CustomMoneyType",Vp="Money";function Mp(e){return!(e.type!==Tp||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Bp(e){const t=e.dbAttrs[0]??{modelId:De(),physicalName:"",dataType:""},o={modelId:De(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Vp,attrType:"EMBED_PREDEF",dbAttrs:[t,o]}}function Dp(e){let t=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Mp(l)?(a=!0,t=!0,Bp(l)):l);return a?{...i,attributes:r}:i});return t?{...e,entities:o}:e}function gs(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function bs(e){for(const t of e){const o=[...t.attributes].sort((s,c)=>s.order-c.order),i=o.filter(gs);if(!i.length)continue;const a=o.filter(s=>!gs(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),t.attributes=l}}function Gn(e){return JSON.parse(JSON.stringify(e))}function _s(e,t,o){var K;const i=o.idFactory??De,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(t);if(o.includeRelated){const v=new Set(t);for(const T of r.associations){const H=v.has(T.end1.entityRef),C=v.has(T.end2.entityRef);H!==C&&s.add(H?T.end2.entityRef:T.end1.entityRef)}}const c=r.entities.filter(v=>s.has(v.modelId)),d=new Set(c.map(v=>v.modelId)),u=r.associations.filter(v=>d.has(v.end1.entityRef)&&d.has(v.end2.entityRef)),m=new Set(u.map(v=>v.modelId)),f=new Map,p=v=>{let T=f.get(v);return T||(T=i(),f.set(v,T)),T};for(const v of c){p(v.modelId);for(const T of v.attributes){p(T.modelId);for(const H of T.dbAttrs)p(H.modelId)}for(const T of v.indexes??[])p(T.modelId);for(const T of v.operations??[])p(T.modelId)}for(const v of u)p(v.modelId);const y=v=>f.get(v),g=c.map(v=>{const T=Gn(v);T.modelId=y(v.modelId),T.attributes=T.attributes.map(H=>Op(H,y,m,d));for(const H of T.indexes??[])H.modelId=y(H.modelId),H.columns=H.columns.map(C=>yo(C.columnRef)?C:{...C,columnRef:y(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const H of T.operations??[])H.modelId=y(H.modelId);return T});bs(g);const _=u.map(v=>{const T=Gn(v);return T.modelId=y(v.modelId),T.end1=ks(T.end1,y),T.end2=ks(T.end2,y),T}),b=[];for(const v of r.groups){const T=v.memberEntityRefs.filter(C=>d.has(C));if(T.length===0)continue;const H=Gn(v);H.modelId=p(v.modelId),H.memberEntityRefs=T.map(C=>y(C)),b.push(H)}const N=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map(v=>v.name)),k=new Set(o.existing.entities.map(v=>{var T;return(T=v.table)==null?void 0:T.physicalName}).filter(v=>!!v));for(const v of g)h.has(v.name)&&(v.name=`${v.name}${N}`),(K=v.table)!=null&&K.physicalName&&k.has(v.table.physicalName)&&(v.table.physicalName=`${v.table.physicalName}${N}`);const P=[];for(const v of l.entityLayouts){const T=y(v.entityRef);if(!T)continue;const H=Gn(v);H.entityRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},H.attributeStyles&&(H.attributeStyles=bi(H.attributeStyles,y)),H.operationStyles&&(H.operationStyles=bi(H.operationStyles,y)),P.push(H)}const A=[];for(const v of l.associationLayouts){const T=y(v.associationRef);if(!T)continue;const H=Gn(v);H.associationRef=T,H.sourceColumnRef=v.sourceColumnRef?y(v.sourceColumnRef):void 0,H.targetColumnRef=v.targetColumnRef?y(v.targetColumnRef):void 0,H.waypoints=H.waypoints.map(C=>cr(C,a)),A.push(H)}const G=[];for(const v of l.groupLayouts){const T=y(v.groupRef);if(!T)continue;const H=Gn(v);H.groupRef=T,H.geo={...H.geo,location:cr(H.geo.location,a)},delete H.memberNoteRefs,G.push(H)}return{logical:{entities:g,associations:_,groups:b},layout:{entityLayouts:P,associationLayouts:A,groupLayouts:G},idMap:f}}function cr(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Op(e,t,o,i){e.modelId=t(e.modelId);for(const a of e.dbAttrs)if(a.modelId=t(a.modelId),a.sharedColumnRef!==void 0){const r=t(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:t(e.derivedFrom.associationRef),sourceAttributeRef:t(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:t(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:t(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function ks(e,t){return{...e,entityRef:t(e.entityRef),attributeRef:e.attributeRef?t(e.attributeRef):void 0}}function bi(e,t){const o={};for(const[i,a]of Object.entries(e)){const r=t(i);r&&(o[r]=a)}return o}function dr(e){if(!("rev"in e))return e;const{rev:t,...o}=e;return o}function jn(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,i)=>jn(o,t[i]));if(typeof e=="object"&&typeof t=="object"){const o=new Set([...Object.keys(e),...Object.keys(t)]);for(const i of o)if(!jn(e[i],t[i]))return!1;return!0}return!1}function pn(e,t,o){const i={},a=new Set([...Object.keys(e),...Object.keys(t)]);for(const r of a)o.has(r)||jn(e[r],t[r])||(i[r]=t[r]===void 0?null:t[r]);return Object.keys(i).length?i:null}function hn(e,t,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(t.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function Lp(e,t){const o=new Set(e),i=new Set(t),a=t.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const Pp=new Set(["attributes","operations","indexes","rev"]),zp=new Set(["end1","end2","rev"]),Up=new Set(["memberEntityRefs","rev"]),Es=new Set(["modelId"]),Fp=new Set(["modelId","columns"]),Hp=new Set([]);function Gp(e,t,o,i){const a=hn(t.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=pn(s,c,Es);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=hn(t.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=pn(s,c,Es);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=hn(t.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!jn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=pn(s,c,Fp);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function jp(e,t,o){const i=hn(e.entities??[],t.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of i.common){const c=pn(l,s,Pp);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Gp(l.modelId,l,s,o)}const a=hn(e.associations??[],t.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of a.common){const c=pn(l,s,zp);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=pn(l[d]??{},s[d]??{},Hp);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=hn(e.groups??[],t.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:dr(l)});for(const{cur:l,tgt:s}of r.common){const c=pn(l,s,Up);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Lp(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function _i(e,t,o,i,a,r,l){const s=hn(e,t,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)jn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function Kp(e,t,o){_i(e.entityLayouts??[],t.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),_i(e.associationLayouts??[],t.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),_i(e.groupLayouts??[],t.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),_i(e.notes??[],t.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Yp(e,t){const o=[];return jp(e.logical,t.logical,o),Kp(e.layout,t.layout,o),o}function Wp(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const qp={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class Xp{constructor(t){qe(this,"out",[]);qe(this,"last",new Map);this.fieldFilter=t}set(t,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...vo(t),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(t,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...vo(t),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...vo(t),field:a,value:void 0,removed:!0});continue}this.out.push({...vo(t),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(t,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...vo(t),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function vo(e){const t={seq:e.seq};return e.ts!==void 0&&(t.ts=e.ts),e.origin!==void 0&&(t.origin=e.origin),e.author!==void 0&&(t.author=e.author),e.kind!==void 0&&(t.kind=e.kind),e.restoredFromSeq!==void 0&&(t.restoredFromSeq=e.restoredFromSeq),t}function At(e,t,o,i){if(o==null||typeof o!="object")return;const a=qp[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(t,r,l)}function yn(e,t,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(t,i,a)}function ur(e,t){if(Array.isArray(e))return e.find(o=>o.modelId===t)}function Zt(e,t){var r,l,s,c,d,u,m,f;const o=Wp(t),i=new Xp(t.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==t.entityRef)break;y.kind==="entity.add"?At(i,p,y.value,"entity"):y.kind==="entity.update"?yn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((r=y.value)==null?void 0:r.attributes,t.attributeRef);g&&At(i,p,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===t.attributeRef?At(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===t.attributeRef?yn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===t.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((s=y.value)==null?void 0:s.operations,t.operationRef);g&&At(i,p,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===t.operationRef?At(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===t.operationRef?yn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===t.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==t.entityRef)break;if(y.kind==="entity.add"){const g=ur((d=y.value)==null?void 0:d.indexes,t.indexRef);g&&At(i,p,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===t.indexRef?At(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===t.indexRef?yn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===t.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==t.associationRef)break;y.kind==="association.add"?At(i,p,y.value,"association"):y.kind==="association.update"?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==t.associationRef)break;if(y.kind==="association.add"){const g=(m=y.value)==null?void 0:m[t.end];At(i,p,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===t.end?yn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==t.groupRef)break;if(y.kind==="group.add"){At(i,p,y.value,"group");const g=(f=y.value)==null?void 0:f.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(p,_,!1)}else y.kind==="group.update"?yn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}function Jp(e,t){const o=e;return o.entityRef===t||o.containerRef===t}function Kn(e,t){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&t.add(o.modelId)}function Zp(e,t){const o=new Set,i=new Set,a=new Set;for(const r of e)for(const l of r.ops){const s=l;if(l.kind==="entity.add"&&s.entityRef===t){const c=s.value;Kn(c==null?void 0:c.attributes,o),Kn(c==null?void 0:c.operations,i),Kn(c==null?void 0:c.indexes,a);continue}s.containerRef!==t&&s.entityRef!==t||(l.kind==="attribute.add"?Kn([s.value],o):l.kind==="attribute.update"||l.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):l.kind==="operation.add"?Kn([s.value],i):l.kind==="operation.update"||l.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):l.kind==="index.add"?Kn([s.value],a):(l.kind==="index.update"||l.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function ki(e,t){return e.map(o=>({...o,subject:t}))}function Ns(e,t){const o=e.filter(s=>s.ops.some(c=>Jp(c,t))),{attributes:i,operations:a,indexes:r}=Zp(o,t),l=[...ki(Zt(o,{entityRef:t}),{kind:"entity",ref:t})];for(const s of i)l.push(...ki(Zt(o,{entityRef:t,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ki(Zt(o,{entityRef:t,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ki(Zt(o,{entityRef:t,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function ws(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Qp(e){var i,a,r;const t=new Set,o=(l,s)=>{typeof s=="string"&&t.add(`${l}:${s}:`)};for(const l of e)for(const s of l.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const u of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",u.modelId);for(const u of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",u.modelId);for(const u of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",u.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(r=c.value)==null?void 0:r.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return t}function eh(e){const t=new Set,o=new Set,i=new Set;for(const a of e)for(const r of a.ops){const l=r,s=r.kind;if(s.startsWith("entity."))typeof l.entityRef=="string"&&t.add(l.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=l.containerRef??l.entityRef;typeof c=="string"&&t.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof l.associationRef=="string"&&o.add(l.associationRef):s.startsWith("group.")&&typeof l.groupRef=="string"&&i.add(l.groupRef)}return{entities:t,associations:o,groups:i}}function th(e){const{entities:t,associations:o,groups:i}=eh(e),a=[];for(const r of t)for(const l of Ns(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Zt(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Zt(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Zt(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function vs(e){const t=th(e),o=Qp(e),i=new Map;for(const l of t){const s=ws(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of t){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=ws(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}class mr{constructor(t){qe(this,"undoStack",[]);qe(this,"redoStack",[]);qe(this,"savePoint",null);qe(this,"listeners",new Set);qe(this,"commandListeners",new Set);qe(this,"coalesceSealed",!1);this.state=t}execute(t){t.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&t.coalesceKey!=null&&!!o&&o.coalesceKey===t.coalesceKey;this.coalesceSealed=!1,i?(t.invert=o.invert,this.undoStack[this.undoStack.length-1]=t):this.undoStack.push(t),this.redoStack=[],this.emitCommand(t,"do",i),this.emit()}undo(){const t=this.undoStack.pop();t&&(t.invert(this.state),this.redoStack.push(t),this.emitCommand(t,"undo",!1),this.emit())}redo(){const t=this.redoStack.pop();t&&(t.apply(this.state),this.undoStack.push(t),this.emitCommand(t,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onCommand(t){return this.commandListeners.add(t),()=>this.commandListeners.delete(t)}emit(){for(const t of this.listeners)t()}emitCommand(t,o,i){for(const a of this.commandListeners)a(t,o,i)}}function xs(e,t){return e.logical.entities.findIndex(o=>o.modelId===t)}function ot(e,t){return e.layout.entityLayouts.findIndex(o=>o.entityRef===t)}function wt(e,t){return e.layout.associationLayouts.find(o=>o.associationRef===t)}function Xe(e,t){const o=e.logical.entities.find(i=>i.modelId===t);if(!o)throw new Error(`엔티티 없음: ${t}`);return o}function zt(e,t,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===t))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function Ei(e,t,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:t,...o})},invert(i){const a=xs(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=ot(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Is(e){let t=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=xs(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=ot(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),t={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(f=>f.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(t){i.logical.entities.splice(t.entity.index,0,t.entity.item),t.entityLayout&&i.layout.entityLayouts.splice(t.entityLayout.index,0,t.entityLayout.item),[...t.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...t.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of t.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!t)return{forward:[],invert:[]};const i=[],a=[];for(const r of t.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of t.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of t.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return t.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:t.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:t.entity.item}),{forward:i,invert:a.reverse()}}}}function Cs(e,t){const o={};return{label:"엔티티 수정",apply(i){const a=Xe(i,e);for(const r of Object.keys(t))o[r]=a[r];Object.assign(a,t)},invert(i){Object.assign(Xe(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 Ss(e,t){let o="";return{label:`엔티티 이름 변경: ${t}`,apply(i){const a=Xe(i,e);o=a.name,a.name=t},invert(i){Xe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:t}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Yn(e,t){let o=null;return{label:"엔티티 이동",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...t}},invert(i){const a=ot(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function $s(e,t){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...t}},invert(i){const a=ot(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function xo(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 Rs(e,t){let o;return{label:"엔티티 색상 변경",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=xo(r.style,t)},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=ot(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function As(e,t){let o;return{label:t?"엔티티 접기":"엔티티 펼치기",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=t},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Ts(e,t){let o;return{label:t?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=ot(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=t},invert(i){const a=ot(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function fr(e){let t=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){t=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=t[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:t[l]}})}),{forward:i,invert:a}}}}function Ni(e,t,o){let i;return{label:"속성 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=ot(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function wi(e,t,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:t,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:t,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Vs(e,t){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:t}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ms(e){let t=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);t={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){t&&(o.logical.groups.splice(t.group.index,0,t.group.item),t.layout&&o.layout.groupLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:t.group.item}),{forward:o,invert:i.reverse()}}}}function Bs(e,t){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(t)&&(r.memberEntityRefs.push(t),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(t))??-1;l>=0&&r.memberEntityRefs.splice(l,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 vi(e,t){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(t))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.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 Ds(e,t){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Os(e,t){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function Ls(e,t){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=xo(a.style,t)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Ps(e,t){let o;return{label:t?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=t},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(t)],invert:[i(o)]}}}}function Ut(e,t){return{label:`속성 추가: ${t.name}`,apply(o){Xe(o,e).attributes.push(t)},invert(o){const i=Xe(o,e),a=i.attributes.findIndex(r=>r.modelId===t.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:t.modelId}]}}}}function gn(e,t,o){const i={},a=r=>{const l=Xe(r,e).attributes.find(s=>s.modelId===t);if(!l)throw new Error(`속성 없음: ${t}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),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 Wn(e,t){let o=null;return{label:"속성 삭제",apply(i){const a=Xe(i,e),r=a.attributes.findIndex(l=>l.modelId===t);if(r<0)throw new Error(`속성 없음: ${t}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Xe(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 pr(e,t,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Xe(a,e);i=r.attributes.map(m=>({...m}));const l=new Set(t),s=r.attributes.filter(m=>l.has(m.modelId)),c=r.attributes.filter(m=>!l.has(m.modelId)),d=Math.max(0,Math.min(o,c.length)),u=[...c.slice(0,d),...s,...c.slice(d)];r.attributes.splice(0,r.attributes.length,...u),r.attributes.forEach((m,f)=>m.order=f)},invert(a){i&&Xe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Xe(a,e).attributes.map(l=>({...l}));return{forward:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"attribute.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function zs(e,t){let o=!1;return{label:`메서드 추가: ${t.name}`,apply(i){const a=Xe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(t)},invert(i){var l;const a=Xe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===t.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t.modelId}]}}}}function Us(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).operations)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`메서드 없음: ${t}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),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 Fs(e,t){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Xe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===t))??-1;if(r<0)throw new Error(`메서드 없음: ${t}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Xe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:t}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Hs(e,t,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Xe(a,e),l=r.operations??[];i=l.map(f=>({...f}));const s=new Set(t),c=l.filter(f=>s.has(f.modelId)),d=l.filter(f=>!s.has(f.modelId)),u=Math.max(0,Math.min(o,d.length)),m=[...d.slice(0,u),...c,...d.slice(u)];l.splice(0,l.length,...m),l.forEach((f,p)=>f.order=p),r.operations=l},invert(a){if(!i)return;const r=Xe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=(Xe(a,e).operations??[]).map(l=>({...l}));return{forward:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:r}],invert:[{kind:"operation.reorder",casUnit:"logical",containerRef:e,entityRef:e,value:i??[]}]}}}}function Gs(e,t,o){let i;return{label:"메서드 색상 변경",apply(a){const r=ot(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=xo(s[t],o);c?s[t]=c:delete s[t],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=ot(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=ot(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function xi(e,t){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(t)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:t,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function js(e){let t=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);t={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){t&&(o.logical.associations.splice(t.assoc.index,0,t.assoc.item),t.layout&&o.layout.associationLayouts.splice(t.layout.index,0,t.layout.item))},emitOps(){if(!t)return{forward:[],invert:[]};const o=[],i=[];return t.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:t.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:t.assoc.item}),{forward:o,invert:i.reverse()}}}}function Ii(e,t){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(t))o[l]=r[l];Object.assign(r,t)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:t}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function Qt(e,t,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[t]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:t,patch:{...i}}]}}}}function Ks(e,t){return{label:"인덱스 추가",apply(o){const i=Xe(o,e);(i.indexes??(i.indexes=[])).push(t)},invert(o){var r;const i=Xe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===t.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:t}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:t.modelId}]}}}}function Ys(e,t,o){const i={},a=r=>{var s;const l=(s=Xe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===t);if(!l)throw new Error(`인덱스 없음: ${t}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),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 Ws(e,t){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Xe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===t))??-1;if(r<0)throw new Error(`인덱스 없음: ${t}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Xe(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 Tt=(e,t)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:t}}),Io=(e,t)=>{var o;return((o=wt(e,t))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function qs(e,t,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=wt(a,e);if(!r||!r.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);i={...r.waypoints[t]},r.waypoints.splice(t,1,{...o})},invert(a){const r=wt(a,e);r&&i&&r.waypoints.splice(t,1,i)},emitOps(a){const r=Io(a,e),l=r.map((s,c)=>c===t&&i?{...i}:s);return{forward:[Tt(e,r)],invert:[Tt(e,l)]}}}}function Xs(e,t){let o=null;return{label:"waypoint 제거",apply(i){const a=wt(i,e);if(!a||!a.waypoints[t])throw new Error(`waypoint 없음: ${e}[${t}]`);o={...a.waypoints[t]},a.waypoints.splice(t,1)},invert(i){const a=wt(i,e);a&&o&&a.waypoints.splice(t,0,o)},emitOps(i){const a=Io(i,e),r=a.slice();return o&&r.splice(t,0,{...o}),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function Js(e,t,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=wt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+t,y:l.y+o}))},invert(a){const r=wt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Tt(e,Io(a,e))],invert:[Tt(e,i??[])]}}}}function Zs(e){let t=null;return{label:"꺾은선 풀기",apply(o){const i=wt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);t=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=wt(o,e);i&&t&&(i.waypoints=t)},emitOps(o){return{forward:[Tt(e,Io(o,e))],invert:[Tt(e,t??[])]}}}}function Qs(e,t,o){return{label:"waypoint 추가",apply(i){const a=wt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(t,0,{...o})},invert(i){const a=wt(i,e);a==null||a.waypoints.splice(t,1)},emitOps(i){const a=Io(i,e),r=a.slice();return r.splice(t,1),{forward:[Tt(e,a)],invert:[Tt(e,r)]}}}}function ec(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 tc(e){let t=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);t={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){t&&o.layout.notes.splice(t.index,0,t.item)},emitOps(){return t?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:t.item}]}:{forward:[],invert:[]}}}}function Co(e,t){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...t}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function nc(e,t){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...t}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(t)],invert:[i(o)]}}}}function oc(e,t){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=t},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(t)],invert:[i(o)]}}}}function ic(e,t){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=xo(a.style,t)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function ac(e,t){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(t)&&(l.memberNoteRefs.push(t),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(t);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.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 rc(e,t){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(t))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.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 en=(e,t,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:t,value:{waypoints:o}}),Ci=(e,t,o)=>{var i;return((i=zt(e,t,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function lc(e,t){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===t)){o=!1;return}r.connections.push({targetRef:t,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===t);l>=0&&r.connections.splice(l,1),i&&delete r.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 sc(e,t){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===t))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${t}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:t}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:t,value:o.item}]}:{forward:[],invert:[]}}}}function cc(e,t,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${t}`,apply(r){const l=zt(r,e,t);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=zt(r,e,t);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ci(r,e,t),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[en(e,t,l)],invert:[en(e,t,s)]}}}}function dc(e,t,o,i){return{label:"waypoint 추가",apply(a){const r=zt(a,e,t);if(!r)throw new Error(`노트 연결 없음: ${e}→${t}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=zt(a,e,t);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return l.splice(o,1),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function uc(e,t,o){let i=null;return{label:"waypoint 제거",apply(a){const r=zt(a,e,t);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${t}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=zt(a,e,t);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ci(a,e,t),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[en(e,t,r)],invert:[en(e,t,l)]}}}}function mc(e,t){let o=null;return{label:"꺾은선 풀기",apply(i){const a=zt(i,e,t);if(!a)throw new Error(`노트 연결 없음: ${e}→${t}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=zt(i,e,t);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[en(e,t,Ci(i,e,t))],invert:[en(e,t,o??[])]}}}}function Je(e,t,o){return{label:e,coalesceKey:o,apply(i){for(const a of t)a.apply(i)},invert(i){for(let a=t.length-1;a>=0;a--)t[a].invert(i)},emitOps(i){const a=t.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const nh=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:xi,addAttribute:Ut,addEntity:Ei,addEntityToGroup:Bs,addGroup:wi,addIndex:Ks,addNote:ec,addNoteConnection:lc,addNoteConnectionWaypoint:dc,addNoteToGroup:ac,addOperation:zs,addWaypoint:Qs,clearNoteConnectionWaypoints:mc,clearWaypoints:Zs,composite:Je,moveEntity:Yn,moveGroup:Ds,moveNote:Co,moveNoteConnectionWaypoint:cc,moveWaypoint:qs,removeAssociation:js,removeAttribute:Wn,removeEntity:Is,removeEntityFromGroup:vi,removeGroup:Ms,removeIndex:Ws,removeNote:tc,removeNoteConnection:sc,removeNoteConnectionWaypoint:uc,removeNoteFromGroup:rc,removeOperation:Fs,removeWaypoint:Xs,renameEntity:Ss,reorderAttributes:pr,reorderOperations:Hs,resizeEntity:$s,resizeGroup:Os,resizeNote:nc,setAllEntitiesCollapsed:fr,setAttributeSwatch:Ni,setEntityCollapsed:As,setEntityLocked:Ts,setEntitySwatch:Rs,setGroupLocked:Ps,setGroupSwatch:Ls,setNoteMemo:oc,setNoteSwatch:ic,setOperationSwatch:Gs,translateWaypoints:Js,updateAssociation:Ii,updateAssociationEnd:Qt,updateAttribute:gn,updateEntity:Cs,updateGroup:Vs,updateIndex:Ys,updateOperation:Us},Symbol.toStringTag,{value:"Module"}));class fc{constructor(){qe(this,"revs",new Map);qe(this,"layoutVersion",0);qe(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 pc{constructor(t){qe(this,"cache",new fc);qe(this,"newClientOpId");qe(this,"debounceMs");qe(this,"emissions",new WeakMap);qe(this,"open",null);qe(this,"debounceHandle",null);qe(this,"queue",[]);qe(this,"sending",!1);qe(this,"_frozen",!1);qe(this,"stack",null);qe(this,"settledWaiters",[]);this.opts=t,this.newClientOpId=t.newClientOpId??De,this.debounceMs=t.debounceMs??300}seed(t){this.cache.seed(t)}attach(t){this.stack=t;const o=t.onCommand((i,a,r)=>this.handle(i,a,r));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 l;if(this._frozen)return;let a;if(o==="do"){const s=(l=t.emitOps)==null?void 0:l.call(t,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${t.label}`);a=s}else{const s=this.emissions.get(t);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${t.label}`);a=s}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===t.coalesceKey){this.open.fwd=r,this.emissions.set(t,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(t,a),t.coalesceKey!=null)){this.open={coalesceKey:t.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(t){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),t&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(t){const o={},i=new Set;let a=!1,r=!1;for(const l of t)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:t,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(t){this.queue.push(t),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const t=this.queue.shift();if(!t){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(t)}catch(r){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",r),(a=(i=this.opts).onError)==null||a.call(i,r),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 hc=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","group.add"],yc=()=>crypto.randomUUID(),oh=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,ih=e=>e&&e[0].toLowerCase()+e.slice(1),ah=e=>e&&e[0].toUpperCase()+e.slice(1),rh=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function lh(e,t){return ih(e)+ah(t)}function sh(e,t){const o=e.entities.find(l=>l.modelId===t.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=t.end1.entityRef===t.end2.entityRef?!1:t.identifying===!0;return o.attributes.filter(l=>l.identifier&&(l.attrType==="NORMAL"||l.attrType==="RELATION_OWN")).sort((l,s)=>l.order-s.order).map(l=>{const s=lh(o.name,l.name);return{associationRef:t.modelId,sourceAttributeRef:l.modelId,name:s,type:l.type,identifier:a,notNull:a,dbAttrs:l.dbAttrs.map(c=>({physicalName:rh(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Si=(e,t)=>`${e}::${t}`,$i=e=>e??void 0;function ch(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((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||$i(s.length)!==$i(r.length)||$i(s.scale)!==$i(r.scale)}))&&(i.dbAttrs=t.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function dh(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 So(e,t,o=yc){const i={add:[],update:[],remove:[]},a=e.entities.find(m=>m.modelId===t);if(!a)return i;const r=e.associations.filter(m=>m.end2.entityRef===t),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(m=>sh(e,m)),s=new Map(l.map(m=>[Si(m.associationRef,m.sourceAttributeRef),m])),c=a.attributes.filter(m=>m.derivedFrom),d=new Map(c.map(m=>[Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef),m]));for(const m of c){const f=Si(m.derivedFrom.associationRef,m.derivedFrom.sourceAttributeRef);s.has(f)||i.remove.push(m.modelId)}let u=a.attributes.reduce((m,f)=>Math.max(m,f.order),-1)+1;for(const m of l){const f=Si(m.associationRef,m.sourceAttributeRef),p=d.get(f);if(!p)i.add.push(dh(m,u++,o));else{const y=ch(p,m,o);y&&i.update.push({attributeId:p.modelId,patch:y})}}return i}function uh(e,t){if(t.remove.length){const o=new Set(t.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of t.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}t.add.length&&e.attributes.push(...t.add)}function mh(e){return{...e,entities:e.entities.map(t=>({...t,attributes:t.attributes.map(o=>({...o}))}))}}function fh(e,t,o=yc){const i=new Map,a=mh(e),r=new Set,l=[t];for(;l.length;){const s=l.shift();if(r.has(s))continue;r.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const u=So(a,d,o);if(oh(u))continue;i.has(d)||i.set(d,u);const m=a.entities.find(f=>f.modelId===d);m&&uh(m,u),r.has(d)||l.push(d)}}return i}function Ri(e,t,o){var l;const i=e.entities.find(s=>s.modelId===t),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===t&&s.end1.attributeRef===o||s.end2.entityRef===t&&s.end2.attributeRef===o)}function ph(e,t){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===t.ref}),i=()=>e.entities.filter(r=>r.name===t.ref);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function hh(e,t){const o=()=>e.attributes.filter(r=>r.name===t.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===t.ref));if(t.by==="name")return o();if(t.by==="physicalName")return i();const a=o();return a.length?a:i()}function gc(e,t,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(t)&&a.includes(o)})}function mt(e,t){const o=ph(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 yh(e,t){const o=hh(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 gh(e,t){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===t.ref),i=()=>e.attributes.filter(r=>r.name===t.ref).flatMap(r=>r.dbAttrs);if(t.by==="physicalName")return o();if(t.by==="name")return i();const a=o();return a.length?a:i()}function bh(e,t){const o=gh(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 bc(e,t){const o=e.filter(i=>i.physicalName===t.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function _h(e,t){return(e.indexes??[]).filter(o=>o.name===t.ref)}function kh(e,t){return(e.operations??[]).filter(o=>o.name===t.ref)}function Eh(e,t){const o=_h(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 Nh(e,t){const o=kh(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 _c(e,t,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:t,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function kc(e,t,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let f=!1;for(const p of t.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=bc(un(i,a),g);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:_.matches}),f=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return f?null:{modelId:d,name:e.name,type:t.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}function wh(e,t,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,f)=>{const p=t.fields[f],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=bc(un(i,a),_);if(!b.ok){s.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Ec(e,t,o){return{modelId:o(),name:e.name,order:t,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function Nc(e,t,o,i,a,r){const l=[];let s=!1;for(const c of t.columns){const d=bh(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:t.name,unique:t.unique??!1,columns:l,...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{}}}function vh(e,t,o={}){const i=o.mkId??De,a=o.embeddableCatalog??[],r=m=>a.find(f=>f.type===m),l=[],s=[],c=new Map,d=new Map,u=new Set;for(const m of t)m.kind==="entity.add"&&(u.add(m.spec.name),m.spec.physicalName&&u.add(m.spec.physicalName));return t.forEach((m,f)=>{var p,y,g,_;switch(m.kind){case"entity.add":{const b=i(),N={modelId:b,name:m.spec.name,stereotype:m.spec.stereotype??"JPA_ENTITY",attributes:[],...m.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...m.spec.physicalName?{table:{physicalName:m.spec.physicalName}}:{}},h={ref:m.spec.name};let k=!1;for(const[G,K]of(m.spec.attributes??[]).entries()){if(K.type==="GroupCodeEnum"&&!K.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0;continue}const v=r(K.type);if(v){const T=kc(K,v,G,N,e.entities,f,h,s,i);T?N.attributes.push(T):k=!0}else(p=K.embeddableOverrides)!=null&&p.length?(s.push({code:"embeddable-type-unresolved",opIndex:f,entity:h,handle:{ref:K.name}}),k=!0):N.attributes.push(_c(K,G,i))}const P=(m.spec.operations??[]).map((G,K)=>Ec(G,K,i));P.length&&(N.operations=P);const A=[];for(const G of m.spec.indexes??[]){const K=Nc(N,G,f,h,s,i);K?A.push(K):k=!0}if(A.length&&(N.indexes=A),k)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:b,value:N});break}case"entity.update":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,patch:m.patch});break}case"entity.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:b.value.modelId});break}case"attribute.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}if(m.spec.type==="GroupCodeEnum"&&!m.spec.groupCode){s.push({code:"groupcode-required",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}const N=c.get(b.value.modelId)??b.value.attributes.length;c.set(b.value.modelId,N+1);const h=r(m.spec.type);let k;if(h)k=kc(m.spec,h,N,b.value,e.entities,f,m.entity,s,i);else if((y=m.spec.embeddableOverrides)!=null&&y.length){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:{ref:m.spec.name}});break}else k=_c(m.spec,N,i);if(!k)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,value:k});break}case"attribute.update":case"attribute.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=yh(b.value,m.attribute);if(!N.ok){s.push(N.reason==="not-found"?{code:"attribute-not-found",opIndex:f,entity:m.entity,handle:m.attribute}:{code:"attribute-ambiguous",opIndex:f,entity:m.entity,handle:m.attribute,matches:N.matches});break}if(m.kind==="attribute.update"){let h=m.patch;if((g=m.embeddableOverrides)!=null&&g.length){const k=r(N.value.type);if(!k||N.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:f,entity:m.entity,handle:m.attribute});break}const P=wh(N.value,k,m.embeddableOverrides,b.value,e.entities,f,m.entity,s);if(!P)break;h={...m.patch,dbAttrs:P}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId,patch:h})}else l.push({kind:"attribute.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,attributeRef:N.value.modelId});break}case"association.add":{const b=mt(e,m.spec.from),N=mt(e,m.spec.to);if(b.ok||s.push(ft(b.reason,f,m.spec.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.spec.to,N.matches,u)),!b.ok||!N.ok)break;if(m.spec.identifying&&b.value.modelId===N.value.modelId){s.push({code:"self-identifying",opIndex:f,handle:{from:m.spec.from,to:m.spec.to}});break}const h=i(),k={modelId:h,...m.spec.identifying!=null?{identifying:m.spec.identifying}:{},end1:{entityRef:b.value.modelId,multiplicity:m.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:N.value.modelId,multiplicity:m.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:m.spec.composition??!1}},P={...e,associations:[...e.associations,k]},A=So(P,N.value.modelId,i);A.add[0]&&(k.end2.attributeRef=A.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:h,value:k});for(const G of A.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:N.value.modelId,entityRef:N.value.modelId,value:G});break}case"association.remove":{const b=mt(e,m.association.from),N=mt(e,m.association.to);if(b.ok||s.push(ft(b.reason,f,m.association.from,b.matches,u)),N.ok||s.push(ft(N.reason,f,m.association.to,N.matches,u)),!b.ok||!N.ok)break;const h=gc(e,b.value.modelId,N.value.modelId);if(h.length!==1){s.push(h.length===0?{code:"association-not-found",opIndex:f,handle:m.association}:{code:"association-ambiguous",opIndex:f,handle:m.association,matches:h.map(k=>k.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:h[0].modelId});break}case"association.update":{const b=wc(e,m.association,f,s,u);if(!b)break;l.push({kind:"association.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,patch:m.patch});break}case"associationEnd.update":{const b=wc(e,m.association,f,s,u);if(!b)break;const N=m.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:b.modelId,associationRef:b.modelId,end:N,patch:m.patch});break}case"index.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nc(b.value,m.spec,f,m.entity,s,i);if(!N)break;l.push({kind:"index.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.modelId,value:N});break}case"index.update":case"index.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Eh(b.value,m.index);if(!N.ok){s.push(N.reason==="not-found"?{code:"index-not-found",opIndex:f,entity:m.entity,handle:m.index}:{code:"index-ambiguous",opIndex:f,entity:m.entity,handle:m.index,matches:N.matches});break}if(m.kind==="index.update"){if("columns"in m.patch){s.push({code:"index-columns-patch-unsupported",opIndex:f,entity:m.entity,handle:m.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId,patch:m.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,indexRef:N.value.modelId});break}case"operation.add":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=d.get(b.value.modelId)??((_=b.value.operations)==null?void 0:_.length)??0;d.set(b.value.modelId,N+1);const h=Ec(m.spec,N,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:h.modelId,value:h});break}case"operation.update":case"operation.remove":{const b=mt(e,m.entity);if(!b.ok){s.push(ft(b.reason,f,m.entity,b.matches,u));break}const N=Nh(b.value,m.operation);if(!N.ok){s.push(N.reason==="not-found"?{code:"operation-not-found",opIndex:f,entity:m.entity,handle:m.operation}:{code:"operation-ambiguous",opIndex:f,entity:m.entity,handle:m.operation,matches:N.matches});break}m.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId,patch:m.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:b.value.modelId,entityRef:b.value.modelId,operationRef:N.value.modelId});break}case"group.add":{const b=[];let N=!1;for(const P of m.spec.members){const A=mt(e,P);if(!A.ok){s.push(ft(A.reason,f,P,A.matches,u)),N=!0;continue}b.push(A.value.modelId)}if(N)break;const h=i(),k={modelId:h,excludeDDLGeneration:m.spec.excludeDDLGeneration??!1,memberEntityRefs:b,...m.spec.name?{name:m.spec.name}:{},...m.spec.packageName?{packageName:m.spec.packageName}:{},...m.spec.description?{description:m.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:h,value:k});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function ft(e,t,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:t,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:t,handle:o}:{code:"entity-ambiguous",opIndex:t,handle:o,matches:i}}function wc(e,t,o,i,a){const r=mt(e,t.from),l=mt(e,t.to);if(r.ok||i.push(ft(r.reason,o,t.from,r.matches,a)),l.ok||i.push(ft(l.reason,o,t.to,l.matches,a)),!r.ok||!l.ok)return null;const s=gc(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:t}:{code:"association-ambiguous",opIndex:o,handle:t,matches:s.map(c=>c.modelId)}),null):s[0]}const vc={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},xh={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ih={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},Ai={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Ch={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...Ai,description:"속성 설명(다국어)."},columnLogicalName:{...Ai,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},Sh={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},xc={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},$h={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...xc,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...xc,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},Rh={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...vc,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},Ah={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Ai,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Th={type:"object",properties:{name:{...Ai,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},Vh={type:"object",description:"부분 patch(임의 키). 값 품질 검증은 별도 엔진."};function lt(e,t){return{type:"object",properties:{kind:{const:e},...t.properties},required:["kind",...t.required],additionalProperties:!1}}const Mh={"entity.add":lt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":lt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","patch"]}),"entity.remove":lt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":lt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":lt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":lt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":lt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":lt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":lt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/patch"}},required:["association","patch"]}),"associationEnd.update":lt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/patch"}},required:["association","end","patch"]}),"index.add":lt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":lt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","index","patch"]}),"index.remove":lt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":lt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":lt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/patch"}},required:["entity","operation","patch"]}),"operation.remove":lt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"group.add":lt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},Ic={anyOf:hc.map(e=>Mh[e])},Bh={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:vc,assocHandle:xh,entitySpec:Ih,attrSpec:Ch,embeddableOverrides:Sh,assocSpec:$h,indexSpec:Rh,operationSpec:Ah,groupSpec:Th,patch:Vh,symbolicOp:Ic}};function Dh(e,t,o,i={}){const a=i.mkClientOpId??De,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=t[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Cc={location:{x:0,y:0},size:{width:220,height:140}};function Sc(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const Oh=/^[-=_*~\s]{3,}$/;function Lh(e){return e.attrType&&e.attrType!=="NORMAL"||!Oh.test(e.name??"")?!1:!(e.dbAttrs??[]).some(t=>t.physicalName||t.dataType)}function Ph(e){return e.type===Rt&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function zh(e,t){if(e.attrType==="DIVIDER"||Lh(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??t,dbAttrs:[]};const o=Ph(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??t,dbAttrs:e.dbAttrs.map(Sc)}}function Uh(e){const{modelId:t,name:o,visibility:i,sourceCode:a,description:r,order:l,personalInfoAttributeType:s,style:c,...d}=e;return{modelId:t,name:o,visibility:i,sourceCode:a,description:r?{ko:r}:void 0,order:l??0,personalInfoAttributeType:s,legacyRaw:Object.keys(d).length?d:void 0}}function Fh(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 Hh(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(zh),operations:(t=e.operations)==null?void 0:t.map(Uh),indexes:(o=e.indexes)==null?void 0:o.map(Fh),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Gh(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??{...Cc},style:e.style,attributeStyles:Object.keys(t).length?t:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function $c(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 hr(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:$c(e)}}function jh(e){var i,a;const t={modelId:e.modelId,description:e.description,end1:hr(e.end1),end2:hr(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:t,layout:o}}function Rc(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Ac(e){var t;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((t=e.dbAttrs)==null?void 0:t.length)??0)>0}function Tc(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 Vc(e,t){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:t,dbAttrs:(e.dbAttrs??[]).map(Sc)}}function Kh(e,t,o){var _,b;const i=Rc(e.end1.attribute),a=Rc(e.end2.attribute);if(i===a)return jh(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(b=(_=s.dbAttrs)==null?void 0:_[0])==null?void 0:b.targetModelId,d=c?o.get(c):void 0,u=t.get(l.endModel.refId),m=u?u.attributes.reduce((N,h)=>Math.max(N,h.order),-1)+1:s.order??0,f={...Vc(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(f);const p=(N,h)=>({entityRef:N.endModel.refId,multiplicity:N.multiplicity,navigable:N.navigable,composition:N.composition,attributeRef:h?d:f.modelId,legacyNavRaw:h?void 0:N.attribute,jpa:$c(N)}),y={modelId:e.modelId,description:e.description,end1:p(e.end1,i),end2:p(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:y.end1.attributeRef,targetColumnRef:y.end2.attributeRef,style:e.style};return{assoc:y,layout:g}}function Yh(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 Wh(e,t,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=t.get(r.endModel.refId),c=s?s.attributes.reduce((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...Vc(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Yh(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...hr(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},f=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:f?d.modelId:void 0,targetColumnRef:f?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function qh(e,t){var i,a,r,l;const o=[];for(const s of t){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Mc(e,t={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=qh(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+t.x,y:a.location.y+t.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Bc(e,t,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(t.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Xh(e){return(e.schemaVersion??1)>=2&&"logical"in e?Jh(e):Zh(e)}function Jh(e){const t=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:f,...p}=m;return f!=null&&(o[m.modelId]=f),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i),{version:s,...c}=e.layout;Bc(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??t,packageName:e.logical.packageName,entities:a,associations:r,groups:l},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 Zh(e){var b,N;const t=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,k)=>{o.push(Hh(h));const P=Gh(h);P.geo={location:{x:P.geo.location.x+k.x,y:P.geo.location.y+k.y},size:P.geo.size},i.push(P);for(const A of h.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const k=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:k.map(A=>A.modelId)});const P=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const A=(h.notes??[]).map(G=>G.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:A.length?A:void 0})}for(const A of k)d(A,P);for(const A of h.notes??[])m.push(Mc(A,P))}const f=new Map(o.map(h=>[h.modelId,h])),p=new Map,y=new Map;for(const h of o)for(const k of h.attributes)for(const P of k.dbAttrs)p.set(P.modelId,k.modelId),y.set(P.modelId,P);for(const h of c)for(const k of[h.end1,h.end2]){const P=k.attribute;if(P&&(((N=P.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of P.dbAttrs)A.modelId&&p.set(A.modelId,P.modelId)}for(const h of c){const k=Ac(h.end1.attribute),P=Ac(h.end2.attribute),A=Tc(h.end1)||Tc(h.end2),{assoc:G,layout:K}=k!==P||A?Wh(h,f,y):Kh(h,f,p);a.push(G),r.push(K)}Bc(o,a,r),bs(o);const g={logical:{modelId:t,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:t,logicalModelRef:t,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(h=>Mc(h)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function Dc(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Qh(e,t){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Dc),style:t}}function ey(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 ty(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 tn(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 ny(e,t){const o=t==null?void 0:t.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...Dc(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function oy(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 iy(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 ay(e,t){return e===t||JSON.stringify(e??null)===JSON.stringify(t??null)}function ry(e,t){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:t==null?void 0:t.modelId,physicalName:e.physicalName===((t==null?void 0:t.physicalName)??"")?"":e.physicalName,logicalName:ay(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 ly(e,t,o){let i;for(const m of t.logical.entities){const f=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(f){i=f;break}}if(!i)return;const a=i.embedded.embeddableRef,r=t.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.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((m,f)=>ry(m,l[f]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:tn(e.end1,c?s:u),end2:tn(e.end2,c?u:s)}}function sy(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:tn(e.end1,e.end1.legacyEmbedRaw),end2:tn(e.end2,e.end2.legacyEmbedRaw)};const a=ly(e,t,i);if(a)return a;const r=!!e.end1.legacyNavRaw,l=!!e.end2.legacyNavRaw;if(r!==l){const s=r?e.end1:e.end2,c=r?e.end2:e.end1,d=t.logical.entities.find(y=>y.modelId===s.entityRef),u=d==null?void 0:d.attributes.find(y=>y.modelId===s.attributeRef),m=t.logical.entities.find(y=>y.modelId===c.entityRef),f=u?ny(u,m):void 0,p=s.legacyNavRaw;return{...i,end1:tn(e.end1,r?p:f),end2:tn(e.end2,l?p:f)}}return{...i,end1:tn(e.end1),end2:tn(e.end2)}}function Oc(e,t,o,i,a={x:0,y:0}){var u,m;const r=t.layout.entityLayouts.find(f=>f.entityRef===e.modelId),l=t.logical.associations.filter(f=>f.end1.entityRef===e.modelId),s=f=>t.layout.associationLayouts.find(p=>p.associationRef===f),c=(r==null?void 0:r.geo)??{...Cc},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(f=>!o.has(f.modelId)&&!i.has(f.modelId)).map(f=>{var p;return Qh(f,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[f.modelId])}),operations:(u=e.operations)==null?void 0:u.map(f=>{var p;return ey(f,(p=r==null?void 0:r.operationStyles)==null?void 0:p[f.modelId])}),ownedAssociations:l.map(f=>sy(f,t,s(f.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(ty),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function cy(e,t,o,i){const a=t.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>t.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>t.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>Lc(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Oc(c,t,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function Lc(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 dy(e,t={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=oy(e),r=iy(e),l=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=>Oc(s,e,a,r)),groups:e.logical.groups.map(s=>cy(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Lc(s))}}function uy(e,t={}){var a,r,l;const o=((a=t.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:t.id,schemaVersion:2,opWriteEnabled:t.opWriteEnabled,version:t.version,diagramVersion:t.diagramVersion,packageName:t.packageName,size:t.size,logical:{version:((r=t.revSeed)==null?void 0:r.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:((l=t.revSeed)==null?void 0:l.layoutVersion)??0}}}function $o(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function Ft(e){return typeof e=="function"?e():n.unref(e)}const my=typeof window<"u"&&typeof document<"u",fy=e=>typeof e<"u",py=Object.prototype.toString,hy=e=>py.call(e)==="[object Object]",yy=()=>{};function gy(e,t){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>t.apply(this,i),{fn:t,thisArg:this,args:i})).then(a).catch(r)})}return o}const Pc=e=>e();function by(e=Pc){const t=n.ref(!0);function o(){t.value=!1}function i(){t.value=!0}const a=(...r)=>{t.value&&e(...r)};return{isActive:n.readonly(t),pause:o,resume:i,eventFilter:a}}function zc(e,t=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(t?()=>a(o):i,e)})}function _y(e,t,o={}){const{eventFilter:i=Pc,...a}=o;return n.watch(e,gy(i,t),a)}function qn(e,t,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=by(i);return{stop:_y(e,t,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function ky(e,t={}){if(!n.isRef(e))return n.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=n.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=Ft(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function yr(e,t=!1){function o(m,{flush:f="sync",deep:p=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(h=>{_=n.watch(e,k=>{m(k)!==t&&(_==null||_(),h(k))},{flush:f,deep:p,immediate:!0})})];return y!=null&&N.push(zc(y,g).then(()=>Ft(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,f){if(!n.isRef(m))return o(k=>k===m,f);const{flush:p="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=f??{};let b=null;const h=[new Promise(k=>{b=n.watch([e,m],([P,A])=>{t!==(P===A)&&(b==null||b(),k(P))},{flush:p,deep:y,immediate:!0})})];return g!=null&&h.push(zc(g,_).then(()=>Ft(e)).finally(()=>(b==null||b(),Ft(e)))),Promise.race(h)}function a(m){return o(f=>!!f,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,f){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(Ft(m))},f)}function d(m){return u(1,m)}function u(m=1,f){let p=-1;return o(()=>(p+=1,p>=m),f)}return Array.isArray(Ft(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return yr(e,!t)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return yr(e,!t)}}}function gr(e){return yr(e)}function Ey(e){var t;const o=Ft(e);return(t=o==null?void 0:o.$el)!=null?t:o}const Uc=my?window:void 0;function Fc(...e){let t,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,t=Uc):[t,o,i,a]=e,!t)return yy;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,f,p)=>(u.addEventListener(m,f,p),()=>u.removeEventListener(m,f,p)),c=n.watch(()=>[Ey(t),Ft(a)],([u,m])=>{if(l(),!u)return;const f=hy(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return $o(d),d}function Ny(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Hc(...e){let t,o,i={};e.length===3?(t=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,o=e[0],i=e[1]):(t=e[0],o=e[1]):(t=!0,o=e[0]);const{target:a=Uc,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=Ny(t);return Fc(a,r,u=>{u.repeat&&Ft(s)||c(u)&&o(u)},l)}function wy(e){return JSON.parse(JSON.stringify(e))}function br(e,t,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:f}=i,p=n.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let g=d;t||(t="modelValue"),g=g||`update:${t.toString()}`;const _=h=>s?typeof s=="function"?s(h):wy(h):h,b=()=>fy(e[t])?_(e[t]):m,N=h=>{f?f(h)&&y(g,h):y(g,h)};if(c){const h=b(),k=n.ref(h);let P=!1;return n.watch(()=>e[t],A=>{P||(P=!0,k.value=_(A),n.nextTick(()=>P=!1))}),n.watch(k,A=>{!P&&(A!==e[t]||u)&&N(A)},{deep:u}),k}else return n.computed({get(){return b()},set(h){N(h)}})}var vy={value:()=>{}};function Ti(){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 Vi(o)}function Vi(e){this._=e}function xy(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Vi.prototype=Ti.prototype={constructor:Vi,on:function(e,t){var o=this._,i=xy(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Iy(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Gc(o[a],e.name,t);else if(t==null)for(a in o)o[a]=Gc(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Vi(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(t,o)}};function Iy(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function Gc(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=vy,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var _r="http://www.w3.org/1999/xhtml";const jc={svg:"http://www.w3.org/2000/svg",xhtml:_r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mi(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),jc.hasOwnProperty(t)?{space:jc[t],local:e}:e}function Cy(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===_r&&t.documentElement.namespaceURI===_r?t.createElement(e):t.createElementNS(o,e)}}function Sy(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Kc(e){var t=Mi(e);return(t.local?Sy:Cy)(t)}function $y(){}function kr(e){return e==null?$y:function(){return this.querySelector(e)}}function Ry(e){typeof e!="function"&&(e=kr(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new kt(i,this._parents)}function Ay(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ty(){return[]}function Yc(e){return e==null?Ty:function(){return this.querySelectorAll(e)}}function Vy(e){return function(){return Ay(e.apply(this,arguments))}}function My(e){typeof e=="function"?e=Vy(e):e=Yc(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new kt(i,a)}function Wc(e){return function(){return this.matches(e)}}function qc(e){return function(t){return t.matches(e)}}var By=Array.prototype.find;function Dy(e){return function(){return By.call(this.children,e)}}function Oy(){return this.firstElementChild}function Ly(e){return this.select(e==null?Oy:Dy(typeof e=="function"?e:qc(e)))}var Py=Array.prototype.filter;function zy(){return Array.from(this.children)}function Uy(e){return function(){return Py.call(this.children,e)}}function Fy(e){return this.selectAll(e==null?zy:Uy(typeof e=="function"?e:qc(e)))}function Hy(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new kt(i,this._parents)}function Xc(e){return new Array(e.length)}function Gy(){return new kt(this._enter||this._groups.map(Xc),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 jy(e){return function(){return e}}function Ky(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Bi(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Yy(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Bi(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Wy(e){return e.__data__}function qy(e,t){if(!arguments.length)return Array.from(this,Wy);var o=t?Yy:Ky,i=this._parents,a=this._groups;typeof e!="function"&&(e=jy(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],f=m.length,p=Xy(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new kt(l,i),l._enter=s,l._exit=c,l}function Xy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Jy(){return new kt(this._exit||this._groups.map(Xc),this._parents)}function Zy(e,t,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Qy(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new kt(s,this._parents)}function eg(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function tg(e){e||(e=ng);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(t)}return new kt(a,this._parents).order()}function ng(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function og(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ig(){return Array.from(this)}function ag(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function rg(){let e=0;for(const t of this)++e;return e}function lg(){return!this.node()}function sg(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function cg(e){return function(){this.removeAttribute(e)}}function dg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ug(e,t){return function(){this.setAttribute(e,t)}}function mg(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function fg(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function pg(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 hg(e,t){var o=Mi(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?dg:cg:typeof t=="function"?o.local?pg:fg:o.local?mg:ug)(o,t))}function Jc(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yg(e){return function(){this.style.removeProperty(e)}}function gg(e,t,o){return function(){this.style.setProperty(e,t,o)}}function bg(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function _g(e,t,o){return arguments.length>1?this.each((t==null?yg:typeof t=="function"?bg:gg)(e,t,o??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Jc(e).getComputedStyle(e,null).getPropertyValue(t)}function kg(e){return function(){delete this[e]}}function Eg(e,t){return function(){this[e]=t}}function Ng(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function wg(e,t){return arguments.length>1?this.each((t==null?kg:typeof t=="function"?Ng:Eg)(e,t)):this.node()[e]}function Zc(e){return e.trim().split(/^|\s+/)}function Er(e){return e.classList||new Qc(e)}function Qc(e){this._node=e,this._names=Zc(e.getAttribute("class")||"")}Qc.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 ed(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function td(e,t){for(var o=Er(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function vg(e){return function(){ed(this,e)}}function xg(e){return function(){td(this,e)}}function Ig(e,t){return function(){(t.apply(this,arguments)?ed:td)(this,e)}}function Cg(e,t){var o=Zc(e+"");if(arguments.length<2){for(var i=Er(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?Ig:t?vg:xg)(o,t))}function Sg(){this.textContent=""}function $g(e){return function(){this.textContent=e}}function Rg(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ag(e){return arguments.length?this.each(e==null?Sg:(typeof e=="function"?Rg:$g)(e)):this.node().textContent}function Tg(){this.innerHTML=""}function Vg(e){return function(){this.innerHTML=e}}function Mg(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Bg(e){return arguments.length?this.each(e==null?Tg:(typeof e=="function"?Mg:Vg)(e)):this.node().innerHTML}function Dg(){this.nextSibling&&this.parentNode.appendChild(this)}function Og(){return this.each(Dg)}function Lg(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pg(){return this.each(Lg)}function zg(e){var t=typeof e=="function"?e:Kc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ug(){return null}function Fg(e,t){var o=typeof e=="function"?e:Kc(e),i=t==null?Ug:typeof t=="function"?t:kr(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Hg(){var e=this.parentNode;e&&e.removeChild(this)}function Gg(){return this.each(Hg)}function jg(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kg(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Yg(e){return this.select(e?Kg:jg)}function Wg(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qg(e){return function(t){e.call(this,t,this.__data__)}}function Xg(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 Jg(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Zg(e,t,o){return function(){var i=this.__on,a,r=qg(t);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Qg(e,t,o){var i=Xg(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=t?Zg:Jg,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function nd(e,t,o){var i=Jc(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function eb(e,t){return function(){return nd(this,e,t)}}function tb(e,t){return function(){return nd(this,e,t.apply(this,arguments))}}function nb(e,t){return this.each((typeof t=="function"?tb:eb)(e,t))}function*ob(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var od=[null];function kt(e,t){this._groups=e,this._parents=t}function Ro(){return new kt([[document.documentElement]],od)}function ib(){return this}kt.prototype=Ro.prototype={constructor:kt,select:Ry,selectAll:My,selectChild:Ly,selectChildren:Fy,filter:Hy,data:qy,enter:Gy,exit:Jy,join:Zy,merge:Qy,selection:ib,order:eg,sort:tg,call:og,nodes:ig,node:ag,size:rg,empty:lg,each:sg,attr:hg,style:_g,property:wg,classed:Cg,text:Ag,html:Bg,raise:Og,lower:Pg,append:zg,insert:Fg,remove:Gg,clone:Yg,datum:Wg,on:Qg,dispatch:nb,[Symbol.iterator]:ob};function vt(e){return typeof e=="string"?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],od)}function ab(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Vt(e,t){if(e=ab(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const rb={passive:!1},Ao={capture:!0,passive:!1};function Nr(e){e.stopImmediatePropagation()}function Jn(e){e.preventDefault(),e.stopImmediatePropagation()}function id(e){var t=e.document.documentElement,o=vt(e).on("dragstart.drag",Jn,Ao);"onselectstart"in t?o.on("selectstart.drag",Jn,Ao):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ad(e,t){var o=e.document.documentElement,i=vt(e).on("dragstart.drag",null);t&&(i.on("click.drag",Jn,Ao),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 Di=e=>()=>e;function wr(e,{sourceEvent:t,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,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}})}wr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lb(e){return!e.ctrlKey&&!e.button}function sb(){return this.parentNode}function cb(e,t){return t??{x:e.x,y:e.y}}function db(){return navigator.maxTouchPoints||"ontouchstart"in this}function ub(){var e=lb,t=sb,o=cb,i=db,a={},r=Ti("start","drag","end"),l=0,s,c,d,u,m=0;function f(k){k.on("mousedown.drag",p).filter(i).on("touchstart.drag",_).on("touchmove.drag",b,rb).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(k,P){if(!(u||!e.call(this,k,P))){var A=h(this,t.call(this,k,P),k,P,"mouse");A&&(vt(k.view).on("mousemove.drag",y,Ao).on("mouseup.drag",g,Ao),id(k.view),Nr(k),d=!1,s=k.clientX,c=k.clientY,A("start",k))}}function y(k){if(Jn(k),!d){var P=k.clientX-s,A=k.clientY-c;d=P*P+A*A>m}a.mouse("drag",k)}function g(k){vt(k.view).on("mousemove.drag mouseup.drag",null),ad(k.view,d),Jn(k),a.mouse("end",k)}function _(k,P){if(e.call(this,k,P)){var A=k.changedTouches,G=t.call(this,k,P),K=A.length,v,T;for(v=0;v<K;++v)(T=h(this,G,k,P,A[v].identifier,A[v]))&&(Nr(k),T("start",k,A[v]))}}function b(k){var P=k.changedTouches,A=P.length,G,K;for(G=0;G<A;++G)(K=a[P[G].identifier])&&(Jn(k),K("drag",k,P[G]))}function N(k){var P=k.changedTouches,A=P.length,G,K;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),G=0;G<A;++G)(K=a[P[G].identifier])&&(Nr(k),K("end",k,P[G]))}function h(k,P,A,G,K,v){var T=r.copy(),H=Vt(v||A,P),C,ae,E;if((E=o.call(k,new wr("beforestart",{sourceEvent:A,target:f,identifier:K,active:l,x:H[0],y:H[1],dx:0,dy:0,dispatch:T}),G))!=null)return C=E.x-H[0]||0,ae=E.y-H[1]||0,function Y(S,W,ee){var ie=H,O;switch(S){case"start":a[K]=Y,O=l++;break;case"end":delete a[K],--l;case"drag":H=Vt(ee||W,P),O=l;break}T.call(S,k,new wr(S,{sourceEvent:W,subject:E,target:f,identifier:K,active:O,x:H[0]+C,y:H[1]+ae,dx:H[0]-ie[0],dy:H[1]-ie[1],dispatch:T}),G)}}return f.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Di(!!k),f):e},f.container=function(k){return arguments.length?(t=typeof k=="function"?k:Di(k),f):t},f.subject=function(k){return arguments.length?(o=typeof k=="function"?k:Di(k),f):o},f.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:Di(!!k),f):i},f.on=function(){var k=r.on.apply(r,arguments);return k===r?f:k},f.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,f):Math.sqrt(m)},f}function vr(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function rd(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function To(){}var Vo=.7,Oi=1/Vo,Zn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mb=/^#([0-9a-f]{3,8})$/,fb=new RegExp(`^rgb\\(${Zn},${Zn},${Zn}\\)$`),pb=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),hb=new RegExp(`^rgba\\(${Zn},${Zn},${Zn},${Mo}\\)$`),yb=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${Mo}\\)$`),gb=new RegExp(`^hsl\\(${Mo},${Mt},${Mt}\\)$`),bb=new RegExp(`^hsla\\(${Mo},${Mt},${Mt},${Mo}\\)$`),ld={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};vr(To,bn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sd,formatHex:sd,formatHex8:_b,formatHsl:kb,formatRgb:cd,toString:cd});function sd(){return this.rgb().formatHex()}function _b(){return this.rgb().formatHex8()}function kb(){return pd(this).formatHsl()}function cd(){return this.rgb().formatRgb()}function bn(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=mb.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?dd(t):o===3?new ht(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Li(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Li(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=fb.exec(e))?new ht(t[1],t[2],t[3],1):(t=pb.exec(e))?new ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hb.exec(e))?Li(t[1],t[2],t[3],t[4]):(t=yb.exec(e))?Li(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gb.exec(e))?fd(t[1],t[2]/100,t[3]/100,1):(t=bb.exec(e))?fd(t[1],t[2]/100,t[3]/100,t[4]):ld.hasOwnProperty(e)?dd(ld[e]):e==="transparent"?new ht(NaN,NaN,NaN,0):null}function dd(e){return new ht(e>>16&255,e>>8&255,e&255,1)}function Li(e,t,o,i){return i<=0&&(e=t=o=NaN),new ht(e,t,o,i)}function Eb(e){return e instanceof To||(e=bn(e)),e?(e=e.rgb(),new ht(e.r,e.g,e.b,e.opacity)):new ht}function xr(e,t,o,i){return arguments.length===1?Eb(e):new ht(e,t,o,i??1)}function ht(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}vr(ht,xr,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new ht(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ht(_n(this.r),_n(this.g),_n(this.b),Pi(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:ud,formatHex:ud,formatHex8:Nb,formatRgb:md,toString:md}));function ud(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}`}function Nb(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}${kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function md(){const e=Pi(this.opacity);return`${e===1?"rgb(":"rgba("}${_n(this.r)}, ${_n(this.g)}, ${_n(this.b)}${e===1?")":`, ${e})`}`}function Pi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function _n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kn(e){return e=_n(e),(e<16?"0":"")+e.toString(16)}function fd(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new xt(e,t,o,i)}function pd(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof To||(e=bn(e)),!e)return new xt;if(e instanceof xt)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new xt(l,s,c,e.opacity)}function wb(e,t,o,i){return arguments.length===1?pd(e):new xt(e,t,o,i??1)}function xt(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}vr(xt,wb,rd(To,{brighter(e){return e=e==null?Oi:Math.pow(Oi,e),new xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vo:Math.pow(Vo,e),new xt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new ht(Ir(e>=240?e-240:e+120,a,i),Ir(e,a,i),Ir(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new xt(hd(this.h),zi(this.s),zi(this.l),Pi(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=Pi(this.opacity);return`${e===1?"hsl(":"hsla("}${hd(this.h)}, ${zi(this.s)*100}%, ${zi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hd(e){return e=(e||0)%360,e<0?e+360:e}function zi(e){return Math.max(0,Math.min(1,e||0))}function Ir(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 Cr=e=>()=>e;function vb(e,t){return function(o){return e+o*t}}function xb(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 Ib(e){return(e=+e)==1?yd:function(t,o){return o-t?xb(t,o,e):Cr(isNaN(t)?o:t)}}function yd(e,t){var o=t-e;return o?vb(e,o):Cr(isNaN(e)?t:e)}const Ui=(function e(t){var o=Ib(t);function i(a,r){var l=o((a=xr(a)).r,(r=xr(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=yd(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Cb(e,t){t||(t=[]);var o=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+t[a]*r;return i}}function Sb(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $b(e,t){var o=t?t.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=Bo(e[l],t[l]);for(;l<o;++l)r[l]=t[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function Rb(e,t){var o=new Date;return e=+e,t=+t,function(i){return o.setTime(e*(1-i)+t*i),o}}function Bt(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}function Ab(e,t){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?o[a]=Bo(e[a],t[a]):i[a]=t[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Sr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$r=new RegExp(Sr.source,"g");function Tb(e){return function(){return e}}function Vb(e){return function(t){return e(t)+""}}function gd(e,t){var o=Sr.lastIndex=$r.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=Sr.exec(e))&&(a=$r.exec(t));)(r=a.index)>o&&(r=t.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Bt(i,a)})),o=$r.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?Vb(c[0].x):Tb(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function Bo(e,t){var o=typeof t,i;return t==null||o==="boolean"?Cr(t):(o==="number"?Bt:o==="string"?(i=bn(t))?(t=i,Ui):gd:t instanceof bn?Ui:t instanceof Date?Rb:Sb(t)?Cb:Array.isArray(t)?$b:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ab:Bt)(e,t)}var bd=180/Math.PI,Rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _d(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(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,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*bd,skewX:Math.atan(c)*bd,scaleX:l,scaleY:s}}var Fi;function Mb(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rr:_d(t.a,t.b,t.c,t.d,t.e,t.f)}function Bb(e){return e==null||(Fi||(Fi=document.createElementNS("http://www.w3.org/2000/svg","g")),Fi.setAttribute("transform",e),!(e=Fi.transform.baseVal.consolidate()))?Rr:(e=e.matrix,_d(e.a,e.b,e.c,e.d,e.e,e.f))}function kd(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Bt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Bt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:Bt(d,m)},{i:g-2,x:Bt(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var Db=kd(Mb,"px, ","px)","deg)"),Ob=kd(Bb,", ",")",")"),Lb=1e-12;function Ed(e){return((e=Math.exp(e))+1/e)/2}function Pb(e){return((e=Math.exp(e))-1/e)/2}function zb(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hi=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<Lb)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Ed(P),T=d/(o*N)*(v*zb(t*K+P)-Pb(P));return[s+T*p,c+T*y,d*v/Ed(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Qn=0,Do=0,Oo=0,Nd=1e3,Gi,Lo,ji=0,En=0,Ki=0,Po=typeof performance=="object"&&performance.now?performance:Date,wd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ar(){return En||(wd(Ub),En=Po.now()+Ki)}function Ub(){En=0}function Yi(){this._call=this._time=this._next=null}Yi.prototype=vd.prototype={constructor:Yi,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Ar():+o)+(t==null?0:+t),!this._next&&Lo!==this&&(Lo?Lo._next=this:Gi=this,Lo=this),this._call=e,this._time=o,Tr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tr())}};function vd(e,t,o){var i=new Yi;return i.restart(e,t,o),i}function Fb(){Ar(),++Qn;for(var e=Gi,t;e;)(t=En-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qn}function xd(){En=(ji=Po.now())+Ki,Qn=Do=0;try{Fb()}finally{Qn=0,Gb(),En=0}}function Hb(){var e=Po.now(),t=e-ji;t>Nd&&(Ki-=t,ji=e)}function Gb(){for(var e,t=Gi,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:Gi=o);Lo=e,Tr(i)}function Tr(e){if(!Qn){Do&&(Do=clearTimeout(Do));var t=e-En;t>24?(e<1/0&&(Do=setTimeout(xd,e-Po.now()-Ki)),Oo&&(Oo=clearInterval(Oo))):(Oo||(ji=Po.now(),Oo=setInterval(Hb,Nd)),Qn=1,wd(xd))}}function Id(e,t,o){var i=new Yi;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var jb=Ti("start","end","cancel","interrupt"),Kb=[],Cd=0,Sd=1,Vr=2,Wi=3,$d=4,Mr=5,qi=6;function Xi(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;Yb(e,o,{name:t,index:i,group:a,on:jb,tween:Kb,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Cd})}function Br(e,t){var o=It(e,t);if(o.state>Cd)throw new Error("too late; already scheduled");return o}function Dt(e,t){var o=It(e,t);if(o.state>Wi)throw new Error("too late; already running");return o}function It(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Yb(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=vd(r,0,o.time);function r(d){o.state=Sd,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Sd)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Wi)return Id(l);p.state===$d?(p.state=qi,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=qi,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Id(function(){o.state===Wi&&(o.state=$d,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Vr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Vr){for(o.state=Wi,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Mr,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===Mr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=qi,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ji(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Vr&&i.state<Mr,i.state=qi,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function Wb(e){return this.each(function(){Ji(this,e)})}function qb(e,t){var o,i;return function(){var a=Dt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function Xb(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Dt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function Jb(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=It(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((t==null?qb:Xb)(o,e,t))}function Dr(e,t,o){var i=e._id;return e.each(function(){var a=Dt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return It(a,i).value[t]}}function Rd(e,t){var o;return(typeof t=="number"?Bt:t instanceof bn?Ui:(o=bn(t))?(t=o,Ui):gd)(e,t)}function Zb(e){return function(){this.removeAttribute(e)}}function Qb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function e_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function t_(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function n_(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function o_(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function i_(e,t){var o=Mi(e),i=o==="transform"?Ob:Rd;return this.attrTween(e,typeof t=="function"?(o.local?o_:n_)(o,i,Dr(this,"attr."+e,t)):t==null?(o.local?Qb:Zb)(o):(o.local?t_:e_)(o,i,t))}function a_(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function r_(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function l_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&r_(e,r)),o}return a._value=t,a}function s_(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&a_(e,r)),o}return a._value=t,a}function c_(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=Mi(e);return this.tween(o,(i.local?l_:s_)(i,t))}function d_(e,t){return function(){Br(this,e).delay=+t.apply(this,arguments)}}function u_(e,t){return t=+t,function(){Br(this,e).delay=t}}function m_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?d_:u_)(t,e)):It(this.node(),t).delay}function f_(e,t){return function(){Dt(this,e).duration=+t.apply(this,arguments)}}function p_(e,t){return t=+t,function(){Dt(this,e).duration=t}}function h_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?f_:p_)(t,e)):It(this.node(),t).duration}function y_(e,t){if(typeof t!="function")throw new Error;return function(){Dt(this,e).ease=t}}function g_(e){var t=this._id;return arguments.length?this.each(y_(t,e)):It(this.node(),t).ease}function b_(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Dt(this,e).ease=o}}function __(e){if(typeof e!="function")throw new Error;return this.each(b_(this._id,e))}function k_(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Ht(i,this._parents,this._name,this._id)}function E_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Ht(l,this._parents,this._name,this._id)}function N_(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 w_(e,t,o){var i,a,r=N_(t)?Br:Dt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function v_(e,t){var o=this._id;return arguments.length<2?It(this.node(),o).on.on(e):this.each(w_(o,e,t))}function x_(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function I_(){return this.on("end.remove",x_(this._id))}function C_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=kr(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Xi(d[f],t,o,f,d,It(u,o)));return new Ht(r,this._parents,t,o)}function S_(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Yc(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var f=e.call(u,u.__data__,m,c),p,y=It(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Xi(p,t,o,g,f,y);r.push(f),l.push(u)}return new Ht(r,l,t,o)}var $_=Ro.prototype.constructor;function R_(){return new $_(this._groups,this._parents)}function A_(e,t){var o,i,a;return function(){var r=Xn(this,e),l=(this.style.removeProperty(e),Xn(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Ad(e){return function(){this.style.removeProperty(e)}}function T_(e,t,o){var i,a=o+"",r;return function(){var l=Xn(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function V_(e,t,o){var i,a,r;return function(){var l=Xn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Xn(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function M_(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Dt(this,e),d=c.on,u=c.value[r]==null?s||(s=Ad(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function B_(e,t,o){var i=(e+="")=="transform"?Db:Rd;return t==null?this.styleTween(e,A_(e,i)).on("end.style."+e,Ad(e)):typeof t=="function"?this.styleTween(e,V_(e,i,Dr(this,"style."+e,t))).each(M_(this._id,e)):this.styleTween(e,T_(e,i,t),o).on("end.style."+e,null)}function D_(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function O_(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&D_(e,l,o)),i}return r._value=t,r}function L_(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,O_(e,t,o??""))}function P_(e){return function(){this.textContent=e}}function z_(e){return function(){var t=e(this);this.textContent=t??""}}function U_(e){return this.tween("text",typeof e=="function"?z_(Dr(this,"text",e)):P_(e==null?"":e+""))}function F_(e){return function(t){this.textContent=e.call(this,t)}}function H_(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&F_(a)),t}return i._value=e,i}function G_(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,H_(e))}function j_(){for(var e=this._name,t=this._id,o=Td(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=It(c,t);Xi(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ht(i,this._parents,e,o)}function K_(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Dt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var Y_=0;function Ht(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function Td(){return++Y_}var Gt=Ro.prototype;Ht.prototype={constructor:Ht,select:C_,selectAll:S_,selectChild:Gt.selectChild,selectChildren:Gt.selectChildren,filter:k_,merge:E_,selection:R_,transition:j_,call:Gt.call,nodes:Gt.nodes,node:Gt.node,size:Gt.size,empty:Gt.empty,each:Gt.each,on:v_,attr:i_,attrTween:c_,style:B_,styleTween:L_,text:U_,textTween:G_,remove:I_,tween:Jb,delay:m_,duration:h_,ease:g_,easeVarying:__,end:K_,[Symbol.iterator]:Gt[Symbol.iterator]};function W_(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var q_={time:null,delay:0,duration:250,ease:W_};function X_(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 J_(e){var t,o;e instanceof Ht?(t=e._id,e=e._name):(t=Td(),(o=q_).time=Ar(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Xi(c,e,t,d,l,o||X_(c,t));return new Ht(i,this._parents,e,t)}Ro.prototype.interrupt=Wb,Ro.prototype.transition=J_;const Zi=e=>()=>e;function Z_(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function jt(e,t,o){this.k=e,this.x=t,this.y=o}jt.prototype={constructor:jt,scale:function(e){return e===1?this:new jt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jt(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 eo=new jt(1,0,0);jt.prototype;function Or(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function Q_(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function e1(){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 Vd(){return this.__zoom||eo}function t1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function n1(){return navigator.maxTouchPoints||"ontouchstart"in this}function o1(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function i1(){var e=Q_,t=e1,o=o1,i=t1,a=n1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Hi,d=Ti("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",Vd).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",Vd),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(eo.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new jt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new jt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new jt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=vt(this.that).datum();d.call(E,this.that,new Z_(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=Vt(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ji(this),S.start()}zo(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=vt(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=Vt(E,S),O=E.clientX,U=E.clientY;id(E.view),Or(E),W.mouse=[ie,this.__zoom.invert(ie)],Ji(this),W.start();function ne(ge){if(zo(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=Vt(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),ad(ge.view,W.moved),zo(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=Vt(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);zo(E),s>0?vt(this).transition().duration(s).call(P,O,W,E):vt(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Or(E),O=0;O<W;++O)U=S[O],ne=Vt(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ji(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(zo(E),ie=0;ie<ee;++ie)O=W[ie],U=Vt(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Or(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=Vt(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=vt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Zi(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Zi(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Zi(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Zi([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}var Re=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Re||{}),Lr=(e=>(e.Partial="partial",e.Full="full",e))(Lr||{}),Nn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Nn||{}),Kt=(e=>(e.Strict="strict",e.Loose="loose",e))(Kt||{}),Pr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Pr||{}),Uo=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{}),Md=(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))(Md||{});const a1=["INPUT","SELECT","TEXTAREA"],r1=typeof document<"u"?document:null;function zr(e){var t,o;const i=((o=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return a1.includes(i==null?void 0:i.nodeName)||a||!!r}function l1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Bd(e,t,o,i){const a=t.replace("+",`
23
+ `}}const Ii="com.example",Jp="command.domain";function Co(e,n,o={}){if(e.packageName)return e.packageName;const i=o.packageConfig;if(i!=null&&i.basePackage){const a=n.groups.find(c=>{var d;return(d=c.memberEntityRefs)==null?void 0:d.includes(e.modelId)}),r=a!=null&&a.packageName?`.${a.packageName}`:"",l=i.layerSuffix??Jp,s=l?`.${l}`:"";return`${i.basePackage}${r}${s}`}return n.packageName||""}const Zp="CustomMoneyType",Qp="Money";function eh(e){return!(e.type!==Zp||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function th(e){const n=e.dbAttrs[0]??{modelId:Ue(),physicalName:"",dataType:""},o={modelId:Ue(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Qp,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function nh(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>eh(l)?(a=!0,n=!0,th(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function wt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function As(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Ts(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(As);if(!i.length)continue;const a=o.filter(s=>!As(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function Wn(e){return JSON.parse(JSON.stringify(e))}function Vs(e,n,o){var z;const i=o.idFactory??Ue,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const w=new Set(n);for(const x of r.associations){const F=w.has(x.end1.entityRef),C=w.has(x.end2.entityRef);F!==C&&s.add(F?x.end2.entityRef:x.end1.entityRef)}}const c=r.entities.filter(w=>s.has(w.modelId)),d=new Set(c.map(w=>w.modelId)),m=r.associations.filter(w=>d.has(w.end1.entityRef)&&d.has(w.end2.entityRef)),u=new Set(m.map(w=>w.modelId)),p=new Map,y=w=>{let x=p.get(w);return x||(x=i(),p.set(w,x)),x};for(const w of c){y(w.modelId);for(const x of w.attributes){y(x.modelId);for(const F of x.dbAttrs)y(F.modelId)}for(const x of w.indexes??[])y(x.modelId);for(const x of w.operations??[])y(x.modelId)}for(const w of m)y(w.modelId);const f=w=>p.get(w),b=c.map(w=>{const x=Wn(w);x.modelId=f(w.modelId),x.attributes=x.attributes.map(F=>oh(F,f,u,d));for(const F of x.indexes??[])F.modelId=f(F.modelId),F.columns=F.columns.map(C=>_o(C.columnRef)?C:{...C,columnRef:f(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const F of x.operations??[])F.modelId=f(F.modelId);return x});Ts(b);const h=m.map(w=>{const x=Wn(w);return x.modelId=f(w.modelId),x.end1=Ms(x.end1,f),x.end2=Ms(x.end2,f),x}),_=[];for(const w of r.groups){const x=w.memberEntityRefs.filter(C=>d.has(C));if(x.length===0)continue;const F=Wn(w);F.modelId=y(w.modelId),F.memberEntityRefs=x.map(C=>f(C)),_.push(F)}const E=o.collisionSuffix??"_imported",g=new Set(o.existing.entities.map(w=>w.name)),N=new Set(o.existing.entities.map(w=>{var x;return(x=w.table)==null?void 0:x.physicalName}).filter(w=>!!w));for(const w of b)g.has(w.name)&&(w.name=`${w.name}${E}`),(z=w.table)!=null&&z.physicalName&&N.has(w.table.physicalName)&&(w.table.physicalName=`${w.table.physicalName}${E}`);const V=[];for(const w of l.entityLayouts){const x=f(w.entityRef);if(!x)continue;const F=Wn(w);F.entityRef=x,F.geo={...F.geo,location:gr(F.geo.location,a)},F.attributeStyles&&(F.attributeStyles=xi(F.attributeStyles,f)),F.operationStyles&&(F.operationStyles=xi(F.operationStyles,f)),V.push(F)}const T=[];for(const w of l.associationLayouts){const x=f(w.associationRef);if(!x)continue;const F=Wn(w);F.associationRef=x,F.sourceColumnRef=w.sourceColumnRef?f(w.sourceColumnRef):void 0,F.targetColumnRef=w.targetColumnRef?f(w.targetColumnRef):void 0,F.waypoints=F.waypoints.map(C=>gr(C,a)),T.push(F)}const I=[];for(const w of l.groupLayouts){const x=f(w.groupRef);if(!x)continue;const F=Wn(w);F.groupRef=x,F.geo={...F.geo,location:gr(F.geo.location,a)},delete F.memberNoteRefs,I.push(F)}return{logical:{entities:b,associations:h,groups:_},layout:{entityLayouts:V,associationLayouts:T,groupLayouts:I},idMap:p}}function gr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function oh(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Ms(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function xi(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function br(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function hn(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>hn(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!hn(e[i],n[i]))return!1;return!0}return!1}function yn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||hn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function gn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,m]of a){const u=i.get(d);u?s.push({cur:u,tgt:m}):r.push(m)}for(const[d,m]of i)a.has(d)||l.push(m);const c=(d,m)=>o(d)<o(m)?-1:o(d)>o(m)?1:0;return r.sort(c),l.sort(c),s.sort((d,m)=>c(d.tgt,m.tgt)),{added:r,removed:l,common:s}}function ih(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const ah=new Set(["attributes","operations","indexes","rev"]),rh=new Set(["end1","end2","rev"]),lh=new Set(["memberEntityRefs","rev"]),Bs=new Set(["modelId"]),sh=new Set(["modelId","columns"]),ch=new Set([]);function dh(e,n,o,i){const a=gn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=yn(s,c,Bs);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=gn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=yn(s,c,Bs);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=gn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!hn(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=yn(s,c,sh);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function uh(e,n,o){const i=gn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:br(l)});for(const{cur:l,tgt:s}of i.common){const c=yn(l,s,ah);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),dh(l.modelId,l,s,o)}const a=gn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:br(l)});for(const{cur:l,tgt:s}of a.common){const c=yn(l,s,rh);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const m=yn(l[d]??{},s[d]??{},ch);m&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:m})}}const r=gn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:br(l)});for(const{cur:l,tgt:s}of r.common){const c=yn(l,s,lh);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=ih(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const m of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:m});for(const m of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:m})}}function Ci(e,n,o,i,a,r,l){const s=gn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)hn(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function mh(e,n,o){Ci(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),Ci(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),Ci(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),Ci(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function fh(e,n){const o=[];return uh(e.logical,n.logical,o),mh(e.layout,n.layout,o),o}function ph(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const hh={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class yh{constructor(n){Ze(this,"out",[]);Ze(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...So(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...So(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...So(n),field:a,value:void 0,removed:!0});continue}this.out.push({...So(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...So(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function So(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Tt(e,n,o,i){if(o==null||typeof o!="object")return;const a=hh[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function bn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function _r(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function en(e,n){var r,l,s,c,d,m,u,p;const o=ph(n),i=new yh(n.field),a=[...e].sort((y,f)=>y.seq-f.seq);for(const y of a)for(const f of y.ops)switch(o){case"entity":if(f.entityRef!==n.entityRef)break;f.kind==="entity.add"?Tt(i,y,f.value,"entity"):f.kind==="entity.update"?bn(i,y,f.patch):f.kind==="entity.remove"&&i.remove(y);break;case"attribute":if(f.entityRef!==n.entityRef)break;if(f.kind==="entity.add"){const b=_r((r=f.value)==null?void 0:r.attributes,n.attributeRef);b&&Tt(i,y,b,"attribute")}else f.kind==="attribute.add"&&((l=f.value)==null?void 0:l.modelId)===n.attributeRef?Tt(i,y,f.value,"attribute"):f.kind==="attribute.update"&&f.attributeRef===n.attributeRef?bn(i,y,f.patch):(f.kind==="attribute.remove"&&f.attributeRef===n.attributeRef||f.kind==="entity.remove")&&i.remove(y);break;case"operation":if(f.entityRef!==n.entityRef)break;if(f.kind==="entity.add"){const b=_r((s=f.value)==null?void 0:s.operations,n.operationRef);b&&Tt(i,y,b,"operation")}else f.kind==="operation.add"&&((c=f.value)==null?void 0:c.modelId)===n.operationRef?Tt(i,y,f.value,"operation"):f.kind==="operation.update"&&f.operationRef===n.operationRef?bn(i,y,f.patch):(f.kind==="operation.remove"&&f.operationRef===n.operationRef||f.kind==="entity.remove")&&i.remove(y);break;case"index":if(f.entityRef!==n.entityRef)break;if(f.kind==="entity.add"){const b=_r((d=f.value)==null?void 0:d.indexes,n.indexRef);b&&Tt(i,y,b,"index")}else f.kind==="index.add"&&((m=f.value)==null?void 0:m.modelId)===n.indexRef?Tt(i,y,f.value,"index"):f.kind==="index.update"&&f.indexRef===n.indexRef?bn(i,y,f.patch):(f.kind==="index.remove"&&f.indexRef===n.indexRef||f.kind==="entity.remove")&&i.remove(y);break;case"association":if(f.associationRef!==n.associationRef)break;f.kind==="association.add"?Tt(i,y,f.value,"association"):f.kind==="association.update"?bn(i,y,f.patch):f.kind==="association.remove"&&i.remove(y);break;case"associationEnd":if(f.associationRef!==n.associationRef)break;if(f.kind==="association.add"){const b=(u=f.value)==null?void 0:u[n.end];Tt(i,y,b,"associationEnd")}else f.kind==="associationEnd.update"&&f.end===n.end?bn(i,y,f.patch):f.kind==="association.remove"&&i.remove(y);break;case"group":if(f.groupRef!==n.groupRef)break;if(f.kind==="group.add"){Tt(i,y,f.value,"group");const b=(p=f.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(b))for(const h of b)i.member(y,h,!1)}else f.kind==="group.update"?bn(i,y,f.patch):f.kind==="group.remove"?i.remove(y):f.kind==="group.addMember"&&f.entityRef!=null?i.member(y,f.entityRef,!1):f.kind==="group.removeMember"&&f.entityRef!=null&&i.member(y,f.entityRef,!0);break}return i.result()}function gh(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Xn(e,n){if(Array.isArray(e))for(const o of e)typeof o.modelId=="string"&&n.add(o.modelId)}function bh(e,n){const o=new Set,i=new Set,a=new Set;for(const r of e)for(const l of r.ops){const s=l;if(l.kind==="entity.add"&&s.entityRef===n){const c=s.value;Xn(c==null?void 0:c.attributes,o),Xn(c==null?void 0:c.operations,i),Xn(c==null?void 0:c.indexes,a);continue}s.containerRef!==n&&s.entityRef!==n||(l.kind==="attribute.add"?Xn([s.value],o):l.kind==="attribute.update"||l.kind==="attribute.remove"?typeof s.attributeRef=="string"&&o.add(s.attributeRef):l.kind==="operation.add"?Xn([s.value],i):l.kind==="operation.update"||l.kind==="operation.remove"?typeof s.operationRef=="string"&&i.add(s.operationRef):l.kind==="index.add"?Xn([s.value],a):(l.kind==="index.update"||l.kind==="index.remove")&&typeof s.indexRef=="string"&&a.add(s.indexRef))}return{attributes:o,operations:i,indexes:a}}function Si(e,n){return e.map(o=>({...o,subject:n}))}function Ds(e,n){const o=e.filter(s=>s.ops.some(c=>gh(c,n))),{attributes:i,operations:a,indexes:r}=bh(o,n),l=[...Si(en(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...Si(en(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...Si(en(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...Si(en(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function Os(e){return`${e.kind}:${e.ref}:${e.end??""}`}function _h(e){var i,a,r;const n=new Set,o=(l,s)=>{typeof s=="string"&&n.add(`${l}:${s}:`)};for(const l of e)for(const s of l.ops){const c=s;switch(s.kind){case"entity.add":{o("entity",c.entityRef);const d=c.value;for(const m of Array.isArray(d==null?void 0:d.attributes)?d.attributes:[])o("attribute",m.modelId);for(const m of Array.isArray(d==null?void 0:d.operations)?d.operations:[])o("operation",m.modelId);for(const m of Array.isArray(d==null?void 0:d.indexes)?d.indexes:[])o("index",m.modelId);break}case"attribute.add":o("attribute",(i=c.value)==null?void 0:i.modelId);break;case"operation.add":o("operation",(a=c.value)==null?void 0:a.modelId);break;case"index.add":o("index",(r=c.value)==null?void 0:r.modelId);break;case"association.add":o("association",c.associationRef);break;case"group.add":o("group",c.groupRef);break}}return n}function kh(e){const n=new Set,o=new Set,i=new Set;for(const a of e)for(const r of a.ops){const l=r,s=r.kind;if(s.startsWith("entity."))typeof l.entityRef=="string"&&n.add(l.entityRef);else if(s.startsWith("attribute.")||s.startsWith("operation.")||s.startsWith("index.")){const c=l.containerRef??l.entityRef;typeof c=="string"&&n.add(c)}else s.startsWith("associationEnd.")||s.startsWith("association.")?typeof l.associationRef=="string"&&o.add(l.associationRef):s.startsWith("group.")&&typeof l.groupRef=="string"&&i.add(l.groupRef)}return{entities:n,associations:o,groups:i}}function Eh(e){const{entities:n,associations:o,groups:i}=kh(e),a=[];for(const r of n)for(const l of Ds(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of en(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of en(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of en(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function kr(e){const n=Eh(e),o=_h(e),i=new Map;for(const l of n){const s=Os(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Os(l.subject);let d=s.subjects.get(c);if(!d){const m=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:m,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function Ls(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Nh(e,n,o){var r,l,s;const i=[],a=(c,d,m)=>i.push({seq:c,subject:d,verb:m,fields:[]});for(const c of e)if(!(c.seq<=n||c.seq>o))for(const d of c.ops){const m=d,u=m.containerRef??m.entityRef;switch(d.kind){case"entity.add":a(c.seq,{kind:"entity",ref:m.entityRef},"add");break;case"entity.remove":a(c.seq,{kind:"entity",ref:m.entityRef},"remove");break;case"attribute.add":{const p=(r=m.value)==null?void 0:r.modelId;typeof p=="string"&&u&&a(c.seq,{kind:"attribute",ref:p,entityRef:u},"add");break}case"attribute.remove":u&&a(c.seq,{kind:"attribute",ref:m.attributeRef,entityRef:u},"remove");break;case"operation.add":{const p=(l=m.value)==null?void 0:l.modelId;typeof p=="string"&&u&&a(c.seq,{kind:"operation",ref:p,entityRef:u},"add");break}case"operation.remove":u&&a(c.seq,{kind:"operation",ref:m.operationRef,entityRef:u},"remove");break;case"index.add":{const p=(s=m.value)==null?void 0:s.modelId;typeof p=="string"&&u&&a(c.seq,{kind:"index",ref:p,entityRef:u},"add");break}case"index.remove":u&&a(c.seq,{kind:"index",ref:m.indexRef,entityRef:u},"remove");break;case"association.add":a(c.seq,{kind:"association",ref:m.associationRef},"add");break;case"association.remove":a(c.seq,{kind:"association",ref:m.associationRef},"remove");break;case"group.add":a(c.seq,{kind:"group",ref:m.groupRef},"add");break;case"group.remove":a(c.seq,{kind:"group",ref:m.groupRef},"remove");break}}return i}function Er(e,n){const{fromSeq:o}=n,i=kr(e);let a=o;for(const u of e)u.seq>a&&(a=u.seq);const r=n.toSeq??a,l=i.filter(u=>u.seq>o&&u.seq<=r).reverse(),s=new Map,c=u=>{const p=Ls(u.subject);let y=s.get(p);y||(y={subject:u.subject,evs:[]},s.set(p,y)),y.evs.push(u)};for(const u of l)for(const p of u.actions)c({seq:u.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const u of Nh(e,o,r)){const p=s.get(Ls(u.subject));p!=null&&p.evs.some(y=>y.seq===u.seq)||c(u)}const d=[],m=new Set;for(const u of s.values()){u.evs.sort((y,f)=>y.seq-f.seq);const p=u.evs[u.evs.length-1];u.subject.kind==="entity"&&p.verb==="remove"&&m.add(u.subject.ref)}for(const u of s.values()){const p=u.evs[0].verb==="add",y=u.evs[u.evs.length-1].verb==="remove";if(u.subject.kind!=="entity"&&u.subject.entityRef&&m.has(u.subject.entityRef)||p&&y)continue;const f=new Map;let b=null;for(const _ of u.evs){_.verb==="add"&&b!==null&&b!=="add"&&f.clear(),b=_.verb;for(const E of _.fields){const g=f.get(E.field);g?g.lastValue=E.value:f.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(y){d.push({subject:u.subject,verb:"removed",fields:[]});continue}if(p){const _=[];for(const[E,g]of f)_.push({field:E,value:g.lastValue});d.push({subject:u.subject,verb:"added",fields:_});continue}const h=[];for(const[_,E]of f)E.hasOld&&hn(E.firstOld,E.lastValue)||h.push({field:_,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});h.length!==0&&d.push({subject:u.subject,verb:"modified",fields:h})}return{fromSeq:o,toSeq:r,entries:d}}function Ps(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class Nr{constructor(n){Ze(this,"undoStack",[]);Ze(this,"redoStack",[]);Ze(this,"savePoint",null);Ze(this,"listeners",new Set);Ze(this,"commandListeners",new Set);Ze(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"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(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function zs(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function at(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function vt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function Ht(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function $i(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=zs(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=at(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Us(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=zs(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=at(i,e),l=[];i.logical.associations.forEach((m,u)=>{o(m)&&l.push({item:m,index:u})});const s=new Set(l.map(m=>m.item.modelId)),c=[];i.layout.associationLayouts.forEach((m,u)=>{s.has(m.associationRef)&&c.push({item:m,index:u})});const d=[];i.logical.groups.forEach(m=>{const u=m.memberEntityRefs.indexOf(e);u>=0&&d.push({groupId:m.modelId,index:u})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((m,u)=>u.index-m.index).forEach(m=>i.layout.associationLayouts.splice(m.index,1)),[...l].sort((m,u)=>u.index-m.index).forEach(m=>i.logical.associations.splice(m.index,1));for(const m of d){const u=i.logical.groups.find(p=>p.modelId===m.groupId);u==null||u.memberEntityRefs.splice(m.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Fs(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:n}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{...o}}]}}}}function Hs(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function Jn(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=at(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=at(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function js(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=at(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=at(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function $o(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function Gs(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=at(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=$o(r.style,n)},invert(i){const a=at(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=at(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Ks(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=at(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=at(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Ys(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=at(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=at(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function wr(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function Ri(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=at(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=$o(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=at(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=at(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function Ai(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function qs(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:n}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:{...o}}]}}}}function Ws(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Xs(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function Ti(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function Js(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Zs(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Qs(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=$o(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function ec(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Vt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function _n(e,n,o){const i={},a=r=>{const l=Qe(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:o}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:{...i}}]}}}}function kn(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&Qe(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function tc(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const m=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...m,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...m,patch:{order:d??c.order}})}return{forward:l,invert:s}}function vr(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(u=>({...u}));const l=new Set(n),s=r.attributes.filter(u=>l.has(u.modelId)),c=r.attributes.filter(u=>!l.has(u.modelId)),d=Math.max(0,Math.min(o,c.length)),m=[...c.slice(0,d),...s,...c.slice(d)];r.attributes.splice(0,r.attributes.length,...m),r.attributes.forEach((u,p)=>u.order=p)},invert(a){i&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return tc("attribute.update","attributeRef",e,r,i??[])}}}function nc(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function oc(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:o}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:{...i}}]}}}}function ic(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=Qe(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function ac(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(p=>({...p}));const s=new Set(n),c=l.filter(p=>s.has(p.modelId)),d=l.filter(p=>!s.has(p.modelId)),m=Math.max(0,Math.min(o,d.length)),u=[...d.slice(0,m),...c,...d.slice(m)];l.splice(0,l.length,...u),l.forEach((p,y)=>p.order=y),r.operations=l},invert(a){if(!i)return;const r=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return tc("operation.update","operationRef",e,r,i??[])}}}function rc(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=at(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=$o(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=at(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=at(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function Vi(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,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 lc(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function Mi(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:n}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:{...o}}]}}}}function Mt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:o}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:{...i}}]}}}}function sc(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function cc(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:o}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:{...i}}]}}}}function dc(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&Qe(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const Bt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Ro=(e,n)=>{var o;return((o=vt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function uc(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=vt(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=vt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Ro(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Bt(e,r)],invert:[Bt(e,l)]}}}}function mc(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=vt(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=vt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Ro(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Bt(e,a)],invert:[Bt(e,r)]}}}}function fc(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=vt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=vt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Bt(e,Ro(a,e))],invert:[Bt(e,i??[])]}}}}function pc(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=vt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=vt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Bt(e,Ro(o,e))],invert:[Bt(e,n??[])]}}}}function hc(e,n,o){return{label:"waypoint 추가",apply(i){const a=vt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=vt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Ro(i,e),r=a.slice();return r.splice(n,1),{forward:[Bt(e,a)],invert:[Bt(e,r)]}}}}function yc(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.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 gc(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function Ao(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function bc(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function _c(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function kc(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=$o(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Ec(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function Nc(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const tn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Bi=(e,n,o)=>{var i;return((i=Ht(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function wc(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function vc(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function Ic(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=Ht(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=Ht(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Bi(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[tn(e,n,l)],invert:[tn(e,n,s)]}}}}function xc(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=Ht(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=Ht(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Bi(a,e,n),l=r.slice();return l.splice(o,1),{forward:[tn(e,n,r)],invert:[tn(e,n,l)]}}}}function Cc(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=Ht(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=Ht(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Bi(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[tn(e,n,r)],invert:[tn(e,n,l)]}}}}function Sc(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=Ht(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=Ht(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[tn(e,n,Bi(i,e,n))],invert:[tn(e,n,o??[])]}}}}function We(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const wh=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Vi,addAttribute:Vt,addEntity:$i,addEntityToGroup:Xs,addGroup:Ai,addIndex:sc,addNote:yc,addNoteConnection:wc,addNoteConnectionWaypoint:xc,addNoteToGroup:Ec,addOperation:nc,addWaypoint:hc,clearNoteConnectionWaypoints:Sc,clearWaypoints:pc,composite:We,moveEntity:Jn,moveGroup:Js,moveNote:Ao,moveNoteConnectionWaypoint:Ic,moveWaypoint:uc,removeAssociation:lc,removeAttribute:kn,removeEntity:Us,removeEntityFromGroup:Ti,removeGroup:Ws,removeIndex:dc,removeNote:gc,removeNoteConnection:vc,removeNoteConnectionWaypoint:Cc,removeNoteFromGroup:Nc,removeOperation:ic,removeWaypoint:mc,renameEntity:Hs,reorderAttributes:vr,reorderOperations:ac,resizeEntity:js,resizeGroup:Zs,resizeNote:bc,setAllEntitiesCollapsed:wr,setAttributeSwatch:Ri,setEntityCollapsed:Ks,setEntityLocked:Ys,setEntitySwatch:Gs,setGroupLocked:ec,setGroupSwatch:Qs,setNoteMemo:_c,setNoteSwatch:kc,setOperationSwatch:rc,translateWaypoints:fc,updateAssociation:Mi,updateAssociationEnd:Mt,updateAttribute:_n,updateEntity:Fs,updateGroup:qs,updateIndex:cc,updateOperation:oc},Symbol.toStringTag,{value:"Module"}));class $c{constructor(){Ze(this,"revs",new Map);Ze(this,"layoutVersion",0);Ze(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}class Rc{constructor(n){Ze(this,"cache",new $c);Ze(this,"newClientOpId");Ze(this,"debounceMs");Ze(this,"emissions",new WeakMap);Ze(this,"open",null);Ze(this,"debounceHandle",null);Ze(this,"queue",[]);Ze(this,"sending",!1);Ze(this,"_frozen",!1);Ze(this,"stack",null);Ze(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Ue,this.debounceMs=n.debounceMs??300}seed(n){this.cache.seed(n)}attach(n){this.stack=n;const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(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(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l;if(this._frozen)return;let a;if(o==="do"){const s=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!s)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=s}else{const s=this.emissions.get(n);if(!s)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=s}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((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(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o=null;try{o=await this.opts.transport(n)}catch(r){this.sending=!1,console.error("[op-sync] op 전송 실패 → 하드 프리즈(kind:missing):",r),(a=(i=this.opts).onError)==null||a.call(i,r),this.freeze({kind:"missing"});return}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const Ac=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add"],Tc=()=>crypto.randomUUID(),vh=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Ih=e=>e&&e[0].toLowerCase()+e.slice(1),xh=e=>e&&e[0].toUpperCase()+e.slice(1),Ch=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function Sh(e,n){return Ih(e)+xh(n)}function $h(e,n){const o=e.entities.find(l=>l.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const a=n.end1.entityRef===n.end2.entityRef?!1:n.identifying===!0;return o.attributes.filter(l=>l.identifier&&(l.attrType==="NORMAL"||l.attrType==="RELATION_OWN")).sort((l,s)=>l.order-s.order).map(l=>{const s=Sh(o.name,l.name);return{associationRef:n.modelId,sourceAttributeRef:l.modelId,name:s,type:l.type,identifier:a,notNull:a,dbAttrs:l.dbAttrs.map(c=>({physicalName:Ch(s),logicalName:c.logicalName,dataType:c.dataType,length:c.length,scale:c.scale}))}})}const Di=(e,n)=>`${e}::${n}`,Oi=e=>e??void 0;function Rh(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Oi(s.length)!==Oi(r.length)||Oi(s.scale)!==Oi(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Ah(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function To(e,n,o=Tc){const i={add:[],update:[],remove:[]},a=e.entities.find(u=>u.modelId===n);if(!a)return i;const r=e.associations.filter(u=>u.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(u=>$h(e,u)),s=new Map(l.map(u=>[Di(u.associationRef,u.sourceAttributeRef),u])),c=a.attributes.filter(u=>u.derivedFrom),d=new Map(c.map(u=>[Di(u.derivedFrom.associationRef,u.derivedFrom.sourceAttributeRef),u]));for(const u of c){const p=Di(u.derivedFrom.associationRef,u.derivedFrom.sourceAttributeRef);s.has(p)||i.remove.push(u.modelId)}let m=a.attributes.reduce((u,p)=>Math.max(u,p.order),-1)+1;for(const u of l){const p=Di(u.associationRef,u.sourceAttributeRef),y=d.get(p);if(!y)i.add.push(Ah(u,m++,o));else{const f=Rh(y,u,o);f&&i.update.push({attributeId:y.modelId,patch:f})}}return i}function Th(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function Vh(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Mh(e,n,o=Tc){const i=new Map,a=Vh(e),r=new Set,l=[n];for(;l.length;){const s=l.shift();if(r.has(s))continue;r.add(s);const c=new Set(a.associations.filter(d=>d.end1.entityRef===s).map(d=>d.end2.entityRef));for(const d of c){const m=To(a,d,o);if(vh(m))continue;i.has(d)||i.set(d,m);const u=a.entities.find(p=>p.modelId===d);u&&Th(u,m),r.has(d)||l.push(d)}}return i}function Li(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!a.attrType.startsWith("RELATION")||a.dbAttrs.length===0)return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}function Bh(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Dh(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Vc(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function ut(e,n){const o=Bh(e,n);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 Mc(e,n){const o=Dh(e,n);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 Oh(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Lh(e,n){const o=Oh(e,n);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 Bc(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Ph(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function zh(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Uh(e,n){const o=Ph(e,n);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 Dc(e,n){const o=zh(e,n);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 Oc(e,n,o){const i=e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null;return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Lc(e,n,o,i,a,r,l,s,c){const d=c(),m=new Map((e.embeddableOverrides??[]).map(y=>[y.field,y])),u=[];let p=!1;for(const y of n.fields){const f=m.get(y.name);if(f!=null&&f.sharedColumnPhysicalName){const b={ref:f.sharedColumnPhysicalName,by:"physicalName"},h=Bc(mn(i,a),b);if(!h.ok){s.push(h.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches:h.matches}),p=!0;continue}u.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:h.value.modelId});continue}u.push({modelId:c(),physicalName:(f==null?void 0:f.physicalName)??"",dataType:"",...f!=null&&f.length?{length:f.length}:{},...f!=null&&f.scale?{scale:f.scale}:{},...(f==null?void 0:f.insertable)!=null?{insertable:f.insertable}:{},...(f==null?void 0:f.updatable)!=null?{updatable:f.updatable}:{}})}return p?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:u}}const Fh=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),Ir=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),Hh=new Set([...Ir].filter(e=>e!=="sharedColumnRef"));function jh(e,n,o,i){if(i||o.some(l=>!Hh.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))Ir.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Gh(e,n,o,i,a,r,l,s){const c=new Map(o.map(u=>[u.field,u])),d=[];let m=!1;return e.dbAttrs.forEach((u,p)=>{const y=n.fields[p],f=y?c.get(y.name):void 0;if(!f){d.push(u);return}if(f.sharedColumnPhysicalName){const h={ref:f.sharedColumnPhysicalName,by:"physicalName"},_=Bc(mn(i,a),h);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:h}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:h,matches:_.matches}),m=!0;return}d.push({modelId:u.modelId,physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});return}const b={...u};delete b.sharedColumnRef,d.push({...b,...f.physicalName!=null?{physicalName:f.physicalName}:{},...f.length!=null?{length:f.length}:{},...f.scale!=null?{scale:f.scale}:{},...f.insertable!=null?{insertable:f.insertable}:{},...f.updatable!=null?{updatable:f.updatable}:{}})}),m?null:d}function Pc(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function zc(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Lh(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function Kh(e,n,o={}){const i=o.mkId??Ue,a=o.embeddableCatalog??[],r=u=>a.find(p=>p.type===u),l=[],s=[],c=new Map,d=new Map,m=new Set;for(const u of n)u.kind==="entity.add"&&(m.add(u.spec.name),u.spec.physicalName&&m.add(u.spec.physicalName));return n.forEach((u,p)=>{var y,f,b;switch(u.kind){case"entity.add":{const h=i(),_={modelId:h,name:u.spec.name,stereotype:u.spec.stereotype??"JPA_ENTITY",attributes:[],...u.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...u.spec.physicalName?{table:{physicalName:u.spec.physicalName}}:{}},E={ref:u.spec.name};let g=!1;for(const[T,I]of(u.spec.attributes??[]).entries()){if(I.type==="GroupCodeEnum"&&!I.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:E,handle:{ref:I.name}}),g=!0;continue}const z=r(I.type);if(z){const w=Lc(I,z,T,_,e.entities,p,E,s,i);w?_.attributes.push(w):g=!0}else(y=I.embeddableOverrides)!=null&&y.length?(s.push({code:"embeddable-type-unresolved",opIndex:p,entity:E,handle:{ref:I.name}}),g=!0):_.attributes.push(Oc(I,T,i))}const N=(u.spec.operations??[]).map((T,I)=>Pc(T,I,i));N.length&&(_.operations=N);const V=[];for(const T of u.spec.indexes??[]){const I=zc(_,T,p,E,s,i);I?V.push(I):g=!0}if(V.length&&(_.indexes=V),g)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:h,value:_});break}case"entity.update":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}l.push({kind:"entity.update",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,patch:u.patch});break}case"entity.remove":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}l.push({kind:"entity.remove",casUnit:"logical",entityRef:h.value.modelId});break}case"attribute.add":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}if(u.spec.type==="GroupCodeEnum"&&!u.spec.groupCode){s.push({code:"groupcode-required",opIndex:p,entity:u.entity,handle:{ref:u.spec.name}});break}const _=c.get(h.value.modelId)??wt(h.value.attributes);c.set(h.value.modelId,_+1);const E=r(u.spec.type);let g;if(E)g=Lc(u.spec,E,_,h.value,e.entities,p,u.entity,s,i);else if((f=u.spec.embeddableOverrides)!=null&&f.length){s.push({code:"embeddable-type-unresolved",opIndex:p,entity:u.entity,handle:{ref:u.spec.name}});break}else g=Oc(u.spec,_,i);if(!g)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,value:g});break}case"attribute.update":case"attribute.remove":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}const _=Mc(h.value,u.attribute);if(!_.ok){s.push(_.reason==="not-found"?{code:"attribute-not-found",opIndex:p,entity:u.entity,handle:u.attribute}:{code:"attribute-ambiguous",opIndex:p,entity:u.entity,handle:u.attribute,matches:_.matches});break}if(u.kind==="attribute.update"){const E=[],g=[];let N=!1;for(const T of Object.keys(u.patch)){if(T.includes(".")){T.startsWith("dbAttrs.")&&(N=!0);continue}Ir.has(T)?E.push(T):Fh.has(T)||g.push(T)}if(g.length){s.push({code:"attribute-patch-unknown-key",opIndex:p,entity:u.entity,handle:u.attribute,keys:g});break}let V=u.patch;if(E.length){const T=jh(_.value,u.patch,E,N);if(!T){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:p,entity:u.entity,handle:u.attribute,keys:E});break}V=T}if((b=u.embeddableOverrides)!=null&&b.length){const T=r(_.value.type);if(!T||_.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:p,entity:u.entity,handle:u.attribute});break}const I=Gh(_.value,T,u.embeddableOverrides,h.value,e.entities,p,u.entity,s);if(!I)break;V={...V,dbAttrs:I}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,attributeRef:_.value.modelId,patch:V})}else l.push({kind:"attribute.remove",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,attributeRef:_.value.modelId});break}case"association.add":{const h=ut(e,u.spec.from),_=ut(e,u.spec.to);if(h.ok||s.push(mt(h.reason,p,u.spec.from,h.matches,m)),_.ok||s.push(mt(_.reason,p,u.spec.to,_.matches,m)),!h.ok||!_.ok)break;if(u.spec.identifying&&h.value.modelId===_.value.modelId){s.push({code:"self-identifying",opIndex:p,handle:{from:u.spec.from,to:u.spec.to}});break}const E=i(),g={modelId:E,...u.spec.identifying!=null?{identifying:u.spec.identifying}:{},end1:{entityRef:h.value.modelId,multiplicity:u.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1},end2:{entityRef:_.value.modelId,multiplicity:u.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:u.spec.composition??!1}},N={...e,associations:[...e.associations,g]},V=To(N,_.value.modelId,i);V.add[0]&&(g.end2.attributeRef=V.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:E,value:g});for(const T of V.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,value:T});break}case"association.remove":{const h=ut(e,u.association.from),_=ut(e,u.association.to);if(h.ok||s.push(mt(h.reason,p,u.association.from,h.matches,m)),_.ok||s.push(mt(_.reason,p,u.association.to,_.matches,m)),!h.ok||!_.ok)break;const E=Vc(e,h.value.modelId,_.value.modelId);if(E.length!==1){s.push(E.length===0?{code:"association-not-found",opIndex:p,handle:u.association}:{code:"association-ambiguous",opIndex:p,handle:u.association,matches:E.map(g=>g.modelId)});break}l.push({kind:"association.remove",casUnit:"logical",associationRef:E[0].modelId});break}case"association.update":{const h=Uc(e,u.association,p,s,m);if(!h)break;l.push({kind:"association.update",casUnit:"logical",containerRef:h.modelId,associationRef:h.modelId,patch:u.patch});break}case"associationEnd.update":{const h=Uc(e,u.association,p,s,m);if(!h)break;const _=u.end==="from"?"end1":"end2";l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:h.modelId,associationRef:h.modelId,end:_,patch:u.patch});break}case"index.add":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}const _=zc(h.value,u.spec,p,u.entity,s,i);if(!_)break;l.push({kind:"index.add",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,indexRef:_.modelId,value:_});break}case"index.update":case"index.remove":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}const _=Uh(h.value,u.index);if(!_.ok){s.push(_.reason==="not-found"?{code:"index-not-found",opIndex:p,entity:u.entity,handle:u.index}:{code:"index-ambiguous",opIndex:p,entity:u.entity,handle:u.index,matches:_.matches});break}if(u.kind==="index.update"){if("columns"in u.patch){s.push({code:"index-columns-patch-unsupported",opIndex:p,entity:u.entity,handle:u.index});break}l.push({kind:"index.update",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,indexRef:_.value.modelId,patch:u.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,indexRef:_.value.modelId});break}case"operation.add":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}const _=d.get(h.value.modelId)??(h.value.operations?wt(h.value.operations):0);d.set(h.value.modelId,_+1);const E=Pc(u.spec,_,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,operationRef:E.modelId,value:E});break}case"operation.update":case"operation.remove":{const h=ut(e,u.entity);if(!h.ok){s.push(mt(h.reason,p,u.entity,h.matches,m));break}const _=Dc(h.value,u.operation);if(!_.ok){s.push(_.reason==="not-found"?{code:"operation-not-found",opIndex:p,entity:u.entity,handle:u.operation}:{code:"operation-ambiguous",opIndex:p,entity:u.entity,handle:u.operation,matches:_.matches});break}u.kind==="operation.update"?l.push({kind:"operation.update",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,operationRef:_.value.modelId,patch:u.patch}):l.push({kind:"operation.remove",casUnit:"logical",containerRef:h.value.modelId,entityRef:h.value.modelId,operationRef:_.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const h=u.kind==="attribute.reorder",_=ut(e,u.entity);if(!_.ok){s.push(mt(_.reason,p,u.entity,_.matches,m));break}const E=h?u.order:u.operations,g=[],N=new Set;let V=!1;for(const w of E){const x=h?Mc(_.value,w):Dc(_.value,w);if(!x.ok){s.push(x.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:p,entity:u.entity,handle:w}:{code:"reorder-handle-ambiguous",opIndex:p,entity:u.entity,handle:w,matches:x.matches}),V=!0;continue}if(N.has(x.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:p,entity:u.entity,handle:w}),V=!0;continue}N.add(x.value.modelId),g.push(x.value)}if(V)break;const I=(h?_.value.attributes:_.value.operations??[]).filter(w=>!N.has(w.modelId));[...g,...I].forEach((w,x)=>{w.order!==x&&l.push(h?{kind:"attribute.update",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,attributeRef:w.modelId,patch:{order:x}}:{kind:"operation.update",casUnit:"logical",containerRef:_.value.modelId,entityRef:_.value.modelId,operationRef:w.modelId,patch:{order:x}})});break}case"group.add":{const h=[];let _=!1;for(const N of u.spec.members){const V=ut(e,N);if(!V.ok){s.push(mt(V.reason,p,N,V.matches,m)),_=!0;continue}h.push(V.value.modelId)}if(_)break;const E=i(),g={modelId:E,excludeDDLGeneration:u.spec.excludeDDLGeneration??!1,memberEntityRefs:h,...u.spec.name?{name:u.spec.name}:{},...u.spec.packageName?{packageName:u.spec.packageName}:{},...u.spec.description?{description:u.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:E,value:g});break}}}),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function mt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Uc(e,n,o,i,a){const r=ut(e,n.from),l=ut(e,n.to);if(r.ok||i.push(mt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(mt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Vc(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Fc={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명."},by:{type:"string",enum:["physicalName","name"],description:"매칭 키 고정(미지정 시 대상별 기본 순서)."}},required:["ref"],additionalProperties:!1},Yh={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},qh={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},En={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},Wh={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...En,description:"속성 설명(다국어)."},columnLogicalName:{...En,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},Xh={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Hc={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Jh={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Hc,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Hc,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},Zh={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Fc,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},Qh={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...En,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},ey={type:"object",properties:{name:{...En,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},ty={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string"},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...En,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...En,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},ny={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},oy={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},iy={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...En,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},ay={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},ry={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function rt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const ly={"entity.add":rt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":rt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":rt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":rt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":rt("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":rt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":rt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":rt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":rt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":rt("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":rt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":rt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":rt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/handle"}},required:["entity","index"]}),"operation.add":rt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":rt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":rt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/handle"}},required:["entity","operation"]}),"attribute.reorder":rt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":rt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","operations"]}),"group.add":rt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]})},jc={anyOf:Ac.map(e=>ly[e])},sy={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Fc,assocHandle:Yh,entitySpec:qh,attrSpec:Wh,embeddableOverrides:Xh,assocSpec:Jh,indexSpec:Zh,operationSpec:Qh,groupSpec:ey,entityUpdatePatch:ay,attrUpdatePatch:ty,assocUpdatePatch:ny,assocEndUpdatePatch:ry,indexUpdatePatch:oy,operationUpdatePatch:iy,symbolicOp:jc}};function cy(e,n,o,i={}){const a=i.mkClientOpId??Ue,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Gc={location:{x:0,y:0},size:{width:220,height:140}};function Kc(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 dy=/^[-=_*~\s]{3,}$/;function uy(e){return e.attrType&&e.attrType!=="NORMAL"||!dy.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function my(e){return e.type===At&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function fy(e,n){if(e.attrType==="DIVIDER"||uy(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=my(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(Kc)}}function py(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...m}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(m).length?m:void 0}}function hy(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function yy(e){var n,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(fy),operations:(n=e.operations)==null?void 0:n.map(py),indexes:(o=e.indexes)==null?void 0:o.map(hy),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function gy(e){const n={};for(const i of e.attributes)i.style&&(n[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??{...Gc},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function Yc(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 xr(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:Yc(e)}}function by(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>Cr(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function _y(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:by(e),end1:xr(e.end1),end2:xr(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:n,layout:o}}function Cr(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function qc(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Wc(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Xc(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(Kc)}}function ky(e,n,o){var N,V;const i=Cr(e.end1.attribute),a=Cr(e.end2.attribute);if(i===a)return _y(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(V=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:V.targetModelId,d=c?o.get(c):void 0,m=n.get(l.endModel.refId),u=m?m.attributes.reduce((T,I)=>Math.max(T,I.order),-1)+1:s.order??0,p={...Xc(s,u),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};m&&m.attributes.push(p);const y=n.get(r.endModel.refId),f=l.attribute;let b;if(f&&y&&r.navigable){const T=hi(l.multiplicity);b={modelId:f.modelId??crypto.randomUUID(),name:f.name??gi((m==null?void 0:m.name)??l.endModel.refId,T),type:(m==null?void 0:m.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:y.attributes.reduce((I,z)=>Math.max(I,z.order),-1)+1,dbAttrs:[]},y.attributes.push(b)}const h=(T,I)=>({entityRef:T.endModel.refId,multiplicity:T.multiplicity,navigable:T.navigable,composition:T.composition,attributeRef:I?b==null?void 0:b.modelId:p.modelId,jpa:Yc(T)}),_=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!_&&p.identifier===!0?!0:void 0,end1:h(e.end1,i),end2:h(e.end2,a)},g={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:g}}function Ey(e,n){const o=e.targetModelId?n.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 Ny(e,n,o){var f;const i=((f=e.end1.attribute)==null?void 0:f.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,h)=>Math.max(b,h.order),-1)+1:l.order??0,d={...Xc(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>Ey(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const m=b=>({...xr(b),legacyEmbedRaw:b.attribute}),u={modelId:e.modelId,description:e.description,end1:m(e.end1),end2:m(e.end2)},p=!i,y={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:u,layout:y}}function wy(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,m=c===e?d:c;!m||m===e||o.push({targetRef:m,waypoints:s.locations??[]})}return o}function Jc(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const m=wy(o,s);m.length&&(d=m)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Zc(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function vy(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(u=>u.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=hi(i.end2.multiplicity),c=gi(r.name,s),d=ts(c,new Set(a.attributes.map(u=>u.name))),m=crypto.randomUUID();a.attributes.push({modelId:m,name:d,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((u,p)=>Math.max(u,p.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=m}}function Iy(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function xy(e){return(e.schemaVersion??1)>=2&&"logical"in e?Cy(e):Sy(e)}function Cy(e){const n=e.id??e.logical.modelId??"",o={},i=u=>{const{rev:p,...y}=u;return p!=null&&(o[u.modelId]=p),y},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);vy(a,r),Iy(a,r);const{version:s,...c}=e.layout;Zc(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},m={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:m}}function Sy(e){var _,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(g,N)=>{o.push(yy(g));const V=gy(g);V.geo={location:{x:V.geo.location.x+N.x,y:V.geo.location.y+N.y},size:V.geo.size},i.push(V);for(const T of g.ownedAssociations??[])c.push(T)},m={x:0,y:0};for(const g of e.entities??[])d(g,m);const u=[];for(const g of e.groups??[]){const N=g.entities??[];l.push({modelId:g.modelId,name:g.name,description:g.description,packageName:g.packageName,excludeDDLGeneration:g.excludeDDLGeneration??!1,memberEntityRefs:N.map(T=>T.modelId)});const V=((_=g.geo)==null?void 0:_.location)??m;if(g.geo){const T=(g.notes??[]).map(I=>I.modelId);s.push({groupRef:g.modelId,geo:g.geo,style:g.style,locked:g.locked,memberNoteRefs:T.length?T:void 0})}for(const T of N)d(T,V);for(const T of g.notes??[])u.push(Jc(T,V))}const p=new Map(o.map(g=>[g.modelId,g])),y=new Map,f=new Map;for(const g of o)for(const N of g.attributes)for(const V of N.dbAttrs)y.set(V.modelId,N.modelId),f.set(V.modelId,V);for(const g of c)for(const N of[g.end1,g.end2]){const V=N.attribute;if(V&&(((E=V.dbAttrs)==null?void 0:E.length)??0)>0)for(const T of V.dbAttrs)T.modelId&&y.set(T.modelId,V.modelId)}for(const g of c){const N=qc(g.end1.attribute),V=qc(g.end2.attribute),T=Wc(g.end1)||Wc(g.end2),{assoc:I,layout:z}=N!==V||T?Ny(g,p,f):ky(g,p,y);a.push(I),r.push(z)}Zc(o,a,r),Ts(o);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(g=>Jc(g)),...u]}},h={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:h}}function Qc(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 $y(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(Qc),style:n}}function Ry(e,n){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:n}}function Ay(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function nn(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function Ty(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...Qc(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Vy(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function ed(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function My(e){const n=new Set;for(const o of e.logical.associations){const i=ed(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function By(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function Dy(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function Oy(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:Dy(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function Ly(e,n,o){let i;for(const u of n.logical.entities){const p=u.attributes.find(y=>{var f;return((f=y.embedded)==null?void 0:f.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(u=>u.modelId===a);if(!r)return;const l=r.attributes.flatMap(u=>u.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((u,p)=>Oy(u,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,m=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:nn(e.end1,c?s:m),end2:nn(e.end2,c?m:s)}}function Py(e,n,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:nn(e.end1,e.end1.legacyEmbedRaw),end2:nn(e.end2,e.end2.legacyEmbedRaw)};const a=Ly(e,n,i);if(a)return a;const r=ed(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?Ty(r.fk,l):void 0,c=Vy(r.navAttr);return{...i,end1:nn(e.end1,r.navEnd===e.end1?s:c),end2:nn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:nn(e.end1),end2:nn(e.end2)}}function td(e,n,o,i,a={x:0,y:0}){var m,u;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(y=>y.associationRef===p),c=(r==null?void 0:r.geo)??{...Gc},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var y;return $y(p,(y=r==null?void 0:r.attributeStyles)==null?void 0:y[p.modelId])}),operations:(m=e.operations)==null?void 0:m.map(p=>{var y;return Ry(p,(y=r==null?void 0:r.operationStyles)==null?void 0:y[p.modelId])}),ownedAssociations:l.map(p=>Py(p,n,s(p.modelId))),indexes:(u=e.indexes)==null?void 0:u.map(Ay),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function zy(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>nd(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>td(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function nd(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function Uy(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=My(e),r=By(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>td(s,e,a,r)),groups:e.logical.groups.map(s=>zy(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>nd(s))}}function Fy(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.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:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}function Vo(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function jt(e){return typeof e=="function"?e():t.unref(e)}const Hy=typeof window<"u"&&typeof document<"u",jy=e=>typeof e<"u",Gy=Object.prototype.toString,Ky=e=>Gy.call(e)==="[object Object]",Yy=()=>{};function qy(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const od=e=>e();function Wy(e=od){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function id(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function Xy(e,n,o={}){const{eventFilter:i=od,...a}=o;return t.watch(e,qy(i,n),a)}function Zn(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=Wy(i);return{stop:Xy(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function Jy(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=jt(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function Sr(e,n=!1){function o(u,{flush:p="sync",deep:y=!1,timeout:f,throwOnTimeout:b}={}){let h=null;const E=[new Promise(g=>{h=t.watch(e,N=>{u(N)!==n&&(h==null||h(),g(N))},{flush:p,deep:y,immediate:!0})})];return f!=null&&E.push(id(f,b).then(()=>jt(e)).finally(()=>h==null?void 0:h())),Promise.race(E)}function i(u,p){if(!t.isRef(u))return o(N=>N===u,p);const{flush:y="sync",deep:f=!1,timeout:b,throwOnTimeout:h}=p??{};let _=null;const g=[new Promise(N=>{_=t.watch([e,u],([V,T])=>{n!==(V===T)&&(_==null||_(),N(V))},{flush:y,deep:f,immediate:!0})})];return b!=null&&g.push(id(b,h).then(()=>jt(e)).finally(()=>(_==null||_(),jt(e)))),Promise.race(g)}function a(u){return o(p=>!!p,u)}function r(u){return i(null,u)}function l(u){return i(void 0,u)}function s(u){return o(Number.isNaN,u)}function c(u,p){return o(y=>{const f=Array.from(y);return f.includes(u)||f.includes(jt(u))},p)}function d(u){return m(1,u)}function m(u=1,p){let y=-1;return o(()=>(y+=1,y>=u),p)}return Array.isArray(jt(e))?{toMatch:o,toContains:c,changed:d,changedTimes:m,get not(){return Sr(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:m,get not(){return Sr(e,!n)}}}function $r(e){return Sr(e)}function Zy(e){var n;const o=jt(e);return(n=o==null?void 0:o.$el)!=null?n:o}const ad=Hy?window:void 0;function rd(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=ad):[n,o,i,a]=e,!n)return Yy;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(m=>m()),r.length=0},s=(m,u,p,y)=>(m.addEventListener(u,p,y),()=>m.removeEventListener(u,p,y)),c=t.watch(()=>[Zy(n),jt(a)],([m,u])=>{if(l(),!m)return;const p=Ky(u)?{...u}:u;r.push(...o.flatMap(y=>i.map(f=>s(m,y,f,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return Vo(d),d}function Qy(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function ld(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=ad,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=Qy(n);return rd(a,r,m=>{m.repeat&&jt(s)||c(m)&&o(m)},l)}function eg(e){return JSON.parse(JSON.stringify(e))}function Rr(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:m=!1,defaultValue:u,shouldEmit:p}=i,y=t.getCurrentInstance(),f=o||(y==null?void 0:y.emit)||((a=y==null?void 0:y.$emit)==null?void 0:a.bind(y))||((l=(r=y==null?void 0:y.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(y==null?void 0:y.proxy));let b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const h=g=>s?typeof s=="function"?s(g):eg(g):g,_=()=>jy(e[n])?h(e[n]):u,E=g=>{p?p(g)&&f(b,g):f(b,g)};if(c){const g=_(),N=t.ref(g);let V=!1;return t.watch(()=>e[n],T=>{V||(V=!0,N.value=h(T),t.nextTick(()=>V=!1))}),t.watch(N,T=>{!V&&(T!==e[n]||m)&&E(T)},{deep:m}),N}else return t.computed({get(){return _()},set(g){E(g)}})}var tg={value:()=>{}};function Pi(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new zi(o)}function zi(e){this._=e}function ng(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}zi.prototype=Pi.prototype={constructor:zi,on:function(e,n){var o=this._,i=ng(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=og(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=sd(o[a],e.name,n);else if(n==null)for(a in o)o[a]=sd(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new zi(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function og(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function sd(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=tg,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Ar="http://www.w3.org/1999/xhtml";const cd={svg:"http://www.w3.org/2000/svg",xhtml:Ar,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ui(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),cd.hasOwnProperty(n)?{space:cd[n],local:e}:e}function ig(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Ar&&n.documentElement.namespaceURI===Ar?n.createElement(e):n.createElementNS(o,e)}}function ag(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dd(e){var n=Ui(e);return(n.local?ag:ig)(n)}function rg(){}function Tr(e){return e==null?rg:function(){return this.querySelector(e)}}function lg(e){typeof e!="function"&&(e=Tr(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,m=0;m<l;++m)(c=r[m])&&(d=e.call(c,c.__data__,m,r))&&("__data__"in c&&(d.__data__=c.__data__),s[m]=d);return new kt(i,this._parents)}function sg(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function cg(){return[]}function ud(e){return e==null?cg:function(){return this.querySelectorAll(e)}}function dg(e){return function(){return sg(e.apply(this,arguments))}}function ug(e){typeof e=="function"?e=dg(e):e=ud(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new kt(i,a)}function md(e){return function(){return this.matches(e)}}function fd(e){return function(n){return n.matches(e)}}var mg=Array.prototype.find;function fg(e){return function(){return mg.call(this.children,e)}}function pg(){return this.firstElementChild}function hg(e){return this.select(e==null?pg:fg(typeof e=="function"?e:fd(e)))}var yg=Array.prototype.filter;function gg(){return Array.from(this.children)}function bg(e){return function(){return yg.call(this.children,e)}}function _g(e){return this.selectAll(e==null?gg:bg(typeof e=="function"?e:fd(e)))}function kg(e){typeof e!="function"&&(e=md(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new kt(i,this._parents)}function pd(e){return new Array(e.length)}function Eg(){return new kt(this._enter||this._groups.map(pd),this._parents)}function Fi(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Fi.prototype={constructor:Fi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ng(e){return function(){return e}}function wg(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new Fi(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function vg(e,n,o,i,a,r,l){var s,c,d=new Map,m=n.length,u=r.length,p=new Array(m),y;for(s=0;s<m;++s)(c=n[s])&&(p[s]=y=l.call(c,c.__data__,s,n)+"",d.has(y)?a[s]=c:d.set(y,c));for(s=0;s<u;++s)y=l.call(e,r[s],s,r)+"",(c=d.get(y))?(i[s]=c,c.__data__=r[s],d.delete(y)):o[s]=new Fi(e,r[s]);for(s=0;s<m;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Ig(e){return e.__data__}function xg(e,n){if(!arguments.length)return Array.from(this,Ig);var o=n?vg:wg,i=this._parents,a=this._groups;typeof e!="function"&&(e=Ng(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var m=i[d],u=a[d],p=u.length,y=Cg(e.call(m,m&&m.__data__,d,i)),f=y.length,b=s[d]=new Array(f),h=l[d]=new Array(f),_=c[d]=new Array(p);o(m,u,b,h,_,y,n);for(var E=0,g=0,N,V;E<f;++E)if(N=b[E]){for(E>=g&&(g=E+1);!(V=h[g])&&++g<f;);N._next=V||null}}return l=new kt(l,i),l._enter=s,l._exit=c,l}function Cg(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Sg(){return new kt(this._exit||this._groups.map(pd),this._parents)}function $g(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Rg(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],m=i[c],u=d.length,p=s[c]=new Array(u),y,f=0;f<u;++f)(y=d[f]||m[f])&&(p[f]=y);for(;c<a;++c)s[c]=o[c];return new kt(s,this._parents)}function Ag(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function Tg(e){e||(e=Vg);function n(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,m=0;m<s;++m)(d=l[m])&&(c[m]=d);c.sort(n)}return new kt(a,this._parents).order()}function Vg(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Mg(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bg(){return Array.from(this)}function Dg(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function Og(){let e=0;for(const n of this)++e;return e}function Lg(){return!this.node()}function Pg(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function zg(e){return function(){this.removeAttribute(e)}}function Ug(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fg(e,n){return function(){this.setAttribute(e,n)}}function Hg(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function jg(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Gg(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function Kg(e,n){var o=Ui(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?Ug:zg:typeof n=="function"?o.local?Gg:jg:o.local?Hg:Fg)(o,n))}function hd(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Yg(e){return function(){this.style.removeProperty(e)}}function qg(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Wg(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Xg(e,n,o){return arguments.length>1?this.each((n==null?Yg:typeof n=="function"?Wg:qg)(e,n,o??"")):Qn(this.node(),e)}function Qn(e,n){return e.style.getPropertyValue(n)||hd(e).getComputedStyle(e,null).getPropertyValue(n)}function Jg(e){return function(){delete this[e]}}function Zg(e,n){return function(){this[e]=n}}function Qg(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function eb(e,n){return arguments.length>1?this.each((n==null?Jg:typeof n=="function"?Qg:Zg)(e,n)):this.node()[e]}function yd(e){return e.trim().split(/^|\s+/)}function Vr(e){return e.classList||new gd(e)}function gd(e){this._node=e,this._names=yd(e.getAttribute("class")||"")}gd.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function bd(e,n){for(var o=Vr(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function _d(e,n){for(var o=Vr(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function tb(e){return function(){bd(this,e)}}function nb(e){return function(){_d(this,e)}}function ob(e,n){return function(){(n.apply(this,arguments)?bd:_d)(this,e)}}function ib(e,n){var o=yd(e+"");if(arguments.length<2){for(var i=Vr(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?ob:n?tb:nb)(o,n))}function ab(){this.textContent=""}function rb(e){return function(){this.textContent=e}}function lb(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function sb(e){return arguments.length?this.each(e==null?ab:(typeof e=="function"?lb:rb)(e)):this.node().textContent}function cb(){this.innerHTML=""}function db(e){return function(){this.innerHTML=e}}function ub(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function mb(e){return arguments.length?this.each(e==null?cb:(typeof e=="function"?ub:db)(e)):this.node().innerHTML}function fb(){this.nextSibling&&this.parentNode.appendChild(this)}function pb(){return this.each(fb)}function hb(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yb(){return this.each(hb)}function gb(e){var n=typeof e=="function"?e:dd(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function bb(){return null}function _b(e,n){var o=typeof e=="function"?e:dd(e),i=n==null?bb:typeof n=="function"?n:Tr(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function kb(){var e=this.parentNode;e&&e.removeChild(this)}function Eb(){return this.each(kb)}function Nb(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function wb(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function vb(e){return this.select(e?wb:Nb)}function Ib(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xb(e){return function(n){e.call(this,n,this.__data__)}}function Cb(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function Sb(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function $b(e,n,o){return function(){var i=this.__on,a,r=xb(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Rb(e,n,o){var i=Cb(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,m;c<d;++c)for(a=0,m=s[c];a<r;++a)if((l=i[a]).type===m.type&&l.name===m.name)return m.value}return}for(s=n?$b:Sb,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function kd(e,n,o){var i=hd(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function Ab(e,n){return function(){return kd(this,e,n)}}function Tb(e,n){return function(){return kd(this,e,n.apply(this,arguments))}}function Vb(e,n){return this.each((typeof n=="function"?Tb:Ab)(e,n))}function*Mb(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Ed=[null];function kt(e,n){this._groups=e,this._parents=n}function Mo(){return new kt([[document.documentElement]],Ed)}function Bb(){return this}kt.prototype=Mo.prototype={constructor:kt,select:lg,selectAll:ug,selectChild:hg,selectChildren:_g,filter:kg,data:xg,enter:Eg,exit:Sg,join:$g,merge:Rg,selection:Bb,order:Ag,sort:Tg,call:Mg,nodes:Bg,node:Dg,size:Og,empty:Lg,each:Pg,attr:Kg,style:Xg,property:eb,classed:ib,text:sb,html:mb,raise:pb,lower:yb,append:gb,insert:_b,remove:Eb,clone:vb,datum:Ib,on:Rb,dispatch:Vb,[Symbol.iterator]:Mb};function It(e){return typeof e=="string"?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],Ed)}function Db(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Dt(e,n){if(e=Db(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const Ob={passive:!1},Bo={capture:!0,passive:!1};function Mr(e){e.stopImmediatePropagation()}function eo(e){e.preventDefault(),e.stopImmediatePropagation()}function Nd(e){var n=e.document.documentElement,o=It(e).on("dragstart.drag",eo,Bo);"onselectstart"in n?o.on("selectstart.drag",eo,Bo):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function wd(e,n){var o=e.document.documentElement,i=It(e).on("dragstart.drag",null);n&&(i.on("click.drag",eo,Bo),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 Hi=e=>()=>e;function Br(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,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:m}})}Br.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Lb(e){return!e.ctrlKey&&!e.button}function Pb(){return this.parentNode}function zb(e,n){return n??{x:e.x,y:e.y}}function Ub(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fb(){var e=Lb,n=Pb,o=zb,i=Ub,a={},r=Pi("start","drag","end"),l=0,s,c,d,m,u=0;function p(N){N.on("mousedown.drag",y).filter(i).on("touchstart.drag",h).on("touchmove.drag",_,Ob).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(N,V){if(!(m||!e.call(this,N,V))){var T=g(this,n.call(this,N,V),N,V,"mouse");T&&(It(N.view).on("mousemove.drag",f,Bo).on("mouseup.drag",b,Bo),Nd(N.view),Mr(N),d=!1,s=N.clientX,c=N.clientY,T("start",N))}}function f(N){if(eo(N),!d){var V=N.clientX-s,T=N.clientY-c;d=V*V+T*T>u}a.mouse("drag",N)}function b(N){It(N.view).on("mousemove.drag mouseup.drag",null),wd(N.view,d),eo(N),a.mouse("end",N)}function h(N,V){if(e.call(this,N,V)){var T=N.changedTouches,I=n.call(this,N,V),z=T.length,w,x;for(w=0;w<z;++w)(x=g(this,I,N,V,T[w].identifier,T[w]))&&(Mr(N),x("start",N,T[w]))}}function _(N){var V=N.changedTouches,T=V.length,I,z;for(I=0;I<T;++I)(z=a[V[I].identifier])&&(eo(N),z("drag",N,V[I]))}function E(N){var V=N.changedTouches,T=V.length,I,z;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),I=0;I<T;++I)(z=a[V[I].identifier])&&(Mr(N),z("end",N,V[I]))}function g(N,V,T,I,z,w){var x=r.copy(),F=Dt(w||T,V),C,se,k;if((k=o.call(N,new Br("beforestart",{sourceEvent:T,target:p,identifier:z,active:l,x:F[0],y:F[1],dx:0,dy:0,dispatch:x}),I))!=null)return C=k.x-F[0]||0,se=k.y-F[1]||0,function G(S,H,Q){var ie=F,oe;switch(S){case"start":a[z]=G,oe=l++;break;case"end":delete a[z],--l;case"drag":F=Dt(Q||H,V),oe=l;break}x.call(S,N,new Br(S,{sourceEvent:H,subject:k,target:p,identifier:z,active:oe,x:F[0]+C,y:F[1]+se,dx:F[0]-ie[0],dy:F[1]-ie[1],dispatch:x}),I)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Hi(!!N),p):e},p.container=function(N){return arguments.length?(n=typeof N=="function"?N:Hi(N),p):n},p.subject=function(N){return arguments.length?(o=typeof N=="function"?N:Hi(N),p):o},p.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:Hi(!!N),p):i},p.on=function(){var N=r.on.apply(r,arguments);return N===r?p:N},p.clickDistance=function(N){return arguments.length?(u=(N=+N)*N,p):Math.sqrt(u)},p}function Dr(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function vd(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Do(){}var Oo=.7,ji=1/Oo,to="\\s*([+-]?\\d+)\\s*",Lo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ot="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Hb=/^#([0-9a-f]{3,8})$/,jb=new RegExp(`^rgb\\(${to},${to},${to}\\)$`),Gb=new RegExp(`^rgb\\(${Ot},${Ot},${Ot}\\)$`),Kb=new RegExp(`^rgba\\(${to},${to},${to},${Lo}\\)$`),Yb=new RegExp(`^rgba\\(${Ot},${Ot},${Ot},${Lo}\\)$`),qb=new RegExp(`^hsl\\(${Lo},${Ot},${Ot}\\)$`),Wb=new RegExp(`^hsla\\(${Lo},${Ot},${Ot},${Lo}\\)$`),Id={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};Dr(Do,Nn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:xd,formatHex:xd,formatHex8:Xb,formatHsl:Jb,formatRgb:Cd,toString:Cd});function xd(){return this.rgb().formatHex()}function Xb(){return this.rgb().formatHex8()}function Jb(){return Td(this).formatHsl()}function Cd(){return this.rgb().formatRgb()}function Nn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Hb.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Sd(n):o===3?new yt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Gi(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Gi(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=jb.exec(e))?new yt(n[1],n[2],n[3],1):(n=Gb.exec(e))?new yt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Kb.exec(e))?Gi(n[1],n[2],n[3],n[4]):(n=Yb.exec(e))?Gi(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=qb.exec(e))?Ad(n[1],n[2]/100,n[3]/100,1):(n=Wb.exec(e))?Ad(n[1],n[2]/100,n[3]/100,n[4]):Id.hasOwnProperty(e)?Sd(Id[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function Sd(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function Gi(e,n,o,i){return i<=0&&(e=n=o=NaN),new yt(e,n,o,i)}function Zb(e){return e instanceof Do||(e=Nn(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function Or(e,n,o,i){return arguments.length===1?Zb(e):new yt(e,n,o,i??1)}function yt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Dr(yt,Or,vd(Do,{brighter(e){return e=e==null?ji:Math.pow(ji,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(wn(this.r),wn(this.g),wn(this.b),Ki(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:$d,formatHex:$d,formatHex8:Qb,formatRgb:Rd,toString:Rd}));function $d(){return`#${vn(this.r)}${vn(this.g)}${vn(this.b)}`}function Qb(){return`#${vn(this.r)}${vn(this.g)}${vn(this.b)}${vn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rd(){const e=Ki(this.opacity);return`${e===1?"rgb(":"rgba("}${wn(this.r)}, ${wn(this.g)}, ${wn(this.b)}${e===1?")":`, ${e})`}`}function Ki(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vn(e){return e=wn(e),(e<16?"0":"")+e.toString(16)}function Ad(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new xt(e,n,o,i)}function Td(e){if(e instanceof xt)return new xt(e.h,e.s,e.l,e.opacity);if(e instanceof Do||(e=Nn(e)),!e)return new xt;if(e instanceof xt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new xt(l,s,c,e.opacity)}function e_(e,n,o,i){return arguments.length===1?Td(e):new xt(e,n,o,i??1)}function xt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Dr(xt,e_,vd(Do,{brighter(e){return e=e==null?ji:Math.pow(ji,e),new xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new xt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new yt(Lr(e>=240?e-240:e+120,a,i),Lr(e,a,i),Lr(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new xt(Vd(this.h),Yi(this.s),Yi(this.l),Ki(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=Ki(this.opacity);return`${e===1?"hsl(":"hsla("}${Vd(this.h)}, ${Yi(this.s)*100}%, ${Yi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vd(e){return e=(e||0)%360,e<0?e+360:e}function Yi(e){return Math.max(0,Math.min(1,e||0))}function Lr(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const Pr=e=>()=>e;function t_(e,n){return function(o){return e+o*n}}function n_(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function o_(e){return(e=+e)==1?Md:function(n,o){return o-n?n_(n,o,e):Pr(isNaN(n)?o:n)}}function Md(e,n){var o=n-e;return o?t_(e,o):Pr(isNaN(e)?n:e)}const qi=(function e(n){var o=o_(n);function i(a,r){var l=o((a=Or(a)).r,(r=Or(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Md(a.opacity,r.opacity);return function(m){return a.r=l(m),a.g=s(m),a.b=c(m),a.opacity=d(m),a+""}}return i.gamma=e,i})(1);function i_(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function a_(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function r_(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=Po(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function l_(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Lt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function s_(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=Po(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var zr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ur=new RegExp(zr.source,"g");function c_(e){return function(){return e}}function d_(e){return function(n){return e(n)+""}}function Bd(e,n){var o=zr.lastIndex=Ur.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=zr.exec(e))&&(a=Ur.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Lt(i,a)})),o=Ur.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?d_(c[0].x):c_(n):(n=c.length,function(d){for(var m=0,u;m<n;++m)s[(u=c[m]).i]=u.x(d);return s.join("")})}function Po(e,n){var o=typeof n,i;return n==null||o==="boolean"?Pr(n):(o==="number"?Lt:o==="string"?(i=Nn(n))?(n=i,qi):Bd:n instanceof Nn?qi:n instanceof Date?l_:a_(n)?i_:Array.isArray(n)?r_:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?s_:Lt)(e,n)}var Dd=180/Math.PI,Fr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Od(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Dd,skewX:Math.atan(c)*Dd,scaleX:l,scaleY:s}}var Wi;function u_(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Fr:Od(n.a,n.b,n.c,n.d,n.e,n.f)}function m_(e){return e==null||(Wi||(Wi=document.createElementNS("http://www.w3.org/2000/svg","g")),Wi.setAttribute("transform",e),!(e=Wi.transform.baseVal.consolidate()))?Fr:(e=e.matrix,Od(e.a,e.b,e.c,e.d,e.e,e.f))}function Ld(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,m,u,p,y,f){if(d!==u||m!==p){var b=y.push("translate(",null,n,null,o);f.push({i:b-4,x:Lt(d,u)},{i:b-2,x:Lt(m,p)})}else(u||p)&&y.push("translate("+u+n+p+o)}function l(d,m,u,p){d!==m?(d-m>180?m+=360:m-d>180&&(d+=360),p.push({i:u.push(a(u)+"rotate(",null,i)-2,x:Lt(d,m)})):m&&u.push(a(u)+"rotate("+m+i)}function s(d,m,u,p){d!==m?p.push({i:u.push(a(u)+"skewX(",null,i)-2,x:Lt(d,m)}):m&&u.push(a(u)+"skewX("+m+i)}function c(d,m,u,p,y,f){if(d!==u||m!==p){var b=y.push(a(y)+"scale(",null,",",null,")");f.push({i:b-4,x:Lt(d,u)},{i:b-2,x:Lt(m,p)})}else(u!==1||p!==1)&&y.push(a(y)+"scale("+u+","+p+")")}return function(d,m){var u=[],p=[];return d=e(d),m=e(m),r(d.translateX,d.translateY,m.translateX,m.translateY,u,p),l(d.rotate,m.rotate,u,p),s(d.skewX,m.skewX,u,p),c(d.scaleX,d.scaleY,m.scaleX,m.scaleY,u,p),d=m=null,function(y){for(var f=-1,b=p.length,h;++f<b;)u[(h=p[f]).i]=h.x(y);return u.join("")}}}var f_=Ld(u_,"px, ","px)","deg)"),p_=Ld(m_,", ",")",")"),h_=1e-12;function Pd(e){return((e=Math.exp(e))+1/e)/2}function y_(e){return((e=Math.exp(e))-1/e)/2}function g_(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xi=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],m=l[0],u=l[1],p=l[2],y=m-s,f=u-c,b=y*y+f*f,h,_;if(b<h_)_=Math.log(p/d)/n,h=function(I){return[s+I*y,c+I*f,d*Math.exp(n*I*_)]};else{var E=Math.sqrt(b),g=(p*p-d*d+i*b)/(2*d*o*E),N=(p*p-d*d-i*b)/(2*p*o*E),V=Math.log(Math.sqrt(g*g+1)-g),T=Math.log(Math.sqrt(N*N+1)-N);_=(T-V)/n,h=function(I){var z=I*_,w=Pd(V),x=d/(o*E)*(w*g_(n*z+V)-y_(V));return[s+x*y,c+x*f,d*w/Pd(n*z+V)]}}return h.duration=_*1e3*n/Math.SQRT2,h}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var no=0,zo=0,Uo=0,zd=1e3,Ji,Fo,Zi=0,In=0,Qi=0,Ho=typeof performance=="object"&&performance.now?performance:Date,Ud=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Hr(){return In||(Ud(b_),In=Ho.now()+Qi)}function b_(){In=0}function ea(){this._call=this._time=this._next=null}ea.prototype=Fd.prototype={constructor:ea,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Hr():+o)+(n==null?0:+n),!this._next&&Fo!==this&&(Fo?Fo._next=this:Ji=this,Fo=this),this._call=e,this._time=o,jr()},stop:function(){this._call&&(this._call=null,this._time=1/0,jr())}};function Fd(e,n,o){var i=new ea;return i.restart(e,n,o),i}function __(){Hr(),++no;for(var e=Ji,n;e;)(n=In-e._time)>=0&&e._call.call(void 0,n),e=e._next;--no}function Hd(){In=(Zi=Ho.now())+Qi,no=zo=0;try{__()}finally{no=0,E_(),In=0}}function k_(){var e=Ho.now(),n=e-Zi;n>zd&&(Qi-=n,Zi=e)}function E_(){for(var e,n=Ji,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ji=o);Fo=e,jr(i)}function jr(e){if(!no){zo&&(zo=clearTimeout(zo));var n=e-In;n>24?(e<1/0&&(zo=setTimeout(Hd,e-Ho.now()-Qi)),Uo&&(Uo=clearInterval(Uo))):(Uo||(Zi=Ho.now(),Uo=setInterval(k_,zd)),no=1,Ud(Hd))}}function jd(e,n,o){var i=new ea;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var N_=Pi("start","end","cancel","interrupt"),w_=[],Gd=0,Kd=1,Gr=2,ta=3,Yd=4,Kr=5,na=6;function oa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;v_(e,o,{name:n,index:i,group:a,on:N_,tween:w_,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Gd})}function Yr(e,n){var o=Ct(e,n);if(o.state>Gd)throw new Error("too late; already scheduled");return o}function Pt(e,n){var o=Ct(e,n);if(o.state>ta)throw new Error("too late; already running");return o}function Ct(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function v_(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Fd(r,0,o.time);function r(d){o.state=Kd,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var m,u,p,y;if(o.state!==Kd)return c();for(m in i)if(y=i[m],y.name===o.name){if(y.state===ta)return jd(l);y.state===Yd?(y.state=na,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete i[m]):+m<n&&(y.state=na,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete i[m])}if(jd(function(){o.state===ta&&(o.state=Yd,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Gr,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Gr){for(o.state=ta,a=new Array(p=o.tween.length),m=0,u=-1;m<p;++m)(y=o.tween[m].value.call(e,e.__data__,o.index,o.group))&&(a[++u]=y);a.length=u+1}}function s(d){for(var m=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Kr,1),u=-1,p=a.length;++u<p;)a[u].call(e,m);o.state===Kr&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=na,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function ia(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Gr&&i.state<Kr,i.state=na,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function I_(e){return this.each(function(){ia(this,e)})}function x_(e,n){var o,i;return function(){var a=Pt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function C_(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Pt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function S_(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Ct(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?x_:C_)(o,e,n))}function qr(e,n,o){var i=e._id;return e.each(function(){var a=Pt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Ct(a,i).value[n]}}function qd(e,n){var o;return(typeof n=="number"?Lt:n instanceof Nn?qi:(o=Nn(n))?(n=o,qi):Bd)(e,n)}function $_(e){return function(){this.removeAttribute(e)}}function R_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function A_(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function T_(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function V_(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function M_(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function B_(e,n){var o=Ui(e),i=o==="transform"?p_:qd;return this.attrTween(e,typeof n=="function"?(o.local?M_:V_)(o,i,qr(this,"attr."+e,n)):n==null?(o.local?R_:$_)(o):(o.local?T_:A_)(o,i,n))}function D_(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function O_(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function L_(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&O_(e,r)),o}return a._value=n,a}function P_(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&D_(e,r)),o}return a._value=n,a}function z_(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=Ui(e);return this.tween(o,(i.local?L_:P_)(i,n))}function U_(e,n){return function(){Yr(this,e).delay=+n.apply(this,arguments)}}function F_(e,n){return n=+n,function(){Yr(this,e).delay=n}}function H_(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?U_:F_)(n,e)):Ct(this.node(),n).delay}function j_(e,n){return function(){Pt(this,e).duration=+n.apply(this,arguments)}}function G_(e,n){return n=+n,function(){Pt(this,e).duration=n}}function K_(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?j_:G_)(n,e)):Ct(this.node(),n).duration}function Y_(e,n){if(typeof n!="function")throw new Error;return function(){Pt(this,e).ease=n}}function q_(e){var n=this._id;return arguments.length?this.each(Y_(n,e)):Ct(this.node(),n).ease}function W_(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Pt(this,e).ease=o}}function X_(e){if(typeof e!="function")throw new Error;return this.each(W_(this._id,e))}function J_(e){typeof e!="function"&&(e=md(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Gt(i,this._parents,this._name,this._id)}function Z_(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],m=c.length,u=l[s]=new Array(m),p,y=0;y<m;++y)(p=c[y]||d[y])&&(u[y]=p);for(;s<i;++s)l[s]=n[s];return new Gt(l,this._parents,this._name,this._id)}function Q_(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function e1(e,n,o){var i,a,r=Q_(n)?Yr:Pt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function t1(e,n){var o=this._id;return arguments.length<2?Ct(this.node(),o).on.on(e):this.each(e1(o,e,n))}function n1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function o1(){return this.on("end.remove",n1(this._id))}function i1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Tr(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),m,u,p=0;p<c;++p)(m=s[p])&&(u=e.call(m,m.__data__,p,s))&&("__data__"in m&&(u.__data__=m.__data__),d[p]=u,oa(d[p],n,o,p,d,Ct(m,o)));return new Gt(r,this._parents,n,o)}function a1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ud(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,m,u=0;u<d;++u)if(m=c[u]){for(var p=e.call(m,m.__data__,u,c),y,f=Ct(m,o),b=0,h=p.length;b<h;++b)(y=p[b])&&oa(y,n,o,b,p,f);r.push(p),l.push(m)}return new Gt(r,l,n,o)}var r1=Mo.prototype.constructor;function l1(){return new r1(this._groups,this._parents)}function s1(e,n){var o,i,a;return function(){var r=Qn(this,e),l=(this.style.removeProperty(e),Qn(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Wd(e){return function(){this.style.removeProperty(e)}}function c1(e,n,o){var i,a=o+"",r;return function(){var l=Qn(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function d1(e,n,o){var i,a,r;return function(){var l=Qn(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Qn(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function u1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Pt(this,e),d=c.on,m=c.value[r]==null?s||(s=Wd(n)):void 0;(d!==o||a!==m)&&(i=(o=d).copy()).on(l,a=m),c.on=i}}function m1(e,n,o){var i=(e+="")=="transform"?f_:qd;return n==null?this.styleTween(e,s1(e,i)).on("end.style."+e,Wd(e)):typeof n=="function"?this.styleTween(e,d1(e,i,qr(this,"style."+e,n))).each(u1(this._id,e)):this.styleTween(e,c1(e,i,n),o).on("end.style."+e,null)}function f1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function p1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&f1(e,l,o)),i}return r._value=n,r}function h1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,p1(e,n,o??""))}function y1(e){return function(){this.textContent=e}}function g1(e){return function(){var n=e(this);this.textContent=n??""}}function b1(e){return this.tween("text",typeof e=="function"?g1(qr(this,"text",e)):y1(e==null?"":e+""))}function _1(e){return function(n){this.textContent=e.call(this,n)}}function k1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&_1(a)),n}return i._value=e,i}function E1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,k1(e))}function N1(){for(var e=this._name,n=this._id,o=Xd(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var m=Ct(c,n);oa(c,e,o,d,l,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Gt(i,this._parents,e,o)}function w1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Pt(this,i),m=d.on;m!==e&&(n=(e=m).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var v1=0;function Gt(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Xd(){return++v1}var Kt=Mo.prototype;Gt.prototype={constructor:Gt,select:i1,selectAll:a1,selectChild:Kt.selectChild,selectChildren:Kt.selectChildren,filter:J_,merge:Z_,selection:l1,transition:N1,call:Kt.call,nodes:Kt.nodes,node:Kt.node,size:Kt.size,empty:Kt.empty,each:Kt.each,on:t1,attr:B_,attrTween:z_,style:m1,styleTween:h1,text:b1,textTween:E1,remove:o1,tween:S_,delay:H_,duration:K_,ease:q_,easeVarying:X_,end:w1,[Symbol.iterator]:Kt[Symbol.iterator]};function I1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var x1={time:null,delay:0,duration:250,ease:I1};function C1(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function S1(e){var n,o;e instanceof Gt?(n=e._id,e=e._name):(n=Xd(),(o=x1).time=Hr(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&oa(c,e,n,d,l,o||C1(c,n));return new Gt(i,this._parents,e,n)}Mo.prototype.interrupt=I_,Mo.prototype.transition=S1;const aa=e=>()=>e;function $1(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Yt(e,n,o){this.k=e,this.x=n,this.y=o}Yt.prototype={constructor:Yt,scale:function(e){return e===1?this:new Yt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Yt(this.k,this.x+this.k*e,this.y+this.k*n)},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 oo=new Yt(1,0,0);Yt.prototype;function Wr(e){e.stopImmediatePropagation()}function jo(e){e.preventDefault(),e.stopImmediatePropagation()}function R1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function A1(){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 Jd(){return this.__zoom||oo}function T1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function V1(){return navigator.maxTouchPoints||"ontouchstart"in this}function M1(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function B1(){var e=R1,n=A1,o=M1,i=T1,a=V1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Xi,d=Pi("start","zoom","end"),m,u,p,y=500,f=150,b=0,h=10;function _(k){k.property("__zoom",Jd).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",se).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,G,S,H){var Q=k.selection?k.selection():k;Q.property("__zoom",Jd),k!==Q?V(k,G,S,H):Q.interrupt().each(function(){T(this,arguments).event(H).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},_.scaleBy=function(k,G,S,H){_.scaleTo(k,function(){var Q=this.__zoom.k,ie=typeof G=="function"?G.apply(this,arguments):G;return Q*ie},S,H)},_.scaleTo=function(k,G,S,H){_.transform(k,function(){var Q=n.apply(this,arguments),ie=this.__zoom,oe=S==null?N(Q):typeof S=="function"?S.apply(this,arguments):S,W=ie.invert(oe),fe=typeof G=="function"?G.apply(this,arguments):G;return o(g(E(ie,fe),oe,W),Q,l)},S,H)},_.translateBy=function(k,G,S,H){_.transform(k,function(){return o(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,H)},_.translateTo=function(k,G,S,H,Q){_.transform(k,function(){var ie=n.apply(this,arguments),oe=this.__zoom,W=H==null?N(ie):typeof H=="function"?H.apply(this,arguments):H;return o(oo.translate(W[0],W[1]).scale(oe.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},H,Q)};function E(k,G){return G=Math.max(r[0],Math.min(r[1],G)),G===k.k?k:new Yt(G,k.x,k.y)}function g(k,G,S){var H=G[0]-S[0]*k.k,Q=G[1]-S[1]*k.k;return H===k.x&&Q===k.y?k:new Yt(k.k,H,Q)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function V(k,G,S,H){k.on("start.zoom",function(){T(this,arguments).event(H).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(H).end()}).tween("zoom",function(){var Q=this,ie=arguments,oe=T(Q,ie).event(H),W=n.apply(Q,ie),fe=S==null?N(W):typeof S=="function"?S.apply(Q,ie):S,ge=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),$e=Q.__zoom,pe=typeof G=="function"?G.apply(Q,ie):G,Ne=c($e.invert(fe).concat(ge/$e.k),pe.invert(fe).concat(ge/pe.k));return function(ve){if(ve===1)ve=pe;else{var Te=Ne(ve),re=ge/Te[2];ve=new Yt(re,fe[0]-Te[0]*re,fe[1]-Te[1]*re)}oe.zoom(null,ve)}})}function T(k,G,S){return!S&&k.__zooming||new I(k,G)}function I(k,G){this.that=k,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,G),this.taps=0}I.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,G){return this.mouse&&k!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var G=It(this.that).datum();d.call(k,this.that,new $1(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),G)}};function z(k,...G){if(!e.apply(this,arguments))return;var S=T(this,G).event(k),H=this.__zoom,Q=Math.max(r[0],Math.min(r[1],H.k*Math.pow(2,i.apply(this,arguments)))),ie=Dt(k);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=H.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(H.k===Q)return;S.mouse=[ie,H.invert(ie)],ia(this),S.start()}jo(k),S.wheel=setTimeout(oe,f),S.zoom("mouse",o(g(E(H,Q),S.mouse[0],S.mouse[1]),S.extent,l));function oe(){S.wheel=null,S.end()}}function w(k,...G){if(p||!e.apply(this,arguments))return;var S=k.currentTarget,H=T(this,G,!0).event(k),Q=It(k.view).on("mousemove.zoom",fe,!0).on("mouseup.zoom",ge,!0),ie=Dt(k,S),oe=k.clientX,W=k.clientY;Nd(k.view),Wr(k),H.mouse=[ie,this.__zoom.invert(ie)],ia(this),H.start();function fe($e){if(jo($e),!H.moved){var pe=$e.clientX-oe,Ne=$e.clientY-W;H.moved=pe*pe+Ne*Ne>b}H.event($e).zoom("mouse",o(g(H.that.__zoom,H.mouse[0]=Dt($e,S),H.mouse[1]),H.extent,l))}function ge($e){Q.on("mousemove.zoom mouseup.zoom",null),wd($e.view,H.moved),jo($e),H.event($e).end()}}function x(k,...G){if(e.apply(this,arguments)){var S=this.__zoom,H=Dt(k.changedTouches?k.changedTouches[0]:k,this),Q=S.invert(H),ie=S.k*(k.shiftKey?.5:2),oe=o(g(E(S,ie),H,Q),n.apply(this,G),l);jo(k),s>0?It(this).transition().duration(s).call(V,oe,H,k):It(this).call(_.transform,oe,H,k)}}function F(k,...G){if(e.apply(this,arguments)){var S=k.touches,H=S.length,Q=T(this,G,k.changedTouches.length===H).event(k),ie,oe,W,fe;for(Wr(k),oe=0;oe<H;++oe)W=S[oe],fe=Dt(W,this),fe=[fe,this.__zoom.invert(fe),W.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==fe[2]&&(Q.touch1=fe,Q.taps=0):(Q.touch0=fe,ie=!0,Q.taps=1+!!m);m&&(m=clearTimeout(m)),ie&&(Q.taps<2&&(u=fe[0],m=setTimeout(function(){m=null},y)),ia(this),Q.start())}}function C(k,...G){if(this.__zooming){var S=T(this,G).event(k),H=k.changedTouches,Q=H.length,ie,oe,W,fe;for(jo(k),ie=0;ie<Q;++ie)oe=H[ie],W=Dt(oe,this),S.touch0&&S.touch0[2]===oe.identifier?S.touch0[0]=W:S.touch1&&S.touch1[2]===oe.identifier&&(S.touch1[0]=W);if(oe=S.that.__zoom,S.touch1){var ge=S.touch0[0],$e=S.touch0[1],pe=S.touch1[0],Ne=S.touch1[1],ve=(ve=pe[0]-ge[0])*ve+(ve=pe[1]-ge[1])*ve,Te=(Te=Ne[0]-$e[0])*Te+(Te=Ne[1]-$e[1])*Te;oe=E(oe,Math.sqrt(ve/Te)),W=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2],fe=[($e[0]+Ne[0])/2,($e[1]+Ne[1])/2]}else if(S.touch0)W=S.touch0[0],fe=S.touch0[1];else return;S.zoom("touch",o(g(oe,W,fe),S.extent,l))}}function se(k,...G){if(this.__zooming){var S=T(this,G).event(k),H=k.changedTouches,Q=H.length,ie,oe;for(Wr(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},y),ie=0;ie<Q;++ie)oe=H[ie],S.touch0&&S.touch0[2]===oe.identifier?delete S.touch0:S.touch1&&S.touch1[2]===oe.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(oe=Dt(oe,this),Math.hypot(u[0]-oe[0],u[1]-oe[1])<h)){var W=It(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:aa(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:aa(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:aa(!!k),_):a},_.extent=function(k){return arguments.length?(n=typeof k=="function"?k:aa([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):n},_.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],_):[r[0],r[1]]},_.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(b=(k=+k)*k,_):Math.sqrt(b)},_.tapDistance=function(k){return arguments.length?(h=+k,_):h},_}var Be=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Be||{}),Xr=(e=>(e.Partial="partial",e.Full="full",e))(Xr||{}),xn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(xn||{}),qt=(e=>(e.Strict="strict",e.Loose="loose",e))(qt||{}),Jr=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Jr||{}),Go=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Go||{}),Zd=(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))(Zd||{});const D1=["INPUT","SELECT","TEXTAREA"],O1=typeof document<"u"?document:null;function Zr(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return D1.includes(i==null?void 0:i.nodeName)||a||!!r}function L1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Qd(e,n,o,i){const a=n.replace("+",`
24
24
  `).replace(`
25
25
 
26
26
  `,`
27
27
  +`).split(`
28
- `).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===t.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function s1(e,t){return o=>{if(!o.code&&!o.key)return!1;const i=c1(o.code,e);return Array.isArray(e)?e.some(a=>Bd(o[i],a,t,o.type==="keyup")):Bd(o[i],e,t,o.type==="keyup")}}function c1(e,t){return t.includes(e)?"code":"key"}function Fo(e,t){const o=n.computed(()=>n.toValue(t==null?void 0:t.target)??r1),i=n.shallowRef(n.toValue(e)===!0);let a=!1;const r=new Set;let l=c(n.toValue(e));n.watch(()=>n.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Fc(["blur","contextmenu"],s),Hc((...d)=>l(...d),d=>{var u,m;const f=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0,p=n.toValue(t==null?void 0:t.preventDefault)??!1;if(a=l1(d),(!a||a&&!f)&&zr(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!p&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Hc((...d)=>l(...d),d=>{const u=n.toValue(t==null?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&zr(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.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"?s1(d,r):d}return i}const Dd="vue-flow__node-desc",Od="vue-flow__edge-desc",d1="vue-flow__aria-live",Ld=["Enter"," ","Escape"],to={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Qi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function ea(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 ta(e){return{width:e.offsetWidth,height:e.offsetHeight}}function wn(e,t=0,o=1){return Math.min(Math.max(e,t),o)}function Pd(e,t){return{x:wn(e.x,t[0][0],t[1][0]),y:wn(e.y,t[0][1],t[1][1])}}function zd(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function nn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function vn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!nn(e)}function Ho(e){return vn(e)&&"computedPosition"in e}function na(e){return!Number.isNaN(e)&&Number.isFinite(e)}function u1(e){return na(e.width)&&na(e.height)&&na(e.x)&&na(e.y)}function m1(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:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{})};return Object.assign(t??i,e,{id:e.id.toString(),parentNode:o})}function Ud(e,t,o){var i,a;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:tt(e.data)?e.data:{},events:n.markRaw(tt(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Fd(e,t,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return t.filter(s=>r.has(s.id))}function f1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"target")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.source===i).map(r=>o.find(l=>vn(l)&&l.id===r.target))}function p1(...e){if(e.length===3){const[r,l,s]=e;return Fd(r,l,s,"source")}const[t,o]=e,i=typeof t=="string"?t:t.id;return o.filter(r=>nn(r)&&r.target===i).map(r=>o.find(l=>vn(l)&&l.id===r.source))}function Hd({source:e,sourceHandle:t,target:o,targetHandle:i}){return`vueflow__edge-${e}${t??""}-${o}${i??""}`}function h1(e,t){return t.some(o=>nn(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 Go({x:e,y:t},{x:o,y:i,zoom:a}){return{x:e*a+o,y:t*a+i}}function jo({x:e,y:t},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(t-i)/a};return r?ia(s,l):s}function Gd(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 oa({x:e,y:t,width:o,height:i}){return{x:e,y:t,x2:e+o,y2:t+i}}function jd({x:e,y:t,x2:o,y2:i}){return{x:e,y:t,width:o-e,height:i-t}}function y1(e,t){return jd(Gd(oa(e),oa(t)))}function Ur(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=Gd(t,oa({...i.computedPosition,...i.dimensions}))}return jd(t)}function Kd(e,t,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...jo(t,o),width:t.width/o.zoom,height:t.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,f=c.height??s.height??null;if(a&&!d||u)continue;const p=ea(r,Qi(s)),y=m===null||f===null,g=i&&p>0,_=(m??0)*(f??0);(y||g||p>=_||s.dragging)&&l.push(s)}return l}function xn(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 no(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 Wo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function g1(e,t,o){if(typeof e=="string"||typeof e=="number"){const i=no(e,o),a=no(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=no(e.top??e.y??0,o),a=no(e.bottom??e.y??0,o),r=no(e.left??e.x??0,t),l=no(e.right??e.x??0,t);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function b1(e,t,o,i,a,r){const{x:l,y:s}=Go(e,{x:t,y:o,zoom:i}),{x:c,y:d}=Go({x:e.x+e.width,y:e.y+e.height},{x:t,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Yd(e,t,o,i,a,r=.1){const l=g1(r,t,o),s=(t-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=wn(d,i,a),m=e.x+e.width/2,f=e.y+e.height/2,p=t/2-m*u,y=o/2-f*u,g=b1(e,p,y,u,t,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:p-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function _1(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Wd(e,t){if(!e.parentNode)return!1;const o=t.get(e.parentNode);return o?o.selected?!0:Wd(o,t):!1}function Ko(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function Fr(e){const t=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function qd(e,t,o){return e<t?wn(Math.abs(e-t),1,t)/t:e>o?-wn(Math.abs(e-o),1,t)/t:0}function Xd(e,t,o=15,i=40){const a=qd(e.x,i,t.width-i)*o,r=qd(e.y,i,t.height-i)*o;return[a,r]}function Hr(e,t){if(t){const o=e.position.x+e.dimensions.width-t.dimensions.width,i=e.position.y+e.dimensions.height-t.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof t.style=="function"?a={...t.style(t)}:t.style&&(a={...t.style}),a.width=a.width??`${t.dimensions.width}px`,a.height=a.height??`${t.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}t.dimensions.width=Number(a.width.toString().replace("px","")),t.dimensions.height=Number(a.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...a}}:t.style={...t.style,...a}}}}function Jd(e,t){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")t.findIndex(c=>c.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(c=>c.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(Ho(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=t[r.indexOf(l.parentNode)];c&&Ho(c)&&Hr(l,c)}break;case"dimensions":if(Ho(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.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"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=t[r.indexOf(l.parentNode)];c&&Ho(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Hr(l,c):n.nextTick(()=>{Hr(l,c)}))}break}return t}function on(e,t){return{id:e,type:"select",selected:t}}function Zd(e){return{item:e,type:"add"}}function Qd(e){return{id:e,type:"remove"}}function eu(e,t,o,i,a){return{id:e,source:t,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function an(e,t=new Set,o=!1){const i=[];for(const[a,r]of e){const l=t.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(on(r.id,l)))}return i}const tu=()=>{};function Se(e){const t=new Set;let o=tu,i=()=>!1;const a=()=>t.size>0||i(),r=f=>{o=f},l=()=>{o=tu},s=f=>{i=f},c=()=>{i=()=>!1},d=f=>{t.delete(f)};return{on:f=>{t.add(f);const p=()=>d(f);return $o(p),{off:p}},off:d,trigger:f=>{const p=[o];return a()?p.push(...t):e&&p.push(e),Promise.allSettled(p.map(y=>y(f)))},hasListeners:a,listeners:t,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function nu(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 k1(e,t,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Wd(c,e))&&(c.draggable||t&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.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(l.values())}function Gr({id:e,dragItems:t,findNode:o}){const i=[];for(const a of t){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function ou(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 E1(e,t,o){const[i,a,r,l]=typeof e!="string"?ou(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+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function N1(e,t,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=E1(a,e,i);r&&(a=r)}else t(new it(et.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=ou(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function w1({width:e,height:t},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(t||0)]]}function jr(e,t,o,i,a){const r=w1(e.dimensions,N1(e,o,i,a)),l=Pd(t,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function oo(e,t,o=Re.Left,i=!1){const a=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:l,height:s}=t??C1(e);if(i)return{x:a+l/2,y:r+s/2};switch((t==null?void 0:t.position)??o){case Re.Top:return{x:a+l/2,y:r};case Re.Right:return{x:a+l,y:r+s/2};case Re.Bottom:return{x:a+l/2,y:r+s};case Re.Left:return{x:a,y:r+s/2}}}function iu(e,t){return e&&(t?e.find(o=>o.id===t):e[0])||null}function v1({sourcePos:e,targetPos:t,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+o,t.x+a),y2:Math.max(e.y+i,t.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=oa({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),f=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*f)>0}function x1(e,t,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var et=(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))(et||{});const au={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
28
+ `).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function P1(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=z1(o.code,e);return Array.isArray(e)?e.some(a=>Qd(o[i],a,n,o.type==="keyup")):Qd(o[i],e,n,o.type==="keyup")}}function z1(e,n){return n.includes(e)?"code":"key"}function Ko(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??O1),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,m)=>{typeof m=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),rd(["blur","contextmenu"],s),ld((...d)=>l(...d),d=>{var m,u;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,y=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=L1(d),(!a||a&&!p)&&Zr(d))return;const b=((u=(m=d.composedPath)==null?void 0:m.call(d))==null?void 0:u[0])||d.target,h=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!y&&(a||!h)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ld((...d)=>l(...d),d=>{const m=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!m)&&Zr(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.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"?P1(d,r):d}return i}const eu="vue-flow__node-desc",tu="vue-flow__edge-desc",U1="vue-flow__aria-live",nu=["Enter"," ","Escape"],io={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function ra(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function la(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function sa(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Cn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function ou(e,n){return{x:Cn(e.x,n[0][0],n[1][0]),y:Cn(e.y,n[0][1],n[1][1])}}function iu(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function on(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Sn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!on(e)}function Yo(e){return Sn(e)&&"computedPosition"in e}function ca(e){return!Number.isNaN(e)&&Number.isFinite(e)}function F1(e){return ca(e.width)&&ca(e.height)&&ca(e.x)&&ca(e.y)}function H1(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.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:ot(e.data)?e.data:{},events:t.markRaw(ot(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function au(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ot(e.data)?e.data:{},events:t.markRaw(ot(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function ru(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function j1(...e){if(e.length===3){const[r,l,s]=e;return ru(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>on(r)&&r.source===i).map(r=>o.find(l=>Sn(l)&&l.id===r.target))}function G1(...e){if(e.length===3){const[r,l,s]=e;return ru(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>on(r)&&r.target===i).map(r=>o.find(l=>Sn(l)&&l.id===r.source))}function lu({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function K1(e,n){return n.some(o=>on(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 qo({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function Wo({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?ua(s,l):s}function su(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function da({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function cu({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function Y1(e,n){return cu(su(da(e),da(n)))}function Qr(e){let n={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];n=su(n,da({...i.computedPosition,...i.dimensions}))}return cu(n)}function du(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...Wo(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:m=!1}=s,u=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||m)continue;const y=la(r,ra(s)),f=u===null||p===null,b=i&&y>0,h=(u??0)*(p??0);(f||b||y>=h||s.dragging)&&l.push(s)}return l}function $n(e,n){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 n.filter(i=>o.has(i.source)||o.has(i.target))}function ao(e,n){if(typeof e=="number")return Math.floor((n-n/(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(n*o*.01)}return Zo(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function q1(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=ao(e,o),a=ao(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=ao(e.top??e.y??0,o),a=ao(e.bottom??e.y??0,o),r=ao(e.left??e.x??0,n),l=ao(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function W1(e,n,o,i,a,r){const{x:l,y:s}=qo(e,{x:n,y:o,zoom:i}),{x:c,y:d}=qo({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),m=a-c,u=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(m),bottom:Math.floor(u)}}function uu(e,n,o,i,a,r=.1){const l=q1(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),m=Cn(d,i,a),u=e.x+e.width/2,p=e.y+e.height/2,y=n/2-u*m,f=o/2-p*m,b=W1(e,y,f,m,n,o),h={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:y-h.left+h.right,y:f-h.top+h.bottom,zoom:m}}function X1(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function mu(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:mu(o,n):!1}function Xo(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function el(e){const n=e.ctrlKey&&Jo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function fu(e,n,o){return e<n?Cn(Math.abs(e-n),1,n)/n:e>o?-Cn(Math.abs(e-o),1,n)/n:0}function pu(e,n,o=15,i=40){const a=fu(e.x,i,n.width-i)*o,r=fu(e.y,i,n.height-i)*o;return[a,r]}function tl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function hu(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(Yo(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&Yo(c)&&tl(l,c)}break;case"dimensions":if(Yo(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.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"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&Yo(c)&&(!!c.dimensions.width&&!!c.dimensions.height?tl(l,c):t.nextTick(()=>{tl(l,c)}))}break}return n}function an(e,n){return{id:e,type:"select",selected:n}}function yu(e){return{item:e,type:"add"}}function gu(e){return{id:e,type:"remove"}}function bu(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function rn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(an(r.id,l)))}return i}const _u=()=>{};function Me(e){const n=new Set;let o=_u,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=_u},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const y=()=>d(p);return Vo(y),{off:y}},off:d,trigger:p=>{const y=[o];return a()?y.push(...n):e&&y.push(e),Promise.allSettled(y.map(f=>f(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function ku(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function J1(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!mu(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.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(l.values())}function nl({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Eu(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 Z1(e,n,o){const[i,a,r,l]=typeof e!="string"?Eu(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+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function Q1(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=Z1(a,e,i);r&&(a=r)}else n(new lt(nt.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Eu(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,m=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+m+r],[a.range[1][0]+d-l,a.range[1][1]+m-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function ek({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function ol(e,n,o,i,a){const r=ek(e.dimensions,Q1(e,o,i,a)),l=ou(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function ro(e,n,o=Be.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??ik(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case Be.Top:return{x:a+l/2,y:r};case Be.Right:return{x:a+l,y:r+s/2};case Be.Bottom:return{x:a+l/2,y:r+s};case Be.Left:return{x:a,y:r+s/2}}}function Nu(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function tk({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const m=da({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),u=Math.max(0,Math.min(m.x2,d.x2)-Math.max(m.x,d.x)),p=Math.max(0,Math.min(m.y2,d.y2)-Math.max(m.y,d.y));return Math.ceil(u*p)>0}function nk(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var nt=(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))(nt||{});const wu={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
29
29
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
30
- Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
30
+ Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
31
31
  Node: ${e}
32
- Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
32
+ Parent: ${n}`,NODE_TYPE_MISSING:e=>`Node type is missing
33
33
  Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
34
34
  Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
35
- Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
35
+ Edge: ${e}`,EDGE_SOURCE_MISSING:(e,n)=>`Edge source is missing
36
36
  Edge: ${e}
37
- Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
37
+ Source: ${n}`,EDGE_TARGET_MISSING:(e,n)=>`Edge target is missing
38
38
  Edge: ${e}
39
- Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
40
- Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,o)=>`Edge source and target are the same
39
+ Target: ${n}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
40
+ Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,n,o)=>`Edge source and target are the same
41
41
  Edge: ${e}
42
- Source: ${t}
43
- Target: ${o}`,EDGE_SOURCE_TARGET_MISSING:(e,t,o)=>`Edge source or target is missing
42
+ Source: ${n}
43
+ Target: ${o}`,EDGE_SOURCE_TARGET_MISSING:(e,n,o)=>`Edge source or target is missing
44
44
  Edge: ${e}
45
- Source: ${t}
45
+ Source: ${n}
46
46
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
47
47
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
48
- 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 it extends Error{constructor(t,...o){var i;super((i=au[t])==null?void 0:i.call(au,...o)),this.name="VueFlowError",this.code=t,this.args=o}}function Kr(e){return"clientX"in e}function I1(e){return"sourceEvent"in e}function Ot(e,t){const o=Kr(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const Yo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function C1(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 ia(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const S1=()=>!0;function Yr(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function $1(e,t,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of t.values())ea(a,Qi(r))>0&&i.push(r);return i}const R1=250;function A1(e,t,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=$1(e,o,t+R1);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:f,y:p}=oo(d,m,m.position,!0),y=Math.sqrt((f-e.x)**2+(p-e.y)**2);y>t||(y<s?(l=[{...m,x:f,y:p}],s=y):y===s&&l.push({...m,x:f,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function ru(e,{handle:t,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=S1},u,m,f,p){const y=r==="target",g=t?l.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:_,y:b}=Ot(e),N=l.elementFromPoint(_,b),h=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,k={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const P=lu(void 0,h),A=h.getAttribute("data-nodeid"),G=h.getAttribute("data-handleid"),K=h.classList.contains("connectable"),v=h.classList.contains("connectableend");if(!A||!P)return k;const T={source:y?A:i,sourceHandle:y?G:a,target:y?i:A,targetHandle:y?a:G};k.connection=T;const C=K&&v&&(o===Kt.Strict?y&&P==="source"||!y&&P==="target":A!==i||G!==a);k.isValid=C&&d(T,{nodes:m,edges:u,sourceNode:f(T.source),targetNode:f(T.target)}),k.toHandle=su(A,P,G,p,o,!0)}return k}function lu(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function T1(e,t){let o=null;return t?o="valid":e&&!t&&(o="invalid"),o}function V1(e,t){let o=null;return t?o=!0:e&&!t&&(o=!1),o}function su(e,t,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Kt.Strict?(l=d.handleBounds)==null?void 0:l[t]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(f=>f.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...oo(d,m,m.position,!0)}:m}const Wr={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top},M1=["production","prod"];function Wo(e,...t){cu()&&console.warn(`[Vue Flow]: ${e}`,...t)}function cu(){return!M1.includes(process.env.NODE_ENV||"")}function du(e,t,o,i,a){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...ta(l)}}):null}function qr(e,t,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&t)&&(i([e]),n.nextTick(()=>{l.blur()})):o([e])}function tt(e){return typeof n.unref(e)<"u"}function B1(e,t,o,i){if(!e||!e.source||!e.target)return o(new it(et.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return nn(e)?a=e:a={...e,id:Hd(e)},a=Ud(a,void 0,i),h1(a,t)?!1:a}function D1(e,t,o,i,a){if(!t.source||!t.target)return a(new it(et.EDGE_INVALID,e.id)),!1;if(!o)return a(new it(et.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Hd(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function uu(e,t,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!vn(l)){o(new it(et.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=m1(l,t(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=t(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new it(et.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function mu(e,t,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,t)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,t)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,t))}}function Xr(e,t,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;mu("source",c,u,e,a,l),mu("target",c,d,e,r,s)}}function fu(e,t){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}function Jr(e,t,o,i,a,r,l,s){const c=[];for(const d of e){const u=nn(d)?d:B1(d,s,a,r);if(!u)continue;const m=o(u.source),f=o(u.target);if(!m||!f){a(new it(et.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new it(et.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){a(new it(et.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:s,nodes:l,sourceNode:m,targetNode:f})){a(new it(et.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...Ud(u,p,r),sourceNode:m,targetNode:f})}return c}const pu=Symbol("vueFlow"),hu=Symbol("nodeId"),yu=Symbol("nodeRef"),O1=Symbol("edgeId"),L1=Symbol("edgeRef"),aa=Symbol("slots");function gu(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:f,findNode:p,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:b,addSelectedNodes:N,updateNodePositions:h,emits:k}=He(),{onStart:P,onDrag:A,onStop:G,onClick:K,el:v,disabled:T,id:H,selectable:C,dragHandle:ae}=e,E=n.shallowRef(!1);let Y=[],S,W=null,ee={x:void 0,y:void 0},ie={x:0,y:0},O=null,U=!1,ne=!1,ce=0,ge=!1;const se=U1(),pe=({x:ke,y:we})=>{ee={x:ke,y:we};let j=!1;if(Y=Y.map(L=>{const x={x:ke-L.distance.x,y:we-L.distance.y},{computedPosition:R}=jr(L,o.value?ia(x,i.value):x,k.error,l.value,L.parentNode?p(L.parentNode):void 0);return j=j||L.position.x!==R.x||L.position.y!==R.y,L.position=R,L}),ne=ne||j,!!j&&(h(Y,!0,!0),E.value=!0,O)){const[L,x]=Gr({id:H,dragItems:Y,findNode:p});A({event:O,node:L,nodes:x})}},be=()=>{if(!W)return;const[ke,we]=Xd(ie,W,u.value);if(ke!==0||we!==0){const j={x:(ee.x??0)-ke/c.value.zoom,y:(ee.y??0)-we/c.value.zoom};f({x:ke,y:we})&&pe(j)}ce=requestAnimationFrame(be)},xe=(ke,we)=>{U=!0;const j=p(H);!_.value&&!y.value&&j&&(j.selected||b()),j&&n.toValue(C)&&_.value&&qr(j,y.value,N,b,g,!1,we);const L=se(ke.sourceEvent);if(ee=L,Y=k1(r.value,m.value,L,H),Y.length){const[x,R]=Gr({id:H,dragItems:Y,findNode:p});P({event:ke.sourceEvent,node:x,nodes:R})}},Te=(ke,we)=>{var j;ke.sourceEvent.type==="touchmove"&&ke.sourceEvent.touches.length>1||(ne=!1,s.value===0&&xe(ke,we),ee=se(ke.sourceEvent),W=((j=t.value)==null?void 0:j.getBoundingClientRect())||null,ie=Ot(ke.sourceEvent,W))},Ae=(ke,we)=>{const j=se(ke.sourceEvent);if(!ge&&U&&d.value&&(ge=!0,be()),!U){const L=j.xSnapped-(ee.x??0),x=j.ySnapped-(ee.y??0);Math.sqrt(L*L+x*x)>s.value&&xe(ke,we)}(ee.x!==j.xSnapped||ee.y!==j.ySnapped)&&Y.length&&U&&(O=ke.sourceEvent,ie=Ot(ke.sourceEvent,W),pe(j))},fe=ke=>{let we=!1;if(!U&&!E.value&&!y.value){const j=ke.sourceEvent,L=se(j),x=L.xSnapped-(ee.x??0),R=L.ySnapped-(ee.y??0),V=Math.sqrt(x*x+R*R);V!==0&&V<=s.value&&(K==null||K(j),we=!0)}if(Y.length&&!we){ne&&(h(Y,!1,!1),ne=!1);const[j,L]=Gr({id:H,dragItems:Y,findNode:p});G({event:ke.sourceEvent,node:j,nodes:L})}Y=[],E.value=!1,ge=!1,U=!1,ee={x:void 0,y:void 0},cancelAnimationFrame(ce)};return n.watch([()=>n.toValue(T),v],([ke,we],j,L)=>{if(we){const x=vt(we);ke||(S=ub().on("start",R=>Te(R,we)).on("drag",R=>Ae(R,we)).on("end",R=>fe(R)).filter(R=>{const V=R.target,Q=n.toValue(ae);return!R.button&&(!a.value||!nu(V,`.${a.value}`,we)&&(!Q||nu(V,Q,we)))}),x.call(S)),L(()=>{x.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function P1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),updateStart:Se(),update:Se(),updateEnd:Se()}}function z1(e,t){const o=P1();return o.doubleClick.on(i=>{var a,r;t.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;t.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;t.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;t.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function U1(){const{viewport:e,snapGrid:t,snapToGrid:o,vueFlowRef:i}=He();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=I1(a)?a.sourceEvent:a,{x:c,y:d}=Ot(s,l),u=jo({x:c,y:d},e.value),{x:m,y:f}=o.value?ia(u,t.value):u;return{xSnapped:m,ySnapped:f,...u}}}function ra(){return!0}function bu({handleId:e,nodeId:t,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:f,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:b,startConnection:N,updateConnection:h,endConnection:k,emits:P,viewport:A,edges:G,nodes:K,isValidConnection:v,nodeLookup:T}=He();let H=null,C=!1,ae=null;function E(S){var W;const ee=n.toValue(o)==="target",ie=Kr(S),O=zd(S.target),U=S.currentTarget;if(U&&(ie&&S.button===0||!ie)){let ne=function(Ee){j=Ot(Ee,fe),pe=A1(jo(j,A.value,!1,[1,1]),u.value,T.value,R),L||(x(),L=!0);const $e=ru(Ee,{handle:pe,connectionMode:d.value,fromNodeId:n.toValue(t),fromHandleId:n.toValue(e),fromType:ee?"target":"source",isValidConnection:se,doc:O,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value);ae=$e.handleDomNode,H=$e.connection,C=V1(!!pe,$e.isValid);const Me={...ve,isValid:C,to:$e.toHandle&&C?Go({x:$e.toHandle.x,y:$e.toHandle.y},A.value):j,toHandle:$e.toHandle,toPosition:C&&$e.toHandle?$e.toHandle.position:Wr[R.position],toNode:$e.toHandle?T.value.get($e.toHandle.nodeId):null};if(C&&pe&&(ve!=null&&ve.toHandle)&&Me.toHandle&&ve.toHandle.type===Me.toHandle.type&&ve.toHandle.nodeId===Me.toHandle.nodeId&&ve.toHandle.id===Me.toHandle.id&&ve.to.x===Me.to.x&&ve.to.y===Me.to.y)return;const Ue=pe??$e.toHandle;if(h(Ue&&C?Go({x:Ue.x,y:Ue.y},A.value):j,Ue,T1(!!Ue,C)),ve=Me,!pe&&!C&&!ae)return Yr(we);H&&H.source!==H.target&&ae&&(Yr(we),we=ae,ae.classList.add("connecting","vue-flow__handle-connecting"),ae.classList.toggle("valid",!!C),ae.classList.toggle("vue-flow__handle-valid",!!C))},ce=function(Ee){"touches"in Ee&&Ee.touches.length>0||((pe||ae)&&H&&C&&(r?r(Ee,H):P.connect(H)),P.connectEnd(Ee),a&&(l==null||l(Ee)),Yr(we),cancelAnimationFrame(be),k(Ee),L=!1,C=!1,H=null,ae=null,O.removeEventListener("mousemove",ne),O.removeEventListener("mouseup",ce),O.removeEventListener("touchmove",ne),O.removeEventListener("touchend",ce))};const ge=_(n.toValue(t));let se=n.toValue(i)||v.value||ra;!se&&ge&&(se=(ee?ge.isValidSourcePos:ge.isValidTargetPos)||ra);let pe,be=0;const{x:xe,y:Te}=Ot(S),Ae=lu(n.toValue(a),U),fe=(W=c.value)==null?void 0:W.getBoundingClientRect();if(!fe||!Ae)return;const ke=su(n.toValue(t),Ae,n.toValue(e),T.value,d.value);if(!ke)return;let we,j=Ot(S,fe),L=!1;const x=()=>{if(!y.value)return;const[Ee,$e]=Xd(j,fe,g.value);b({x:Ee,y:$e}),be=requestAnimationFrame(x)},R={...ke,nodeId:n.toValue(t),type:Ae,position:ke.position},V=T.value.get(n.toValue(t)),me={inProgress:!0,isValid:null,from:oo(V,R,Re.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:V,to:j,toHandle:null,toPosition:Wr[R.position],toNode:null};N({nodeId:n.toValue(t),id:n.toValue(e),type:Ae,position:(U==null?void 0:U.getAttribute("data-handlepos"))||Re.Top,...j},{x:xe-fe.left,y:Te-fe.top}),P.connectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e),handleType:Ae});let ve=me;O.addEventListener("mousemove",ne),O.addEventListener("mouseup",ce),O.addEventListener("touchmove",ne),O.addEventListener("touchend",ce)}}function Y(S){var W,ee;if(!m.value)return;const ie=n.toValue(o)==="target";if(!f.value){P.clickConnectStart({event:S,nodeId:n.toValue(t),handleId:n.toValue(e)}),N({nodeId:n.toValue(t),type:n.toValue(o),id:n.toValue(e),position:Re.Top,...Ot(S)},void 0,!0);return}let O=n.toValue(i)||v.value||ra;const U=_(n.toValue(t));if(!O&&U&&(O=(ie?U.isValidSourcePos:U.isValidTargetPos)||ra),U&&(typeof U.connectable>"u"?p.value:U.connectable)===!1)return;const ne=zd(S.target),ce=ru(S,{handle:{nodeId:n.toValue(t),id:n.toValue(e),type:n.toValue(o),position:Re.Top,...Ot(S)},connectionMode:d.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:O,doc:ne,lib:"vue",flowId:s,nodeLookup:T.value},G.value,K.value,_,T.value),ge=((W=ce.connection)==null?void 0:W.source)===((ee=ce.connection)==null?void 0:ee.target);ce.isValid&&ce.connection&&!ge&&P.connect(ce.connection),P.clickConnectEnd(S),k(S,!0)}return{handlePointerDown:E,handleClick:Y}}function F1(){return n.inject(hu,"")}function _u(e){const t=e??F1()??"",o=n.inject(yu,n.ref(null)),{findNode:i,edges:a,emits:r}=He(),l=i(t);return l||r.error(new it(et.NODE_NOT_FOUND,t)),{id:t,nodeEl:o,node:l,parentNode:n.computed(()=>i(l.parentNode)),connectedEdges:n.computed(()=>xn([l],a.value))}}function H1(){return{doubleClick:Se(),click:Se(),mouseEnter:Se(),mouseMove:Se(),mouseLeave:Se(),contextMenu:Se(),dragStart:Se(),drag:Se(),dragStop:Se()}}function G1(e,t){const o=H1();return o.doubleClick.on(i=>{var a,r;t.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;t.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;t.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;t.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;t.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;t.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;t.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;t.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;t.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function ku(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=He();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,f=d?4:1,p=c.x*u*f,y=c.y*m*f,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const b={x:_.computedPosition.x+p,y:_.computedPosition.y+y},{position:N}=jr(_,b,s.error,t.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const la=.1,j1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function rn(){return Wo("Viewport not initialized yet."),Promise.resolve(!1)}const K1={zoomIn:rn,zoomOut:rn,zoomTo:rn,fitView:rn,setCenter:rn,fitBounds:rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:rn,setTransform:rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Y1(e){function t(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Bo:Hi).scaleBy(Zr(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=Pd({x:-i,y:-a},e.translateExtent),m=eo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Bo:Hi).transform(Zr(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return n.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>t(1.2,a),zoomOut:a=>t(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?Bo:Hi).scaleTo(Zr(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:la,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!f.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const c=Ur(s),{x:d,y:u,zoom:m}=Yd(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??la);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:la})=>{const{x:l,y:s,zoom:c}=Yd(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??la);return o(l,s,c,r)},project:a=>jo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return jo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return Go(s,e.viewport)}return{x:0,y:0}}}:K1)}function Zr(e,t=0,o=j1,i=()=>{}){const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(o).on("end",i):e}function W1(e,t,o){const i=n.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,b=!!(o.nodes.value.length||o.edges.value.length);g=qn([e.modelValue,()=>{var N,h;return(h=(N=e.modelValue)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,h])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...h],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,b=!!o.nodes.value.length;g=qn([e.nodes,()=>{var N,h;return(h=(N=e.nodes)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.nodes,()=>o.nodes.value.length],([N])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,b=!!o.edges.value.length;g=qn([e.edges,()=>{var N,h;return(h=(N=e.edges)==null?void 0:N.value)==null?void 0:h.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!b&&N.length?b=!0:_==null||_.resume())}),_=qn([o.edges,()=>o.edges.value.length],([N])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],n.nextTick(()=>{g==null||g.resume()}))},{immediate:b}),n.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},s=()=>{i.run(()=>{n.watch(()=>t.maxZoom,()=>{t.maxZoom&&tt(t.maxZoom)&&o.setMaxZoom(t.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{n.watch(()=>t.minZoom,()=>{t.minZoom&&tt(t.minZoom)&&o.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{n.watch(()=>t.translateExtent,()=>{t.translateExtent&&tt(t.translateExtent)&&o.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{n.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&tt(t.nodeExtent)&&o.setNodeExtent(t.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{n.watch(()=>t.applyDefault,()=>{tt(t.applyDefault)&&(o.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{i.run(()=>{const g=async _=>{let b=_;typeof t.autoConnect=="function"&&(b=await t.autoConnect(_)),b!==!1&&o.addEdges([b])};n.watch(()=>t.autoConnect,()=>{tt(t.autoConnect)&&(o.autoConnect.value=t.autoConnect)},{immediate:!0}),n.watch(o.autoConnect,(_,b,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},p=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(t)){const b=_;if(!g.includes(b)){const N=n.toRef(()=>t[b]),h=o[b];n.isRef(h)&&i.run(()=>{n.watch(N,k=>{tt(k)&&(h.value=k)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),f(),p()})()}),()=>i.stop()}function q1(){return{edgesChange:Se(),nodesChange:Se(),nodeDoubleClick:Se(),nodeClick:Se(),nodeMouseEnter:Se(),nodeMouseMove:Se(),nodeMouseLeave:Se(),nodeContextMenu:Se(),nodeDragStart:Se(),nodeDrag:Se(),nodeDragStop:Se(),nodesInitialized:Se(),miniMapNodeClick:Se(),miniMapNodeDoubleClick:Se(),miniMapNodeMouseEnter:Se(),miniMapNodeMouseMove:Se(),miniMapNodeMouseLeave:Se(),connect:Se(),connectStart:Se(),connectEnd:Se(),clickConnectStart:Se(),clickConnectEnd:Se(),paneReady:Se(),init:Se(),move:Se(),moveStart:Se(),moveEnd:Se(),selectionDragStart:Se(),selectionDrag:Se(),selectionDragStop:Se(),selectionContextMenu:Se(),selectionStart:Se(),selectionEnd:Se(),viewportChangeStart:Se(),viewportChange:Se(),viewportChangeEnd:Se(),paneScroll:Se(),paneClick:Se(),paneContextMenu:Se(),paneMouseEnter:Se(),paneMouseMove:Se(),paneMouseLeave:Se(),edgeContextMenu:Se(),edgeMouseEnter:Se(),edgeMouseMove:Se(),edgeMouseLeave:Se(),edgeDoubleClick:Se(),edgeClick:Se(),edgeUpdateStart:Se(),edgeUpdate:Se(),edgeUpdateEnd:Se(),updateNodeInternals:Se(),error:Se(e=>Wo(e.message))}}function X1(e,t){const o=n.getCurrentInstance();n.onBeforeMount(()=>{for(const[a,r]of Object.entries(t.value)){const l=s=>{e(a,s)};r.setEmitter(l),$o(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),$o(r.removeHasEmitListeners)}});function i(a){var r;const l=J1(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function J1(e){const[t,...o]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Eu(){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:Lr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Uo.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Nn.Bezier,style:{}},connectionMode:Kt.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:Yo()?"Meta":"Control",zoomActivationKeyCode:Yo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:q1(),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 Z1=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Q1(e,t,o){const i=Y1(e),a=j=>{const L=j??[];e.hooks.updateNodeInternals.trigger(L)},r=j=>p1(j,e.nodes,e.edges),l=j=>f1(j,e.nodes,e.edges),s=j=>xn(j,e.edges),c=({id:j,type:L,nodeId:x})=>{var R;const V=j?`-${L}-${j}`:`-${L}`;return Array.from(((R=e.connectionLookup.get(`${x}${V}`))==null?void 0:R.values())??[])},d=j=>{if(j)return t.value.get(j)},u=j=>{if(j)return o.value.get(j)},m=(j,L,x)=>{var R,V;const Q=[];for(const me of j){const ve={id:me.id,type:"position",dragging:x,from:me.from};if(L&&(ve.position=me.position,me.parentNode)){const Ee=d(me.parentNode);ve.position={x:ve.position.x-(((R=Ee==null?void 0:Ee.computedPosition)==null?void 0:R.x)??0),y:ve.position.y-(((V=Ee==null?void 0:Ee.computedPosition)==null?void 0:V.y)??0)}}Q.push(ve)}Q!=null&&Q.length&&e.hooks.nodesChange.trigger(Q)},f=j=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const x=window.getComputedStyle(L),{m22:R}=new window.DOMMatrixReadOnly(x.transform),V=[];for(const Q of j){const me=Q,ve=d(me.id);if(ve){const Ee=ta(me.nodeElement);if(!!(Ee.width&&Ee.height&&(ve.dimensions.width!==Ee.width||ve.dimensions.height!==Ee.height||me.forceUpdate))){const Me=me.nodeElement.getBoundingClientRect();ve.dimensions=Ee,ve.handleBounds.source=du("source",me.nodeElement,Me,R,ve.id),ve.handleBounds.target=du("target",me.nodeElement,Me,R,ve.id),V.push({id:ve.id,type:"dimensions",dimensions:Ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),V.length&&e.hooks.nodesChange.trigger(V)},p=(j,L)=>{const x=new Set,R=new Set;for(const me of j)vn(me)?x.add(me.id):nn(me)&&R.add(me.id);const V=an(t.value,x,!0),Q=an(o.value,R);if(e.multiSelectionActive){for(const me of x)V.push(on(me,L));for(const me of R)Q.push(on(me,L))}V.length&&e.hooks.nodesChange.trigger(V),Q.length&&e.hooks.edgesChange.trigger(Q)},y=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(an(t.value,new Set(j.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(an(o.value))},g=j=>{if(e.multiSelectionActive){const L=j.map(x=>on(x.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(an(o.value,new Set(j.map(L=>L.id)))),e.hooks.nodesChange.trigger(an(t.value,new Set,!0))},_=j=>{p(j,!0)},b=j=>{const x=(j||e.nodes).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.nodesChange.trigger(x)},N=j=>{const x=(j||e.edges).map(R=>(R.selected=!1,on(R.id,!1)));e.hooks.edgesChange.trigger(x)},h=j=>{if(!j||!j.length)return p([],!1);const L=j.reduce((x,R)=>{const V=on(R.id,!1);return vn(R)?x.nodes.push(V):x.edges.push(V),x},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},k=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([j,e.maxZoom]),e.minZoom=j},P=j=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,j]),e.maxZoom=j},A=j=>{var L;(L=e.d3Zoom)==null||L.translateExtent(j),e.translateExtent=j},G=j=>{e.nodeExtent=j,a()},K=j=>{var L;(L=e.d3Zoom)==null||L.clickDistance(j)},v=j=>{e.nodesDraggable=j,e.nodesConnectable=j,e.elementsSelectable=j},T=j=>{const L=j instanceof Function?j(e.nodes):j;!e.initialized&&!L.length||(e.nodes=uu(L,d,e.hooks.error.trigger))},H=j=>{const L=j instanceof Function?j(e.edges):j;if(!e.initialized&&!L.length)return;const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Xr(e.connectionLookup,o.value,x),e.edges=x},C=j=>{const L=j instanceof Function?j([...e.nodes,...e.edges]):j;!e.initialized&&!L.length||(T(L.filter(vn)),H(L.filter(nn)))},ae=j=>{let L=j instanceof Function?j(e.nodes):j;L=Array.isArray(L)?L:[L];const x=uu(L,d,e.hooks.error.trigger),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.nodesChange.trigger(R)},E=j=>{let L=j instanceof Function?j(e.edges):j;L=Array.isArray(L)?L:[L];const x=Jr(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),R=[];for(const V of x)R.push(Zd(V));R.length&&e.hooks.edgesChange.trigger(R)},Y=(j,L=!0,x=!1)=>{const R=j instanceof Function?j(e.nodes):j,V=Array.isArray(R)?R:[R],Q=[],me=[];function ve($e){const Me=s($e);for(const Ue of Me)(!tt(Ue.deletable)||Ue.deletable)&&me.push(eu(Ue.id,Ue.source,Ue.target,Ue.sourceHandle,Ue.targetHandle))}function Ee($e){const Me=[];for(const Ue of e.nodes)Ue.parentNode===$e&&Me.push(Ue);if(Me.length){for(const Ue of Me)Q.push(Qd(Ue.id));L&&ve(Me);for(const Ue of Me)Ee(Ue.id)}}for(const $e of V){const Me=typeof $e=="string"?d($e):$e;Me&&(tt(Me.deletable)&&!Me.deletable||(Q.push(Qd(Me.id)),L&&ve([Me]),x&&Ee(Me.id)))}me.length&&e.hooks.edgesChange.trigger(me),Q.length&&e.hooks.nodesChange.trigger(Q)},S=j=>{const L=j instanceof Function?j(e.edges):j,x=Array.isArray(L)?L:[L],R=[];for(const V of x){const Q=typeof V=="string"?u(V):V;Q&&(tt(Q.deletable)&&!Q.deletable||R.push(eu(typeof V=="string"?V:V.id,Q.source,Q.target,Q.sourceHandle,Q.targetHandle)))}e.hooks.edgesChange.trigger(R)},W=(j,L,x=!0)=>{const R=u(j.id);if(!R)return!1;const V=e.edges.indexOf(R),Q=D1(j,L,R,x,e.hooks.error.trigger);if(Q){const[me]=Jr([Q],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((ve,Ee)=>Ee===V?me:ve),Xr(e.connectionLookup,o.value,[me]),me}return!1},ee=(j,L,x={replace:!1})=>{const R=u(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ie=j=>Jd(j,e.nodes),O=j=>{const L=Jd(j,e.edges);return Xr(e.connectionLookup,o.value,L),L},U=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;x.replace?e.nodes.splice(e.nodes.indexOf(R),1,V):Object.assign(R,V)},ne=(j,L,x={replace:!1})=>{const R=d(j);if(!R)return;const V=typeof L=="function"?L(R):L;R.data=x.replace?V:{...R.data,...V}},ce=(j,L,x=!1)=>{x?e.connectionClickStartHandle=j:e.connectionStartHandle=j,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},ge=(j,L=null,x=null)=>{e.connectionStartHandle&&(e.connectionPosition=j,e.connectionEndHandle=L,e.connectionStatus=x)},se=(j,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},pe=j=>{const L=u1(j),x=L?null:Ho(j)?j:d(j.id);return!L&&!x?[null,null,L]:[L?j:Qi(x),x,L]},be=(j,L=!0,x=e.nodes)=>{const[R,V,Q]=pe(j);if(!R)return[];const me=[];for(const ve of x||e.nodes){if(!Q&&(ve.id===V.id||!ve.computedPosition))continue;const Ee=Qi(ve),$e=ea(Ee,R);(L&&$e>0||$e>=Ee.width*Ee.height||$e>=Number(R.width)*Number(R.height))&&me.push(ve)}return me},xe=(j,L,x=!0)=>{const[R]=pe(j);if(!R)return!1;const V=ea(R,L);return x&&V>0||V>=Number(R.width)*Number(R.height)},Te=j=>{const{viewport:L,dimensions:x,d3Zoom:R,d3Selection:V,translateExtent:Q}=e;if(!R||!V||!j.x&&!j.y)return!1;const me=eo.translate(L.x+j.x,L.y+j.y).scale(L.zoom),ve=[[0,0],[x.width,x.height]],Ee=R.constrain()(me,ve,Q),$e=e.viewport.x!==Ee.x||e.viewport.y!==Ee.y||e.viewport.zoom!==Ee.k;return R.transform(V,Ee),$e},Ae=j=>{const L=j instanceof Function?j(e):j,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];tt(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const R=L.modelValue||L.nodes||L.edges?[]:void 0;R&&(L.modelValue&&R.push(...L.modelValue),L.nodes&&R.push(...L.nodes),L.edges&&R.push(...L.edges),C(R));const V=()=>{tt(L.maxZoom)&&P(L.maxZoom),tt(L.minZoom)&&k(L.minZoom),tt(L.translateExtent)&&A(L.translateExtent)};for(const Q of Object.keys(L)){const me=Q,ve=L[me];![...Z1,...x].includes(me)&&tt(ve)&&(e[me]=ve)}gr(()=>e.d3Zoom).not.toBeNull().then(V),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:f,setElements:C,setNodes:T,setEdges:H,addNodes:ae,addEdges:E,removeNodes:Y,removeEdges:S,findNode:d,findEdge:u,updateEdge:W,updateEdgeData:ee,updateNode:U,updateNodeData:ne,applyEdgeChanges:O,applyNodeChanges:ie,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:k,setMaxZoom:P,setTranslateExtent:A,setNodeExtent:G,setPaneClickDistance:K,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:N,startConnection:ce,updateConnection:ge,endConnection:se,setInteractive:v,setState:Ae,getIntersectingNodes:be,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:xe,panBy:Te,fitView:j=>i.value.fitView(j),zoomIn:j=>i.value.zoomIn(j),zoomOut:j=>i.value.zoomOut(j),zoomTo:(j,L)=>i.value.zoomTo(j,L),setViewport:(j,L)=>i.value.setViewport(j,L),setTransform:(j,L)=>i.value.setTransform(j,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(j,L,x)=>i.value.setCenter(j,L,x),fitBounds:(j,L)=>i.value.fitBounds(j,L),project:j=>i.value.project(j),screenToFlowCoordinate:j=>i.value.screenToFlowCoordinate(j),flowToScreenCoordinate:j=>i.value.flowToScreenCoordinate(j),toObject:()=>{const j=[],L=[];for(const x of e.nodes){const{computedPosition:R,handleBounds:V,selected:Q,dimensions:me,isParent:ve,resizing:Ee,dragging:$e,events:Me,...Ue}=x;j.push(Ue)}for(const x of e.edges){const{selected:R,sourceNode:V,targetNode:Q,events:me,...ve}=x;L.push(ve)}return JSON.parse(JSON.stringify({nodes:j,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:j=>new Promise(L=>{const{nodes:x,edges:R,position:V,zoom:Q,viewport:me}=j;x&&T(x),R&&H(R);const[ve,Ee]=me!=null&&me.x&&(me!=null&&me.y)?[me.x,me.y]:V??[null,null];if(ve&&Ee){const $e=(me==null?void 0:me.zoom)||Q||e.viewport.zoom;return gr(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ve,y:Ee,zoom:$e}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const j=Eu();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=eo.translate(j.defaultViewport.x??0,j.defaultViewport.y??0).scale(wn(j.defaultViewport.zoom??1,j.minZoom,j.maxZoom)),x=e.viewportRef.getBoundingClientRect(),R=[[0,0],[x.width,x.height]],V=e.d3Zoom.constrain()(L,R,j.translateExtent);e.d3Zoom.transform(e.d3Selection,V)}Ae(j)},$destroy:()=>{}}}const e0=["data-id","data-handleid","data-nodeid","data-handlepos"],t0={name:"Handle",compatConfig:{MODE:3}},In=n.defineComponent({...t0,props:{id:{default:null},type:{},position:{default:()=>Re.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=n.toRef(()=>o.type??"source"),a=n.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:f}=He(),{id:p,node:y,nodeEl:g,connectedEdges:_}=_u(),b=n.ref(),N=n.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=n.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=n.toRef(()=>{var H,C,ae,E,Y,S;return((H=l.value)==null?void 0:H.nodeId)===p&&((C=l.value)==null?void 0:C.id)===e.id&&((ae=l.value)==null?void 0:ae.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((Y=c.value)==null?void 0:Y.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),P=n.toRef(()=>{var H,C,ae;return((H=s.value)==null?void 0:H.nodeId)===p&&((C=s.value)==null?void 0:C.id)===e.id&&((ae=s.value)==null?void 0:ae.type)===i.value}),{handlePointerDown:A,handleClick:G}=bu({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),K=n.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}):typeof e.connectable=="number"?_.value.filter(H=>{const C=H[`${i.value}Handle`];return H[i.value]!==p?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):tt(e.connectable)?e.connectable:u.value);n.onMounted(()=>{var H;if(!y.dimensions.width||!y.dimensions.height)return;const C=(H=y.handleBounds[i.value])==null?void 0:H.find(ie=>ie.id===e.id);if(!d.value||C)return;const ae=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!b.value||!ae||!e.id)return;const E=g.value.getBoundingClientRect(),Y=b.value.getBoundingClientRect(),S=window.getComputedStyle(ae),{m22:W}=new window.DOMMatrixReadOnly(S.transform),ee={id:e.id,position:e.position,x:(Y.left-E.left)/W,y:(Y.top-E.top)/W,type:i.value,nodeId:p,...ta(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],ee]});function v(H){const C=Kr(H);K.value&&N.value&&(C&&H.button===0||!C)&&A(H)}function T(H){!p||!s.value&&!N.value||K.value&&G(H)}return t({handleClick:G,handlePointerDown:A,onClick:T,onPointerDown:v}),(H,C)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${n.unref(r)}-${n.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":n.unref(p),"data-handlepos":H.position,class:n.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${H.position}`,`vue-flow__handle-${e.id}`,n.unref(m),n.unref(f),i.value,{connectable:K.value,connecting:P.value,connectablestart:N.value,connectableend:h.value,connectionindicator:K.value&&(N.value&&!k.value||h.value&&k.value)}]]),onMousedown:v,onTouchstartPassive:v,onClick:T},[n.renderSlot(H.$slots,"default",{id:H.id})],42,e0))}}),sa=function({sourcePosition:e=Re.Bottom,targetPosition:t=Re.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[n.h(In,{type:"target",position:t,connectable:i,isValidConnection:a}),typeof s!="string"&&s?n.h(s):n.h(n.Fragment,[s]),n.h(In,{type:"source",position:e,connectable:i,isValidConnection:r})]};sa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],sa.inheritAttrs=!1,sa.compatConfig={MODE:3};const n0=sa,ca=function({targetPosition:e=Re.Top,label:t,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??t;return[n.h(In,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r])]};ca.props=["targetPosition","label","isValidTargetPos","connectable","data"],ca.inheritAttrs=!1,ca.compatConfig={MODE:3};const o0=ca,da=function({sourcePosition:e=Re.Bottom,label:t,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??t;return[typeof r!="string"&&r?n.h(r):n.h(n.Fragment,[r]),n.h(In,{type:"source",position:e,connectable:o,isValidConnection:i})]};da.props=["sourcePosition","label","isValidSourcePos","connectable","data"],da.inheritAttrs=!1,da.compatConfig={MODE:3};const i0=da,a0=["transform"],r0=["width","height","x","y","rx","ry"],l0=["y"],s0={name:"EdgeText",compatConfig:{MODE:3}},c0=n.defineComponent({...s0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=n.ref({x:0,y:0,width:0,height:0}),o=n.ref(null),i=n.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);n.onMounted(a),n.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(n.openBlock(),n.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(n.openBlock(),n.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:n.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,r0)):n.createCommentVNode("",!0),n.createElementVNode("text",n.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[n.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(r.label),{key:0})):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(r.label),1)],64))])],16,l0)],8,a0))}}),d0=["id","d","marker-end","marker-start"],u0=["d","stroke-width"],m0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ua=n.defineComponent({...m0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const o=n.ref(null),i=n.ref(null),a=n.ref(null),r=n.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",n.mergeProps(n.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,d0),l.interactionWidth?(n.openBlock(),n.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,u0)):n.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(n.openBlock(),n.createBlock(c0,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.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 Nu({sourceX:e,sourceY:t,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-t)/2,s=i<t?i+l:i-l;return[r,s,a,l]}function wu({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=t*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-t);return[c,d,u,m]}function ma(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vu({pos:e,x1:t,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Re.Left:l=t-ma(t-i,r),s=o;break;case Re.Right:l=t+ma(i-t,r),s=o;break;case Re.Top:l=t,s=o-ma(o-a,r);break;case Re.Bottom:l=t,s=o+ma(a-o,r);break}return[l,s]}function xu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,curvature:s=.25}=e,[c,d]=vu({pos:i,x1:t,y1:o,x2:a,y2:r,c:s}),[u,m]=vu({pos:l,x1:a,y1:r,x2:t,y2:o,c:s}),[f,p,y,g]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${t},${o} C${c},${d} ${u},${m} ${a},${r}`,f,p,y,g]}function Iu({pos:e,x1:t,y1:o,x2:i,y2:a}){let r,l;switch(e){case Re.Left:case Re.Right:r=.5*(t+i),l=o;break;case Re.Top:case Re.Bottom:r=t,l=.5*(o+a);break}return[r,l]}function Cu(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top}=e,[s,c]=Iu({pos:i,x1:t,y1:o,x2:a,y2:r}),[d,u]=Iu({pos:l,x1:a,y1:r,x2:t,y2:o}),[m,f,p,y]=wu({sourceX:t,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${o} C${s},${c} ${d},${u} ${a},${r}`,m,f,p,y]}const Su={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}};function f0({source:e,sourcePosition:t=Re.Bottom,target:o}){return t===Re.Left||t===Re.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 $u(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function p0({source:e,sourcePosition:t=Re.Bottom,target:o,targetPosition:i=Re.Top,center:a,offset:r}){const l=Su[t],s=Su[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=f0({source:c,sourcePosition:t,target:d}),m=u.x!==0?"x":"y",f=u[m];let p,y,g;const _={x:0,y:0},b={x:0,y:0},[N,h,k,P]=Nu({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??h;const G=[{x:y,y:c.y},{x:y,y:d.y}],K=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===f?p=m==="x"?G:K:p=m==="x"?K:G}else{const G=[{x:c.x,y:d.y}],K=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===f?K:G:p=l.y===f?G:K,t===i){const ae=Math.abs(e[m]-o[m]);if(ae<=r){const E=Math.min(r-1,r-ae);l[m]===f?_[m]=(c[m]>e[m]?-1:1)*E:b[m]=(d[m]>o[m]?-1:1)*E}}if(t!==i){const ae=m==="x"?"y":"x",E=l[m]===s[ae],Y=c[ae]>d[ae],S=c[ae]<d[ae];(l[m]===1&&(!E&&Y||E&&S)||l[m]!==1&&(!E&&S||E&&Y))&&(p=m==="x"?G:K)}const v={x:c.x+_.x,y:c.y+_.y},T={x:d.x+b.x,y:d.y+b.y},H=Math.max(Math.abs(v.x-p[0].x),Math.abs(T.x-p[0].x)),C=Math.max(Math.abs(v.y-p[0].y),Math.abs(T.y-p[0].y));H>=C?(y=(v.x+T.x)/2,g=p[0].y):(y=p[0].x,g=(v.y+T.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...p,{x:d.x+b.x,y:d.y+b.y},o],y,g,k,P]}function h0(e,t,o,i){const a=Math.min($u(e,t)/2,$u(t,o)/2,i),{x:r,y:l}=t;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Qr(e){const{sourceX:t,sourceY:o,sourcePosition:i=Re.Bottom,targetX:a,targetY:r,targetPosition:l=Re.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,f,p,y,g]=p0({source:{x:t,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,N,h)=>{let k;return h>0&&h<m.length-1?k=h0(m[h-1],N,m[h+1],s):k=`${h===0?"M":"L"}${N.x} ${N.y}`,b+=k,b},""),f,p,y,g]}function y0(e){const{sourceX:t,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Nu({sourceX:t,sourceY:o,targetX:i,targetY:a});return[`M ${t},${o}L ${i},${a}`,r,l,s,c]}const g0=n.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=y0(e);return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),Ru=n.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=Qr({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),b0=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(Ru,{...e,...t,borderRadius:0})}}),_0=n.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=xu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),k0=n.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[o,i,a]=Cu({...e,sourcePosition:e.sourcePosition??Re.Bottom,targetPosition:e.targetPosition??Re.Top});return n.h(ua,{path:o,labelX:i,labelY:a,...t,...e})}}}),E0={input:i0,default:n0,output:o0},N0={default:_0,straight:g0,step:b0,smoothstep:Ru,simplebezier:k0};function w0(e,t,o){const i=n.computed(()=>g=>t.value.get(g)),a=n.computed(()=>g=>o.value.get(g)),r=n.computed(()=>{const g={...N0,...e.edgeTypes},_=Object.keys(g);for(const b of e.edges)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),l=n.computed(()=>{const g={...E0,...e.nodeTypes},_=Object.keys(g);for(const b of e.nodes)b.type&&!_.includes(b.type)&&(g[b.type]=b.type);return g}),s=n.computed(()=>e.onlyRenderVisibleElements?Kd(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=n.computed(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const _ of e.edges){const b=t.value.get(_.source),N=t.value.get(_.target);v1({sourcePos:b.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=n.computed(()=>[...s.value,...c.value]),u=n.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=n.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),f=n.computed(()=>[...u.value,...m.value]),p=n.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=n.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Cn{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)??Cn.instance;return Cn.instance=i??new Cn,o&&(o.config.globalProperties.$vueFlowStorage=Cn.instance),Cn.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=Eu(),a=n.reactive(i),r={};for(const[f,p]of Object.entries(a.hooks)){const y=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[y]=p.on}const l={};for(const[f,p]of Object.entries(a.hooks))l[f]=p.trigger;const s=n.computed(()=>{const f=new Map;for(const p of a.nodes)f.set(p.id,p);return f}),c=n.computed(()=>{const f=new Map;for(const p of a.edges)f.set(p.id,p);return f}),d=w0(a,s,c),u=Q1(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...ky(a),nodeLookup:s,edgeLookup:c,emits:l,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,m),m}getId(){return`vue-flow-${this.currentId++}`}}function He(e){const t=Cn.getInstance(),o=n.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=n.inject(pu,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const c=r??t.getId(),d=t.create(c,a);s=d,(o??n.effectScope(!0)).run(()=>{n.watch(d.applyDefault,(m,f,p)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),$o(()=>{if(s){const m=t.get(s.id);m?m.$destroy():Wo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(n.provide(pu,s),o.vueFlowId=s.id),i){const c=n.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new it(et.USEVUEFLOW_OPTIONS))}return s}function v0(e){const{emits:t,dimensions:o}=He();let i;n.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=ta(e.value);(s.width===0||s.height===0)&&t.error(new it(et.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),n.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const x0={name:"UserSelection",compatConfig:{MODE:3}},I0=n.defineComponent({...x0,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))}}),C0=["tabIndex"],S0={name:"NodesSelection",compatConfig:{MODE:3}},$0=n.defineComponent({...S0,setup(e){const{emits:t,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=He(),s=ku(),c=n.ref(null),d=gu({el:c,onStart(y){t.selectionDragStart(y),t.nodeDragStart(y)},onDrag(y){t.selectionDrag(y),t.nodeDrag(y)},onStop(y){t.selectionDragStop(y),t.nodeDragStop(y)}});n.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=n.computed(()=>Ur(i.value)),m=n.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function f(y){t.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||to[y.key]&&(y.preventDefault(),s({x:to[y.key].x,y:to[y.key].y},y.shiftKey))}return(y,g)=>!n.unref(l)&&u.value.width&&u.value.height?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["vue-flow__nodesselection vue-flow__container",n.unref(a)]),style:n.normalizeStyle({transform:`translate(${n.unref(o).x}px,${n.unref(o).y}px) scale(${n.unref(o).zoom})`})},[n.createElementVNode("div",{ref_key:"el",ref:c,class:n.normalizeClass([{dragging:n.unref(d)},"vue-flow__nodesselection-rect"]),style:n.normalizeStyle(m.value),tabIndex:n.unref(r)?void 0:-1,onContextmenu:f,onKeydown:p},null,46,C0)],6)):n.createCommentVNode("",!0)}});function R0(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const A0={name:"Pane",compatConfig:{MODE:3}},T0=n.defineComponent({...A0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:f,removeEdges:p,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:b,edgeLookup:N,nodeLookup:h,connectionLookup:k,defaultEdgeOptions:P,connectionStartHandle:A,panOnDrag:G}=He(),K=n.shallowRef(null),v=n.shallowRef(new Set),T=n.shallowRef(new Set),H=n.shallowRef(null),C=n.toRef(()=>c.value&&(e.isSelecting||r.value)),ae=n.toRef(()=>A.value!==null);let E=!1,Y=!1;const S=Fo(g,{actInsideInputWithModifier:!1}),W=Fo(_);n.watch(S,se=>{se&&(f(m.value),p(u.value),d.value=!1)}),n.watch(W,se=>{b.value=se});function ee(se,pe){return be=>{be.target===pe&&(se==null||se(be))}}function ie(se){if(E||ae.value){E=!1;return}a.paneClick(se),l(),d.value=!1}function O(se){var pe;if(Array.isArray(G.value)&&((pe=G.value)!=null&&pe.includes(2))){se.preventDefault();return}a.paneContextMenu(se)}function U(se){a.paneScroll(se)}function ne(se){var pe,be,xe;if(H.value=((pe=t.value)==null?void 0:pe.getBoundingClientRect())??null,!c.value||!e.isSelecting||se.button!==0||se.target!==K.value||!H.value)return;(xe=(be=se.target)==null?void 0:be.setPointerCapture)==null||xe.call(be,se.pointerId);const{x:Te,y:Ae}=R0(se,H.value);Y=!0,E=!1,l(),s.value={width:0,height:0,startX:Te,startY:Ae,x:Te,y:Ae},a.selectionStart(se)}function ce(se){var pe;if(!H.value||!s.value)return;E=!0;const{x:be,y:xe}=Ot(se,H.value),{startX:Te=0,startY:Ae=0}=s.value,fe={startX:Te,startY:Ae,x:be<Te?be:Te,y:xe<Ae?xe:Ae,width:Math.abs(be-Te),height:Math.abs(xe-Ae)},ke=v.value,we=T.value;v.value=new Set(Kd(o.value,fe,i.value,y.value===Lr.Partial,!0).map(L=>L.id)),T.value=new Set;const j=((pe=P.value)==null?void 0:pe.selectable)??!0;for(const L of v.value){const x=k.value.get(L);if(x)for(const{edgeId:R}of x.values()){const V=N.value.get(R);V&&(V.selectable??j)&&T.value.add(R)}}if(!fu(ke,v.value)){const L=an(h.value,v.value,!0);a.nodesChange(L)}if(!fu(we,T.value)){const L=an(N.value,T.value);a.edgesChange(L)}s.value=fe,r.value=!0,d.value=!1}function ge(se){var pe;se.button!==0||!Y||((pe=se.target)==null||pe.releasePointerCapture(se.pointerId),!r.value&&s.value&&se.target===K.value&&ie(se),r.value=!1,s.value=null,d.value=v.value.size>0,a.selectionEnd(se),e.selectionKeyPressed&&(E=!1),Y=!1)}return(se,pe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:K,class:n.normalizeClass(["vue-flow__pane vue-flow__container",{selection:se.isSelecting}]),onClick:pe[0]||(pe[0]=be=>C.value?void 0:ee(ie,K.value)(be)),onContextmenu:pe[1]||(pe[1]=be=>ee(O,K.value)(be)),onWheelPassive:pe[2]||(pe[2]=be=>ee(U,K.value)(be)),onPointerenter:pe[3]||(pe[3]=be=>C.value?void 0:n.unref(a).paneMouseEnter(be)),onPointerdown:pe[4]||(pe[4]=be=>C.value?ne(be):n.unref(a).paneMouseMove(be)),onPointermove:pe[5]||(pe[5]=be=>C.value?ce(be):n.unref(a).paneMouseMove(be)),onPointerup:pe[6]||(pe[6]=be=>C.value?ge(be):void 0),onPointerleave:pe[7]||(pe[7]=be=>n.unref(a).paneMouseLeave(be))},[n.renderSlot(se.$slots,"default"),n.unref(r)&&n.unref(s)?(n.openBlock(),n.createBlock(I0,{key:0,"user-selection-rect":n.unref(s)},null,8,["user-selection-rect"])):n.createCommentVNode("",!0),n.unref(d)&&n.unref(m).length?(n.openBlock(),n.createBlock($0,{key:1})):n.createCommentVNode("",!0)],34))}}),V0={name:"Transform",compatConfig:{MODE:3}},M0=n.defineComponent({...V0,setup(e){const{viewport:t,fitViewOnInit:o,fitViewOnInitDone:i}=He(),a=n.computed(()=>o.value?!i.value:!1),r=n.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(n.openBlock(),n.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:n.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[n.renderSlot(l.$slots,"default")],4))}}),B0={name:"Viewport",compatConfig:{MODE:3}},D0=n.defineComponent({...B0,setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:f,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:b,emits:N,connectionStartHandle:h,userSelectionActive:k,paneDragging:P,d3Zoom:A,d3Selection:G,d3ZoomHandler:K,viewport:v,viewportRef:T,paneClickDistance:H}=He();v0(T);const C=n.shallowRef(!1),ae=n.shallowRef(!1);let E=null,Y=!1,S=0,W={x:0,y:0,zoom:0};const ee=Fo(s),ie=Fo(l),O=Fo(r),U=n.toRef(()=>(!ie.value||ie.value&&l.value===!0)&&(ee.value||m.value)),ne=n.toRef(()=>ee.value||c.value),ce=n.toRef(()=>l.value===!0&&U.value!==!0),ge=n.toRef(()=>ie.value&&l.value!==!0||k.value||ce.value),se=n.toRef(()=>h.value!==null);n.onMounted(()=>{if(!T.value){Wo("Viewport element is missing");return}const Ae=T.value,fe=Ae.getBoundingClientRect(),ke=i1().clickDistance(H.value).scaleExtent([t.value,o.value]).translateExtent(a.value),we=vt(Ae).call(ke),j=we.on("wheel.zoom"),L=eo.translate(i.value.x??0,i.value.y??0).scale(wn(i.value.zoom??1,t.value,o.value)),x=[[0,0],[fe.width,fe.height]],R=ke.constrain()(L,x,a.value);ke.transform(we,R),ke.wheelDelta(Fr),A.value=ke,G.value=we,K.value=j,v.value={x:R.x,y:R.y,zoom:R.k},ke.on("start",V=>{var Q;if(!V.sourceEvent)return null;S=V.sourceEvent.button,C.value=!0;const me=xe(V.transform);((Q=V.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(P.value=!0),W=me,N.viewportChangeStart(me),N.moveStart({event:V,flowTransform:me})}),ke.on("end",V=>{if(!V.sourceEvent)return null;if(C.value=!1,P.value=!1,pe(U.value,S??0)&&!Y&&N.paneContextMenu(V.sourceEvent),Y=!1,be(W,V.transform)){const Q=xe(V.transform);W=Q,N.viewportChangeEnd(Q),N.moveEnd({event:V,flowTransform:Q})}}),ke.filter(V=>{var Q;const me=O.value||y.value,ve=p.value&&V.ctrlKey,Ee=V.button,$e=V.type==="wheel";if(Ee===1&&V.type==="mousedown"&&(Te(V,"vue-flow__node")||Te(V,"vue-flow__edge")))return!0;if(!U.value&&!me&&!ne.value&&!f.value&&!p.value||k.value||se.value&&!$e||!f.value&&V.type==="dblclick"||Te(V,_.value)&&$e||Te(V,b.value)&&(!$e||ne.value&&$e&&!O.value)||!p.value&&V.ctrlKey&&$e||!me&&!ne.value&&!ve&&$e)return!1;if(!p&&V.type==="touchstart"&&((Q=V.touches)==null?void 0:Q.length)>1)return V.preventDefault(),!1;if(!U.value&&(V.type==="mousedown"||V.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ee===0||Array.isArray(m.value)&&!m.value.includes(Ee)&&(V.type==="mousedown"||V.type==="touchstart"))return!1;const Me=Array.isArray(m.value)&&m.value.includes(Ee)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ee||Ee<=1;return(!V.ctrlKey||ee.value||$e)&&Me}),n.watch([k,U],()=>{k.value&&!C.value?ke.on("zoom",null):k.value||ke.on("zoom",V=>{v.value={x:V.transform.x,y:V.transform.y,zoom:V.transform.k};const Q=xe(V.transform);Y=pe(U.value,S??0),N.viewportChange(Q),N.move({event:V,flowTransform:Q})})},{immediate:!0}),n.watch([k,ne,d,O,p,g,_],()=>{ne.value&&!O.value&&!k.value?we.on("wheel.zoom",V=>{if(Te(V,_.value))return!1;const Q=O.value||y.value,me=p.value&&V.ctrlKey;if(!(!g.value||ne.value||Q||me))return!1;V.preventDefault(),V.stopImmediatePropagation();const Ee=we.property("__zoom").k||1,$e=Yo();if(!ee.value&&V.ctrlKey&&p.value&&$e){const gt=Vt(V),w=Fr(V),M=Ee*2**w;ke.scaleTo(we,M,gt,V);return}const Me=V.deltaMode===1?20:1;let Ue=d.value===Uo.Vertical?0:V.deltaX*Me,Ye=d.value===Uo.Horizontal?0:V.deltaY*Me;!$e&&V.shiftKey&&d.value!==Uo.Vertical&&!Ue&&Ye&&(Ue=Ye,Ye=0),ke.translateBy(we,-(Ue/Ee)*u.value,-(Ye/Ee)*u.value);const Fe=xe(we.property("__zoom"));E&&clearTimeout(E),ae.value?(N.move({event:V,flowTransform:Fe}),N.viewportChange(Fe),E=setTimeout(()=>{N.moveEnd({event:V,flowTransform:Fe}),N.viewportChangeEnd(Fe),ae.value=!1},150)):(ae.value=!0,N.moveStart({event:V,flowTransform:Fe}),N.viewportChangeStart(Fe))},{passive:!1}):typeof j<"u"&&we.on("wheel.zoom",function(V,Q){const me=!g.value&&V.type==="wheel"&&!V.ctrlKey,ve=O.value||y.value,Ee=p.value&&V.ctrlKey;if(!ve&&!c.value&&!Ee&&V.type==="wheel"||me||Te(V,_.value))return null;V.preventDefault(),j.call(this,V,Q)},{passive:!1})},{immediate:!0})});function pe(Ae,fe){return fe===2&&Array.isArray(Ae)&&Ae.includes(2)}function be(Ae,fe){return Ae.x!==fe.x&&!Number.isNaN(fe.x)||Ae.y!==fe.y&&!Number.isNaN(fe.y)||Ae.zoom!==fe.k&&!Number.isNaN(fe.k)}function xe(Ae){return{x:Ae.x,y:Ae.y,zoom:Ae.k}}function Te(Ae,fe){return Ae.target.closest(`.${fe}`)}return(Ae,fe)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"viewportRef",ref:T,class:"vue-flow__viewport vue-flow__container"},[n.createVNode(T0,{"is-selecting":ge.value,"selection-key-pressed":n.unref(ie),class:n.normalizeClass({connecting:se.value,dragging:n.unref(P),draggable:n.unref(m)===!0||Array.isArray(n.unref(m))&&n.unref(m).includes(0)})},{default:n.withCtx(()=>[n.createVNode(M0,null,{default:n.withCtx(()=>[n.renderSlot(Ae.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),O0=["id"],L0=["id"],P0=["id"],z0={name:"A11yDescriptions",compatConfig:{MODE:3}},U0=n.defineComponent({...z0,setup(e){const{id:t,disableKeyboardA11y:o,ariaLiveMessage:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",{id:`${n.unref(Dd)}-${n.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+n.toDisplayString(n.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,O0),n.createElementVNode("div",{id:`${n.unref(Od)}-${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,L0),n.unref(o)?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,id:`${n.unref(d1)}-${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,P0))],64))}});function F0(){const e=He();n.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function H0(e,t,o){return o===Re.Left?e-t:o===Re.Right?e+t:e}function G0(e,t,o){return o===Re.Top?e-t:o===Re.Bottom?e+t:e}const el=function({radius:e=10,centerX:t=0,centerY:o=0,position:i=Re.Top,type:a}){return n.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:H0(t,e,i),cy:G0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};el.props=["radius","centerX","centerY","position","type"],el.compatConfig={MODE:3};const Au=el,j0=n.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:f,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:b,hooks:N}=He(),h=n.computed(()=>u(e.id)),{emit:k,on:P}=z1(h.value,r),A=n.inject(aa),G=n.getCurrentInstance(),K=n.ref(!1),v=n.ref(!1),T=n.ref(""),H=n.ref(null),C=n.ref("source"),ae=n.ref(null),E=n.toRef(()=>typeof h.value.selectable>"u"?g.value:h.value.selectable),Y=n.toRef(()=>typeof h.value.updatable>"u"?_.value:h.value.updatable),S=n.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);n.provide(O1,e.id),n.provide(L1,ae);const W=n.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),ee=n.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),ie=n.computed(()=>{const L=h.value.type||"default",x=A==null?void 0:A[`edge-${L}`];if(x)return x;let R=h.value.template??c.value[L];if(typeof R=="string"&&G){const V=Object.keys(G.appContext.components);V&&V.includes(L)&&(R=n.resolveComponent(L,!1))}return R&&typeof R!="string"?R:(r.error(new it(et.EDGE_TYPE_MISSING,R)),!1)}),{handlePointerDown:O}=bu({nodeId:T,handleId:H,type:C,isValidConnection:f,edgeUpdaterType:C,onEdgeUpdate:ce,onEdgeUpdateEnd:ge});return()=>{const L=m(h.value.source),x=m(h.value.target),R="pathOptions"in h.value?h.value.pathOptions:{};if(!L&&!x)return r.error(new it(et.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!L)return r.error(new it(et.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!x)return r.error(new it(et.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||L.hidden||x.hidden)return null;let V;i.value===Kt.Strict?V=L.handleBounds.source:V=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const Q=iu(V,h.value.sourceHandle);let me;i.value===Kt.Strict?me=x.handleBounds.target:me=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const ve=iu(me,h.value.targetHandle),Ee=(Q==null?void 0:Q.position)||Re.Bottom,$e=(ve==null?void 0:ve.position)||Re.Top,{x:Me,y:Ue}=oo(L,Q,Ee),{x:Ye,y:Fe}=oo(x,ve,$e);return h.value.sourceX=Me,h.value.sourceY=Ue,h.value.targetX=Ye,h.value.targetY=Fe,n.h("g",{ref:ae,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ie.value===!1?"default":h.value.type||"default"}`,s.value,W.value,{updating:K.value,selected:h.value.selected,animated:h.value.animated,inactive:!E.value&&!N.value.edgeClick.hasListeners()}],tabIndex:S.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":S.value?`${Od}-${t}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...h.value.domAttributes,onClick:pe,onContextmenu:be,onDblclick:xe,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onKeyDown:S.value?j:void 0},[v.value?null:n.h(ie.value===!1?c.value.default:ie.value,{id:e.id,sourceNode:L,targetNode:x,source:h.value.source,target:h.value.target,type:h.value.type,updatable:Y.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...P},style:ee.value,markerStart:`url('#${Ko(h.value.markerStart,t)}')`,markerEnd:`url('#${Ko(h.value.markerEnd,t)}')`,sourcePosition:Ee,targetPosition:$e,sourceX:Me,sourceY:Ue,targetX:Ye,targetY:Fe,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...R}),[Y.value==="source"||Y.value===!0?[n.h("g",{onMousedown:ke,onMouseenter:U,onMouseout:ne},n.h(Au,{position:Ee,centerX:Me,centerY:Ue,radius:a.value,type:"source","data-type":"source"}))]:null,Y.value==="target"||Y.value===!0?[n.h("g",{onMousedown:we,onMouseenter:U,onMouseout:ne},n.h(Au,{position:$e,centerX:Ye,centerY:Fe,radius:a.value,type:"target","data-type":"target"}))]:null]])};function U(){K.value=!0}function ne(){K.value=!1}function ce(L,x){k.update({event:L,edge:h.value,connection:x})}function ge(L){k.updateEnd({event:L,edge:h.value}),v.value=!1}function se(L,x){L.button===0&&(v.value=!0,T.value=x?h.value.target:h.value.source,H.value=(x?h.value.targetHandle:h.value.sourceHandle)??null,C.value=x?"target":"source",k.updateStart({event:L,edge:h.value}),O(L))}function pe(L){var x;const R={event:L,edge:h.value};E.value&&(l.value=!1,h.value.selected&&p.value?(d([h.value]),(x=ae.value)==null||x.blur()):o([h.value])),k.click(R)}function be(L){k.contextMenu({event:L,edge:h.value})}function xe(L){k.doubleClick({event:L,edge:h.value})}function Te(L){k.mouseEnter({event:L,edge:h.value})}function Ae(L){k.mouseMove({event:L,edge:h.value})}function fe(L){k.mouseLeave({event:L,edge:h.value})}function ke(L){se(L,!0)}function we(L){se(L,!1)}function j(L){var x;!y.value&&Ld.includes(L.key)&&E.value&&(L.key==="Escape"?((x=ae.value)==null||x.blur(),d([u(e.id)])):o([u(e.id)]))}}}),K0=n.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=He(),f=(e=n.inject(aa))==null?void 0:e["connection-line"],p=n.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=n.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=n.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=n.computed(()=>c.value.markerStart?`url(#${Ko(c.value.markerStart,t)})`:""),b=n.computed(()=>c.value.markerEnd?`url(#${Ko(c.value.markerEnd,t)})`:"");return()=>{var N,h,k;if(!p.value||!i.value)return null;const P=i.value.id,A=i.value.type,G=p.value.handleBounds;let K=(G==null?void 0:G[A])??[];if(o.value===Kt.Loose){const ee=(G==null?void 0:G[A==="source"?"target":"source"])??[];K=[...K,...ee]}if(!K)return null;const v=(P?K.find(ee=>ee.id===P):K[0])??null,T=(v==null?void 0:v.position)??Re.Top,{x:H,y:C}=oo(p.value,v,T);let ae=null;y.value&&(o.value===Kt.Strict?ae=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null:ae=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(ee=>{var ie;return ee.id===((ie=a.value)==null?void 0:ie.id)}))||null);const E=((k=a.value)==null?void 0:k.position)??(T?Wr[T]:null);if(!T||!E)return null;const Y=l.value??c.value.type??Nn.Bezier;let S="";const W={sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E};return Y===Nn.Bezier?[S]=xu(W):Y===Nn.Step?[S]=Qr({...W,borderRadius:0}):Y===Nn.SmoothStep?[S]=Qr(W):Y===Nn.SimpleBezier?[S]=Cu(W):S=`M${H},${C} ${g.value.x},${g.value.y}`,n.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},n.h("g",{class:"vue-flow__connection"},f?n.h(f,{sourceX:H,sourceY:C,sourcePosition:T,targetX:g.value.x,targetY:g.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:v,targetNode:y.value,targetHandle:ae,markerEnd:b.value,markerStart:_.value,connectionStatus:d.value}):n.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":_.value})))}}}),Y0=["id","markerWidth","markerHeight","markerUnits","orient"],W0={name:"MarkerType",compatConfig:{MODE:3}},q0=n.defineComponent({...W0,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(Pr).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(Pr).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,Y0))}}),X0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},J0={name:"MarkerDefinitions",compatConfig:{MODE:3}},Z0=n.defineComponent({...J0,setup(e){const{id:t,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=He(),r=n.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ko(d,t);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.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(l,s)=>(n.openBlock(),n.createElementBlock("svg",X0,[n.createElementVNode("defs",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,c=>(n.openBlock(),n.createBlock(q0,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Q0={name:"Edges",compatConfig:{MODE:3}},ek=n.defineComponent({...Q0,setup(e){const{findNode:t,getEdges:o,elevateEdgesOnSelect:i}=He();return(a,r)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(Z0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o),l=>(n.openBlock(),n.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:n.normalizeStyle({zIndex:n.unref(x1)(l,n.unref(t),n.unref(i))})},[n.createVNode(n.unref(j0),{id:l.id},null,8,["id"])],4))),128)),n.createVNode(n.unref(K0))],64))}}),tk=n.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:f,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:b,nodeDragThreshold:N,nodesDraggable:h,elementsSelectable:k,nodesConnectable:P,nodesFocusable:A,hooks:G}=He(),K=n.ref(null);n.provide(yu,K),n.provide(hu,e.id);const v=n.inject(aa),T=n.getCurrentInstance(),H=ku(),{node:C,parentNode:ae}=_u(e.id),{emit:E,on:Y}=G1(C,l),S=n.toRef(()=>typeof C.draggable>"u"?h.value:C.draggable),W=n.toRef(()=>typeof C.selectable>"u"?k.value:C.selectable),ee=n.toRef(()=>typeof C.connectable>"u"?P.value:C.connectable),ie=n.toRef(()=>typeof C.focusable>"u"?A.value:C.focusable),O=n.computed(()=>W.value||S.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),U=n.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),ne=n.computed(()=>{const x=C.type||"default",R=v==null?void 0:v[`node-${x}`];if(R)return R;let V=C.template||m.value[x];if(typeof V=="string"&&T){const Q=Object.keys(T.appContext.components);Q&&Q.includes(x)&&(V=n.resolveComponent(x,!1))}return V&&typeof V!="string"?V:(l.error(new it(et.NODE_TYPE_MISSING,V)),!1)}),ce=gu({id:e.id,el:K,disabled:()=>!S.value,selectable:W,dragHandle:()=>C.dragHandle,onStart(x){E.dragStart(x)},onDrag(x){E.drag(x)},onStop(x){E.dragStop(x)},onClick(x){j(x)}}),ge=n.computed(()=>C.class instanceof Function?C.class(C):C.class),se=n.computed(()=>{const x=(C.style instanceof Function?C.style(C):C.style)||{},R=C.width instanceof Function?C.width(C):C.width,V=C.height instanceof Function?C.height(C):C.height;return!x.width&&R&&(x.width=typeof R=="string"?R:`${R}px`),!x.height&&V&&(x.height=typeof V=="string"?V:`${V}px`),x}),pe=n.toRef(()=>Number(C.zIndex??se.value.zIndex??0));return u(x=>{(x.includes(e.id)||!x.length)&&xe()}),n.onMounted(()=>{n.watch(()=>C.hidden,(x=!1,R,V)=>{!x&&K.value&&(e.resizeObserver.observe(K.value),V(()=>{K.value&&e.resizeObserver.unobserve(K.value)}))},{immediate:!0,flush:"post"})}),n.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{n.nextTick(()=>{d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])})}),n.watch([()=>C.position.x,()=>C.position.y,()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=ae.value)==null?void 0:x.computedPosition.z},pe,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=ae.value)==null?void 0:x.dimensions.width}],([x,R,V,Q,me,ve])=>{const Ee={x,y:R,z:ve+(p.value&&C.selected?1e3:0)};typeof V<"u"&&typeof Q<"u"?C.computedPosition=_1({x:V,y:Q,z:me},Ee):C.computedPosition=Ee},{flush:"post",immediate:!0}),n.watch([()=>C.extent,f],([x,R],[V,Q])=>{(x!==V||R!==Q)&&be()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?gr(()=>U).toBe(!0).then(be):be(),()=>C.hidden?null:n.h("div",{ref:K,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${ne.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:C.selected,selectable:W.value,parent:C.isParent},ge.value],style:{visibility:U.value?"visible":"hidden",zIndex:C.computedPosition.z??pe.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:O.value?"all":"none",...se.value},tabIndex:ie.value?0:void 0,role:ie.value?"group":void 0,"aria-describedby":y.value?void 0:`${Dd}-${t}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:Te,onMousemove:Ae,onMouseleave:fe,onContextmenu:ke,onClick:j,onDblclick:we,onKeydown:L},[n.h(ne.value===!1?m.value.default:ne.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...Y},selected:C.selected,resizing:C.resizing,dragging:ce.value,connectable:ee.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??pe.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:xe})]);function be(){const x=C.computedPosition,{computedPosition:R,position:V}=jr(C,_.value?ia(x,b.value):x,l.error,f.value,ae.value);(C.computedPosition.x!==R.x||C.computedPosition.y!==R.y)&&(C.computedPosition={...C.computedPosition,...R}),(C.position.x!==V.x||C.position.y!==V.y)&&(C.position=V)}function xe(){K.value&&d([{id:e.id,nodeElement:K.value,forceUpdate:!0}])}function Te(x){ce!=null&&ce.value||E.mouseEnter({event:x,node:C})}function Ae(x){ce!=null&&ce.value||E.mouseMove({event:x,node:C})}function fe(x){ce!=null&&ce.value||E.mouseLeave({event:x,node:C})}function ke(x){return E.contextMenu({event:x,node:C})}function we(x){return E.doubleClick({event:x,node:C})}function j(x){W.value&&(!i.value||!S.value||N.value>0)&&qr(C,r.value,c,s,a,!1,K.value),E.click({event:x,node:C})}function L(x){if(!(zr(x)||y.value))if(Ld.includes(x.key)&&W.value){const R=x.key==="Escape";qr(C,r.value,c,s,a,R,K.value)}else S.value&&C.selected&&to[x.key]&&(x.preventDefault(),g.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,H({x:to[x.key].x,y:to[x.key].y},x.shiftKey))}}});function nk(e={includeHiddenNodes:!1}){const{nodes:t}=He();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 ok={class:"vue-flow__nodes vue-flow__container"},ik={name:"Nodes",compatConfig:{MODE:3}},ak=n.defineComponent({...ik,setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=He(),a=nk(),r=n.ref();return n.watch(a,l=>{l&&n.nextTick(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),n.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));n.nextTick(()=>o(s))})}),n.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(n.openBlock(),n.createElementBlock("div",ok,[r.value?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(n.unref(t),(c,d,u,m)=>{const f=[c.id];if(m&&m.key===c.id&&n.isMemoSame(m,f))return m;const p=(n.openBlock(),n.createBlock(n.unref(tk),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=f,p},s,0),128)):n.createCommentVNode("",!0)]))}});function rk(){const{emits:e}=He();n.onMounted(()=>{if(cu()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new it(et.MISSING_STYLES))}})}const lk=n.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),sk={name:"VueFlow",compatConfig:{MODE:3}},ck=n.defineComponent({...sk,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const i=e,a=n.useSlots(),r=br(i,"modelValue",o),l=br(i,"nodes",o),s=br(i,"edges",o),c=He(i),d=W1({modelValue:r,nodes:l,edges:s},i,c);return X1(o,c.hooks),F0(),rk(),n.provide(aa,a),n.onUnmounted(d),t(c),(u,m)=>(n.openBlock(),n.createElementBlock("div",{ref:n.unref(c).vueFlowRef,class:"vue-flow"},[n.createVNode(D0,null,{default:n.withCtx(()=>[n.createVNode(ek),lk,n.createVNode(ak),n.renderSlot(u.$slots,"zoom-pane")]),_:3}),n.renderSlot(u.$slots,"default"),n.createVNode(U0)],512))}}),dk={name:"Panel",compatConfig:{MODE:3}},Tu=n.defineComponent({...dk,props:{position:{}},setup(e){const t=e,{userSelectionActive:o}=He(),i=n.computed(()=>`${t.position}`.split("-"));return(a,r)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["vue-flow__panel",i.value]),style:n.normalizeStyle({pointerEvents:n.unref(o)?"none":"all"})},[n.renderSlot(a.$slots,"default")],6))}}),Sn=["red","amber","green","teal","blue","indigo","violet","pink"],Vu={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function uk(e){return typeof e=="string"&&e in Vu}const mk={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},fk=.15;function pk(e){const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let o=t[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function hk(e){if(typeof e!="string")return null;const t=pk(e);if(!t||t.s<fk)return null;let o=null,i=1/0;for(const a of Sn){const r=Math.abs(t.h-mk[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function ut(e){var i;const t=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(uk(t))return t;const o=e==null?void 0:e.properties;return hk((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function tl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const yk={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)"},gk={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 Mu(e,t=!1){return e?t?gk[e]:yk[e]:null}function io(e){return Vu[e]}function ao(e){return`var(--em-swatch-${e}-bar)`}const bk=["width","height","innerHTML"],_k=n.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const t={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(n.openBlock(),n.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:t[e.name]??""},null,8,bk))}}),Ge=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Ve=Ge(_k,[["__scopeId","data-v-92c1dba8"]]);function kk(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function Ek(e,t){const o=kk(t);return o?e(o):t.split("-")[1]??t}function Nk(e){const t=o=>e.params!=null&&o in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return"em.check.name3";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return t("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return t("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";default:return e.ruleId}}function Bu(e,t){const o=Nk(t);if(t.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=t.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,t.params)}function wk(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const vk={class:"em-inline-issue__msgs"},$n=Ge(n.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const t=e,o=t.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=n.computed(()=>t.refId?t.controller.issuesByRef.value.get(t.refId)??[]:[]),r=n.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(n.openBlock(),n.createElementBlock("p",{key:0,class:n.normalizeClass(["em-inline-issue",`is-${r.value}`])},[n.createVNode(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),n.createElementVNode("span",vk,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,(c,d)=>(n.openBlock(),n.createElementBlock("span",{key:d},n.toDisplayString(n.unref(Bu)(n.unref(o).t,c)),1))),128))])],2)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),xk={class:"em-mlang"},Ik={class:"em-mlang__tabs",role:"tablist"},Ck=["aria-selected","onClick"],Sk={key:0,class:"em-mlang__dot"},Rn=Ge(n.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const r=n.ref(a());n.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(r.value)||(r.value=a())});function l(d){var u,m;return!!((m=(u=o.modelValue)==null?void 0:u[d])!=null&&m.trim())}const s=n.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[r.value])??""});function c(d){const u={...o.modelValue};d.trim()===""?delete u[r.value]:u[r.value]=d,i("update:modelValue",u)}return(d,u)=>(n.openBlock(),n.createElementBlock("div",xk,[n.createElementVNode("div",Ik,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.languages,m=>(n.openBlock(),n.createElementBlock("button",{key:m,type:"button",class:n.normalizeClass(["em-mlang__tab",{"is-active":r.value===m}]),role:"tab","aria-selected":r.value===m,onClick:f=>r.value=m},[n.createTextVNode(n.toDisplayString(m),1),l(m)?(n.openBlock(),n.createElementBlock("span",Sk,"•")):n.createCommentVNode("",!0)],10,Ck))),128))]),e.multiline?(n.openBlock(),n.createBlock(n.unref(oe.BSTextArea),{key:0,name:`${e.name}-${r.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(oe.BSTextInput),{key:1,name:`${e.name}-${r.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),$k=["disabled"],Rk={class:"em-panel__sub-label"},Ak={class:"em-field"},Tk={class:"em-field"},Vk={class:"em-field"},Mk={class:"em-class"},Bk={class:"em-field"},Dk={class:"em-field"},Ok={class:"em-field"},Lk={class:"em-field"},Pk={class:"em-multilang"},zk={class:"em-multilang"},Uk={class:"em-jpa"},Fk={class:"em-field"},Hk={class:"em-field"},Gk={class:"em-field"},jk={class:"em-swatch"},Kk={class:"em-swatch__row"},Yk=["title"],Wk=["title","onClick"],Du=Ge(n.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=n.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=n.computed(()=>{var C;return ut(((C=l.value)==null?void 0:C.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=C=>C;function f(C){return C==="inherit"?a.t("em.common.inherit"):C}function p(C){r.value&&a.updateEntity(r.value.modelId,C)}function y(C,ae,E){var S;const Y=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(C==="physicalName"?{table:{...Y,physicalName:E}}:{table:{...Y,logicalName:{...Y.logicalName,[ae]:E}}})}function g(C){p({description:Object.keys(C).length?C:void 0})}function _(C,ae){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[C]:ae}})}function b(C,ae){_(C,ae)}const N=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:ae.discriminatorType)??"inherit"}),h=n.computed(()=>{var C,ae;return!((ae=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&ae.useDiscriminator)});function k(C){_("discriminatorType",C==="inherit"?void 0:C)}function P(C){p({hasPersonalInfo:C})}function A(C){p({superClass:C.trim()||void 0})}function G(C){p({schema:C.trim()||void 0})}function K(C){p({abstractClass:C})}const v=n.computed(()=>{var C,ae;return((ae=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:ae.join(", "))??""});function T(C){const ae=C.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:ae.length?ae:void 0})}function H(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,ae)=>{var E,Y,S;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[e.collapsible?(n.openBlock(),n.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:ae[0]||(ae[0]=W=>i("toggle"))},[n.createElementVNode("span",Rk,[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),n.createTextVNode(" "+n.toDisplayString(e.title||r.value.name||n.unref(a).t("em.entity.fallback")),1)])])):n.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode($n,{controller:n.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),n.createElementVNode("label",Ak,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.name")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":ae[1]||(ae[1]=W=>p({name:W}))},null,8,["model-value"])]),n.createElementVNode("label",Tk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.stereotype")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":ae[2]||(ae[2]=W=>p({stereotype:W}))},null,8,["model-value"])]),n.createElementVNode("label",Vk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":ae[3]||(ae[3]=W=>p({packageName:W}))},null,8,["model-value"])]),n.createElementVNode("fieldset",Mk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.classLegend")),1),n.createElementVNode("label",Bk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.superClass")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:n.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":ae[4]||(ae[4]=W=>A(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("label",Dk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.interfaces")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:n.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":v.value,"onUpdate:modelValue":ae[5]||(ae[5]=W=>T(W))},null,8,["placeholder","model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-abstract",class:"em-check",label:n.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":ae[6]||(ae[6]=W=>K(W))},null,8,["label","model-value"])]),n.createElementVNode("label",Ok,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.tablePhysical")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":ae[7]||(ae[7]=W=>y("physicalName",null,W))},null,8,["model-value"])]),n.createElementVNode("label",Lk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.schema")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"ent-schema",width:"100%",placeholder:n.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":ae[8]||(ae[8]=W=>G(W))},null,8,["placeholder","model-value"])]),n.createElementVNode("fieldset",Pk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.tableLogicalLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,W=>{var ee,ie;return n.openBlock(),n.createElementBlock("label",{key:W,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(W),1),n.createVNode(n.unref(oe.BSTextInput),{name:`ent-logical-${W}`,width:"100%","model-value":((ie=(ee=r.value.table)==null?void 0:ee.logicalName)==null?void 0:ie[W])??"","onUpdate:modelValue":O=>y("logicalName",W,O)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("fieldset",zk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:"ent-desc",languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),n.createElementVNode("fieldset",Uk,[ae[13]||(ae[13]=n.createElementVNode("legend",null,"JPA",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(d,W=>{var ee;return n.createVNode(n.unref(oe.BSCheckbox),{key:W.key,name:`jpa-${W.key}`,class:"em-check",label:W.label,"model-value":!!((ee=r.value.jpaAttrs)!=null&&ee[W.key]),"onUpdate:modelValue":ie=>b(W.key,ie)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),n.createElementVNode("label",Fk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discColumn")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"disc-col",width:"100%",placeholder:n.unref(a).t("em.entity.discColumnPlaceholder"),disabled:h.value,"model-value":((Y=r.value.jpaAttrs)==null?void 0:Y.discriminatorColumnName)??"","onUpdate:modelValue":ae[9]||(ae[9]=W=>_("discriminatorColumnName",W.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),n.createElementVNode("label",Hk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discType")),1),n.createVNode(n.unref(oe.BSSelect),{disabled:h.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":f,"onUpdate:modelValue":ae[10]||(ae[10]=W=>W&&k(W))},null,8,["disabled","model-value"])]),n.createElementVNode("label",Gk,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.discLength")),1),n.createVNode(n.unref(oe.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:h.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":ae[11]||(ae[11]=W=>_("discriminatorLength",W||void 0))},null,8,["disabled","model-value"])])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:n.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":P},null,8,["label","model-value"]),n.createElementVNode("fieldset",jk,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.entity.headerColor")),1),n.createElementVNode("div",Kk,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:ae[12]||(ae[12]=W=>H(null))},"∅",10,Yk),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),W=>(n.openBlock(),n.createElementBlock("button",{key:W,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":s.value===W}]),style:n.normalizeStyle({background:n.unref(ao)(W)}),title:n.unref(io)(W),onClick:ee=>H(W)},null,14,Wk))),128))])])],64)):n.createCommentVNode("",!0)],8,$k)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-92e146f7"]]),Ou={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.descPlaceholderKo":"Description (ko)","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3":'Duplicate entity name: "{name}"',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.unspecified":"unspecified"},Lu={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.descPlaceholderKo":"説明(ko)","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3":'エンティティ名が重複しています: "{name}"',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.unspecified":"未指定"},Pu={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.descPlaceholderKo":"설명(ko)","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3":'엔티티 이름이 중복됩니다: "{name}"',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.unspecified":"미지정"},qk=["ko","en","ja"],nl={ko:Pu,en:Ou,ja:Lu};function Ct(e,t,o){let a=(nl[e]??nl.ko)[t]??nl.ko[t]??t;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const zu=["ko","en","ja","zh"];function Xk(e){if(e)for(const t of zu){const o=e[t];if(o)return o}}function ol(e){const t=Xk(e.label);return t?`${e.groupCode} (${t})`:e.groupCode}function Jk(e,t){const o=t.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:zu.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const Zk=["aria-expanded","placeholder"],Qk=["aria-selected","onClick","onMouseenter"],eE={key:0,class:"gcc__opt gcc__opt--empty"},Uu=Ge(n.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,i=t,a=(v,T)=>Ct(o.locale??"ko",v,T),r=n.ref(),l=n.ref(),s=n.ref(),c=n.ref(""),d=n.ref(!1),u=n.ref(-1),m=n.ref({}),f=n.computed(()=>o.items.find(v=>v.groupCode===o.modelValue)),p=n.computed(()=>f.value?ol(f.value):"");n.watch(p,v=>{d.value||(c.value=v)},{immediate:!0});const y=n.computed(()=>c.value===p.value?o.items:Jk(o.items,c.value));function g(){var T;const v=(T=r.value)==null?void 0:T.getBoundingClientRect();v&&(m.value={left:`${v.left}px`,top:`${v.bottom}px`,width:`${v.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(v=>v.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",K)}function b(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",K)}n.onBeforeUnmount(b);function N(){_(),n.nextTick(()=>{var v;return(v=l.value)==null?void 0:v.select()})}function h(){d.value||_(),u.value=0}function k(v){i("update:modelValue",v.groupCode),c.value=ol(v),b()}function P(){i("update:modelValue",void 0),c.value="",b()}function A(){c.value.trim()===""?P():(c.value=p.value,b())}function G(v){var T;if(v.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),v.preventDefault();else if(v.key==="ArrowUp")u.value=Math.max(u.value-1,0),v.preventDefault();else if(v.key==="Enter"){const H=y.value[u.value];H&&k(H),v.preventDefault()}else v.key==="Escape"&&(c.value=p.value,b(),(T=l.value)==null||T.blur())}function K(v){var H,C;const T=v.target;!((H=r.value)!=null&&H.contains(T))&&!((C=s.value)!=null&&C.contains(T))&&A()}return(v,T)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":T[0]||(T[0]=H=>c.value=H),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:h,onKeydown:G},null,40,Zk),[[n.vModelText,c.value]]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[d.value?(n.openBlock(),n.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:n.normalizeStyle(m.value),role:"listbox"},[n.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:T[1]||(T[1]=n.withModifiers(()=>{},["prevent"])),onClick:P},n.toDisplayString(a("em.common.noneParen")),33),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:H.groupCode,class:n.normalizeClass(["gcc__opt",{"is-active":C===u.value,"is-selected":H.groupCode===e.modelValue}]),role:"option","aria-selected":H.groupCode===e.modelValue,onMousedown:T[2]||(T[2]=n.withModifiers(()=>{},["prevent"])),onClick:ae=>k(H),onMouseenter:ae=>u.value=C},n.toDisplayString(n.unref(ol)(H)),43,Qk))),128)),y.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",eE,n.toDisplayString(a("em.groupCode.noMatch")),1))],4)):n.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),tE=["disabled"],nE={class:"em-aw__toolbar"},oE={class:"em-aw__count"},iE={class:"em-aw__scroll"},aE={class:"em-aw__table"},rE={class:"c-name"},lE={class:"c-type"},sE={class:"c-logical"},cE={class:"c-col"},dE={class:"c-constraints"},uE={class:"c-del"},mE={class:"c-expand"},fE=["title","onClick","onKeydown"],pE={class:"c-constraints"},hE={class:"em-aw__cflags"},yE=["title"],gE={colspan:"8"},bE={class:"em-aw__detail"},_E={class:"em-aw__dgroup"},kE={class:"em-aw__df"},EE={class:"em-aw__df"},NE={class:"em-aw__df"},wE={class:"em-aw__dgroup"},vE={class:"em-aw__dgroup"},xE={class:"em-aw__df"},IE={key:0,class:"em-aw__df"},CE={class:"em-aw__df"},SE={class:"c-expand"},$E={class:"em-aw__caret is-static","aria-hidden":"true"},RE={class:"c-del"},AE={class:"c-expand"},TE=["title","onClick","onKeydown"],VE={class:"em-aw__embed-label"},ME={class:"em-aw__ro"},BE={class:"em-aw__ro"},DE={class:"c-constraints"},OE={class:"em-aw__ro"},LE={key:0,class:"em-aw__detail-row em-aw__embed-detail"},PE={colspan:"8"},zE={class:"em-aw__detail"},UE={class:"em-aw__dgroup"},FE={key:0,class:"em-aw__df"},HE={class:"em-aw__df"},GE={class:"em-aw__df"},jE={key:0},KE={colspan:"99",class:"em-aw__empty"},YE=6,WE=5,fa="__OWN__",qE=Ge(n.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(I=>I.modelId===t.entityId)??null),a=n.computed(()=>{var I;return((I=i.value)==null?void 0:I.stereotype)==="JPA_EMBEDDABLE"}),r=n.computed(()=>new Set(o.selectedAttrIds.value)),l=n.computed(()=>{var I;return(((I=i.value)==null?void 0:I.attributes)??[]).filter(D=>D.attrType!=="DIVIDER").length}),s=n.ref(new Set);function c(I){return s.value.has(I)}function d(I){const D=new Set(s.value);D.has(I)?D.delete(I):D.add(I),s.value=D}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 m(I){return I==="none"?o.t("em.common.noneParen"):I}const f=I=>I;function p(I,D){i.value&&o.updateAttribute(i.value.modelId,I.modelId,D)}function y(I){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,I.modelId)}function g(I,D){p(I,{naturalId:D||void 0,naturalIdMutable:D?I.naturalIdMutable:void 0})}function _(){return{naturalId:void 0,naturalIdMutable:void 0}}function b(I,D){p(I,{identifier:D,...D?_():{}})}function N(I,D){p(I,{transient:D||void 0,...D?_():{}})}function h(I){return!!I.transient}const k=I=>I.value,P=I=>I.label;function A(I,D){if(!D)return;const B=ae.value.find(de=>de.type===D);if(B){const de=I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"};p(I,{type:D,customType:void 0,dbAttrs:[{...de,dataType:B.dataType,length:B.length,scale:B.scale}]});return}p(I,D===Rt?{type:D}:{type:D,customType:void 0})}function G(I,D){p(I,{customType:D.trim()===""?void 0:D})}function K(I,D){const de={...I.dbAttrs[0]??{modelId:I.modelId+".c",physicalName:I.name,dataType:"VARCHAR"},...D};D.dataType!==void 0&&!_o.has(de.dataType)&&(de.scale=void 0),p(I,{dbAttrs:[de]})}function v(I){var D;return _o.has(((D=I.dbAttrs[0])==null?void 0:D.dataType)??"")}function T(I,D){K(I,{logicalName:Object.keys(D).length?D:void 0})}function H(I){return I.personalInfoAttributeType??"none"}function C(I,D){p(I,{personalInfoAttributeType:D==="none"?void 0:D})}const ae=n.computed(()=>o.predefinedCustomTypeCatalog.value),E=n.computed(()=>o.embeddableCatalog.value);function Y(I){var D,B;return((D=I.label)==null?void 0:D.ko)??((B=I.label)==null?void 0:B.en)??I.type}function S(I){!I||!i.value||o.addPredefinedEmbed(i.value.modelId,I)}const W=n.computed(()=>o.groupCodeCatalog.value);function ee(I){var D;return((D=W.value.find(B=>B.groupCode===I.groupCode))==null?void 0:D.codes)??[]}function ie(I){return["none",...ee(I)]}function O(I){return I==="none"?"none":I.code}function U(I){var B,de;if(I==="none")return o.t("em.common.noneParen");const D=((B=I.label)==null?void 0:B.ko)??((de=I.label)==null?void 0:de.en);return D?`${I.code} (${D})`:I.code}function ne(I,D){i.value&&o.setAttributeGroupCode(i.value.modelId,I.modelId,D)}function ce(I,D){p(I,{defaultValue:D==="none"?void 0:D})}function ge(I,D){p(I,{defaultValue:D.trim()===""?void 0:D})}function se(I){return I.attrType.startsWith("EMBED")&&I.dbAttrs.length>0}function pe(I,D,B){const de=I.dbAttrs.map((J,X)=>{if(X!==D)return J;const te={...J,...B};for(const re of Object.keys(B))B[re]===void 0&&delete te[re];return te});i.value&&o.setEmbedColumns(i.value.modelId,I.modelId,de)}function be(I,D,B){pe(I,D,{logicalName:Object.keys(B).length?B:void 0})}function xe(I,D){var J,X,te;if(I.attrType==="EMBED_PREDEF"){const re=(J=o.embeddableCatalog.value.find(Ne=>Ne.type===I.type))==null?void 0:J.fields[D];return re?{name:re.name,physicalName:re.physicalName,dataType:re.dataType,length:re.length,shareable:re.shareable,logicalName:re.logicalName}:void 0}const B=(X=I.embedded)==null?void 0:X.embeddableRef;if(!B)return;const de=(te=o.state.logical.entities.find(re=>re.modelId===B))==null?void 0:te.attributes.flatMap(re=>re.dbAttrs)[D];return de?{physicalName:de.physicalName,dataType:de.dataType,length:de.length,scale:de.scale,logicalName:de.logicalName}:void 0}function Te(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.dataType)||((de=I.dbAttrs[D])==null?void 0:de.dataType)||""}function Ae(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.length)??((de=I.dbAttrs[D])==null?void 0:de.length)}function fe(I,D){var B,de;return((B=xe(I,D))==null?void 0:B.scale)??((de=I.dbAttrs[D])==null?void 0:de.scale)}const ke=["inherit","true","false"];function we(I){return I==="inherit"?o.t("em.common.inherit"):I}function j(I){return(I==null?void 0:I.updatable)===void 0?"inherit":I.updatable?"true":"false"}function L(I,D,B){pe(I,D,{updatable:B==="inherit"?void 0:B==="true"})}function x(I,D){K(I,{updatable:D==="inherit"?void 0:D==="true"})}const R=["inherit","true","false"];function V(I){return I==="inherit"?o.t("em.common.inherit"):I}function Q(I){return(I==null?void 0:I.insertable)===void 0?"inherit":I.insertable?"true":"false"}function me(I,D,B){pe(I,D,{insertable:B==="inherit"?void 0:B==="true"})}function ve(I,D){K(I,{insertable:D==="inherit"?void 0:D==="true"})}const Ee=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),$e=n.computed(()=>mn(Ee.value.flatMap(I=>I.attributes.flatMap(D=>D.dbAttrs)))),Me=n.computed(()=>Ee.value.flatMap(I=>I.attributes.filter(D=>D.attrType==="NORMAL"&&D.dbAttrs.length===1&&D.dbAttrs[0]).map(D=>{var B;return{modelId:D.dbAttrs[0].modelId,physical:D.dbAttrs[0].physicalName||D.name,isCurrency:D.type==="Currency",ownerName:I.modelId===((B=i.value)==null?void 0:B.modelId)?void 0:I.name}})));function Ue(){const I=[...Me.value].sort((D,B)=>Number(B.isCurrency)-Number(D.isCurrency));return[fa,...I.map(D=>D.modelId)]}function Ye(I){if(I===fa)return o.t("em.attr.sharedOwn");const D=Me.value.find(de=>de.modelId===I);if(!D)return I;const B=D.ownerName?`${D.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:B,physical:D.physical,mode:D.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function Fe(I){return(I==null?void 0:I.sharedColumnRef)??fa}function gt(I,D,B){pe(I,D,{sharedColumnRef:B===fa?void 0:B})}function w(I){return(I==null?void 0:I.sharedColumnRef)!=null}function M(I){var D;return((D=zn(I,$e.value))==null?void 0:D.physicalName)??""}return(I,D)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",nE,[n.createElementVNode("span",oE,n.toDisplayString(n.unref(o).t("em.attr.section",{n:l.value})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:D[0]||(D[0]=B=>n.unref(o).addAttribute(i.value.modelId))},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.attr.addDivider"),onClick:D[1]||(D[1]=B=>n.unref(o).addDivider(i.value.modelId))},null,8,["caption"]),E.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"140px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:E.value,"value-provider":B=>B.type,"label-provider":Y,"onUpdate:modelValue":S},null,8,["placeholder","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",iE,[n.createElementVNode("table",aE,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[D[2]||(D[2]=n.createElementVNode("th",{class:"c-expand"},null,-1)),n.createElementVNode("th",rE,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),n.createElementVNode("th",lE,n.toDisplayString(n.unref(o).t("em.attr.typePlaceholder")),1),n.createElementVNode("th",sE,n.toDisplayString(n.unref(o).t("em.attr.logicalPlaceholder")),1),n.createElementVNode("th",cE,n.toDisplayString(n.unref(o).t("em.attr.columnPhysical")),1),D[3]||(D[3]=n.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),D[4]||(D[4]=n.createElementVNode("th",{class:"c-len"},"len",-1)),n.createElementVNode("th",dE,n.toDisplayString(n.unref(o).t("em.attr.constraints")),1),D[5]||(D[5]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.attributes,B=>{var de,J,X,te,re,Ne,$,Z,F,Ie;return n.openBlock(),n.createElementBlock(n.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__divider-row",{"is-focused":r.value.has(B.modelId)}])},[D[6]||(D[6]=n.createElementVNode("td",{class:"c-expand"},null,-1)),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",{colspan:YE,class:"em-aw__divider-note"},n.toDisplayString(n.unref(o).t("em.attr.dividerNote")),1),n.createElementVNode("td",uE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2)):se(B)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-parent",{"is-focused":r.value.has(B.modelId)}])},[n.createElementVNode("td",SE,[n.createElementVNode("span",$E,[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),n.createElementVNode("td",{colspan:WE,class:"em-aw__embed-note"},n.toDisplayString(n.unref(o).t("em.attr.embedChildCols",{n:B.dbAttrs.length})),1),n.createElementVNode("td",RE,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])])],2),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.dbAttrs,(ye,ze)=>{var z,q,ue,Ce,Be,Oe;return n.openBlock(),n.createElementBlock(n.Fragment,{key:ye.modelId},[n.createElementVNode("tr",{class:n.normalizeClass(["em-aw__embed-col",{"em-aw__open":c(ye.modelId)}])},[n.createElementVNode("td",AE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(ye.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(ye.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:he=>d(ye.modelId),onKeydown:[n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(he=>d(ye.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,TE)]),n.createElementVNode("td",VE,"↳ "+n.toDisplayString(((z=xe(B,ze))==null?void 0:z.name)??((q=xe(B,ze))==null?void 0:q.physicalName)??n.unref(o).t("em.attr.colFallback",{n:ze+1})),1),D[13]||(D[13]=n.createElementVNode("td",null,null,-1)),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-embed-logical-${ye.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((Ce=(ue=xe(B,ze))==null?void 0:ue.logicalName)==null?void 0:Ce.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ye.logicalName,"onUpdate:modelValue":he=>be(B,ze,he)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-embed-col-${ye.modelId}`,width:"100%",disabled:w(ye),placeholder:((Be=xe(B,ze))==null?void 0:Be.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":w(ye)?M(ye):ye.physicalName,"onUpdate:modelValue":he=>pe(B,ze,{physicalName:he})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":ye.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createElementVNode("span",ME,n.toDisplayString(Te(B,ze)),1)]),n.createElementVNode("td",null,[n.createElementVNode("span",BE,n.toDisplayString(Ae(B,ze)??""),1)]),n.createElementVNode("td",DE,[n.createElementVNode("span",OE,n.toDisplayString(fe(B,ze)!=null?`scale ${fe(B,ze)}`:""),1)]),D[14]||(D[14]=n.createElementVNode("td",null,null,-1))],2),c(ye.modelId)?(n.openBlock(),n.createElementBlock("tr",LE,[D[17]||(D[17]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",PE,[n.createElementVNode("div",zE,[n.createElementVNode("fieldset",UE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.overrideLegend")),1),(Oe=xe(B,ze))!=null&&Oe.shareable?(n.openBlock(),n.createElementBlock("label",FE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":Fe(ye),items:Ue(),"value-provider":f,"label-provider":Ye,"onUpdate:modelValue":he=>he&&gt(B,ze,he)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",HE,[D[15]||(D[15]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":Q(ye),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":he=>he&&me(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",GE,[D[16]||(D[16]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:w(ye),"model-value":w(ye)?"false":j(ye),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":he=>he&&L(B,ze,he)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):n.createCommentVNode("",!0)],64)}),128))],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("tr",{class:n.normalizeClass({"is-focused":r.value.has(B.modelId),"em-aw__open":c(B.modelId)})},[n.createElementVNode("td",mE,[n.createElementVNode("span",{class:n.normalizeClass(["em-aw__caret",{"is-open":c(B.modelId)}]),role:"button",tabindex:"0",title:n.unref(o).t(c(B.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ye=>d(B.modelId),onKeydown:[n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["enter"]),n.withKeys(n.withModifiers(ye=>d(B.modelId),["prevent"]),["space"])]},[n.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,fE)]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":ye=>p(B,{name:ye})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:!!B.groupCode,items:n.unref(Ql)(B.type,ae.value),"value-provider":k,"label-provider":P,"model-value":B.type,"onUpdate:modelValue":ye=>A(B,ye)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),B.type===n.unref(Rt)?(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":B.customType??"","onUpdate:modelValue":ye=>G(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):n.createCommentVNode("",!0)]),n.createElementVNode("td",null,[n.createVNode(Rn,{name:`aw-logical-${B.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(de=B.dbAttrs[0])==null?void 0:de.logicalName,"onUpdate:modelValue":ye=>T(B,ye)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:h(B),"model-value":((J=B.dbAttrs[0])==null?void 0:J.physicalName)??"","onUpdate:modelValue":ye=>K(B,{physicalName:ye})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode($n,{controller:n.unref(o),"ref-id":(X=B.dbAttrs[0])==null?void 0:X.modelId},null,8,["controller","ref-id"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:h(B),items:n.unref(Jl)(((te=B.dbAttrs[0])==null?void 0:te.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":f,"label-provider":n.unref(qa),"model-value":((re=B.dbAttrs[0])==null?void 0:re.dataType)??"","onUpdate:modelValue":ye=>ye&&K(B,{dataType:ye})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:h(B),"model-value":(Ne=B.dbAttrs[0])==null?void 0:Ne.length,"onUpdate:modelValue":ye=>K(B,{length:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",pE,[n.createElementVNode("div",hE,[n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-pk-${B.modelId}`,label:"PK","model-value":B.identifier,disabled:a.value||h(B),"onUpdate:modelValue":ye=>b(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nn-${B.modelId}`,label:"NN","model-value":B.notNull,disabled:h(B),"onUpdate:modelValue":ye=>p(B,{notNull:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-uq-${B.modelId}`,label:"UQ","model-value":!!(($=B.dbAttrs[0])!=null&&$.unique),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{unique:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),n.createElementVNode("td",{class:"c-del",title:y(B)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ye=>n.unref(o).removeAttribute(i.value.modelId,B.modelId)},null,8,["onClick"])],8,yE)],2),c(B.modelId)?(n.openBlock(),n.createElementBlock("tr",{key:0,class:n.normalizeClass(["em-aw__detail-row",{"is-focused":r.value.has(B.modelId)}])},[D[12]||(D[12]=n.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),n.createElementVNode("td",gE,[n.createElementVNode("div",bE,[n.createElementVNode("fieldset",_E,[D[10]||(D[10]=n.createElementVNode("legend",null,"DB",-1)),n.createElementVNode("label",kE,[D[7]||(D[7]=n.createElementVNode("span",null,"scale",-1)),n.createVNode(n.unref(oe.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"72px",placeholder:"scale",disabled:h(B)||!v(B),"model-value":(Z=B.dbAttrs[0])==null?void 0:Z.scale,"onUpdate:modelValue":ye=>K(B,{scale:ye||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((F=B.dbAttrs[0])!=null&&F.autoIncrement),disabled:h(B)||!B.identifier,"onUpdate:modelValue":ye=>K(B,{autoIncrement:ye})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createElementVNode("label",EE,[D[8]||(D[8]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-ins-${B.modelId}`,width:"110px",disabled:h(B),"model-value":Q(B.dbAttrs[0]),items:R,"value-provider":f,"label-provider":V,"onUpdate:modelValue":ye=>ye&&ve(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",NE,[D[9]||(D[9]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{name:`aw-upd-${B.modelId}`,width:"110px",disabled:h(B),"model-value":j(B.dbAttrs[0]),items:ke,"value-provider":f,"label-provider":we,"onUpdate:modelValue":ye=>ye&&x(B,ye)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),n.createElementVNode("fieldset",wE,[D[11]||(D[11]=n.createElementVNode("legend",null,"JPA",-1)),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier,"onUpdate:modelValue":ye=>N(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||h(B),"onUpdate:modelValue":ye=>g(B,ye)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:h(B)||!B.naturalId,"onUpdate:modelValue":ye=>p(B,{naturalIdMutable:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`aw-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((Ie=B.dbAttrs[0])!=null&&Ie.multiValue),disabled:h(B),"onUpdate:modelValue":ye=>K(B,{multiValue:ye||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("fieldset",vE,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.attr.semanticLegend")),1),n.createElementVNode("label",xE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"150px","model-value":H(B),items:u,"value-provider":f,"label-provider":m,"onUpdate:modelValue":ye=>ye&&C(B,ye)},null,8,["model-value","onUpdate:modelValue"])]),W.value.length?(n.openBlock(),n.createElementBlock("label",IE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":B.groupCode,items:W.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":ye=>ne(B,ye)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",CE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),ee(B).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"150px","model-value":B.defaultValue??"none",items:ie(B),"value-provider":O,"label-provider":U,"onUpdate:modelValue":ye=>ye&&ce(B,ye)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"150px",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":B.defaultValue??"","onUpdate:modelValue":ye=>ge(B,ye)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])])])],2)):n.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",jE,[n.createElementVNode("td",KE,n.toDisplayString(n.unref(o).t("em.attr.empty")),1)]))])])])],8,tE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-a64a6817"]]),XE=["disabled"],JE={class:"em-idxw__list"},ZE={class:"em-idxw__list-head"},QE=["onClick"],eN={class:"em-idxw__item-name"},tN={key:0,class:"em-idxw__badge"},nN={class:"em-idxw__item-cnt"},oN={key:0,class:"em-idxw__empty"},iN={key:0,class:"em-idxw__edit"},aN={class:"em-idxw__form"},rN={class:"em-field em-idxw__name"},lN={class:"em-field"},sN=["value","placeholder"],cN={class:"em-idxw__transfer"},dN={class:"em-idxw__pane"},uN={class:"em-idxw__pane-head"},mN={class:"em-idxw__cols"},fN=["onClick"],pN=["title"],hN={key:0,class:"em-idxw__empty"},yN={class:"em-idxw__arrows"},gN={class:"em-idxw__pane"},bN={class:"em-idxw__pane-head"},_N={class:"em-idxw__cols"},kN={class:"em-idxw__col-name"},EN=["title"],NN={class:"em-idxw__col-ops"},wN=["title","disabled","onClick"],vN=["title","disabled","onClick"],xN=["title","onClick"],IN={key:0,class:"em-idxw__empty"},CN={key:1,class:"em-idxw__edit em-idxw__edit--empty"},SN=Ge(n.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find(v=>v.modelId===t.entityId)??null),a=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.indexes)??[]}),r=n.computed(()=>{var v;return((v=i.value)==null?void 0:v.attributes)??[]}),l=n.ref(null);n.watch(a,v=>{var T;v.some(H=>H.modelId===l.value)||(l.value=((T=v[0])==null?void 0:T.modelId)??null)},{immediate:!0});const s=n.computed(()=>a.value.find(v=>v.modelId===l.value)??null),c=n.computed(()=>i.value?go(i.value,o.superClassCatalog.value):[]),d=n.computed(()=>{var v;return new Set(((v=s.value)==null?void 0:v.columns.map(T=>T.columnRef))??[])}),u=n.computed(()=>[...r.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:f(v),inherited:!1})),...c.value.filter(v=>!d.value.has(v.modelId)).map(v=>({ref:v.modelId,label:p(v),inherited:!0}))]),m=n.ref(new Set);n.watch(l,()=>m.value=new Set);function f(v){var H;const T=(H=v.dbAttrs[0])==null?void 0:H.physicalName;return T&&T!==v.name?`${v.name} (${T})`:v.name}function p(v){return v.physicalName&&v.physicalName!==v.field?`${v.field} (${v.physicalName})`:v.field}function y(v){const T=r.value.find(C=>C.modelId===v);if(T)return f(T);const H=c.value.find(C=>C.modelId===v);return H?p(H):v}function g(v){return yo(v)}function _(v,T){i.value&&o.updateIndex(i.value.modelId,v,T)}function b(){var T;if(!i.value)return;const v=De();o.addIndex(i.value.modelId,{modelId:v,name:`idx_${(((T=i.value.indexes)==null?void 0:T.length)??0)+1}`,unique:!1,columns:[]}),l.value=v}function N(v){i.value&&o.removeIndex(i.value.modelId,v)}function h(v){s.value&&_(s.value.modelId,{parameters:v.trim()===""?void 0:v})}function k(v){const T=new Set(m.value);T.has(v)?T.delete(v):T.add(v),m.value=T}function P(){const v=s.value;if(!v||!m.value.size)return;const T=[...m.value].map(H=>({columnRef:H,descending:!1}));_(v.modelId,{columns:[...v.columns,...T]}),m.value=new Set}function A(v){const T=s.value;T&&_(T.modelId,{columns:T.columns.filter((H,C)=>C!==v)})}function G(v,T){const H=s.value;H&&_(H.modelId,{columns:H.columns.map((C,ae)=>ae===v?{...C,descending:T}:C)})}function K(v,T){const H=s.value;if(!H)return;const C=v+T;if(C<0||C>=H.columns.length)return;const ae=[...H.columns];[ae[v],ae[C]]=[ae[C],ae[v]],_(H.modelId,{columns:ae})}return(v,T)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!n.unref(o).editable.value},[n.createElementVNode("aside",JE,[n.createElementVNode("div",ZE,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.section",{n:a.value.length})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:b},null,8,["caption"])]),n.createElementVNode("ul",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.modelId,class:n.normalizeClass(["em-idxw__item",{"is-active":H.modelId===l.value}]),onClick:C=>l.value=H.modelId},[n.createElementVNode("span",eN,n.toDisplayString(H.name||n.unref(o).t("em.attr.nameless")),1),H.unique?(n.openBlock(),n.createElementBlock("span",tN,"UQ")):n.createCommentVNode("",!0),n.createElementVNode("span",nN,n.toDisplayString(H.columns.length),1)],10,QE))),128)),a.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",oN,n.toDisplayString(n.unref(o).t("em.index.empty")),1))])]),s.value?(n.openBlock(),n.createElementBlock("section",iN,[n.createElementVNode("div",aN,[n.createElementVNode("label",rN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.namePlaceholder")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":T[0]||(T[0]=H=>_(s.value.modelId,{name:H}))},null,8,["model-value"]),n.createVNode($n,{controller:n.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":T[1]||(T[1]=H=>_(s.value.modelId,{unique:H}))},null,8,["model-value"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:n.unref(o).t("em.index.delete"),onClick:T[2]||(T[2]=H=>N(s.value.modelId))},null,8,["caption"])]),n.createElementVNode("label",lN,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:n.unref(o).t("em.index.conditionPlaceholderWide"),onChange:T[3]||(T[3]=H=>h(H.target.value))},null,40,sN)]),n.createElementVNode("div",cN,[n.createElementVNode("div",dN,[n.createElementVNode("div",uN,n.toDisplayString(n.unref(o).t("em.index.availColumns",{n:u.value.length})),1),n.createElementVNode("ul",mN,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,H=>(n.openBlock(),n.createElementBlock("li",{key:H.ref,class:n.normalizeClass(["em-idxw__col",{"is-sel":m.value.has(H.ref)}]),onClick:C=>k(H.ref)},[n.createTextVNode(n.toDisplayString(H.label),1),H.inherited?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,pN)):n.createCommentVNode("",!0)],10,fN))),128)),u.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",hN,n.toDisplayString(n.unref(o).t("em.index.allColumnsUsed")),1))])]),n.createElementVNode("div",yN,[n.createVNode(n.unref(oe.BSButton),{caption:n.unref(o).t("em.index.addArrow"),disabled:!m.value.size,onClick:P},null,8,["caption","disabled"])]),n.createElementVNode("div",gN,[n.createElementVNode("div",bN,n.toDisplayString(n.unref(o).t("em.index.indexColumns",{n:s.value.columns.length})),1),n.createElementVNode("ul",_N,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value.columns,(H,C)=>(n.openBlock(),n.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[n.createElementVNode("span",kN,[n.createTextVNode(n.toDisplayString(y(H.columnRef)),1),g(H.columnRef)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-idxw__inh",title:n.unref(o).t("em.index.inheritedColTitle")},n.toDisplayString(n.unref(o).t("em.index.inheritedBadge")),9,EN)):n.createCommentVNode("",!0)]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":H.descending,"onUpdate:modelValue":ae=>G(C,ae)},null,8,["name","model-value","onUpdate:modelValue"]),n.createElementVNode("span",NN,[n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:ae=>K(C,-1)},"↑",8,wN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:n.unref(o).t("em.index.moveDown"),disabled:C===s.value.columns.length-1,onClick:ae=>K(C,1)},"↓",8,vN),n.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:n.unref(o).t("em.index.removeColumn"),onClick:ae=>A(C)},"✕",8,xN)])]))),128)),s.value.columns.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("li",IN,n.toDisplayString(n.unref(o).t("em.index.noColumns")),1))])])])])):(n.openBlock(),n.createElementBlock("section",CN,n.toDisplayString(n.unref(o).t("em.index.selectPrompt")),1))],8,XE)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-76de4c26"]]),$N={class:"em-op-src"},RN=["placeholder"],AN={class:"em-op-src__actions"},Fu=Ge(n.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(l,s)=>Ct(t.locale??"ko",l,s),a=n.ref(t.sourceCode);function r(){t.onSave(a.value),o.close()}return(l,s)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.opSource.title",{name:t.operationName})},{default:n.withCtx(()=>[n.createElementVNode("div",$N,[n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,RN),[[n.vModelText,a.value]]),n.createElementVNode("div",AN,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),TN=["disabled"],VN={class:"em-ow__toolbar"},MN={class:"em-ow__count"},BN={class:"em-ow__scroll"},DN={class:"em-ow__table"},ON={class:"c-name"},LN={class:"c-desc"},PN={class:"c-pii"},zN={class:"c-src"},UN={class:"c-del"},FN={key:0},HN={colspan:"6",class:"em-ow__empty"},GN=Ge(n.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModal(),a=n.computed(()=>o.state.logical.entities.find(y=>y.modelId===t.entityId)??null),r=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],l=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function s(y){return y==="none"?o.t("em.common.noneParen"):y}const c=y=>y;function d(y,g){a.value&&o.updateOperation(a.value.modelId,y.modelId,g)}function u(y,g,_){d(y,{description:{...y.description,[g]:_}})}function m(y){return y.personalInfoAttributeType??"none"}function f(y,g){d(y,{personalInfoAttributeType:g==="none"?void 0:g})}function p(y){i.openModal({component:Fu,bind:{operationName:y.name,sourceCode:y.sourceCode??"",locale:o.uiLocale.value,onSave:g=>d(y,{sourceCode:g})}})}return(y,g)=>{var _,b;return a.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!n.unref(o).editable.value},[n.createElementVNode("div",VN,[n.createElementVNode("span",MN,n.toDisplayString(n.unref(o).t("em.op.section",{n:((_=a.value.operations)==null?void 0:_.length)??0})),1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>n.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),n.createElementVNode("div",BN,[n.createElementVNode("table",DN,[n.createElementVNode("thead",null,[n.createElementVNode("tr",null,[n.createElementVNode("th",ON,n.toDisplayString(n.unref(o).t("em.attr.namePlaceholder")),1),g[1]||(g[1]=n.createElementVNode("th",{class:"c-vis"},"visibility",-1)),n.createElementVNode("th",LN,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createElementVNode("th",PN,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createElementVNode("th",zN,n.toDisplayString(n.unref(o).t("em.op.body")),1),g[2]||(g[2]=n.createElementVNode("th",{class:"c-del"},null,-1))])]),n.createElementVNode("tbody",null,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value.operations??[],N=>{var h;return n.openBlock(),n.createElementBlock("tr",{key:N.modelId},[n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":k=>d(N,{name:k})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:r,"value-provider":c,"label-provider":c,"onUpdate:modelValue":k=>k&&d(N,{visibility:k})},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSTextInput),{name:`ow-desc-${N.modelId}`,width:"100%",placeholder:n.unref(o).t("em.op.descPlaceholderKo"),"model-value":((h=N.description)==null?void 0:h.ko)??"","onUpdate:modelValue":k=>u(N,"ko",k)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":m(N),items:l,"value-provider":c,"label-provider":s,"onUpdate:modelValue":k=>k&&f(N,k)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("td",null,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:k=>p(N)},null,8,["caption","onClick"])]),n.createElementVNode("td",UN,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:k=>n.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])])}),128)),(b=a.value.operations)!=null&&b.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("tr",FN,[n.createElementVNode("td",HN,n.toDisplayString(n.unref(o).t("em.op.empty")),1)]))])])])],8,TN)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1c255914"]]),jN={class:"em-detail__tabs"},KN=["onClick"],YN={key:0,class:"em-detail__narrow"},WN=Ge(n.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=oe.useModalHandle(),a=n.computed(()=>o.state.logical.entities.find(s=>s.modelId===t.entityId)??null);n.watch(a,s=>{s||i.close()});const r=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],l=n.ref("basics");return(s,c)=>{var d;return n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:n.unref(o).t("em.detail.title",{name:((d=a.value)==null?void 0:d.name)??""})},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["em-detail",{"is-maximized":n.unref(i).maximized}])},[n.createElementVNode("nav",jN,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(r,u=>n.createElementVNode("button",{key:u.key,type:"button",class:n.normalizeClass(["em-detail__tab",{"is-active":l.value===u.key}]),onClick:m=>l.value=u.key},n.toDisplayString(n.unref(o).t(u.labelKey)),11,KN)),64))]),n.createElementVNode("div",{class:n.normalizeClass(["em-detail__body",{"is-readonly":!n.unref(o).editable.value}])},[l.value==="basics"?(n.openBlock(),n.createElementBlock("div",YN,[n.createVNode(Du,{controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):l.value==="columns"?(n.openBlock(),n.createBlock(qE,{key:1,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):l.value==="indexes"?(n.openBlock(),n.createBlock(SN,{key:2,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(n.openBlock(),n.createBlock(GN,{key:3,controller:n.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):n.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-785c4770"]]);function pa(e,t,o){e.openModal({component:WN,bind:{controller:n.markRaw(t),entityId:o}})}const Hu="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function qN(e){var i;const t=JSON.parse(JSON.stringify(e));t.modelId=De(),t.name=`${e.name}_copy`,(i=t.table)!=null&&i.physicalName&&(t.table.physicalName=`${t.table.physicalName}_copy`);const o=new Map;for(const a of t.attributes){const r=De();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=De()}for(const a of t.indexes??[]){a.modelId=De();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of t.operations??[]){const r=De();o.set(a.modelId,r),a.modelId=r}return{clone:t,idMap:o}}const XN=220;function JN(e,t){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||XN));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of t.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of t.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const il=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),An=Symbol("editorController");function Gu(e="m1",t="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:t,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function ha(e,t){const o=[];for(const i of t.remove)o.push(Wn(e,i));for(const i of t.update)o.push(gn(e,i.attributeId,i.patch));for(const i of t.add)o.push(Ut(e,i));return o}function ro(e,t,o){return{...e,entities:e.entities.map(i=>i.modelId===t?{...i,attributes:o(i.attributes)}:i)}}function lo(e,t){const o=[];for(const[i,a]of fh(e,t,De))o.push(...ha(i,a));return o}function ju(e,t,o){const i=new Set(o.remove);return ro(e,t,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function al(e,t){const o=So(e,t,De),i=ha(t,o),a=ju(e,t,o);return i.push(...lo(a,t)),i}function Ku(e){return e.attributes.flatMap(t=>t.dbAttrs).map(t=>({...t,modelId:De()}))}function ZN(e,t){var d;const o=e.entities.find(u=>u.modelId===t);if(!o)return[];const i=[];let a;if(!o.attributes.some(u=>u.identifier)){const u=o.attributes.reduce((p,y)=>Math.max(p,y.order),-1)+1,m=new Set(o.attributes.map(p=>p.name));let f="id";for(let p=2;m.has(f);p++)f=`id${p}`;a={modelId:De(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:u,dbAttrs:[{modelId:De(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Ut(t,a))}const r=[];for(const u of e.entities)for(const m of u.attributes){if(((d=m.embedded)==null?void 0:d.embeddableRef)!==t)continue;const f=e.associations.find(_=>_.modelId===m.embedded.associationRef);if(!f)continue;const p=f.end1.entityRef===u.modelId,y=p?f.end1:f.end2,g=p?f.end2:f.end1;r.push({ownerId:u.modelId,dispId:m.modelId,assocId:f.modelId,end1:{entityRef:u.modelId,multiplicity:y.multiplicity,navigable:y.navigable,composition:!1},end2:{entityRef:t,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1}})}const l={...e,entities:e.entities.map(u=>{if(u.modelId===t)return a?{...u,stereotype:"JPA_ENTITY",attributes:[...u.attributes,a]}:{...u,stereotype:"JPA_ENTITY"};const m=new Set(r.filter(f=>f.ownerId===u.modelId).map(f=>f.dispId));return m.size?{...u,attributes:u.attributes.filter(f=>!m.has(f.modelId))}:u}),associations:e.associations.map(u=>{const m=r.find(f=>f.assocId===u.modelId);return m?{...u,end1:m.end1,end2:m.end2}:u})},s=So(l,t,De);for(const u of r){const m=s.add.find(f=>{var p;return((p=f.derivedFrom)==null?void 0:p.associationRef)===u.assocId});m&&(u.end2.attributeRef=m.modelId)}for(const u of r)i.push(Wn(u.ownerId,u.dispId)),i.push(Ii(u.assocId,{end1:u.end1,end2:u.end2}));i.push(...ha(t,s));const c=ju(l,t,s);return i.push(...lo(c,t)),i}function QN(e,t){const o=e.entities.find(r=>r.modelId===t);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===t,s=r.end2.entityRef===t;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var k;return((k=h.embedded)==null?void 0:k.associationRef)===r.modelId}))continue;const u=De(),m=d.attributes.reduce((h,k)=>Math.max(h,k.order),-1)+1,f=new Set(d.attributes.map(h=>h.name)),p=a(o.name);let y=p;for(let h=2;f.has(y);h++)y=`${p}${h}`;const g=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:De()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:t}};i.push(Ut(c,_));const b=l?"end2":"end1",N=l?"end1":"end2";i.push(Ii(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:De()},[N]:{entityRef:t,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function ew(e=Gu(),t={}){var Fe,gt;const o=n.reactive(e);let i=new mr(o);const a=n.ref(t.embeddableCatalog??[]),r=n.ref(t.groupCodeCatalog??[]),l=n.ref(t.predefinedCustomTypeCatalog??[]),s=n.ref(t.superClassCatalog??[]),c=n.ref(t.languages??["ko","en","ja","zh"]),d=n.ref(t.userLanguage??"ko"),u=n.ref(t.uiLocale??"ko"),m=(w,M)=>Ct(u.value,w,M),f=n.ref(t.reservedWords),p=n.ref(t.selectableDataTypes),y=n.ref(t.largeEntityThreshold),g=n.ref(t.flagEntitiesWithoutRelations??!1),_=n.ref(!1),b=n.ref(!1),N=n.ref(!1),h=n.ref(0),k=n.ref(null);let P=0;const A=w=>{if(t.onNotice){t.onNotice(w);return}k.value={text:w,id:++P}},G=n.ref(((Fe=t.meta)==null?void 0:Fe.schemaVersion)??1),K=n.ref(((gt=t.meta)==null?void 0:gt.opWriteEnabled)??!1),v=n.computed(()=>G.value>=2&&K.value),T=t.historyTransport,H=n.computed(()=>v.value&&T!==void 0),C=t.restoreTransport,ae=n.ref(0),E=n.computed(()=>v.value&&S.value&&C!==void 0);async function Y(w){if(!C||!S.value)return{ok:!1,reason:"unavailable"};const M=await C(w);return M.ok&&ae.value++,M}const S=n.ref(!(G.value>=2&&K.value===!1)),W=n.ref("LOGICAL_PHYSICAL"),ee=n.ref("straight"),ie=n.ref(!0),O=n.ref(!0),U=n.ref(null),ne=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?{entityId:U.value.entityId,attrId:U.value.anchor}:null}),ce=n.computed(()=>{var w;return((w=U.value)==null?void 0:w.kind)==="attribute"?U.value.ids:[]}),ge=n.computed(()=>{var w,M;return((w=U.value)==null?void 0:w.kind)==="entity"?U.value.id:((M=U.value)==null?void 0:M.kind)==="attribute"?U.value.entityId:null}),se=n.ref(null);let pe=0;const be=n.ref(null),xe=n.ref(null);let Te=t.meta;function Ae(){i.onChange(()=>{_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,h.value++})}Ae();let fe=null,ke=null;function we(){ke==null||ke(),ke=null,fe=null}function j(){if(we(),!v.value||!t.opTransport)return;const w=new pc({diagramId:o.layout.diagramId,state:o,transport:t.opTransport,origin:"gui",onFreeze:M=>{S.value=!1,xe.value=M},onError:t.onOpError});w.seed((Te==null?void 0:Te.revSeed)??{}),ke=w.attach(i),fe=w}j();const L=n.computed(()=>Vl(o.logical,o.layout)),x=n.computed(()=>({reservedWords:f.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),R=n.computed(()=>ts(o.logical,x.value)),V=n.computed(()=>{const w=new Map;for(const M of R.value){if(!M.targetRef)continue;const I=w.get(M.targetRef);I?I.push(M):w.set(M.targetRef,[M])}return w}),Q=w=>{S.value&&i.execute(w)},me=w=>o.layout.entityLayouts.some(M=>M.entityRef===w&&!!M.locked),ve=w=>o.layout.groupLayouts.some(M=>M.groupRef===w&&!!M.locked),Ee=w=>{const M=o.logical.associations.find(I=>I.modelId===w);return!!M&&(me(M.end1.entityRef)||me(M.end2.entityRef))},$e=(w,M,I)=>{if(me(w))return;const D=gn(w,M,I),B=ro(o.logical,w,J=>J.map(X=>X.modelId===M?{...X,...I}:X)),de=lo(B,w);Q(de.length?Je("속성 수정",[D,...de]):D)};function Me(w){const M=w.map(te=>o.layout.entityLayouts.find(re=>re.entityRef===te)).filter(te=>!!te);if(!M.length)return{location:{x:40,y:40},size:{width:400,height:300}};let I=1/0,D=1/0,B=-1/0,de=-1/0;for(const te of M){const re=te.geo.size.width||220,Ne=te.geo.size.height||140;I=Math.min(I,te.geo.location.x),D=Math.min(D,te.geo.location.y),B=Math.max(B,te.geo.location.x+re),de=Math.max(de,te.geo.location.y+Ne)}const J=40,X=28;return{location:{x:I-J,y:D-J-X},size:{width:B-I+J*2,height:de-D+J*2+X}}}function Ue(w,M,I){var te;const D=o.layout.groupLayouts.find(re=>re.groupRef===w),B=(D==null?void 0:D.geo.location)??M,de=M.x-B.x,J=M.y-B.y,X=[Ds(w,M),...I.map(re=>Yn(re.id,re.location))];if(de||J){const re=new Set(((te=o.logical.groups.find(Ne=>Ne.modelId===w))==null?void 0:te.memberEntityRefs)??[]);for(const Ne of o.logical.associations){if(!re.has(Ne.end1.entityRef)||!re.has(Ne.end2.entityRef))continue;const $=o.layout.associationLayouts.find(Z=>Z.associationRef===Ne.modelId);$&&$.waypoints.length&&X.push(Js(Ne.modelId,de,J))}for(const Ne of(D==null?void 0:D.memberNoteRefs)??[]){const $=o.layout.notes.find(Z=>Z.modelId===Ne);$&&X.push(Co(Ne,{x:$.geo.location.x+de,y:$.geo.location.y+J}))}}return X}const Ye={state:o,resolved:L,issues:R,issuesByRef:V,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:b,dirty:N,revision:h,notice:k,editable:S,schemaVersion:G,opWriteEnabled:K,opMode:v,opConflict:xe,historyTransport:T,historyAvailable:H,restoreTransport:C,restoreAvailable:E,restoreToSeq:Y,reloadRequest:ae,displayMode:W,routingMode:ee,showGrid:ie,showMinimap:O,selection:U,selectedAttr:ne,selectedAttrIds:ce,inspectedEntityId:ge,focusRequest:se,clipboard:be,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(w){S.value=w&&v.value},setEmbeddableCatalog(w){a.value=w},setGroupCodeCatalog(w){r.value=w},setPredefinedCustomTypeCatalog(w){l.value=w},setSuperClassCatalog(w){s.value=w},selectAttribute(w,M,I="replace"){const D=U.value,B=(D==null?void 0:D.kind)==="attribute"&&D.entityId===w;if(I==="replace"||!B){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}if(I==="toggle"){const $=D.ids.includes(M),Z=$?D.ids.filter(Ie=>Ie!==M):[...D.ids,M];if(!Z.length){U.value=null;return}const F=$&&D.anchor===M?Z[Z.length-1]:$?D.anchor:M;U.value={kind:"attribute",entityId:w,ids:Z,anchor:F};return}const de=o.logical.entities.find($=>$.modelId===w),J=[...(de==null?void 0:de.attributes)??[]].sort(($,Z)=>$.order-Z.order).map($=>$.modelId),X=J.indexOf(D.anchor),te=J.indexOf(M);if(X<0||te<0){U.value={kind:"attribute",entityId:w,ids:[M],anchor:M};return}const[re,Ne]=X<=te?[X,te]:[te,X];U.value={kind:"attribute",entityId:w,ids:J.slice(re,Ne+1),anchor:D.anchor}},moveAttributeFocus(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find(J=>J.modelId===M.entityId);if(!I||!I.attributes.length)return!1;const D=I.attributes.findIndex(J=>J.modelId===M.anchor);if(D<0)return!1;const B=Math.min(Math.max(D+w,0),I.attributes.length-1);if(B===D)return!0;const de=I.attributes[B].modelId;return U.value={kind:"attribute",entityId:M.entityId,ids:[de],anchor:de},!0},nudgeSelectedAttributes(w){const M=U.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const I=o.logical.entities.find($=>$.modelId===M.entityId);if(!I)return!1;const D=I.attributes,B=new Set(M.ids),de=D.map(($,Z)=>B.has($.modelId)?Z:-1).filter($=>$>=0);if(!de.length)return!1;const J=Math.min(...de),X=D.filter($=>!B.has($.modelId)),te=D.slice(0,J).filter($=>!B.has($.modelId)).length;let re;if(w<0){if(te<=0)return!0;re=te-1}else{if(X.length-te<=0)return!0;re=te+1}if(me(M.entityId))return!0;const Ne=D.filter($=>B.has($.modelId)).map($=>$.modelId);return Q(pr(M.entityId,Ne,re)),!0},deleteSelection(){if(!S.value)return!1;const w=U.value;if(!w)return!1;if(w.kind==="attribute"){if(me(w.entityId))return!1;const M=w.ids;if(!M.length)return!1;M.length===1?Ye.removeAttribute(w.entityId,M[0]):Ye.removeAttributes(w.entityId,M)}else if(w.kind==="entity"){if(me(w.id))return!1;Ye.removeEntity(w.id)}else if(w.kind==="note")Ye.removeNote(w.id);else if(w.kind==="group"){if(ve(w.id))return!1;Ye.removeGroup(w.id)}else Ye.removeAssociation(w.id);return U.value=null,!0},nudgeNodes(w,M,I){if(!w.length||M===0&&I===0)return!1;const D=new Set(o.logical.entities.map(re=>re.modelId)),B=new Set(o.logical.groups.map(re=>re.modelId)),de=new Set(o.layout.notes.map(re=>re.modelId)),J=new Set;for(const re of w){if(!B.has(re))continue;const Ne=o.logical.groups.find($=>$.modelId===re);for(const $ of(Ne==null?void 0:Ne.memberEntityRefs)??[])J.add($)}const X=[],te=[];for(const re of w)if(B.has(re)){if(ve(re))continue;const Ne=o.layout.groupLayouts.find(Ie=>Ie.groupRef===re);if(!Ne)continue;const $=o.logical.groups.find(Ie=>Ie.modelId===re),Z=(($==null?void 0:$.memberEntityRefs)??[]).map(Ie=>{var ze;const ye=((ze=o.layout.entityLayouts.find(z=>z.entityRef===Ie))==null?void 0:ze.geo.location)??{x:0,y:0};return{id:Ie,location:{x:ye.x+M,y:ye.y+I}}}),F={x:Ne.geo.location.x+M,y:Ne.geo.location.y+I};X.push(Je("그룹 이동",Ue(re,F,Z))),te.push("g:"+re)}else if(D.has(re)){if(J.has(re)||me(re))continue;const Ne=o.layout.entityLayouts.find($=>$.entityRef===re);if(!Ne)continue;X.push(Yn(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("e:"+re)}else if(de.has(re)){const Ne=o.layout.notes.find($=>$.modelId===re);if(!Ne)continue;X.push(Co(re,{x:Ne.geo.location.x+M,y:Ne.geo.location.y+I})),te.push("n:"+re)}return X.length?(Q(Je("이동",X,"nudge:"+te.sort().join(","))),!0):!1},requestFocus(w){se.value={id:w,nonce:++pe}},undo:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(fe==null||fe.flush(),i.markSavePoint())},loadDiagram(w,M){we(),o.logical=w.logical,o.layout=w.layout,i=new mr(o),Ae(),G.value=(M==null?void 0:M.schemaVersion)??1,K.value=(M==null?void 0:M.opWriteEnabled)??!1,S.value=!(G.value>=2&&K.value===!1),Te=M,xe.value=null,U.value=null,_.value=i.canUndo,b.value=i.canRedo,N.value=i.isDirty,j()},flush(){fe==null||fe.flush()},whenOpsSettled(){return(fe==null?void 0:fe.whenSettled())??Promise.resolve()},addEntity(w="NewEntity",M={x:80,y:80}){const I=De(),D={modelId:I,name:w,stereotype:"JPA_ENTITY",table:{physicalName:w.toLowerCase()},attributes:[{modelId:De(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:De(),physicalName:"id",dataType:"BIGINT"}]}]};return Q(Ei(D,{location:{...M},size:{width:220,height:140}})),I},renameEntity(w,M){me(w)||Q(Ss(w,M))},updateEntity(w,M){if(me(w))return;const I=Cs(w,M),D=o.logical.entities.find(J=>J.modelId===w),B=M.stereotype==="JPA_EMBEDDABLE"&&!!D&&D.stereotype!=="JPA_EMBEDDABLE",de=!!M.stereotype&&M.stereotype!=="JPA_EMBEDDABLE"&&!!D&&D.stereotype==="JPA_EMBEDDABLE";if(B&&D){const J=D.attributes.filter($=>$.identifier&&!$.derivedFrom).map($=>gn(w,$.modelId,{identifier:!1})),X=ro({...o.logical,entities:o.logical.entities.map($=>$.modelId===w?{...$,stereotype:"JPA_EMBEDDABLE"}:$)},w,$=>$.map(Z=>Z.identifier&&!Z.derivedFrom?{...Z,identifier:!1}:Z)),te=al(X,w),re=QN(o.logical,w),Ne=[I,...J,...te,...re];Q(Ne.length>1?Je("임베더블 변환",Ne):I);return}if(de){const J=ZN(o.logical,w),X=[I,...J];Q(X.length>1?Je("엔터티 전환",X):I);return}Q(I)},moveEntity(w,M){me(w)||Q(Yn(w,M))},resizeEntity(w,M){me(w)||Q($s(w,M))},removeEntity(w){me(w)||Q(Is(w))},setEntitySwatch(w,M){Q(Rs(w,M))},setEntityCollapsed(w,M){Q(As(w,M))},setEntityLocked(w,M){Q(Ts(w,M))},isEntityLocked(w){return me(w)},collapseAll(){Q(fr(!0))},expandAll(){Q(fr(!1))},setAttributeSwatch(w,M,I){Q(Ni(w,M,I))},dragGroup(w,M,I){ve(w)||Q(Je("그룹 이동",Ue(w,M,I)))},resizeGroup(w,M){ve(w)||Q(Os(w,M))},setGroupSwatch(w,M){Q(Ls(w,M))},setGroupLocked(w,M){Q(Ps(w,M))},isGroupLocked(w){return ve(w)},updateGroup(w,M){ve(w)||Q(Vs(w,M))},createGroup(w,M){if(!w.length)return null;const I=[];for(const de of o.logical.groups)for(const J of w)de.memberEntityRefs.includes(J)&&I.push(vi(de.modelId,J));const D=De(),B={modelId:D,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...w]};return I.push(wi(B,Me(w))),Q(Je("그룹 생성",I)),U.value=null,D},addEmptyGroup(w,M){const I=De();return Q(wi({modelId:I,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...w},size:{width:360,height:260}})),I},removeGroup(w){ve(w)||Q(Ms(w))},dropEntity(w,M,I){var de;if(me(w))return;const D=((de=o.logical.groups.find(J=>J.memberEntityRefs.includes(w)))==null?void 0:de.modelId)??null,B=[Yn(w,M)];D!==I&&(D&&B.push(vi(D,w)),I&&B.push(Bs(I,w))),Q(Je("이동",B))},ungroupEntity(w){const M=o.logical.groups.find(I=>I.memberEntityRefs.includes(w));M&&Q(vi(M.modelId,w))},dropNote(w,M,I){var de;const D=((de=o.layout.groupLayouts.find(J=>{var X;return(X=J.memberNoteRefs)==null?void 0:X.includes(w)}))==null?void 0:de.groupRef)??null,B=[Co(w,M)];D!==I&&(D&&B.push(rc(D,w)),I&&B.push(ac(I,w))),Q(Je("이동",B))},addPredefinedEmbed(w,M){if(me(w))return;const I=a.value.find(te=>te.type===M),D=o.logical.entities.find(te=>te.modelId===w);if(!I||!D)return;const B=D.attributes.reduce((te,re)=>Math.max(te,re.order),-1)+1,de=De(),J=I.fields.map(()=>({modelId:De(),physicalName:"",dataType:""})),X={modelId:de,name:I.defaultName,type:I.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:B,dbAttrs:J};return Q(Ut(w,X)),de},addAttribute(w,M={}){if(me(w))return M.modelId??"";const I=o.logical.entities.find(Ne=>Ne.modelId===w),D=I?I.attributes.length:0,B=M.modelId??De(),de=M.name??`field${D}`,J={modelId:B,name:de,type:M.type??Xa,attrType:M.attrType??"NORMAL",identifier:M.identifier??!1,notNull:M.notNull??!1,order:D,dbAttrs:M.dbAttrs??[{modelId:De(),physicalName:de,dataType:"VARCHAR",length:255}],...M},X=Ut(w,J),te=ro(o.logical,w,Ne=>[...Ne,J]),re=lo(te,w);return Q(re.length?Je("속성 추가",[X,...re]):X),B},addDivider(w){if(me(w))return"";const M=o.logical.entities.find(de=>de.modelId===w),I=M?M.attributes.length:0,D=De();return Q(Ut(w,{modelId:D,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:I,dbAttrs:[]})),D},updateAttribute(w,M,I){$e(w,M,I)},setAttributeGroupCode(w,M,I){$e(w,M,{groupCode:I,type:I?Ln:Xa})},setEmbedColumns(w,M,I){var te,re;if(me(w))return;const D=gn(w,M,{dbAttrs:I}),B=(te=o.logical.entities.find(Ne=>Ne.modelId===w))==null?void 0:te.attributes.find(Ne=>Ne.modelId===M),de=(re=B==null?void 0:B.embedded)==null?void 0:re.associationRef,J=de?o.logical.associations.find(Ne=>Ne.modelId===de):void 0,X=[];J&&de&&(J.end1.legacyEmbedRaw&&X.push(Qt(de,"end1",{legacyEmbedRaw:void 0})),J.end2.legacyEmbedRaw&&X.push(Qt(de,"end2",{legacyEmbedRaw:void 0}))),Q(X.length?Je("임베드 컬럼 수정",[D,...X]):D)},removeAttribute(w,M){if(me(w))return;if(Ri(o.logical,w,M)){A(Hu);return}const I=Wn(w,M),D=ro(o.logical,w,de=>de.filter(J=>J.modelId!==M)),B=lo(D,w);Q(B.length?Je("속성 삭제",[I,...B]):I)},removeAttributes(w,M){var X;if(!M.length||me(w))return;const I=M.filter(te=>!Ri(o.logical,w,te));if(I.length<M.length&&A(Hu),!I.length)return;const D=I.map(te=>Wn(w,te)),B=new Set(I),de=ro(o.logical,w,te=>te.filter(re=>!B.has(re.modelId))),J=[...D,...lo(de,w)];Q(J.length===1?J[0]:Je("속성 삭제",J)),((X=U.value)==null?void 0:X.kind)==="attribute"&&U.value.entityId===w&&(U.value=null)},setAttributeSwatches(w,M,I){M.length&&(M.length===1?Q(Ni(w,M[0],I)):Q(Je("속성 색상",M.map(D=>Ni(w,D,I)))))},reorderAttributes(w,M,I){!M.length||me(w)||Q(pr(w,M,I))},addIndex(w,M){me(w)||Q(Ks(w,M))},updateIndex(w,M,I){me(w)||Q(Ys(w,M,I))},removeIndex(w,M){me(w)||Q(Ws(w,M))},addOperation(w,M={}){var J;if(me(w))return M.modelId??"";const I=o.logical.entities.find(X=>X.modelId===w),D=((J=I==null?void 0:I.operations)==null?void 0:J.length)??0,B=M.modelId??De(),de={modelId:B,name:M.name??`method${D}`,visibility:M.visibility??"PACKAGE",order:D,...M};return Q(zs(w,de)),B},updateOperation(w,M,I){me(w)||Q(Us(w,M,I))},removeOperation(w,M){me(w)||Q(Fs(w,M))},reorderOperations(w,M,I){!M.length||me(w)||Q(Hs(w,M,I))},setOperationSwatch(w,M,I){Q(Gs(w,M,I))},addAssociation(w,M,I,D){if(me(w)||me(M))return"";const B=De(),de={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:I},end2:{entityRef:M,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},J={...o.logical,associations:[...o.logical.associations,de]},X=So(J,M,De),te=X.add[0];te&&(de.end2.attributeRef=te.modelId);const re={associationRef:B,waypoints:[],sourceColumnRef:I,targetColumnRef:(te==null?void 0:te.modelId)??D},Ne=xi(de,re),$=ha(M,X);return Q($.length?Je("관계 추가",[Ne,...$]):Ne),B},addEmbedAssociation(w,M){if(me(w))return;const I=o.logical.entities.find(ze=>ze.modelId===w),D=o.logical.entities.find(ze=>ze.modelId===M);if(!I||!D||D.stereotype!=="JPA_EMBEDDABLE")return;const B=De(),de=De(),J=De(),X=I.attributes.reduce((ze,z)=>Math.max(ze,z.order),-1)+1,te=Ku(D),re=ze=>ze&&ze.charAt(0).toLowerCase()+ze.slice(1),Ne=new Set(I.attributes.map(ze=>ze.name)),$=re(D.name);let Z=$;for(let ze=2;Ne.has(Z);ze++)Z=`${$}${ze}`;const F={modelId:de,name:Z,type:D.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:X,dbAttrs:te,embedded:{associationRef:B,embeddableRef:M}},Ie={modelId:B,end1:{entityRef:w,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:J},end2:{entityRef:M,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:de}},ye={associationRef:B,waypoints:[],sourceColumnRef:de,targetColumnRef:void 0};return Q(Je("임베드 추가",[Ut(w,F),xi(Ie,ye)])),B},setEmbedCardinality(w,M){var $;if(Ee(w))return;const I=o.logical.associations.find(Z=>Z.modelId===w);if(!I)return;let D,B;for(const Z of o.logical.entities){const F=Z.attributes.find(Ie=>{var ye;return((ye=Ie.embedded)==null?void 0:ye.associationRef)===w&&Ie.attrType==="EMBED_OWN"});if(F){D=Z.modelId,B=F;break}}if(!D||!B)return;const de=B.embedded.embeddableRef,J=I.end2.entityRef===de?"end2":"end1",X=I[J];if(X.multiplicity===M)return;const te=Z=>Z==="ZERO_OR_MORE_INSTANCES"||Z==="ONE_OR_MORE_INSTANCES",re=te(X.multiplicity),Ne=te(M);if(re===Ne){Q(Qt(w,J,{multiplicity:M}));return}if(Ne)Q(Je("임베드 컬렉션 전환",[gn(D,B.modelId,{dbAttrs:[]}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:(($=X.jpa)==null?void 0:$.collectionType)??"LIST"}})]));else{const Z=o.logical.entities.find(F=>F.modelId===de);if(!Z)return;Q(Je("임베드 단일 전환",[gn(D,B.modelId,{dbAttrs:Ku(Z)}),Qt(w,J,{multiplicity:M,jpa:{...X.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(w){if(Ee(w))return;const M=o.logical.associations.find(J=>J.modelId===w),I=js(w);if(!M){Q(I);return}for(const J of o.logical.entities){const X=J.attributes.find(te=>{var re;return((re=te.embedded)==null?void 0:re.associationRef)===w});if(X){Q(Je("임베드 삭제",[I,Wn(J.modelId,X.modelId)]));return}}const D=M.end2.entityRef,B={...o.logical,associations:o.logical.associations.filter(J=>J.modelId!==w)},de=al(B,D);Q(de.length?Je("관계 삭제",[I,...de]):I)},setAssociationIdentifying(w,M){if(Ee(w))return;const I=o.logical.associations.find(X=>X.modelId===w),D=Ii(w,{identifying:M});if(!I||I.identifying===M){Q(D);return}const B=I.end2.entityRef,de={...o.logical,associations:o.logical.associations.map(X=>X.modelId===w?{...X,identifying:M}:X)},J=al(de,B);Q(J.length?Je("식별 관계 변경",[D,...J]):D)},updateAssociationEnd(w,M,I){Ee(w)||Q(Qt(w,M,I))},hasQuickFix(w){return S.value?ir(w,o.logical)!=null:!1},applyQuickFix(w){if(!S.value)return!1;const M=ir(w,o.logical);if(!M||Ee(M.assocRef))return!1;const I=o.logical.associations.find(D=>D.modelId===M.assocRef);return I?(Q(Qt(M.assocRef,M.which,{jpa:{...I[M.which].jpa,cascadeTypes:M.cascades}})),!0):!1},moveWaypoint(w,M,I){Q(qs(w,M,I))},addWaypoint(w,M,I){Q(Qs(w,M,I))},removeWaypoint(w,M){Q(Xs(w,M))},clearWaypoints(w){Q(Zs(w))},addNote(w="메모",M={x:80,y:80}){const I=De();return Q(ec({modelId:I,memo:w,geo:{location:{...M},size:{width:200,height:120}}})),I},removeNote(w){Q(tc(w))},moveNote(w,M){Q(Co(w,M))},resizeNote(w,M){Q(nc(w,M))},setNoteMemo(w,M){Q(oc(w,M))},setNoteSwatch(w,M){Q(ic(w,M))},addNoteConnection(w,M){Q(lc(w,M))},removeNoteConnection(w,M){Q(sc(w,M))},moveNoteConnectionWaypoint(w,M,I,D){Q(cc(w,M,I,D))},addNoteConnectionWaypoint(w,M,I,D){Q(dc(w,M,I,D))},removeNoteConnectionWaypoint(w,M,I){Q(uc(w,M,I))},clearNoteConnectionWaypoints(w,M){Q(mc(w,M))},autoLayout(){const w=Dl(o.logical,o.layout);w.length&&Q(Je("자동 배치",w.map(M=>Yn(M.id,M.location))))},copy(w){if(w&&w.length){const X=w.filter(te=>o.logical.entities.some(re=>re.modelId===te));if(X.length){be.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:o.logical,layout:o.layout},selectedIds:X}));return}}const M=U.value;if((M==null?void 0:M.kind)==="attribute"){const X=o.logical.entities.find(re=>re.modelId===M.entityId);if(!X)return;const te=[...X.attributes].sort((re,Ne)=>re.order-Ne.order).filter(re=>M.ids.includes(re.modelId));if(!te.length)return;be.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:te}));return}const I=ge.value;if(!I)return;const D=o.logical.entities.find(X=>X.modelId===I),B=o.layout.entityLayouts.find(X=>X.entityRef===I);if(!D)return;const de=(B==null?void 0:B.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let J;if(B){const{entityRef:X,geo:te,locked:re,...Ne}=B;Object.keys(Ne).length&&(J=Ne)}be.value=JSON.parse(JSON.stringify({kind:"entity",entity:D,geo:de,layoutExtras:J}))},paste(){if(!S.value)return[];const w=be.value;if(!w)return[];if(w.kind==="entities")return Ye.importEntities(w.source,w.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(w.kind==="attribute"){const de=ge.value;if(!de)return[];const J=o.logical.entities.find(Z=>Z.modelId===de);if(!J)return[];const X=new Set(J.attributes.map(Z=>Z.name)),te=new Set(J.attributes.flatMap(Z=>Z.dbAttrs.map(F=>F.physicalName))),re=J.attributes.length,Ne=[],$=w.attributes.map((Z,F)=>{const Ie=JSON.parse(JSON.stringify(Z));Ie.modelId=De();for(const ye of Ie.dbAttrs)ye.modelId=De();X.has(Ie.name)&&(Ie.name=`${Ie.name}_copy`);for(const ye of Ie.dbAttrs)ye.physicalName&&te.has(ye.physicalName)&&(ye.physicalName=`${ye.physicalName}_copy`);return Ie.order=re+F,Ne.push(Ie.modelId),Ut(de,Ie)});return Q($.length===1?$[0]:Je("속성 붙여넣기",$)),U.value={kind:"attribute",entityId:de,ids:Ne,anchor:Ne[Ne.length-1]},[]}const{clone:M,idMap:I}=qN(w.entity),D={location:{x:w.geo.location.x+40,y:w.geo.location.y+40},size:{...w.geo.size}};let B;if(w.layoutExtras){const de={...w.layoutExtras},J=X=>I.get(X);de.attributeStyles&&(de.attributeStyles=bi(de.attributeStyles,J)),de.operationStyles&&(de.operationStyles=bi(de.operationStyles,J)),B=de}return Q(Ei(M,D,B)),U.value={kind:"entity",id:M.modelId},[M.modelId]},importEntities(w,M,I){if(!S.value)return[];const D=_s(w,M,{existing:o.logical,includeRelated:I==null?void 0:I.includeRelated,collisionSuffix:I==null?void 0:I.collisionSuffix});if(D.logical.entities.length===0)return[];const B=(I==null?void 0:I.placement)??"append-right",de=B==="append-right"?JN(o.layout,D.layout):B.offset,J=new Map(D.layout.entityLayouts.map($=>[$.entityRef,$])),X=new Map(D.layout.associationLayouts.map($=>[$.associationRef,$])),te=new Map(D.layout.groupLayouts.map($=>[$.groupRef,$])),re=[];let Ne=80;for(const $ of D.logical.entities){const Z=J.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:Ne+=40,y:80},size:{width:220,height:140}};let Ie;if(Z){const{entityRef:ye,geo:ze,locked:z,...q}=Z;Ie=q}re.push(Ei($,F,Ie))}for(const $ of D.logical.associations){const Z=X.get($.modelId),F=Z?{...Z,waypoints:Z.waypoints.map(Ie=>il(Ie,de))}:{associationRef:$.modelId,waypoints:[]};re.push(xi($,F))}for(const $ of D.logical.groups){const Z=te.get($.modelId),F=Z?{location:il(Z.geo.location,de),size:{...Z.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let Ie;if(Z){const{groupRef:ye,geo:ze,locked:z,memberNoteRefs:q,...ue}=Z;Ie=ue}re.push(wi($,F,Ie))}return Q(Je("다이어그램 가져오기",re)),U.value={kind:"entity",id:D.logical.entities[0].modelId},D.logical.entities.map($=>$.modelId)}};return Ye}const ya=Symbol("groupHover"),Yu=Symbol("groupDrag"),so=Symbol("relationHighlight"),tw={key:0,class:"em-sel","aria-hidden":"true"},nw=["title","aria-expanded","disabled"],ow={class:"em-entity__stereotype"},iw={key:1,class:"em-entity__name"},aw=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],rw=["onPointerdown"],lw={key:1,class:"em-entity__divider-label"},sw=["title"],cw={class:"em-key-slot"},dw={class:"em-key-slot"},uw={key:0,class:"em-entity__type"},mw=["onClick"],fw={class:"em-entity__attrname"},pw={class:"em-entity__type"},hw=["data-op"],yw=["onPointerdown"],gw={class:"em-entity__op-vis","aria-hidden":"true"},bw=["title"],_w={key:4,class:"em-entity__footer"},Wu=Ge(n.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=(J,X)=>o?o.t(J,X):Ct("ko",J,X),a=n.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=oe.useModal();function l(){o&&pa(r,o,t.id)}const s=n.inject(ya,null),c=n.inject(so,null),d=n.computed(()=>!!o&&o.editable.value);function u(){s&&(s.value=t.data.groupRef??null)}function m(){c==null||c.setEntityHover(t.id)}function f(){c==null||c.setEntityHover(null)}const p=n.computed(()=>!!c&&c.primaryEntityIds.value.has(t.id)),y=n.computed(()=>!!c&&c.relatedEntityIds.value.has(t.id)&&!p.value),g=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}),_=n.computed(()=>!!t.selected&&!g.value),b=n.computed(()=>{var J;return o&&((J=o.selectedAttr.value)==null?void 0:J.entityId)===t.id?new Set(o.selectedAttrIds.value):new Set}),N=n.computed(()=>b.value.size>0);function h(J,X){const te=X.shiftKey?"range":X.metaKey||X.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(t.id,J.modelId,te)}const k=n.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(t.id)&&!g.value),P=n.computed(()=>t.data.entity),A=n.computed(()=>t.data.displayMode??"LOGICAL_PHYSICAL"),G=n.computed(()=>t.data.collapsed??!1),K=n.computed(()=>t.data.locked??!1);function v(){d.value&&(o==null||o.setEntityCollapsed(t.id,!G.value))}const T=n.computed(()=>A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL"),H=n.computed(()=>{const J=A.value==="PHYSICAL"||A.value==="LOGICAL_PHYSICAL",X={};for(const te of P.value.attributes){const re=te.attrType.startsWith("RELATION")&&te.dbAttrs.length>0;X[te.modelId]={pk:te.identifier,fk:re&&J,required:te.notNull&&!te.identifier}}return X});function C(J){if(!J)return"";const X=[];return J.pk&&J.fk?X.push(i("em.node.keyPfk")):J.pk?X.push(i("em.node.keyPk")):J.fk&&X.push(i("em.node.keyFk")),J.required&&X.push(i("em.node.required")),X.join(" · ")}const ae=n.computed(()=>{const J=tl(ut(t.data.style)),X={};return J&&(X["--em-header-bg"]=J.bar,X["--em-header-fg"]=J.barOn),X});function E(J){var X,te;return(te=tl(ut((X=t.data.attributeStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}const Y=n.computed(()=>[...P.value.operations??[]].sort((J,X)=>J.order-X.order)),S=n.computed(()=>A.value==="CLASS"&&Y.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ee(J){return J?W[J]:"~"}function ie(J){var X,te;return(te=tl(ut((X=t.data.operationStyles)==null?void 0:X[J.modelId])))==null?void 0:te.text}function O(J,X,te){switch(A.value){case"CLASS":return[{text:J}];case"PHYSICAL":return[{text:te||J}];case"LOGICAL":return[X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=X?{text:X}:{text:i("em.node.logicalMissing"),missing:!0};return te?[re,{text:` · ${te}`}]:[re]}}}function U(J){var X,te,re;return ne(J)?[{text:J.name}]:O(J.name,(te=(X=J.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:te[a.value],((re=J.dbAttrs[0])==null?void 0:re.physicalName)??"")}function ne(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}function ce(J){return J.attrType==="DIVIDER"}function ge(J){if(J.attrType!=="EMBED_PREDEF")return J.dbAttrs;const X=o==null?void 0:o.embeddableCatalog.value.find(re=>re.type===J.type);if(!X)return J.dbAttrs;const te=mn(un(P.value,(o==null?void 0:o.state.logical.entities)??[]));return J.dbAttrs.map((re,Ne)=>{const $=X.fields[Ne],Z=zn(re,te);return Z?{...re,physicalName:Z.physicalName,logicalName:re.logicalName??($==null?void 0:$.logicalName),dataType:re.dataType||($==null?void 0:$.dataType)||""}:$?{...re,physicalName:re.physicalName||$.physicalName,logicalName:re.logicalName??$.logicalName,dataType:re.dataType||$.dataType,length:re.length??$.length}:re})}function se(J){var X;return O(J.physicalName,(X=J.logicalName)==null?void 0:X[a.value],J.physicalName)}function pe(J){const X=Ja(J,(o==null?void 0:o.state.logical.associations)??[]);return Za(A.value,J,X)}const be=n.computed(()=>{var J,X,te;return O(P.value.name,(X=(J=P.value.table)==null?void 0:J.logicalName)==null?void 0:X[a.value],((te=P.value.table)==null?void 0:te.physicalName)??"")}),xe=n.ref(!1),Te=n.ref(""),Ae=n.ref(null);async function fe(){var J,X;d.value&&(Te.value=P.value.name,xe.value=!0,await n.nextTick(),(J=Ae.value)==null||J.focus(),(X=Ae.value)==null||X.select())}function ke(){if(!xe.value)return;xe.value=!1;const J=Te.value.trim();J&&J!==P.value.name&&(o==null||o.renameEntity(t.id,J))}function we(){o==null||o.addAttribute(t.id)}function j(){o==null||o.addDivider(t.id)}const{screenToFlowCoordinate:L,findNode:x}=He(),R=n.ref(null),V=n.computed(()=>{const J=R.value??t.data.size;return J?{width:`${J.width}px`,minHeight:`${J.height}px`}:void 0});let Q=null;function me(J){var re,Ne,$;if(!d.value)return;J.stopPropagation();const X=(re=x(t.id))==null?void 0:re.dimensions,te=L({x:J.clientX,y:J.clientY});Q={fx:te.x,fy:te.y,w:(X==null?void 0:X.width)??((Ne=t.data.size)==null?void 0:Ne.width)??200,h:(X==null?void 0:X.height)??(($=t.data.size)==null?void 0:$.height)??120},J.target.setPointerCapture(J.pointerId)}function ve(J){if(!Q)return;const X=L({x:J.clientX,y:J.clientY});R.value={width:Math.max(40,Q.w+(X.x-Q.fx)),height:Math.max(40,Q.h+(X.y-Q.fy))}}function Ee(J){var X,te,re;if(Q&&R.value&&o){const Ne=(X=x(t.id))==null?void 0:X.dimensions;o.resizeEntity(t.id,{width:Math.round((Ne==null?void 0:Ne.width)??R.value.width),height:Math.round((Ne==null?void 0:Ne.height)??R.value.height)})}Q=null,R.value=null,(re=(te=J.target).releasePointerCapture)==null||re.call(te,J.pointerId)}const $e=n.ref(null),Me=n.ref(null);function Ue(J,X){if(!d.value)return;X.stopPropagation(),X.preventDefault();const te=b.value,re=te.has(J.modelId)?new Set(te):new Set([J.modelId]);Me.value={ids:re,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId)}function Ye(J){if(!Me.value||!$e.value)return;const X=Array.from($e.value.querySelectorAll(".em-entity__row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;Me.value={...Me.value,dropIndex:te,lineY:Ne}}function Fe(){const J=Me.value;if(Me.value=null,!J||J.dropIndex<0)return;const X=P.value.attributes,te=X.filter(F=>J.ids.has(F.modelId)).map(F=>F.modelId),re=X.filter((F,Ie)=>J.ids.has(F.modelId)&&Ie<J.dropIndex).length,Ne=J.dropIndex-re,$=X.filter(F=>!J.ids.has(F.modelId)).map(F=>F.modelId);[...$.slice(0,Ne),...te,...$.slice(Ne)].join(",")!==X.map(F=>F.modelId).join(",")&&(o==null||o.reorderAttributes(t.id,te,Ne))}function gt(){Me.value=null}const w=n.ref(null),M=n.ref(null);function I(J,X){d.value&&(X.stopPropagation(),X.preventDefault(),M.value={id:J.modelId,dropIndex:-1,lineY:0},X.target.setPointerCapture(X.pointerId))}function D(J){if(!M.value||!w.value)return;const X=Array.from(w.value.querySelectorAll(".em-entity__op-row"));if(!X.length)return;let te=X.length;for(let $=0;$<X.length;$++){const Z=X[$].getBoundingClientRect();if(J.clientY<Z.top+Z.height/2){te=$;break}}const re=X[X.length-1],Ne=te<X.length?X[te].offsetTop:re.offsetTop+re.offsetHeight;M.value={...M.value,dropIndex:te,lineY:Ne}}function B(){const J=M.value;if(M.value=null,!J||J.dropIndex<0)return;const te=Y.value.findIndex(Ne=>Ne.modelId===J.id);if(te<0)return;const re=J.dropIndex-(te<J.dropIndex?1:0);re!==te&&(o==null||o.reorderOperations(t.id,[J.id],re))}function de(){M.value=null}return(J,X)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":y.value,"is-dimmed":k.value,"is-selected":g.value,"is-multi-selected":_.value,"has-focused-attr":N.value,"is-locked":K.value}]),style:n.normalizeStyle(V.value),onPointerdown:u,onMouseenter:m,onMouseleave:f,onDblclick:l},[g.value?(n.openBlock(),n.createElementBlock("div",tw,[...X[7]||(X[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(ae.value),onDblclick:n.withModifiers(fe,["stop"])},[n.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:i(G.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!G.value,disabled:!d.value,onClick:n.withModifiers(v,["stop"]),onPointerdown:X[0]||(X[0]=n.withModifiers(()=>{},["stop"])),onDblclick:X[1]||(X[1]=n.withModifiers(()=>{},["stop"]))},n.toDisplayString(G.value?"▸":"▾"),41,nw),n.createElementVNode("span",ow,"«"+n.toDisplayString(P.value.stereotype)+"»",1),xe.value?n.withDirectives((n.openBlock(),n.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ae,"onUpdate:modelValue":X[2]||(X[2]=te=>Te.value=te),class:"em-entity__name-input nodrag",onKeyup:[n.withKeys(ke,["enter"]),X[3]||(X[3]=n.withKeys(te=>xe.value=!1,["esc"]))],onBlur:ke,onPointerdown:X[4]||(X[4]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,Te.value]]):(n.openBlock(),n.createElementBlock("span",iw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(te,re)=>(n.openBlock(),n.createElementBlock("span",{key:re,class:n.normalizeClass({"em-entity__missing":te.missing})},n.toDisplayString(te.text),3))),128))])),K.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)],36),G.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:$e,class:"em-entity__attrs"},[Me.value&&Me.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${Me.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(P.value.attributes,te=>{var re,Ne,$,Z;return n.openBlock(),n.createElementBlock(n.Fragment,{key:te.modelId},[n.createElementVNode("li",{class:n.normalizeClass(["em-entity__row",{"is-attr-selected":b.value.has(te.modelId),"is-dragging":(re=Me.value)==null?void 0:re.ids.has(te.modelId),"is-embed":ne(te),"is-divider":ce(te),nodrag:ce(te)&&d.value}]),"data-attr":te.modelId,onClick:n.withModifiers(F=>h(te,F),["stop"]),onPointerdown:F=>ce(te)?Ue(te,F):void 0,onPointermove:F=>ce(te)?Ye(F):void 0,onPointerup:F=>ce(te)?Fe():void 0,onPointercancel:F=>ce(te)?gt():void 0},[d.value&&!ce(te)?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:F=>Ue(te,F),onPointermove:Ye,onPointerup:Fe,onPointercancel:gt,onClick:X[5]||(X[5]=n.withModifiers(()=>{},["stop"]))},"⠿",40,rw)):n.createCommentVNode("",!0),ce(te)?(n.openBlock(),n.createElementBlock("span",lw,n.toDisplayString(te.name),1)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createVNode(n.unref(In),{id:`l:${te.modelId}`,type:"target",position:n.unref(Re).Left,class:"em-handle"},null,8,["id","position"]),n.createElementVNode("span",{class:"em-entity__keys",title:C(H.value[te.modelId]),"aria-hidden":"true"},[n.createElementVNode("span",cw,[(Ne=H.value[te.modelId])!=null&&Ne.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):($=H.value[te.modelId])!=null&&$.required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):n.createCommentVNode("",!0)]),n.createElementVNode("span",dw,[ne(te)?(n.openBlock(),n.createBlock(Ve,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Z=H.value[te.modelId])!=null&&Z.fk?(n.openBlock(),n.createBlock(Ve,{key:1,name:"key",size:12,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,sw),n.createElementVNode("span",{class:"em-entity__attrname",style:n.normalizeStyle({color:E(te)})},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(U(te),(F,Ie)=>(n.openBlock(),n.createElementBlock("span",{key:Ie,class:n.normalizeClass({"em-entity__missing":F.missing})},n.toDisplayString(F.text),3))),128))],4),pe(te)?(n.openBlock(),n.createElementBlock("span",uw,n.toDisplayString(pe(te)),1)):n.createCommentVNode("",!0),n.createVNode(n.unref(In),{id:`r:${te.modelId}`,type:"source",position:n.unref(Re).Right,class:"em-handle"},null,8,["id","position"])],64))],42,aw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne(te)&&T.value?ge(te):[],F=>(n.openBlock(),n.createElementBlock("li",{key:`${te.modelId}:${F.modelId}`,class:n.normalizeClass(["em-entity__embed-col",{"is-group-selected":b.value.has(te.modelId)}]),onClick:n.withModifiers(Ie=>h(te,Ie),["stop"])},[X[8]||(X[8]=n.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),n.createElementVNode("span",fw,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(se(F),(Ie,ye)=>(n.openBlock(),n.createElementBlock("span",{key:ye,class:n.normalizeClass({"em-entity__missing":Ie.missing})},n.toDisplayString(Ie.text),3))),128))]),n.createElementVNode("span",pw,n.toDisplayString(F.dataType),1)],10,mw))),128))],64)}),128))],512)),!G.value&&S.value?(n.openBlock(),n.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:w,class:"em-entity__ops"},[M.value&&M.value.dropIndex>=0?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:n.normalizeStyle({top:`${M.value.lineY}px`}),"aria-hidden":"true"},null,4)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Y.value,te=>{var re;return n.openBlock(),n.createElementBlock("li",{key:te.modelId,class:n.normalizeClass(["em-entity__op-row",{"is-dragging":((re=M.value)==null?void 0:re.id)===te.modelId}]),"data-op":te.modelId},[d.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ne=>I(te,Ne),onPointermove:D,onPointerup:B,onPointercancel:de,onClick:X[6]||(X[6]=n.withModifiers(()=>{},["stop"]))},"⠿",40,yw)):n.createCommentVNode("",!0),n.createElementVNode("span",gw,n.toDisplayString(ee(te.visibility)),1),n.createElementVNode("span",{class:"em-entity__op-name",style:n.normalizeStyle({color:ie(te)})},n.toDisplayString(te.name)+"()",5)],10,hw)}),128))],512)):Y.value.length?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Y.value.length})},[n.createVNode(Ve,{name:"method",size:12}),n.createElementVNode("span",null,n.toDisplayString(i("em.node.opsSummary",{n:Y.value.length})),1)],8,bw)):n.createCommentVNode("",!0),d.value?(n.openBlock(),n.createElementBlock("footer",_w,[n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:we},n.toDisplayString(i("em.node.addAttr")),1),X[9]||(X[9]=n.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),n.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:j},n.toDisplayString(i("em.node.addDivider")),1)])):n.createCommentVNode("",!0),d.value&&!xe.value?(n.openBlock(),n.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:me,onPointermove:ve,onPointerup:Ee},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-3ffbbf24"]]),kw={key:0,class:"em-sel","aria-hidden":"true"},Ew={class:"em-group__label"},Nw={class:"em-group__name"},ww={key:0,class:"em-group__pkg"},vw={key:1,class:"em-group__flag"},qu=Ge(n.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.computed(()=>t.data.group),i=n.computed(()=>t.data.locked??!1),a=n.computed(()=>ut(t.data.style)),r=n.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=n.inject(An,null),s=(T,H)=>l?l.t(T,H):Ct("ko",T,H),c=n.computed(()=>!!l&&l.editable.value),d=n.computed(()=>{var T;return!!t.id&&((T=l==null?void 0:l.selection.value)==null?void 0:T.kind)==="group"&&l.selection.value.id===t.id}),u=n.computed(()=>!!t.selected&&!d.value),m=n.inject(ya,null),f=n.computed(()=>!!t.id&&(m==null?void 0:m.value)===t.id),p=n.inject(so,null);function y(){t.id&&(p==null||p.setGroupHover(t.id))}function g(){p==null||p.setGroupHover(null)}const _=n.computed(()=>!!p&&p.hoverGroupId.value===t.id),b=n.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==t.id),{screenToFlowCoordinate:N,findNode:h}=He();let k=null,P=null;function A(T){var ae;if(!t.id||!c.value)return;T.stopPropagation();const H=((ae=h(t.id))==null?void 0:ae.dimensions)??{width:400,height:300},C=N({x:T.clientX,y:T.clientY});k={fx:C.x,fy:C.y,w:H.width,h:H.height},T.target.setPointerCapture(T.pointerId)}function G(T){if(!k||!t.id)return;const H=N({x:T.clientX,y:T.clientY});P={width:Math.max(160,k.w+(H.x-k.fx)),height:Math.max(120,k.h+(H.y-k.fy))};const C=h(t.id);C&&(C.style={width:`${P.width}px`,height:`${P.height}px`})}function K(T){var H,C;k&&P&&t.id&&l&&l.resizeGroup(t.id,P),k=null,P=null,(C=(H=T.target).releasePointerCapture)==null||C.call(H,T.pointerId)}const v=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||s("em.group.fallback")});return(T,H)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-group",{"is-drop-target":f.value,"is-hover-origin":_.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),style:n.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(n.openBlock(),n.createElementBlock("div",kw,[...H[0]||(H[0]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),n.createElementVNode("div",Ew,[n.createElementVNode("span",Nw,n.toDisplayString(v.value),1),o.value.packageName?(n.openBlock(),n.createElementBlock("span",ww,n.toDisplayString(o.value.packageName),1)):n.createCommentVNode("",!0),o.value.excludeDDLGeneration?(n.openBlock(),n.createElementBlock("span",vw,n.toDisplayString(s("em.group.ddlExcludeBadge")),1)):n.createCommentVNode("",!0),i.value?(n.openBlock(),n.createBlock(Ve,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):n.createCommentVNode("",!0)]),c.value&&!i.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:G,onPointerup:K},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-9b95a9b6"]]),xw={key:0,class:"em-sel","aria-hidden":"true"},Iw={key:2,class:"em-note__text"},Xu=Ge(n.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const t=e,o=n.inject(An,null),i=n.inject(ya,null),a=n.inject(so,null),r=n.computed(()=>t.data.note),l=n.computed(()=>!!o&&o.editable.value),s=n.computed(()=>ut(r.value.style)),c=n.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=t.data.groupRef??null)}function u(){a==null||a.setNoteHover(t.id)}function m(){a==null||a.setNoteHover(null)}const f=n.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===t.id}),p=n.computed(()=>!!a&&a.relatedNoteIds.value.has(t.id)&&!f.value),y=n.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===t.id}),g=n.computed(()=>!!t.selected&&!y.value),_=n.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(t.id)&&!y.value),b=[{id:"n-top",pos:Re.Top},{id:"n-right",pos:Re.Right},{id:"n-bottom",pos:Re.Bottom},{id:"n-left",pos:Re.Left}],N=n.ref(!1),h=n.ref(""),k=n.ref(null);async function P(){var E;l.value&&(h.value=r.value.memo,N.value=!0,await n.nextTick(),(E=k.value)==null||E.focus())}function A(){N.value&&(N.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(t.id,h.value)))}const{screenToFlowCoordinate:G,findNode:K}=He();let v=null,T=null;function H(E){var W;if(!l.value)return;E.stopPropagation();const Y=((W=K(t.id))==null?void 0:W.dimensions)??r.value.geo.size,S=G({x:E.clientX,y:E.clientY});v={fx:S.x,fy:S.y,w:Y.width,h:Y.height},E.target.setPointerCapture(E.pointerId)}function C(E){if(!v)return;const Y=G({x:E.clientX,y:E.clientY});T={width:Math.max(140,v.w+(Y.x-v.fx)),height:Math.max(60,v.h+(Y.y-v.fy))};const S=K(t.id);S&&(S.style={width:`${T.width}px`,height:`${T.height}px`})}function ae(E){var Y,S;v&&T&&o&&o.resizeNote(t.id,T),v=null,T=null,(S=(Y=E.target).releasePointerCapture)==null||S.call(Y,E.pointerId)}return(E,Y)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-note",{"is-hover-origin":f.value,"is-related":p.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),style:n.normalizeStyle(c.value),onDblclick:P,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(n.openBlock(),n.createElementBlock("div",xw,[...Y[4]||(Y[4]=[n.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),n.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):n.createCommentVNode("",!0),N.value?n.withDirectives((n.openBlock(),n.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":Y[0]||(Y[0]=S=>h.value=S),class:"em-note__edit nodrag",onBlur:A,onKeydown:Y[1]||(Y[1]=n.withKeys(S=>N.value=!1,["esc"])),onPointerdown:Y[2]||(Y[2]=n.withModifiers(()=>{},["stop"]))},null,544)),[[n.vModelText,h.value]]):(n.openBlock(),n.createElementBlock("div",Iw,n.toDisplayString(r.value.memo),1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(b,S=>n.createVNode(n.unref(In),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:Y[3]||(Y[3]=n.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:H,onPointermove:C,onPointerup:ae},null,32)):n.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),Cw=20,Sw=22,$w=7,Rw=22,Ju=31,Zu=7,Aw=20,Qu=11,em=11,Tw=Ju+Zu;function Vw(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Mw(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function ga(e,t,o){const i=t.x-e.x,a=t.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function tm(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function ba(e,t,o){return{x:Math.cos(o)*t+e.x,y:Math.sin(o)*t+e.y}}function nm(e,t,o,i){const a=i/2,r=e.x===t.x&&e.y===t.y?Math.PI/2:tm(e,t);return[ba(o,a,r-Math.PI/2),ba(o,a,r+Math.PI/2)]}function om(e,t,o,i){const a=t*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function im(e,t,o,i){const a=[],r=[],l=[];if(e.x===t.x&&e.y===t.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=ga(e,t,Cw),[d,u]=nm(e,t,c,Sw);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),Vw(o.multiplicity)){const m=ga(e,t,Ju);r.push({cx:m.x,cy:m.y,r:Zu})}if(Mw(o.multiplicity)){const m=ga(e,t,$w),[f,p]=nm(e,t,m,Rw);a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=ga(e,t,Aw),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=tm(e,t),m=ba(d,Qu/2,u-Math.PI/2),f=ba(d,Qu/2,u+Math.PI/2);l.push({points:[e,m,c,f]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(t.x-e.x,t.y-e.y),d=om(s,c,em,!0),u=om(s,c,em,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const am=200,rm=120,rl=24;function lm(e){var a,r;if(!e)return{x:0,y:0,width:am,height:rm};const t=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||am,i=((r=e.dimensions)==null?void 0:r.height)||rm;return{x:t.x,y:t.y,width:o,height:i}}function sm(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function cm(e){const t=n.computed(()=>lm(e.sourceNode())),o=n.computed(()=>lm(e.targetNode())),i=n.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=n.computed(()=>{var p,y;const d=t.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,f=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(f-m)<rl){const g=(m+f)/2;m=g-rl/2,f=g+rl/2}return{source:{x:u,y:m},target:{x:u,y:f}}}),r=n.computed(()=>e.waypoints()[0]??sm(o.value)),l=n.computed(()=>{const d=e.waypoints();return d[d.length-1]??sm(t.value)}),s=n.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Fa(t.value,d,r.value.x):Ua(t.value,r.value)}),c=n.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Fa(o.value,d,l.value.x):Ua(o.value,l.value)});return{source:n.computed(()=>i.value?a.value.source:s.value.point),target:n.computed(()=>i.value?a.value.target:c.value.point),sourceSide:n.computed(()=>i.value?"right":s.value.side),targetSide:n.computed(()=>i.value?"right":c.value.side),isSelf:i}}const ll=Symbol("waypointController"),Bw=["d"],Dw=["d"],Ow=["d"],Lw=["x1","y1","x2","y2"],Pw=["cx","cy","r"],zw=["x","y"],Uw=["x","y"],Fw=["cx","cy","onDblclick"],Hw=["x","y","onPointerdown","onDblclick"],dm=Ge(n.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(Yu,null),s=n.inject(so,null),c=n.computed(()=>!!s&&s.relatedEdgeIds.value.has(t.id)),d=n.computed(()=>{var fe;return((fe=a==null?void 0:a.selection.value)==null?void 0:fe.kind)==="association"&&a.selection.value.id===t.id}),u=n.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(t.id)&&!d.value),m=n.computed(()=>{const fe=l==null?void 0:l.value;if(!fe||!a)return null;const ke=a.resolved.value.entities,we=L=>{var x;return(x=ke.find(R=>R.entity.modelId===L))==null?void 0:x.groupRef},j=t.data.association;return we(j.end1.entityRef)===fe.groupId&&we(j.end2.entityRef)===fe.groupId?{dx:fe.dx,dy:fe.dy}:null}),f=n.computed(()=>(i==null?void 0:i.points(t.id))??[]),p=n.ref(-1),y=n.ref({x:0,y:0}),g=n.computed(()=>{const fe=m.value;return f.value.map((ke,we)=>we===p.value?y.value:fe?{x:ke.x+fe.dx,y:ke.y+fe.dy}:ke)}),_=n.computed(()=>{var fe;return!!((fe=t.sourceNode.data)!=null&&fe.collapsed)}),b=n.computed(()=>{var fe;return!!((fe=t.targetNode.data)!=null&&fe.collapsed)}),{source:N,target:h,sourceSide:k,targetSide:P,isSelf:A}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>g.value,sourceRowY:()=>t.data.sourceColumnRef&&!_.value?t.sourceY:void 0,targetRowY:()=>t.data.targetColumnRef&&!b.value?t.targetY:void 0}),G=Tw+4,K=n.computed(()=>A.value?Bl(N.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?La(N.value,k.value,g.value,h.value,P.value,G):za(N.value,g.value,h.value)),v=n.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(N.value,k.value,g.value,h.value,P.value,G):Ha(N.value,g.value,h.value).map((fe,ke)=>({point:fe,segIndex:ke}))),T=n.computed(()=>A.value||!r.value?[]:g.value);function H(fe){switch(fe){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 C(fe,ke){p.value=fe,y.value={...f.value[fe]},ke.target.setPointerCapture(ke.pointerId),ke.stopPropagation()}function ae(fe){if(p.value<0)return;const ke=o({x:fe.clientX,y:fe.clientY});y.value={x:ke.x,y:ke.y}}function E(fe){var ke,we;p.value>=0&&i&&i.movePoint(t.id,p.value,{...y.value}),p.value=-1,(we=(ke=fe.target).releasePointerCapture)==null||we.call(ke,fe.pointerId)}function Y(fe,ke){ke.stopPropagation(),i==null||i.removePoint(t.id,fe)}function S(fe,ke){if(!i)return;const we=o({x:ke.clientX,y:ke.clientY});i.insertPoint(t.id,fe,{x:we.x,y:we.y})}const W=n.computed(()=>H(t.data.association.end1.multiplicity)),ee=n.computed(()=>H(t.data.association.end2.multiplicity)),ie=n.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),O=n.computed(()=>ie.value==="class"),U=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const fe=ho(k.value);return{x:N.value.x+fe.x*10,y:N.value.y+fe.y*10}}return g.value[0]??h.value}),ne=n.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ke=ho(P.value);return{x:h.value.x+ke.x*10,y:h.value.y+ke.y*10}}const fe=g.value;return fe[fe.length-1]??N.value}),ce=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end1.multiplicity,navigable:fe.end1.navigable,composition:fe.end1.composition,otherNavigable:fe.end2.navigable}}),ge=n.computed(()=>{const fe=t.data.association;return{multiplicity:fe.end2.multiplicity,navigable:fe.end2.navigable,composition:fe.end2.composition,otherNavigable:fe.end1.navigable}}),se=n.computed(()=>im(N.value,U.value,ce.value,ie.value)),pe=n.computed(()=>im(h.value,ne.value,ge.value,ie.value)),be=n.computed(()=>[...se.value.lines,...pe.value.lines]),xe=n.computed(()=>[...se.value.circles,...pe.value.circles]),Te=n.computed(()=>[...se.value.polygons,...pe.value.polygons].map(fe=>`M${fe.points.map(ke=>`${ke.x},${ke.y}`).join(" L")} Z`)),Ae=n.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(fe,ke)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:K.value,fill:"none",class:"em-edge__hit"},null,8,Bw),n.createElementVNode("path",{d:K.value,fill:"none","stroke-width":"1.5",class:n.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Dw),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(Te.value,(we,j)=>(n.openBlock(),n.createElementBlock("path",{key:`mpoly-${j}`,d:we,class:n.normalizeClass(["em-edge__marker em-edge__marker--fill",Ae.value])},null,10,Ow))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(be.value,(we,j)=>(n.openBlock(),n.createElementBlock("line",{key:`mline-${j}`,x1:we.x1,y1:we.y1,x2:we.x2,y2:we.y2,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Lw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(xe.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mcirc-${j}`,cx:we.cx,cy:we.cy,r:we.r,class:n.normalizeClass(["em-edge__marker",Ae.value])},null,10,Pw))),128)),O.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("text",{x:n.unref(N).x+8,y:n.unref(N).y-6,class:n.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},n.toDisplayString(W.value),11,zw),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(ee.value),11,Uw)],64)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(v.value,(we,j)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${j}`,cx:we.point.x,cy:we.point.y,r:"4",class:n.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:n.withModifiers(L=>S(we.segIndex,L),["stop"])},null,42,Fw))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,(we,j)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${j}`,x:we.x-5,y:we.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>C(j,L),onPointermove:ae,onPointerup:E,onDblclick:L=>Y(j,L)},null,42,Hw))),128))],64))}}),[["__scopeId","data-v-208ecd02"]]);var Yt=(e=>(e.Lines="lines",e.Dots="dots",e))(Yt||{});const um=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]}`})},mm=function({radius:e,color:t}){return n.h("circle",{cx:e,cy:e,r:e,fill:t})};Yt.Lines+"",Yt.Dots+"";const Gw={[Yt.Dots]:"#81818a",[Yt.Lines]:"#eee"},jw=["id","x","y","width","height","patternTransform"],Kw={key:2,height:"100",width:"100"},Yw=["fill"],Ww=["x","y","fill"],qw={name:"Background",compatConfig:{MODE:3}},Xw=n.defineComponent({...qw,props:{id:{},variant:{default:()=>Yt.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}=He(),i=n.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,f*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=n.toRef(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=n.toRef(()=>e.color||e.patternColor||Gw[e.variant||Yt.Dots]);return(l,s)=>(n.openBlock(),n.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:n.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[n.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[n.createElementVNode("pattern",{id:a.value,x:n.unref(o).x%i.value.scaledGap[0],y:n.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[n.renderSlot(l.$slots,"pattern",{},()=>[l.variant===n.unref(Yt).Lines?(n.openBlock(),n.createBlock(n.unref(um),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===n.unref(Yt).Dots?(n.openBlock(),n.createBlock(n.unref(mm),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):n.createCommentVNode("",!0),l.bgColor?(n.openBlock(),n.createElementBlock("svg",Kw,[n.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Yw)])):n.createCommentVNode("",!0)])],8,jw)]),n.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Ww),n.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Jw={name:"ControlButton",compatConfig:{MODE:3}},Zw=(e,t)=>{const o=e.__vccOpts||e;for(const[i,a]of t)o[i]=a;return o},Qw={type:"button",class:"vue-flow__controls-button"};function ev(e,t,o,i,a,r){return n.openBlock(),n.createElementBlock("button",Qw,[n.renderSlot(e.$slots,"default")])}const Tn=Zw(Jw,[["render",ev]]),tv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},nv=[n.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function ov(e,t){return n.openBlock(),n.createElementBlock("svg",tv,nv)}const iv={render:ov},av={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},rv=[n.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function lv(e,t){return n.openBlock(),n.createElementBlock("svg",av,rv)}const sv={render:lv},cv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},dv=[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 uv(e,t){return n.openBlock(),n.createElementBlock("svg",cv,dv)}const mv={render:uv},fv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pv=[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 hv(e,t){return n.openBlock(),n.createElementBlock("svg",fv,pv)}const yv={render:hv},gv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},bv=[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 _v(e,t){return n.openBlock(),n.createElementBlock("svg",gv,bv)}const kv={render:_v},Ev={name:"Controls",compatConfig:{MODE:3}},Nv=n.defineComponent({...Ev,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Md.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=He(),f=n.toRef(()=>o.value||i.value||a.value),p=n.toRef(()=>d.value.zoom<=u.value),y=n.toRef(()=>d.value.zoom>=m.value);function g(){l(),t("zoomIn")}function _(){s(),t("zoomOut")}function b(){c(e.fitViewParams),t("fitView")}function N(){r(!f.value),t("interactionChange",!f.value)}return(h,k)=>(n.openBlock(),n.createBlock(n.unref(Tu),{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(Tn,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(iv))))])]),_:3},8,["disabled"])]),n.renderSlot(h.$slots,"control-zoom-out",{},()=>[n.createVNode(Tn,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:_},{default:n.withCtx(()=>[n.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(sv))))])]),_:3},8,["disabled"])])],64)):n.createCommentVNode("",!0),h.showFitView?n.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[n.createVNode(Tn,{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(mv))))])]),_:3})]):n.createCommentVNode("",!0),h.showInteractive?n.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(n.openBlock(),n.createBlock(Tn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:n.withCtx(()=>[f.value?n.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(kv))))]):n.createCommentVNode("",!0),f.value?n.createCommentVNode("",!0):n.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(yv))))])]),_:3})):n.createCommentVNode("",!0)]):n.createCommentVNode("",!0),n.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var wv={value:()=>{}};function sl(){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 _a(o)}function _a(e){this._=e}function vv(e,t){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}_a.prototype=sl.prototype={constructor:_a,on:function(e,t){var o=this._,i=vv(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=xv(o[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(a=(e=i[r]).type)o[a]=fm(o[a],e.name,t);else if(t==null)for(a in o)o[a]=fm(o[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new _a(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(t,o)}};function xv(e,t){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===t)return a.value}function fm(e,t,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=wv,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:t,value:o}),e}var cl="http://www.w3.org/1999/xhtml";const pm={svg:"http://www.w3.org/2000/svg",xhtml:cl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ka(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),pm.hasOwnProperty(t)?{space:pm[t],local:e}:e}function Iv(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===cl&&t.documentElement.namespaceURI===cl?t.createElement(e):t.createElementNS(o,e)}}function Cv(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hm(e){var t=ka(e);return(t.local?Cv:Iv)(t)}function Sv(){}function dl(e){return e==null?Sv:function(){return this.querySelector(e)}}function $v(e){typeof e!="function"&&(e=dl(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Et(i,this._parents)}function Rv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Av(){return[]}function ym(e){return e==null?Av:function(){return this.querySelectorAll(e)}}function Tv(e){return function(){return Rv(e.apply(this,arguments))}}function Vv(e){typeof e=="function"?e=Tv(e):e=ym(e);for(var t=this._groups,o=t.length,i=[],a=[],r=0;r<o;++r)for(var l=t[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Et(i,a)}function gm(e){return function(){return this.matches(e)}}function bm(e){return function(t){return t.matches(e)}}var Mv=Array.prototype.find;function Bv(e){return function(){return Mv.call(this.children,e)}}function Dv(){return this.firstElementChild}function Ov(e){return this.select(e==null?Dv:Bv(typeof e=="function"?e:bm(e)))}var Lv=Array.prototype.filter;function Pv(){return Array.from(this.children)}function zv(e){return function(){return Lv.call(this.children,e)}}function Uv(e){return this.selectAll(e==null?Pv:zv(typeof e=="function"?e:bm(e)))}function Fv(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Et(i,this._parents)}function _m(e){return new Array(e.length)}function Hv(){return new Et(this._enter||this._groups.map(_m),this._parents)}function Ea(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ea.prototype={constructor:Ea,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 Gv(e){return function(){return e}}function jv(e,t,o,i,a,r){for(var l=0,s,c=t.length,d=r.length;l<d;++l)(s=t[l])?(s.__data__=r[l],i[l]=s):o[l]=new Ea(e,r[l]);for(;l<c;++l)(s=t[l])&&(a[l]=s)}function Kv(e,t,o,i,a,r,l){var s,c,d=new Map,u=t.length,m=r.length,f=new Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=l.call(c,c.__data__,s,t)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new Ea(e,r[s]);for(s=0;s<u;++s)(c=t[s])&&d.get(f[s])===c&&(a[s]=c)}function Yv(e){return e.__data__}function Wv(e,t){if(!arguments.length)return Array.from(this,Yv);var o=t?Kv:jv,i=this._parents,a=this._groups;typeof e!="function"&&(e=Gv(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],f=m.length,p=qv(e.call(u,u&&u.__data__,d,i)),y=p.length,g=s[d]=new Array(y),_=l[d]=new Array(y),b=c[d]=new Array(f);o(u,m,g,_,b,p,t);for(var N=0,h=0,k,P;N<y;++N)if(k=g[N]){for(N>=h&&(h=N+1);!(P=_[h])&&++h<y;);k._next=P||null}}return l=new Et(l,i),l._enter=s,l._exit=c,l}function qv(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xv(){return new Et(this._exit||this._groups.map(_m),this._parents)}function Jv(e,t,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function Zv(e){for(var t=e.selection?e.selection():e,o=this._groups,i=t._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,f=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(f[y]=p);for(;c<a;++c)s[c]=o[c];return new Et(s,this._parents)}function Qv(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var i=e[t],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function ex(e){e||(e=tx);function t(m,f){return m&&f?e(m.__data__,f.__data__):!m-!f}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(t)}return new Et(a,this._parents).order()}function tx(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function nx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ox(){return Array.from(this)}function ix(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function ax(){let e=0;for(const t of this)++e;return e}function rx(){return!this.node()}function lx(e){for(var t=this._groups,o=0,i=t.length;o<i;++o)for(var a=t[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function sx(e){return function(){this.removeAttribute(e)}}function cx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dx(e,t){return function(){this.setAttribute(e,t)}}function ux(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mx(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function fx(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 px(e,t){var o=ka(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?cx:sx:typeof t=="function"?o.local?fx:mx:o.local?ux:dx)(o,t))}function km(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hx(e){return function(){this.style.removeProperty(e)}}function yx(e,t,o){return function(){this.style.setProperty(e,t,o)}}function gx(e,t,o){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function bx(e,t,o){return arguments.length>1?this.each((t==null?hx:typeof t=="function"?gx:yx)(e,t,o??"")):co(this.node(),e)}function co(e,t){return e.style.getPropertyValue(t)||km(e).getComputedStyle(e,null).getPropertyValue(t)}function _x(e){return function(){delete this[e]}}function kx(e,t){return function(){this[e]=t}}function Ex(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Nx(e,t){return arguments.length>1?this.each((t==null?_x:typeof t=="function"?Ex:kx)(e,t)):this.node()[e]}function Em(e){return e.trim().split(/^|\s+/)}function ul(e){return e.classList||new Nm(e)}function Nm(e){this._node=e,this._names=Em(e.getAttribute("class")||"")}Nm.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 wm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.add(t[i])}function vm(e,t){for(var o=ul(e),i=-1,a=t.length;++i<a;)o.remove(t[i])}function wx(e){return function(){wm(this,e)}}function vx(e){return function(){vm(this,e)}}function xx(e,t){return function(){(t.apply(this,arguments)?wm:vm)(this,e)}}function Ix(e,t){var o=Em(e+"");if(arguments.length<2){for(var i=ul(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof t=="function"?xx:t?wx:vx)(o,t))}function Cx(){this.textContent=""}function Sx(e){return function(){this.textContent=e}}function $x(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Rx(e){return arguments.length?this.each(e==null?Cx:(typeof e=="function"?$x:Sx)(e)):this.node().textContent}function Ax(){this.innerHTML=""}function Tx(e){return function(){this.innerHTML=e}}function Vx(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mx(e){return arguments.length?this.each(e==null?Ax:(typeof e=="function"?Vx:Tx)(e)):this.node().innerHTML}function Bx(){this.nextSibling&&this.parentNode.appendChild(this)}function Dx(){return this.each(Bx)}function Ox(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lx(){return this.each(Ox)}function Px(e){var t=typeof e=="function"?e:hm(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zx(){return null}function Ux(e,t){var o=typeof e=="function"?e:hm(e),i=t==null?zx:typeof t=="function"?t:dl(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Fx(){var e=this.parentNode;e&&e.removeChild(this)}function Hx(){return this.each(Fx)}function Gx(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jx(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kx(e){return this.select(e?jx:Gx)}function Yx(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Wx(e){return function(t){e.call(this,t,this.__data__)}}function qx(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 Xx(e){return function(){var t=this.__on;if(t){for(var o=0,i=-1,a=t.length,r;o<a;++o)r=t[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++i]=r;++i?t.length=i:delete this.__on}}}function Jx(e,t,o){return function(){var i=this.__on,a,r=Wx(t);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=t;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:t,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Zx(e,t,o){var i=qx(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=t?Jx:Xx,a=0;a<r;++a)this.each(s(i[a],t,o));return this}function xm(e,t,o){var i=km(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,o):(a=i.document.createEvent("Event"),o?(a.initEvent(t,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Qx(e,t){return function(){return xm(this,e,t)}}function eI(e,t){return function(){return xm(this,e,t.apply(this,arguments))}}function tI(e,t){return this.each((typeof t=="function"?eI:Qx)(e,t))}function*nI(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var i=e[t],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Im=[null];function Et(e,t){this._groups=e,this._parents=t}function qo(){return new Et([[document.documentElement]],Im)}function oI(){return this}Et.prototype=qo.prototype={constructor:Et,select:$v,selectAll:Vv,selectChild:Ov,selectChildren:Uv,filter:Fv,data:Wv,enter:Hv,exit:Xv,join:Jv,merge:Zv,selection:oI,order:Qv,sort:ex,call:nx,nodes:ox,node:ix,size:ax,empty:rx,each:lx,attr:px,style:bx,property:Nx,classed:Ix,text:Rx,html:Mx,raise:Dx,lower:Lx,append:Px,insert:Ux,remove:Hx,clone:Kx,datum:Yx,on:Zx,dispatch:tI,[Symbol.iterator]:nI};function ln(e){return typeof e=="string"?new Et([[document.querySelector(e)]],[document.documentElement]):new Et([[e]],Im)}function iI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sn(e,t){if(e=iI(e),t===void 0&&(t=e.currentTarget),t){var o=t.ownerSVGElement||t;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const ml={capture:!0,passive:!1};function fl(e){e.preventDefault(),e.stopImmediatePropagation()}function aI(e){var t=e.document.documentElement,o=ln(e).on("dragstart.drag",fl,ml);"onselectstart"in t?o.on("selectstart.drag",fl,ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function rI(e,t){var o=e.document.documentElement,i=ln(e).on("dragstart.drag",null);t&&(i.on("click.drag",fl,ml),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 pl(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Cm(e,t){var o=Object.create(e.prototype);for(var i in t)o[i]=t[i];return o}function Xo(){}var Jo=.7,Na=1/Jo,uo="\\s*([+-]?\\d+)\\s*",Zo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lI=/^#([0-9a-f]{3,8})$/,sI=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),cI=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),dI=new RegExp(`^rgba\\(${uo},${uo},${uo},${Zo}\\)$`),uI=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${Zo}\\)$`),mI=new RegExp(`^hsl\\(${Zo},${Lt},${Lt}\\)$`),fI=new RegExp(`^hsla\\(${Zo},${Lt},${Lt},${Zo}\\)$`),Sm={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};pl(Xo,Qo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$m,formatHex:$m,formatHex8:pI,formatHsl:hI,formatRgb:Rm,toString:Rm});function $m(){return this.rgb().formatHex()}function pI(){return this.rgb().formatHex8()}function hI(){return Bm(this).formatHsl()}function Rm(){return this.rgb().formatRgb()}function Qo(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=lI.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Am(t):o===3?new yt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?wa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?wa(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=sI.exec(e))?new yt(t[1],t[2],t[3],1):(t=cI.exec(e))?new yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dI.exec(e))?wa(t[1],t[2],t[3],t[4]):(t=uI.exec(e))?wa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(e))?Mm(t[1],t[2]/100,t[3]/100,t[4]):Sm.hasOwnProperty(e)?Am(Sm[e]):e==="transparent"?new yt(NaN,NaN,NaN,0):null}function Am(e){return new yt(e>>16&255,e>>8&255,e&255,1)}function wa(e,t,o,i){return i<=0&&(e=t=o=NaN),new yt(e,t,o,i)}function yI(e){return e instanceof Xo||(e=Qo(e)),e?(e=e.rgb(),new yt(e.r,e.g,e.b,e.opacity)):new yt}function hl(e,t,o,i){return arguments.length===1?yI(e):new yt(e,t,o,i??1)}function yt(e,t,o,i){this.r=+e,this.g=+t,this.b=+o,this.opacity=+i}pl(yt,hl,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yt(Vn(this.r),Vn(this.g),Vn(this.b),va(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:Tm,formatHex:Tm,formatHex8:gI,formatRgb:Vm,toString:Vm}));function Tm(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function gI(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vm(){const e=va(this.opacity);return`${e===1?"rgb(":"rgba("}${Vn(this.r)}, ${Vn(this.g)}, ${Vn(this.b)}${e===1?")":`, ${e})`}`}function va(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=Vn(e),(e<16?"0":"")+e.toString(16)}function Mm(e,t,o,i){return i<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new St(e,t,o,i)}function Bm(e){if(e instanceof St)return new St(e.h,e.s,e.l,e.opacity);if(e instanceof Xo||(e=Qo(e)),!e)return new St;if(e instanceof St)return e;e=e.rgb();var t=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(t,o,i),r=Math.max(t,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(t===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-t)/s+2:l=(t-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new St(l,s,c,e.opacity)}function bI(e,t,o,i){return arguments.length===1?Bm(e):new St(e,t,o,i??1)}function St(e,t,o,i){this.h=+e,this.s=+t,this.l=+o,this.opacity=+i}pl(St,bI,Cm(Xo,{brighter(e){return e=e==null?Na:Math.pow(Na,e),new St(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Jo:Math.pow(Jo,e),new St(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*t,a=2*o-i;return new yt(yl(e>=240?e-240:e+120,a,i),yl(e,a,i),yl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new St(Dm(this.h),xa(this.s),xa(this.l),va(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=va(this.opacity);return`${e===1?"hsl(":"hsla("}${Dm(this.h)}, ${xa(this.s)*100}%, ${xa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dm(e){return e=(e||0)%360,e<0?e+360:e}function xa(e){return Math.max(0,Math.min(1,e||0))}function yl(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 Om=e=>()=>e;function _I(e,t){return function(o){return e+o*t}}function kI(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 EI(e){return(e=+e)==1?Lm:function(t,o){return o-t?kI(t,o,e):Om(isNaN(t)?o:t)}}function Lm(e,t){var o=t-e;return o?_I(e,o):Om(isNaN(e)?t:e)}const Pm=(function e(t){var o=EI(t);function i(a,r){var l=o((a=hl(a)).r,(r=hl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Lm(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function cn(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var gl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bl=new RegExp(gl.source,"g");function NI(e){return function(){return e}}function wI(e){return function(t){return e(t)+""}}function vI(e,t){var o=gl.lastIndex=bl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",t=t+"";(i=gl.exec(e))&&(a=bl.exec(t));)(r=a.index)>o&&(r=t.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:cn(i,a)})),o=bl.lastIndex;return o<t.length&&(r=t.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?wI(c[0].x):NI(t):(t=c.length,function(d){for(var u=0,m;u<t;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var zm=180/Math.PI,_l={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Um(e,t,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(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,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(t,e)*zm,skewX:Math.atan(c)*zm,scaleX:l,scaleY:s}}var Ia;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_l:Um(t.a,t.b,t.c,t.d,t.e,t.f)}function II(e){return e==null||(Ia||(Ia=document.createElementNS("http://www.w3.org/2000/svg","g")),Ia.setAttribute("transform",e),!(e=Ia.transform.baseVal.consolidate()))?_l:(e=e.matrix,Um(e.a,e.b,e.c,e.d,e.e,e.f))}function Fm(e,t,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push("translate(",null,t,null,o);y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m||f)&&p.push("translate("+m+t+f+o)}function l(d,u,m,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:m.push(a(m)+"rotate(",null,i)-2,x:cn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,f){d!==u?f.push({i:m.push(a(m)+"skewX(",null,i)-2,x:cn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,f,p,y){if(d!==m||u!==f){var g=p.push(a(p)+"scale(",null,",",null,")");y.push({i:g-4,x:cn(d,m)},{i:g-2,x:cn(u,f)})}else(m!==1||f!==1)&&p.push(a(p)+"scale("+m+","+f+")")}return function(d,u){var m=[],f=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,f),l(d.rotate,u.rotate,m,f),s(d.skewX,u.skewX,m,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,f),d=u=null,function(p){for(var y=-1,g=f.length,_;++y<g;)m[(_=f[y]).i]=_.x(p);return m.join("")}}}var CI=Fm(xI,"px, ","px)","deg)"),SI=Fm(II,", ",")",")"),$I=1e-12;function Hm(e){return((e=Math.exp(e))+1/e)/2}function RI(e){return((e=Math.exp(e))-1/e)/2}function AI(e){return((e=Math.exp(2*e))-1)/(e+1)}const TI=(function e(t,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],f=l[2],p=u-s,y=m-c,g=p*p+y*y,_,b;if(g<$I)b=Math.log(f/d)/t,_=function(G){return[s+G*p,c+G*y,d*Math.exp(t*G*b)]};else{var N=Math.sqrt(g),h=(f*f-d*d+i*g)/(2*d*o*N),k=(f*f-d*d-i*g)/(2*f*o*N),P=Math.log(Math.sqrt(h*h+1)-h),A=Math.log(Math.sqrt(k*k+1)-k);b=(A-P)/t,_=function(G){var K=G*b,v=Hm(P),T=d/(o*N)*(v*AI(t*K+P)-RI(P));return[s+T*p,c+T*y,d*v/Hm(t*K+P)]}}return _.duration=b*1e3*t/Math.SQRT2,_}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var mo=0,ei=0,ti=0,Gm=1e3,Ca,ni,Sa=0,Bn=0,$a=0,oi=typeof performance=="object"&&performance.now?performance:Date,jm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kl(){return Bn||(jm(VI),Bn=oi.now()+$a)}function VI(){Bn=0}function Ra(){this._call=this._time=this._next=null}Ra.prototype=Km.prototype={constructor:Ra,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?kl():+o)+(t==null?0:+t),!this._next&&ni!==this&&(ni?ni._next=this:Ca=this,ni=this),this._call=e,this._time=o,El()},stop:function(){this._call&&(this._call=null,this._time=1/0,El())}};function Km(e,t,o){var i=new Ra;return i.restart(e,t,o),i}function MI(){kl(),++mo;for(var e=Ca,t;e;)(t=Bn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mo}function Ym(){Bn=(Sa=oi.now())+$a,mo=ei=0;try{MI()}finally{mo=0,DI(),Bn=0}}function BI(){var e=oi.now(),t=e-Sa;t>Gm&&($a-=t,Sa=e)}function DI(){for(var e,t=Ca,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:Ca=o);ni=e,El(i)}function El(e){if(!mo){ei&&(ei=clearTimeout(ei));var t=e-Bn;t>24?(e<1/0&&(ei=setTimeout(Ym,e-oi.now()-$a)),ti&&(ti=clearInterval(ti))):(ti||(Sa=oi.now(),ti=setInterval(BI,Gm)),mo=1,jm(Ym))}}function Wm(e,t,o){var i=new Ra;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,o),i}var OI=sl("start","end","cancel","interrupt"),LI=[],qm=0,Xm=1,Nl=2,Aa=3,Jm=4,wl=5,Ta=6;function Va(e,t,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;PI(e,o,{name:t,index:i,group:a,on:OI,tween:LI,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:qm})}function vl(e,t){var o=$t(e,t);if(o.state>qm)throw new Error("too late; already scheduled");return o}function Pt(e,t){var o=$t(e,t);if(o.state>Aa)throw new Error("too late; already running");return o}function $t(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function PI(e,t,o){var i=e.__transition,a;i[t]=o,o.timer=Km(r,0,o.time);function r(d){o.state=Xm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,f,p;if(o.state!==Xm)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Aa)return Wm(l);p.state===Jm?(p.state=Ta,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<t&&(p.state=Ta,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Wm(function(){o.state===Aa&&(o.state=Jm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Nl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Nl){for(o.state=Aa,a=new Array(f=o.tween.length),u=0,m=-1;u<f;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=wl,1),m=-1,f=a.length;++m<f;)a[m].call(e,u);o.state===wl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ta,o.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function Ma(e,t){var o=e.__transition,i,a,r=!0,l;if(o){t=t==null?null:t+"";for(l in o){if((i=o[l]).name!==t){r=!1;continue}a=i.state>Nl&&i.state<wl,i.state=Ta,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function zI(e){return this.each(function(){Ma(this,e)})}function UI(e,t){var o,i;return function(){var a=Pt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===t){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function FI(e,t,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Pt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:t,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===t){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function HI(e,t){var o=this._id;if(e+="",arguments.length<2){for(var i=$t(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((t==null?UI:FI)(o,e,t))}function xl(e,t,o){var i=e._id;return e.each(function(){var a=Pt(this,i);(a.value||(a.value={}))[t]=o.apply(this,arguments)}),function(a){return $t(a,i).value[t]}}function Zm(e,t){var o;return(typeof t=="number"?cn:t instanceof Qo?Pm:(o=Qo(t))?(t=o,Pm):vI)(e,t)}function GI(e){return function(){this.removeAttribute(e)}}function jI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function KI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=t(i=l,o)}}function YI(e,t,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=t(i=l,o)}}function WI(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function qI(e,t,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s)))}}function XI(e,t){var o=ka(e),i=o==="transform"?SI:Zm;return this.attrTween(e,typeof t=="function"?(o.local?qI:WI)(o,i,xl(this,"attr."+e,t)):t==null?(o.local?jI:GI)(o):(o.local?YI:KI)(o,i,t))}function JI(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function ZI(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function QI(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&ZI(e,r)),o}return a._value=t,a}function eC(e,t){var o,i;function a(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&JI(e,r)),o}return a._value=t,a}function tC(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=ka(e);return this.tween(o,(i.local?QI:eC)(i,t))}function nC(e,t){return function(){vl(this,e).delay=+t.apply(this,arguments)}}function oC(e,t){return t=+t,function(){vl(this,e).delay=t}}function iC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nC:oC)(t,e)):$t(this.node(),t).delay}function aC(e,t){return function(){Pt(this,e).duration=+t.apply(this,arguments)}}function rC(e,t){return t=+t,function(){Pt(this,e).duration=t}}function lC(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?aC:rC)(t,e)):$t(this.node(),t).duration}function sC(e,t){if(typeof t!="function")throw new Error;return function(){Pt(this,e).ease=t}}function cC(e){var t=this._id;return arguments.length?this.each(sC(t,e)):$t(this.node(),t).ease}function dC(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;Pt(this,e).ease=o}}function uC(e){if(typeof e!="function")throw new Error;return this.each(dC(this._id,e))}function mC(e){typeof e!="function"&&(e=gm(e));for(var t=this._groups,o=t.length,i=new Array(o),a=0;a<o;++a)for(var r=t[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Wt(i,this._parents,this._name,this._id)}function fC(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,i=t.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=t[s],d=o[s],u=c.length,m=l[s]=new Array(u),f,p=0;p<u;++p)(f=c[p]||d[p])&&(m[p]=f);for(;s<i;++s)l[s]=t[s];return new Wt(l,this._parents,this._name,this._id)}function pC(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 hC(e,t,o){var i,a,r=pC(t)?vl:Pt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(t,o),l.on=a}}function yC(e,t){var o=this._id;return arguments.length<2?$t(this.node(),o).on.on(e):this.each(hC(o,e,t))}function gC(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function bC(){return this.on("end.remove",gC(this._id))}function _C(e){var t=this._name,o=this._id;typeof e!="function"&&(e=dl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,f=0;f<c;++f)(u=s[f])&&(m=e.call(u,u.__data__,f,s))&&("__data__"in u&&(m.__data__=u.__data__),d[f]=m,Va(d[f],t,o,f,d,$t(u,o)));return new Wt(r,this._parents,t,o)}function kC(e){var t=this._name,o=this._id;typeof e!="function"&&(e=ym(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var f=e.call(u,u.__data__,m,c),p,y=$t(u,o),g=0,_=f.length;g<_;++g)(p=f[g])&&Va(p,t,o,g,f,y);r.push(f),l.push(u)}return new Wt(r,l,t,o)}var EC=qo.prototype.constructor;function NC(){return new EC(this._groups,this._parents)}function wC(e,t){var o,i,a;return function(){var r=co(this,e),l=(this.style.removeProperty(e),co(this,e));return r===l?null:r===o&&l===i?a:a=t(o=r,i=l)}}function Qm(e){return function(){this.style.removeProperty(e)}}function vC(e,t,o){var i,a=o+"",r;return function(){var l=co(this,e);return l===a?null:l===i?r:r=t(i=l,o)}}function xC(e,t,o){var i,a,r;return function(){var l=co(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),co(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=t(i=l,s))}}function IC(e,t){var o,i,a,r="style."+t,l="end."+r,s;return function(){var c=Pt(this,e),d=c.on,u=c.value[r]==null?s||(s=Qm(t)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function CC(e,t,o){var i=(e+="")=="transform"?CI:Zm;return t==null?this.styleTween(e,wC(e,i)).on("end.style."+e,Qm(e)):typeof t=="function"?this.styleTween(e,xC(e,i,xl(this,"style."+e,t))).each(IC(this._id,e)):this.styleTween(e,vC(e,i,t),o).on("end.style."+e,null)}function SC(e,t,o){return function(i){this.style.setProperty(e,t.call(this,i),o)}}function $C(e,t,o){var i,a;function r(){var l=t.apply(this,arguments);return l!==a&&(i=(a=l)&&SC(e,l,o)),i}return r._value=t,r}function RC(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,$C(e,t,o??""))}function AC(e){return function(){this.textContent=e}}function TC(e){return function(){var t=e(this);this.textContent=t??""}}function VC(e){return this.tween("text",typeof e=="function"?TC(xl(this,"text",e)):AC(e==null?"":e+""))}function MC(e){return function(t){this.textContent=e.call(this,t)}}function BC(e){var t,o;function i(){var a=e.apply(this,arguments);return a!==o&&(t=(o=a)&&MC(a)),t}return i._value=e,i}function DC(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,BC(e))}function OC(){for(var e=this._name,t=this._id,o=ef(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=$t(c,t);Va(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Wt(i,this._parents,e,o)}function LC(){var e,t,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Pt(this,i),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),d.on=t}),a===0&&r()})}var PC=0;function Wt(e,t,o,i){this._groups=e,this._parents=t,this._name=o,this._id=i}function ef(){return++PC}var qt=qo.prototype;Wt.prototype={constructor:Wt,select:_C,selectAll:kC,selectChild:qt.selectChild,selectChildren:qt.selectChildren,filter:mC,merge:fC,selection:NC,transition:OC,call:qt.call,nodes:qt.nodes,node:qt.node,size:qt.size,empty:qt.empty,each:qt.each,on:yC,attr:XI,attrTween:tC,style:CC,styleTween:RC,text:VC,textTween:DC,remove:bC,tween:HI,delay:iC,duration:lC,ease:cC,easeVarying:uC,end:LC,[Symbol.iterator]:qt[Symbol.iterator]};function zC(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var UC={time:null,delay:0,duration:250,ease:zC};function FC(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 HC(e){var t,o;e instanceof Wt?(t=e._id,e=e._name):(t=ef(),(o=UC).time=kl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Va(c,e,t,d,l,o||FC(c,t));return new Wt(i,this._parents,e,t)}qo.prototype.interrupt=zI,qo.prototype.transition=HC;const Ba=e=>()=>e;function GC(e,{sourceEvent:t,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Xt(e,t,o){this.k=e,this.x=t,this.y=o}Xt.prototype={constructor:Xt,scale:function(e){return e===1?this:new Xt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Il=new Xt(1,0,0);Xt.prototype;function Cl(e){e.stopImmediatePropagation()}function ii(e){e.preventDefault(),e.stopImmediatePropagation()}function jC(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function KC(){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 tf(){return this.__zoom||Il}function YC(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WC(){return navigator.maxTouchPoints||"ontouchstart"in this}function qC(e,t,o){var i=e.invertX(t[0][0])-o[0][0],a=e.invertX(t[1][0])-o[1][0],r=e.invertY(t[0][1])-o[0][1],l=e.invertY(t[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function XC(){var e=jC,t=KC,o=qC,i=YC,a=WC,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=TI,d=sl("start","zoom","end"),u,m,f,p=500,y=150,g=0,_=10;function b(E){E.property("__zoom",tf).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",v).on("dblclick.zoom",T).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(E,Y,S,W){var ee=E.selection?E.selection():E;ee.property("__zoom",tf),E!==ee?P(E,Y,S,W):ee.interrupt().each(function(){A(this,arguments).event(W).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(E,Y,S,W){b.scaleTo(E,function(){var ee=this.__zoom.k,ie=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*ie},S,W)},b.scaleTo=function(E,Y,S,W){b.transform(E,function(){var ee=t.apply(this,arguments),ie=this.__zoom,O=S==null?k(ee):typeof S=="function"?S.apply(this,arguments):S,U=ie.invert(O),ne=typeof Y=="function"?Y.apply(this,arguments):Y;return o(h(N(ie,ne),O,U),ee,l)},S,W)},b.translateBy=function(E,Y,S,W){b.transform(E,function(){return o(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,W)},b.translateTo=function(E,Y,S,W,ee){b.transform(E,function(){var ie=t.apply(this,arguments),O=this.__zoom,U=W==null?k(ie):typeof W=="function"?W.apply(this,arguments):W;return o(Il.translate(U[0],U[1]).scale(O.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},W,ee)};function N(E,Y){return Y=Math.max(r[0],Math.min(r[1],Y)),Y===E.k?E:new Xt(Y,E.x,E.y)}function h(E,Y,S){var W=Y[0]-S[0]*E.k,ee=Y[1]-S[1]*E.k;return W===E.x&&ee===E.y?E:new Xt(E.k,W,ee)}function k(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function P(E,Y,S,W){E.on("start.zoom",function(){A(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(W).end()}).tween("zoom",function(){var ee=this,ie=arguments,O=A(ee,ie).event(W),U=t.apply(ee,ie),ne=S==null?k(U):typeof S=="function"?S.apply(ee,ie):S,ce=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),ge=ee.__zoom,se=typeof Y=="function"?Y.apply(ee,ie):Y,pe=c(ge.invert(ne).concat(ce/ge.k),se.invert(ne).concat(ce/se.k));return function(be){if(be===1)be=se;else{var xe=pe(be),Te=ce/xe[2];be=new Xt(Te,ne[0]-xe[0]*Te,ne[1]-xe[1]*Te)}O.zoom(null,be)}})}function A(E,Y,S){return!S&&E.__zooming||new G(E,Y)}function G(E,Y){this.that=E,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,Y),this.taps=0}G.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,Y){return this.mouse&&E!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var Y=ln(this.that).datum();d.call(E,this.that,new GC(E,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),Y)}};function K(E,...Y){if(!e.apply(this,arguments))return;var S=A(this,Y).event(E),W=this.__zoom,ee=Math.max(r[0],Math.min(r[1],W.k*Math.pow(2,i.apply(this,arguments)))),ie=sn(E);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=W.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(W.k===ee)return;S.mouse=[ie,W.invert(ie)],Ma(this),S.start()}ii(E),S.wheel=setTimeout(O,y),S.zoom("mouse",o(h(N(W,ee),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function v(E,...Y){if(f||!e.apply(this,arguments))return;var S=E.currentTarget,W=A(this,Y,!0).event(E),ee=ln(E.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",ce,!0),ie=sn(E,S),O=E.clientX,U=E.clientY;aI(E.view),Cl(E),W.mouse=[ie,this.__zoom.invert(ie)],Ma(this),W.start();function ne(ge){if(ii(ge),!W.moved){var se=ge.clientX-O,pe=ge.clientY-U;W.moved=se*se+pe*pe>g}W.event(ge).zoom("mouse",o(h(W.that.__zoom,W.mouse[0]=sn(ge,S),W.mouse[1]),W.extent,l))}function ce(ge){ee.on("mousemove.zoom mouseup.zoom",null),rI(ge.view,W.moved),ii(ge),W.event(ge).end()}}function T(E,...Y){if(e.apply(this,arguments)){var S=this.__zoom,W=sn(E.changedTouches?E.changedTouches[0]:E,this),ee=S.invert(W),ie=S.k*(E.shiftKey?.5:2),O=o(h(N(S,ie),W,ee),t.apply(this,Y),l);ii(E),s>0?ln(this).transition().duration(s).call(P,O,W,E):ln(this).call(b.transform,O,W,E)}}function H(E,...Y){if(e.apply(this,arguments)){var S=E.touches,W=S.length,ee=A(this,Y,E.changedTouches.length===W).event(E),ie,O,U,ne;for(Cl(E),O=0;O<W;++O)U=S[O],ne=sn(U,this),ne=[ne,this.__zoom.invert(ne),U.identifier],ee.touch0?!ee.touch1&&ee.touch0[2]!==ne[2]&&(ee.touch1=ne,ee.taps=0):(ee.touch0=ne,ie=!0,ee.taps=1+!!u);u&&(u=clearTimeout(u)),ie&&(ee.taps<2&&(m=ne[0],u=setTimeout(function(){u=null},p)),Ma(this),ee.start())}}function C(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O,U,ne;for(ii(E),ie=0;ie<ee;++ie)O=W[ie],U=sn(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=U:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=U);if(O=S.that.__zoom,S.touch1){var ce=S.touch0[0],ge=S.touch0[1],se=S.touch1[0],pe=S.touch1[1],be=(be=se[0]-ce[0])*be+(be=se[1]-ce[1])*be,xe=(xe=pe[0]-ge[0])*xe+(xe=pe[1]-ge[1])*xe;O=N(O,Math.sqrt(be/xe)),U=[(ce[0]+se[0])/2,(ce[1]+se[1])/2],ne=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2]}else if(S.touch0)U=S.touch0[0],ne=S.touch0[1];else return;S.zoom("touch",o(h(O,U,ne),S.extent,l))}}function ae(E,...Y){if(this.__zooming){var S=A(this,Y).event(E),W=E.changedTouches,ee=W.length,ie,O;for(Cl(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),ie=0;ie<ee;++ie)O=W[ie],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=sn(O,this),Math.hypot(m[0]-O[0],m[1]-O[1])<_)){var U=ln(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return b.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Ba(+E),b):i},b.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ba(!!E),b):e},b.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Ba(!!E),b):a},b.extent=function(E){return arguments.length?(t=typeof E=="function"?E:Ba([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),b):t},b.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],b):[r[0],r[1]]},b.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(E){return arguments.length?(o=E,b):o},b.duration=function(E){return arguments.length?(s=+E,b):s},b.interpolate=function(E){return arguments.length?(c=E,b):c},b.on=function(){var E=d.on.apply(d,arguments);return E===d?b:E},b.clickDistance=function(E){return arguments.length?(g=(E=+E)*E,b):Math.sqrt(g)},b.tapDistance=function(E){return arguments.length?(_=+E,b):_},b}const nf=Symbol("MiniMapSlots"),JC=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],ZC={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},QC=n.defineComponent({...ZC,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(nf),a=n.useAttrs(),r=n.toRef(()=>a.style??{});function l(m){t("click",m)}function s(m){t("dblclick",m)}function c(m){t("mouseenter",m)}function d(m){t("mousemove",m)}function u(m){t("mouseleave",m)}return(m,f)=>!m.hidden&&m.dimensions.width!==0&&m.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,...m.$attrs})),null,16)):(n.openBlock(),n.createElementBlock("rect",n.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,JC))],64)):n.createCommentVNode("",!0)}}),eS=["width","height","viewBox","aria-labelledby"],tS=["id"],nS=["d","fill","stroke","stroke-width"],oS={name:"MiniMap",compatConfig:{MODE:3}},iS=n.defineComponent({...oS,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const o=n.useSlots(),i=n.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:f,d3Zoom:p,getNodesInitialized:y}=He(),g=n.ref();n.provide(nf,o);const _=n.toRef(()=>{var ee;return e.width??((ee=i.style)==null?void 0:ee.width)??a}),b=n.toRef(()=>{var ee;return e.height??((ee=i.style)==null?void 0:ee.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=n.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=n.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),P=n.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=n.computed(()=>Ur(y.value.filter(ee=>!ee.hidden))),G=n.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),K=n.computed(()=>y.value&&y.value.length?y1(A.value,G.value):G.value),v=n.computed(()=>{const ee=K.value.width/_.value,ie=K.value.height/b.value;return Math.max(ee,ie)}),T=n.computed(()=>{const ee=v.value*_.value,ie=v.value*b.value,O=e.offsetScale*v.value;return{offset:O,x:K.value.x-(ee-K.value.width)/2-O,y:K.value.y-(ie-K.value.height)/2-O,width:ee+O*2,height:ie+O*2}}),H=n.computed(()=>!T.value.x||!T.value.y?"":`
49
- M${T.value.x-T.value.offset},${T.value.y-T.value.offset}
50
- h${T.value.width+T.value.offset*2}
51
- v${T.value.height+T.value.offset*2}
52
- h${-T.value.width-T.value.offset*2}z
53
- M${G.value.x+e.maskBorderRadius},${G.value.y}
54
- h${G.value.width-2*e.maskBorderRadius}
48
+ 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 lt extends Error{constructor(n,...o){var i;super((i=wu[n])==null?void 0:i.call(wu,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function il(e){return"clientX"in e}function ok(e){return"sourceEvent"in e}function zt(e,n){const o=il(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const Jo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ik(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function ua(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const ak=()=>!0;function al(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function rk(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())la(a,ra(r))>0&&i.push(r);return i}const lk=250;function sk(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=rk(e,o,n+lk);for(const d of c){const m=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const u of m){if(i.nodeId===u.nodeId&&i.type===u.type&&i.id===u.id)continue;const{x:p,y}=ro(d,u,u.position,!0),f=Math.sqrt((p-e.x)**2+(y-e.y)**2);f>n||(f<s?(l=[{...u,x:p,y}],s=f):f===s&&l.push({...u,x:p,y}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(m=>m.type===d)??l[0]}return l[0]}function vu(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=ak},m,u,p,y){const f=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:h,y:_}=zt(e),E=l.elementFromPoint(h,_),g=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:b,N={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const V=Iu(void 0,g),T=g.getAttribute("data-nodeid"),I=g.getAttribute("data-handleid"),z=g.classList.contains("connectable"),w=g.classList.contains("connectableend");if(!T||!V)return N;const x={source:f?T:i,sourceHandle:f?I:a,target:f?i:T,targetHandle:f?a:I};N.connection=x;const C=z&&w&&(o===qt.Strict?f&&V==="source"||!f&&V==="target":T!==i||I!==a);N.isValid=C&&d(x,{nodes:u,edges:m,sourceNode:p(x.source),targetNode:p(x.target)}),N.toHandle=xu(T,V,I,y,o,!0)}return N}function Iu(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function ck(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function dk(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function xu(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const m=a===qt.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],u=(o?m==null?void 0:m.find(p=>p.id===o):m==null?void 0:m[0])??null;return u&&r?{...u,...ro(d,u,u.position,!0)}:u}const rl={[Be.Left]:Be.Right,[Be.Right]:Be.Left,[Be.Top]:Be.Bottom,[Be.Bottom]:Be.Top},uk=["production","prod"];function Zo(e,...n){Cu()&&console.warn(`[Vue Flow]: ${e}`,...n)}function Cu(){return!uk.includes(process.env.NODE_ENV||"")}function Su(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...sa(l)}}):null}function ll(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ot(e){return typeof t.unref(e)<"u"}function mk(e,n,o,i){if(!e||!e.source||!e.target)return o(new lt(nt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return on(e)?a=e:a={...e,id:lu(e)},a=au(a,void 0,i),K1(a,n)?!1:a}function fk(e,n,o,i,a){if(!n.source||!n.target)return a(new lt(nt.EDGE_INVALID,e.id)),!1;if(!o)return a(new lt(nt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?lu(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function $u(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Sn(l)){o(new lt(nt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=H1(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new lt(nt.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Ru(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function sl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,m=`${r}-${s}--${a}-${l}`;Ru("source",c,m,e,a,l),Ru("target",c,d,e,r,s)}}function Au(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function cl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const m=on(d)?d:mk(d,s,a,r);if(!m)continue;const u=o(m.source),p=o(m.target);if(!u||!p){a(new lt(nt.EDGE_SOURCE_TARGET_MISSING,m.id,m.source,m.target));continue}if(!u){a(new lt(nt.EDGE_SOURCE_MISSING,m.id,m.source));continue}if(!p){a(new lt(nt.EDGE_TARGET_MISSING,m.id,m.target));continue}if(n&&!n(m,{edges:s,nodes:l,sourceNode:u,targetNode:p})){a(new lt(nt.EDGE_INVALID,m.id));continue}const y=i(m.id);c.push({...au(m,y,r),sourceNode:u,targetNode:p})}return c}const Tu=Symbol("vueFlow"),Vu=Symbol("nodeId"),Mu=Symbol("nodeRef"),pk=Symbol("edgeId"),hk=Symbol("edgeRef"),ma=Symbol("slots");function Bu(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:m,nodesDraggable:u,panBy:p,findNode:y,multiSelectionActive:f,nodesSelectionActive:b,selectNodesOnDrag:h,removeSelectedElements:_,addSelectedNodes:E,updateNodePositions:g,emits:N}=Ge(),{onStart:V,onDrag:T,onStop:I,onClick:z,el:w,disabled:x,id:F,selectable:C,dragHandle:se}=e,k=t.shallowRef(!1);let G=[],S,H=null,Q={x:void 0,y:void 0},ie={x:0,y:0},oe=null,W=!1,fe=!1,ge=0,$e=!1;const pe=bk(),Ne=({x:ke,y:ue})=>{Q={x:ke,y:ue};let L=!1;if(G=G.map(D=>{const K={x:ke-D.distance.x,y:ue-D.distance.y},{computedPosition:Z}=ol(D,o.value?ua(K,i.value):K,N.error,l.value,D.parentNode?y(D.parentNode):void 0);return L=L||D.position.x!==Z.x||D.position.y!==Z.y,D.position=Z,D}),fe=fe||L,!!L&&(g(G,!0,!0),k.value=!0,oe)){const[D,K]=nl({id:F,dragItems:G,findNode:y});T({event:oe,node:D,nodes:K})}},ve=()=>{if(!H)return;const[ke,ue]=pu(ie,H,m.value);if(ke!==0||ue!==0){const L={x:(Q.x??0)-ke/c.value.zoom,y:(Q.y??0)-ue/c.value.zoom};p({x:ke,y:ue})&&Ne(L)}ge=requestAnimationFrame(ve)},Te=(ke,ue)=>{W=!0;const L=y(F);!h.value&&!f.value&&L&&(L.selected||_()),L&&t.toValue(C)&&h.value&&ll(L,f.value,E,_,b,!1,ue);const D=pe(ke.sourceEvent);if(Q=D,G=J1(r.value,u.value,D,F),G.length){const[K,Z]=nl({id:F,dragItems:G,findNode:y});V({event:ke.sourceEvent,node:K,nodes:Z})}},re=(ke,ue)=>{var L;ke.sourceEvent.type==="touchmove"&&ke.sourceEvent.touches.length>1||(fe=!1,s.value===0&&Te(ke,ue),Q=pe(ke.sourceEvent),H=((L=n.value)==null?void 0:L.getBoundingClientRect())||null,ie=zt(ke.sourceEvent,H))},_e=(ke,ue)=>{const L=pe(ke.sourceEvent);if(!$e&&W&&d.value&&($e=!0,ve()),!W){const D=L.xSnapped-(Q.x??0),K=L.ySnapped-(Q.y??0);Math.sqrt(D*D+K*K)>s.value&&Te(ke,ue)}(Q.x!==L.xSnapped||Q.y!==L.ySnapped)&&G.length&&W&&(oe=ke.sourceEvent,ie=zt(ke.sourceEvent,H),Ne(L))},me=ke=>{let ue=!1;if(!W&&!k.value&&!f.value){const L=ke.sourceEvent,D=pe(L),K=D.xSnapped-(Q.x??0),Z=D.ySnapped-(Q.y??0),ne=Math.sqrt(K*K+Z*Z);ne!==0&&ne<=s.value&&(z==null||z(L),ue=!0)}if(G.length&&!ue){fe&&(g(G,!1,!1),fe=!1);const[L,D]=nl({id:F,dragItems:G,findNode:y});I({event:ke.sourceEvent,node:L,nodes:D})}G=[],k.value=!1,$e=!1,W=!1,Q={x:void 0,y:void 0},cancelAnimationFrame(ge)};return t.watch([()=>t.toValue(x),w],([ke,ue],L,D)=>{if(ue){const K=It(ue);ke||(S=Fb().on("start",Z=>re(Z,ue)).on("drag",Z=>_e(Z,ue)).on("end",Z=>me(Z)).filter(Z=>{const ne=Z.target,te=t.toValue(se);return!Z.button&&(!a.value||!ku(ne,`.${a.value}`,ue)&&(!te||ku(ne,te,ue)))}),K.call(S)),D(()=>{K.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),k}function yk(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function gk(e,n){const o=yk();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function bk(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=Ge();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=ok(a)?a.sourceEvent:a,{x:c,y:d}=zt(s,l),m=Wo({x:c,y:d},e.value),{x:u,y:p}=o.value?ua(m,n.value):m;return{xSnapped:u,ySnapped:p,...m}}}function fa(){return!0}function Du({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:m,connectOnClick:u,connectionClickStartHandle:p,nodesConnectable:y,autoPanOnConnect:f,autoPanSpeed:b,findNode:h,panBy:_,startConnection:E,updateConnection:g,endConnection:N,emits:V,viewport:T,edges:I,nodes:z,isValidConnection:w,nodeLookup:x}=Ge();let F=null,C=!1,se=null;function k(S){var H;const Q=t.toValue(o)==="target",ie=il(S),oe=iu(S.target),W=S.currentTarget;if(W&&(ie&&S.button===0||!ie)){let fe=function(X){L=zt(X,me),Ne=sk(Wo(L,T.value,!1,[1,1]),m.value,x.value,Z),D||(K(),D=!0);const ee=vu(X,{handle:Ne,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:Q?"target":"source",isValidConnection:pe,doc:oe,lib:"vue",flowId:s,nodeLookup:x.value},I.value,z.value,h,x.value);se=ee.handleDomNode,F=ee.connection,C=dk(!!Ne,ee.isValid);const Re={...J,isValid:C,to:ee.toHandle&&C?qo({x:ee.toHandle.x,y:ee.toHandle.y},T.value):L,toHandle:ee.toHandle,toPosition:C&&ee.toHandle?ee.toHandle.position:rl[Z.position],toNode:ee.toHandle?x.value.get(ee.toHandle.nodeId):null};if(C&&Ne&&(J!=null&&J.toHandle)&&Re.toHandle&&J.toHandle.type===Re.toHandle.type&&J.toHandle.nodeId===Re.toHandle.nodeId&&J.toHandle.id===Re.toHandle.id&&J.to.x===Re.to.x&&J.to.y===Re.to.y)return;const Le=Ne??ee.toHandle;if(g(Le&&C?qo({x:Le.x,y:Le.y},T.value):L,Le,ck(!!Le,C)),J=Re,!Ne&&!C&&!se)return al(ue);F&&F.source!==F.target&&se&&(al(ue),ue=se,se.classList.add("connecting","vue-flow__handle-connecting"),se.classList.toggle("valid",!!C),se.classList.toggle("vue-flow__handle-valid",!!C))},ge=function(X){"touches"in X&&X.touches.length>0||((Ne||se)&&F&&C&&(r?r(X,F):V.connect(F)),V.connectEnd(X),a&&(l==null||l(X)),al(ue),cancelAnimationFrame(ve),N(X),D=!1,C=!1,F=null,se=null,oe.removeEventListener("mousemove",fe),oe.removeEventListener("mouseup",ge),oe.removeEventListener("touchmove",fe),oe.removeEventListener("touchend",ge))};const $e=h(t.toValue(n));let pe=t.toValue(i)||w.value||fa;!pe&&$e&&(pe=(Q?$e.isValidSourcePos:$e.isValidTargetPos)||fa);let Ne,ve=0;const{x:Te,y:re}=zt(S),_e=Iu(t.toValue(a),W),me=(H=c.value)==null?void 0:H.getBoundingClientRect();if(!me||!_e)return;const ke=xu(t.toValue(n),_e,t.toValue(e),x.value,d.value);if(!ke)return;let ue,L=zt(S,me),D=!1;const K=()=>{if(!f.value)return;const[X,ee]=pu(L,me,b.value);_({x:X,y:ee}),ve=requestAnimationFrame(K)},Z={...ke,nodeId:t.toValue(n),type:_e,position:ke.position},ne=x.value.get(t.toValue(n)),ye={inProgress:!0,isValid:null,from:ro(ne,Z,Be.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:ne,to:L,toHandle:null,toPosition:rl[Z.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:_e,position:(W==null?void 0:W.getAttribute("data-handlepos"))||Be.Top,...L},{x:Te-me.left,y:re-me.top}),V.connectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:_e});let J=ye;oe.addEventListener("mousemove",fe),oe.addEventListener("mouseup",ge),oe.addEventListener("touchmove",fe),oe.addEventListener("touchend",ge)}}function G(S){var H,Q;if(!u.value)return;const ie=t.toValue(o)==="target";if(!p.value){V.clickConnectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Be.Top,...zt(S)},void 0,!0);return}let oe=t.toValue(i)||w.value||fa;const W=h(t.toValue(n));if(!oe&&W&&(oe=(ie?W.isValidSourcePos:W.isValidTargetPos)||fa),W&&(typeof W.connectable>"u"?y.value:W.connectable)===!1)return;const fe=iu(S.target),ge=vu(S,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Be.Top,...zt(S)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:oe,doc:fe,lib:"vue",flowId:s,nodeLookup:x.value},I.value,z.value,h,x.value),$e=((H=ge.connection)==null?void 0:H.source)===((Q=ge.connection)==null?void 0:Q.target);ge.isValid&&ge.connection&&!$e&&V.connect(ge.connection),V.clickConnectEnd(S),N(S,!0)}return{handlePointerDown:k,handleClick:G}}function _k(){return t.inject(Vu,"")}function Ou(e){const n=e??_k()??"",o=t.inject(Mu,t.ref(null)),{findNode:i,edges:a,emits:r}=Ge(),l=i(n);return l||r.error(new lt(nt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>$n([l],a.value))}}function kk(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function Ek(e,n){const o=kk();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function Lu(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=Ge();return(c,d=!1)=>{const m=r.value?a.value[0]:5,u=r.value?a.value[1]:5,p=d?4:1,y=c.x*m*p,f=c.y*u*p,b=[];for(const h of e.value)if(h.draggable||l&&typeof h.draggable>"u"){const _={x:h.computedPosition.x+y,y:h.computedPosition.y+f},{position:E}=ol(h,_,s.error,n.value,h.parentNode?i(h.parentNode):void 0);b.push({id:h.id,position:E,from:h.position,distance:{x:c.x,y:c.y},dimensions:h.dimensions})}o(b,!0,!1)}}const pa=.1,Nk=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function ln(){return Zo("Viewport not initialized yet."),Promise.resolve(!1)}const wk={zoomIn:ln,zoomOut:ln,zoomTo:ln,fitView:ln,setCenter:ln,fitBounds:ln,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:ln,setTransform:ln,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vk(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?Po:Xi).scaleBy(dl(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:m}=ou({x:-i,y:-a},e.translateExtent),u=oo.translate(-d,-m).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?Po:Xi).transform(dl(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),u):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?Po:Xi).scaleTo(dl(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:pa,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=Qr(s),{x:d,y:m,zoom:u}=uu(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??pa);return o(d,m,u,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:pa})=>{const{x:l,y:s,zoom:c}=uu(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??pa);return o(l,s,c,r)},project:a=>Wo(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return Wo(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return qo(s,e.viewport)}return{x:0,y:0}}}:wk)}function dl(e,n=0,o=Nk,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function Ik(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,h,_=!!(o.nodes.value.length||o.edges.value.length);b=Zn([e.modelValue,()=>{var E,g;return(g=(E=e.modelValue)==null?void 0:E.value)==null?void 0:g.length}],([E])=>{E&&Array.isArray(E)&&(h==null||h.pause(),o.setElements(E),!h&&!_&&E.length?_=!0:h==null||h.resume())}),h=Zn([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,g])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...E,...g],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),h==null||h.stop()})})},r=()=>{i.run(()=>{let b,h,_=!!o.nodes.value.length;b=Zn([e.nodes,()=>{var E,g;return(g=(E=e.nodes)==null?void 0:E.value)==null?void 0:g.length}],([E])=>{E&&Array.isArray(E)&&(h==null||h.pause(),o.setNodes(E),!h&&!_&&E.length?_=!0:h==null||h.resume())}),h=Zn([o.nodes,()=>o.nodes.value.length],([E])=>{var g;(g=e.nodes)!=null&&g.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...E],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),h==null||h.stop()})})},l=()=>{i.run(()=>{let b,h,_=!!o.edges.value.length;b=Zn([e.edges,()=>{var E,g;return(g=(E=e.edges)==null?void 0:E.value)==null?void 0:g.length}],([E])=>{E&&Array.isArray(E)&&(h==null||h.pause(),o.setEdges(E),!h&&!_&&E.length?_=!0:h==null||h.resume())}),h=Zn([o.edges,()=>o.edges.value.length],([E])=>{var g;(g=e.edges)!=null&&g.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...E],t.nextTick(()=>{b==null||b.resume()}))},{immediate:_}),t.onScopeDispose(()=>{b==null||b.stop(),h==null||h.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ot(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ot(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ot(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ot(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ot(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const b=async h=>{let _=h;typeof n.autoConnect=="function"&&(_=await n.autoConnect(h)),_!==!1&&o.addEdges([_])};t.watch(()=>n.autoConnect,()=>{ot(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(h,_,E)=>{h?o.onConnect(b):o.hooks.value.connect.off(b),E(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},y=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const h of Object.keys(n)){const _=h;if(!b.includes(_)){const E=t.toRef(()=>n[_]),g=o[_];t.isRef(g)&&i.run(()=>{t.watch(E,N=>{ot(N)&&(g.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),m(),u(),p(),y()})()}),()=>i.stop()}function xk(){return{edgesChange:Me(),nodesChange:Me(),nodeDoubleClick:Me(),nodeClick:Me(),nodeMouseEnter:Me(),nodeMouseMove:Me(),nodeMouseLeave:Me(),nodeContextMenu:Me(),nodeDragStart:Me(),nodeDrag:Me(),nodeDragStop:Me(),nodesInitialized:Me(),miniMapNodeClick:Me(),miniMapNodeDoubleClick:Me(),miniMapNodeMouseEnter:Me(),miniMapNodeMouseMove:Me(),miniMapNodeMouseLeave:Me(),connect:Me(),connectStart:Me(),connectEnd:Me(),clickConnectStart:Me(),clickConnectEnd:Me(),paneReady:Me(),init:Me(),move:Me(),moveStart:Me(),moveEnd:Me(),selectionDragStart:Me(),selectionDrag:Me(),selectionDragStop:Me(),selectionContextMenu:Me(),selectionStart:Me(),selectionEnd:Me(),viewportChangeStart:Me(),viewportChange:Me(),viewportChangeEnd:Me(),paneScroll:Me(),paneClick:Me(),paneContextMenu:Me(),paneMouseEnter:Me(),paneMouseMove:Me(),paneMouseLeave:Me(),edgeContextMenu:Me(),edgeMouseEnter:Me(),edgeMouseMove:Me(),edgeMouseLeave:Me(),edgeDoubleClick:Me(),edgeClick:Me(),edgeUpdateStart:Me(),edgeUpdate:Me(),edgeUpdateEnd:Me(),updateNodeInternals:Me(),error:Me(e=>Zo(e.message))}}function Ck(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),Vo(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),Vo(r.removeHasEmitListeners)}});function i(a){var r;const l=Sk(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function Sk(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Pu(){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:Xr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Go.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:xn.Bezier,style:{}},connectionMode:qt.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:Jo()?"Meta":"Control",zoomActivationKeyCode:Jo()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:xk(),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 $k=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Rk(e,n,o){const i=vk(e),a=L=>{const D=L??[];e.hooks.updateNodeInternals.trigger(D)},r=L=>G1(L,e.nodes,e.edges),l=L=>j1(L,e.nodes,e.edges),s=L=>$n(L,e.edges),c=({id:L,type:D,nodeId:K})=>{var Z;const ne=L?`-${D}-${L}`:`-${D}`;return Array.from(((Z=e.connectionLookup.get(`${K}${ne}`))==null?void 0:Z.values())??[])},d=L=>{if(L)return n.value.get(L)},m=L=>{if(L)return o.value.get(L)},u=(L,D,K)=>{var Z,ne;const te=[];for(const ye of L){const J={id:ye.id,type:"position",dragging:K,from:ye.from};if(D&&(J.position=ye.position,ye.parentNode)){const X=d(ye.parentNode);J.position={x:J.position.x-(((Z=X==null?void 0:X.computedPosition)==null?void 0:Z.x)??0),y:J.position.y-(((ne=X==null?void 0:X.computedPosition)==null?void 0:ne.y)??0)}}te.push(J)}te!=null&&te.length&&e.hooks.nodesChange.trigger(te)},p=L=>{if(!e.vueFlowRef)return;const D=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!D)return;const K=window.getComputedStyle(D),{m22:Z}=new window.DOMMatrixReadOnly(K.transform),ne=[];for(const te of L){const ye=te,J=d(ye.id);if(J){const X=sa(ye.nodeElement);if(!!(X.width&&X.height&&(J.dimensions.width!==X.width||J.dimensions.height!==X.height||ye.forceUpdate))){const Re=ye.nodeElement.getBoundingClientRect();J.dimensions=X,J.handleBounds.source=Su("source",ye.nodeElement,Re,Z,J.id),J.handleBounds.target=Su("target",ye.nodeElement,Re,Z,J.id),ne.push({id:J.id,type:"dimensions",dimensions:X})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ne.length&&e.hooks.nodesChange.trigger(ne)},y=(L,D)=>{const K=new Set,Z=new Set;for(const ye of L)Sn(ye)?K.add(ye.id):on(ye)&&Z.add(ye.id);const ne=rn(n.value,K,!0),te=rn(o.value,Z);if(e.multiSelectionActive){for(const ye of K)ne.push(an(ye,D));for(const ye of Z)te.push(an(ye,D))}ne.length&&e.hooks.nodesChange.trigger(ne),te.length&&e.hooks.edgesChange.trigger(te)},f=L=>{if(e.multiSelectionActive){const D=L.map(K=>an(K.id,!0));e.hooks.nodesChange.trigger(D);return}e.hooks.nodesChange.trigger(rn(n.value,new Set(L.map(D=>D.id)),!0)),e.hooks.edgesChange.trigger(rn(o.value))},b=L=>{if(e.multiSelectionActive){const D=L.map(K=>an(K.id,!0));e.hooks.edgesChange.trigger(D);return}e.hooks.edgesChange.trigger(rn(o.value,new Set(L.map(D=>D.id)))),e.hooks.nodesChange.trigger(rn(n.value,new Set,!0))},h=L=>{y(L,!0)},_=L=>{const K=(L||e.nodes).map(Z=>(Z.selected=!1,an(Z.id,!1)));e.hooks.nodesChange.trigger(K)},E=L=>{const K=(L||e.edges).map(Z=>(Z.selected=!1,an(Z.id,!1)));e.hooks.edgesChange.trigger(K)},g=L=>{if(!L||!L.length)return y([],!1);const D=L.reduce((K,Z)=>{const ne=an(Z.id,!1);return Sn(Z)?K.nodes.push(ne):K.edges.push(ne),K},{nodes:[],edges:[]});D.nodes.length&&e.hooks.nodesChange.trigger(D.nodes),D.edges.length&&e.hooks.edgesChange.trigger(D.edges)},N=L=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([L,e.maxZoom]),e.minZoom=L},V=L=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([e.minZoom,L]),e.maxZoom=L},T=L=>{var D;(D=e.d3Zoom)==null||D.translateExtent(L),e.translateExtent=L},I=L=>{e.nodeExtent=L,a()},z=L=>{var D;(D=e.d3Zoom)==null||D.clickDistance(L)},w=L=>{e.nodesDraggable=L,e.nodesConnectable=L,e.elementsSelectable=L},x=L=>{const D=L instanceof Function?L(e.nodes):L;!e.initialized&&!D.length||(e.nodes=$u(D,d,e.hooks.error.trigger))},F=L=>{const D=L instanceof Function?L(e.edges):L;if(!e.initialized&&!D.length)return;const K=cl(D,e.isValidConnection,d,m,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);sl(e.connectionLookup,o.value,K),e.edges=K},C=L=>{const D=L instanceof Function?L([...e.nodes,...e.edges]):L;!e.initialized&&!D.length||(x(D.filter(Sn)),F(D.filter(on)))},se=L=>{let D=L instanceof Function?L(e.nodes):L;D=Array.isArray(D)?D:[D];const K=$u(D,d,e.hooks.error.trigger),Z=[];for(const ne of K)Z.push(yu(ne));Z.length&&e.hooks.nodesChange.trigger(Z)},k=L=>{let D=L instanceof Function?L(e.edges):L;D=Array.isArray(D)?D:[D];const K=cl(D,e.isValidConnection,d,m,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Z=[];for(const ne of K)Z.push(yu(ne));Z.length&&e.hooks.edgesChange.trigger(Z)},G=(L,D=!0,K=!1)=>{const Z=L instanceof Function?L(e.nodes):L,ne=Array.isArray(Z)?Z:[Z],te=[],ye=[];function J(ee){const Re=s(ee);for(const Le of Re)(!ot(Le.deletable)||Le.deletable)&&ye.push(bu(Le.id,Le.source,Le.target,Le.sourceHandle,Le.targetHandle))}function X(ee){const Re=[];for(const Le of e.nodes)Le.parentNode===ee&&Re.push(Le);if(Re.length){for(const Le of Re)te.push(gu(Le.id));D&&J(Re);for(const Le of Re)X(Le.id)}}for(const ee of ne){const Re=typeof ee=="string"?d(ee):ee;Re&&(ot(Re.deletable)&&!Re.deletable||(te.push(gu(Re.id)),D&&J([Re]),K&&X(Re.id)))}ye.length&&e.hooks.edgesChange.trigger(ye),te.length&&e.hooks.nodesChange.trigger(te)},S=L=>{const D=L instanceof Function?L(e.edges):L,K=Array.isArray(D)?D:[D],Z=[];for(const ne of K){const te=typeof ne=="string"?m(ne):ne;te&&(ot(te.deletable)&&!te.deletable||Z.push(bu(typeof ne=="string"?ne:ne.id,te.source,te.target,te.sourceHandle,te.targetHandle)))}e.hooks.edgesChange.trigger(Z)},H=(L,D,K=!0)=>{const Z=m(L.id);if(!Z)return!1;const ne=e.edges.indexOf(Z),te=fk(L,D,Z,K,e.hooks.error.trigger);if(te){const[ye]=cl([te],e.isValidConnection,d,m,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((J,X)=>X===ne?ye:J),sl(e.connectionLookup,o.value,[ye]),ye}return!1},Q=(L,D,K={replace:!1})=>{const Z=m(L);if(!Z)return;const ne=typeof D=="function"?D(Z):D;Z.data=K.replace?ne:{...Z.data,...ne}},ie=L=>hu(L,e.nodes),oe=L=>{const D=hu(L,e.edges);return sl(e.connectionLookup,o.value,D),D},W=(L,D,K={replace:!1})=>{const Z=d(L);if(!Z)return;const ne=typeof D=="function"?D(Z):D;K.replace?e.nodes.splice(e.nodes.indexOf(Z),1,ne):Object.assign(Z,ne)},fe=(L,D,K={replace:!1})=>{const Z=d(L);if(!Z)return;const ne=typeof D=="function"?D(Z):D;Z.data=K.replace?ne:{...Z.data,...ne}},ge=(L,D,K=!1)=>{K?e.connectionClickStartHandle=L:e.connectionStartHandle=L,e.connectionEndHandle=null,e.connectionStatus=null,D&&(e.connectionPosition=D)},$e=(L,D=null,K=null)=>{e.connectionStartHandle&&(e.connectionPosition=L,e.connectionEndHandle=D,e.connectionStatus=K)},pe=(L,D)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,D?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Ne=L=>{const D=F1(L),K=D?null:Yo(L)?L:d(L.id);return!D&&!K?[null,null,D]:[D?L:ra(K),K,D]},ve=(L,D=!0,K=e.nodes)=>{const[Z,ne,te]=Ne(L);if(!Z)return[];const ye=[];for(const J of K||e.nodes){if(!te&&(J.id===ne.id||!J.computedPosition))continue;const X=ra(J),ee=la(X,Z);(D&&ee>0||ee>=X.width*X.height||ee>=Number(Z.width)*Number(Z.height))&&ye.push(J)}return ye},Te=(L,D,K=!0)=>{const[Z]=Ne(L);if(!Z)return!1;const ne=la(Z,D);return K&&ne>0||ne>=Number(Z.width)*Number(Z.height)},re=L=>{const{viewport:D,dimensions:K,d3Zoom:Z,d3Selection:ne,translateExtent:te}=e;if(!Z||!ne||!L.x&&!L.y)return!1;const ye=oo.translate(D.x+L.x,D.y+L.y).scale(D.zoom),J=[[0,0],[K.width,K.height]],X=Z.constrain()(ye,J,te),ee=e.viewport.x!==X.x||e.viewport.y!==X.y||e.viewport.zoom!==X.k;return Z.transform(ne,X),ee},_e=L=>{const D=L instanceof Function?L(e):L,K=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ot(D.defaultEdgeOptions)&&(e.defaultEdgeOptions=D.defaultEdgeOptions);const Z=D.modelValue||D.nodes||D.edges?[]:void 0;Z&&(D.modelValue&&Z.push(...D.modelValue),D.nodes&&Z.push(...D.nodes),D.edges&&Z.push(...D.edges),C(Z));const ne=()=>{ot(D.maxZoom)&&V(D.maxZoom),ot(D.minZoom)&&N(D.minZoom),ot(D.translateExtent)&&T(D.translateExtent)};for(const te of Object.keys(D)){const ye=te,J=D[ye];![...$k,...K].includes(ye)&&ot(J)&&(e[ye]=J)}$r(()=>e.d3Zoom).not.toBeNull().then(ne),e.initialized||(e.initialized=!0)};return{updateNodePositions:u,updateNodeDimensions:p,setElements:C,setNodes:x,setEdges:F,addNodes:se,addEdges:k,removeNodes:G,removeEdges:S,findNode:d,findEdge:m,updateEdge:H,updateEdgeData:Q,updateNode:W,updateNodeData:fe,applyEdgeChanges:oe,applyNodeChanges:ie,addSelectedElements:h,addSelectedNodes:f,addSelectedEdges:b,setMinZoom:N,setMaxZoom:V,setTranslateExtent:T,setNodeExtent:I,setPaneClickDistance:z,removeSelectedElements:g,removeSelectedNodes:_,removeSelectedEdges:E,startConnection:ge,updateConnection:$e,endConnection:pe,setInteractive:w,setState:_e,getIntersectingNodes:ve,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Te,panBy:re,fitView:L=>i.value.fitView(L),zoomIn:L=>i.value.zoomIn(L),zoomOut:L=>i.value.zoomOut(L),zoomTo:(L,D)=>i.value.zoomTo(L,D),setViewport:(L,D)=>i.value.setViewport(L,D),setTransform:(L,D)=>i.value.setTransform(L,D),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(L,D,K)=>i.value.setCenter(L,D,K),fitBounds:(L,D)=>i.value.fitBounds(L,D),project:L=>i.value.project(L),screenToFlowCoordinate:L=>i.value.screenToFlowCoordinate(L),flowToScreenCoordinate:L=>i.value.flowToScreenCoordinate(L),toObject:()=>{const L=[],D=[];for(const K of e.nodes){const{computedPosition:Z,handleBounds:ne,selected:te,dimensions:ye,isParent:J,resizing:X,dragging:ee,events:Re,...Le}=K;L.push(Le)}for(const K of e.edges){const{selected:Z,sourceNode:ne,targetNode:te,events:ye,...J}=K;D.push(J)}return JSON.parse(JSON.stringify({nodes:L,edges:D,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:L=>new Promise(D=>{const{nodes:K,edges:Z,position:ne,zoom:te,viewport:ye}=L;K&&x(K),Z&&F(Z);const[J,X]=ye!=null&&ye.x&&(ye!=null&&ye.y)?[ye.x,ye.y]:ne??[null,null];if(J&&X){const ee=(ye==null?void 0:ye.zoom)||te||e.viewport.zoom;return $r(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:J,y:X,zoom:ee}).then(()=>{D(!0)})})}else D(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const L=Pu();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const D=oo.translate(L.defaultViewport.x??0,L.defaultViewport.y??0).scale(Cn(L.defaultViewport.zoom??1,L.minZoom,L.maxZoom)),K=e.viewportRef.getBoundingClientRect(),Z=[[0,0],[K.width,K.height]],ne=e.d3Zoom.constrain()(D,Z,L.translateExtent);e.d3Zoom.transform(e.d3Selection,ne)}_e(L)},$destroy:()=>{}}}const Ak=["data-id","data-handleid","data-nodeid","data-handlepos"],Tk={name:"Handle",compatConfig:{MODE:3}},Rn=t.defineComponent({...Tk,props:{id:{default:null},type:{},position:{default:()=>Be.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:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:m,noDragClassName:u,noPanClassName:p}=Ge(),{id:y,node:f,nodeEl:b,connectedEdges:h}=Ou(),_=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var F,C,se,k,G,S;return((F=l.value)==null?void 0:F.nodeId)===y&&((C=l.value)==null?void 0:C.id)===e.id&&((se=l.value)==null?void 0:se.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===y&&((G=c.value)==null?void 0:G.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),V=t.toRef(()=>{var F,C,se;return((F=s.value)==null?void 0:F.nodeId)===y&&((C=s.value)==null?void 0:C.id)===e.id&&((se=s.value)==null?void 0:se.type)===i.value}),{handlePointerDown:T,handleClick:I}=Du({nodeId:y,handleId:e.id,isValidConnection:a,type:i}),z=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!h.value.some(F=>{const C=F[`${i.value}Handle`];return F[i.value]!==y?!1:C?C===e.id:!0}):typeof e.connectable=="number"?h.value.filter(F=>{const C=F[`${i.value}Handle`];return F[i.value]!==y?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(f,h.value):ot(e.connectable)?e.connectable:m.value);t.onMounted(()=>{var F;if(!f.dimensions.width||!f.dimensions.height)return;const C=(F=f.handleBounds[i.value])==null?void 0:F.find(ie=>ie.id===e.id);if(!d.value||C)return;const se=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!_.value||!se||!e.id)return;const k=b.value.getBoundingClientRect(),G=_.value.getBoundingClientRect(),S=window.getComputedStyle(se),{m22:H}=new window.DOMMatrixReadOnly(S.transform),Q={id:e.id,position:e.position,x:(G.left-k.left)/H,y:(G.top-k.top)/H,type:i.value,nodeId:y,...sa(_.value)};f.handleBounds[i.value]=[...f.handleBounds[i.value]??[],Q]});function w(F){const C=il(F);z.value&&E.value&&(C&&F.button===0||!C)&&T(F)}function x(F){!y||!s.value&&!E.value||z.value&&I(F)}return n({handleClick:I,handlePointerDown:T,onClick:x,onPointerDown:w}),(F,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${t.unref(r)}-${t.unref(y)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(y),"data-handlepos":F.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${F.position}`,`vue-flow__handle-${e.id}`,t.unref(u),t.unref(p),i.value,{connectable:z.value,connecting:V.value,connectablestart:E.value,connectableend:g.value,connectionindicator:z.value&&(E.value&&!N.value||g.value&&N.value)}]]),onMousedown:w,onTouchstartPassive:w,onClick:x},[t.renderSlot(F.$slots,"default",{id:F.id})],42,Ak))}}),ha=function({sourcePosition:e=Be.Bottom,targetPosition:n=Be.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Rn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Rn,{type:"source",position:e,connectable:i,isValidConnection:r})]};ha.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ha.inheritAttrs=!1,ha.compatConfig={MODE:3};const Vk=ha,ya=function({targetPosition:e=Be.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Rn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};ya.props=["targetPosition","label","isValidTargetPos","connectable","data"],ya.inheritAttrs=!1,ya.compatConfig={MODE:3};const Mk=ya,ga=function({sourcePosition:e=Be.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Rn,{type:"source",position:e,connectable:o,isValidConnection:i})]};ga.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ga.inheritAttrs=!1,ga.compatConfig={MODE:3};const Bk=ga,Dk=["transform"],Ok=["width","height","x","y","rx","ry"],Lk=["y"],Pk={name:"EdgeText",compatConfig:{MODE:3}},zk=t.defineComponent({...Pk,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Ok)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,Lk)],8,Dk))}}),Uk=["id","d","marker-end","marker-start"],Fk=["d","stroke-width"],Hk={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ba=t.defineComponent({...Hk,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Uk),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Fk)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(zk,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function zu({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function Uu({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,m=Math.abs(c-e),u=Math.abs(d-n);return[c,d,m,u]}function _a(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Fu({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Be.Left:l=n-_a(n-i,r),s=o;break;case Be.Right:l=n+_a(i-n,r),s=o;break;case Be.Top:l=n,s=o-_a(o-a,r);break;case Be.Bottom:l=n,s=o+_a(a-o,r);break}return[l,s]}function Hu(e){const{sourceX:n,sourceY:o,sourcePosition:i=Be.Bottom,targetX:a,targetY:r,targetPosition:l=Be.Top,curvature:s=.25}=e,[c,d]=Fu({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[m,u]=Fu({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,y,f,b]=Uu({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:m,targetControlY:u});return[`M${n},${o} C${c},${d} ${m},${u} ${a},${r}`,p,y,f,b]}function ju({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Be.Left:case Be.Right:r=.5*(n+i),l=o;break;case Be.Top:case Be.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Gu(e){const{sourceX:n,sourceY:o,sourcePosition:i=Be.Bottom,targetX:a,targetY:r,targetPosition:l=Be.Top}=e,[s,c]=ju({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,m]=ju({pos:l,x1:a,y1:r,x2:n,y2:o}),[u,p,y,f]=Uu({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:m});return[`M${n},${o} C${s},${c} ${d},${m} ${a},${r}`,u,p,y,f]}const Ku={[Be.Left]:{x:-1,y:0},[Be.Right]:{x:1,y:0},[Be.Top]:{x:0,y:-1},[Be.Bottom]:{x:0,y:1}};function jk({source:e,sourcePosition:n=Be.Bottom,target:o}){return n===Be.Left||n===Be.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 Yu(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function Gk({source:e,sourcePosition:n=Be.Bottom,target:o,targetPosition:i=Be.Top,center:a,offset:r}){const l=Ku[n],s=Ku[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},m=jk({source:c,sourcePosition:n,target:d}),u=m.x!==0?"x":"y",p=m[u];let y,f,b;const h={x:0,y:0},_={x:0,y:0},[E,g,N,V]=zu({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[u]*s[u]===-1){f=a.x??E,b=a.y??g;const I=[{x:f,y:c.y},{x:f,y:d.y}],z=[{x:c.x,y:b},{x:d.x,y:b}];l[u]===p?y=u==="x"?I:z:y=u==="x"?z:I}else{const I=[{x:c.x,y:d.y}],z=[{x:d.x,y:c.y}];if(u==="x"?y=l.x===p?z:I:y=l.y===p?I:z,n===i){const se=Math.abs(e[u]-o[u]);if(se<=r){const k=Math.min(r-1,r-se);l[u]===p?h[u]=(c[u]>e[u]?-1:1)*k:_[u]=(d[u]>o[u]?-1:1)*k}}if(n!==i){const se=u==="x"?"y":"x",k=l[u]===s[se],G=c[se]>d[se],S=c[se]<d[se];(l[u]===1&&(!k&&G||k&&S)||l[u]!==1&&(!k&&S||k&&G))&&(y=u==="x"?I:z)}const w={x:c.x+h.x,y:c.y+h.y},x={x:d.x+_.x,y:d.y+_.y},F=Math.max(Math.abs(w.x-y[0].x),Math.abs(x.x-y[0].x)),C=Math.max(Math.abs(w.y-y[0].y),Math.abs(x.y-y[0].y));F>=C?(f=(w.x+x.x)/2,b=y[0].y):(f=y[0].x,b=(w.y+x.y)/2)}return[[e,{x:c.x+h.x,y:c.y+h.y},...y,{x:d.x+_.x,y:d.y+_.y},o],f,b,N,V]}function Kk(e,n,o,i){const a=Math.min(Yu(e,n)/2,Yu(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,m=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*m}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function ul(e){const{sourceX:n,sourceY:o,sourcePosition:i=Be.Bottom,targetX:a,targetY:r,targetPosition:l=Be.Top,borderRadius:s=5,centerX:c,centerY:d,offset:m=20}=e,[u,p,y,f,b]=Gk({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:m});return[u.reduce((_,E,g)=>{let N;return g>0&&g<u.length-1?N=Kk(u[g-1],E,u[g+1],s):N=`${g===0?"M":"L"}${E.x} ${E.y}`,_+=N,_},""),p,y,f,b]}function Yk(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=zu({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const qk=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Yk(e);return t.h(ba,{path:o,labelX:i,labelY:a,...n,...e})}}}),qu=t.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:n}){return()=>{const[o,i,a]=ul({...e,sourcePosition:e.sourcePosition??Be.Bottom,targetPosition:e.targetPosition??Be.Top});return t.h(ba,{path:o,labelX:i,labelY:a,...n,...e})}}}),Wk=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(qu,{...e,...n,borderRadius:0})}}),Xk=t.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:n}){return()=>{const[o,i,a]=Hu({...e,sourcePosition:e.sourcePosition??Be.Bottom,targetPosition:e.targetPosition??Be.Top});return t.h(ba,{path:o,labelX:i,labelY:a,...n,...e})}}}),Jk=t.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:n}){return()=>{const[o,i,a]=Gu({...e,sourcePosition:e.sourcePosition??Be.Bottom,targetPosition:e.targetPosition??Be.Top});return t.h(ba,{path:o,labelX:i,labelY:a,...n,...e})}}}),Zk={input:Bk,default:Vk,output:Mk},Qk={default:Xk,straight:qk,step:Wk,smoothstep:qu,simplebezier:Jk};function e0(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={...Qk,...e.edgeTypes},h=Object.keys(b);for(const _ of e.edges)_.type&&!h.includes(_.type)&&(b[_.type]=_.type);return b}),l=t.computed(()=>{const b={...Zk,...e.nodeTypes},h=Object.keys(b);for(const _ of e.nodes)_.type&&!h.includes(_.type)&&(b[_.type]=_.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?du(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const h of e.edges){const _=n.value.get(h.source),E=n.value.get(h.target);tk({sourcePos:_.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(h)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),m=t.computed(()=>{const b=[];for(const h of e.nodes)h.selected&&b.push(h);return b}),u=t.computed(()=>{const b=[];for(const h of e.edges)h.selected&&b.push(h);return b}),p=t.computed(()=>[...m.value,...u.value]),y=t.computed(()=>{const b=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&h.handleBounds!==void 0&&b.push(h);return b}),f=t.computed(()=>s.value.length>0&&y.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:m,getSelectedEdges:u,getNodesInitialized:y,areNodesInitialized:f}}class An{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??An.instance;return An.instance=i??new An,o&&(o.config.globalProperties.$vueFlowStorage=An.instance),An.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Pu(),a=t.reactive(i),r={};for(const[p,y]of Object.entries(a.hooks)){const f=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[f]=y.on}const l={};for(const[p,y]of Object.entries(a.hooks))l[p]=y.trigger;const s=t.computed(()=>{const p=new Map;for(const y of a.nodes)p.set(y.id,y);return p}),c=t.computed(()=>{const p=new Map;for(const y of a.edges)p.set(y.id,y);return p}),d=e0(a,s,c),m=Rk(a,s,c);m.setState({...a,...o});const u={...r,...d,...m,...Jy(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,u),u}getId(){return`vue-flow-${this.currentId++}`}}function Ge(e){const n=An.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Tu,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(u,p,y)=>{const f=h=>{d.applyNodeChanges(h)},b=h=>{d.applyEdgeChanges(h)};u?(d.onNodesChange(f),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(f),d.hooks.value.edgesChange.off(b)),y(()=>{d.hooks.value.nodesChange.off(f),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),Vo(()=>{if(s){const u=n.get(s.id);u?u.$destroy():Zo(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Tu,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new lt(nt.USEVUEFLOW_OPTIONS))}return s}function t0(e){const{emits:n,dimensions:o}=Ge();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=sa(e.value);(s.width===0||s.height===0)&&n.error(new lt(nt.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const n0={name:"UserSelection",compatConfig:{MODE:3}},o0=t.defineComponent({...n0,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),i0=["tabIndex"],a0={name:"NodesSelection",compatConfig:{MODE:3}},r0=t.defineComponent({...a0,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=Ge(),s=Lu(),c=t.ref(null),d=Bu({el:c,onStart(f){n.selectionDragStart(f),n.nodeDragStart(f)},onDrag(f){n.selectionDrag(f),n.nodeDrag(f)},onStop(f){n.selectionDragStop(f),n.nodeDragStop(f)}});t.onMounted(()=>{var f;r.value||(f=c.value)==null||f.focus({preventScroll:!0})});const m=t.computed(()=>Qr(i.value)),u=t.computed(()=>({width:`${m.value.width}px`,height:`${m.value.height}px`,top:`${m.value.y}px`,left:`${m.value.x}px`}));function p(f){n.selectionContextMenu({event:f,nodes:i.value})}function y(f){r.value||io[f.key]&&(f.preventDefault(),s({x:io[f.key].x,y:io[f.key].y},f.shiftKey))}return(f,b)=>!t.unref(l)&&m.value.width&&m.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(u.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:y},null,46,i0)],6)):t.createCommentVNode("",!0)}});function l0(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const s0={name:"Pane",compatConfig:{MODE:3}},c0=t.defineComponent({...s0,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:m,getSelectedNodes:u,removeNodes:p,removeEdges:y,selectionMode:f,deleteKeyCode:b,multiSelectionKeyCode:h,multiSelectionActive:_,edgeLookup:E,nodeLookup:g,connectionLookup:N,defaultEdgeOptions:V,connectionStartHandle:T,panOnDrag:I}=Ge(),z=t.shallowRef(null),w=t.shallowRef(new Set),x=t.shallowRef(new Set),F=t.shallowRef(null),C=t.toRef(()=>c.value&&(e.isSelecting||r.value)),se=t.toRef(()=>T.value!==null);let k=!1,G=!1;const S=Ko(b,{actInsideInputWithModifier:!1}),H=Ko(h);t.watch(S,pe=>{pe&&(p(u.value),y(m.value),d.value=!1)}),t.watch(H,pe=>{_.value=pe});function Q(pe,Ne){return ve=>{ve.target===Ne&&(pe==null||pe(ve))}}function ie(pe){if(k||se.value){k=!1;return}a.paneClick(pe),l(),d.value=!1}function oe(pe){var Ne;if(Array.isArray(I.value)&&((Ne=I.value)!=null&&Ne.includes(2))){pe.preventDefault();return}a.paneContextMenu(pe)}function W(pe){a.paneScroll(pe)}function fe(pe){var Ne,ve,Te;if(F.value=((Ne=n.value)==null?void 0:Ne.getBoundingClientRect())??null,!c.value||!e.isSelecting||pe.button!==0||pe.target!==z.value||!F.value)return;(Te=(ve=pe.target)==null?void 0:ve.setPointerCapture)==null||Te.call(ve,pe.pointerId);const{x:re,y:_e}=l0(pe,F.value);G=!0,k=!1,l(),s.value={width:0,height:0,startX:re,startY:_e,x:re,y:_e},a.selectionStart(pe)}function ge(pe){var Ne;if(!F.value||!s.value)return;k=!0;const{x:ve,y:Te}=zt(pe,F.value),{startX:re=0,startY:_e=0}=s.value,me={startX:re,startY:_e,x:ve<re?ve:re,y:Te<_e?Te:_e,width:Math.abs(ve-re),height:Math.abs(Te-_e)},ke=w.value,ue=x.value;w.value=new Set(du(o.value,me,i.value,f.value===Xr.Partial,!0).map(D=>D.id)),x.value=new Set;const L=((Ne=V.value)==null?void 0:Ne.selectable)??!0;for(const D of w.value){const K=N.value.get(D);if(K)for(const{edgeId:Z}of K.values()){const ne=E.value.get(Z);ne&&(ne.selectable??L)&&x.value.add(Z)}}if(!Au(ke,w.value)){const D=rn(g.value,w.value,!0);a.nodesChange(D)}if(!Au(ue,x.value)){const D=rn(E.value,x.value);a.edgesChange(D)}s.value=me,r.value=!0,d.value=!1}function $e(pe){var Ne;pe.button!==0||!G||((Ne=pe.target)==null||Ne.releasePointerCapture(pe.pointerId),!r.value&&s.value&&pe.target===z.value&&ie(pe),r.value=!1,s.value=null,d.value=w.value.size>0,a.selectionEnd(pe),e.selectionKeyPressed&&(k=!1),G=!1)}return(pe,Ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:z,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:pe.isSelecting}]),onClick:Ne[0]||(Ne[0]=ve=>C.value?void 0:Q(ie,z.value)(ve)),onContextmenu:Ne[1]||(Ne[1]=ve=>Q(oe,z.value)(ve)),onWheelPassive:Ne[2]||(Ne[2]=ve=>Q(W,z.value)(ve)),onPointerenter:Ne[3]||(Ne[3]=ve=>C.value?void 0:t.unref(a).paneMouseEnter(ve)),onPointerdown:Ne[4]||(Ne[4]=ve=>C.value?fe(ve):t.unref(a).paneMouseMove(ve)),onPointermove:Ne[5]||(Ne[5]=ve=>C.value?ge(ve):t.unref(a).paneMouseMove(ve)),onPointerup:Ne[6]||(Ne[6]=ve=>C.value?$e(ve):void 0),onPointerleave:Ne[7]||(Ne[7]=ve=>t.unref(a).paneMouseLeave(ve))},[t.renderSlot(pe.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(o0,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(u).length?(t.openBlock(),t.createBlock(r0,{key:1})):t.createCommentVNode("",!0)],34))}}),d0={name:"Transform",compatConfig:{MODE:3}},u0=t.defineComponent({...d0,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=Ge(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),m0={name:"Viewport",compatConfig:{MODE:3}},f0=t.defineComponent({...m0,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:m,panOnDrag:u,zoomOnDoubleClick:p,zoomOnPinch:y,zoomOnScroll:f,preventScrolling:b,noWheelClassName:h,noPanClassName:_,emits:E,connectionStartHandle:g,userSelectionActive:N,paneDragging:V,d3Zoom:T,d3Selection:I,d3ZoomHandler:z,viewport:w,viewportRef:x,paneClickDistance:F}=Ge();t0(x);const C=t.shallowRef(!1),se=t.shallowRef(!1);let k=null,G=!1,S=0,H={x:0,y:0,zoom:0};const Q=Ko(s),ie=Ko(l),oe=Ko(r),W=t.toRef(()=>(!ie.value||ie.value&&l.value===!0)&&(Q.value||u.value)),fe=t.toRef(()=>Q.value||c.value),ge=t.toRef(()=>l.value===!0&&W.value!==!0),$e=t.toRef(()=>ie.value&&l.value!==!0||N.value||ge.value),pe=t.toRef(()=>g.value!==null);t.onMounted(()=>{if(!x.value){Zo("Viewport element is missing");return}const _e=x.value,me=_e.getBoundingClientRect(),ke=B1().clickDistance(F.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=It(_e).call(ke),L=ue.on("wheel.zoom"),D=oo.translate(i.value.x??0,i.value.y??0).scale(Cn(i.value.zoom??1,n.value,o.value)),K=[[0,0],[me.width,me.height]],Z=ke.constrain()(D,K,a.value);ke.transform(ue,Z),ke.wheelDelta(el),T.value=ke,I.value=ue,z.value=L,w.value={x:Z.x,y:Z.y,zoom:Z.k},ke.on("start",ne=>{var te;if(!ne.sourceEvent)return null;S=ne.sourceEvent.button,C.value=!0;const ye=Te(ne.transform);((te=ne.sourceEvent)==null?void 0:te.type)==="mousedown"&&(V.value=!0),H=ye,E.viewportChangeStart(ye),E.moveStart({event:ne,flowTransform:ye})}),ke.on("end",ne=>{if(!ne.sourceEvent)return null;if(C.value=!1,V.value=!1,Ne(W.value,S??0)&&!G&&E.paneContextMenu(ne.sourceEvent),G=!1,ve(H,ne.transform)){const te=Te(ne.transform);H=te,E.viewportChangeEnd(te),E.moveEnd({event:ne,flowTransform:te})}}),ke.filter(ne=>{var te;const ye=oe.value||f.value,J=y.value&&ne.ctrlKey,X=ne.button,ee=ne.type==="wheel";if(X===1&&ne.type==="mousedown"&&(re(ne,"vue-flow__node")||re(ne,"vue-flow__edge")))return!0;if(!W.value&&!ye&&!fe.value&&!p.value&&!y.value||N.value||pe.value&&!ee||!p.value&&ne.type==="dblclick"||re(ne,h.value)&&ee||re(ne,_.value)&&(!ee||fe.value&&ee&&!oe.value)||!y.value&&ne.ctrlKey&&ee||!ye&&!fe.value&&!J&&ee)return!1;if(!y&&ne.type==="touchstart"&&((te=ne.touches)==null?void 0:te.length)>1)return ne.preventDefault(),!1;if(!W.value&&(ne.type==="mousedown"||ne.type==="touchstart")||ge.value&&Array.isArray(u.value)&&u.value.includes(0)&&X===0||Array.isArray(u.value)&&!u.value.includes(X)&&(ne.type==="mousedown"||ne.type==="touchstart"))return!1;const Re=Array.isArray(u.value)&&u.value.includes(X)||l.value===!0&&Array.isArray(u.value)&&!u.value.includes(0)||!X||X<=1;return(!ne.ctrlKey||Q.value||ee)&&Re}),t.watch([N,W],()=>{N.value&&!C.value?ke.on("zoom",null):N.value||ke.on("zoom",ne=>{w.value={x:ne.transform.x,y:ne.transform.y,zoom:ne.transform.k};const te=Te(ne.transform);G=Ne(W.value,S??0),E.viewportChange(te),E.move({event:ne,flowTransform:te})})},{immediate:!0}),t.watch([N,fe,d,oe,y,b,h],()=>{fe.value&&!oe.value&&!N.value?ue.on("wheel.zoom",ne=>{if(re(ne,h.value))return!1;const te=oe.value||f.value,ye=y.value&&ne.ctrlKey;if(!(!b.value||fe.value||te||ye))return!1;ne.preventDefault(),ne.stopImmediatePropagation();const X=ue.property("__zoom").k||1,ee=Jo();if(!Q.value&&ne.ctrlKey&&y.value&&ee){const et=Dt(ne),v=el(ne),M=X*2**v;ke.scaleTo(ue,M,et,ne);return}const Re=ne.deltaMode===1?20:1;let Le=d.value===Go.Vertical?0:ne.deltaX*Re,He=d.value===Go.Horizontal?0:ne.deltaY*Re;!ee&&ne.shiftKey&&d.value!==Go.Vertical&&!Le&&He&&(Le=He,He=0),ke.translateBy(ue,-(Le/X)*m.value,-(He/X)*m.value);const Oe=Te(ue.property("__zoom"));k&&clearTimeout(k),se.value?(E.move({event:ne,flowTransform:Oe}),E.viewportChange(Oe),k=setTimeout(()=>{E.moveEnd({event:ne,flowTransform:Oe}),E.viewportChangeEnd(Oe),se.value=!1},150)):(se.value=!0,E.moveStart({event:ne,flowTransform:Oe}),E.viewportChangeStart(Oe))},{passive:!1}):typeof L<"u"&&ue.on("wheel.zoom",function(ne,te){const ye=!b.value&&ne.type==="wheel"&&!ne.ctrlKey,J=oe.value||f.value,X=y.value&&ne.ctrlKey;if(!J&&!c.value&&!X&&ne.type==="wheel"||ye||re(ne,h.value))return null;ne.preventDefault(),L.call(this,ne,te)},{passive:!1})},{immediate:!0})});function Ne(_e,me){return me===2&&Array.isArray(_e)&&_e.includes(2)}function ve(_e,me){return _e.x!==me.x&&!Number.isNaN(me.x)||_e.y!==me.y&&!Number.isNaN(me.y)||_e.zoom!==me.k&&!Number.isNaN(me.k)}function Te(_e){return{x:_e.x,y:_e.y,zoom:_e.k}}function re(_e,me){return _e.target.closest(`.${me}`)}return(_e,me)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:x,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(c0,{"is-selecting":$e.value,"selection-key-pressed":t.unref(ie),class:t.normalizeClass({connecting:pe.value,dragging:t.unref(V),draggable:t.unref(u)===!0||Array.isArray(t.unref(u))&&t.unref(u).includes(0)})},{default:t.withCtx(()=>[t.createVNode(u0,null,{default:t.withCtx(()=>[t.renderSlot(_e.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),p0=["id"],h0=["id"],y0=["id"],g0={name:"A11yDescriptions",compatConfig:{MODE:3}},b0=t.defineComponent({...g0,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=Ge();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(eu)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.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,p0),t.createElementVNode("div",{id:`${t.unref(tu)}-${t.unref(n)}`,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,h0),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(U1)}-${t.unref(n)}`,"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%)"}},t.toDisplayString(t.unref(i)),9,y0))],64))}});function _0(){const e=Ge();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function k0(e,n,o){return o===Be.Left?e-n:o===Be.Right?e+n:e}function E0(e,n,o){return o===Be.Top?e-n:o===Be.Bottom?e+n:e}const ml=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Be.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:k0(n,e,i),cy:E0(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ml.props=["radius","centerX","centerY","position","type"],ml.compatConfig={MODE:3};const Wu=ml,N0=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:m,findNode:u,isValidConnection:p,multiSelectionActive:y,disableKeyboardA11y:f,elementsSelectable:b,edgesUpdatable:h,edgesFocusable:_,hooks:E}=Ge(),g=t.computed(()=>m(e.id)),{emit:N,on:V}=gk(g.value,r),T=t.inject(ma),I=t.getCurrentInstance(),z=t.ref(!1),w=t.ref(!1),x=t.ref(""),F=t.ref(null),C=t.ref("source"),se=t.ref(null),k=t.toRef(()=>typeof g.value.selectable>"u"?b.value:g.value.selectable),G=t.toRef(()=>typeof g.value.updatable>"u"?h.value:g.value.updatable),S=t.toRef(()=>typeof g.value.focusable>"u"?_.value:g.value.focusable);t.provide(pk,e.id),t.provide(hk,se);const H=t.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),Q=t.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),ie=t.computed(()=>{const D=g.value.type||"default",K=T==null?void 0:T[`edge-${D}`];if(K)return K;let Z=g.value.template??c.value[D];if(typeof Z=="string"&&I){const ne=Object.keys(I.appContext.components);ne&&ne.includes(D)&&(Z=t.resolveComponent(D,!1))}return Z&&typeof Z!="string"?Z:(r.error(new lt(nt.EDGE_TYPE_MISSING,Z)),!1)}),{handlePointerDown:oe}=Du({nodeId:x,handleId:F,type:C,isValidConnection:p,edgeUpdaterType:C,onEdgeUpdate:ge,onEdgeUpdateEnd:$e});return()=>{const D=u(g.value.source),K=u(g.value.target),Z="pathOptions"in g.value?g.value.pathOptions:{};if(!D&&!K)return r.error(new lt(nt.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!D)return r.error(new lt(nt.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!K)return r.error(new lt(nt.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||D.hidden||K.hidden)return null;let ne;i.value===qt.Strict?ne=D.handleBounds.source:ne=[...D.handleBounds.source||[],...D.handleBounds.target||[]];const te=Nu(ne,g.value.sourceHandle);let ye;i.value===qt.Strict?ye=K.handleBounds.target:ye=[...K.handleBounds.target||[],...K.handleBounds.source||[]];const J=Nu(ye,g.value.targetHandle),X=(te==null?void 0:te.position)||Be.Bottom,ee=(J==null?void 0:J.position)||Be.Top,{x:Re,y:Le}=ro(D,te,X),{x:He,y:Oe}=ro(K,J,ee);return g.value.sourceX=Re,g.value.sourceY=Le,g.value.targetX=He,g.value.targetY=Oe,t.h("g",{ref:se,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${ie.value===!1?"default":g.value.type||"default"}`,s.value,H.value,{updating:z.value,selected:g.value.selected,animated:g.value.animated,inactive:!k.value&&!E.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":S.value?`${tu}-${n}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...g.value.domAttributes,onClick:Ne,onContextmenu:ve,onDblclick:Te,onMouseenter:re,onMousemove:_e,onMouseleave:me,onKeyDown:S.value?L:void 0},[w.value?null:t.h(ie.value===!1?c.value.default:ie.value,{id:e.id,sourceNode:D,targetNode:K,source:g.value.source,target:g.value.target,type:g.value.type,updatable:G.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...V},style:Q.value,markerStart:`url('#${Xo(g.value.markerStart,n)}')`,markerEnd:`url('#${Xo(g.value.markerEnd,n)}')`,sourcePosition:X,targetPosition:ee,sourceX:Re,sourceY:Le,targetX:He,targetY:Oe,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...Z}),[G.value==="source"||G.value===!0?[t.h("g",{onMousedown:ke,onMouseenter:W,onMouseout:fe},t.h(Wu,{position:X,centerX:Re,centerY:Le,radius:a.value,type:"source","data-type":"source"}))]:null,G.value==="target"||G.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:W,onMouseout:fe},t.h(Wu,{position:ee,centerX:He,centerY:Oe,radius:a.value,type:"target","data-type":"target"}))]:null]])};function W(){z.value=!0}function fe(){z.value=!1}function ge(D,K){N.update({event:D,edge:g.value,connection:K})}function $e(D){N.updateEnd({event:D,edge:g.value}),w.value=!1}function pe(D,K){D.button===0&&(w.value=!0,x.value=K?g.value.target:g.value.source,F.value=(K?g.value.targetHandle:g.value.sourceHandle)??null,C.value=K?"target":"source",N.updateStart({event:D,edge:g.value}),oe(D))}function Ne(D){var K;const Z={event:D,edge:g.value};k.value&&(l.value=!1,g.value.selected&&y.value?(d([g.value]),(K=se.value)==null||K.blur()):o([g.value])),N.click(Z)}function ve(D){N.contextMenu({event:D,edge:g.value})}function Te(D){N.doubleClick({event:D,edge:g.value})}function re(D){N.mouseEnter({event:D,edge:g.value})}function _e(D){N.mouseMove({event:D,edge:g.value})}function me(D){N.mouseLeave({event:D,edge:g.value})}function ke(D){pe(D,!0)}function ue(D){pe(D,!1)}function L(D){var K;!f.value&&nu.includes(D.key)&&k.value&&(D.key==="Escape"?((K=se.value)==null||K.blur(),d([m(e.id)])):o([m(e.id)]))}}}),w0=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:m,findNode:u}=Ge(),p=(e=t.inject(ma))==null?void 0:e["connection-line"],y=t.computed(()=>{var E;return u((E=i.value)==null?void 0:E.nodeId)}),f=t.computed(()=>{var E;return u((E=a.value)==null?void 0:E.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-m.value.x)/m.value.zoom,y:(r.value.y-m.value.y)/m.value.zoom})),h=t.computed(()=>c.value.markerStart?`url(#${Xo(c.value.markerStart,n)})`:""),_=t.computed(()=>c.value.markerEnd?`url(#${Xo(c.value.markerEnd,n)})`:"");return()=>{var E,g,N;if(!y.value||!i.value)return null;const V=i.value.id,T=i.value.type,I=y.value.handleBounds;let z=(I==null?void 0:I[T])??[];if(o.value===qt.Loose){const Q=(I==null?void 0:I[T==="source"?"target":"source"])??[];z=[...z,...Q]}if(!z)return null;const w=(V?z.find(Q=>Q.id===V):z[0])??null,x=(w==null?void 0:w.position)??Be.Top,{x:F,y:C}=ro(y.value,w,x);let se=null;f.value&&(o.value===qt.Strict?se=((E=f.value.handleBounds[T==="source"?"target":"source"])==null?void 0:E.find(Q=>{var ie;return Q.id===((ie=a.value)==null?void 0:ie.id)}))||null:se=((g=[...f.value.handleBounds.source??[],...f.value.handleBounds.target??[]])==null?void 0:g.find(Q=>{var ie;return Q.id===((ie=a.value)==null?void 0:ie.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(x?rl[x]:null);if(!x||!k)return null;const G=l.value??c.value.type??xn.Bezier;let S="";const H={sourceX:F,sourceY:C,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:k};return G===xn.Bezier?[S]=Hu(H):G===xn.Step?[S]=ul({...H,borderRadius:0}):G===xn.SmoothStep?[S]=ul(H):G===xn.SimpleBezier?[S]=Gu(H):S=`M${F},${C} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:F,sourceY:C,sourcePosition:x,targetX:b.value.x,targetY:b.value.y,targetPosition:k,sourceNode:y.value,sourceHandle:w,targetNode:f.value,targetHandle:se,markerEnd:_.value,markerStart:h.value,connectionStatus:d.value}):t.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":h.value})))}}}),v0=["id","markerWidth","markerHeight","markerUnits","orient"],I0={name:"MarkerType",compatConfig:{MODE:3}},x0=t.defineComponent({...I0,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(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Jr).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(Jr).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,v0))}}),C0={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},S0={name:"MarkerDefinitions",compatConfig:{MODE:3}},$0=t.defineComponent({...S0,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=Ge(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const m=Xo(d,n);l.has(m)||(typeof d=="object"?s.push({...d,id:m,color:d.color||a.value}):s.push({id:m,color:a.value,type:d}),l.add(m))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const m of[d.markerStart,d.markerEnd])c(m);return s.sort((d,m)=>d.id.localeCompare(m.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",C0,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(x0,{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))])]))}}),R0={name:"Edges",compatConfig:{MODE:3}},A0=t.defineComponent({...R0,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=Ge();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode($0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(nk)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(N0),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(w0))],64))}}),T0=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:m,getNodeTypes:u,nodeExtent:p,elevateNodesOnSelect:y,disableKeyboardA11y:f,ariaLiveMessage:b,snapToGrid:h,snapGrid:_,nodeDragThreshold:E,nodesDraggable:g,elementsSelectable:N,nodesConnectable:V,nodesFocusable:T,hooks:I}=Ge(),z=t.ref(null);t.provide(Mu,z),t.provide(Vu,e.id);const w=t.inject(ma),x=t.getCurrentInstance(),F=Lu(),{node:C,parentNode:se}=Ou(e.id),{emit:k,on:G}=Ek(C,l),S=t.toRef(()=>typeof C.draggable>"u"?g.value:C.draggable),H=t.toRef(()=>typeof C.selectable>"u"?N.value:C.selectable),Q=t.toRef(()=>typeof C.connectable>"u"?V.value:C.connectable),ie=t.toRef(()=>typeof C.focusable>"u"?T.value:C.focusable),oe=t.computed(()=>H.value||S.value||I.value.nodeClick.hasListeners()||I.value.nodeDoubleClick.hasListeners()||I.value.nodeMouseEnter.hasListeners()||I.value.nodeMouseMove.hasListeners()||I.value.nodeMouseLeave.hasListeners()),W=t.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),fe=t.computed(()=>{const K=C.type||"default",Z=w==null?void 0:w[`node-${K}`];if(Z)return Z;let ne=C.template||u.value[K];if(typeof ne=="string"&&x){const te=Object.keys(x.appContext.components);te&&te.includes(K)&&(ne=t.resolveComponent(K,!1))}return ne&&typeof ne!="string"?ne:(l.error(new lt(nt.NODE_TYPE_MISSING,ne)),!1)}),ge=Bu({id:e.id,el:z,disabled:()=>!S.value,selectable:H,dragHandle:()=>C.dragHandle,onStart(K){k.dragStart(K)},onDrag(K){k.drag(K)},onStop(K){k.dragStop(K)},onClick(K){L(K)}}),$e=t.computed(()=>C.class instanceof Function?C.class(C):C.class),pe=t.computed(()=>{const K=(C.style instanceof Function?C.style(C):C.style)||{},Z=C.width instanceof Function?C.width(C):C.width,ne=C.height instanceof Function?C.height(C):C.height;return!K.width&&Z&&(K.width=typeof Z=="string"?Z:`${Z}px`),!K.height&&ne&&(K.height=typeof ne=="string"?ne:`${ne}px`),K}),Ne=t.toRef(()=>Number(C.zIndex??pe.value.zIndex??0));return m(K=>{(K.includes(e.id)||!K.length)&&Te()}),t.onMounted(()=>{t.watch(()=>C.hidden,(K=!1,Z,ne)=>{!K&&z.value&&(e.resizeObserver.observe(z.value),ne(()=>{z.value&&e.resizeObserver.unobserve(z.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])})}),t.watch([()=>C.position.x,()=>C.position.y,()=>{var K;return(K=se.value)==null?void 0:K.computedPosition.x},()=>{var K;return(K=se.value)==null?void 0:K.computedPosition.y},()=>{var K;return(K=se.value)==null?void 0:K.computedPosition.z},Ne,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var K;return(K=se.value)==null?void 0:K.dimensions.height},()=>{var K;return(K=se.value)==null?void 0:K.dimensions.width}],([K,Z,ne,te,ye,J])=>{const X={x:K,y:Z,z:J+(y.value&&C.selected?1e3:0)};typeof ne<"u"&&typeof te<"u"?C.computedPosition=X1({x:ne,y:te,z:ye},X):C.computedPosition=X},{flush:"post",immediate:!0}),t.watch([()=>C.extent,p],([K,Z],[ne,te])=>{(K!==ne||Z!==te)&&ve()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?$r(()=>W).toBe(!0).then(ve):ve(),()=>C.hidden?null:t.h("div",{ref:z,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${fe.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ge==null?void 0:ge.value,draggable:S.value,selected:C.selected,selectable:H.value,parent:C.isParent},$e.value],style:{visibility:W.value?"visible":"hidden",zIndex:C.computedPosition.z??Ne.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:oe.value?"all":"none",...pe.value},tabIndex:ie.value?0:void 0,role:ie.value?"group":void 0,"aria-describedby":f.value?void 0:`${eu}-${n}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:re,onMousemove:_e,onMouseleave:me,onContextmenu:ke,onClick:L,onDblclick:ue,onKeydown:D},[t.h(fe.value===!1?u.value.default:fe.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...G},selected:C.selected,resizing:C.resizing,dragging:ge.value,connectable:Q.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??Ne.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:Te})]);function ve(){const K=C.computedPosition,{computedPosition:Z,position:ne}=ol(C,h.value?ua(K,_.value):K,l.error,p.value,se.value);(C.computedPosition.x!==Z.x||C.computedPosition.y!==Z.y)&&(C.computedPosition={...C.computedPosition,...Z}),(C.position.x!==ne.x||C.position.y!==ne.y)&&(C.position=ne)}function Te(){z.value&&d([{id:e.id,nodeElement:z.value,forceUpdate:!0}])}function re(K){ge!=null&&ge.value||k.mouseEnter({event:K,node:C})}function _e(K){ge!=null&&ge.value||k.mouseMove({event:K,node:C})}function me(K){ge!=null&&ge.value||k.mouseLeave({event:K,node:C})}function ke(K){return k.contextMenu({event:K,node:C})}function ue(K){return k.doubleClick({event:K,node:C})}function L(K){H.value&&(!i.value||!S.value||E.value>0)&&ll(C,r.value,c,s,a,!1,z.value),k.click({event:K,node:C})}function D(K){if(!(Zr(K)||f.value))if(nu.includes(K.key)&&H.value){const Z=K.key==="Escape";ll(C,r.value,c,s,a,Z,z.value)}else S.value&&C.selected&&io[K.key]&&(K.preventDefault(),b.value=`Moved selected node ${K.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,F({x:io[K.key].x,y:io[K.key].y},K.shiftKey))}}});function V0(e={includeHiddenNodes:!1}){const{nodes:n}=Ge();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.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 M0={class:"vue-flow__nodes vue-flow__container"},B0={name:"Nodes",compatConfig:{MODE:3}},D0=t.defineComponent({...B0,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=Ge(),a=V0(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",M0,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,m,u)=>{const p=[c.id];if(u&&u.key===c.id&&t.isMemoSame(u,p))return u;const y=(t.openBlock(),t.createBlock(t.unref(T0),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return y.memo=p,y},s,0),128)):t.createCommentVNode("",!0)]))}});function O0(){const{emits:e}=Ge();t.onMounted(()=>{if(Cu()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new lt(nt.MISSING_STYLES))}})}const L0=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),P0={name:"VueFlow",compatConfig:{MODE:3}},z0=t.defineComponent({...P0,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:n,emit:o}){const i=e,a=t.useSlots(),r=Rr(i,"modelValue",o),l=Rr(i,"nodes",o),s=Rr(i,"edges",o),c=Ge(i),d=Ik({modelValue:r,nodes:l,edges:s},i,c);return Ck(o,c.hooks),_0(),O0(),t.provide(ma,a),t.onUnmounted(d),n(c),(m,u)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(f0,null,{default:t.withCtx(()=>[t.createVNode(A0),L0,t.createVNode(D0),t.renderSlot(m.$slots,"zoom-pane")]),_:3}),t.renderSlot(m.$slots,"default"),t.createVNode(b0)],512))}}),U0={name:"Panel",compatConfig:{MODE:3}},Xu=t.defineComponent({...U0,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=Ge(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),Tn=["red","amber","green","teal","blue","indigo","violet","pink"],Ju={red:"빨강",amber:"주황",green:"초록",teal:"청록",blue:"파랑",indigo:"남색",violet:"보라",pink:"분홍"};function F0(e){return typeof e=="string"&&e in Ju}const H0={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},j0=.15;function G0(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let m=0,u=0;return c!==0&&(m=c/(1-Math.abs(2*d-1)),l===i?u=(a-r)/c%6:l===a?u=(r-i)/c+2:u=(i-a)/c+4,u*=60,u<0&&(u+=360)),{h:u,s:m,l:d}}function K0(e){if(typeof e!="string")return null;const n=G0(e);if(!n||n.s<j0)return null;let o=null,i=1/0;for(const a of Tn){const r=Math.abs(n.h-H0[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function ft(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(F0(n))return n;const o=e==null?void 0:e.properties;return K0((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 Y0={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)"},q0={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 Zu(e,n=!1){return e?n?q0[e]:Y0[e]:null}function lo(e){return Ju[e]}function so(e){return`var(--em-swatch-${e}-bar)`}const W0=["width","height","innerHTML"],X0=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.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:n[e.name]??""},null,8,W0))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},De=Ke(X0,[["__scopeId","data-v-92c1dba8"]]);function J0(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function Z0(e,n){const o=J0(n);return o?e(o):n.split("-")[1]??n}function Q0(e){const n=o=>e.params!=null&&o in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return"em.check.name3";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";default:return e.ruleId}}function Qu(e,n){const o=Q0(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function eE(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const tE={class:"em-inline-issue__msgs"},Vn=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(De,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",tE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(Qu)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),nE={class:"em-mlang"},oE={class:"em-mlang__tabs",role:"tablist"},iE=["aria-selected","onClick"],aE={key:0,class:"em-mlang__dot"},Mn=Ke(t.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:n}){const o=e,i=n;function a(){const d=o.defaultLang;return d&&o.languages.includes(d)?d:o.languages[0]??"ko"}const r=t.ref(a());t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(r.value)||(r.value=a())});function l(d){var m,u;return!!((u=(m=o.modelValue)==null?void 0:m[d])!=null&&u.trim())}const s=t.computed(()=>{var d;return((d=o.modelValue)==null?void 0:d[r.value])??""});function c(d){const m={...o.modelValue};d.trim()===""?delete m[r.value]:m[r.value]=d,i("update:modelValue",m)}return(d,m)=>(t.openBlock(),t.createElementBlock("div",nE,[t.createElementVNode("div",oE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,u=>(t.openBlock(),t.createElementBlock("button",{key:u,type:"button",class:t.normalizeClass(["em-mlang__tab",{"is-active":r.value===u}]),role:"tab","aria-selected":r.value===u,onClick:p=>r.value=u},[t.createTextVNode(t.toDisplayString(u),1),l(u)?(t.openBlock(),t.createElementBlock("span",aE,"•")):t.createCommentVNode("",!0)],10,iE))),128))]),e.multiline?(t.openBlock(),t.createBlock(t.unref(le.BSTextArea),{key:0,name:`${e.name}-${r.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(le.BSTextInput),{key:1,name:`${e.name}-${r.value}`,width:"100%",placeholder:e.placeholder,"model-value":s.value,"onUpdate:modelValue":c},null,8,["name","placeholder","model-value"]))]))}}),[["__scopeId","data-v-274a0fe9"]]),rE=["disabled"],lE={class:"em-panel__sub-label"},sE={class:"em-field"},cE={class:"em-field"},dE={class:"em-field"},uE={class:"em-class"},mE={class:"em-field"},fE={class:"em-field"},pE={class:"em-field"},hE={class:"em-field"},yE={class:"em-multilang"},gE={class:"em-multilang"},bE={class:"em-jpa"},_E={class:"em-field"},kE={class:"em-field"},EE={class:"em-field"},NE={class:"em-swatch"},wE={class:"em-swatch__row"},vE=["title"],IE=["title","onClick"],em=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var C;return ft(((C=l.value)==null?void 0:C.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],m=["inherit","STRING","CHAR","INTEGER"],u=C=>C;function p(C){return C==="inherit"?a.t("em.common.inherit"):C}function y(C){r.value&&a.updateEntity(r.value.modelId,C)}function f(C,se,k){var S;const G=((S=r.value)==null?void 0:S.table)??{physicalName:""};y(C==="physicalName"?{table:{...G,physicalName:k}}:{table:{...G,logicalName:{...G.logicalName,[se]:k}}})}function b(C){y({description:Object.keys(C).length?C:void 0})}function h(C,se){var k;y({jpaAttrs:{...(k=r.value)==null?void 0:k.jpaAttrs,[C]:se}})}function _(C,se){h(C,se)}const E=t.computed(()=>{var C,se;return((se=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:se.discriminatorType)??"inherit"}),g=t.computed(()=>{var C,se;return!((se=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&se.useDiscriminator)});function N(C){h("discriminatorType",C==="inherit"?void 0:C)}function V(C){y({hasPersonalInfo:C})}function T(C){y({superClass:C.trim()||void 0})}function I(C){y({schema:C.trim()||void 0})}function z(C){y({abstractClass:C})}const w=t.computed(()=>{var C,se;return((se=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:se.join(", "))??""});function x(C){const se=C.split(",").map(k=>k.trim()).filter(Boolean);y({declarationOfInterfaces:se.length?se:void 0})}function F(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,se)=>{var k,G,S;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:se[0]||(se[0]=H=>i("toggle"))},[t.createElementVNode("span",lE,[t.createVNode(De,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(Vn,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",sE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":se[1]||(se[1]=H=>y({name:H}))},null,8,["model-value"])]),t.createElementVNode("label",cE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(le.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":u,"label-provider":t.unref(Eo),"onUpdate:modelValue":se[2]||(se[2]=H=>y({stereotype:H}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",dE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":se[3]||(se[3]=H=>y({packageName:H}))},null,8,["model-value"])]),t.createElementVNode("fieldset",uE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",mE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":se[4]||(se[4]=H=>T(H))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",fE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":w.value,"onUpdate:modelValue":se[5]||(se[5]=H=>x(H))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(le.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":se[6]||(se[6]=H=>z(H))},null,8,["label","model-value"])]),t.createElementVNode("label",pE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-table",width:"100%","model-value":((k=r.value.table)==null?void 0:k.physicalName)??"","onUpdate:modelValue":se[7]||(se[7]=H=>f("physicalName",null,H))},null,8,["model-value"])]),t.createElementVNode("label",hE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(le.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":se[8]||(se[8]=H=>I(H))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",yE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,H=>{var Q,ie;return t.openBlock(),t.createElementBlock("label",{key:H,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(H),1),t.createVNode(t.unref(le.BSTextInput),{name:`ent-logical-${H}`,width:"100%","model-value":((ie=(Q=r.value.table)==null?void 0:Q.logicalName)==null?void 0:ie[H])??"","onUpdate:modelValue":oe=>f("logicalName",H,oe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",gE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Mn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",bE,[se[13]||(se[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,H=>{var Q;return t.createVNode(t.unref(le.BSCheckbox),{key:H.key,name:`jpa-${H.key}`,class:"em-check",label:H.label,"model-value":!!((Q=r.value.jpaAttrs)!=null&&Q[H.key]),"onUpdate:modelValue":ie=>_(H.key,ie)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",_E,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(le.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:g.value,"model-value":((G=r.value.jpaAttrs)==null?void 0:G.discriminatorColumnName)??"","onUpdate:modelValue":se[9]||(se[9]=H=>h("discriminatorColumnName",H.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",kE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(le.BSSelect),{disabled:g.value,"model-value":E.value,items:m,"value-provider":u,"label-provider":p,"onUpdate:modelValue":se[10]||(se[10]=H=>H&&N(H))},null,8,["disabled","model-value"])]),t.createElementVNode("label",EE,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(le.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:g.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":se[11]||(se[11]=H=>h("discriminatorLength",H||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(le.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":V},null,8,["label","model-value"]),t.createElementVNode("fieldset",NE,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",wE,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:se[12]||(se[12]=H=>F(null))},"∅",10,vE),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),H=>(t.openBlock(),t.createElementBlock("button",{key:H,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===H}]),style:t.normalizeStyle({background:t.unref(so)(H)}),title:t.unref(lo)(H),onClick:Q=>F(H)},null,14,IE))),128))])])],64)):t.createCommentVNode("",!0)],8,rE)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bf09b0d4"]]);function ka(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function pl(e,n,o,i,a=0){var u;if(!ka(e))return;const r=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(r)for(const p of o){const y=p.attributes.find(f=>f.modelId===r);if(y)return y.dbAttrs[a]}const l=i.find(p=>p.end1.attributeRef===e.modelId||p.end2.attributeRef===e.modelId);if(!l)return;const s=n==null?void 0:n.modelId,c=l.end1.entityRef===s?l.end2.entityRef:l.end1.entityRef,d=o.find(p=>p.modelId===c);return d?d.attributes.filter(p=>p.identifier&&(p.attrType==="NORMAL"||p.attrType==="RELATION_OWN")).sort((p,y)=>p.order-y.order).flatMap(p=>p.dbAttrs)[a]:void 0}const tm={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.descPlaceholderKo":"Description (ko)","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.banner":"#{seq} ↔ current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3":'Duplicate entity name: "{name}"',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.unspecified":"unspecified"},nm={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.descPlaceholderKo":"説明(ko)","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.banner":"#{seq} ↔ 現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3":'エンティティ名が重複しています: "{name}"',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.unspecified":"未指定"},om={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.descPlaceholderKo":"설명(ko)","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.banner":"#{seq} ↔ 현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3":'엔티티 이름이 중복됩니다: "{name}"',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.unspecified":"미지정"},xE=["ko","en","ja"],hl={ko:om,en:tm,ja:nm};function St(e,n,o){let a=(hl[e]??hl.ko)[n]??hl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const im=["ko","en","ja","zh"];function CE(e){if(e)for(const n of im){const o=e[n];if(o)return o}}function yl(e){const n=CE(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function SE(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:im.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const $E=["aria-expanded","placeholder"],RE=["aria-selected","onClick","onMouseenter"],AE={key:0,class:"gcc__opt gcc__opt--empty"},am=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(w,x)=>St(o.locale??"ko",w,x),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),m=t.ref(-1),u=t.ref({}),p=t.computed(()=>o.items.find(w=>w.groupCode===o.modelValue)),y=t.computed(()=>p.value?yl(p.value):"");t.watch(y,w=>{d.value||(c.value=w)},{immediate:!0});const f=t.computed(()=>c.value===y.value?o.items:SE(o.items,c.value));function b(){var x;const w=(x=r.value)==null?void 0:x.getBoundingClientRect();w&&(u.value={left:`${w.left}px`,top:`${w.bottom}px`,width:`${w.width}px`})}function h(){d.value=!0,b(),m.value=Math.max(0,f.value.findIndex(w=>w.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",z)}function _(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",z)}t.onBeforeUnmount(_);function E(){h(),t.nextTick(()=>{var w;return(w=l.value)==null?void 0:w.select()})}function g(){d.value||h(),m.value=0}function N(w){i("update:modelValue",w.groupCode),c.value=yl(w),_()}function V(){i("update:modelValue",void 0),c.value="",_()}function T(){c.value.trim()===""?V():(c.value=y.value,_())}function I(w){var x;if(w.key==="ArrowDown")d.value||h(),m.value=Math.min(m.value+1,f.value.length-1),w.preventDefault();else if(w.key==="ArrowUp")m.value=Math.max(m.value-1,0),w.preventDefault();else if(w.key==="Enter"){const F=f.value[m.value];F&&N(F),w.preventDefault()}else w.key==="Escape"&&(c.value=y.value,_(),(x=l.value)==null||x.blur())}function z(w){var F,C;const x=w.target;!((F=r.value)!=null&&F.contains(x))&&!((C=s.value)!=null&&C.contains(x))&&T()}return(w,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":x[0]||(x[0]=F=>c.value=F),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:g,onKeydown:I},null,40,$E),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(u.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:x[1]||(x[1]=t.withModifiers(()=>{},["prevent"])),onClick:V},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,(F,C)=>(t.openBlock(),t.createElementBlock("li",{key:F.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":C===m.value,"is-selected":F.groupCode===e.modelValue}]),role:"option","aria-selected":F.groupCode===e.modelValue,onMousedown:x[2]||(x[2]=t.withModifiers(()=>{},["prevent"])),onClick:se=>N(F),onMouseenter:se=>m.value=C},t.toDisplayString(t.unref(yl)(F)),43,RE))),128)),f.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",AE,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),TE=["disabled"],VE={class:"em-aw__toolbar"},ME={class:"em-aw__count"},BE={class:"em-aw__scroll"},DE={class:"em-aw__table"},OE={class:"c-name"},LE={class:"c-type"},PE={class:"c-logical"},zE={class:"c-col"},UE={class:"c-constraints"},FE={class:"c-del"},HE={class:"c-expand"},jE=["title","onClick","onKeydown"],GE={key:1,class:"em-aw__muted"},KE={class:"c-constraints"},YE={class:"em-aw__cflags"},qE=["title"],WE={colspan:"8"},XE={class:"em-aw__detail"},JE={class:"em-aw__dgroup"},ZE={class:"em-aw__df"},QE={class:"em-aw__df"},eN={class:"em-aw__df"},tN={class:"em-aw__dgroup"},nN={key:0,class:"em-aw__dgroup"},oN={class:"em-aw__df"},iN={key:0,class:"em-aw__df"},aN={class:"em-aw__df"},rN={class:"c-expand"},lN={class:"em-aw__caret is-static","aria-hidden":"true"},sN={class:"c-del"},cN={class:"c-expand"},dN=["title","onClick","onKeydown"],uN={class:"em-aw__embed-label"},mN={class:"em-aw__ro"},fN={class:"em-aw__ro"},pN={class:"c-constraints"},hN={class:"em-aw__ro"},yN={key:0,class:"em-aw__detail-row em-aw__embed-detail"},gN={colspan:"8"},bN={class:"em-aw__detail"},_N={class:"em-aw__dgroup"},kN={key:0,class:"em-aw__df"},EN={class:"em-aw__df"},NN={class:"em-aw__df"},wN={key:0},vN={colspan:"99",class:"em-aw__empty"},IN=6,xN=5,Ea="__OWN__",CN=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(O=>O.modelId===n.entityId)??null),a=t.computed(()=>{var O;return[...((O=i.value)==null?void 0:O.attributes)??[]].sort((U,R)=>U.order-R.order)}),r=t.computed(()=>{var O;return((O=i.value)==null?void 0:O.stereotype)==="JPA_EMBEDDABLE"}),l=t.computed(()=>new Set(o.selectedAttrIds.value)),s=t.computed(()=>{var O;return(((O=i.value)==null?void 0:O.attributes)??[]).filter(U=>U.attrType!=="DIVIDER").length}),c=t.ref(new Set);function d(O){return c.value.has(O)}function m(O){const U=new Set(c.value);U.has(O)?U.delete(O):U.add(O),c.value=U}const u=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function p(O){return O==="none"?o.t("em.common.noneParen"):O}const y=O=>O;function f(O,U){i.value&&o.updateAttribute(i.value.modelId,O.modelId,U)}function b(O){return!!i.value&&!!Li(o.state.logical,i.value.modelId,O.modelId)}function h(O,U){f(O,{naturalId:U||void 0,naturalIdMutable:U?O.naturalIdMutable:void 0})}function _(){return{naturalId:void 0,naturalIdMutable:void 0}}function E(O,U){f(O,{identifier:U,...U?_():{}})}function g(O,U){f(O,{transient:U||void 0,...U?_():{}})}function N(O){return!!O.transient||O.attrType==="RELATION_REF"}function V(O){return ka(O)}function T(O,U=0){var R;return((R=pl(O,i.value,o.state.logical.entities,o.state.logical.associations,U))==null?void 0:R.physicalName)||void 0}const I=O=>O.value,z=O=>O.label;function w(O,U){if(!U)return;const R=S.value.find(be=>be.type===U);if(R){const be=O.dbAttrs[0]??{modelId:O.modelId+".c",physicalName:O.name,dataType:"VARCHAR"};f(O,{type:U,customType:void 0,dbAttrs:[{...be,dataType:R.dataType,length:R.length,scale:R.scale}]});return}f(O,U===At?{type:U}:{type:U,customType:void 0})}function x(O,U){f(O,{customType:U.trim()===""?void 0:U})}function F(O,U){if(O.attrType==="RELATION_REF")return;const be={...O.dbAttrs[0]??{modelId:O.modelId+".c",physicalName:O.name,dataType:"VARCHAR"},...U};U.dataType!==void 0&&!wo.has(be.dataType)&&(be.scale=void 0),f(O,{dbAttrs:[be]})}function C(O){var U;return wo.has(((U=O.dbAttrs[0])==null?void 0:U.dataType)??"")}function se(O,U){F(O,{logicalName:Object.keys(U).length?U:void 0})}function k(O){return O.personalInfoAttributeType??"none"}function G(O,U){f(O,{personalInfoAttributeType:U==="none"?void 0:U})}const S=t.computed(()=>o.predefinedCustomTypeCatalog.value),H=t.computed(()=>o.embeddableCatalog.value);function Q(O){var U,R;return((U=O.label)==null?void 0:U.ko)??((R=O.label)==null?void 0:R.en)??O.type}function ie(O){!O||!i.value||o.addPredefinedEmbed(i.value.modelId,O)}const oe=t.computed(()=>o.groupCodeCatalog.value);function W(O){var U;return((U=oe.value.find(R=>R.groupCode===O.groupCode))==null?void 0:U.codes)??[]}function fe(O){return["none",...W(O)]}function ge(O){return O==="none"?"none":O.code}function $e(O){var R,be;if(O==="none")return o.t("em.common.noneParen");const U=((R=O.label)==null?void 0:R.ko)??((be=O.label)==null?void 0:be.en);return U?`${O.code} (${U})`:O.code}function pe(O,U){i.value&&o.setAttributeGroupCode(i.value.modelId,O.modelId,U)}function Ne(O,U){f(O,{defaultValue:U==="none"?void 0:U})}function ve(O,U){f(O,{defaultValue:U.trim()===""?void 0:U})}function Te(O){return O.attrType.startsWith("EMBED")&&O.dbAttrs.length>0}function re(O,U,R){const be=O.dbAttrs.map((Se,Ae)=>{if(Ae!==U)return Se;const j={...Se,...R};for(const Y of Object.keys(R))R[Y]===void 0&&delete j[Y];return j});i.value&&o.setEmbedColumns(i.value.modelId,O.modelId,be)}function _e(O,U,R){re(O,U,{logicalName:Object.keys(R).length?R:void 0})}function me(O,U){var Se,Ae,j;if(O.attrType==="EMBED_PREDEF"){const Y=(Se=o.embeddableCatalog.value.find(B=>B.type===O.type))==null?void 0:Se.fields[U];return Y?{name:Y.name,physicalName:Y.physicalName,dataType:Y.dataType,length:Y.length,shareable:Y.shareable,logicalName:Y.logicalName}:void 0}const R=(Ae=O.embedded)==null?void 0:Ae.embeddableRef;if(!R)return;const be=(j=o.state.logical.entities.find(Y=>Y.modelId===R))==null?void 0:j.attributes.flatMap(Y=>Y.dbAttrs)[U];return be?{physicalName:be.physicalName,dataType:be.dataType,length:be.length,scale:be.scale,logicalName:be.logicalName}:void 0}function ke(O,U){var R,be;return((R=me(O,U))==null?void 0:R.dataType)||((be=O.dbAttrs[U])==null?void 0:be.dataType)||""}function ue(O,U){var R,be;return((R=me(O,U))==null?void 0:R.length)??((be=O.dbAttrs[U])==null?void 0:be.length)}function L(O,U){var R,be;return((R=me(O,U))==null?void 0:R.scale)??((be=O.dbAttrs[U])==null?void 0:be.scale)}const D=["inherit","true","false"];function K(O){return O==="inherit"?o.t("em.common.inherit"):O}function Z(O){return(O==null?void 0:O.updatable)===void 0?"inherit":O.updatable?"true":"false"}function ne(O,U,R){re(O,U,{updatable:R==="inherit"?void 0:R==="true"})}function te(O,U){F(O,{updatable:U==="inherit"?void 0:U==="true"})}const ye=["inherit","true","false"];function J(O){return O==="inherit"?o.t("em.common.inherit"):O}function X(O){return(O==null?void 0:O.insertable)===void 0?"inherit":O.insertable?"true":"false"}function ee(O,U,R){re(O,U,{insertable:R==="inherit"?void 0:R==="true"})}function Re(O,U){F(O,{insertable:U==="inherit"?void 0:U==="true"})}const Le=t.computed(()=>i.value?_i(i.value,o.state.logical.entities):[]),He=t.computed(()=>fn(Le.value.flatMap(O=>O.attributes.flatMap(U=>U.dbAttrs)))),Oe=t.computed(()=>Le.value.flatMap(O=>O.attributes.filter(U=>U.attrType==="NORMAL"&&U.dbAttrs.length===1&&U.dbAttrs[0]).map(U=>{var R;return{modelId:U.dbAttrs[0].modelId,physical:U.dbAttrs[0].physicalName||U.name,isCurrency:U.type==="Currency",ownerName:O.modelId===((R=i.value)==null?void 0:R.modelId)?void 0:O.name}})));function et(){const O=[...Oe.value].sort((U,R)=>Number(R.isCurrency)-Number(U.isCurrency));return[Ea,...O.map(U=>U.modelId)]}function v(O){if(O===Ea)return o.t("em.attr.sharedOwn");const U=Oe.value.find(be=>be.modelId===O);if(!U)return O;const R=U.ownerName?`${U.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:R,physical:U.physical,mode:U.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function M(O){return(O==null?void 0:O.sharedColumnRef)??Ea}function ae(O,U,R){re(O,U,{sharedColumnRef:R===Ea?void 0:R})}function de(O){return(O==null?void 0:O.sharedColumnRef)!=null}function Ie(O){var U;return((U=Gn(O,He.value))==null?void 0:U.physicalName)??""}return(O,U)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",VE,[t.createElementVNode("span",ME,t.toDisplayString(t.unref(o).t("em.attr.section",{n:s.value})),1),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:U[0]||(U[0]=R=>t.unref(o).addAttribute(i.value.modelId))},null,8,["caption"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:U[1]||(U[1]=R=>t.unref(o).addDivider(i.value.modelId))},null,8,["caption"]),H.value.length?(t.openBlock(),t.createBlock(t.unref(le.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:H.value,"value-provider":R=>R.type,"label-provider":Q,"onUpdate:modelValue":ie},null,8,["placeholder","items","value-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",BE,[t.createElementVNode("table",DE,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[U[2]||(U[2]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",OE,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",LE,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",PE,t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),1),t.createElementVNode("th",zE,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),U[3]||(U[3]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),U[4]||(U[4]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",UE,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),U[5]||(U[5]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,R=>{var be,Se,Ae,j,Y,B,q,$,xe,P;return t.openBlock(),t.createElementBlock(t.Fragment,{key:R.modelId},[R.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":l.value.has(R.modelId)}])},[U[6]||(U[6]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-divlabel-${R.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":R.name,"onUpdate:modelValue":A=>f(R,{name:A})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:IN,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",FE,[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])])],2)):Te(R)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":l.value.has(R.modelId)}])},[t.createElementVNode("td",rN,[t.createElementVNode("span",lN,[t.createVNode(De,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-name-${R.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":R.name,"onUpdate:modelValue":A=>f(R,{name:A})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-type-${R.modelId}`,width:"100%",disabled:"","model-value":R.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:xN,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:R.dbAttrs.length})),1),t.createElementVNode("td",sN,[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.dbAttrs,(A,ce)=>{var Ce,Ve,Pe,we,ze,je;return t.openBlock(),t.createElementBlock(t.Fragment,{key:A.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":d(A.modelId)}])},[t.createElementVNode("td",cN,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":d(A.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(d(A.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:he=>m(A.modelId),onKeydown:[t.withKeys(t.withModifiers(he=>m(A.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(he=>m(A.modelId),["prevent"]),["space"])]},[t.createVNode(De,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,dN)]),t.createElementVNode("td",uN,"↳ "+t.toDisplayString(((Ce=me(R,ce))==null?void 0:Ce.name)??((Ve=me(R,ce))==null?void 0:Ve.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ce+1})),1),U[13]||(U[13]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Mn,{name:`aw-embed-logical-${A.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((we=(Pe=me(R,ce))==null?void 0:Pe.logicalName)==null?void 0:we.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":A.logicalName,"onUpdate:modelValue":he=>_e(R,ce,he)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-embed-col-${A.modelId}`,width:"100%",disabled:de(A),placeholder:((ze=me(R,ce))==null?void 0:ze.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":de(A)?Ie(A):A.physicalName,"onUpdate:modelValue":he=>re(R,ce,{physicalName:he})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Vn,{controller:t.unref(o),"ref-id":A.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",null,[t.createElementVNode("span",mN,t.toDisplayString(ke(R,ce)),1)]),t.createElementVNode("td",null,[t.createElementVNode("span",fN,t.toDisplayString(ue(R,ce)??""),1)]),t.createElementVNode("td",pN,[t.createElementVNode("span",hN,t.toDisplayString(L(R,ce)!=null?`scale ${L(R,ce)}`:""),1)]),U[14]||(U[14]=t.createElementVNode("td",null,null,-1))],2),d(A.modelId)?(t.openBlock(),t.createElementBlock("tr",yN,[U[17]||(U[17]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",gN,[t.createElementVNode("div",bN,[t.createElementVNode("fieldset",_N,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(je=me(R,ce))!=null&&je.shareable?(t.openBlock(),t.createElementBlock("label",kN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(le.BSSelect),{width:"150px","model-value":M(A),items:et(),"value-provider":y,"label-provider":v,"onUpdate:modelValue":he=>he&&ae(R,ce,he)},null,8,["model-value","items","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",EN,[U[15]||(U[15]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"110px",disabled:de(A),"model-value":de(A)?"false":X(A),items:ye,"value-provider":y,"label-provider":J,"onUpdate:modelValue":he=>he&&ee(R,ce,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",NN,[U[16]||(U[16]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"110px",disabled:de(A),"model-value":de(A)?"false":Z(A),items:D,"value-provider":y,"label-provider":K,"onUpdate:modelValue":he=>he&&ne(R,ce,he)},null,8,["disabled","model-value","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":l.value.has(R.modelId),"em-aw__open":d(R.modelId)})},[t.createElementVNode("td",HE,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":d(R.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(d(R.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:A=>m(R.modelId),onKeydown:[t.withKeys(t.withModifiers(A=>m(R.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(A=>m(R.modelId),["prevent"]),["space"])]},[t.createVNode(De,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,jE)]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-name-${R.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":R.name,"onUpdate:modelValue":A=>f(R,{name:A})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSSelect),{name:`aw-type-${R.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!R.groupCode||R.attrType==="RELATION_REF"||V(R),items:t.unref(fs)(R.type,S.value),"value-provider":I,"label-provider":z,"model-value":R.type,"onUpdate:modelValue":A=>w(R,A)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),R.type===t.unref(At)&&!V(R)?(t.openBlock(),t.createBlock(t.unref(le.BSTextInput),{key:0,name:`aw-customtype-${R.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":R.customType??"","onUpdate:modelValue":A=>x(R,A)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)]),t.createElementVNode("td",null,[R.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Mn,{key:0,name:`aw-logical-${R.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(be=R.dbAttrs[0])==null?void 0:be.logicalName,"onUpdate:modelValue":A=>se(R,A)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",GE,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`aw-col-${R.modelId}`,width:"100%",placeholder:T(R)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:N(R),"model-value":((Se=R.dbAttrs[0])==null?void 0:Se.physicalName)??"","onUpdate:modelValue":A=>F(R,{physicalName:A})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Vn,{controller:t.unref(o),"ref-id":(Ae=R.dbAttrs[0])==null?void 0:Ae.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSSelect),{name:`aw-dtype-${R.modelId}`,width:"100%",placeholder:"dataType",disabled:N(R)||V(R),items:t.unref(us)(((j=R.dbAttrs[0])==null?void 0:j.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":y,"label-provider":t.unref(or),"model-value":((Y=R.dbAttrs[0])==null?void 0:Y.dataType)??"","onUpdate:modelValue":A=>A&&F(R,{dataType:A})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSNumberInput),{name:`aw-len-${R.modelId}`,width:"100%",placeholder:"len",disabled:N(R)||V(R),"model-value":(B=R.dbAttrs[0])==null?void 0:B.length,"onUpdate:modelValue":A=>F(R,{length:A||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",KE,[t.createElementVNode("div",YE,[t.createVNode(t.unref(le.BSCheckbox),{name:`aw-pk-${R.modelId}`,label:"PK","model-value":R.identifier,disabled:r.value||N(R)||V(R),"onUpdate:modelValue":A=>E(R,A)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-nn-${R.modelId}`,label:"NN","model-value":R.notNull,disabled:N(R)||V(R),"onUpdate:modelValue":A=>f(R,{notNull:A})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-uq-${R.modelId}`,label:"UQ","model-value":!!((q=R.dbAttrs[0])!=null&&q.unique),disabled:N(R)||V(R),"onUpdate:modelValue":A=>F(R,{unique:A})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])]),t.createElementVNode("td",{class:"c-del",title:b(R)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(o).removeAttribute(i.value.modelId,R.modelId)},null,8,["onClick"])],8,qE)],2),d(R.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":l.value.has(R.modelId)}])},[U[12]||(U[12]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",WE,[t.createElementVNode("div",XE,[t.createElementVNode("fieldset",JE,[U[10]||(U[10]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",ZE,[U[7]||(U[7]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(le.BSNumberInput),{name:`aw-scale-${R.modelId}`,width:"72px",placeholder:"scale",disabled:N(R)||V(R)||!C(R),"model-value":($=R.dbAttrs[0])==null?void 0:$.scale,"onUpdate:modelValue":A=>F(R,{scale:A||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-ai-${R.modelId}`,label:"Auto Increment","model-value":!!((xe=R.dbAttrs[0])!=null&&xe.autoIncrement),disabled:N(R)||V(R)||!R.identifier,"onUpdate:modelValue":A=>F(R,{autoIncrement:A})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",QE,[U[8]||(U[8]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(le.BSSelect),{name:`aw-ins-${R.modelId}`,width:"110px",disabled:N(R),"model-value":X(R.dbAttrs[0]),items:ye,"value-provider":y,"label-provider":J,"onUpdate:modelValue":A=>A&&Re(R,A)},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",eN,[U[9]||(U[9]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(le.BSSelect),{name:`aw-upd-${R.modelId}`,width:"110px",disabled:N(R),"model-value":Z(R.dbAttrs[0]),items:D,"value-provider":y,"label-provider":K,"onUpdate:modelValue":A=>A&&te(R,A)},null,8,["name","disabled","model-value","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",tN,[U[11]||(U[11]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-tr-${R.modelId}`,label:"@Transient","model-value":!!R.transient,disabled:R.identifier||V(R),"onUpdate:modelValue":A=>g(R,A)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-nid-${R.modelId}`,label:"@NaturalId","model-value":!!R.naturalId,disabled:R.identifier||N(R)||V(R),"onUpdate:modelValue":A=>h(R,A)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${R.modelId}`,label:"mutable","model-value":!!R.naturalIdMutable,disabled:N(R)||!R.naturalId,"onUpdate:modelValue":A=>f(R,{naturalIdMutable:A||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`aw-mv-${R.modelId}`,label:"Multi-Value (Set)","model-value":!!((P=R.dbAttrs[0])!=null&&P.multiValue),disabled:N(R)||V(R),"onUpdate:modelValue":A=>F(R,{multiValue:A||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),V(R)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",nN,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",oN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(le.BSSelect),{width:"150px","model-value":k(R),items:u,"value-provider":y,"label-provider":p,"onUpdate:modelValue":A=>A&&G(R,A)},null,8,["model-value","onUpdate:modelValue"])]),oe.value.length?(t.openBlock(),t.createElementBlock("label",iN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(am,{"model-value":R.groupCode,items:oe.value,locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":A=>pe(R,A)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",aN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),W(R).length?(t.openBlock(),t.createBlock(t.unref(le.BSSelect),{key:0,width:"150px","model-value":R.defaultValue??"none",items:fe(R),"value-provider":ge,"label-provider":$e,"onUpdate:modelValue":A=>A&&Ne(R,A)},null,8,["model-value","items","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(le.BSTextInput),{key:1,name:`aw-default-${R.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":R.defaultValue??"","onUpdate:modelValue":A=>ve(R,A)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])]))])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),i.value.attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",wN,[t.createElementVNode("td",vN,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,TE)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-fa6c3cd6"]]),SN=["disabled"],$N={class:"em-idxw__list"},RN={class:"em-idxw__list-head"},AN=["onClick"],TN={class:"em-idxw__item-name"},VN={key:0,class:"em-idxw__badge"},MN={class:"em-idxw__item-cnt"},BN={key:0,class:"em-idxw__empty"},DN={key:0,class:"em-idxw__edit"},ON={class:"em-idxw__form"},LN={class:"em-field em-idxw__name"},PN={class:"em-field"},zN=["value","placeholder"],UN={class:"em-idxw__transfer"},FN={class:"em-idxw__pane"},HN={class:"em-idxw__pane-head"},jN={class:"em-idxw__cols"},GN=["onClick"],KN=["title"],YN={key:0,class:"em-idxw__empty"},qN={class:"em-idxw__arrows"},WN={class:"em-idxw__pane"},XN={class:"em-idxw__pane-head"},JN={class:"em-idxw__cols"},ZN={class:"em-idxw__col-name"},QN=["title"],ew={class:"em-idxw__col-ops"},tw=["title","disabled","onClick"],nw=["title","disabled","onClick"],ow=["title","onClick"],iw={key:0,class:"em-idxw__empty"},aw={key:1,class:"em-idxw__edit em-idxw__edit--empty"},rw=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(w=>w.modelId===n.entityId)??null),a=t.computed(()=>{var w;return((w=i.value)==null?void 0:w.indexes)??[]}),r=t.computed(()=>{var w;return((w=i.value)==null?void 0:w.attributes)??[]}),l=t.ref(null);t.watch(a,w=>{var x;w.some(F=>F.modelId===l.value)||(l.value=((x=w[0])==null?void 0:x.modelId)??null)},{immediate:!0});const s=t.computed(()=>a.value.find(w=>w.modelId===l.value)??null),c=t.computed(()=>i.value?ko(i.value,o.superClassCatalog.value):[]),d=t.computed(()=>{var w;return new Set(((w=s.value)==null?void 0:w.columns.map(x=>x.columnRef))??[])}),m=t.computed(()=>[...r.value.filter(w=>!d.value.has(w.modelId)).map(w=>({ref:w.modelId,label:p(w),inherited:!1})),...c.value.filter(w=>!d.value.has(w.modelId)).map(w=>({ref:w.modelId,label:y(w),inherited:!0}))]),u=t.ref(new Set);t.watch(l,()=>u.value=new Set);function p(w){var F;const x=(F=w.dbAttrs[0])==null?void 0:F.physicalName;return x&&x!==w.name?`${w.name} (${x})`:w.name}function y(w){return w.physicalName&&w.physicalName!==w.field?`${w.field} (${w.physicalName})`:w.field}function f(w){const x=r.value.find(C=>C.modelId===w);if(x)return p(x);const F=c.value.find(C=>C.modelId===w);return F?y(F):w}function b(w){return _o(w)}function h(w,x){i.value&&o.updateIndex(i.value.modelId,w,x)}function _(){var x;if(!i.value)return;const w=Ue();o.addIndex(i.value.modelId,{modelId:w,name:`idx_${(((x=i.value.indexes)==null?void 0:x.length)??0)+1}`,unique:!1,columns:[]}),l.value=w}function E(w){i.value&&o.removeIndex(i.value.modelId,w)}function g(w){s.value&&h(s.value.modelId,{parameters:w.trim()===""?void 0:w})}function N(w){const x=new Set(u.value);x.has(w)?x.delete(w):x.add(w),u.value=x}function V(){const w=s.value;if(!w||!u.value.size)return;const x=[...u.value].map(F=>({columnRef:F,descending:!1}));h(w.modelId,{columns:[...w.columns,...x]}),u.value=new Set}function T(w){const x=s.value;x&&h(x.modelId,{columns:x.columns.filter((F,C)=>C!==w)})}function I(w,x){const F=s.value;F&&h(F.modelId,{columns:F.columns.map((C,se)=>se===w?{...C,descending:x}:C)})}function z(w,x){const F=s.value;if(!F)return;const C=w+x;if(C<0||C>=F.columns.length)return;const se=[...F.columns];[se[w],se[C]]=[se[C],se[w]],h(F.modelId,{columns:se})}return(w,x)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",$N,[t.createElementVNode("div",RN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:_},null,8,["caption"])]),t.createElementVNode("ul",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,F=>(t.openBlock(),t.createElementBlock("li",{key:F.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":F.modelId===l.value}]),onClick:C=>l.value=F.modelId},[t.createElementVNode("span",TN,t.toDisplayString(F.name||t.unref(o).t("em.attr.nameless")),1),F.unique?(t.openBlock(),t.createElementBlock("span",VN,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",MN,t.toDisplayString(F.columns.length),1)],10,AN))),128)),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",BN,t.toDisplayString(t.unref(o).t("em.index.empty")),1))])]),s.value?(t.openBlock(),t.createElementBlock("section",DN,[t.createElementVNode("div",ON,[t.createElementVNode("label",LN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(le.BSTextInput),{name:"idxw-name",width:"100%","model-value":s.value.name,"onUpdate:modelValue":x[0]||(x[0]=F=>h(s.value.modelId,{name:F}))},null,8,["model-value"]),t.createVNode(Vn,{controller:t.unref(o),"ref-id":s.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(le.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":s.value.unique,"onUpdate:modelValue":x[1]||(x[1]=F=>h(s.value.modelId,{unique:F}))},null,8,["model-value"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:x[2]||(x[2]=F=>E(s.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",PN,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:s.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:x[3]||(x[3]=F=>g(F.target.value))},null,40,zN)]),t.createElementVNode("div",UN,[t.createElementVNode("div",FN,[t.createElementVNode("div",HN,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:m.value.length})),1),t.createElementVNode("ul",jN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,F=>(t.openBlock(),t.createElementBlock("li",{key:F.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":u.value.has(F.ref)}]),onClick:C=>N(F.ref)},[t.createTextVNode(t.toDisplayString(F.label),1),F.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,KN)):t.createCommentVNode("",!0)],10,GN))),128)),m.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",YN,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))])]),t.createElementVNode("div",qN,[t.createVNode(t.unref(le.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!u.value.size,onClick:V},null,8,["caption","disabled"])]),t.createElementVNode("div",WN,[t.createElementVNode("div",XN,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:s.value.columns.length})),1),t.createElementVNode("ul",JN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value.columns,(F,C)=>(t.openBlock(),t.createElementBlock("li",{key:C,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",ZN,[t.createTextVNode(t.toDisplayString(f(F.columnRef)),1),b(F.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,QN)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(le.BSCheckbox),{name:`idxw-desc-${C}`,class:"em-check",label:"DESC","model-value":F.descending,"onUpdate:modelValue":se=>I(C,se)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",ew,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:t.unref(o).t("em.index.moveUp"),disabled:C===0,onClick:se=>z(C,-1)},"↑",8,tw),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn",title:t.unref(o).t("em.index.moveDown"),disabled:C===s.value.columns.length-1,onClick:se=>z(C,1)},"↓",8,nw),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:se=>T(C)},"✕",8,ow)])]))),128)),s.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",iw,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))])])])])):(t.openBlock(),t.createElementBlock("section",aw,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,SN)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76de4c26"]]),lw={class:"em-op-src"},sw=["placeholder"],cw={class:"em-op-src__actions"},rm=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=le.useModalHandle(),i=(l,s)=>St(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(le.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",lw,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,sw),[[t.vModelText,a.value]]),t.createElementVNode("div",cw,[t.createVNode(t.unref(le.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),dw=["disabled"],uw={class:"em-ow__toolbar"},mw={class:"em-ow__count"},fw={class:"em-ow__scroll"},pw={class:"em-ow__table"},hw={class:"c-name"},yw={class:"c-desc"},gw={class:"c-pii"},bw={class:"c-src"},_w={class:"c-del"},kw={key:0},Ew={colspan:"6",class:"em-ow__empty"},Nw=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=le.useModal(),a=t.computed(()=>o.state.logical.entities.find(b=>b.modelId===n.entityId)??null),r=t.computed(()=>{var b;return[...((b=a.value)==null?void 0:b.operations)??[]].sort((h,_)=>h.order-_.order)}),l=["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"?o.t("em.common.noneParen"):b}const d=b=>b;function m(b,h){a.value&&o.updateOperation(a.value.modelId,b.modelId,h)}function u(b,h,_){m(b,{description:{...b.description,[h]:_}})}function p(b){return b.personalInfoAttributeType??"none"}function y(b,h){m(b,{personalInfoAttributeType:h==="none"?void 0:h})}function f(b){i.openModal({component:rm,bind:{operationName:b.name,sourceCode:b.sourceCode??"",locale:o.uiLocale.value,onSave:h=>m(b,{sourceCode:h})}})}return(b,h)=>{var _,E;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",uw,[t.createElementVNode("span",mw,t.toDisplayString(t.unref(o).t("em.op.section",{n:((_=a.value.operations)==null?void 0:_.length)??0})),1),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:h[0]||(h[0]=g=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",fw,[t.createElementVNode("table",pw,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",hw,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),h[1]||(h[1]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",yw,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createElementVNode("th",gw,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",bw,t.toDisplayString(t.unref(o).t("em.op.body")),1),h[2]||(h[2]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,g=>{var N;return t.openBlock(),t.createElementBlock("tr",{key:g.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`ow-name-${g.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":g.name,"onUpdate:modelValue":V=>m(g,{name:V})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSSelect),{width:"100%","model-value":g.visibility??"PACKAGE",items:l,"value-provider":d,"label-provider":d,"onUpdate:modelValue":V=>V&&m(g,{visibility:V})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSTextInput),{name:`ow-desc-${g.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.descPlaceholderKo"),"model-value":((N=g.description)==null?void 0:N.ko)??"","onUpdate:modelValue":V=>u(g,"ko",V)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSSelect),{width:"100%","model-value":p(g),items:s,"value-provider":d,"label-provider":c,"onUpdate:modelValue":V=>V&&y(g,V)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t(g.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:V=>f(g)},null,8,["caption","onClick"])]),t.createElementVNode("td",_w,[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:V=>t.unref(o).removeOperation(a.value.modelId,g.modelId)},null,8,["onClick"])])])}),128)),(E=a.value.operations)!=null&&E.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",kw,[t.createElementVNode("td",Ew,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,dw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-373d5455"]]),ww={class:"em-detail__tabs"},vw=["onClick"],Iw={key:0,class:"em-detail__narrow"},xw=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=le.useModalHandle(),a=t.computed(()=>o.state.logical.entities.find(s=>s.modelId===n.entityId)??null);t.watch(a,s=>{s||i.close()});const r=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],l=t.ref("basics");return(s,c)=>{var d;return t.openBlock(),t.createBlock(t.unref(le.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((d=a.value)==null?void 0:d.name)??""})},{default:t.withCtx(()=>[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",ww,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":l.value===m.key}]),onClick:u=>l.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,vw)),64))]),t.createElementVNode("div",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value}])},[l.value==="basics"?(t.openBlock(),t.createElementBlock("div",Iw,[t.createVNode(em,{controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])])):l.value==="columns"?(t.openBlock(),t.createBlock(CN,{key:1,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):l.value==="indexes"?(t.openBlock(),t.createBlock(rw,{key:2,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(Nw,{key:3,controller:t.unref(o),"entity-id":a.value.modelId},null,8,["controller","entity-id"]))],2)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-785c4770"]]);function Na(e,n,o){e.openModal({component:xw,bind:{controller:t.markRaw(n),entityId:o}})}const lm="외래키는 연관관계에서 파생됩니다. 삭제하려면 연관관계선을 선택해 삭제하세요.";function Cw(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Ue(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Ue();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Ue()}for(const a of n.indexes??[]){a.modelId=Ue();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Ue();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const Sw=220;function $w(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||Sw));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const gl=(e,n)=>({x:e.x+n.x,y:e.y+n.y}),Bn=Symbol("editorController");function sm(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function wa(e,n){const o=[];for(const i of n.remove)o.push(kn(e,i));for(const i of n.update)o.push(_n(e,i.attributeId,i.patch));for(const i of n.add)o.push(Vt(e,i));return o}function co(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function uo(e,n){const o=[];for(const[i,a]of Mh(e,n,Ue))o.push(...wa(i,a));return o}function cm(e,n,o){const i=new Set(o.remove);return co(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function bl(e,n){const o=To(e,n,Ue),i=wa(n,o),a=cm(e,n,o);return i.push(...uo(a,n)),i}function dm(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Ue()}))}function Rw(e,n){var d;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=wt(o.attributes),u=new Set(o.attributes.map(y=>y.name));let p="id";for(let y=2;u.has(p);y++)p=`id${y}`;a={modelId:Ue(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Ue(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(Vt(n,a))}const r=[];for(const m of e.entities)for(const u of m.attributes){if(((d=u.embedded)==null?void 0:d.embeddableRef)!==n)continue;const p=e.associations.find(h=>h.modelId===u.embedded.associationRef);if(!p)continue;const y=p.end1.entityRef===m.modelId,f=y?p.end1:p.end2,b=y?p.end2:p.end1;r.push({ownerId:m.modelId,dispId:u.modelId,assocId:p.modelId,end1:{entityRef:m.modelId,multiplicity:f.multiplicity,navigable:f.navigable,composition:!1},end2:{entityRef:n,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const u=new Set(r.filter(p=>p.ownerId===m.modelId).map(p=>p.dispId));return u.size?{...m,attributes:m.attributes.filter(p=>!u.has(p.modelId))}:m}),associations:e.associations.map(m=>{const u=r.find(p=>p.assocId===m.modelId);return u?{...m,end1:u.end1,end2:u.end2}:m})},s=To(l,n,Ue);for(const m of r){const u=s.add.find(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===m.assocId});u&&(m.end2.attributeRef=u.modelId)}for(const m of r)i.push(kn(m.ownerId,m.dispId)),i.push(Mi(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...wa(n,s));const c=cm(l,n,s);return i.push(...uo(c,n)),i}function Aw(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(g=>g.modelId===c);if(!d||d.attributes.some(g=>{var N;return((N=g.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const m=Ue(),u=wt(d.attributes),p=new Set(d.attributes.map(g=>g.name)),y=a(o.name);let f=y;for(let g=2;p.has(f);g++)f=`${y}${g}`;const b=o.attributes.filter(g=>!g.identifier&&!g.derivedFrom).flatMap(g=>g.dbAttrs).map(g=>({...g,modelId:Ue()})),h={modelId:m,name:f,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:u,dbAttrs:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Vt(c,h));const _=l?"end2":"end1",E=l?"end1":"end2";i.push(Mi(r.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Ue()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}}))}return i}function Tw(e=sm(),n={}){var Oe,et;const o=t.reactive(e);let i=new Nr(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),m=t.ref(n.uiLocale??"ko"),u=(v,M)=>St(m.value,v,M),p=t.ref(n.reservedWords),y=t.ref(n.selectableDataTypes),f=t.ref(n.largeEntityThreshold),b=t.ref(n.flagEntitiesWithoutRelations??!1),h=t.ref(!1),_=t.ref(!1),E=t.ref(!1),g=t.ref(0),N=t.ref(null);let V=0;const T=v=>{if(n.onNotice){n.onNotice(v);return}N.value={text:v,id:++V}},I=t.ref(((Oe=n.meta)==null?void 0:Oe.schemaVersion)??1),z=t.ref(((et=n.meta)==null?void 0:et.opWriteEnabled)??!1),w=t.computed(()=>I.value>=2&&z.value),x=n.historyTransport,F=t.computed(()=>w.value&&x!==void 0),C=n.restoreTransport,se=t.ref(0),k=t.computed(()=>w.value&&S.value&&C!==void 0);async function G(v){if(!C||!S.value)return{ok:!1,reason:"unavailable"};const M=await C(v);return M.ok&&se.value++,M}const S=t.ref(!(I.value>=2&&z.value===!1)),H=t.ref("LOGICAL_PHYSICAL"),Q=t.ref("straight"),ie=t.ref(!0),oe=t.ref(!0),W=t.ref(null),fe=t.computed(()=>{var v;return((v=W.value)==null?void 0:v.kind)==="attribute"?{entityId:W.value.entityId,attrId:W.value.anchor}:null}),ge=t.computed(()=>{var v;return((v=W.value)==null?void 0:v.kind)==="attribute"?W.value.ids:[]}),$e=t.computed(()=>{var v,M;return((v=W.value)==null?void 0:v.kind)==="entity"?W.value.id:((M=W.value)==null?void 0:M.kind)==="attribute"?W.value.entityId:null}),pe=t.ref(null);let Ne=0;const ve=t.ref(null),Te=t.ref(null);let re=n.meta;function _e(){i.onChange(()=>{h.value=i.canUndo,_.value=i.canRedo,E.value=i.isDirty,g.value++})}_e();let me=null,ke=null;function ue(){ke==null||ke(),ke=null,me=null}function L(){if(ue(),!w.value||!n.opTransport)return;const v=new Rc({diagramId:o.layout.diagramId,state:o,transport:n.opTransport,origin:"gui",onFreeze:M=>{S.value=!1,Te.value=M},onError:n.onOpError});v.seed((re==null?void 0:re.revSeed)??{}),ke=v.attach(i),me=v}L();const D=t.computed(()=>Kl(o.logical,o.layout)),K=t.computed(()=>({reservedWords:p.value,selectableDataTypes:y.value,largeEntityThreshold:f.value,flagEntitiesWithoutRelations:b.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Z=t.computed(()=>hs(o.logical,K.value)),ne=t.computed(()=>{const v=new Map;for(const M of Z.value){if(!M.targetRef)continue;const ae=v.get(M.targetRef);ae?ae.push(M):v.set(M.targetRef,[M])}return v}),te=v=>{S.value&&i.execute(v)},ye=v=>o.layout.entityLayouts.some(M=>M.entityRef===v&&!!M.locked),J=v=>o.layout.groupLayouts.some(M=>M.groupRef===v&&!!M.locked),X=v=>{const M=o.logical.associations.find(ae=>ae.modelId===v);return!!M&&(ye(M.end1.entityRef)||ye(M.end2.entityRef))},ee=(v,M,ae)=>{if(ye(v))return;const de=_n(v,M,ae),Ie=co(o.logical,v,U=>U.map(R=>R.modelId===M?{...R,...ae}:R)),O=uo(Ie,v);te(O.length?We("속성 수정",[de,...O]):de)};function Re(v){const M=v.map(be=>o.layout.entityLayouts.find(Se=>Se.entityRef===be)).filter(be=>!!be);if(!M.length)return{location:{x:40,y:40},size:{width:400,height:300}};let ae=1/0,de=1/0,Ie=-1/0,O=-1/0;for(const be of M){const Se=be.geo.size.width||220,Ae=be.geo.size.height||140;ae=Math.min(ae,be.geo.location.x),de=Math.min(de,be.geo.location.y),Ie=Math.max(Ie,be.geo.location.x+Se),O=Math.max(O,be.geo.location.y+Ae)}const U=40,R=28;return{location:{x:ae-U,y:de-U-R},size:{width:Ie-ae+U*2,height:O-de+U*2+R}}}function Le(v,M,ae){var be;const de=o.layout.groupLayouts.find(Se=>Se.groupRef===v),Ie=(de==null?void 0:de.geo.location)??M,O=M.x-Ie.x,U=M.y-Ie.y,R=[Js(v,M),...ae.map(Se=>Jn(Se.id,Se.location))];if(O||U){const Se=new Set(((be=o.logical.groups.find(Ae=>Ae.modelId===v))==null?void 0:be.memberEntityRefs)??[]);for(const Ae of o.logical.associations){if(!Se.has(Ae.end1.entityRef)||!Se.has(Ae.end2.entityRef))continue;const j=o.layout.associationLayouts.find(Y=>Y.associationRef===Ae.modelId);j&&j.waypoints.length&&R.push(fc(Ae.modelId,O,U))}for(const Ae of(de==null?void 0:de.memberNoteRefs)??[]){const j=o.layout.notes.find(Y=>Y.modelId===Ae);j&&R.push(Ao(Ae,{x:j.geo.location.x+O,y:j.geo.location.y+U}))}}return R}const He={state:o,resolved:D,issues:Z,issuesByRef:ne,flagEntitiesWithoutRelations:b,canUndo:h,canRedo:_,dirty:E,revision:g,notice:N,editable:S,schemaVersion:I,opWriteEnabled:z,opMode:w,opConflict:Te,historyTransport:x,historyAvailable:F,restoreTransport:C,restoreAvailable:k,restoreToSeq:G,reloadRequest:se,displayMode:H,routingMode:Q,showGrid:ie,showMinimap:oe,selection:W,selectedAttr:fe,selectedAttrIds:ge,inspectedEntityId:$e,focusRequest:pe,clipboard:ve,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:m,t:u,selectableDataTypes:y,setEditable(v){S.value=v&&w.value},setEmbeddableCatalog(v){a.value=v},setGroupCodeCatalog(v){r.value=v},setPredefinedCustomTypeCatalog(v){l.value=v},setSuperClassCatalog(v){s.value=v},selectAttribute(v,M,ae="replace"){const de=W.value,Ie=(de==null?void 0:de.kind)==="attribute"&&de.entityId===v;if(ae==="replace"||!Ie){W.value={kind:"attribute",entityId:v,ids:[M],anchor:M};return}if(ae==="toggle"){const j=de.ids.includes(M),Y=j?de.ids.filter(q=>q!==M):[...de.ids,M];if(!Y.length){W.value=null;return}const B=j&&de.anchor===M?Y[Y.length-1]:j?de.anchor:M;W.value={kind:"attribute",entityId:v,ids:Y,anchor:B};return}const O=o.logical.entities.find(j=>j.modelId===v),U=[...(O==null?void 0:O.attributes)??[]].sort((j,Y)=>j.order-Y.order).map(j=>j.modelId),R=U.indexOf(de.anchor),be=U.indexOf(M);if(R<0||be<0){W.value={kind:"attribute",entityId:v,ids:[M],anchor:M};return}const[Se,Ae]=R<=be?[R,be]:[be,R];W.value={kind:"attribute",entityId:v,ids:U.slice(Se,Ae+1),anchor:de.anchor}},moveAttributeFocus(v){const M=W.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const ae=o.logical.entities.find(U=>U.modelId===M.entityId);if(!ae||!ae.attributes.length)return!1;const de=ae.attributes.findIndex(U=>U.modelId===M.anchor);if(de<0)return!1;const Ie=Math.min(Math.max(de+v,0),ae.attributes.length-1);if(Ie===de)return!0;const O=ae.attributes[Ie].modelId;return W.value={kind:"attribute",entityId:M.entityId,ids:[O],anchor:O},!0},nudgeSelectedAttributes(v){const M=W.value;if((M==null?void 0:M.kind)!=="attribute")return!1;const ae=o.logical.entities.find(j=>j.modelId===M.entityId);if(!ae)return!1;const de=ae.attributes,Ie=new Set(M.ids),O=de.map((j,Y)=>Ie.has(j.modelId)?Y:-1).filter(j=>j>=0);if(!O.length)return!1;const U=Math.min(...O),R=de.filter(j=>!Ie.has(j.modelId)),be=de.slice(0,U).filter(j=>!Ie.has(j.modelId)).length;let Se;if(v<0){if(be<=0)return!0;Se=be-1}else{if(R.length-be<=0)return!0;Se=be+1}if(ye(M.entityId))return!0;const Ae=de.filter(j=>Ie.has(j.modelId)).map(j=>j.modelId);return te(vr(M.entityId,Ae,Se)),!0},deleteSelection(){if(!S.value)return!1;const v=W.value;if(!v)return!1;if(v.kind==="attribute"){if(ye(v.entityId))return!1;const M=v.ids;if(!M.length)return!1;M.length===1?He.removeAttribute(v.entityId,M[0]):He.removeAttributes(v.entityId,M)}else if(v.kind==="entity"){if(ye(v.id))return!1;He.removeEntity(v.id)}else if(v.kind==="note")He.removeNote(v.id);else if(v.kind==="group"){if(J(v.id))return!1;He.removeGroup(v.id)}else He.removeAssociation(v.id);return W.value=null,!0},nudgeNodes(v,M,ae){if(!v.length||M===0&&ae===0)return!1;const de=new Set(o.logical.entities.map(Se=>Se.modelId)),Ie=new Set(o.logical.groups.map(Se=>Se.modelId)),O=new Set(o.layout.notes.map(Se=>Se.modelId)),U=new Set;for(const Se of v){if(!Ie.has(Se))continue;const Ae=o.logical.groups.find(j=>j.modelId===Se);for(const j of(Ae==null?void 0:Ae.memberEntityRefs)??[])U.add(j)}const R=[],be=[];for(const Se of v)if(Ie.has(Se)){if(J(Se))continue;const Ae=o.layout.groupLayouts.find(q=>q.groupRef===Se);if(!Ae)continue;const j=o.logical.groups.find(q=>q.modelId===Se),Y=((j==null?void 0:j.memberEntityRefs)??[]).map(q=>{var xe;const $=((xe=o.layout.entityLayouts.find(P=>P.entityRef===q))==null?void 0:xe.geo.location)??{x:0,y:0};return{id:q,location:{x:$.x+M,y:$.y+ae}}}),B={x:Ae.geo.location.x+M,y:Ae.geo.location.y+ae};R.push(We("그룹 이동",Le(Se,B,Y))),be.push("g:"+Se)}else if(de.has(Se)){if(U.has(Se)||ye(Se))continue;const Ae=o.layout.entityLayouts.find(j=>j.entityRef===Se);if(!Ae)continue;R.push(Jn(Se,{x:Ae.geo.location.x+M,y:Ae.geo.location.y+ae})),be.push("e:"+Se)}else if(O.has(Se)){const Ae=o.layout.notes.find(j=>j.modelId===Se);if(!Ae)continue;R.push(Ao(Se,{x:Ae.geo.location.x+M,y:Ae.geo.location.y+ae})),be.push("n:"+Se)}return R.length?(te(We("이동",R,"nudge:"+be.sort().join(","))),!0):!1},requestFocus(v){pe.value={id:v,nonce:++Ne}},undo:()=>{S.value&&i.undo()},redo:()=>{S.value&&i.redo()},markSaved:()=>{S.value&&(me==null||me.flush(),i.markSavePoint())},loadDiagram(v,M){ue(),o.logical=v.logical,o.layout=v.layout,i=new Nr(o),_e(),I.value=(M==null?void 0:M.schemaVersion)??1,z.value=(M==null?void 0:M.opWriteEnabled)??!1,S.value=!(I.value>=2&&z.value===!1),re=M,Te.value=null,W.value=null,h.value=i.canUndo,_.value=i.canRedo,E.value=i.isDirty,L()},flush(){me==null||me.flush()},whenOpsSettled(){return(me==null?void 0:me.whenSettled())??Promise.resolve()},addEntity(v="NewEntity",M={x:80,y:80}){const ae=Ue(),de={modelId:ae,name:v,stereotype:"JPA_ENTITY",table:{physicalName:v.toLowerCase()},attributes:[{modelId:Ue(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Ue(),physicalName:"id",dataType:"BIGINT"}]}]};return te($i(de,{location:{...M},size:{width:220,height:140}})),ae},renameEntity(v,M){ye(v)||te(Hs(v,M))},updateEntity(v,M){if(ye(v))return;const ae=Fs(v,M),de=o.logical.entities.find(U=>U.modelId===v),Ie=M.stereotype==="JPA_EMBEDDABLE"&&!!de&&de.stereotype!=="JPA_EMBEDDABLE",O=!!M.stereotype&&M.stereotype!=="JPA_EMBEDDABLE"&&!!de&&de.stereotype==="JPA_EMBEDDABLE";if(Ie&&de){const U=de.attributes.filter(j=>j.identifier&&!j.derivedFrom).map(j=>_n(v,j.modelId,{identifier:!1})),R=co({...o.logical,entities:o.logical.entities.map(j=>j.modelId===v?{...j,stereotype:"JPA_EMBEDDABLE"}:j)},v,j=>j.map(Y=>Y.identifier&&!Y.derivedFrom?{...Y,identifier:!1}:Y)),be=bl(R,v),Se=Aw(o.logical,v),Ae=[ae,...U,...be,...Se];te(Ae.length>1?We("임베더블 변환",Ae):ae);return}if(O){const U=Rw(o.logical,v),R=[ae,...U];te(R.length>1?We("엔터티 전환",R):ae);return}te(ae)},moveEntity(v,M){ye(v)||te(Jn(v,M))},resizeEntity(v,M){ye(v)||te(js(v,M))},removeEntity(v){ye(v)||te(Us(v))},setEntitySwatch(v,M){te(Gs(v,M))},setEntityCollapsed(v,M){te(Ks(v,M))},setEntityLocked(v,M){te(Ys(v,M))},isEntityLocked(v){return ye(v)},collapseAll(){te(wr(!0))},expandAll(){te(wr(!1))},setAttributeSwatch(v,M,ae){te(Ri(v,M,ae))},dragGroup(v,M,ae){J(v)||te(We("그룹 이동",Le(v,M,ae)))},resizeGroup(v,M){J(v)||te(Zs(v,M))},setGroupSwatch(v,M){te(Qs(v,M))},setGroupLocked(v,M){te(ec(v,M))},isGroupLocked(v){return J(v)},updateGroup(v,M){J(v)||te(qs(v,M))},createGroup(v,M){if(!v.length)return null;const ae=[];for(const O of o.logical.groups)for(const U of v)O.memberEntityRefs.includes(U)&&ae.push(Ti(O.modelId,U));const de=Ue(),Ie={modelId:de,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...v]};return ae.push(Ai(Ie,Re(v))),te(We("그룹 생성",ae)),W.value=null,de},addEmptyGroup(v,M){const ae=Ue();return te(Ai({modelId:ae,name:M?{ko:M}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...v},size:{width:360,height:260}})),ae},removeGroup(v){J(v)||te(Ws(v))},dropEntity(v,M,ae){var O;if(ye(v))return;const de=((O=o.logical.groups.find(U=>U.memberEntityRefs.includes(v)))==null?void 0:O.modelId)??null,Ie=[Jn(v,M)];de!==ae&&(de&&Ie.push(Ti(de,v)),ae&&Ie.push(Xs(ae,v))),te(We("이동",Ie))},ungroupEntity(v){const M=o.logical.groups.find(ae=>ae.memberEntityRefs.includes(v));M&&te(Ti(M.modelId,v))},dropNote(v,M,ae){var O;const de=((O=o.layout.groupLayouts.find(U=>{var R;return(R=U.memberNoteRefs)==null?void 0:R.includes(v)}))==null?void 0:O.groupRef)??null,Ie=[Ao(v,M)];de!==ae&&(de&&Ie.push(Nc(de,v)),ae&&Ie.push(Ec(ae,v))),te(We("이동",Ie))},addPredefinedEmbed(v,M){if(ye(v))return;const ae=a.value.find(be=>be.type===M),de=o.logical.entities.find(be=>be.modelId===v);if(!ae||!de)return;const Ie=wt(de.attributes),O=Ue(),U=ae.fields.map(()=>({modelId:Ue(),physicalName:"",dataType:""})),R={modelId:O,name:ae.defaultName,type:ae.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:Ie,dbAttrs:U};return te(Vt(v,R)),O},addAttribute(v,M={}){if(ye(v))return M.modelId??"";const ae=o.logical.entities.find(Ae=>Ae.modelId===v),de=ae?wt(ae.attributes):0,Ie=M.modelId??Ue(),O=M.name??`field${de}`,U={modelId:Ie,name:O,type:M.type??ir,attrType:M.attrType??"NORMAL",identifier:M.identifier??!1,notNull:M.notNull??!1,order:de,dbAttrs:M.dbAttrs??[{modelId:Ue(),physicalName:O,dataType:"VARCHAR",length:255}],...M},R=Vt(v,U),be=co(o.logical,v,Ae=>[...Ae,U]),Se=uo(be,v);return te(Se.length?We("속성 추가",[R,...Se]):R),Ie},addDivider(v){if(ye(v))return"";const M=o.logical.entities.find(O=>O.modelId===v),ae=M?wt(M.attributes):0,de=Ue();return te(Vt(v,{modelId:de,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:ae,dbAttrs:[]})),de},updateAttribute(v,M,ae){ee(v,M,ae)},setAttributeGroupCode(v,M,ae){ee(v,M,{groupCode:ae,type:ae?Hn:ir})},setEmbedColumns(v,M,ae){var be,Se;if(ye(v))return;const de=_n(v,M,{dbAttrs:ae}),Ie=(be=o.logical.entities.find(Ae=>Ae.modelId===v))==null?void 0:be.attributes.find(Ae=>Ae.modelId===M),O=(Se=Ie==null?void 0:Ie.embedded)==null?void 0:Se.associationRef,U=O?o.logical.associations.find(Ae=>Ae.modelId===O):void 0,R=[];U&&O&&(U.end1.legacyEmbedRaw&&R.push(Mt(O,"end1",{legacyEmbedRaw:void 0})),U.end2.legacyEmbedRaw&&R.push(Mt(O,"end2",{legacyEmbedRaw:void 0}))),te(R.length?We("임베드 컬럼 수정",[de,...R]):de)},removeAttribute(v,M){if(ye(v))return;if(Li(o.logical,v,M)){T(lm);return}const ae=kn(v,M),de=co(o.logical,v,O=>O.filter(U=>U.modelId!==M)),Ie=uo(de,v);te(Ie.length?We("속성 삭제",[ae,...Ie]):ae)},removeAttributes(v,M){var R;if(!M.length||ye(v))return;const ae=M.filter(be=>!Li(o.logical,v,be));if(ae.length<M.length&&T(lm),!ae.length)return;const de=ae.map(be=>kn(v,be)),Ie=new Set(ae),O=co(o.logical,v,be=>be.filter(Se=>!Ie.has(Se.modelId))),U=[...de,...uo(O,v)];te(U.length===1?U[0]:We("속성 삭제",U)),((R=W.value)==null?void 0:R.kind)==="attribute"&&W.value.entityId===v&&(W.value=null)},setAttributeSwatches(v,M,ae){M.length&&(M.length===1?te(Ri(v,M[0],ae)):te(We("속성 색상",M.map(de=>Ri(v,de,ae)))))},reorderAttributes(v,M,ae){!M.length||ye(v)||te(vr(v,M,ae))},addIndex(v,M){ye(v)||te(sc(v,M))},updateIndex(v,M,ae){ye(v)||te(cc(v,M,ae))},removeIndex(v,M){ye(v)||te(dc(v,M))},addOperation(v,M={}){if(ye(v))return M.modelId??"";const ae=o.logical.entities.find(U=>U.modelId===v),de=ae!=null&&ae.operations?wt(ae.operations):0,Ie=M.modelId??Ue(),O={modelId:Ie,name:M.name??`method${de}`,visibility:M.visibility??"PACKAGE",order:de,...M};return te(nc(v,O)),Ie},updateOperation(v,M,ae){ye(v)||te(oc(v,M,ae))},removeOperation(v,M){ye(v)||te(ic(v,M))},reorderOperations(v,M,ae){!M.length||ye(v)||te(ac(v,M,ae))},setOperationSwatch(v,M,ae){te(rc(v,M,ae))},addAssociation(v,M,ae,de){if(ye(v)||ye(M))return"";const Ie=Ue(),O={modelId:Ie,end1:{entityRef:v,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:M,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},U={...o.logical,associations:[...o.logical.associations,O]},R=To(U,M,Ue),be=R.add[0];be&&(O.end2.attributeRef=be.modelId);const Se={associationRef:Ie,waypoints:[],sourceColumnRef:ae,targetColumnRef:(be==null?void 0:be.modelId)??de},Ae=Vi(O,Se),j=wa(M,R);return te(j.length?We("관계 추가",[Ae,...j]):Ae),Ie},addEmbedAssociation(v,M){if(ye(v))return;const ae=o.logical.entities.find(xe=>xe.modelId===v),de=o.logical.entities.find(xe=>xe.modelId===M);if(!ae||!de||de.stereotype!=="JPA_EMBEDDABLE")return;const Ie=Ue(),O=Ue(),U=Ue(),R=wt(ae.attributes),be=dm(de),Se=xe=>xe&&xe.charAt(0).toLowerCase()+xe.slice(1),Ae=new Set(ae.attributes.map(xe=>xe.name)),j=Se(de.name);let Y=j;for(let xe=2;Ae.has(Y);xe++)Y=`${j}${xe}`;const B={modelId:O,name:Y,type:de.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:R,dbAttrs:be,embedded:{associationRef:Ie,embeddableRef:M}},q={modelId:Ie,end1:{entityRef:v,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:U},end2:{entityRef:M,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:O}},$={associationRef:Ie,waypoints:[],sourceColumnRef:O,targetColumnRef:void 0};return te(We("임베드 추가",[Vt(v,B),Vi(q,$)])),Ie},setEmbedCardinality(v,M){var j;if(X(v))return;const ae=o.logical.associations.find(Y=>Y.modelId===v);if(!ae)return;let de,Ie;for(const Y of o.logical.entities){const B=Y.attributes.find(q=>{var $;return(($=q.embedded)==null?void 0:$.associationRef)===v&&q.attrType==="EMBED_OWN"});if(B){de=Y.modelId,Ie=B;break}}if(!de||!Ie)return;const O=Ie.embedded.embeddableRef,U=ae.end2.entityRef===O?"end2":"end1",R=ae[U];if(R.multiplicity===M)return;const be=Y=>Y==="ZERO_OR_MORE_INSTANCES"||Y==="ONE_OR_MORE_INSTANCES",Se=be(R.multiplicity),Ae=be(M);if(Se===Ae){te(Mt(v,U,{multiplicity:M}));return}if(Ae)te(We("임베드 컬렉션 전환",[_n(de,Ie.modelId,{dbAttrs:[]}),Mt(v,U,{multiplicity:M,jpa:{...R.jpa,collectionType:((j=R.jpa)==null?void 0:j.collectionType)??"LIST"}})]));else{const Y=o.logical.entities.find(B=>B.modelId===O);if(!Y)return;te(We("임베드 단일 전환",[_n(de,Ie.modelId,{dbAttrs:dm(Y)}),Mt(v,U,{multiplicity:M,jpa:{...R.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(v){if(X(v))return;const M=o.logical.associations.find(U=>U.modelId===v),ae=lc(v);if(!M){te(ae);return}for(const U of o.logical.entities){const R=U.attributes.find(be=>{var Se;return((Se=be.embedded)==null?void 0:Se.associationRef)===v});if(R){te(We("임베드 삭제",[ae,kn(U.modelId,R.modelId)]));return}}const de=M.end2.entityRef,Ie={...o.logical,associations:o.logical.associations.filter(U=>U.modelId!==v)},O=bl(Ie,de);te(O.length?We("관계 삭제",[ae,...O]):ae)},setAssociationIdentifying(v,M){if(X(v))return;const ae=o.logical.associations.find(R=>R.modelId===v),de=Mi(v,{identifying:M});if(!ae||ae.identifying===M){te(de);return}const Ie=ae.end2.entityRef,O={...o.logical,associations:o.logical.associations.map(R=>R.modelId===v?{...R,identifying:M}:R)},U=bl(O,Ie);te(U.length?We("식별 관계 변경",[de,...U]):de)},updateAssociationEnd(v,M,ae){if(X(v))return;const de=o.logical.associations.find(Ie=>Ie.modelId===v);if(de&&M==="end1"&&"navigable"in ae&&ae.navigable!==de.end1.navigable){const Ie=o.logical.entities.find(R=>R.modelId===de.end1.entityRef),O=o.logical.entities.find(R=>R.modelId===de.end2.entityRef),U=(Ie==null?void 0:Ie.stereotype)==="JPA_EMBEDDABLE"||(O==null?void 0:O.stereotype)==="JPA_EMBEDDABLE";if(Ie&&O&&!U){if(ae.navigable===!0&&!de.end1.attributeRef){const R=hi(de.end2.multiplicity),be=de.end1.navFieldNameHint||gi(O.name,R),Se=ts(be,new Set(Ie.attributes.map(B=>B.name))),Ae=Ue(),j=wt(Ie.attributes),Y={modelId:Ae,name:Se,type:O.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:j,dbAttrs:[]};te(We("inverse nav 추가",[Vt(de.end1.entityRef,Y),Mt(v,"end1",{...ae,attributeRef:Ae,navFieldNameHint:void 0})]));return}if(ae.navigable===!1&&de.end1.attributeRef){const R=de.end1.attributeRef,be=Ie.attributes.find(Ae=>Ae.modelId===R&&Ae.attrType==="RELATION_REF"),Se=Mt(v,"end1",{...ae,attributeRef:void 0,navFieldNameHint:(be==null?void 0:be.name)??de.end1.navFieldNameHint});te(be?We("inverse nav 제거",[kn(de.end1.entityRef,R),Se]):Se);return}}}te(Mt(v,M,ae))},hasQuickFix(v){return S.value?mr(v,o.logical)!=null:!1},applyQuickFix(v){if(!S.value)return!1;const M=mr(v,o.logical);if(!M||X(M.assocRef))return!1;const ae=o.logical.associations.find(de=>de.modelId===M.assocRef);return ae?(te(Mt(M.assocRef,M.which,{jpa:{...ae[M.which].jpa,cascadeTypes:M.cascades}})),!0):!1},moveWaypoint(v,M,ae){te(uc(v,M,ae))},addWaypoint(v,M,ae){te(hc(v,M,ae))},removeWaypoint(v,M){te(mc(v,M))},clearWaypoints(v){te(pc(v))},addNote(v="메모",M={x:80,y:80}){const ae=Ue();return te(yc({modelId:ae,memo:v,geo:{location:{...M},size:{width:200,height:120}}})),ae},removeNote(v){te(gc(v))},moveNote(v,M){te(Ao(v,M))},resizeNote(v,M){te(bc(v,M))},setNoteMemo(v,M){te(_c(v,M))},setNoteSwatch(v,M){te(kc(v,M))},addNoteConnection(v,M){te(wc(v,M))},removeNoteConnection(v,M){te(vc(v,M))},moveNoteConnectionWaypoint(v,M,ae,de){te(Ic(v,M,ae,de))},addNoteConnectionWaypoint(v,M,ae,de){te(xc(v,M,ae,de))},removeNoteConnectionWaypoint(v,M,ae){te(Cc(v,M,ae))},clearNoteConnectionWaypoints(v,M){te(Sc(v,M))},autoLayout(){const v=Wl(o.logical,o.layout);v.length&&te(We("자동 배치",v.map(M=>Jn(M.id,M.location))))},copy(v){if(v&&v.length){const R=v.filter(be=>o.logical.entities.some(Se=>Se.modelId===be));if(R.length){ve.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:o.logical,layout:o.layout},selectedIds:R}));return}}const M=W.value;if((M==null?void 0:M.kind)==="attribute"){const R=o.logical.entities.find(Se=>Se.modelId===M.entityId);if(!R)return;const be=[...R.attributes].sort((Se,Ae)=>Se.order-Ae.order).filter(Se=>M.ids.includes(Se.modelId));if(!be.length)return;ve.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:be}));return}const ae=$e.value;if(!ae)return;const de=o.logical.entities.find(R=>R.modelId===ae),Ie=o.layout.entityLayouts.find(R=>R.entityRef===ae);if(!de)return;const O=(Ie==null?void 0:Ie.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let U;if(Ie){const{entityRef:R,geo:be,locked:Se,...Ae}=Ie;Object.keys(Ae).length&&(U=Ae)}ve.value=JSON.parse(JSON.stringify({kind:"entity",entity:de,geo:O,layoutExtras:U}))},paste(){if(!S.value)return[];const v=ve.value;if(!v)return[];if(v.kind==="entities")return He.importEntities(v.source,v.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(v.kind==="attribute"){const O=$e.value;if(!O)return[];const U=o.logical.entities.find(Y=>Y.modelId===O);if(!U)return[];const R=new Set(U.attributes.map(Y=>Y.name)),be=new Set(U.attributes.flatMap(Y=>Y.dbAttrs.map(B=>B.physicalName))),Se=wt(U.attributes),Ae=[],j=v.attributes.map((Y,B)=>{const q=JSON.parse(JSON.stringify(Y));q.modelId=Ue();for(const $ of q.dbAttrs)$.modelId=Ue();R.has(q.name)&&(q.name=`${q.name}_copy`);for(const $ of q.dbAttrs)$.physicalName&&be.has($.physicalName)&&($.physicalName=`${$.physicalName}_copy`);return q.order=Se+B,Ae.push(q.modelId),Vt(O,q)});return te(j.length===1?j[0]:We("속성 붙여넣기",j)),W.value={kind:"attribute",entityId:O,ids:Ae,anchor:Ae[Ae.length-1]},[]}const{clone:M,idMap:ae}=Cw(v.entity),de={location:{x:v.geo.location.x+40,y:v.geo.location.y+40},size:{...v.geo.size}};let Ie;if(v.layoutExtras){const O={...v.layoutExtras},U=R=>ae.get(R);O.attributeStyles&&(O.attributeStyles=xi(O.attributeStyles,U)),O.operationStyles&&(O.operationStyles=xi(O.operationStyles,U)),Ie=O}return te($i(M,de,Ie)),W.value={kind:"entity",id:M.modelId},[M.modelId]},importEntities(v,M,ae){if(!S.value)return[];const de=Vs(v,M,{existing:o.logical,includeRelated:ae==null?void 0:ae.includeRelated,collisionSuffix:ae==null?void 0:ae.collisionSuffix});if(de.logical.entities.length===0)return[];const Ie=(ae==null?void 0:ae.placement)??"append-right",O=Ie==="append-right"?$w(o.layout,de.layout):Ie.offset,U=new Map(de.layout.entityLayouts.map(j=>[j.entityRef,j])),R=new Map(de.layout.associationLayouts.map(j=>[j.associationRef,j])),be=new Map(de.layout.groupLayouts.map(j=>[j.groupRef,j])),Se=[];let Ae=80;for(const j of de.logical.entities){const Y=U.get(j.modelId),B=Y?{location:gl(Y.geo.location,O),size:{...Y.geo.size}}:{location:{x:Ae+=40,y:80},size:{width:220,height:140}};let q;if(Y){const{entityRef:$,geo:xe,locked:P,...A}=Y;q=A}Se.push($i(j,B,q))}for(const j of de.logical.associations){const Y=R.get(j.modelId),B=Y?{...Y,waypoints:Y.waypoints.map(q=>gl(q,O))}:{associationRef:j.modelId,waypoints:[]};Se.push(Vi(j,B))}for(const j of de.logical.groups){const Y=be.get(j.modelId),B=Y?{location:gl(Y.geo.location,O),size:{...Y.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let q;if(Y){const{groupRef:$,geo:xe,locked:P,memberNoteRefs:A,...ce}=Y;q=ce}Se.push(Ai(j,B,q))}return te(We("다이어그램 가져오기",Se)),W.value={kind:"entity",id:de.logical.entities[0].modelId},de.logical.entities.map(j=>j.modelId)}};return He}const va=Symbol("groupHover"),um=Symbol("groupDrag"),mo=Symbol("relationHighlight"),mm=Symbol("diffOverlay"),Vw={key:0,class:"em-sel","aria-hidden":"true"},Mw=["title","aria-expanded","disabled"],Bw={class:"em-entity__stereotype"},Dw={key:1,class:"em-entity__name"},Ow=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Lw=["onPointerdown"],Pw={key:1,class:"em-entity__divider-label"},zw=["title"],Uw={class:"em-key-slot"},Fw={class:"em-key-slot"},Hw={key:0,class:"em-entity__type"},jw=["onClick"],Gw={class:"em-entity__attrname"},Kw={class:"em-entity__type"},Yw=["data-op"],qw=["onPointerdown"],Ww={class:"em-entity__op-vis","aria-hidden":"true"},Xw=["title"],Jw={key:4,class:"em-entity__footer"},fm=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Bn,null),i=(j,Y)=>o?o.t(j,Y):St("ko",j,Y),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=le.useModal();function l(){o&&Na(r,o,n.id)}const s=t.inject(va,null),c=t.inject(mo,null),d=t.inject(mm,null),m=t.computed(()=>{var j;return((j=d==null?void 0:d.marks.value)==null?void 0:j.get(n.id))??null}),u=t.computed(()=>!!o&&o.editable.value);function p(){s&&(s.value=n.data.groupRef??null)}function y(){c==null||c.setEntityHover(n.id)}function f(){c==null||c.setEntityHover(null)}const b=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),h=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!b.value),_=t.computed(()=>{var j;return((j=o==null?void 0:o.selection.value)==null?void 0:j.kind)==="entity"&&o.selection.value.id===n.id}),E=t.computed(()=>!!n.selected&&!_.value),g=t.computed(()=>{var j;return o&&((j=o.selectedAttr.value)==null?void 0:j.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),N=t.computed(()=>g.value.size>0);function V(j,Y){const B=Y.shiftKey?"range":Y.metaKey||Y.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,j.modelId,B)}const T=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>n.data.entity),z=t.computed(()=>[...I.value.attributes].sort((j,Y)=>j.order-Y.order)),w=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),x=t.computed(()=>n.data.collapsed??!1),F=t.computed(()=>n.data.locked??!1),C=t.computed(()=>u.value&&!F.value);function se(){u.value&&(o==null||o.setEntityCollapsed(n.id,!x.value))}const k=t.computed(()=>w.value==="PHYSICAL"||w.value==="LOGICAL_PHYSICAL"),G=t.computed(()=>{const j=w.value==="PHYSICAL"||w.value==="LOGICAL_PHYSICAL",Y={};for(const B of z.value){const q=B.attrType.startsWith("RELATION")&&B.dbAttrs.length>0;Y[B.modelId]={pk:B.identifier,fk:q&&j,required:B.notNull&&!B.identifier}}return Y});function S(j){if(!j)return"";const Y=[];return j.pk&&j.fk?Y.push(i("em.node.keyPfk")):j.pk?Y.push(i("em.node.keyPk")):j.fk&&Y.push(i("em.node.keyFk")),j.required&&Y.push(i("em.node.required")),Y.join(" · ")}const H=t.computed(()=>{const j=fl(ft(n.data.style)),Y={};return j&&(Y["--em-header-bg"]=j.bar,Y["--em-header-fg"]=j.barOn),Y});function Q(j){var Y,B;return(B=fl(ft((Y=n.data.attributeStyles)==null?void 0:Y[j.modelId])))==null?void 0:B.text}const ie=t.computed(()=>[...I.value.operations??[]].sort((j,Y)=>j.order-Y.order)),oe=t.computed(()=>w.value==="CLASS"&&ie.value.length>0),W={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function fe(j){return j?W[j]:"~"}function ge(j){var Y,B;return(B=fl(ft((Y=n.data.operationStyles)==null?void 0:Y[j.modelId])))==null?void 0:B.text}function $e(j,Y,B){switch(w.value){case"CLASS":return[{text:j}];case"PHYSICAL":return[{text:B||j}];case"LOGICAL":return[Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const q=Y?{text:Y}:{text:i("em.node.logicalMissing"),missing:!0};return B?[q,{text:` · ${B}`}]:[q]}}}function pe(j){if(!o||!ka(j))return j;const Y=j.dbAttrs[0];if(Y!=null&&Y.physicalName&&(Y!=null&&Y.dataType))return j;const B=pl(j,I.value,o.state.logical.entities,o.state.logical.associations);if(!B)return j;const q={...Y,physicalName:(Y==null?void 0:Y.physicalName)||B.physicalName,dataType:(Y==null?void 0:Y.dataType)||B.dataType,length:(Y==null?void 0:Y.length)??B.length,scale:(Y==null?void 0:Y.scale)??B.scale};return{...j,dbAttrs:[q,...j.dbAttrs.slice(1)]}}function Ne(j){var B,q,$;if(ve(j))return[{text:j.name}];const Y=pe(j);return $e(j.name,(q=(B=Y.dbAttrs[0])==null?void 0:B.logicalName)==null?void 0:q[a.value],(($=Y.dbAttrs[0])==null?void 0:$.physicalName)??"")}function ve(j){return j.attrType.startsWith("EMBED")&&j.dbAttrs.length>0}function Te(j){return j.attrType==="DIVIDER"}function re(j){if(j.attrType!=="EMBED_PREDEF")return j.dbAttrs;const Y=o==null?void 0:o.embeddableCatalog.value.find(q=>q.type===j.type);if(!Y)return j.dbAttrs;const B=fn(mn(I.value,(o==null?void 0:o.state.logical.entities)??[]));return j.dbAttrs.map((q,$)=>{const xe=Y.fields[$],P=Gn(q,B);return P?{...q,physicalName:P.physicalName,logicalName:q.logicalName??(xe==null?void 0:xe.logicalName),dataType:q.dataType||(xe==null?void 0:xe.dataType)||""}:xe?{...q,physicalName:q.physicalName||xe.physicalName,logicalName:q.logicalName??xe.logicalName,dataType:q.dataType||xe.dataType,length:q.length??xe.length}:q})}function _e(j){var Y;return $e(j.physicalName,(Y=j.logicalName)==null?void 0:Y[a.value],j.physicalName)}function me(j){const Y=ar(j,(o==null?void 0:o.state.logical.associations)??[]);return rr(w.value,pe(j),Y)}const ke=t.computed(()=>{var j,Y,B;return $e(I.value.name,(Y=(j=I.value.table)==null?void 0:j.logicalName)==null?void 0:Y[a.value],((B=I.value.table)==null?void 0:B.physicalName)??"")}),ue=t.ref(!1),L=t.ref(""),D=t.ref(null);async function K(){var j,Y;C.value&&(L.value=I.value.name,ue.value=!0,await t.nextTick(),(j=D.value)==null||j.focus(),(Y=D.value)==null||Y.select())}function Z(){if(!ue.value)return;ue.value=!1;const j=L.value.trim();j&&j!==I.value.name&&(o==null||o.renameEntity(n.id,j))}function ne(){o==null||o.addAttribute(n.id)}function te(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:ye,findNode:J}=Ge(),X=t.ref(null),ee=t.computed(()=>{const j=X.value??n.data.size;return j?{width:`${j.width}px`,minHeight:`${j.height}px`}:void 0});let Re=null;function Le(j){var q,$,xe;if(!C.value)return;j.stopPropagation();const Y=(q=J(n.id))==null?void 0:q.dimensions,B=ye({x:j.clientX,y:j.clientY});Re={fx:B.x,fy:B.y,w:(Y==null?void 0:Y.width)??(($=n.data.size)==null?void 0:$.width)??200,h:(Y==null?void 0:Y.height)??((xe=n.data.size)==null?void 0:xe.height)??120},j.target.setPointerCapture(j.pointerId)}function He(j){if(!Re)return;const Y=ye({x:j.clientX,y:j.clientY});X.value={width:Math.max(40,Re.w+(Y.x-Re.fx)),height:Math.max(40,Re.h+(Y.y-Re.fy))}}function Oe(j){var Y,B,q;if(Re&&X.value&&o){const $=(Y=J(n.id))==null?void 0:Y.dimensions;o.resizeEntity(n.id,{width:Math.round(($==null?void 0:$.width)??X.value.width),height:Math.round(($==null?void 0:$.height)??X.value.height)})}Re=null,X.value=null,(q=(B=j.target).releasePointerCapture)==null||q.call(B,j.pointerId)}const et=t.ref(null),v=t.ref(null);function M(j,Y){if(!C.value)return;Y.stopPropagation(),Y.preventDefault();const B=g.value,q=B.has(j.modelId)?new Set(B):new Set([j.modelId]);v.value={ids:q,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId)}function ae(j){if(!v.value||!et.value)return;const Y=Array.from(et.value.querySelectorAll(".em-entity__row"));if(!Y.length)return;let B=Y.length;for(let xe=0;xe<Y.length;xe++){const P=Y[xe].getBoundingClientRect();if(j.clientY<P.top+P.height/2){B=xe;break}}const q=Y[Y.length-1],$=B<Y.length?Y[B].offsetTop:q.offsetTop+q.offsetHeight;v.value={...v.value,dropIndex:B,lineY:$}}function de(){const j=v.value;if(v.value=null,!j||j.dropIndex<0)return;const Y=z.value,B=Y.filter(A=>j.ids.has(A.modelId)).map(A=>A.modelId),q=Y.filter((A,ce)=>j.ids.has(A.modelId)&&ce<j.dropIndex).length,$=j.dropIndex-q,xe=Y.filter(A=>!j.ids.has(A.modelId)).map(A=>A.modelId);[...xe.slice(0,$),...B,...xe.slice($)].join(",")!==Y.map(A=>A.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,B,$))}function Ie(){v.value=null}const O=t.ref(null),U=t.ref(null);function R(j,Y){C.value&&(Y.stopPropagation(),Y.preventDefault(),U.value={id:j.modelId,dropIndex:-1,lineY:0},Y.target.setPointerCapture(Y.pointerId))}function be(j){if(!U.value||!O.value)return;const Y=Array.from(O.value.querySelectorAll(".em-entity__op-row"));if(!Y.length)return;let B=Y.length;for(let xe=0;xe<Y.length;xe++){const P=Y[xe].getBoundingClientRect();if(j.clientY<P.top+P.height/2){B=xe;break}}const q=Y[Y.length-1],$=B<Y.length?Y[B].offsetTop:q.offsetTop+q.offsetHeight;U.value={...U.value,dropIndex:B,lineY:$}}function Se(){const j=U.value;if(U.value=null,!j||j.dropIndex<0)return;const B=ie.value.findIndex($=>$.modelId===j.id);if(B<0)return;const q=j.dropIndex-(B<j.dropIndex?1:0);q!==B&&(o==null||o.reorderOperations(n.id,[j.id],q))}function Ae(){U.value=null}return(j,Y)=>{var B,q;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":b.value,"is-related":h.value,"is-dimmed":T.value,"is-selected":_.value,"is-multi-selected":E.value,"has-focused-attr":N.value,"is-locked":F.value,"is-diff-added":((B=m.value)==null?void 0:B.verb)==="added","is-diff-modified":((q=m.value)==null?void 0:q.verb)==="modified"}]),style:t.normalizeStyle(ee.value),onPointerdown:p,onMouseenter:y,onMouseleave:f,onDblclick:l},[_.value?(t.openBlock(),t.createElementBlock("div",Vw,[...Y[7]||(Y[7]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(H.value),onDblclick:t.withModifiers(K,["stop"])},[t.createElementVNode("button",{type:"button",class:"em-entity__caret nodrag",title:i(x.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!x.value,disabled:!u.value,onClick:t.withModifiers(se,["stop"]),onPointerdown:Y[0]||(Y[0]=t.withModifiers(()=>{},["stop"])),onDblclick:Y[1]||(Y[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(x.value?"▸":"▾"),41,Mw),t.createElementVNode("span",Bw,"«"+t.toDisplayString(t.unref(Eo)(I.value.stereotype))+"»",1),ue.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:D,"onUpdate:modelValue":Y[2]||(Y[2]=$=>L.value=$),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Z,["enter"]),Y[3]||(Y[3]=t.withKeys($=>ue.value=!1,["esc"]))],onBlur:Z,onPointerdown:Y[4]||(Y[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,L.value]]):(t.openBlock(),t.createElementBlock("span",Dw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,($,xe)=>(t.openBlock(),t.createElementBlock("span",{key:xe,class:t.normalizeClass({"em-entity__missing":$.missing})},t.toDisplayString($.text),3))),128))])),F.value?(t.openBlock(),t.createBlock(De,{key:2,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),m.value?(t.openBlock(),t.createElementBlock("span",{key:3,class:t.normalizeClass(["em-entity__diff-badge",m.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(m.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),x.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:et,class:"em-entity__attrs"},[v.value&&v.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${v.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(z.value,$=>{var xe,P,A,ce,Ce;return t.openBlock(),t.createElementBlock(t.Fragment,{key:$.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":g.value.has($.modelId),"is-dragging":(xe=v.value)==null?void 0:xe.ids.has($.modelId),"is-embed":ve($),"is-divider":Te($),nodrag:Te($)&&C.value,"is-diff-changed":!!((P=m.value)!=null&&P.changedAttributeIds.has($.modelId))}]),"data-attr":$.modelId,onClick:t.withModifiers(Ve=>V($,Ve),["stop"]),onPointerdown:Ve=>Te($)?M($,Ve):void 0,onPointermove:Ve=>Te($)?ae(Ve):void 0,onPointerup:Ve=>Te($)?de():void 0,onPointercancel:Ve=>Te($)?Ie():void 0},[C.value&&!Te($)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Ve=>M($,Ve),onPointermove:ae,onPointerup:de,onPointercancel:Ie,onClick:Y[5]||(Y[5]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Lw)):t.createCommentVNode("",!0),Te($)?(t.openBlock(),t.createElementBlock("span",Pw,t.toDisplayString($.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Rn),{id:`l:${$.modelId}`,type:"target",position:t.unref(Be).Left,class:"em-handle"},null,8,["id","position"]),t.createElementVNode("span",{class:"em-entity__keys",title:S(G.value[$.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Uw,[(A=G.value[$.modelId])!=null&&A.pk?(t.openBlock(),t.createBlock(De,{key:0,name:"key",size:12,class:"em-key is-pk"})):(ce=G.value[$.modelId])!=null&&ce.required?(t.openBlock(),t.createBlock(De,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Fw,[ve($)?(t.openBlock(),t.createBlock(De,{key:0,name:"table",size:11,class:"em-embed-glyph"})):(Ce=G.value[$.modelId])!=null&&Ce.fk?(t.openBlock(),t.createBlock(De,{key:1,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,zw),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:Q($)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ne($),(Ve,Pe)=>(t.openBlock(),t.createElementBlock("span",{key:Pe,class:t.normalizeClass({"em-entity__missing":Ve.missing})},t.toDisplayString(Ve.text),3))),128))],4),me($)?(t.openBlock(),t.createElementBlock("span",Hw,t.toDisplayString(me($)),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Rn),{id:`r:${$.modelId}`,type:"source",position:t.unref(Be).Right,class:"em-handle"},null,8,["id","position"])],64))],42,Ow),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve($)&&k.value?re($):[],Ve=>(t.openBlock(),t.createElementBlock("li",{key:`${$.modelId}:${Ve.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":g.value.has($.modelId)}]),onClick:t.withModifiers(Pe=>V($,Pe),["stop"])},[Y[8]||(Y[8]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Gw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e(Ve),(Pe,we)=>(t.openBlock(),t.createElementBlock("span",{key:we,class:t.normalizeClass({"em-entity__missing":Pe.missing})},t.toDisplayString(Pe.text),3))),128))]),t.createElementVNode("span",Kw,t.toDisplayString(Ve.dataType),1)],10,jw))),128))],64)}),128))],512)),!x.value&&oe.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:O,class:"em-entity__ops"},[U.value&&U.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${U.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie.value,$=>{var xe,P;return t.openBlock(),t.createElementBlock("li",{key:$.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((xe=U.value)==null?void 0:xe.id)===$.modelId,"is-diff-changed":!!((P=m.value)!=null&&P.changedOperationIds.has($.modelId))}]),"data-op":$.modelId},[C.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:A=>R($,A),onPointermove:be,onPointerup:Se,onPointercancel:Ae,onClick:Y[6]||(Y[6]=t.withModifiers(()=>{},["stop"]))},"⠿",40,qw)):t.createCommentVNode("",!0),t.createElementVNode("span",Ww,t.toDisplayString(fe($.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:ge($)})},t.toDisplayString($.name)+"()",5)],10,Yw)}),128))],512)):ie.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ie.value.length})},[t.createVNode(De,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ie.value.length})),1)],8,Xw)):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createElementBlock("footer",Jw,[t.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:ne},t.toDisplayString(i("em.node.addAttr")),1),Y[9]||(Y[9]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{type:"button",class:"em-entity__add nodrag",onClick:te},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),C.value&&!ue.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:Le,onPointermove:He,onPointerup:Oe},null,32)):t.createCommentVNode("",!0)],38)}}}),[["__scopeId","data-v-35746c9b"]]),Zw={key:0,class:"em-sel","aria-hidden":"true"},Qw={class:"em-group__label"},ev={class:"em-group__name"},tv={key:0,class:"em-group__pkg"},nv={key:1,class:"em-group__flag"},pm=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>ft(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(Bn,null),s=(x,F)=>l?l.t(x,F):St("ko",x,F),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var x;return!!n.id&&((x=l==null?void 0:l.selection.value)==null?void 0:x.kind)==="group"&&l.selection.value.id===n.id}),m=t.computed(()=>!!n.selected&&!d.value),u=t.inject(va,null),p=t.computed(()=>!!n.id&&(u==null?void 0:u.value)===n.id),y=t.inject(mo,null);function f(){n.id&&(y==null||y.setGroupHover(n.id))}function b(){y==null||y.setGroupHover(null)}const h=t.computed(()=>!!y&&y.hoverGroupId.value===n.id),_=t.computed(()=>!!y&&y.hoverGroupId.value!==null&&y.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:g}=Ge();let N=null,V=null;function T(x){var se;if(!n.id||!c.value)return;x.stopPropagation();const F=((se=g(n.id))==null?void 0:se.dimensions)??{width:400,height:300},C=E({x:x.clientX,y:x.clientY});N={fx:C.x,fy:C.y,w:F.width,h:F.height},x.target.setPointerCapture(x.pointerId)}function I(x){if(!N||!n.id)return;const F=E({x:x.clientX,y:x.clientY});V={width:Math.max(160,N.w+(F.x-N.fx)),height:Math.max(120,N.h+(F.y-N.fy))};const C=g(n.id);C&&(C.style={width:`${V.width}px`,height:`${V.height}px`})}function z(x){var F,C;N&&V&&n.id&&l&&l.resizeGroup(n.id,V),N=null,V=null,(C=(F=x.target).releasePointerCapture)==null||C.call(F,x.pointerId)}const w=t.computed(()=>{const x=o.value.name;return(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||o.value.packageName||s("em.group.fallback")});return(x,F)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":h.value,"is-dimmed":_.value,"is-selected":d.value,"is-multi-selected":m.value,"is-locked":i.value}]),style:t.normalizeStyle(r.value),onMouseenter:f,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",Zw,[...F[0]||(F[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Qw,[t.createElementVNode("span",ev,t.toDisplayString(w.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",tv,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",nv,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(De,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:T,onPointermove:I,onPointerup:z},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-9b95a9b6"]]),ov={key:0,class:"em-sel","aria-hidden":"true"},iv={key:2,class:"em-note__text"},hm=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Bn,null),i=t.inject(va,null),a=t.inject(mo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>ft(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function m(){a==null||a.setNoteHover(n.id)}function u(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===n.id}),y=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),f=t.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!f.value),h=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!f.value),_=[{id:"n-top",pos:Be.Top},{id:"n-right",pos:Be.Right},{id:"n-bottom",pos:Be.Bottom},{id:"n-left",pos:Be.Left}],E=t.ref(!1),g=t.ref(""),N=t.ref(null);async function V(){var k;l.value&&(g.value=r.value.memo,E.value=!0,await t.nextTick(),(k=N.value)==null||k.focus())}function T(){E.value&&(E.value=!1,g.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,g.value)))}const{screenToFlowCoordinate:I,findNode:z}=Ge();let w=null,x=null;function F(k){var H;if(!l.value)return;k.stopPropagation();const G=((H=z(n.id))==null?void 0:H.dimensions)??r.value.geo.size,S=I({x:k.clientX,y:k.clientY});w={fx:S.x,fy:S.y,w:G.width,h:G.height},k.target.setPointerCapture(k.pointerId)}function C(k){if(!w)return;const G=I({x:k.clientX,y:k.clientY});x={width:Math.max(140,w.w+(G.x-w.fx)),height:Math.max(60,w.h+(G.y-w.fy))};const S=z(n.id);S&&(S.style={width:`${x.width}px`,height:`${x.height}px`})}function se(k){var G,S;w&&x&&o&&o.resizeNote(n.id,x),w=null,x=null,(S=(G=k.target).releasePointerCapture)==null||S.call(G,k.pointerId)}return(k,G)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":y.value,"is-dimmed":h.value,"is-selected":f.value,"is-multi-selected":b.value}]),style:t.normalizeStyle(c.value),onDblclick:V,onPointerdown:d,onMouseenter:m,onMouseleave:u},[f.value?(t.openBlock(),t.createElementBlock("div",ov,[...G[4]||(G[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),E.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":G[0]||(G[0]=S=>g.value=S),class:"em-note__edit nodrag",onBlur:T,onKeydown:G[1]||(G[1]=t.withKeys(S=>E.value=!1,["esc"])),onPointerdown:G[2]||(G[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,g.value]]):(t.openBlock(),t.createElementBlock("div",iv,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(_,S=>t.createVNode(t.unref(Rn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:G[3]||(G[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!E.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:F,onPointermove:C,onPointerup:se},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-77c75add"]]),av=20,rv=22,lv=7,sv=22,ym=31,gm=7,cv=20,bm=11,_m=11,dv=ym+gm;function uv(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function mv(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Ia(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function km(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function xa(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Em(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:km(e,n);return[xa(o,a,r-Math.PI/2),xa(o,a,r+Math.PI/2)]}function Nm(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function wm(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Ia(e,n,av),[d,m]=Em(e,n,c,rv);if(a.push({x1:d.x,y1:d.y,x2:m.x,y2:m.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),uv(o.multiplicity)){const u=Ia(e,n,ym);r.push({cx:u.x,cy:u.y,r:gm})}if(mv(o.multiplicity)){const u=Ia(e,n,lv),[p,y]=Em(e,n,u,sv);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:y.x,y2:y.y}),a.push({x1:c.x,y1:c.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Ia(e,n,cv),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},m=km(e,n),u=xa(d,bm/2,m-Math.PI/2),p=xa(d,bm/2,m+Math.PI/2);l.push({points:[e,u,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Nm(s,c,_m,!0),m=Nm(s,c,_m,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}const vm=200,Im=120,_l=24;function xm(e){var a,r;if(!e)return{x:0,y:0,width:vm,height:Im};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||vm,i=((r=e.dimensions)==null?void 0:r.height)||Im;return{x:n.x,y:n.y,width:o,height:i}}function Cm(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Sm(e){const n=t.computed(()=>xm(e.sourceNode())),o=t.computed(()=>xm(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),m=e.targetNode();return!!d&&!!m&&d.id===m.id}),a=t.computed(()=>{var y,f;const d=n.value,m=d.x+d.width;let u=((y=e.sourceRowY)==null?void 0:y.call(e))??d.y+d.height/3,p=((f=e.targetRowY)==null?void 0:f.call(e))??d.y+d.height*2/3;if(Math.abs(p-u)<_l){const b=(u+p)/2;u=b-_l/2,p=b+_l/2}return{source:{x:m,y:u},target:{x:m,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Cm(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Cm(n.value)}),s=t.computed(()=>{var m;const d=(m=e.sourceRowY)==null?void 0:m.call(e);return d!=null?Xa(n.value,d,r.value.x):Wa(n.value,r.value)}),c=t.computed(()=>{var m;const d=(m=e.targetRowY)==null?void 0:m.call(e);return d!=null?Xa(o.value,d,l.value.x):Wa(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const kl=Symbol("waypointController"),fv=["d"],pv=["d"],hv=["d"],yv=["x1","y1","x2","y2"],gv=["cx","cy","r"],bv=["x","y"],_v=["x","y"],kv=["cx","cy","onDblclick"],Ev=["x","y","onPointerdown","onDblclick"],$m=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=Ge(),i=t.inject(kl),a=t.inject(Bn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(um,null),s=t.inject(mo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var me;return((me=a==null?void 0:a.selection.value)==null?void 0:me.kind)==="association"&&a.selection.value.id===n.id}),m=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),u=t.computed(()=>{const me=l==null?void 0:l.value;if(!me||!a)return null;const ke=a.resolved.value.entities,ue=D=>{var K;return(K=ke.find(Z=>Z.entity.modelId===D))==null?void 0:K.groupRef},L=n.data.association;return ue(L.end1.entityRef)===me.groupId&&ue(L.end2.entityRef)===me.groupId?{dx:me.dx,dy:me.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),y=t.ref(-1),f=t.ref({x:0,y:0}),b=t.computed(()=>{const me=u.value;return p.value.map((ke,ue)=>ue===y.value?f.value:me?{x:ke.x+me.dx,y:ke.y+me.dy}:ke)}),h=t.computed(()=>{var me;return!!((me=n.sourceNode.data)!=null&&me.collapsed)}),_=t.computed(()=>{var me;return!!((me=n.targetNode.data)!=null&&me.collapsed)}),{source:E,target:g,sourceSide:N,targetSide:V,isSelf:T}=Sm({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!h.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!_.value?n.targetY:void 0}),I=dv+4,z=t.computed(()=>T.value?ql(E.value,g.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Ka(E.value,N.value,b.value,g.value,V.value,I):qa(E.value,b.value,g.value)),w=t.computed(()=>T.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Ya(E.value,N.value,b.value,g.value,V.value,I):Ja(E.value,b.value,g.value).map((me,ke)=>({point:me,segIndex:ke}))),x=t.computed(()=>T.value||!r.value?[]:b.value),F=yi;function C(me,ke){y.value=me,f.value={...p.value[me]},ke.target.setPointerCapture(ke.pointerId),ke.stopPropagation()}function se(me){if(y.value<0)return;const ke=o({x:me.clientX,y:me.clientY});f.value={x:ke.x,y:ke.y}}function k(me){var ke,ue;y.value>=0&&i&&i.movePoint(n.id,y.value,{...f.value}),y.value=-1,(ue=(ke=me.target).releasePointerCapture)==null||ue.call(ke,me.pointerId)}function G(me,ke){ke.stopPropagation(),i==null||i.removePoint(n.id,me)}function S(me,ke){if(!i)return;const ue=o({x:ke.clientX,y:ke.clientY});i.insertPoint(n.id,me,{x:ue.x,y:ue.y})}const H=t.computed(()=>F(n.data.association.end1.multiplicity)),Q=t.computed(()=>F(n.data.association.end2.multiplicity)),ie=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),oe=t.computed(()=>ie.value==="class"),W=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const me=bo(N.value);return{x:E.value.x+me.x*10,y:E.value.y+me.y*10}}return b.value[0]??g.value}),fe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ke=bo(V.value);return{x:g.value.x+ke.x*10,y:g.value.y+ke.y*10}}const me=b.value;return me[me.length-1]??E.value}),ge=t.computed(()=>{const me=n.data.association;return{multiplicity:me.end1.multiplicity,navigable:me.end1.navigable,composition:me.end1.composition,otherNavigable:me.end2.navigable}}),$e=t.computed(()=>{const me=n.data.association;return{multiplicity:me.end2.multiplicity,navigable:me.end2.navigable,composition:me.end2.composition,otherNavigable:me.end1.navigable}}),pe=t.computed(()=>wm(E.value,W.value,ge.value,ie.value)),Ne=t.computed(()=>wm(g.value,fe.value,$e.value,ie.value)),ve=t.computed(()=>[...pe.value.lines,...Ne.value.lines]),Te=t.computed(()=>[...pe.value.circles,...Ne.value.circles]),re=t.computed(()=>[...pe.value.polygons,...Ne.value.polygons].map(me=>`M${me.points.map(ke=>`${ke.x},${ke.y}`).join(" L")} Z`)),_e=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":m.value,"is-selected":d.value}));return(me,ke)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:z.value,fill:"none",class:"em-edge__hit"},null,8,fv),t.createElementVNode("path",{d:z.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":m.value,"is-selected":d.value}])},null,10,pv),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(re.value,(ue,L)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${L}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",_e.value])},null,10,hv))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,(ue,L)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${L}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",_e.value])},null,10,yv))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Te.value,(ue,L)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${L}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",_e.value])},null,10,gv))),128)),oe.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(E).x+8,y:t.unref(E).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":m.value}])},t.toDisplayString(H.value),11,bv),t.createElementVNode("text",{x:t.unref(g).x-8,y:t.unref(g).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":m.value}])},t.toDisplayString(Q.value),11,_v)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,(ue,L)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${L}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":m.value}]),onDblclick:t.withModifiers(D=>S(ue.segIndex,D),["stop"])},null,42,kv))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,(ue,L)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${L}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":m.value}]),onPointerdown:D=>C(L,D),onPointermove:se,onPointerup:k,onDblclick:D=>G(L,D)},null,42,Ev))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var Wt=(e=>(e.Lines="lines",e.Dots="dots",e))(Wt||{});const Rm=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Am=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Wt.Lines+"",Wt.Dots+"";const Nv={[Wt.Dots]:"#81818a",[Wt.Lines]:"#eee"},wv=["id","x","y","width","height","patternTransform"],vv={key:2,height:"100",width:"100"},Iv=["fill"],xv=["x","y","fill"],Cv={name:"Background",compatConfig:{MODE:3}},Sv=t.defineComponent({...Cv,props:{id:{},variant:{default:()=>Wt.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:n,viewport:o}=Ge(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],m=e.size*l,[u,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],y=[u*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:y,size:m}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Nv[e.variant||Wt.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.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"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(Wt).Lines?(t.openBlock(),t.createBlock(t.unref(Rm),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Wt).Dots?(t.openBlock(),t.createBlock(t.unref(Am),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",vv,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Iv)])):t.createCommentVNode("",!0)])],8,wv)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,xv),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),$v={name:"ControlButton",compatConfig:{MODE:3}},Rv=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Av={type:"button",class:"vue-flow__controls-button"};function Tv(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",Av,[t.renderSlot(e.$slots,"default")])}const Dn=Rv($v,[["render",Tv]]),Vv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Mv=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Bv(e,n){return t.openBlock(),t.createElementBlock("svg",Vv,Mv)}const Dv={render:Bv},Ov={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Lv=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Pv(e,n){return t.openBlock(),t.createElementBlock("svg",Ov,Lv)}const zv={render:Pv},Uv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Fv=[t.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 Hv(e,n){return t.openBlock(),t.createElementBlock("svg",Uv,Fv)}const jv={render:Hv},Gv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Kv=[t.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 Yv(e,n){return t.openBlock(),t.createElementBlock("svg",Gv,Kv)}const qv={render:Yv},Wv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Xv=[t.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 Jv(e,n){return t.openBlock(),t.createElementBlock("svg",Wv,Xv)}const Zv={render:Jv},Qv={name:"Controls",compatConfig:{MODE:3}},eI=t.defineComponent({...Qv,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Zd.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:m,maxZoom:u}=Ge(),p=t.toRef(()=>o.value||i.value||a.value),y=t.toRef(()=>d.value.zoom<=m.value),f=t.toRef(()=>d.value.zoom>=u.value);function b(){l(),n("zoomIn")}function h(){s(),n("zoomOut")}function _(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(g,N)=>(t.openBlock(),t.createBlock(t.unref(Xu),{class:"vue-flow__controls",position:g.position},{default:t.withCtx(()=>[t.renderSlot(g.$slots,"top"),g.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(g.$slots,"control-zoom-in",{},()=>[t.createVNode(Dn,{class:"vue-flow__controls-zoomin",disabled:f.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Dv))))])]),_:3},8,["disabled"])]),t.renderSlot(g.$slots,"control-zoom-out",{},()=>[t.createVNode(Dn,{class:"vue-flow__controls-zoomout",disabled:y.value,onClick:h},{default:t.withCtx(()=>[t.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(zv))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),g.showFitView?t.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Dn,{class:"vue-flow__controls-fitview",onClick:_},{default:t.withCtx(()=>[t.renderSlot(g.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(jv))))])]),_:3})]):t.createCommentVNode("",!0),g.showInteractive?t.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(t.openBlock(),t.createBlock(Dn,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Zv))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(qv))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}});var tI={value:()=>{}};function El(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Ca(o)}function Ca(e){this._=e}function nI(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Ca.prototype=El.prototype={constructor:Ca,on:function(e,n){var o=this._,i=nI(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=oI(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=Tm(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Tm(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new Ca(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function oI(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Tm(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=tI,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Nl="http://www.w3.org/1999/xhtml";const Vm={svg:"http://www.w3.org/2000/svg",xhtml:Nl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Vm.hasOwnProperty(n)?{space:Vm[n],local:e}:e}function iI(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Nl&&n.documentElement.namespaceURI===Nl?n.createElement(e):n.createElementNS(o,e)}}function aI(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Mm(e){var n=Sa(e);return(n.local?aI:iI)(n)}function rI(){}function wl(e){return e==null?rI:function(){return this.querySelector(e)}}function lI(e){typeof e!="function"&&(e=wl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,m=0;m<l;++m)(c=r[m])&&(d=e.call(c,c.__data__,m,r))&&("__data__"in c&&(d.__data__=c.__data__),s[m]=d);return new Et(i,this._parents)}function sI(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function cI(){return[]}function Bm(e){return e==null?cI:function(){return this.querySelectorAll(e)}}function dI(e){return function(){return sI(e.apply(this,arguments))}}function uI(e){typeof e=="function"?e=dI(e):e=Bm(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Et(i,a)}function Dm(e){return function(){return this.matches(e)}}function Om(e){return function(n){return n.matches(e)}}var mI=Array.prototype.find;function fI(e){return function(){return mI.call(this.children,e)}}function pI(){return this.firstElementChild}function hI(e){return this.select(e==null?pI:fI(typeof e=="function"?e:Om(e)))}var yI=Array.prototype.filter;function gI(){return Array.from(this.children)}function bI(e){return function(){return yI.call(this.children,e)}}function _I(e){return this.selectAll(e==null?gI:bI(typeof e=="function"?e:Om(e)))}function kI(e){typeof e!="function"&&(e=Dm(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Et(i,this._parents)}function Lm(e){return new Array(e.length)}function EI(){return new Et(this._enter||this._groups.map(Lm),this._parents)}function $a(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}$a.prototype={constructor:$a,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function NI(e){return function(){return e}}function wI(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new $a(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function vI(e,n,o,i,a,r,l){var s,c,d=new Map,m=n.length,u=r.length,p=new Array(m),y;for(s=0;s<m;++s)(c=n[s])&&(p[s]=y=l.call(c,c.__data__,s,n)+"",d.has(y)?a[s]=c:d.set(y,c));for(s=0;s<u;++s)y=l.call(e,r[s],s,r)+"",(c=d.get(y))?(i[s]=c,c.__data__=r[s],d.delete(y)):o[s]=new $a(e,r[s]);for(s=0;s<m;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function II(e){return e.__data__}function xI(e,n){if(!arguments.length)return Array.from(this,II);var o=n?vI:wI,i=this._parents,a=this._groups;typeof e!="function"&&(e=NI(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var m=i[d],u=a[d],p=u.length,y=CI(e.call(m,m&&m.__data__,d,i)),f=y.length,b=s[d]=new Array(f),h=l[d]=new Array(f),_=c[d]=new Array(p);o(m,u,b,h,_,y,n);for(var E=0,g=0,N,V;E<f;++E)if(N=b[E]){for(E>=g&&(g=E+1);!(V=h[g])&&++g<f;);N._next=V||null}}return l=new Et(l,i),l._enter=s,l._exit=c,l}function CI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function SI(){return new Et(this._exit||this._groups.map(Lm),this._parents)}function $I(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function RI(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],m=i[c],u=d.length,p=s[c]=new Array(u),y,f=0;f<u;++f)(y=d[f]||m[f])&&(p[f]=y);for(;c<a;++c)s[c]=o[c];return new Et(s,this._parents)}function AI(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function TI(e){e||(e=VI);function n(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,m=0;m<s;++m)(d=l[m])&&(c[m]=d);c.sort(n)}return new Et(a,this._parents).order()}function VI(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function MI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BI(){return Array.from(this)}function DI(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function OI(){let e=0;for(const n of this)++e;return e}function LI(){return!this.node()}function PI(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function zI(e){return function(){this.removeAttribute(e)}}function UI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FI(e,n){return function(){this.setAttribute(e,n)}}function HI(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function jI(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function GI(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function KI(e,n){var o=Sa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?UI:zI:typeof n=="function"?o.local?GI:jI:o.local?HI:FI)(o,n))}function Pm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function YI(e){return function(){this.style.removeProperty(e)}}function qI(e,n,o){return function(){this.style.setProperty(e,n,o)}}function WI(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function XI(e,n,o){return arguments.length>1?this.each((n==null?YI:typeof n=="function"?WI:qI)(e,n,o??"")):fo(this.node(),e)}function fo(e,n){return e.style.getPropertyValue(n)||Pm(e).getComputedStyle(e,null).getPropertyValue(n)}function JI(e){return function(){delete this[e]}}function ZI(e,n){return function(){this[e]=n}}function QI(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ex(e,n){return arguments.length>1?this.each((n==null?JI:typeof n=="function"?QI:ZI)(e,n)):this.node()[e]}function zm(e){return e.trim().split(/^|\s+/)}function vl(e){return e.classList||new Um(e)}function Um(e){this._node=e,this._names=zm(e.getAttribute("class")||"")}Um.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Fm(e,n){for(var o=vl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Hm(e,n){for(var o=vl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function tx(e){return function(){Fm(this,e)}}function nx(e){return function(){Hm(this,e)}}function ox(e,n){return function(){(n.apply(this,arguments)?Fm:Hm)(this,e)}}function ix(e,n){var o=zm(e+"");if(arguments.length<2){for(var i=vl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?ox:n?tx:nx)(o,n))}function ax(){this.textContent=""}function rx(e){return function(){this.textContent=e}}function lx(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function sx(e){return arguments.length?this.each(e==null?ax:(typeof e=="function"?lx:rx)(e)):this.node().textContent}function cx(){this.innerHTML=""}function dx(e){return function(){this.innerHTML=e}}function ux(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function mx(e){return arguments.length?this.each(e==null?cx:(typeof e=="function"?ux:dx)(e)):this.node().innerHTML}function fx(){this.nextSibling&&this.parentNode.appendChild(this)}function px(){return this.each(fx)}function hx(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yx(){return this.each(hx)}function gx(e){var n=typeof e=="function"?e:Mm(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function bx(){return null}function _x(e,n){var o=typeof e=="function"?e:Mm(e),i=n==null?bx:typeof n=="function"?n:wl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function kx(){var e=this.parentNode;e&&e.removeChild(this)}function Ex(){return this.each(kx)}function Nx(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function wx(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function vx(e){return this.select(e?wx:Nx)}function Ix(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xx(e){return function(n){e.call(this,n,this.__data__)}}function Cx(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function Sx(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function $x(e,n,o){return function(){var i=this.__on,a,r=xx(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function Rx(e,n,o){var i=Cx(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,m;c<d;++c)for(a=0,m=s[c];a<r;++a)if((l=i[a]).type===m.type&&l.name===m.name)return m.value}return}for(s=n?$x:Sx,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function jm(e,n,o){var i=Pm(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function Ax(e,n){return function(){return jm(this,e,n)}}function Tx(e,n){return function(){return jm(this,e,n.apply(this,arguments))}}function Vx(e,n){return this.each((typeof n=="function"?Tx:Ax)(e,n))}function*Mx(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var Gm=[null];function Et(e,n){this._groups=e,this._parents=n}function Qo(){return new Et([[document.documentElement]],Gm)}function Bx(){return this}Et.prototype=Qo.prototype={constructor:Et,select:lI,selectAll:uI,selectChild:hI,selectChildren:_I,filter:kI,data:xI,enter:EI,exit:SI,join:$I,merge:RI,selection:Bx,order:AI,sort:TI,call:MI,nodes:BI,node:DI,size:OI,empty:LI,each:PI,attr:KI,style:XI,property:ex,classed:ix,text:sx,html:mx,raise:px,lower:yx,append:gx,insert:_x,remove:Ex,clone:vx,datum:Ix,on:Rx,dispatch:Vx,[Symbol.iterator]:Mx};function sn(e){return typeof e=="string"?new Et([[document.querySelector(e)]],[document.documentElement]):new Et([[e]],Gm)}function Dx(e){let n;for(;n=e.sourceEvent;)e=n;return e}function cn(e,n){if(e=Dx(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const Il={capture:!0,passive:!1};function xl(e){e.preventDefault(),e.stopImmediatePropagation()}function Ox(e){var n=e.document.documentElement,o=sn(e).on("dragstart.drag",xl,Il);"onselectstart"in n?o.on("selectstart.drag",xl,Il):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Lx(e,n){var o=e.document.documentElement,i=sn(e).on("dragstart.drag",null);n&&(i.on("click.drag",xl,Il),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 Cl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Km(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ei(){}var ti=.7,Ra=1/ti,po="\\s*([+-]?\\d+)\\s*",ni="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Px=/^#([0-9a-f]{3,8})$/,zx=new RegExp(`^rgb\\(${po},${po},${po}\\)$`),Ux=new RegExp(`^rgb\\(${Ut},${Ut},${Ut}\\)$`),Fx=new RegExp(`^rgba\\(${po},${po},${po},${ni}\\)$`),Hx=new RegExp(`^rgba\\(${Ut},${Ut},${Ut},${ni}\\)$`),jx=new RegExp(`^hsl\\(${ni},${Ut},${Ut}\\)$`),Gx=new RegExp(`^hsla\\(${ni},${Ut},${Ut},${ni}\\)$`),Ym={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Cl(ei,oi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qm,formatHex:qm,formatHex8:Kx,formatHsl:Yx,formatRgb:Wm,toString:Wm});function qm(){return this.rgb().formatHex()}function Kx(){return this.rgb().formatHex8()}function Yx(){return ef(this).formatHsl()}function Wm(){return this.rgb().formatRgb()}function oi(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Px.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Xm(n):o===3?new gt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Aa(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Aa(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=zx.exec(e))?new gt(n[1],n[2],n[3],1):(n=Ux.exec(e))?new gt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Fx.exec(e))?Aa(n[1],n[2],n[3],n[4]):(n=Hx.exec(e))?Aa(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=jx.exec(e))?Qm(n[1],n[2]/100,n[3]/100,1):(n=Gx.exec(e))?Qm(n[1],n[2]/100,n[3]/100,n[4]):Ym.hasOwnProperty(e)?Xm(Ym[e]):e==="transparent"?new gt(NaN,NaN,NaN,0):null}function Xm(e){return new gt(e>>16&255,e>>8&255,e&255,1)}function Aa(e,n,o,i){return i<=0&&(e=n=o=NaN),new gt(e,n,o,i)}function qx(e){return e instanceof ei||(e=oi(e)),e?(e=e.rgb(),new gt(e.r,e.g,e.b,e.opacity)):new gt}function Sl(e,n,o,i){return arguments.length===1?qx(e):new gt(e,n,o,i??1)}function gt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Cl(gt,Sl,Km(ei,{brighter(e){return e=e==null?Ra:Math.pow(Ra,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ti:Math.pow(ti,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gt(On(this.r),On(this.g),On(this.b),Ta(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:Jm,formatHex:Jm,formatHex8:Wx,formatRgb:Zm,toString:Zm}));function Jm(){return`#${Ln(this.r)}${Ln(this.g)}${Ln(this.b)}`}function Wx(){return`#${Ln(this.r)}${Ln(this.g)}${Ln(this.b)}${Ln((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zm(){const e=Ta(this.opacity);return`${e===1?"rgb(":"rgba("}${On(this.r)}, ${On(this.g)}, ${On(this.b)}${e===1?")":`, ${e})`}`}function Ta(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function On(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ln(e){return e=On(e),(e<16?"0":"")+e.toString(16)}function Qm(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new $t(e,n,o,i)}function ef(e){if(e instanceof $t)return new $t(e.h,e.s,e.l,e.opacity);if(e instanceof ei||(e=oi(e)),!e)return new $t;if(e instanceof $t)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new $t(l,s,c,e.opacity)}function Xx(e,n,o,i){return arguments.length===1?ef(e):new $t(e,n,o,i??1)}function $t(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Cl($t,Xx,Km(ei,{brighter(e){return e=e==null?Ra:Math.pow(Ra,e),new $t(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ti:Math.pow(ti,e),new $t(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new gt($l(e>=240?e-240:e+120,a,i),$l(e,a,i),$l(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new $t(tf(this.h),Va(this.s),Va(this.l),Ta(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=Ta(this.opacity);return`${e===1?"hsl(":"hsla("}${tf(this.h)}, ${Va(this.s)*100}%, ${Va(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tf(e){return e=(e||0)%360,e<0?e+360:e}function Va(e){return Math.max(0,Math.min(1,e||0))}function $l(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const nf=e=>()=>e;function Jx(e,n){return function(o){return e+o*n}}function Zx(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function Qx(e){return(e=+e)==1?of:function(n,o){return o-n?Zx(n,o,e):nf(isNaN(n)?o:n)}}function of(e,n){var o=n-e;return o?Jx(e,o):nf(isNaN(e)?n:e)}const af=(function e(n){var o=Qx(n);function i(a,r){var l=o((a=Sl(a)).r,(r=Sl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=of(a.opacity,r.opacity);return function(m){return a.r=l(m),a.g=s(m),a.b=c(m),a.opacity=d(m),a+""}}return i.gamma=e,i})(1);function dn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var Rl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Al=new RegExp(Rl.source,"g");function eC(e){return function(){return e}}function tC(e){return function(n){return e(n)+""}}function nC(e,n){var o=Rl.lastIndex=Al.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Rl.exec(e))&&(a=Al.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:dn(i,a)})),o=Al.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?tC(c[0].x):eC(n):(n=c.length,function(d){for(var m=0,u;m<n;++m)s[(u=c[m]).i]=u.x(d);return s.join("")})}var rf=180/Math.PI,Tl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lf(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*rf,skewX:Math.atan(c)*rf,scaleX:l,scaleY:s}}var Ma;function oC(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Tl:lf(n.a,n.b,n.c,n.d,n.e,n.f)}function iC(e){return e==null||(Ma||(Ma=document.createElementNS("http://www.w3.org/2000/svg","g")),Ma.setAttribute("transform",e),!(e=Ma.transform.baseVal.consolidate()))?Tl:(e=e.matrix,lf(e.a,e.b,e.c,e.d,e.e,e.f))}function sf(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,m,u,p,y,f){if(d!==u||m!==p){var b=y.push("translate(",null,n,null,o);f.push({i:b-4,x:dn(d,u)},{i:b-2,x:dn(m,p)})}else(u||p)&&y.push("translate("+u+n+p+o)}function l(d,m,u,p){d!==m?(d-m>180?m+=360:m-d>180&&(d+=360),p.push({i:u.push(a(u)+"rotate(",null,i)-2,x:dn(d,m)})):m&&u.push(a(u)+"rotate("+m+i)}function s(d,m,u,p){d!==m?p.push({i:u.push(a(u)+"skewX(",null,i)-2,x:dn(d,m)}):m&&u.push(a(u)+"skewX("+m+i)}function c(d,m,u,p,y,f){if(d!==u||m!==p){var b=y.push(a(y)+"scale(",null,",",null,")");f.push({i:b-4,x:dn(d,u)},{i:b-2,x:dn(m,p)})}else(u!==1||p!==1)&&y.push(a(y)+"scale("+u+","+p+")")}return function(d,m){var u=[],p=[];return d=e(d),m=e(m),r(d.translateX,d.translateY,m.translateX,m.translateY,u,p),l(d.rotate,m.rotate,u,p),s(d.skewX,m.skewX,u,p),c(d.scaleX,d.scaleY,m.scaleX,m.scaleY,u,p),d=m=null,function(y){for(var f=-1,b=p.length,h;++f<b;)u[(h=p[f]).i]=h.x(y);return u.join("")}}}var aC=sf(oC,"px, ","px)","deg)"),rC=sf(iC,", ",")",")"),lC=1e-12;function cf(e){return((e=Math.exp(e))+1/e)/2}function sC(e){return((e=Math.exp(e))-1/e)/2}function cC(e){return((e=Math.exp(2*e))-1)/(e+1)}const dC=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],m=l[0],u=l[1],p=l[2],y=m-s,f=u-c,b=y*y+f*f,h,_;if(b<lC)_=Math.log(p/d)/n,h=function(I){return[s+I*y,c+I*f,d*Math.exp(n*I*_)]};else{var E=Math.sqrt(b),g=(p*p-d*d+i*b)/(2*d*o*E),N=(p*p-d*d-i*b)/(2*p*o*E),V=Math.log(Math.sqrt(g*g+1)-g),T=Math.log(Math.sqrt(N*N+1)-N);_=(T-V)/n,h=function(I){var z=I*_,w=cf(V),x=d/(o*E)*(w*cC(n*z+V)-sC(V));return[s+x*y,c+x*f,d*w/cf(n*z+V)]}}return h.duration=_*1e3*n/Math.SQRT2,h}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var ho=0,ii=0,ai=0,df=1e3,Ba,ri,Da=0,Pn=0,Oa=0,li=typeof performance=="object"&&performance.now?performance:Date,uf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vl(){return Pn||(uf(uC),Pn=li.now()+Oa)}function uC(){Pn=0}function La(){this._call=this._time=this._next=null}La.prototype=mf.prototype={constructor:La,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vl():+o)+(n==null?0:+n),!this._next&&ri!==this&&(ri?ri._next=this:Ba=this,ri=this),this._call=e,this._time=o,Ml()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ml())}};function mf(e,n,o){var i=new La;return i.restart(e,n,o),i}function mC(){Vl(),++ho;for(var e=Ba,n;e;)(n=Pn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ho}function ff(){Pn=(Da=li.now())+Oa,ho=ii=0;try{mC()}finally{ho=0,pC(),Pn=0}}function fC(){var e=li.now(),n=e-Da;n>df&&(Oa-=n,Da=e)}function pC(){for(var e,n=Ba,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:Ba=o);ri=e,Ml(i)}function Ml(e){if(!ho){ii&&(ii=clearTimeout(ii));var n=e-Pn;n>24?(e<1/0&&(ii=setTimeout(ff,e-li.now()-Oa)),ai&&(ai=clearInterval(ai))):(ai||(Da=li.now(),ai=setInterval(fC,df)),ho=1,uf(ff))}}function pf(e,n,o){var i=new La;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var hC=El("start","end","cancel","interrupt"),yC=[],hf=0,yf=1,Bl=2,Pa=3,gf=4,Dl=5,za=6;function Ua(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;gC(e,o,{name:n,index:i,group:a,on:hC,tween:yC,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:hf})}function Ol(e,n){var o=Rt(e,n);if(o.state>hf)throw new Error("too late; already scheduled");return o}function Ft(e,n){var o=Rt(e,n);if(o.state>Pa)throw new Error("too late; already running");return o}function Rt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function gC(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=mf(r,0,o.time);function r(d){o.state=yf,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var m,u,p,y;if(o.state!==yf)return c();for(m in i)if(y=i[m],y.name===o.name){if(y.state===Pa)return pf(l);y.state===gf?(y.state=za,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete i[m]):+m<n&&(y.state=za,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete i[m])}if(pf(function(){o.state===Pa&&(o.state=gf,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Bl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Bl){for(o.state=Pa,a=new Array(p=o.tween.length),m=0,u=-1;m<p;++m)(y=o.tween[m].value.call(e,e.__data__,o.index,o.group))&&(a[++u]=y);a.length=u+1}}function s(d){for(var m=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Dl,1),u=-1,p=a.length;++u<p;)a[u].call(e,m);o.state===Dl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=za,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Fa(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>Bl&&i.state<Dl,i.state=za,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function bC(e){return this.each(function(){Fa(this,e)})}function _C(e,n){var o,i;return function(){var a=Ft(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function kC(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Ft(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function EC(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Rt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?_C:kC)(o,e,n))}function Ll(e,n,o){var i=e._id;return e.each(function(){var a=Ft(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Rt(a,i).value[n]}}function bf(e,n){var o;return(typeof n=="number"?dn:n instanceof oi?af:(o=oi(n))?(n=o,af):nC)(e,n)}function NC(e){return function(){this.removeAttribute(e)}}function wC(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vC(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function IC(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function xC(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function CC(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function SC(e,n){var o=Sa(e),i=o==="transform"?rC:bf;return this.attrTween(e,typeof n=="function"?(o.local?CC:xC)(o,i,Ll(this,"attr."+e,n)):n==null?(o.local?wC:NC)(o):(o.local?IC:vC)(o,i,n))}function $C(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function RC(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function AC(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&RC(e,r)),o}return a._value=n,a}function TC(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&$C(e,r)),o}return a._value=n,a}function VC(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=Sa(e);return this.tween(o,(i.local?AC:TC)(i,n))}function MC(e,n){return function(){Ol(this,e).delay=+n.apply(this,arguments)}}function BC(e,n){return n=+n,function(){Ol(this,e).delay=n}}function DC(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?MC:BC)(n,e)):Rt(this.node(),n).delay}function OC(e,n){return function(){Ft(this,e).duration=+n.apply(this,arguments)}}function LC(e,n){return n=+n,function(){Ft(this,e).duration=n}}function PC(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?OC:LC)(n,e)):Rt(this.node(),n).duration}function zC(e,n){if(typeof n!="function")throw new Error;return function(){Ft(this,e).ease=n}}function UC(e){var n=this._id;return arguments.length?this.each(zC(n,e)):Rt(this.node(),n).ease}function FC(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Ft(this,e).ease=o}}function HC(e){if(typeof e!="function")throw new Error;return this.each(FC(this._id,e))}function jC(e){typeof e!="function"&&(e=Dm(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Xt(i,this._parents,this._name,this._id)}function GC(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],m=c.length,u=l[s]=new Array(m),p,y=0;y<m;++y)(p=c[y]||d[y])&&(u[y]=p);for(;s<i;++s)l[s]=n[s];return new Xt(l,this._parents,this._name,this._id)}function KC(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function YC(e,n,o){var i,a,r=KC(n)?Ol:Ft;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function qC(e,n){var o=this._id;return arguments.length<2?Rt(this.node(),o).on.on(e):this.each(YC(o,e,n))}function WC(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function XC(){return this.on("end.remove",WC(this._id))}function JC(e){var n=this._name,o=this._id;typeof e!="function"&&(e=wl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),m,u,p=0;p<c;++p)(m=s[p])&&(u=e.call(m,m.__data__,p,s))&&("__data__"in m&&(u.__data__=m.__data__),d[p]=u,Ua(d[p],n,o,p,d,Rt(m,o)));return new Xt(r,this._parents,n,o)}function ZC(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Bm(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,m,u=0;u<d;++u)if(m=c[u]){for(var p=e.call(m,m.__data__,u,c),y,f=Rt(m,o),b=0,h=p.length;b<h;++b)(y=p[b])&&Ua(y,n,o,b,p,f);r.push(p),l.push(m)}return new Xt(r,l,n,o)}var QC=Qo.prototype.constructor;function eS(){return new QC(this._groups,this._parents)}function tS(e,n){var o,i,a;return function(){var r=fo(this,e),l=(this.style.removeProperty(e),fo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function _f(e){return function(){this.style.removeProperty(e)}}function nS(e,n,o){var i,a=o+"",r;return function(){var l=fo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function oS(e,n,o){var i,a,r;return function(){var l=fo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),fo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function iS(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Ft(this,e),d=c.on,m=c.value[r]==null?s||(s=_f(n)):void 0;(d!==o||a!==m)&&(i=(o=d).copy()).on(l,a=m),c.on=i}}function aS(e,n,o){var i=(e+="")=="transform"?aC:bf;return n==null?this.styleTween(e,tS(e,i)).on("end.style."+e,_f(e)):typeof n=="function"?this.styleTween(e,oS(e,i,Ll(this,"style."+e,n))).each(iS(this._id,e)):this.styleTween(e,nS(e,i,n),o).on("end.style."+e,null)}function rS(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function lS(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&rS(e,l,o)),i}return r._value=n,r}function sS(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,lS(e,n,o??""))}function cS(e){return function(){this.textContent=e}}function dS(e){return function(){var n=e(this);this.textContent=n??""}}function uS(e){return this.tween("text",typeof e=="function"?dS(Ll(this,"text",e)):cS(e==null?"":e+""))}function mS(e){return function(n){this.textContent=e.call(this,n)}}function fS(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&mS(a)),n}return i._value=e,i}function pS(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,fS(e))}function hS(){for(var e=this._name,n=this._id,o=kf(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var m=Rt(c,n);Ua(c,e,o,d,l,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Xt(i,this._parents,e,o)}function yS(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Ft(this,i),m=d.on;m!==e&&(n=(e=m).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var gS=0;function Xt(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function kf(){return++gS}var Jt=Qo.prototype;Xt.prototype={constructor:Xt,select:JC,selectAll:ZC,selectChild:Jt.selectChild,selectChildren:Jt.selectChildren,filter:jC,merge:GC,selection:eS,transition:hS,call:Jt.call,nodes:Jt.nodes,node:Jt.node,size:Jt.size,empty:Jt.empty,each:Jt.each,on:qC,attr:SC,attrTween:VC,style:aS,styleTween:sS,text:uS,textTween:pS,remove:XC,tween:EC,delay:DC,duration:PC,ease:UC,easeVarying:HC,end:yS,[Symbol.iterator]:Jt[Symbol.iterator]};function bS(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _S={time:null,delay:0,duration:250,ease:bS};function kS(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function ES(e){var n,o;e instanceof Xt?(n=e._id,e=e._name):(n=kf(),(o=_S).time=Vl(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ua(c,e,n,d,l,o||kS(c,n));return new Xt(i,this._parents,e,n)}Qo.prototype.interrupt=bC,Qo.prototype.transition=ES;const Ha=e=>()=>e;function NS(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Zt(e,n,o){this.k=e,this.x=n,this.y=o}Zt.prototype={constructor:Zt,scale:function(e){return e===1?this:new Zt(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Zt(this.k,this.x+this.k*e,this.y+this.k*n)},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 Pl=new Zt(1,0,0);Zt.prototype;function zl(e){e.stopImmediatePropagation()}function si(e){e.preventDefault(),e.stopImmediatePropagation()}function wS(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vS(){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 Ef(){return this.__zoom||Pl}function IS(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xS(){return navigator.maxTouchPoints||"ontouchstart"in this}function CS(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function SS(){var e=wS,n=vS,o=CS,i=IS,a=xS,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=dC,d=El("start","zoom","end"),m,u,p,y=500,f=150,b=0,h=10;function _(k){k.property("__zoom",Ef).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",w).on("dblclick.zoom",x).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",se).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(k,G,S,H){var Q=k.selection?k.selection():k;Q.property("__zoom",Ef),k!==Q?V(k,G,S,H):Q.interrupt().each(function(){T(this,arguments).event(H).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},_.scaleBy=function(k,G,S,H){_.scaleTo(k,function(){var Q=this.__zoom.k,ie=typeof G=="function"?G.apply(this,arguments):G;return Q*ie},S,H)},_.scaleTo=function(k,G,S,H){_.transform(k,function(){var Q=n.apply(this,arguments),ie=this.__zoom,oe=S==null?N(Q):typeof S=="function"?S.apply(this,arguments):S,W=ie.invert(oe),fe=typeof G=="function"?G.apply(this,arguments):G;return o(g(E(ie,fe),oe,W),Q,l)},S,H)},_.translateBy=function(k,G,S,H){_.transform(k,function(){return o(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,H)},_.translateTo=function(k,G,S,H,Q){_.transform(k,function(){var ie=n.apply(this,arguments),oe=this.__zoom,W=H==null?N(ie):typeof H=="function"?H.apply(this,arguments):H;return o(Pl.translate(W[0],W[1]).scale(oe.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof S=="function"?-S.apply(this,arguments):-S),ie,l)},H,Q)};function E(k,G){return G=Math.max(r[0],Math.min(r[1],G)),G===k.k?k:new Zt(G,k.x,k.y)}function g(k,G,S){var H=G[0]-S[0]*k.k,Q=G[1]-S[1]*k.k;return H===k.x&&Q===k.y?k:new Zt(k.k,H,Q)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function V(k,G,S,H){k.on("start.zoom",function(){T(this,arguments).event(H).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(H).end()}).tween("zoom",function(){var Q=this,ie=arguments,oe=T(Q,ie).event(H),W=n.apply(Q,ie),fe=S==null?N(W):typeof S=="function"?S.apply(Q,ie):S,ge=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),$e=Q.__zoom,pe=typeof G=="function"?G.apply(Q,ie):G,Ne=c($e.invert(fe).concat(ge/$e.k),pe.invert(fe).concat(ge/pe.k));return function(ve){if(ve===1)ve=pe;else{var Te=Ne(ve),re=ge/Te[2];ve=new Zt(re,fe[0]-Te[0]*re,fe[1]-Te[1]*re)}oe.zoom(null,ve)}})}function T(k,G,S){return!S&&k.__zooming||new I(k,G)}function I(k,G){this.that=k,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,G),this.taps=0}I.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,G){return this.mouse&&k!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var G=sn(this.that).datum();d.call(k,this.that,new NS(k,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),G)}};function z(k,...G){if(!e.apply(this,arguments))return;var S=T(this,G).event(k),H=this.__zoom,Q=Math.max(r[0],Math.min(r[1],H.k*Math.pow(2,i.apply(this,arguments)))),ie=cn(k);if(S.wheel)(S.mouse[0][0]!==ie[0]||S.mouse[0][1]!==ie[1])&&(S.mouse[1]=H.invert(S.mouse[0]=ie)),clearTimeout(S.wheel);else{if(H.k===Q)return;S.mouse=[ie,H.invert(ie)],Fa(this),S.start()}si(k),S.wheel=setTimeout(oe,f),S.zoom("mouse",o(g(E(H,Q),S.mouse[0],S.mouse[1]),S.extent,l));function oe(){S.wheel=null,S.end()}}function w(k,...G){if(p||!e.apply(this,arguments))return;var S=k.currentTarget,H=T(this,G,!0).event(k),Q=sn(k.view).on("mousemove.zoom",fe,!0).on("mouseup.zoom",ge,!0),ie=cn(k,S),oe=k.clientX,W=k.clientY;Ox(k.view),zl(k),H.mouse=[ie,this.__zoom.invert(ie)],Fa(this),H.start();function fe($e){if(si($e),!H.moved){var pe=$e.clientX-oe,Ne=$e.clientY-W;H.moved=pe*pe+Ne*Ne>b}H.event($e).zoom("mouse",o(g(H.that.__zoom,H.mouse[0]=cn($e,S),H.mouse[1]),H.extent,l))}function ge($e){Q.on("mousemove.zoom mouseup.zoom",null),Lx($e.view,H.moved),si($e),H.event($e).end()}}function x(k,...G){if(e.apply(this,arguments)){var S=this.__zoom,H=cn(k.changedTouches?k.changedTouches[0]:k,this),Q=S.invert(H),ie=S.k*(k.shiftKey?.5:2),oe=o(g(E(S,ie),H,Q),n.apply(this,G),l);si(k),s>0?sn(this).transition().duration(s).call(V,oe,H,k):sn(this).call(_.transform,oe,H,k)}}function F(k,...G){if(e.apply(this,arguments)){var S=k.touches,H=S.length,Q=T(this,G,k.changedTouches.length===H).event(k),ie,oe,W,fe;for(zl(k),oe=0;oe<H;++oe)W=S[oe],fe=cn(W,this),fe=[fe,this.__zoom.invert(fe),W.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==fe[2]&&(Q.touch1=fe,Q.taps=0):(Q.touch0=fe,ie=!0,Q.taps=1+!!m);m&&(m=clearTimeout(m)),ie&&(Q.taps<2&&(u=fe[0],m=setTimeout(function(){m=null},y)),Fa(this),Q.start())}}function C(k,...G){if(this.__zooming){var S=T(this,G).event(k),H=k.changedTouches,Q=H.length,ie,oe,W,fe;for(si(k),ie=0;ie<Q;++ie)oe=H[ie],W=cn(oe,this),S.touch0&&S.touch0[2]===oe.identifier?S.touch0[0]=W:S.touch1&&S.touch1[2]===oe.identifier&&(S.touch1[0]=W);if(oe=S.that.__zoom,S.touch1){var ge=S.touch0[0],$e=S.touch0[1],pe=S.touch1[0],Ne=S.touch1[1],ve=(ve=pe[0]-ge[0])*ve+(ve=pe[1]-ge[1])*ve,Te=(Te=Ne[0]-$e[0])*Te+(Te=Ne[1]-$e[1])*Te;oe=E(oe,Math.sqrt(ve/Te)),W=[(ge[0]+pe[0])/2,(ge[1]+pe[1])/2],fe=[($e[0]+Ne[0])/2,($e[1]+Ne[1])/2]}else if(S.touch0)W=S.touch0[0],fe=S.touch0[1];else return;S.zoom("touch",o(g(oe,W,fe),S.extent,l))}}function se(k,...G){if(this.__zooming){var S=T(this,G).event(k),H=k.changedTouches,Q=H.length,ie,oe;for(zl(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},y),ie=0;ie<Q;++ie)oe=H[ie],S.touch0&&S.touch0[2]===oe.identifier?delete S.touch0:S.touch1&&S.touch1[2]===oe.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(oe=cn(oe,this),Math.hypot(u[0]-oe[0],u[1]-oe[1])<h)){var W=sn(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return _.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ha(+k),_):i},_.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ha(!!k),_):e},_.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ha(!!k),_):a},_.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ha([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),_):n},_.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],_):[r[0],r[1]]},_.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(k){return arguments.length?(o=k,_):o},_.duration=function(k){return arguments.length?(s=+k,_):s},_.interpolate=function(k){return arguments.length?(c=k,_):c},_.on=function(){var k=d.on.apply(d,arguments);return k===d?_:k},_.clickDistance=function(k){return arguments.length?(b=(k=+k)*k,_):Math.sqrt(b)},_.tapDistance=function(k){return arguments.length?(h=+k,_):h},_}const Nf=Symbol("MiniMapSlots"),$S=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],RS={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},AS=t.defineComponent({...RS,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:n}){const o=e,i=t.inject(Nf),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(u){n("click",u)}function s(u){n("dblclick",u)}function c(u){n("mouseenter",u)}function d(u){n("mousemove",u)}function m(u){n("mouseleave",u)}return(u,p)=>!u.hidden&&u.dimensions.width!==0&&u.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...u.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:u.id},u.$attrs,{class:["vue-flow__minimap-node",{selected:u.selected,dragging:u.dragging}],x:u.position.x,y:u.position.y,rx:u.borderRadius,ry:u.borderRadius,width:u.dimensions.width,height:u.dimensions.height,fill:u.color||r.value.background||r.value.backgroundColor,stroke:u.strokeColor,"stroke-width":u.strokeWidth,"shape-rendering":u.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:m}),null,16,$S))],64)):t.createCommentVNode("",!0)}}),TS=["width","height","viewBox","aria-labelledby"],VS=["id"],MS=["d","fill","stroke","stroke-width"],BS={name:"MiniMap",compatConfig:{MODE:3}},DS=t.defineComponent({...BS,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:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:m,emits:u,d3Selection:p,d3Zoom:y,getNodesInitialized:f}=Ge(),b=t.ref();t.provide(Nf,o);const h=t.toRef(()=>{var Q;return e.width??((Q=i.style)==null?void 0:Q.width)??a}),_=t.toRef(()=>{var Q;return e.height??((Q=i.style)==null?void 0:Q.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",g=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),V=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),T=t.computed(()=>Qr(f.value.filter(Q=>!Q.hidden))),I=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:m.value.width/c.value.zoom,height:m.value.height/c.value.zoom})),z=t.computed(()=>f.value&&f.value.length?Y1(T.value,I.value):I.value),w=t.computed(()=>{const Q=z.value.width/h.value,ie=z.value.height/_.value;return Math.max(Q,ie)}),x=t.computed(()=>{const Q=w.value*h.value,ie=w.value*_.value,oe=e.offsetScale*w.value;return{offset:oe,x:z.value.x-(Q-z.value.width)/2-oe,y:z.value.y-(ie-z.value.height)/2-oe,width:Q+oe*2,height:ie+oe*2}}),F=t.computed(()=>!x.value.x||!x.value.y?"":`
49
+ M${x.value.x-x.value.offset},${x.value.y-x.value.offset}
50
+ h${x.value.width+x.value.offset*2}
51
+ v${x.value.height+x.value.offset*2}
52
+ h${-x.value.width-x.value.offset*2}z
53
+ M${I.value.x+e.maskBorderRadius},${I.value.y}
54
+ h${I.value.width-2*e.maskBorderRadius}
55
55
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
56
- v${G.value.height-2*e.maskBorderRadius}
56
+ v${I.value.height-2*e.maskBorderRadius}
57
57
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
58
- h${-(G.value.width-2*e.maskBorderRadius)}
58
+ h${-(I.value.width-2*e.maskBorderRadius)}
59
59
  a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
60
- v${-(G.value.height-2*e.maskBorderRadius)}
61
- a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);n.watchEffect(ee=>{if(g.value){const ie=ln(g.value),O=ce=>{if(ce.sourceEvent.type!=="wheel"||!f.value||!p.value)return;const ge=ce.sourceEvent.ctrlKey&&Yo()?10:1,se=-ce.sourceEvent.deltaY*(ce.sourceEvent.deltaMode===1?.05:ce.sourceEvent.deltaMode?1:.002)*e.zoomStep,pe=c.value.zoom*2**(se*ge);p.value.scaleTo(f.value,pe)},U=ce=>{if(ce.sourceEvent.type!=="mousemove"||!f.value||!p.value)return;const ge=v.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),se={x:c.value.x-ce.sourceEvent.movementX*ge,y:c.value.y-ce.sourceEvent.movementY*ge},pe=[[0,0],[u.value.width,u.value.height]],be=Il.translate(se.x,se.y).scale(c.value.zoom),xe=p.value.constrain()(be,pe,d.value);p.value.transform(f.value,xe)},ne=XC().wheelDelta(ce=>Fr(ce)*(e.zoomStep/10)).on("zoom",e.pannable?U:()=>{}).on("zoom.wheel",e.zoomable?O:()=>{});ie.call(ne),ee(()=>{ie.on("zoom",null)})}},{flush:"post"});function C(ee){const[ie,O]=sn(ee);t("click",{event:ee,position:{x:ie,y:O}})}function ae(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeClick(O),t("nodeClick",O)}function E(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeDoubleClick(O),t("nodeDblclick",O)}function Y(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseEnter(O),t("nodeMouseenter",O)}function S(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseMove(O),t("nodeMousemove",O)}function W(ee,ie){const O={event:ee,node:ie,connectedEdges:xn([ie],s.value)};m.miniMapNodeMouseLeave(O),t("nodeMouseleave",O)}return(ee,ie)=>(n.openBlock(),n.createBlock(n.unref(Tu),{position:ee.position,class:n.normalizeClass(["vue-flow__minimap",{pannable:ee.pannable,zoomable:ee.zoomable}])},{default:n.withCtx(()=>[(n.openBlock(),n.createElementBlock("svg",{ref_key:"el",ref:g,width:_.value,height:b.value,viewBox:[T.value.x,T.value.y,T.value.width,T.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${n.unref(l)}`,onClick:C},[ee.ariaLabel?(n.openBlock(),n.createElementBlock("title",{key:0,id:`vue-flow__minimap-${n.unref(l)}`},n.toDisplayString(ee.ariaLabel),9,tS)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(y),O=>(n.openBlock(),n.createBlock(QC,{id:O.id,key:O.id,f:"",position:O.computedPosition,dimensions:O.dimensions,selected:O.selected,dragging:O.dragging,style:n.normalizeStyle(O.style),class:n.normalizeClass(P.value(O)),color:h.value(O),"border-radius":ee.nodeBorderRadius,"stroke-color":k.value(O),"stroke-width":ee.nodeStrokeWidth,"shape-rendering":n.unref(N),type:O.type,hidden:O.hidden,onClick:U=>ae(U,O),onDblclick:U=>E(U,O),onMouseenter:U=>Y(U,O),onMousemove:U=>S(U,O),onMouseleave:U=>W(U,O)},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:H.value,fill:ee.maskColor,stroke:ee.maskStrokeColor,"stroke-width":ee.maskStrokeWidth,"fill-rule":"evenodd"},null,8,nS)],8,eS))]),_:1},8,["position","class"]))}}),aS=["d"],rS=["cx","cy","onDblclick"],lS=["x","y","onPointerdown","onDblclick"],sS=Ge(n.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const t=e,{screenToFlowCoordinate:o}=He(),i=n.inject(ll),a=n.inject(An,null),r=n.computed(()=>!!a&&a.editable.value),l=n.inject(so,null),s=n.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(t.data.targetRef)||!l.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}),m=n.computed(()=>c.value.map((K,v)=>v===d.value?u.value:K)),{source:f,target:p,sourceSide:y,targetSide:g}=cm({sourceNode:()=>t.sourceNode,targetNode:()=>t.targetNode,waypoints:()=>m.value}),_=n.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?La(f.value,y.value,m.value,p.value,g.value):za(f.value,m.value,p.value)),b=n.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Pa(f.value,y.value,m.value,p.value,g.value):Ha(f.value,m.value,p.value).map((K,v)=>({point:K,segIndex:v})):[]),N=n.computed(()=>r.value?m.value:[]);function h(K,v){d.value=K,u.value={...c.value[K]},v.target.setPointerCapture(v.pointerId),v.stopPropagation()}function k(K){if(d.value<0)return;const v=o({x:K.clientX,y:K.clientY});u.value={x:v.x,y:v.y}}function P(K){var v,T;d.value>=0&&i&&i.movePoint(t.id,d.value,{...u.value}),d.value=-1,(T=(v=K.target).releasePointerCapture)==null||T.call(v,K.pointerId)}function A(K,v){v.stopPropagation(),i==null||i.removePoint(t.id,K)}function G(K,v){if(!i)return;const T=o({x:v.clientX,y:v.clientY});i.insertPoint(t.id,K,{x:T.x,y:T.y})}return(K,v)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:n.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,aS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(b.value,(T,H)=>(n.openBlock(),n.createElementBlock("circle",{key:`mid-${H}`,cx:T.point.x,cy:T.point.y,r:"4",class:n.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:n.withModifiers(C=>G(T.segIndex,C),["stop"])},null,42,rS))),128)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.value,(T,H)=>(n.openBlock(),n.createElementBlock("rect",{key:`wp-${H}`,x:T.x-5,y:T.y-5,width:"10",height:"10",rx:"2",class:n.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:C=>h(H,C),onPointermove:k,onPointerup:P,onDblclick:C=>A(H,C)},null,42,lS))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),cS=["data-theme"],dS={key:0,class:"em-ctx__sep",role:"separator"},uS={key:1,class:"em-ctx__swatches"},mS={class:"em-ctx__swatches-label"},fS={class:"em-ctx__chips"},pS=["title","onClick"],hS=["title","onClick"],yS=["disabled","onClick"],gS={class:"em-ctx__icon"},bS={class:"em-ctx__caption"},_S=Ge(n.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:t}){const o=e,i=(g,_)=>Ct(o.locale??"ko",g,_),a=n.ref(!1),r=n.ref([]),l=n.ref(void 0),s=n.ref(null),c=n.reactive({x:0,y:0}),d=8;async function u(g,_){var h;r.value=_,l.value=(h=g.target)!=null&&h.closest('[data-theme="dark"]')?"dark":void 0,c.x=g.clientX,c.y=g.clientY,a.value=!0,window.addEventListener("keydown",f),window.addEventListener("resize",m),await n.nextTick();const b=s.value;if(!b)return;const N=b.getBoundingClientRect();c.x+N.width>window.innerWidth-d&&(c.x=Math.max(d,window.innerWidth-d-N.width)),c.y+N.height>window.innerHeight-d&&(c.y=Math.max(d,window.innerHeight-d-N.height))}function m(){a.value&&(a.value=!1,r.value=[],window.removeEventListener("keydown",f),window.removeEventListener("resize",m))}function f(g){g.key==="Escape"&&(g.stopPropagation(),m())}function p(g){g.disabled||(g.handler(),m())}function y(g,_){g.onPick(_),m()}return n.onBeforeUnmount(m),t({open:u,close:m}),(g,_)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[a.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[n.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:m,onContextmenu:n.withModifiers(m,["prevent"])},null,32),n.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:n.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:_[0]||(_[0]=n.withModifiers(()=>{},["prevent"]))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.value,(b,N)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N},[b.type==="separator"?(n.openBlock(),n.createElementBlock("div",dS)):b.type==="swatches"?(n.openBlock(),n.createElementBlock("div",uS,[n.createElementVNode("span",mS,n.toDisplayString(b.caption),1),n.createElementVNode("div",fS,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":b.current===null}]),title:i("em.swatch.none"),onClick:h=>y(b,null)},null,10,pS),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),h=>(n.openBlock(),n.createElementBlock("button",{key:h,type:"button",class:n.normalizeClass(["em-ctx__chip",{"is-on":b.current===h}]),style:n.normalizeStyle({background:n.unref(ao)(h)}),title:n.unref(io)(h),onClick:k=>y(b,h)},null,14,hS))),128))])])):(n.openBlock(),n.createElementBlock("button",{key:2,type:"button",class:n.normalizeClass(["em-ctx__item",{"is-danger":b.danger,"is-disabled":b.disabled}]),disabled:b.disabled,role:"menuitem",onClick:h=>p(b)},[n.createElementVNode("span",gS,[b.icon?(n.openBlock(),n.createBlock(Ve,{key:0,name:b.icon,size:15},null,8,["name"])):n.createCommentVNode("",!0)]),n.createElementVNode("span",bS,n.toDisplayString(b.caption),1)],10,yS))],64))),128))],36)],8,cS)):n.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b8cdb1f"]]),Sl=[".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 fo(e){const t=getComputedStyle(e);return!(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)===0)}function kS(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function ES(e,t){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const g=t(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,f=0;const p=()=>{const y=d.trim();if(y){const g=t(m,(u+f)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(p(),u=g.top,m=g.left,f=g.bottom,d=s[y]):(d+=s[y],f=Math.max(f,g.bottom))}return p(),c}function Da(e,t){const o=[];for(const i of e.querySelectorAll("*"))kS(i)&&(i.closest(Sl)||fo(i)&&o.push(...ES(i,t)));return o}function ai(e){return Math.round(e*100)/100}function NS(e,t){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Sl)||!fo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=t(a.left,a.top),l=t(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ai(r.x)}" y="${ai(r.y)}" width="${ai(l.x-r.x)}" height="${ai(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function wS(e){const t=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!fo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>ai(parseFloat(o.getAttribute(d)??"0"));s==="line"?t.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?t.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&t.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return t}function of(e,t,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===t||a.closest(Sl)||!fo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function ri(e,t){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=t(o.left,o.top),r=t(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function $l(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 vS(e){const t=e.vueFlowRef.value;if(!t)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(p,y)=>e.screenToFlowCoordinate({x:p,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const p of e.nodes.value){const y=t.querySelector(`.vue-flow__node[data-id="${CSS.escape(p.id)}"]`);if(!y||!fo(y))continue;const g=y.firstElementChild;if(g)if(p.type==="group"){const _=ri(g,o);$l(s,_),i.push({..._,texts:[]});const b=g.querySelector(".em-group__label");b&&i.push({...ri(b,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o)})}else if(p.type==="note"){const _={...ri(g,o),texts:Da(g,o),lines:of(g,g,o)};$l(s,_),r.push(_)}else{const _=ri(g,o);$l(s,_);const b=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const h=ri(N,o);a.push({x:_.x,y:_.y,w:_.w,h:h.y+h.h-_.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Da(g,o),lines:of(g,g,o),icons:NS(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const p of t.querySelectorAll(".vue-flow__edge")){const y=p.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!fo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),b=_.strokeDasharray,N=wS(p);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:Da(p,o),markers:N.length?N:void 0})}const c=t.closest(".em-canvas")??t,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Rl(e){return ls(vS(e))}function af(e,t){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function rf(e,t="diagram.svg"){const o=Rl(e);af(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),t)}function xS(e){var i,a;const t=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:t>0?t:1,h:o>0?o:1}}async function lf(e,t="diagram.png",o=2){const i=Rl(e),{w:a,h:r}=xS(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,f)=>{s.onload=()=>m(),s.onerror=()=>f(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");af(u,t)}finally{URL.revokeObjectURL(l)}}const IS={class:"em-shortcuts"},CS={class:"em-shortcuts__title"},SS={class:"em-shortcuts__keys"},$S={class:"em-shortcuts__kbd"},RS={key:0,class:"em-shortcuts__plus"},AS={class:"em-shortcuts__desc"},TS={class:"em-shortcuts__actions"},sf=Ge(n.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(s,c)=>Ct(t.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=n.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.shortcuts.title")},{default:n.withCtx(()=>[n.createElementVNode("div",IS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[n.createElementVNode("h4",CS,n.toDisplayString(d.title),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.items,u=>(n.openBlock(),n.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[n.createElementVNode("span",SS,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.keys,(m,f)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:m+f},[n.createElementVNode("kbd",$S,n.toDisplayString(m),1),f<u.keys.length-1?(n.openBlock(),n.createElementBlock("span",RS,"+")):n.createCommentVNode("",!0)],64))),128))]),n.createElementVNode("span",AS,n.toDisplayString(u.desc),1)]))),128))]))),128)),n.createElementVNode("div",TS,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-af88f86f"]]);function po(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function VS(e,t){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(t);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const MS={class:"em-cmdk",role:"dialog","aria-modal":"true"},BS=["placeholder"],DS={class:"em-cmdk__results"},OS={class:"em-cmdk__section"},LS=["onMouseenter","onClick"],PS={class:"em-cmdk__label"},zS={key:0,class:"em-cmdk__tag"},US={key:1,class:"em-cmdk__sub"},FS={class:"em-cmdk__section"},HS=["onMouseenter","onClick"],GS={class:"em-cmdk__label"},jS={key:1,class:"em-cmdk__empty"},KS=Ge(n.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref(""),l=n.ref(0),s=n.ref(null),c=n.computed(()=>a.userLanguage.value),d=n.computed(()=>{const h=c.value,k=a.state.logical.entities.map(A=>{var G,K,v,T,H,C;return{type:"goto",kind:"entity",id:A.modelId,label:((K=(G=A.table)==null?void 0:G.logicalName)==null?void 0:K[h])||A.name,sub:(v=A.table)==null?void 0:v.physicalName,match:po(A.name,(H=(T=A.table)==null?void 0:T.logicalName)==null?void 0:H[h],(C=A.table)==null?void 0:C.physicalName)??""}}),P=a.state.logical.groups.map(A=>{var G,K,v,T;return{type:"goto",kind:"group",id:A.modelId,label:((G=A.name)==null?void 0:G[h])||((K=A.name)==null?void 0:K.ko)||A.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:po((v=A.name)==null?void 0:v[h],(T=A.name)==null?void 0:T.ko,A.packageName)??""}});return[...k,...P]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=n.computed(()=>{const h=[];a.editable.value&&(h.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),h.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),h.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),h.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),h.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),h.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),h.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),h.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const k of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])h.push({type:"action",id:`dm-${k}`,label:a.t(u[k]),run:()=>a.displayMode.value=k});return h});function f(h,k){return h.label.toLowerCase().includes(k)}const p=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?d.value.filter(k=>k.match.includes(h)):d.value}),y=n.computed(()=>{const h=r.value.trim().toLowerCase();return h?m.value.filter(k=>f(k,h)):m.value}),g=n.computed(()=>[...p.value,...y.value]);n.watch([p,y],()=>{l.value=0});function _(h){return g.value.indexOf(h)}function b(h){if(h.type==="goto")a.selection.value={kind:h.kind,id:h.id},a.requestFocus(h.id);else{if(h.disabled)return;h.run()}i("close")}function N(h){if(h.key==="Escape"){i("close"),h.preventDefault();return}if(h.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),h.preventDefault();return}if(h.key==="ArrowUp"){l.value=Math.max(l.value-1,0),h.preventDefault();return}if(h.key==="Enter"){const k=g.value[l.value];k&&b(k),h.preventDefault()}}return n.nextTick(()=>{var h;return(h=s.value)==null?void 0:h.focus()}),(h,k)=>(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:k[1]||(k[1]=n.withModifiers(P=>i("close"),["self"]))},[n.createElementVNode("div",MS,[n.withDirectives(n.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":k[0]||(k[0]=P=>r.value=P),class:"em-cmdk__input",type:"text",placeholder:n.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,BS),[[n.vModelText,r.value]]),n.createElementVNode("div",DS,[g.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[p.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("div",OS,n.toDisplayString(n.unref(a).t("em.cmd.sectionGoto")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",PS,n.toDisplayString(P.label),1),P.tag?(n.openBlock(),n.createElementBlock("span",zS,n.toDisplayString(P.tag),1)):P.sub?(n.openBlock(),n.createElementBlock("span",US,n.toDisplayString(P.sub),1)):n.createCommentVNode("",!0)],42,LS))),128))],64)):n.createCommentVNode("",!0),y.value.length?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",FS,n.toDisplayString(n.unref(a).t("em.cmd.sectionActions")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,P=>(n.openBlock(),n.createElementBlock("button",{key:P.id,type:"button",class:n.normalizeClass(["em-cmdk__item",{"is-active":_(P)===l.value,"is-disabled":P.disabled}]),onMouseenter:A=>l.value=_(P),onClick:A=>b(P)},[n.createElementVNode("span",GS,n.toDisplayString(P.label),1)],42,HS))),128))],64)):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock("div",jS,n.toDisplayString(n.unref(a).t("em.cmd.empty")),1))])])],32)]))}}),[["__scopeId","data-v-a5a7d1c2"]]);function YS(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const WS={key:0,class:"em-canvas__empty","aria-hidden":"true"},qS={class:"em-canvas__empty-title"},XS=["innerHTML"],JS=["innerHTML"],ZS={key:1,class:"em-canvas__empty-title"},QS={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},e$={class:"em-conflict-banner__body"},t$={class:"em-conflict-banner__title"},n$={class:"em-conflict-banner__detail"},o$={key:0,class:"em-toast",role:"status","aria-live":"polite"},Al="nc:",cf=Ge(n.defineComponent({__name:"DiagramCanvas",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.ref(!1),l=n.ref(null);let s;n.watch(()=>i.notice.value,z=>{z&&(l.value=z.text,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200))}),n.onBeforeUnmount(()=>s&&clearTimeout(s));const c=n.computed(()=>YS(i.opConflict.value)),d=n.ref(!1),u=n.ref(!1),m={x:0,y:0};function f(z){m.x=z.clientX,m.y=z.clientY}const p=n.ref(null);n.provide(ya,p);const y=n.ref(null);n.provide(Yu,y);const g=n.ref(null),_=n.computed(()=>{const z=g.value,q=new Set;if(!z)return q;if(z.kind==="entity")q.add(z.id);else if(z.kind==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===z.id);for(const Ce of(ue==null?void 0:ue.group.memberEntityRefs)??[])q.add(Ce)}return q}),b=n.computed(()=>{const z=g.value,q=new Set(_.value),ue=new Set,Ce=new Set;if(!z)return{related:q,edges:ue,notes:Ce};if(z.kind==="note"){Ce.add(z.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===z.id&&q.add(Oe.targetRef);return{related:q,edges:ue,notes:Ce}}const Be=_.value;if(!Be.size)return{related:q,edges:ue,notes:Ce};for(const Oe of i.resolved.value.associations){const{end1:he,end2:le}=Oe.association;(Be.has(he.entityRef)||Be.has(le.entityRef))&&(ue.add(Oe.association.modelId),q.add(he.entityRef),q.add(le.entityRef))}for(const Oe of i.resolved.value.noteConnections)q.has(Oe.targetRef)&&Ce.add(Oe.noteRef);return{related:q,edges:ue,notes:Ce}});n.provide(so,{source:g,active:n.computed(()=>g.value!==null),primaryEntityIds:_,relatedEntityIds:n.computed(()=>b.value.related),relatedEdgeIds:n.computed(()=>b.value.edges),relatedNoteIds:n.computed(()=>b.value.notes),hoverGroupId:n.computed(()=>{var z;return((z=g.value)==null?void 0:z.kind)==="group"?g.value.id:null}),setEntityHover:z=>{y.value||u.value||(g.value=z?{kind:"entity",id:z}:null)},setGroupHover:z=>{y.value||u.value||(g.value=z?{kind:"group",id:z}:null)},setNoteHover:z=>{y.value||u.value||(g.value=z?{kind:"note",id:z}:null)}}),n.provide(An,i);function N(z,q){return`${Al}${z}:${q}`}function h(z){if(!z.startsWith(Al))return null;const[q,ue]=z.slice(Al.length).split(":");return q&&ue?{noteRef:q,targetRef:ue}:null}n.provide(ll,{points:z=>{var ue,Ce;const q=h(z);return q?((ue=i.resolved.value.noteConnections.find(Be=>Be.noteRef===q.noteRef&&Be.targetRef===q.targetRef))==null?void 0:ue.waypoints)??[]:((Ce=i.resolved.value.associations.find(Be=>Be.association.modelId===z))==null?void 0:Ce.waypoints)??[]},movePoint:(z,q,ue)=>{const Ce=h(z);Ce?i.moveNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.moveWaypoint(z,q,ue)},insertPoint:(z,q,ue)=>{const Ce=h(z);Ce?i.addNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,q,ue):i.addWaypoint(z,q,ue)},removePoint:(z,q)=>{const ue=h(z);ue?i.removeNoteConnectionWaypoint(ue.noteRef,ue.targetRef,q):i.removeWaypoint(z,q)}});const k=He(),{nodes:P,edges:A,findNode:G,findEdge:K,addNodes:v,addEdges:T,removeNodes:H,removeEdges:C,fitView:ae,setCenter:E,getViewport:Y,screenToFlowCoordinate:S,getSelectedNodes:W,updateNodeInternals:ee}=k,ie=n.ref(!1);async function O(z){ie.value=!0,await n.nextTick(),await new Promise(q=>requestAnimationFrame(()=>q(null)));try{return await z()}finally{ie.value=!1}}function U(){return O(()=>rf(k))}function ne(){return O(()=>lf(k))}t({exportSvg:U,exportPng:ne});const ce=n.computed(()=>i.resolved.value.entities.length===0);function ge(){const z=Y(),{width:q,height:ue}=k.dimensions.value;return{x:(q/2-z.x)/z.zoom,y:(ue/2-z.y)/z.zoom}}function se(){const z=ge();i.addEntity("NewEntity",{x:z.x,y:z.y})}function pe(){const z=ge();i.addNote("메모",{x:z.x,y:z.y})}function be(z){for(const q of i.resolved.value.groups){const{location:ue,size:Ce}=q.geo;if(z.x>=ue.x&&z.x<=ue.x+Ce.width&&z.y>=ue.y&&z.y<=ue.y+Ce.height)return q.group.modelId}return null}function xe(){const z=i.resolved.value,q=new Map(z.groups.map(he=>[he.group.modelId,he.geo])),ue=new Set(z.groups.map(he=>he.group.modelId)),Ce=new Set([...ue,...z.entities.map(he=>he.entity.modelId),...z.notes.map(he=>he.note.modelId)]);for(const he of[...P.value])Ce.has(he.id)||H([he.id]);for(const he of z.groups){const le=he.group.modelId,Pe={width:`${he.geo.size.width}px`,height:`${he.geo.size.height}px`},Ke={group:he.group,style:he.style,locked:he.locked},st=he.locked?!1:void 0,Ze=G(le);Ze?(Ze.position={...he.geo.location},Ze.data=Ke,Ze.style=Pe,Ze.draggable=st):v([{id:le,type:"group",position:{...he.geo.location},draggable:st,style:Pe,data:Ke}])}for(const he of z.entities){const le=he.entity.modelId,Pe=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,Ke={entity:he.entity,displayMode:i.displayMode.value,collapsed:he.collapsed,locked:he.locked,groupRef:Pe,size:he.geo.size,style:he.style,attributeStyles:he.attributeStyles,operationStyles:he.operationStyles},st=he.locked?!1:void 0,Ze=Pe?q.get(Pe):void 0,pt=Ze?{x:he.geo.location.x-Ze.location.x,y:he.geo.location.y-Ze.location.y}:{...he.geo.location},nt=G(le);nt?(nt.position=pt,nt.data=Ke,nt.parentNode=Pe,nt.draggable=st):v([{id:le,type:"entity",position:pt,parentNode:Pe,draggable:st,data:Ke}])}for(const he of z.notes){const le=he.note,Pe=le.modelId,Ke=he.groupRef&&ue.has(he.groupRef)?he.groupRef:void 0,st={note:le,groupRef:Ke},Ze={width:`${le.geo.size.width}px`,height:`${le.geo.size.height}px`},pt=Ke?q.get(Ke):void 0,nt=pt?{x:le.geo.location.x-pt.location.x,y:le.geo.location.y-pt.location.y}:{...le.geo.location},at=G(Pe);at?(at.position=nt,at.data=st,at.style=Ze,at.parentNode=Ke):v([{id:Pe,type:"note",position:nt,parentNode:Ke,style:Ze,data:st}])}const Be=new Map(z.associations.map(he=>[he.association.modelId,he])),Oe=new Set(z.noteConnections.map(he=>N(he.noteRef,he.targetRef)));for(const he of[...A.value])!Be.has(he.id)&&!Oe.has(he.id)&&C([he.id]);for(const[he,le]of Be){const Pe={id:he,type:"association",source:le.association.end1.entityRef,target:le.association.end2.entityRef,sourceHandle:le.sourceColumnRef?`r:${le.sourceColumnRef}`:void 0,targetHandle:le.targetColumnRef?`l:${le.targetColumnRef}`:void 0,data:{association:le.association,sourceColumnRef:le.sourceColumnRef,targetColumnRef:le.targetColumnRef}},Ke=K(he);Ke?(Ke.data=Pe.data,Ke.sourceHandle=Pe.sourceHandle,Ke.targetHandle=Pe.targetHandle):T([Pe])}for(const he of z.noteConnections){const le=N(he.noteRef,he.targetRef),Pe={noteRef:he.noteRef,targetRef:he.targetRef},Ke=K(le);Ke?Ke.data=Pe:T([{id:le,type:"note-connection",source:he.noteRef,target:he.targetRef,data:Pe}])}Te()}function Te(){n.nextTick(()=>requestAnimationFrame(()=>ee()))}function Ae(){const z=W.value.map(ue=>ue.id);if(z.length)return z;const q=i.selection.value;return q&&(q.kind==="entity"||q.kind==="note"||q.kind==="group")?[q.id]:[]}function fe(){return W.value.filter(z=>z.type==="entity").map(z=>z.id)}function ke(){return W.value.filter(z=>z.type==="group").map(z=>z.id)}function we(z){var q;return[...((q=i.state.logical.groups.find(ue=>ue.modelId===z))==null?void 0:q.memberEntityRefs)??[]]}function j(){const z=ke().flatMap(we);return[...new Set([...fe(),...z])]}function L(){return ke().length>0||fe().length>1}function x(){L()?i.copy(j()):i.copy()}async function R(z){if(!z.length)return;await n.nextTick();const q=W.value;q.length&&k.removeSelectedNodes(q);const ue=z.map(Ce=>G(Ce)).filter(Ce=>!!Ce);ue.length&&k.addSelectedNodes(ue)}function V(z){if(L()&&fe().includes(z)){const q=j();return{caption:i.t("em.ctx.copyN",{n:q.length}),icon:"copy",handler:()=>i.copy(q)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:z},i.copy()}}}function Q(z){var Be;const q=z.target;if(q&&(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable))return;if(z.key==="?"){a.openModal({component:sf,bind:{locale:i.uiLocale.value}}),z.preventDefault();return}if((z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"){r.value=!0,z.preventDefault();return}if(!i.editable.value){(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="c"&&(x(),z.preventDefault());return}if(z.key==="Delete"||z.key==="Backspace"){i.deleteSelection()&&z.preventDefault();return}if(z.key==="ArrowUp"||z.key==="ArrowDown"||z.key==="ArrowLeft"||z.key==="ArrowRight"){if(((Be=i.selection.value)==null?void 0:Be.kind)==="attribute"){if(z.key==="ArrowUp"||z.key==="ArrowDown"){const Pe=z.key==="ArrowDown"?1:-1;(z.altKey?i.nudgeSelectedAttributes(Pe):i.moveAttributeFocus(Pe))&&z.preventDefault()}return}const Oe=z.shiftKey?10:1,he=z.key==="ArrowLeft"?-Oe:z.key==="ArrowRight"?Oe:0,le=z.key==="ArrowUp"?-Oe:z.key==="ArrowDown"?Oe:0;i.nudgeNodes(Ae(),he,le)&&z.preventDefault();return}if(!(z.metaKey||z.ctrlKey))return;const Ce=z.key.toLowerCase();Ce==="c"?(x(),z.preventDefault()):Ce==="v"?(R(i.paste()),z.preventDefault()):Ce==="z"&&(z.shiftKey?i.redo():i.undo(),z.preventDefault())}n.onMounted(async()=>{xe(),await n.nextTick(),ae(),window.addEventListener("keydown",Q),window.addEventListener("pointerup",me),window.addEventListener("pointermove",f,{passive:!0})}),n.onBeforeUnmount(()=>{window.removeEventListener("keydown",Q),window.removeEventListener("pointerup",me),window.removeEventListener("pointermove",f)});function me(){p.value=null}function ve(){u.value=!0,g.value=null}function Ee(){var Ce;u.value=!1;const z=(Ce=document.elementFromPoint(m.x,m.y))==null?void 0:Ce.closest(".vue-flow__node"),q=z==null?void 0:z.dataset.id;if(!q){g.value=null;return}const ue=z.classList.contains("vue-flow__node-group")?"group":z.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:ue,id:q}}n.watch([()=>i.resolved.value,()=>i.displayMode.value],xe),n.watch(()=>i.revision.value,Te),n.watch(()=>i.resolved.value,z=>{const q=g.value;if(!q)return;(q.kind==="entity"?z.entities.some(Ce=>Ce.entity.modelId===q.id):q.kind==="group"?z.groups.some(Ce=>Ce.group.modelId===q.id):z.notes.some(Ce=>Ce.note.modelId===q.id))||(g.value=null)});function $e(z){const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};return{x:q.x+ue.width/2,y:q.y+ue.height/2}}function Me(z){const q=z.node;if(q){if(g.value=null,q.type==="group"){const ue=i.resolved.value.groups.find(Ce=>Ce.group.modelId===q.id);y.value=ue?{groupId:q.id,dx:q.position.x-ue.geo.location.x,dy:q.position.y-ue.geo.location.y}:null,p.value=null;return}if(q.type!=="entity"&&q.type!=="note"){p.value=null;return}p.value=be($e(q))}}function Ue(z){var Ce;p.value=null,y.value=null;const q=(Ce=z.nodes)!=null&&Ce.length?z.nodes:[z.node],ue=q.filter(Be=>(Be==null?void 0:Be.type)==="group");if(ue.length){for(const Be of ue){if(!Be)continue;const Oe=i.resolved.value.entities.filter(he=>he.groupRef===Be.id).map(he=>{const le=G(he.entity.modelId),Pe=(le==null?void 0:le.computedPosition)??(le==null?void 0:le.position)??{x:0,y:0};return{id:he.entity.modelId,location:{x:Pe.x,y:Pe.y}}});i.dragGroup(Be.id,{x:Be.position.x,y:Be.position.y},Oe)}return}for(const Be of q){if(!Be||Be.type==="group")continue;const Oe=Be.computedPosition??Be.position,he=Be.dimensions??{width:0,height:0},le={x:Oe.x+he.width/2,y:Oe.y+he.height/2};Be.type==="note"?i.dropNote(Be.id,{x:Oe.x,y:Oe.y},be(le)):i.dropEntity(Be.id,{x:Oe.x,y:Oe.y},be(le))}}function Ye(z){var Pe,Ke,st,Ze,pt;if(!i.editable.value||!z.source||!z.target)return;const q=((Pe=G(z.source))==null?void 0:Pe.type)==="note",ue=((Ke=G(z.target))==null?void 0:Ke.type)==="note";if(q||ue){if(q&&ue)return;const nt=q?z.source:z.target,at=q?z.target:z.source;((st=G(at))==null?void 0:st.type)==="entity"&&i.addNoteConnection(nt,at);return}const Ce=nt=>{var at;return(at=i.state.logical.entities.find(ct=>ct.modelId===nt))==null?void 0:at.stereotype},Be=Ce(z.source)==="JPA_EMBEDDABLE",Oe=Ce(z.target)==="JPA_EMBEDDABLE";if(Be||Oe){if(Be&&Oe)return;const nt=Be?z.source:z.target,at=Be?z.target:z.source;i.addEmbedAssociation(at,nt);return}const he=(Ze=z.sourceHandle)!=null&&Ze.startsWith("r:")?z.sourceHandle.slice(2):void 0,le=(pt=z.targetHandle)!=null&&pt.startsWith("l:")?z.targetHandle.slice(2):void 0;i.addAssociation(z.source,z.target,he,le)}const Fe=n.ref(null);function gt(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.attributeStyles)==null?void 0:Ce[q])}function w(z,q){var Ce;const ue=i.state.layout.entityLayouts.find(Be=>Be.entityRef===z);return ut((Ce=ue==null?void 0:ue.operationStyles)==null?void 0:Ce[q])}function M(z){var q;return ut((q=i.state.layout.groupLayouts.find(ue=>ue.groupRef===z))==null?void 0:q.style)}function I(z){var q;return ut((q=i.state.layout.notes.find(ue=>ue.modelId===z))==null?void 0:q.style)}function D(z){var Be,Oe;if(z.preventDefault(),!i.editable.value)return;const q=()=>S({x:z.clientX,y:z.clientY}),ue=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const he=q();i.addEntity("NewEntity",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const he=q();i.addNote("메모",{x:he.x,y:he.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const he=q();i.addEmptyGroup({x:he.x,y:he.y})}}],Ce=(Be=i.clipboard.value)==null?void 0:Be.kind;(Ce==="entity"||Ce==="entities")&&ue.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>R(i.paste())}),i.resolved.value.entities.length>0&&ue.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Oe=Fe.value)==null||Oe.open(z,ue)}function B({event:z,node:q}){var Pe,Ke,st,Ze,pt,nt,at,ct,pf,hf,yf,gf,bf,_f,kf,Ef,Nf,wf;const ue=z;if(ue.preventDefault(),!i.editable.value){if(q.type==="group"||q.type==="note")return;const je=(Ke=(Pe=ue.target)==null?void 0:Pe.closest("[data-attr]"))==null?void 0:Ke.dataset.attr;if(je){const Qe=i.selection.value;(Qe==null?void 0:Qe.kind)==="attribute"&&Qe.entityId===q.id&&Qe.ids.includes(je)||i.selectAttribute(q.id,je);const Jt=((st=i.selection.value)==null?void 0:st.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[je];(Ze=Fe.value)==null||Ze.open(ue,[{caption:Jt.length>1?i.t("em.ctx.copyN",{n:Jt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=Fe.value)==null||pt.open(ue,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)},V(q.id)]);return}if(q.type==="group"){const je=i.isGroupLocked(q.id),Qe=[];je||Qe.push({type:"swatches",caption:i.t("em.common.color"),current:M(q.id),onPick:Jt=>i.setGroupSwatch(q.id,Jt)},{type:"separator"});const rt=L()&&ke().includes(q.id)?j():we(q.id);rt.length&&Qe.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(rt)}),Qe.push({caption:je?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:je?"unlock":"lock",handler:()=>i.setGroupLocked(q.id,!je)}),je||Qe.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(q.id)}),(nt=Fe.value)==null||nt.open(ue,Qe);return}if(q.type==="note"){(at=Fe.value)==null||at.open(ue,[{type:"swatches",caption:i.t("em.common.color"),current:I(q.id),onPick:je=>i.setNoteSwatch(q.id,je)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(q.id)}]);return}const Ce=(pf=(ct=ue.target)==null?void 0:ct.closest("[data-attr]"))==null?void 0:pf.dataset.attr;if(Ce){const je=i.selection.value;(je==null?void 0:je.kind)==="attribute"&&je.entityId===q.id&&je.ids.includes(Ce)||i.selectAttribute(q.id,Ce);const rt=((hf=i.selection.value)==null?void 0:hf.kind)==="attribute"&&i.selection.value.entityId===q.id?[...i.selection.value.ids]:[Ce];if(i.isEntityLocked(q.id)){(yf=Fe.value)==null||yf.open(ue,[{caption:rt.length>1?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Jt=rt.length>1,Tl=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{type:"swatches",caption:Jt?i.t("em.ctx.colorN",{n:rt.length}):i.t("em.common.color"),current:Jt?null:gt(q.id,Ce),onPick:xT=>i.setAttributeSwatches(q.id,rt,xT)},{type:"separator"},{caption:Jt?i.t("em.ctx.copyN",{n:rt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],li=i.clipboard.value;(li==null?void 0:li.kind)==="attribute"&&Tl.push({caption:li.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:li.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),Tl.push({type:"separator"},{caption:Jt?i.t("em.ctx.deleteAttrN",{n:rt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(q.id,rt)}),(gf=Fe.value)==null||gf.open(ue,Tl);return}const Be=(_f=(bf=ue.target)==null?void 0:bf.closest("[data-op]"))==null?void 0:_f.dataset.op;if(Be){if(i.isEntityLocked(q.id))return;(kf=Fe.value)==null||kf.open(ue,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(q.id)},{type:"swatches",caption:i.t("em.common.color"),current:w(q.id,Be),onPick:je=>i.setOperationSwatch(q.id,Be,je)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(q.id,Be)}]);return}const Oe=i.resolved.value.entities.find(je=>je.entity.modelId===q.id),he=!!(Oe!=null&&Oe.locked),le=[{caption:he?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>pa(a,i,q.id)}];if(!he){le.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(q.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(q.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const Qe=W.value.filter(rt=>rt.type==="entity").map(rt=>rt.id);i.createGroup(Qe.includes(q.id)&&Qe.length?Qe:[q.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(q.id,q.id)});const je=i.embeddableCatalog.value;if(je.length){le.push({type:"separator"});for(const Qe of je){const rt=((Ef=Qe.label)==null?void 0:Ef.ko)??((Nf=Qe.label)==null?void 0:Nf.en)??Qe.type;le.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:rt}),icon:"link",handler:()=>i.addPredefinedEmbed(q.id,Qe.type)})}}}if(le.push({type:"separator"}),le.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(q.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!he&&le.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(q.id)}),le.push({caption:he?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:he?"unlock":"lock",handler:()=>i.setEntityLocked(q.id,!he)}),le.push(V(q.id)),!he){const je=i.clipboard.value;(je==null?void 0:je.kind)==="attribute"&&le.push({caption:je.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:je.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:q.id},i.paste()}}),le.push({type:"separator"}),le.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(q.id)})}(wf=Fe.value)==null||wf.open(ue,le)}function de({event:z,edge:q}){var Be,Oe;const ue=z;if(ue.preventDefault(),!i.editable.value)return;const Ce=h(q.id);if(Ce){(Be=Fe.value)==null||Be.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Ce.noteRef,Ce.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Ce.noteRef,Ce.targetRef)}]);return}(Oe=Fe.value)==null||Oe.open(ue,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(q.id)},{type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(q.id)}])}function J(z){return z==="group"?"group":z==="note"?"note":"entity"}function X({node:z}){if(W.value.length>1){i.selection.value=null;return}i.selection.value={kind:J(z.type),id:z.id}}function te({nodes:z}){z.length>1&&(i.selection.value=null)}function re({edge:z}){const q=h(z.id);i.selection.value=q?{kind:"note",id:q.noteRef}:{kind:"association",id:z.id}}function Ne(z){const q=i.selection.value;return!!q&&q.kind!=="attribute"&&q.id===z.id}function $(z){var q,ue;return Ne(z)?z.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":z.type==="note"?"var(--em-note-soft)":z.type==="group"?Mu(ut((q=z.data)==null?void 0:q.style),!0)??"var(--em-mm-group)":Mu(ut((ue=z.data)==null?void 0:ue.style))??"var(--em-mm-entity)"}function Z(z){return Ne(z)?"var(--em-selection)":z.type==="note"?"var(--em-note-accent)":z.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function F(z,q){E(z,q,{zoom:Y().zoom,duration:350})}n.watch(()=>i.focusRequest.value,z=>{if(!z)return;const q=G(z.id);if(!q)return;const ue=q.computedPosition??q.position,Ce=q.dimensions??{width:0,height:0};F(ue.x+Ce.width/2,ue.y+Ce.height/2)});function Ie({position:z}){F(z.x,z.y)}function ye({node:z}){i.selection.value={kind:J(z.type),id:z.id};const q=z.computedPosition??z.position,ue=z.dimensions??{width:0,height:0};F(q.x+ue.width/2,q.y+ue.height/2)}function ze({node:z}){ae({nodes:[z.id],duration:350,maxZoom:1.2,padding:.6})}return(z,q)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["em-canvas",{"is-connecting":d.value,"is-panning":u.value}])},[n.createVNode(n.unref(ck),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ie.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(Kt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:ve,onMoveEnd:Ee,onConnect:Ye,onConnectStart:q[1]||(q[1]=ue=>d.value=!0),onConnectEnd:q[2]||(q[2]=ue=>d.value=!1),onNodeDrag:Me,onNodeDragStop:Ue,onNodeClick:X,onEdgeClick:re,onSelectionChange:te,onPaneClick:q[3]||(q[3]=ue=>n.unref(i).selection.value=null),onPaneContextMenu:D,onNodeContextMenu:B,onEdgeContextMenu:de},{"node-group":n.withCtx(ue=>[n.createVNode(qu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-entity":n.withCtx(ue=>[n.createVNode(Wu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"node-note":n.withCtx(ue=>[n.createVNode(Xu,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-association":n.withCtx(ue=>[n.createVNode(dm,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),"edge-note-connection":n.withCtx(ue=>[n.createVNode(sS,n.normalizeProps(n.guardReactiveProps(ue)),null,16)]),default:n.withCtx(()=>[n.unref(i).showGrid.value?(n.openBlock(),n.createBlock(n.unref(Xw),{key:0,gap:16,"pattern-color":"var(--em-border)"})):n.createCommentVNode("",!0),n.createVNode(n.unref(Nv),{"show-interactive":!1,position:"bottom-left"},{default:n.withCtx(()=>[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(n.unref(Tn),{class:"em-palette__group-start",title:n.unref(i).t("em.ctx.addEntity"),onClick:se},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.ctx.addNote"),onClick:pe},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),n.createVNode(n.unref(Tn),{title:n.unref(i).t("em.palette.autoLayout"),onClick:q[0]||(q[0]=ue=>n.unref(i).autoLayout())},{default:n.withCtx(()=>[n.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):n.createCommentVNode("",!0)]),_:1}),n.unref(i).showMinimap.value?(n.openBlock(),n.createBlock(n.unref(iS),{key:1,pannable:"",width:224,height:160,"node-color":$,"node-stroke-color":Z,"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:Ie,onNodeClick:ye,onNodeDblclick:ze})):n.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ce.value?(n.openBlock(),n.createElementBlock("div",WS,[n.unref(i).editable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("p",qS,n.toDisplayString(n.unref(i).t("em.canvas.emptyTitle")),1),n.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:n.unref(i).t("em.canvas.emptyHint")},null,8,XS),n.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:n.unref(i).t("em.canvas.emptyShortcutHint")},null,8,JS)],64)):(n.openBlock(),n.createElementBlock("p",ZS,n.toDisplayString(n.unref(i).t("em.canvas.emptyReadonly")),1))])):n.createCommentVNode("",!0),r.value?(n.openBlock(),n.createBlock(KS,{key:1,controller:n.unref(i),onClose:q[4]||(q[4]=ue=>r.value=!1)},null,8,["controller"])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"em-conflict-fade"},{default:n.withCtx(()=>[c.value?(n.openBlock(),n.createElementBlock("div",QS,[n.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),n.createElementVNode("div",e$,[n.createElementVNode("strong",t$,n.toDisplayString(c.value.title),1),n.createElementVNode("span",n$,n.toDisplayString(c.value.detail),1)])])):n.createCommentVNode("",!0)]),_:1}),n.createVNode(_S,{ref_key:"menuRef",ref:Fe,locale:n.unref(i).uiLocale.value},null,8,["locale"]),(n.openBlock(),n.createBlock(n.Teleport,{to:"body"},[n.createVNode(n.Transition,{name:"em-toast-fade"},{default:n.withCtx(()=>[l.value?(n.openBlock(),n.createElementBlock("div",o$,n.toDisplayString(l.value),1)):n.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-a49d9d63"]]),i$={class:"em-explorer em-scroll-overlay"},a$={class:"em-explorer__search"},r$=["placeholder","aria-label"],l$=["aria-label","title"],s$={key:0,class:"em-explorer__empty"},c$={class:"em-explorer__rows"},d$=["data-key","onClick","onDblclick"],u$=["onClick"],m$=["title"],f$={class:"em-key-slot"},p$={class:"em-key-slot"},h$={class:"em-explorer__label"},df=Ge(n.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:t}){const i=e.controller,a=oe.useModal(),r=n.computed(()=>{var O;const A=i.resolved.value,G=i.displayMode.value,K=i.userLanguage.value,v=U=>{var ne,ce,ge;return ci(G,U.name,(ce=(ne=U.table)==null?void 0:ne.logicalName)==null?void 0:ce[K],(ge=U.table)==null?void 0:ge.physicalName,i.t("em.node.logicalMissing"))},T=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",H=U=>{const ne=U.attrType.startsWith("RELATION")&&U.dbAttrs.length>0;return{icon:U.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:U.identifier,fk:ne&&T}}},C=U=>U.attrType.startsWith("EMBED")&&U.dbAttrs.length>0,ae=G==="PHYSICAL"||G==="LOGICAL_PHYSICAL",E=U=>{if(U.attrType!=="EMBED_PREDEF")return U.dbAttrs;const ne=i.embeddableCatalog.value.find(ce=>ce.type===U.type);return ne?U.dbAttrs.map((ce,ge)=>{const se=ne.fields[ge];return se?{...ce,physicalName:ce.physicalName||se.physicalName,logicalName:ce.logicalName??se.logicalName,dataType:ce.dataType||se.dataType,length:ce.length??se.length}:ce}):U.dbAttrs},Y=(U,ne)=>{var pe,be,xe,Te,Ae,fe,ke,we,j;const ce={entityId:ne,attrId:U.modelId};if(C(U)){const L=Za(G,U);return{key:`attr:${U.modelId}`,label:U.name+(L?` : ${L}`:""),icon:"table",attrRef:ce,focusId:ne,matchText:po(U.name,(be=(pe=U.dbAttrs[0])==null?void 0:pe.logicalName)==null?void 0:be[K],(xe=U.dbAttrs[0])==null?void 0:xe.physicalName),children:ae?E(U).map(x=>{var R,V;return{key:`attr:${U.modelId}:col:${x.modelId}`,label:ci(G,x.physicalName,(R=x.logicalName)==null?void 0:R[K],x.physicalName,i.t("em.node.logicalMissing"))+(x.dataType?` : ${x.dataType}`:""),icon:"field",attrRef:ce,focusId:ne,matchText:po(x.physicalName,(V=x.logicalName)==null?void 0:V[K]),children:[]}}):[]}}const ge=Ja(U,i.state.logical.associations),se=Za(G,U,ge);return{key:`attr:${U.modelId}`,label:ci(G,U.name,(Ae=(Te=U.dbAttrs[0])==null?void 0:Te.logicalName)==null?void 0:Ae[K],(fe=U.dbAttrs[0])==null?void 0:fe.physicalName,i.t("em.node.logicalMissing"))+(se?` : ${se}`:""),...H(U),attrRef:ce,focusId:ne,matchText:po(U.name,(we=(ke=U.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:we[K],(j=U.dbAttrs[0])==null?void 0:j.physicalName),children:[]}},S=U=>{var ge,se,pe;const ne=U.entity,ce=[...ne.attributes].sort((be,xe)=>be.order-xe.order);return{key:`entity:${ne.modelId}`,label:v(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:po(ne.name,(se=(ge=ne.table)==null?void 0:ge.logicalName)==null?void 0:se[K],(pe=ne.table)==null?void 0:pe.physicalName),children:ce.map(be=>Y(be,ne.modelId))}},W=new Map,ee=[];for(const U of A.entities)if(U.groupRef){const ne=W.get(U.groupRef)??[];ne.push(U),W.set(U.groupRef,ne)}else ee.push(U);const ie=[];for(const U of A.groups){const ne=U.group;ie.push({key:`group:${ne.modelId}`,label:((O=ne.name)==null?void 0:O.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(W.get(ne.modelId)??[]).map(S)})}for(const U of ee)ie.push(S(U));if(A.associations.length){const U=new Map(A.entities.map(ne=>[ne.entity.modelId,v(ne.entity)]));ie.push({key:"section:associations",label:i.t("em.explorer.associations",{n:A.associations.length}),icon:"arrow-lr",children:A.associations.map(ne=>{const ce=ne.association,ge=U.get(ce.end1.entityRef)??ce.end1.entityRef,se=U.get(ce.end2.entityRef)??ce.end2.entityRef;return{key:`assoc:${ce.modelId}`,label:`${ge} — ${se}`,icon:"arrow-lr",selectKind:"association",selectId:ce.modelId,children:[]}})})}return A.notes.length&&ie.push({key:"section:notes",label:i.t("em.explorer.notes",{n:A.notes.length}),icon:"note",children:A.notes.map(({note:U})=>{var ne;return{key:`note:${U.modelId}`,label:((ne=U.memo.split(`
62
- `)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:U.modelId,focusId:U.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ie}});function l(A){return A?A.pk&&A.fk?i.t("em.node.keyPfk"):A.pk?i.t("em.node.keyPk"):A.fk?i.t("em.node.keyFk"):"":""}const s=n.ref(new Set);function c(A){const G=new Set(s.value);G.has(A)?G.delete(A):G.add(A),s.value=G}const d=n.ref(""),u=n.ref(null),m=n.computed(()=>d.value.trim().length>0),f=n.computed(()=>{const A=[];if(m.value){const K=VS(r.value,d.value.trim().toLowerCase()),v=(T,H)=>{if(K.has(T.key)){A.push({node:T,depth:H});for(const C of T.children)v(C,H+1)}};return v(r.value,0),A}const G=(K,v)=>{if(A.push({node:K,depth:v}),!s.value.has(K.key))for(const T of K.children)G(T,v+1)};return G(r.value,0),A}),p=n.computed(()=>m.value&&f.value.length<=1);function y(A){var v;if(A.key!=="/"||A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;const G=A.target,K=G==null?void 0:G.tagName;K==="INPUT"||K==="TEXTAREA"||K==="SELECT"||G!=null&&G.isContentEditable||(A.preventDefault(),(v=u.value)==null||v.focus())}n.onMounted(()=>window.addEventListener("keydown",y)),n.onBeforeUnmount(()=>window.removeEventListener("keydown",y));const g=n.computed(()=>{const A=[],G=K=>{if(K.children.length){K.key!=="root"&&A.push(K.key);for(const v of K.children)G(v)}};return G(r.value),A}),_=n.computed(()=>!g.value.some(A=>s.value.has(A)));function b(){s.value=_.value?new Set(g.value):new Set}t({toggleAll:b,allExpanded:_,hasExpandable:n.computed(()=>g.value.length>0)});function N(A){const G=i.selection.value;return A.attrRef?(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.attrRef.entityId&&G.ids.includes(A.attrRef.attrId):!!G&&G.kind!=="attribute"&&!!A.selectId&&A.selectKind===G.kind&&A.selectId===G.id}function h(A){const G=i.selection.value;return A.selectKind==="entity"&&(G==null?void 0:G.kind)==="attribute"&&G.entityId===A.selectId}function k(A,G){if(A.attrRef){const K=G.shiftKey?"range":G.metaKey||G.ctrlKey?"toggle":"replace";i.selectAttribute(A.attrRef.entityId,A.attrRef.attrId,K)}else A.selectKind&&A.selectId&&(i.selection.value={kind:A.selectKind,id:A.selectId});A.focusId&&i.requestFocus(A.focusId)}function P(A){A.selectKind==="entity"&&A.selectId&&pa(a,i,A.selectId)}return(A,G)=>(n.openBlock(),n.createElementBlock("section",i$,[n.createElementVNode("div",a$,[n.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),n.withDirectives(n.createElementVNode("input",{ref_key:"searchInput",ref:u,"onUpdate:modelValue":G[0]||(G[0]=K=>d.value=K),class:"em-explorer__search-input",type:"text",placeholder:n.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":n.unref(i).t("em.explorer.searchAria"),onKeydown:G[1]||(G[1]=n.withKeys(K=>d.value="",["esc"]))},null,40,r$),[[n.vModelText,d.value]]),d.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":n.unref(i).t("em.explorer.clearSearchAria"),title:n.unref(i).t("em.explorer.clearSearchTitle"),onClick:G[2]||(G[2]=K=>d.value="")},[n.createVNode(Ve,{name:"x",size:13})],8,l$)):n.createCommentVNode("",!0)]),p.value?(n.openBlock(),n.createElementBlock("p",s$,n.toDisplayString(n.unref(i).t("em.explorer.noMatches")),1)):n.createCommentVNode("",!0),n.createElementVNode("div",c$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(f.value,({node:K,depth:v})=>(n.openBlock(),n.createElementBlock("div",{key:K.key,class:n.normalizeClass(["em-explorer__row",{"is-active":N(K),"is-focus-parent":h(K),"is-selectable":!!K.selectKind||!!K.attrRef||!!K.focusId}]),"data-key":K.key,style:n.normalizeStyle({paddingLeft:4+v*14+"px"}),onClick:T=>k(K,T),onDblclick:T=>P(K)},[n.createElementVNode("span",{class:n.normalizeClass(["em-explorer__chevron",{"is-leaf":!K.children.length,"is-open":!s.value.has(K.key)}]),onClick:n.withModifiers(T=>K.children.length&&c(K.key),["stop"])},[K.children.length?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:14})):n.createCommentVNode("",!0)],10,u$),K.keyMarks?(n.openBlock(),n.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(K.keyMarks),"aria-hidden":"true"},[n.createElementVNode("span",f$,[K.keyMarks.pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):K.keyMarks.fk?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:14},null,8,["name"]))]),n.createElementVNode("span",p$,[K.keyMarks.fk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):n.createCommentVNode("",!0)])],8,m$)):(n.openBlock(),n.createBlock(Ve,{key:1,class:"em-explorer__icon",name:K.icon,size:15},null,8,["name"])),n.createElementVNode("span",h$,n.toDisplayString(K.label),1)],46,d$))),128))])]))}}),[["__scopeId","data-v-7b20d13b"]]),y$={class:"em-text-export"},g$={key:0,class:"em-text-export__tabs",role:"tablist"},b$=["aria-selected","onClick"],_$={class:"em-text-export__pre"},k$={class:"em-text-export__actions"},E$=Ge(n.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(c,d)=>Ct(t.locale??"ko",c,d),a=n.ref(0);function r(){return t.formats[a.value]??t.formats[0]}async function l(){try{await navigator.clipboard.writeText(r().content),oe.showNotification(i("em.export.copied"),"info")}catch{oe.showNotification(i("em.export.copyFailed"),"error")}}function s(){const c=r(),d=new Blob([c.content],{type:"text/plain;charset=utf-8"}),u=URL.createObjectURL(d);try{const m=document.createElement("a");m.href=u,m.download=c.filename,document.body.appendChild(m),m.click(),m.remove()}finally{URL.revokeObjectURL(u)}}return(c,d)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:t.title??i("em.export.title")},{default:n.withCtx(()=>[n.createElementVNode("div",y$,[t.formats.length>1?(n.openBlock(),n.createElementBlock("div",g$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.formats,(u,m)=>(n.openBlock(),n.createElementBlock("button",{key:u.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-export__tab",{"is-active":m===a.value}]),"aria-selected":m===a.value,onClick:f=>a.value=m},n.toDisplayString(u.label),11,b$))),128))])):n.createCommentVNode("",!0),n.createElementVNode("pre",_$,n.toDisplayString(r().content),1),n.createElementVNode("div",k$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.copy"),onClick:l},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{caption:i("em.export.download"),onClick:s},null,8,["caption"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:d[0]||(d[0]=u=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-f31001c1"]]),N$={class:"em-text-import"},w$={class:"em-text-import__formats",role:"tablist"},v$=["aria-selected","onClick"],x$=["placeholder"],I$={class:"em-text-import__status"},C$={class:"em-text-import__ok"},S$={key:0,class:"em-text-import__warn"},$$={key:1,class:"em-text-import__err"},R$={key:2,class:"em-text-import__err"},A$={key:3,class:"em-text-import__err"},T$={class:"em-text-import__actions"},V$=Ge(n.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const t=e,o=oe.useModalHandle(),i=(f,p)=>Ct(t.locale??"ko",f,p),a=n.ref(""),r=n.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}];function s(f){return f?f.startsWith("{")?"json":/\berdiagram\b/i.test(f)?"mermaid":/\bcreate\s+table\b/i.test(f)?"ddl":null:null}const c=n.computed(()=>r.value==="auto"?s(a.value.trim()):r.value),d=n.computed(()=>{const f=a.value.trim();if(!f)return{status:"empty"};const p=c.value;if(!p)return{status:"unknown"};try{let y,g=[];return p==="json"?y=as(f):p==="mermaid"?y=Kl(f):(y=Xl(f),g=Wa(f).warnings),y.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:y,warnings:g}}catch(y){return{status:"error",message:y instanceof Error?y.message:String(y)}}}),u=n.computed(()=>d.value.status==="ok");function m(){const f=d.value;f.status!=="ok"||!f.source||(t.onImport(f.source),o.close())}return(f,p)=>(n.openBlock(),n.createBlock(n.unref(oe.BSModalFrame),{title:i("em.import.title")},{default:n.withCtx(()=>[n.createElementVNode("div",N$,[n.createElementVNode("div",w$,[(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(l,y=>n.createElementVNode("button",{key:y.key,type:"button",role:"tab",class:n.normalizeClass(["em-text-import__fmt",{"is-active":y.key===r.value}]),"aria-selected":y.key===r.value,onClick:g=>r.value=y.key},n.toDisplayString(i(y.labelKey)),11,v$)),64))]),n.withDirectives(n.createElementVNode("textarea",{"onUpdate:modelValue":p[0]||(p[0]=y=>a.value=y),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,x$),[[n.vModelText,a.value]]),n.createElementVNode("div",I$,[d.value.status==="ok"&&d.value.source?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",C$,n.toDisplayString(i("em.import.detected",{format:i(`em.import.format${c.value==="json"?"Json":c.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+n.toDisplayString(i("em.import.summary",{entities:d.value.source.logical.entities.length,relations:d.value.source.logical.associations.length})),1),d.value.warnings&&d.value.warnings.length?(n.openBlock(),n.createElementBlock("span",S$," ⚠ "+n.toDisplayString(i("em.import.warnings",{n:d.value.warnings.length})),1)):n.createCommentVNode("",!0)],64)):d.value.status==="error"?(n.openBlock(),n.createElementBlock("span",$$,n.toDisplayString(i("em.import.error",{message:d.value.message??""})),1)):d.value.status==="unknown"?(n.openBlock(),n.createElementBlock("span",R$,n.toDisplayString(i("em.import.unknownFormat")),1)):d.value.status==="emptyParse"?(n.openBlock(),n.createElementBlock("span",A$,n.toDisplayString(i("em.import.emptyParse")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("div",T$,[n.createVNode(n.unref(oe.BSButton),{caption:i("em.import.confirm"),disabled:!u.value,onClick:m},null,8,["caption","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[1]||(p[1]=y=>n.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-43a94e55"]]),M$={class:"em-toolbar"},B$={class:"em-toolbar__mode"},uf=Ge(n.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:t}){const i=e.controller,a=t,r=oe.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=n.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=n.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=i.state.logical;r.openModal({component:E$,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Ul(y),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Ka(y,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Ka(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:ns(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:is(y,i.state.layout),filename:"diagram.json"}]}})}function f(){r.openModal({component:V$,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function p(){r.openModal({component:sf,bind:{locale:i.uiLocale.value}})}return(y,g)=>(n.openBlock(),n.createElementBlock("div",M$,[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.undo"),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,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.redo"),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,["tooltip","disabled"]),g[9]||(g[9]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createElementVNode("label",B$,[n.createTextVNode(n.toDisplayString(n.unref(i).t("em.toolbar.displayLabel"))+" ",1),n.createVNode(n.unref(oe.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>n.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(n.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:n.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showGrid.value}]),caption:n.unref(i).t("em.toolbar.grid"),tooltip:n.unref(i).t(n.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>n.unref(i).showGrid.value=!n.unref(i).showGrid.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":n.unref(i).showMinimap.value}]),caption:n.unref(i).t("em.toolbar.minimap"),tooltip:n.unref(i).t(n.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>n.unref(i).showMinimap.value=!n.unref(i).showMinimap.value)},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!n.unref(i).editable.value,onClick:u},{left:n.withCtx(()=>[n.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.import"),disabled:!n.unref(i).editable.value,onClick:f},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportText"),onClick:m},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:n.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),n.unref(i).historyAvailable.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[g[8]||(g[8]=n.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:n.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:n.unref(i).t("em.toolbar.history"),tooltip:n.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["class","caption","tooltip"])],64)):n.createCommentVNode("",!0),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:n.unref(i).t("em.toolbar.shortcuts"),onClick:p},{left:n.withCtx(()=>[n.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-38de55b4"]]),D$=["title"],O$=["title"],L$=["disabled","aria-pressed"],P$=["disabled","aria-pressed"],z$=Ge(n.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=l=>Ct(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(n.openBlock(),n.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[n.createVNode(Ve,{name:"lock",size:14}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.frozen")),1)],8,D$)):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[n.createVNode(Ve,{name:"eye",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.view")),1)],10,L$),n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[n.createVNode(Ve,{name:"pencil",size:13}),n.createElementVNode("span",null,n.toDisplayString(a("em.mode.edit")),1)],10,P$)],10,O$))}}),[["__scopeId","data-v-2b5162b7"]]),U$=["disabled"],F$={class:"em-panel__sub"},H$={class:"em-nav"},G$={key:0,class:"em-nav__divider","aria-hidden":"true"},j$={key:1},K$=["onClick","onKeydown"],Y$={class:"em-nav__name"},W$=["title"],q$={key:0,class:"em-panel__note"},X$=["data-attr-block"],J$={class:"em-attr__row"},Z$=["title"],Q$={key:0,class:"em-attr__row"},eR={class:"em-attr__row"},tR={class:"em-attr__row"},nR={class:"em-attr__flags"},oR={class:"em-attr__pii"},iR={class:"em-attr__pii"},aR={class:"em-attr__pii"},rR={key:0,class:"em-attr__pii em-attr__codetop"},lR={class:"em-multilang"},sR={key:2,class:"em-embed-cols"},cR={class:"em-embed-col__label"},dR={class:"em-attr__row"},uR={class:"em-attr__row"},mR={key:0,class:"em-embed-upd"},fR={class:"em-embed-upd"},pR={class:"em-embed-upd"},hR={class:"em-swatch__row em-attr__swatch"},yR=["title","onClick"],gR=["title","onClick"],bR={key:0,class:"em-attr__swatch-hint"},Oa="__OWN__",_R=Ge(n.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const t=e,o=t.controller,i=n.computed(()=>o.state.logical.entities.find($=>$.modelId===t.entityId)??null),a=n.computed(()=>i.value?o.state.layout.entityLayouts.find($=>$.entityRef===i.value.modelId)??null:null),r=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.stereotype)==="JPA_EMBEDDABLE"}),l=n.computed(()=>new Set(o.selectedAttrIds.value)),s=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes.filter(Z=>Z.attrType!=="DIVIDER"))??[]}),c=n.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),d=n.computed(()=>s.value.filter($=>l.value.has($.modelId)));function u($){return{pk:$.identifier,fk:$.attrType.startsWith("RELATION")&&$.dbAttrs.length>0,required:$.notNull&&!$.identifier}}function m($){return!!i.value&&!!Ri(o.state.logical,i.value.modelId,$.modelId)}function f($){const Z=u($),F=[Z.pk&&"PK",Z.fk&&"FK",Z.required&&"NOT NULL"].filter(Boolean);return F.length?F.join(" · "):void 0}function p($,Z){i.value&&o.selectAttribute(i.value.modelId,$.modelId,Z.shiftKey?"range":Z.metaKey||Z.ctrlKey?"toggle":"replace")}const y=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function g($){return $==="none"?o.t("em.common.noneParen"):$}const _=$=>$;function b($){var Z,F;return ut((F=(Z=a.value)==null?void 0:Z.attributeStyles)==null?void 0:F[$.modelId])}function N($){return l.value.size>1&&l.value.has($.modelId)}function h($,Z){if(!i.value)return;const F=N($)?o.selectedAttrIds.value:[$.modelId];o.setAttributeSwatches(i.value.modelId,F,Z)}function k($,Z){i.value&&o.updateAttribute(i.value.modelId,$.modelId,Z)}function P($,Z){k($,{naturalId:Z||void 0,naturalIdMutable:Z?$.naturalIdMutable:void 0})}function A(){return{naturalId:void 0,naturalIdMutable:void 0}}function G($,Z){k($,{identifier:Z,...Z?A():{}})}function K($,Z){k($,{transient:Z||void 0,...Z?A():{}})}function v($){return!!$.transient}const T=$=>$.value,H=$=>$.label;function C($,Z){if(!Z)return;const F=O.value.find(Ie=>Ie.type===Z);if(F){const Ie=$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"};k($,{type:Z,customType:void 0,dbAttrs:[{...Ie,dataType:F.dataType,length:F.length,scale:F.scale}]});return}k($,Z===Rt?{type:Z}:{type:Z,customType:void 0})}function ae($,Z){k($,{customType:Z.trim()===""?void 0:Z})}function E($,Z){const Ie={...$.dbAttrs[0]??{modelId:$.modelId+".c",physicalName:$.name,dataType:"VARCHAR"},...Z};Z.dataType!==void 0&&!_o.has(Ie.dataType)&&(Ie.scale=void 0),k($,{dbAttrs:[Ie]})}function Y($){var Z;return _o.has(((Z=$.dbAttrs[0])==null?void 0:Z.dataType)??"")}function S($,Z){E($,{logicalName:Object.keys(Z).length?Z:void 0})}function W($,Z){k($,{description:Object.keys(Z).length?Z:void 0})}function ee($){return $.personalInfoAttributeType??"none"}function ie($,Z){k($,{personalInfoAttributeType:Z==="none"?void 0:Z})}const O=n.computed(()=>o.predefinedCustomTypeCatalog.value),U=n.computed(()=>o.embeddableCatalog.value),ne=n.ref(void 0);function ce($){var Z,F;return((Z=$.label)==null?void 0:Z.ko)??((F=$.label)==null?void 0:F.en)??$.type}function ge($){if(!$||!i.value)return;const Z=o.addPredefinedEmbed(i.value.modelId,$);Z&&o.selectAttribute(i.value.modelId,Z),ne.value=void 0}function se(){if(!i.value)return;const $=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,$)}const pe=n.computed(()=>o.groupCodeCatalog.value);function be($){var Z;return((Z=pe.value.find(F=>F.groupCode===$.groupCode))==null?void 0:Z.codes)??[]}function xe($){return["none",...be($)]}function Te($){return $==="none"?"none":$.code}function Ae($){var F,Ie;if($==="none")return o.t("em.common.noneParen");const Z=((F=$.label)==null?void 0:F.ko)??((Ie=$.label)==null?void 0:Ie.en);return Z?`${$.code} (${Z})`:$.code}function fe($,Z){i.value&&o.setAttributeGroupCode(i.value.modelId,$.modelId,Z)}function ke($,Z){k($,{defaultValue:Z==="none"?void 0:Z})}function we($,Z){k($,{defaultValue:Z.trim()===""?void 0:Z})}function j($){return $.attrType.startsWith("EMBED")&&$.dbAttrs.length>0}function L($,Z,F){const Ie=$.dbAttrs.map((ye,ze)=>{if(ze!==Z)return ye;const z={...ye,...F};for(const q of Object.keys(F))F[q]===void 0&&delete z[q];return z});i.value&&o.setEmbedColumns(i.value.modelId,$.modelId,Ie)}function x($,Z,F){L($,Z,{logicalName:Object.keys(F).length?F:void 0})}function R($,Z){var ye,ze,z;if($.attrType==="EMBED_PREDEF"){const q=(ye=o.embeddableCatalog.value.find(ue=>ue.type===$.type))==null?void 0:ye.fields[Z];return q?{name:q.name,physicalName:q.physicalName,dataType:q.dataType,length:q.length,shareable:q.shareable,logicalName:q.logicalName}:void 0}const F=(ze=$.embedded)==null?void 0:ze.embeddableRef;if(!F)return;const Ie=(z=o.state.logical.entities.find(q=>q.modelId===F))==null?void 0:z.attributes.flatMap(q=>q.dbAttrs)[Z];return Ie?{physicalName:Ie.physicalName,dataType:Ie.dataType,length:Ie.length,scale:Ie.scale,logicalName:Ie.logicalName}:void 0}function V($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.dataType)||((Ie=$.dbAttrs[Z])==null?void 0:Ie.dataType)||""}function Q($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.length)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.length)}function me($,Z){var F,Ie;return((F=R($,Z))==null?void 0:F.scale)??((Ie=$.dbAttrs[Z])==null?void 0:Ie.scale)}const ve=["inherit","true","false"];function Ee($){return $==="inherit"?o.t("em.common.inherit"):$}function $e($){return($==null?void 0:$.updatable)===void 0?"inherit":$.updatable?"true":"false"}function Me($,Z,F){L($,Z,{updatable:F==="inherit"?void 0:F==="true"})}function Ue($,Z){E($,{updatable:Z==="inherit"?void 0:Z==="true"})}const Ye=["inherit","true","false"];function Fe($){return $==="inherit"?o.t("em.common.inherit"):$}function gt($){return($==null?void 0:$.insertable)===void 0?"inherit":$.insertable?"true":"false"}function w($,Z,F){L($,Z,{insertable:F==="inherit"?void 0:F==="true"})}function M($,Z){E($,{insertable:Z==="inherit"?void 0:Z==="true"})}const I=n.computed(()=>i.value?ui(i.value,o.state.logical.entities):[]),D=n.computed(()=>mn(I.value.flatMap($=>$.attributes.flatMap(Z=>Z.dbAttrs)))),B=n.computed(()=>I.value.flatMap($=>$.attributes.filter(Z=>Z.attrType==="NORMAL"&&Z.dbAttrs.length===1&&Z.dbAttrs[0]).map(Z=>{var F;return{modelId:Z.dbAttrs[0].modelId,physical:Z.dbAttrs[0].physicalName||Z.name,isCurrency:Z.type==="Currency",ownerName:$.modelId===((F=i.value)==null?void 0:F.modelId)?void 0:$.name}})));function de(){const $=[...B.value].sort((Z,F)=>Number(F.isCurrency)-Number(Z.isCurrency));return[Oa,...$.map(Z=>Z.modelId)]}function J($){if($===Oa)return o.t("em.attr.sharedOwn");const Z=B.value.find(Ie=>Ie.modelId===$);if(!Z)return $;const F=Z.ownerName?`${Z.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:F,physical:Z.physical,mode:Z.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function X($){return($==null?void 0:$.sharedColumnRef)??Oa}function te($,Z,F){L($,Z,{sharedColumnRef:F===Oa?void 0:F})}function re($){return($==null?void 0:$.sharedColumnRef)!=null}function Ne($){var Z;return((Z=zn($,D.value))==null?void 0:Z.physicalName)??""}return($,Z)=>i.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(o).editable.value},[n.createElementVNode("h4",F$,[n.createTextVNode(n.toDisplayString(n.unref(o).t("em.attr.section",{n:s.value.length}))+" ",1),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(o).t("em.common.add"),onClick:se},null,8,["caption"]),U.value.length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"120px",placeholder:n.unref(o).t("em.attr.addEmbeddable"),"model-value":ne.value,items:U.value,"value-provider":F=>F.type,"label-provider":ce,"onUpdate:modelValue":ge},null,8,["placeholder","model-value","items","value-provider"])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",H$,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,F=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:F.modelId},[F.attrType==="DIVIDER"?(n.openBlock(),n.createElementBlock("li",G$,[...Z[0]||(Z[0]=[n.createElementVNode("hr",null,null,-1)])])):(n.openBlock(),n.createElementBlock("li",j$,[n.createElementVNode("div",{class:n.normalizeClass(["em-nav__item",{"is-selected":l.value.has(F.modelId)}]),role:"button",tabindex:"0",onClick:Ie=>p(F,Ie),onKeydown:[n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["enter"]),n.withKeys(n.withModifiers(Ie=>p(F,Ie),["prevent"]),["space"])]},[n.createElementVNode("span",Y$,n.toDisplayString(F.name||n.unref(o).t("em.attr.nameless")),1),n.createElementVNode("span",{class:"em-nav__marks",title:f(F)},[u(F).pk?(n.openBlock(),n.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):u(F).required?(n.openBlock(),n.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):n.createCommentVNode("",!0),u(F).fk?(n.openBlock(),n.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):n.createCommentVNode("",!0)],8,W$)],42,K$)]))],64))),128))]),s.value.length&&!d.value.length?(n.openBlock(),n.createElementBlock("p",q$,n.toDisplayString(n.unref(o).t("em.attr.selectHint")),1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,F=>{var Ie,ye,ze,z,q,ue,Ce,Be,Oe,he;return n.openBlock(),n.createElementBlock("div",{key:F.modelId,class:n.normalizeClass(["em-attr",{"is-focused":l.value.has(F.modelId)}]),"data-attr-block":F.modelId},[n.createElementVNode("div",J$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-name-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.namePlaceholder"),"model-value":F.name,"onUpdate:modelValue":le=>k(F,{name:le})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-type-${F.modelId}`,width:"84px",placeholder:n.unref(o).t("em.attr.typePlaceholder"),disabled:F.attrType.startsWith("EMBED")||!!F.groupCode,items:n.unref(Ql)(F.type,O.value),"value-provider":T,"label-provider":H,"model-value":F.type,"onUpdate:modelValue":le=>C(F,le)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),n.createElementVNode("span",{title:m(F)?n.unref(o).t("em.attr.fkDeleteHint"):void 0},[n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:le=>n.unref(o).removeAttribute(i.value.modelId,F.modelId)},null,8,["onClick"])],8,Z$)]),F.type===n.unref(Rt)?(n.openBlock(),n.createElementBlock("div",Q$,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-customtype-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.customTypePlaceholder"),"model-value":F.customType??"","onUpdate:modelValue":le=>ae(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):n.createCommentVNode("",!0),j(F)?(n.openBlock(),n.createElementBlock("div",sR,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.dbAttrs,(le,Pe)=>{var Ke,st,Ze,pt,nt,at;return n.openBlock(),n.createElementBlock("div",{key:le.modelId,class:"em-embed-col"},[n.createElementVNode("span",cR,n.toDisplayString(((Ke=R(F,Pe))==null?void 0:Ke.name)??((st=R(F,Pe))==null?void 0:st.physicalName)??n.unref(o).t("em.attr.colFallback",{n:Pe+1})),1),n.createElementVNode("div",dR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`embed-col-${le.modelId}`,width:"100%",disabled:re(le),placeholder:((Ze=R(F,Pe))==null?void 0:Ze.physicalName)??n.unref(o).t("em.attr.columnPlaceholder"),"model-value":re(le)?Ne(le):le.physicalName,"onUpdate:modelValue":ct=>L(F,Pe,{physicalName:ct})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSTextInput),{name:`embed-dtype-${le.modelId}`,width:"84px",disabled:"","model-value":V(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-len-${le.modelId}`,width:"48px",disabled:"","model-value":Q(F,Pe)},null,8,["name","model-value"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`embed-scale-${le.modelId}`,width:"48px",disabled:"","model-value":me(F,Pe)},null,8,["name","model-value"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":le.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",uR,[n.createVNode(Rn,{class:"grow",name:`embed-logical-${le.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:((nt=(pt=R(F,Pe))==null?void 0:pt.logicalName)==null?void 0:nt.ko)??n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":le.logicalName,"onUpdate:modelValue":ct=>x(F,Pe,ct)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(at=R(F,Pe))!=null&&at.shareable?(n.openBlock(),n.createElementBlock("label",mR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.currencyColumn")),1),n.createVNode(n.unref(oe.BSSelect),{width:"110px","model-value":X(le),items:de(),"value-provider":_,"label-provider":J,"onUpdate:modelValue":ct=>ct&&te(F,Pe,ct)},null,8,["model-value","items","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",fR,[Z[3]||(Z[3]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":gt(le),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":ct=>ct&&w(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",pR,[Z[4]||(Z[4]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"110px",disabled:re(le),"model-value":re(le)?"false":$e(le),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":ct=>ct&&Me(F,Pe,ct)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createElementVNode("div",eR,[n.createVNode(Rn,{class:"grow",name:`attr-logical-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,placeholder:n.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Ie=F.dbAttrs[0])==null?void 0:Ie.logicalName,"onUpdate:modelValue":le=>S(F,le)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),n.createElementVNode("div",tR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`attr-col-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.columnPlaceholder"),disabled:v(F),"model-value":((ye=F.dbAttrs[0])==null?void 0:ye.physicalName)??"","onUpdate:modelValue":le=>E(F,{physicalName:le})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{name:`attr-dtype-${F.modelId}`,width:"84px",placeholder:"dataType",disabled:v(F),items:n.unref(Jl)(((ze=F.dbAttrs[0])==null?void 0:ze.dataType)??"",n.unref(o).selectableDataTypes.value),"value-provider":_,"label-provider":n.unref(qa),"model-value":((z=F.dbAttrs[0])==null?void 0:z.dataType)??"","onUpdate:modelValue":le=>le&&E(F,{dataType:le})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-len-${F.modelId}`,width:"48px",placeholder:"len",disabled:v(F),"model-value":(q=F.dbAttrs[0])==null?void 0:q.length,"onUpdate:modelValue":le=>E(F,{length:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSNumberInput),{name:`attr-scale-${F.modelId}`,width:"48px",placeholder:"scale",disabled:v(F)||!Y(F),"model-value":(ue=F.dbAttrs[0])==null?void 0:ue.scale,"onUpdate:modelValue":le=>E(F,{scale:le||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),n.createVNode($n,{controller:n.unref(o),"ref-id":(Ce=F.dbAttrs[0])==null?void 0:Ce.modelId},null,8,["controller","ref-id"]),n.createElementVNode("div",nR,[n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-pk-${F.modelId}`,label:"Primary Key","model-value":F.identifier,disabled:r.value||v(F),"onUpdate:modelValue":le=>G(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nn-${F.modelId}`,label:"Not Null","model-value":F.notNull,disabled:v(F),"onUpdate:modelValue":le=>k(F,{notNull:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-uq-${F.modelId}`,label:"Unique","model-value":!!((Be=F.dbAttrs[0])!=null&&Be.unique),disabled:v(F),"onUpdate:modelValue":le=>E(F,{unique:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-ai-${F.modelId}`,label:"Auto Increment","model-value":!!((Oe=F.dbAttrs[0])!=null&&Oe.autoIncrement),disabled:v(F)||!F.identifier,"onUpdate:modelValue":le=>E(F,{autoIncrement:le})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-tr-${F.modelId}`,label:"@Transient","model-value":!!F.transient,disabled:F.identifier,"onUpdate:modelValue":le=>K(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-nid-${F.modelId}`,label:"@NaturalId","model-value":!!F.naturalId,disabled:F.identifier||v(F),"onUpdate:modelValue":le=>P(F,le)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${F.modelId}`,label:"mutable","model-value":!!F.naturalIdMutable,disabled:v(F)||!F.naturalId,"onUpdate:modelValue":le=>k(F,{naturalIdMutable:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`attr-mv-${F.modelId}`,label:"Multi-Value (Set)","model-value":!!((he=F.dbAttrs[0])!=null&&he.multiValue),disabled:v(F),"onUpdate:modelValue":le=>E(F,{multiValue:le||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),n.createElementVNode("label",oR,[Z[1]||(Z[1]=n.createElementVNode("span",null,"insertable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":gt(F.dbAttrs[0]),items:Ye,"value-provider":_,"label-provider":Fe,"onUpdate:modelValue":le=>le&&M(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",iR,[Z[2]||(Z[2]=n.createElementVNode("span",null,"updatable",-1)),n.createVNode(n.unref(oe.BSSelect),{width:"100%",disabled:v(F),"model-value":$e(F.dbAttrs[0]),items:ve,"value-provider":_,"label-provider":Ee,"onUpdate:modelValue":le=>le&&Ue(F,le)},null,8,["disabled","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",aR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":ee(F),items:y,"value-provider":_,"label-provider":g,"onUpdate:modelValue":le=>le&&ie(F,le)},null,8,["model-value","onUpdate:modelValue"])]),pe.value.length?(n.openBlock(),n.createElementBlock("label",rR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.codeGroup")),1),n.createVNode(Uu,{"model-value":F.groupCode,items:pe.value,locale:n.unref(o).uiLocale.value,"onUpdate:modelValue":le=>fe(F,le)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):n.createCommentVNode("",!0),n.createElementVNode("label",{class:n.normalizeClass(["em-attr__pii",{"em-attr__codetop":!pe.value.length}])},[n.createElementVNode("span",null,n.toDisplayString(n.unref(o).t("em.attr.defaultValue")),1),be(F).length?(n.openBlock(),n.createBlock(n.unref(oe.BSSelect),{key:0,width:"100%","model-value":F.defaultValue??"none",items:xe(F),"value-provider":Te,"label-provider":Ae,"onUpdate:modelValue":le=>le&&ke(F,le)},null,8,["model-value","items","onUpdate:modelValue"])):(n.openBlock(),n.createBlock(n.unref(oe.BSTextInput),{key:1,name:`attr-default-${F.modelId}`,width:"100%",placeholder:n.unref(o).t("em.attr.defaultValue"),"model-value":F.defaultValue??"","onUpdate:modelValue":le=>we(F,le)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2),n.createElementVNode("fieldset",lR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(o).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`attr-desc-${F.modelId}`,languages:n.unref(o).languages.value,"default-lang":n.unref(o).userLanguage.value,"model-value":F.description,"onUpdate:modelValue":le=>W(F,le)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),n.createElementVNode("div",hR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(F)===null}]),title:n.unref(o).t("em.swatch.none"),onClick:le=>h(F,null)},"∅",10,yR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),le=>(n.openBlock(),n.createElementBlock("button",{key:le,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":b(F)===le}]),style:n.normalizeStyle({background:n.unref(ao)(le)}),title:n.unref(io)(le),onClick:Pe=>h(F,le)},null,14,gR))),128)),N(F)?(n.openBlock(),n.createElementBlock("span",bR,n.toDisplayString(n.unref(o).t("em.attr.batchHint",{n:l.value.size})),1)):n.createCommentVNode("",!0)])],10,X$)}),128))],8,U$)):n.createCommentVNode("",!0)}}),[["__scopeId","data-v-7fd67ee7"]]),kR=["disabled"],ER={class:"em-panel__sub-label"},NR={class:"em-attr__row"},wR={class:"em-field em-idx-params"},vR=["value","placeholder","onChange"],xR=Ge(n.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),l=n.computed(()=>r.value?go(r.value,a.superClassCatalog.value):[]),s=n.computed(()=>{var g;return[...(((g=r.value)==null?void 0:g.attributes)??[]).map(_=>({value:_.modelId,label:_.name})),...l.value.map(_=>({value:_.modelId,label:a.t("em.index.inherited",{field:_.field})}))]});function c(){var _;if(!r.value)return;const g=r.value.attributes[0];a.addIndex(r.value.modelId,{modelId:De(),name:`idx_${(((_=r.value.indexes)==null?void 0:_.length)??0)+1}`,unique:!1,columns:g?[{columnRef:g.modelId,descending:!1}]:[]})}function d(g,_){r.value&&a.updateIndex(r.value.modelId,g,_)}function u(g){var b;const _=(b=r.value)==null?void 0:b.attributes[0];_&&d(g.modelId,{columns:[...g.columns,{columnRef:_.modelId,descending:!1}]})}function m(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,columnRef:b}:N)})}function f(g,_,b){d(g.modelId,{columns:g.columns.map((N,h)=>h===_?{...N,descending:b}:N)})}function p(g,_){d(g.modelId,{columns:g.columns.filter((b,N)=>N!==_)})}function y(g,_){d(g.modelId,{parameters:_.trim()===""?void 0:_})}return(g,_)=>{var b;return r.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:_[0]||(_[0]=N=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",ER,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.index.section",{n:((b=r.value.indexes)==null?void 0:b.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:n.withModifiers(c,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(r.value.indexes??[],N=>(n.openBlock(),n.createElementBlock("div",{key:N.modelId,class:"em-attr"},[n.createElementVNode("div",NR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`idx-name-${N.modelId}`,width:"100%",placeholder:n.unref(a).t("em.index.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":h=>d(N.modelId,{name:h})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-uq-${N.modelId}`,class:"em-check",label:"UQ","model-value":N.unique,"onUpdate:modelValue":h=>d(N.modelId,{unique:h})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:h=>n.unref(a).removeIndex(r.value.modelId,N.modelId)},null,8,["onClick"])]),n.createVNode($n,{controller:n.unref(a),"ref-id":N.modelId},null,8,["controller","ref-id"]),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(N.columns,(h,k)=>(n.openBlock(),n.createElementBlock("div",{key:k,class:"em-attr__row"},[n.createVNode(n.unref(oe.BSSelect),{class:"grow","model-value":h.columnRef,items:s.value,"value-provider":P=>P.value,"label-provider":P=>P.label,"onUpdate:modelValue":P=>P&&m(N,k,P)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`idx-${N.modelId}-desc-${k}`,class:"em-check",label:"DESC","model-value":h.descending,"onUpdate:modelValue":P=>f(N,k,P)},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:"−",onClick:P=>p(N,k)},null,8,["onClick"])]))),128)),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.index.addColumn"),onClick:h=>u(N)},null,8,["caption","onClick"]),n.createElementVNode("label",wR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.index.condition")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.parameters??"",rows:"2",placeholder:n.unref(a).t("em.index.conditionPlaceholder"),onChange:h=>y(N,h.target.value)},null,40,vR)])]))),128)):n.createCommentVNode("",!0)],8,kR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d883aded"]]),IR=["disabled"],CR={class:"em-panel__sub-label"},SR={class:"em-attr__row"},$R={class:"em-attr__row"},RR={class:"em-multilang"},AR={class:"em-attr__pii"},TR={class:"em-swatch__row em-attr__swatch"},VR=["title","onClick"],MR=["title","onClick"],BR=Ge(n.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=oe.useModal(),l=n.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=n.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function u(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function f(h,k){l.value&&a.updateOperation(l.value.modelId,h.modelId,k)}function p(h,k){f(h,{description:Object.keys(k).length?k:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function g(h,k){f(h,{personalInfoAttributeType:k==="none"?void 0:k})}function _(h){var k,P;return ut((P=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:P[h.modelId])}function b(h,k){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,k)}function N(h){r.openModal({component:Fu,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:k=>f(h,{sourceCode:k})}})}return(h,k)=>{var P;return l.value?(n.openBlock(),n.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!n.unref(a).editable.value},[n.createElementVNode("h4",{class:n.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=A=>e.collapsible&&i("toggle"))},[n.createElementVNode("span",CR,[e.collapsible?(n.openBlock(),n.createBlock(Ve,{key:0,name:"chevron",size:13,class:n.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.op.section",{n:((P=l.value.operations)==null?void 0:P.length)??0})),1)]),n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t("em.common.add"),onClick:k[0]||(k[0]=n.withModifiers(A=>n.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(l.value.operations??[],A=>(n.openBlock(),n.createElementBlock("div",{key:A.modelId,class:"em-attr"},[n.createElementVNode("div",SR,[n.createVNode(n.unref(oe.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:n.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":G=>f(A,{name:G})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":G=>G&&f(A,{visibility:G})},null,8,["model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:G=>n.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),n.createElementVNode("div",$R,[n.createVNode(n.unref(oe.BSButton),{variant:"text",caption:n.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:G=>N(A)},null,8,["caption","onClick"])]),n.createElementVNode("fieldset",RR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createVNode(Rn,{multiline:"",name:`op-desc-${A.modelId}`,languages:n.unref(a).languages.value,"default-lang":n.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":G=>p(A,G)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),n.createElementVNode("label",AR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.attr.pii")),1),n.createVNode(n.unref(oe.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":G=>G&&g(A,G)},null,8,["model-value","onUpdate:modelValue"])]),n.createElementVNode("div",TR,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:n.unref(a).t("em.swatch.none"),onClick:G=>b(A,null)},"∅",10,VR),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),G=>(n.openBlock(),n.createElementBlock("button",{key:G,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":_(A)===G}]),style:n.normalizeStyle({background:n.unref(ao)(G)}),title:n.unref(io)(G),onClick:K=>b(A,G)},null,14,MR))),128))])]))),128)):n.createCommentVNode("",!0)],8,IR)):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-394829bc"]]),DR=["title"],OR={class:"em-panel__head"},LR={class:"em-panel__head-row"},PR=["title"],zR={class:"em-panel__context"},UR={key:0,class:"em-panel__lock"},FR=["disabled"],HR={key:0,class:"em-panel__note"},GR={key:1,class:"em-panel__note"},jR={key:2,class:"em-jpa"},KR={class:"em-field"},YR={class:"em-field"},WR={class:"em-field"},qR={key:0,class:"em-field"},XR={class:"em-panel__note"},JR={class:"em-panel__sub"},ZR={class:"em-field"},QR={class:"em-jpa"},eA={key:0,class:"em-panel__note"},tA={class:"em-jpa"},nA={class:"em-field"},oA={key:0,class:"em-panel__note"},iA={class:"em-field"},aA={class:"em-multilang"},rA={class:"em-field"},lA=["value"],sA={class:"em-field"},cA={class:"em-swatch"},dA={class:"em-swatch__row"},uA=["title"],mA=["title","onClick"],fA={class:"em-panel__note"},pA={class:"em-field"},hA=["value"],yA={class:"em-swatch"},gA={class:"em-swatch__row"},bA=["title"],_A=["title","onClick"],mf=Ge(n.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.computed(()=>a.selection.value),l=n.computed(()=>a.inspectedEntityId.value),s=n.computed(()=>{const x=l.value;return x?a.state.logical.entities.find(R=>R.modelId===x)??null:null}),c=n.computed(()=>{const x=r.value;if((x==null?void 0:x.kind)==="association"){const V=a.state.logical.associations.find(Q=>Q.modelId===x.id);return!!V&&(a.isEntityLocked(V.end1.entityRef)||a.isEntityLocked(V.end2.entityRef))}const R=l.value;return!!R&&a.isEntityLocked(R)}),d=n.computed(()=>{var x;return((x=a.selectedAttr.value)==null?void 0:x.attrId)??null}),u=n.computed(()=>new Set(a.selectedAttrIds.value)),m=n.computed(()=>d.value!==null),f=n.ref({});n.watch(m,()=>{f.value={}});function p(x){return f.value[x]??m.value}function y(x){f.value={...f.value,[x]:!p(x)}}const g=n.computed(()=>{var V;const x=s.value;if(!x)return a.t("em.entity.fallback");const R=(V=x.table)==null?void 0:V.physicalName;return R?`${x.name} (${R})`:x.name}),_=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="association"?a.state.logical.associations.find(R=>R.modelId===x.id)??null:null}),b=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="group"?a.state.logical.groups.find(R=>R.modelId===x.id)??null:null}),N=n.computed(()=>{const x=r.value;return(x==null?void 0:x.kind)==="note"?a.state.layout.notes.find(R=>R.modelId===x.id)??null:null}),h=n.computed(()=>{var R,V;const x=(R=b.value)==null?void 0:R.name;return(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||((V=b.value)==null?void 0:V.packageName)||a.t("em.group.fallback")}),k=n.computed(()=>{if(s.value){const x=u.value.size;if(x>1)return a.t("em.inspector.ctxEntityAttrs",{name:s.value.name,n:x});if(d.value){const R=s.value.attributes.find(V=>V.modelId===d.value);return(R==null?void 0:R.attrType)==="DIVIDER"?a.t("em.inspector.ctxEntityDivider",{name:s.value.name}):a.t("em.inspector.ctxEntityAttr",{name:s.value.name,attr:(R==null?void 0:R.name)??""})}return a.t("em.inspector.ctxEntity",{name:s.value.name})}if(_.value){const x=R=>{var V;return((V=a.state.logical.entities.find(Q=>Q.modelId===R))==null?void 0:V.name)??R};return a.t("em.inspector.ctxAssoc",{a:x(_.value.end1.entityRef),b:x(_.value.end2.entityRef)})}return b.value?a.t("em.inspector.ctxGroup",{name:h.value}):N.value?a.t("em.inspector.ctxNote"):a.t("em.inspector.ctxNone")}),P=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],A=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],G={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},K=x=>{const R=G[x];return R?a.t(R):x},v=x=>{var R;return((R=a.state.logical.entities.find(V=>V.modelId===x))==null?void 0:R.name)??x},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],H=["LIST","SET"],C=["inherit","LAZY","EAGER"],ae=x=>x;function E(x){return x==="inherit"?a.t("em.common.inherit"):x}const Y=n.computed(()=>!!_.value&&_.value.end1.entityRef===_.value.end2.entityRef);function S(x,R){_.value&&a.updateAssociationEnd(_.value.modelId,x,R)}function W(x){_.value&&!Y.value&&a.setAssociationIdentifying(_.value.modelId,x)}function ee(x){var R,V,Q;return!!((Q=(V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.cascadeTypes)!=null&&Q.includes("ALL"))}function ie(x,R,V){var ve,Ee;const Q=(ve=_.value)==null?void 0:ve[x];if(R==="ALL"&&V){S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:["ALL"]}});return}const me=new Set(((Ee=Q==null?void 0:Q.jpa)==null?void 0:Ee.cascadeTypes)??[]);V?me.add(R):me.delete(R),S(x,{jpa:{...Q==null?void 0:Q.jpa,cascadeTypes:[...me]}})}function O(x,R){var Q;const V=(Q=_.value)==null?void 0:Q[x];S(x,{jpa:{...V==null?void 0:V.jpa,...R}})}function U(x){var R,V;return((V=(R=_.value)==null?void 0:R[x].jpa)==null?void 0:V.fetchType)??"inherit"}function ne(x,R){O(x,{fetchType:R==="inherit"?void 0:R})}function ce(x){var V;const R=(V=_.value)==null?void 0:V[x==="end1"?"end2":"end1"];return(R==null?void 0:R.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(R==null?void 0:R.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ge=n.computed(()=>{const x=_.value;if(!x)return null;for(const R of a.state.logical.entities){const V=R.attributes.find(Ee=>{var $e;return(($e=Ee.embedded)==null?void 0:$e.associationRef)===x.modelId&&Ee.attrType==="EMBED_OWN"});if(!V)continue;const Q=x.end2.entityRef===V.embedded.embeddableRef?"end2":"end1",me=x[Q].multiplicity,ve=x[Q].jpa;return{which:Q,cardinality:me,isCollection:me==="ZERO_OR_MORE_INSTANCES"||me==="ONE_OR_MORE_INSTANCES",collectionType:(ve==null?void 0:ve.collectionType)??"LIST",collectionTable:(ve==null?void 0:ve.collectionTable)??"",orderColumn:(ve==null?void 0:ve.orderColumn)??""}}return null});function se(x){_.value&&a.setEmbedCardinality(_.value.modelId,x)}function pe(x){const R=ge.value;R&&O(R.which,x==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function be(x){const R=ge.value;R&&O(R.which,{collectionTable:x.trim()||void 0})}function xe(x){const R=ge.value;R&&O(R.which,{orderColumn:x.trim()||void 0})}function Te(x){b.value&&a.updateGroup(b.value.modelId,x)}function Ae(x,R){var V;Te({name:{...(V=b.value)==null?void 0:V.name,[x]:R}})}const fe=n.computed(()=>{var x;return b.value?ut((x=a.state.layout.groupLayouts.find(R=>R.groupRef===b.value.modelId))==null?void 0:x.style):null});function ke(x){b.value&&a.setGroupSwatch(b.value.modelId,x)}function we(x){N.value&&a.setNoteMemo(N.value.modelId,x)}const j=n.computed(()=>{var x;return ut((x=N.value)==null?void 0:x.style)});function L(x){N.value&&a.setNoteSwatch(N.value.modelId,x)}return(x,R)=>(n.openBlock(),n.createElementBlock("aside",{class:"em-panel",style:n.normalizeStyle({width:e.width+"px"})},[n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:n.unref(a).t("em.panel.resizeWidth"),onPointerdown:R[0]||(R[0]=(...V)=>e.startResize&&e.startResize(...V))},null,42,DR),n.createElementVNode("header",OR,[n.createElementVNode("div",LR,[R[14]||(R[14]=n.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),n.createElementVNode("button",{type:"button",class:"em-panel__btn",title:n.unref(a).t("em.panel.collapse"),onClick:R[1]||(R[1]=V=>i("collapse"))},[n.createVNode(Ve,{name:"panel-right-close",size:16})],8,PR)]),n.createElementVNode("p",zR,n.toDisplayString(k.value),1),c.value&&l.value?(n.openBlock(),n.createElementBlock("div",UR,[n.createVNode(Ve,{name:"lock",size:13}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.panel.lockedBanner")),1),n.unref(a).editable.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:R[2]||(R[2]=V=>n.unref(a).setEntityLocked(l.value,!1))},n.toDisplayString(n.unref(a).t("em.panel.unlock")),1)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!n.unref(a).editable.value||c.value},[s.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(Du,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("basics"),title:g.value,onToggle:R[3]||(R[3]=V=>y("basics"))},null,8,["controller","entity-id","collapsed","title"]),n.createVNode(_R,{controller:n.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),n.createVNode(xR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("index"),onToggle:R[4]||(R[4]=V=>y("index"))},null,8,["controller","entity-id","collapsed"]),n.createVNode(BR,{controller:n.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:p("ops"),onToggle:R[5]||(R[5]=V=>y("ops"))},null,8,["controller","entity-id","collapsed"])],64)):n.createCommentVNode("",!0),_.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createVNode(n.unref(oe.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:n.unref(a).t("em.assoc.identifying"),"model-value":!!_.value.identifying,disabled:Y.value||!!ge.value,"onUpdate:modelValue":W},null,8,["label","model-value","disabled"]),Y.value?(n.openBlock(),n.createElementBlock("p",HR,n.toDisplayString(n.unref(a).t("em.assoc.selfNoIdentifying")),1)):ge.value?(n.openBlock(),n.createElementBlock("p",GR,n.toDisplayString(n.unref(a).t("em.assoc.embedNoIdentifying")),1)):n.createCommentVNode("",!0),ge.value?(n.openBlock(),n.createElementBlock("fieldset",jR,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.embed.legend")),1),n.createElementVNode("label",KR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.embed.cardinality")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.cardinality,items:A,"value-provider":ae,"label-provider":K,"onUpdate:modelValue":R[6]||(R[6]=V=>V&&se(V))},null,8,["model-value"])]),ge.value.isCollection?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",YR,[R[15]||(R[15]=n.createElementVNode("span",null,"collectionType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":ge.value.collectionType,items:H,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":R[7]||(R[7]=V=>V&&pe(V))},null,8,["model-value"])]),n.createElementVNode("label",WR,[R[16]||(R[16]=n.createElementVNode("span",null,"collectionTable",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:n.unref(a).t("em.embed.collectionTablePlaceholder"),"model-value":ge.value.collectionTable,"onUpdate:modelValue":be},null,8,["placeholder","model-value"])]),ge.value.collectionType==="LIST"?(n.openBlock(),n.createElementBlock("label",qR,[R[17]||(R[17]=n.createElementVNode("span",null,"orderColumn",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:n.unref(a).t("em.embed.orderColumnPlaceholder"),"model-value":ge.value.orderColumn,"onUpdate:modelValue":xe},null,8,["placeholder","model-value"])])):n.createCommentVNode("",!0)],64)):n.createCommentVNode("",!0),n.createElementVNode("p",XR,n.toDisplayString(n.unref(a).t("em.embed.ownerFixedNote")),1)])):n.createCommentVNode("",!0),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(["end1","end2"],V=>{var Q,me,ve;return n.withDirectives(n.createElementVNode("div",{key:V,class:"em-end"},[n.createElementVNode("h4",JR,n.toDisplayString(V)+" → "+n.toDisplayString(v(_.value[V].entityRef)),1),ge.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("label",ZR,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.assoc.multiplicity")),1),n.createVNode(n.unref(oe.BSSelect),{"model-value":_.value[V].multiplicity,items:P,"value-provider":ae,"label-provider":ae,"onUpdate:modelValue":Ee=>S(V,{multiplicity:Ee})},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-navigable`,class:"em-check",label:"navigable","model-value":_.value[V].navigable,"onUpdate:modelValue":Ee=>S(V,{navigable:Ee})},null,8,["name","model-value","onUpdate:modelValue"]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-composition`,class:"em-check",label:"composition","model-value":_.value[V].composition,"onUpdate:modelValue":Ee=>S(V,{composition:Ee})},null,8,["name","model-value","onUpdate:modelValue"])],64)),n.createElementVNode("fieldset",QR,[R[18]||(R[18]=n.createElementVNode("legend",null,"cascade",-1)),(n.openBlock(),n.createElementBlock(n.Fragment,null,n.renderList(T,Ee=>{var $e,Me;return n.createVNode(n.unref(oe.BSCheckbox),{key:Ee,name:`${V}-cascade-${Ee}`,class:"em-check",label:Ee,"model-value":!!((Me=($e=_.value[V].jpa)==null?void 0:$e.cascadeTypes)!=null&&Me.includes(Ee)),disabled:Ee!=="ALL"&&ee(V),"onUpdate:modelValue":Ue=>ie(V,Ee,Ue)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ee(V)?(n.openBlock(),n.createElementBlock("p",eA,n.toDisplayString(n.unref(a).t("em.assoc.cascadeAllNote")),1)):n.createCommentVNode("",!0)]),n.createElementVNode("fieldset",tA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.assoc.jpaDetails")),1),n.createElementVNode("label",nA,[R[19]||(R[19]=n.createElementVNode("span",null,"fetchType",-1)),n.createVNode(n.unref(oe.BSSelect),{"model-value":U(V),items:C,"value-provider":ae,"label-provider":E,"onUpdate:modelValue":Ee=>Ee&&ne(V,Ee)},null,8,["model-value","onUpdate:modelValue"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:`${V}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Q=_.value[V].jpa)!=null&&Q.orphanRemoval),disabled:ce(V),"onUpdate:modelValue":Ee=>O(V,{orphanRemoval:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),ce(V)&&((me=_.value[V].jpa)!=null&&me.orphanRemoval)?(n.openBlock(),n.createElementBlock("p",oA,n.toDisplayString(n.unref(a).t("em.assoc.orphanRemovalNote")),1)):n.createCommentVNode("",!0),n.createElementVNode("label",iA,[R[20]||(R[20]=n.createElementVNode("span",null,"orderBy",-1)),n.createVNode(n.unref(oe.BSTextInput),{name:`${V}-orderby`,width:"100%",placeholder:n.unref(a).t("em.assoc.orderByPlaceholder"),"model-value":((ve=_.value[V].jpa)==null?void 0:ve.orderBy)??"","onUpdate:modelValue":Ee=>O(V,{orderBy:Ee.trim()||void 0})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])])]),[[n.vShow,!ge.value||V===ge.value.which]])}),64))],64)):n.createCommentVNode("",!0),b.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createElementVNode("fieldset",aA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.group.nameLegend")),1),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(a).languages.value,V=>{var Q;return n.openBlock(),n.createElementBlock("label",{key:V,class:"em-lang"},[n.createElementVNode("span",null,n.toDisplayString(V),1),n.createVNode(n.unref(oe.BSTextInput),{name:`grp-name-${V}`,width:"100%","model-value":((Q=b.value.name)==null?void 0:Q[V])??"","onUpdate:modelValue":me=>Ae(V,me)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),n.createElementVNode("label",rA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.description")),1),n.createElementVNode("textarea",{class:"em-textarea",value:b.value.description??"",rows:"3",onChange:R[8]||(R[8]=V=>Te({description:V.target.value}))},null,40,lA)]),n.createElementVNode("label",sA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.entity.package")),1),n.createVNode(n.unref(oe.BSTextInput),{name:"grp-package",width:"100%","model-value":b.value.packageName??"","onUpdate:modelValue":R[9]||(R[9]=V=>Te({packageName:V}))},null,8,["model-value"])]),n.createVNode(n.unref(oe.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:n.unref(a).t("em.group.excludeDDL"),"model-value":b.value.excludeDDLGeneration,"onUpdate:modelValue":R[10]||(R[10]=V=>Te({excludeDDLGeneration:V}))},null,8,["label","model-value"]),n.createElementVNode("fieldset",cA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",dA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":fe.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[11]||(R[11]=V=>ke(null))},"∅",10,uA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":fe.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>ke(V)},null,14,mA))),128))])]),n.createElementVNode("p",fA,n.toDisplayString(n.unref(a).t("em.group.members",{n:b.value.memberEntityRefs.length})),1)],64)):n.createCommentVNode("",!0),N.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("label",pA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.common.memo")),1),n.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:R[12]||(R[12]=V=>we(V.target.value))},null,40,hA)]),n.createElementVNode("fieldset",yA,[n.createElementVNode("legend",null,n.toDisplayString(n.unref(a).t("em.common.color")),1),n.createElementVNode("div",gA,[n.createElementVNode("button",{type:"button",class:n.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":j.value===null}]),title:n.unref(a).t("em.swatch.none"),onClick:R[13]||(R[13]=V=>L(null))},"∅",10,bA),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(Sn),V=>(n.openBlock(),n.createElementBlock("button",{key:V,type:"button",class:n.normalizeClass(["em-swatch__chip",{"is-on":j.value===V}]),style:n.normalizeStyle({background:n.unref(ao)(V)}),title:n.unref(io)(V),onClick:Q=>L(V)},null,14,_A))),128))])])],64)):n.createCommentVNode("",!0)],8,FR)],4))}}),[["__scopeId","data-v-4a891fbf"]]),kA=["title"],EA={class:"em-validation__title"},NA=["title","onClick"],wA={key:0,class:"em-validation__body"},vA={class:"em-validation__opt"},xA={key:0,class:"em-validation__empty"},IA={key:1,class:"em-validation__empty"},CA={key:2,class:"em-validation__list"},SA=["onClick"],$A={class:"em-validation__item-msg"},RA={key:0,class:"em-validation__item-entity"},AA=["title","onClick"],TA=["title"],VA=Ge(n.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=n.computed(()=>o.issues.value),a=n.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=wk(g);if(!_)return null;const b=a.value.get(_);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=n.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=n.ref({error:!0,warning:!0,info:!0}),d=n.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=n.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:Bu(o.t,g),category:Ek(o.t,g.ruleId)}))),m=n.ref(!1);function f(g){c.value[g]=!c.value[g]}function p(g){if(!m.value){m.value=!0;return}f(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(n.openBlock(),n.createElementBlock("section",{class:n.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:n.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[n.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=b=>m.value=!m.value)},[n.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:n.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[n.createVNode(Ve,{name:"chevron",size:14,class:n.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),n.createElementVNode("span",EA,n.toDisplayString(n.unref(o).t("em.validation.title")),1)],8,kA),n.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[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:m.value?n.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:n.unref(o).t(l[b].labelKey)}):n.unref(o).t("em.validation.expandPanel"),onClick:N=>p(b)},[n.createVNode(Ve,{name:l[b].icon,size:14},null,8,["name"]),n.createElementVNode("span",null,n.toDisplayString(s.value[b]),1)],10,NA)),64))])]),m.value?(n.openBlock(),n.createElementBlock("div",wA,[n.createElementVNode("label",vA,[n.createVNode(n.unref(oe.BSCheckbox),{name:"val-flag-norel",label:n.unref(o).t("em.validation.checkOrphanEntities"),"model-value":n.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=b=>n.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(n.openBlock(),n.createElementBlock("p",xA,n.toDisplayString(n.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(n.openBlock(),n.createElementBlock("p",IA,n.toDisplayString(n.unref(o).t("em.validation.noVisibleIssues")),1)):(n.openBlock(),n.createElementBlock("ul",CA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,({issue:b,entityName:N,message:h,category:k},P)=>(n.openBlock(),n.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${P}`,class:n.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:A=>y(b)},[n.createVNode(Ve,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),n.createElementVNode("span",$A,[N?(n.openBlock(),n.createElementBlock("span",RA,n.toDisplayString(N),1)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(h),1)]),n.unref(o).hasQuickFix(b)?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:n.unref(o).t("em.validation.quickFixTip"),onClick:n.withModifiers(A=>n.unref(o).applyQuickFix(b),["stop"])},n.toDisplayString(n.unref(o).t("em.validation.quickFix")),9,AA)):n.createCommentVNode("",!0),n.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},n.toDisplayString(k),9,TA)],10,SA))),128))]))])):n.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),MA={class:"em-history"},BA={class:"em-history__head"},DA={class:"em-history__title"},OA={class:"em-history__head-actions"},LA=["title","disabled"],PA=["title"],zA={class:"em-history__filters"},UA={class:"em-history__filter"},FA={class:"em-history__body"},HA={key:0,class:"em-history__empty"},GA={key:1,class:"em-history__empty is-error"},jA={key:2,class:"em-history__empty"},KA={key:3,class:"em-history__list"},YA=["onClick"],WA={class:"em-history__summary"},qA={class:"em-history__seq"},XA={class:"em-history__gmeta"},JA={class:"em-history__who"},ZA={key:0,class:"em-history__time"},QA={key:1,class:"em-history__restored-from"},eT={key:0,class:"em-history__detail"},tT={class:"em-history__action-head"},nT={class:"em-history__action-name"},oT={key:0,class:"em-history__fields"},iT={class:"em-history__fname"},aT={key:0,class:"em-history__old"},rT={class:"em-history__val"},lT={key:1,class:"em-history__restore"},sT={class:"em-history__confirm-msg"},cT=["disabled","onClick"],dT=["disabled"],uT=["onClick"],mT=Ge(n.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const o=e,i=t,a=o.controller,r=n.ref([]),l=n.ref(!1),s=n.ref(null),c=n.ref(!1);async function d(){if(a.historyTransport){l.value=!0,s.value=null;try{r.value=await a.historyTransport(),c.value=!0}catch(O){s.value=O instanceof Error?O.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function u(){await a.whenOpsSettled(),await d()}n.watch(()=>o.open,O=>{O&&u()},{immediate:!0});let m=null;n.watch(()=>a.revision.value,()=>{o.open&&(m&&clearTimeout(m),m=setTimeout(()=>void u(),500))}),n.watch(()=>a.reloadRequest.value,()=>{o.open&&u()});const f=n.computed(()=>new Map(a.state.logical.entities.map(O=>[O.modelId,O]))),p=n.computed(()=>new Map(a.state.logical.associations.map(O=>[O.modelId,O]))),y=n.computed(()=>new Map((a.state.logical.groups??[]).map(O=>{var U;return[O.modelId,O.packageName||((U=O.name)==null?void 0:U.ko)||O.modelId]})));function g(O){var ge,se,pe,be,xe,Te,Ae;const U=p.value.get(O);if(!U)return a.t("em.history.assocFallback");if((ge=U.description)!=null&&ge.trim())return U.description.trim();const ne=(be=(pe=f.value.get((se=U.end1)==null?void 0:se.entityRef))==null?void 0:pe.name)==null?void 0:be.trim(),ce=(Ae=(Te=f.value.get((xe=U.end2)==null?void 0:xe.entityRef))==null?void 0:Te.name)==null?void 0:Ae.trim();return ne&&ce?`${ne}→${ce}`:a.t("em.history.assocFallback")}function _(O){var U,ne,ce,ge;if(O.kind==="entity")return((ne=(U=f.value.get(O.ref))==null?void 0:U.name)==null?void 0:ne.trim())||a.t("em.attr.nameless");if(O.kind==="attribute"||O.kind==="operation"||O.kind==="index"){const se=O.entityRef?f.value.get(O.entityRef):void 0,be=((O.kind==="attribute"?se==null?void 0:se.attributes:O.kind==="operation"?se==null?void 0:se.operations:se==null?void 0:se.indexes)??[]).find(Te=>Te.modelId===O.ref),xe=(ce=se==null?void 0:se.name)==null?void 0:ce.trim();return`${xe?xe+".":""}${((ge=be==null?void 0:be.name)==null?void 0:ge.trim())||O.ref}`}return O.kind==="association"?g(O.ref):O.kind==="associationEnd"?`${g(O.ref)}(${O.end})`:O.kind==="group"?a.t("em.history.groupSubject",{name:y.value.get(O.ref)??O.ref}):O.ref}const b={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},N={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},h=n.ref("all"),k=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],P=n.computed({get:()=>h.value,set:O=>{O&&(h.value=O)}}),A=n.computed(()=>vs(r.value)),G=n.computed(()=>A.value.length?A.value[0].seq:null),K=n.computed(()=>h.value==="all"?A.value:A.value.filter(O=>(O.kind??"edit")===h.value));function v(O){return O===void 0?"—":O===null?a.t("em.history.emptyValue"):typeof O=="object"?JSON.stringify(O):String(O)}function T(O){const U=_(O.subject);if(O.verb==="add")return a.t("em.history.summaryAdd",{name:U});if(O.verb==="remove")return a.t("em.history.summaryRemove",{name:U});if(O.fields.length===1){const ne=O.fields[0];return`${U}.${ne.field} ${ne.oldValue!==void 0?v(ne.oldValue)+"→":""}${v(ne.value)}`}return a.t("em.history.summaryFields",{name:U,n:O.fields.length})}function H(O){return O.actions.length===0?a.t("em.history.noChange"):O.actions.length===1?T(O.actions[0]):a.t("em.history.summaryMore",{summary:T(O.actions[0]),n:O.actions.length-1})}const C=n.ref(new Set);function ae(O){const U=new Set(C.value);U.has(O)?U.delete(O):U.add(O),C.value=U}function E(O){if(O==null)return"";const U=new Date(O);return isNaN(U.getTime())?String(O):U.toLocaleString()}function Y(O){const U=O.author,ne=O.origin;return U&&ne?`${U}(${ne})`:U||(ne?`(${ne})`:"—")}const S=n.ref(null),W=n.ref(!1);function ee(O){S.value=O}async function ie(O){W.value=!0;try{const U=await a.restoreToSeq(O);U.ok||(s.value=a.t("em.history.restoreFailed",{reason:U.reason??a.t("em.history.unknown")}))}finally{W.value=!1,S.value=null}}return(O,U)=>(n.openBlock(),n.createBlock(n.Transition,{name:"em-history"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("section",MA,[n.createElementVNode("header",BA,[n.createElementVNode("div",DA,[n.createVNode(Ve,{name:"undo",size:15}),n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.history.title")),1)]),n.createElementVNode("div",OA,[n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.history.refresh"),disabled:l.value,onClick:U[0]||(U[0]=ne=>d())},[n.createVNode(Ve,{name:"redo",size:15})],8,LA),n.createElementVNode("button",{type:"button",class:"em-history__btn",title:n.unref(a).t("em.common.close"),onClick:U[1]||(U[1]=ne=>i("close"))},[n.createVNode(Ve,{name:"panel-close",size:15})],8,PA)])]),n.createElementVNode("div",zA,[n.createElementVNode("label",UA,[n.createElementVNode("span",null,n.toDisplayString(n.unref(a).t("em.toolbar.displayLabel")),1),n.createVNode(n.unref(oe.BSSelect),{modelValue:P.value,"onUpdate:modelValue":U[2]||(U[2]=ne=>P.value=ne),items:k,"value-provider":ne=>ne.v,"label-provider":ne=>n.unref(a).t(ne.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),n.createElementVNode("div",FA,[l.value&&!c.value?(n.openBlock(),n.createElementBlock("p",HA,n.toDisplayString(n.unref(a).t("em.history.loading")),1)):s.value?(n.openBlock(),n.createElementBlock("p",GA,n.toDisplayString(s.value),1)):K.value.length===0?(n.openBlock(),n.createElementBlock("p",jA,n.toDisplayString(c.value?n.unref(a).t("em.history.emptyLoaded"):n.unref(a).t("em.history.emptyNotLoaded")),1)):(n.openBlock(),n.createElementBlock("ul",KA,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(K.value,ne=>(n.openBlock(),n.createElementBlock("li",{key:ne.seq,class:n.normalizeClass(["em-history__group",[`is-${ne.kind??"edit"}`]])},[n.createElementVNode("div",{class:"em-history__ghead",onClick:ce=>ae(ne.seq)},[n.createVNode(Ve,{name:"chevron",size:13,class:n.normalizeClass(["em-history__chevron",{"is-open":C.value.has(ne.seq)}])},null,8,["class"]),n.createElementVNode("span",{class:n.normalizeClass(["em-history__kind",`is-${ne.kind??"edit"}`])},n.toDisplayString(n.unref(a).t(ne.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),n.createElementVNode("span",WA,n.toDisplayString(H(ne)),1),n.createElementVNode("span",qA,"#"+n.toDisplayString(ne.seq),1)],8,YA),n.createElementVNode("div",XA,[n.createElementVNode("span",JA,n.toDisplayString(Y(ne)),1),ne.ts?(n.openBlock(),n.createElementBlock("span",ZA,n.toDisplayString(E(ne.ts)),1)):n.createCommentVNode("",!0),ne.kind==="restore"&&ne.restoredFromSeq!=null?(n.openBlock(),n.createElementBlock("span",QA,"← #"+n.toDisplayString(ne.restoredFromSeq),1)):n.createCommentVNode("",!0)]),C.value.has(ne.seq)?(n.openBlock(),n.createElementBlock("div",eT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ne.actions,(ce,ge)=>(n.openBlock(),n.createElementBlock("div",{key:ge,class:"em-history__action"},[n.createElementVNode("div",tT,[n.createVNode(Ve,{name:b[ce.subject.kind],size:12},null,8,["name"]),n.createElementVNode("span",nT,n.toDisplayString(_(ce.subject)),1),n.createElementVNode("span",{class:n.normalizeClass(["em-history__verb",`is-${ce.verb}`])},n.toDisplayString(n.unref(a).t(N[ce.verb])),3)]),ce.fields.length?(n.openBlock(),n.createElementBlock("ul",oT,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(ce.fields,(se,pe)=>(n.openBlock(),n.createElementBlock("li",{key:pe,class:"em-history__field"},[n.createElementVNode("span",iT,n.toDisplayString(se.field),1),se.oldValue!==void 0?(n.openBlock(),n.createElementBlock("span",aT,n.toDisplayString(v(se.oldValue)),1)):n.createCommentVNode("",!0),se.oldValue!==void 0?(n.openBlock(),n.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):n.createCommentVNode("",!0),n.createElementVNode("span",rT,n.toDisplayString(v(se.value)),1)]))),128))])):n.createCommentVNode("",!0)]))),128))])):n.createCommentVNode("",!0),n.unref(a).restoreAvailable.value&&ne.seq!==G.value?(n.openBlock(),n.createElementBlock("div",lT,[S.value===ne.seq?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createElementVNode("span",sT,n.toDisplayString(n.unref(a).t("em.history.confirmRestore")),1),n.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:ce=>ie(ne.seq)},n.toDisplayString(n.unref(a).t("em.history.doRestore")),9,cT),n.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:U[3]||(U[3]=ce=>S.value=null)},n.toDisplayString(n.unref(a).t("em.history.cancel")),9,dT)],64)):(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:ce=>ee(ne.seq)},[n.createVNode(Ve,{name:"undo",size:12}),n.createTextVNode(" "+n.toDisplayString(n.unref(a).t("em.history.restoreToHere")),1)],8,uT))])):n.createCommentVNode("",!0)],2))),128))]))])],512),[[n.vShow,e.open]])]),_:1}))}}),[["__scopeId","data-v-45d29598"]]);function fT(e,t){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=t?i:null}function ff(e){const t=n.ref(fT(e.storageKey,e.min)??e.initial),o=n.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=t.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),t.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(t.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:t,dragging:o,startResize:i}}const pT={class:"em-modeler"},hT={class:"em-modeler__body"},yT={class:"em-drawer__inner"},gT={class:"em-drawer__head"},bT={class:"em-drawer__actions"},_T=["title"],kT=["title"],ET=["title"],NT=["title"],wT=["title"],vT=Ge(n.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const t=n.ref(!0),o=n.ref(!0),i=n.ref(!1),{width:a,dragging:r,startResize:l}=ff({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:s,dragging:c,startResize:d}=ff({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=n.ref(null),m=n.ref(null);return(f,p)=>{var y,g,_;return n.openBlock(),n.createElementBlock("div",pT,[n.createVNode(uf,{controller:e.controller,"history-open":i.value,onExportSvg:p[0]||(p[0]=b=>{var N;return(N=u.value)==null?void 0:N.exportSvg()}),onExportPng:p[1]||(p[1]=b=>{var N;return(N=u.value)==null?void 0:N.exportPng()}),onToggleHistory:p[2]||(p[2]=b=>i.value=!i.value)},null,8,["controller","history-open"]),n.createElementVNode("div",hT,[n.createElementVNode("aside",{class:n.normalizeClass(["em-drawer",{"is-collapsed":!t.value}]),style:n.normalizeStyle({width:n.unref(a)+"px"})},[n.createElementVNode("div",yT,[n.createElementVNode("header",gT,[p[10]||(p[10]=n.createElementVNode("span",null,"Diagram Explorer",-1)),n.createElementVNode("div",bT,[(y=m.value)!=null&&y.hasExpandable?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((g=m.value)!=null&&g.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:p[3]||(p[3]=b=>{var N;return(N=m.value)==null?void 0:N.toggleAll()})},[n.createVNode(Ve,{name:(_=m.value)!=null&&_.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,_T)):n.createCommentVNode("",!0),n.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:p[4]||(p[4]=b=>t.value=!1)},[n.createVNode(Ve,{name:"panel-close",size:16})],8,kT)])]),n.createVNode(df,{ref_key:"explorer",ref:m,controller:e.controller},null,8,["controller"])]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":n.unref(r)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:p[5]||(p[5]=(...b)=>n.unref(l)&&n.unref(l)(...b))},null,42,ET),[[n.vShow,t.value]])],6),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:p[6]||(p[6]=b=>t.value=!0)},[n.createVNode(Ve,{name:"panel-open",size:18})],8,NT),[[n.vShow,!t.value]])]),_:1}),n.createElementVNode("div",{class:n.normalizeClass(["em-modeler__canvas",{"is-drawer-open":t.value,"is-resizing":n.unref(r),"is-inspector-collapsed":!o.value}]),style:n.normalizeStyle({"--em-drawer-shift":n.unref(a)-6+"px"})},[n.createVNode(cf,{ref_key:"canvas",ref:u,controller:e.controller},null,8,["controller"])],6),n.withDirectives(n.createVNode(mf,{controller:e.controller,width:n.unref(s),resizing:n.unref(c),"start-resize":n.unref(d),onCollapse:p[7]||(p[7]=b=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[n.vShow,o.value]]),n.createVNode(n.Transition,{name:"em-reopen"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:p[8]||(p[8]=b=>o.value=!0)},[n.createVNode(Ve,{name:"panel-right-open",size:18})],8,wT),[[n.vShow,!o.value]])]),_:1}),n.createVNode(mT,{controller:e.controller,open:i.value,onClose:p[9]||(p[9]=b=>i.value=!1)},null,8,["controller","open"])]),n.createVNode(VA,{controller:e.controller,"panel-width":n.unref(s),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-cce29135"]]);_e.APPLY_MODEL_OPS_INPUT_SCHEMA=Bh,_e.AssociationEdge=dm,_e.CUSTOM_TYPE_VALUE=Rt,_e.CommandStack=mr,_e.DEFAULT_JAVA_TYPE=Xa,_e.DIAGRAM_JSON_FORMAT=tr,_e.DIAGRAM_JSON_VERSION=nr,_e.DiagramCanvas=cf,_e.DiagramExplorer=df,_e.EDITOR=An,_e.EditModeToggle=z$,_e.EditorToolbar=uf,_e.EntityModeler=vT,_e.EntityNode=Wu,_e.GROUP_CODE_ENUM_VALUE=Ln,_e.GroupNode=qu,_e.INHERITED_REF_PREFIX=si,_e.InvalidDiagramJsonError=fn,_e.JAVA_TYPES=di,_e.NoteNode=Xu,_e.OpSyncAdapter=pc,_e.PHYSICAL_NAME_MAX_LENGTH=ko,_e.PropertyPanel=mf,_e.RevCache=fc,_e.SELECTABLE_JAVA_TYPES=Zl,_e.SYMBOLIC_OP_KINDS=hc,_e.SYMBOLIC_OP_SCHEMA=Ic,_e.UI_LOCALES=qk,_e.anchoredEdgePoint=Fa,_e.buildAgentBatch=Dh,_e.buildDiagramSvg=Rl,_e.buildOrthogonalPath=La,_e.buildSelfLoopPath=Bl,_e.buildStraightPath=za,_e.collectSharedColumns=un,_e.commands=nh,_e.computeAutoLayout=Dl,_e.createEditorController=ew,_e.defaultMermaidDialect=Rf,_e.defaultSqlDialect=np,_e.diagramToJson=is,_e.displayLabel=ci,_e.emptyState=Gu,_e.entityModelToDdl=ns,_e.entityModelToMermaid=Ka,_e.entityModelToText=Ul,_e.estimateEntityHeight=Ll,_e.exportDiagramPng=lf,_e.exportDiagramSvg=rf,_e.fromPersisted=Xh,_e.indexColumnsByModelId=mn,_e.isInheritedColumnRef=yo,_e.javaTypeLabel=Pn,_e.makeInheritedColumnRef=Pl,_e.mergeDiagram=_s,_e.mermaidErToImportSource=Kl,_e.migrateLegacyMoney=Dp,_e.newId=De,_e.orthogonalMidpoints=Pa,_e.packEntityBoxes=Ga,_e.parseDiagramJson=as,_e.parseInheritedColumnRef=ja,_e.parseMermaidEr=jl,_e.parseSqlDdl=Wa,_e.physicalNameLengthOverflow=mi,_e.projectActionLog=vs,_e.projectEntityAudit=Ns,_e.projectFieldAudit=Zt,_e.projectInheritedColumns=go,_e.rectExitPoint=Ua,_e.renderDiagramSvg=ls,_e.resolveColumnPhysicalName=fi,_e.resolveDiagram=Vl,_e.resolveQuickFix=ir,_e.resolveSharedColumn=zn,_e.resolveSymbolicOps=vh,_e.restoreDeepEqual=jn,_e.scaffoldEntityJava=pp,_e.segmentMidpoints=Ha,_e.sharedColumnScopeEntities=ui,_e.sideDir=ho,_e.sqlDdlToImportSource=Xl,_e.synthesizeRestoreOps=Yp,_e.toPersisted=dy,_e.toPersistedV2=uy,_e.translate=Ct,_e.uiMessagesEn=Ou,_e.uiMessagesJa=Lu,_e.uiMessagesKo=Pu,_e.validateModel=ts,Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"})}));
60
+ v${-(I.value.height-2*e.maskBorderRadius)}
61
+ a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(Q=>{if(b.value){const ie=sn(b.value),oe=ge=>{if(ge.sourceEvent.type!=="wheel"||!p.value||!y.value)return;const $e=ge.sourceEvent.ctrlKey&&Jo()?10:1,pe=-ge.sourceEvent.deltaY*(ge.sourceEvent.deltaMode===1?.05:ge.sourceEvent.deltaMode?1:.002)*e.zoomStep,Ne=c.value.zoom*2**(pe*$e);y.value.scaleTo(p.value,Ne)},W=ge=>{if(ge.sourceEvent.type!=="mousemove"||!p.value||!y.value)return;const $e=w.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),pe={x:c.value.x-ge.sourceEvent.movementX*$e,y:c.value.y-ge.sourceEvent.movementY*$e},Ne=[[0,0],[m.value.width,m.value.height]],ve=Pl.translate(pe.x,pe.y).scale(c.value.zoom),Te=y.value.constrain()(ve,Ne,d.value);y.value.transform(p.value,Te)},fe=SS().wheelDelta(ge=>el(ge)*(e.zoomStep/10)).on("zoom",e.pannable?W:()=>{}).on("zoom.wheel",e.zoomable?oe:()=>{});ie.call(fe),Q(()=>{ie.on("zoom",null)})}},{flush:"post"});function C(Q){const[ie,oe]=cn(Q);n("click",{event:Q,position:{x:ie,y:oe}})}function se(Q,ie){const oe={event:Q,node:ie,connectedEdges:$n([ie],s.value)};u.miniMapNodeClick(oe),n("nodeClick",oe)}function k(Q,ie){const oe={event:Q,node:ie,connectedEdges:$n([ie],s.value)};u.miniMapNodeDoubleClick(oe),n("nodeDblclick",oe)}function G(Q,ie){const oe={event:Q,node:ie,connectedEdges:$n([ie],s.value)};u.miniMapNodeMouseEnter(oe),n("nodeMouseenter",oe)}function S(Q,ie){const oe={event:Q,node:ie,connectedEdges:$n([ie],s.value)};u.miniMapNodeMouseMove(oe),n("nodeMousemove",oe)}function H(Q,ie){const oe={event:Q,node:ie,connectedEdges:$n([ie],s.value)};u.miniMapNodeMouseLeave(oe),n("nodeMouseleave",oe)}return(Q,ie)=>(t.openBlock(),t.createBlock(t.unref(Xu),{position:Q.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:Q.pannable,zoomable:Q.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:b,width:h.value,height:_.value,viewBox:[x.value.x,x.value.y,x.value.width,x.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:C},[Q.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(Q.ariaLabel),9,VS)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(f),oe=>(t.openBlock(),t.createBlock(AS,{id:oe.id,key:oe.id,f:"",position:oe.computedPosition,dimensions:oe.dimensions,selected:oe.selected,dragging:oe.dragging,style:t.normalizeStyle(oe.style),class:t.normalizeClass(V.value(oe)),color:g.value(oe),"border-radius":Q.nodeBorderRadius,"stroke-color":N.value(oe),"stroke-width":Q.nodeStrokeWidth,"shape-rendering":t.unref(E),type:oe.type,hidden:oe.hidden,onClick:W=>se(W,oe),onDblclick:W=>k(W,oe),onMouseenter:W=>G(W,oe),onMousemove:W=>S(W,oe),onMouseleave:W=>H(W,oe)},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)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:F.value,fill:Q.maskColor,stroke:Q.maskStrokeColor,"stroke-width":Q.maskStrokeWidth,"fill-rule":"evenodd"},null,8,MS)],8,TS))]),_:1},8,["position","class"]))}}),OS=["d"],LS=["cx","cy","onDblclick"],PS=["x","y","onPointerdown","onDblclick"],zS=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=Ge(),i=t.inject(kl),a=t.inject(Bn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(mo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),m=t.ref({x:0,y:0}),u=t.computed(()=>c.value.map((z,w)=>w===d.value?m.value:z)),{source:p,target:y,sourceSide:f,targetSide:b}=Sm({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>u.value}),h=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Ka(p.value,f.value,u.value,y.value,b.value):qa(p.value,u.value,y.value)),_=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Ya(p.value,f.value,u.value,y.value,b.value):Ja(p.value,u.value,y.value).map((z,w)=>({point:z,segIndex:w})):[]),E=t.computed(()=>r.value?u.value:[]);function g(z,w){d.value=z,m.value={...c.value[z]},w.target.setPointerCapture(w.pointerId),w.stopPropagation()}function N(z){if(d.value<0)return;const w=o({x:z.clientX,y:z.clientY});m.value={x:w.x,y:w.y}}function V(z){var w,x;d.value>=0&&i&&i.movePoint(n.id,d.value,{...m.value}),d.value=-1,(x=(w=z.target).releasePointerCapture)==null||x.call(w,z.pointerId)}function T(z,w){w.stopPropagation(),i==null||i.removePoint(n.id,z)}function I(z,w){if(!i)return;const x=o({x:w.clientX,y:w.clientY});i.insertPoint(n.id,z,{x:x.x,y:x.y})}return(z,w)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:h.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,OS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(x,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${F}`,cx:x.point.x,cy:x.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(C=>I(x.segIndex,C),["stop"])},null,42,LS))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(x,F)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${F}`,x:x.x-5,y:x.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:C=>g(F,C),onPointermove:N,onPointerup:V,onDblclick:C=>T(F,C)},null,42,PS))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),US=["data-theme"],FS={key:0,class:"em-ctx__sep",role:"separator"},HS={key:1,class:"em-ctx__swatches"},jS={class:"em-ctx__swatches-label"},GS={class:"em-ctx__chips"},KS=["title","onClick"],YS=["title","onClick"],qS=["disabled","onClick"],WS={class:"em-ctx__icon"},XS={class:"em-ctx__caption"},JS=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(b,h)=>St(o.locale??"ko",b,h),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0}),d=8;async function m(b,h){var g;r.value=h,l.value=(g=b.target)!=null&&g.closest('[data-theme="dark"]')?"dark":void 0,c.x=b.clientX,c.y=b.clientY,a.value=!0,window.addEventListener("keydown",p),window.addEventListener("resize",u),await t.nextTick();const _=s.value;if(!_)return;const E=_.getBoundingClientRect();c.x+E.width>window.innerWidth-d&&(c.x=Math.max(d,window.innerWidth-d-E.width)),c.y+E.height>window.innerHeight-d&&(c.y=Math.max(d,window.innerHeight-d-E.height))}function u(){a.value&&(a.value=!1,r.value=[],window.removeEventListener("keydown",p),window.removeEventListener("resize",u))}function p(b){b.key==="Escape"&&(b.stopPropagation(),u())}function y(b){b.disabled||(b.handler(),u())}function f(b,h){b.onPick(h),u()}return t.onBeforeUnmount(u),n({open:m,close:u}),(b,h)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:u,onContextmenu:t.withModifiers(u,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:h[0]||(h[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(_,E)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:E},[_.type==="separator"?(t.openBlock(),t.createElementBlock("div",FS)):_.type==="swatches"?(t.openBlock(),t.createElementBlock("div",HS,[t.createElementVNode("span",jS,t.toDisplayString(_.caption),1),t.createElementVNode("div",GS,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":_.current===null}]),title:i("em.swatch.none"),onClick:g=>f(_,null)},null,10,KS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),g=>(t.openBlock(),t.createElementBlock("button",{key:g,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":_.current===g}]),style:t.normalizeStyle({background:t.unref(so)(g)}),title:t.unref(lo)(g),onClick:N=>f(_,g)},null,14,YS))),128))])])):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":_.danger,"is-disabled":_.disabled}]),disabled:_.disabled,role:"menuitem",onClick:g=>y(_)},[t.createElementVNode("span",WS,[_.icon?(t.openBlock(),t.createBlock(De,{key:0,name:_.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",XS,t.toDisplayString(_.caption),1)],10,qS))],64))),128))],36)],8,US)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-0b8cdb1f"]]),Ul=[".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 yo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function ZS(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function QS(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const f=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(f.width===0&&f.height===0)return[];const b=n(f.left,f.top+f.height/2);return[{...i,x:b.x,y:b.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",m=null,u=0,p=0;const y=()=>{const f=d.trim();if(f){const b=n(u,(m+p)/2);c.push({...i,x:b.x,y:b.y,text:f})}d=""};for(let f=0;f<s.length;f++){a.setStart(r,f),a.setEnd(r,f+1);const b=a.getBoundingClientRect();m===null||Math.abs(b.top-m)>1?(y(),m=b.top,u=b.left,p=b.bottom,d=s[f]):(d+=s[f],p=Math.max(p,b.bottom))}return y(),c}function ja(e,n){const o=[];for(const i of e.querySelectorAll("*"))ZS(i)&&(i.closest(Ul)||yo(i)&&o.push(...QS(i,n)));return o}function ci(e){return Math.round(e*100)/100}function e$(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Ul)||!yo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ci(r.x)}" y="${ci(r.y)}" width="${ci(l.x-r.x)}" height="${ci(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function t$(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!yo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>ci(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function wf(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Ul)||!yo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function di(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function Fl(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function n$(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(y,f)=>e.screenToFlowCoordinate({x:y,y:f}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const y of e.nodes.value){const f=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(y.id)}"]`);if(!f||!yo(f))continue;const b=f.firstElementChild;if(b)if(y.type==="group"){const h=di(b,o);Fl(s,h),i.push({...h,texts:[]});const _=b.querySelector(".em-group__label");_&&i.push({...di(_,o),stroke:"none",texts:[]}),i.push({...h,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ja(b,o)})}else if(y.type==="note"){const h={...di(b,o),texts:ja(b,o),lines:wf(b,b,o)};Fl(s,h),r.push(h)}else{const h=di(b,o);Fl(s,h);const _=h.radius??{tl:0,tr:0};a.push({...h,stroke:"none",texts:[]});const E=b.querySelector(".em-entity__header");if(E){const g=di(E,o);a.push({x:h.x,y:h.y,w:h.w,h:g.y+g.h-h.y,fill:g.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...h,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:ja(b,o),lines:wf(b,b,o),icons:e$(b,o)}),a.push({...h,fill:"none",texts:[]})}}for(const y of n.querySelectorAll(".vue-flow__edge")){const f=y.querySelector("path.em-edge__path, path.em-note-edge__path");if(!f||!yo(f))continue;const b=f.getAttribute("d");if(!b)continue;const h=getComputedStyle(f),_=h.strokeDasharray,E=t$(y);l.push({d:b,stroke:h.stroke,strokeWidth:parseFloat(h.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:ja(y,o),markers:E.length?E:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,m=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-m,y:s.minY-m,w:s.maxX-s.minX+m*2,h:s.maxY-s.minY+m*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Hl(e){return Es(n$(e))}function vf(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function If(e,n="diagram.svg"){const o=Hl(e);vf(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function o$(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function xf(e,n="diagram.png",o=2){const i=Hl(e),{w:a,h:r}=o$(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((u,p)=>{s.onload=()=>u(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const m=await new Promise(u=>c.toBlob(u,"image/png"));if(!m)throw new Error("PNG 변환 실패");vf(m,n)}finally{URL.revokeObjectURL(l)}}const i$={class:"em-shortcuts"},a$={class:"em-shortcuts__title"},r$={class:"em-shortcuts__keys"},l$={class:"em-shortcuts__kbd"},s$={key:0,class:"em-shortcuts__plus"},c$={class:"em-shortcuts__desc"},d$={class:"em-shortcuts__actions"},Cf=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=le.useModalHandle(),i=(s,c)=>St(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(le.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",i$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",a$,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,m=>(t.openBlock(),t.createElementBlock("div",{key:m.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",r$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.keys,(u,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:u+p},[t.createElementVNode("kbd",l$,t.toDisplayString(u),1),p<m.keys.length-1?(t.openBlock(),t.createElementBlock("span",s$,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",c$,t.toDisplayString(m.desc),1)]))),128))]))),128)),t.createElementVNode("div",d$,[t.createVNode(t.unref(le.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-af88f86f"]]);function go(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function u$(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const m$={class:"em-cmdk",role:"dialog","aria-modal":"true"},f$=["placeholder"],p$={class:"em-cmdk__results"},h$={class:"em-cmdk__section"},y$=["onMouseenter","onClick"],g$={class:"em-cmdk__label"},b$={key:0,class:"em-cmdk__tag"},_$={key:1,class:"em-cmdk__sub"},k$={class:"em-cmdk__section"},E$=["onMouseenter","onClick"],N$={class:"em-cmdk__label"},w$={key:1,class:"em-cmdk__empty"},v$=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const g=c.value,N=a.state.logical.entities.map(T=>{var I,z,w,x,F,C;return{type:"goto",kind:"entity",id:T.modelId,label:((z=(I=T.table)==null?void 0:I.logicalName)==null?void 0:z[g])||T.name,sub:(w=T.table)==null?void 0:w.physicalName,match:go(T.name,(F=(x=T.table)==null?void 0:x.logicalName)==null?void 0:F[g],(C=T.table)==null?void 0:C.physicalName)??""}}),V=a.state.logical.groups.map(T=>{var I,z,w,x;return{type:"goto",kind:"group",id:T.modelId,label:((I=T.name)==null?void 0:I[g])||((z=T.name)==null?void 0:z.ko)||T.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:go((w=T.name)==null?void 0:w[g],(x=T.name)==null?void 0:x.ko,T.packageName)??""}});return[...N,...V]}),m={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},u=t.computed(()=>{const g=[];a.editable.value&&(g.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),g.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),g.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),g.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),g.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),g.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),g.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),g.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const N of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])g.push({type:"action",id:`dm-${N}`,label:a.t(m[N]),run:()=>a.displayMode.value=N});return g});function p(g,N){return g.label.toLowerCase().includes(N)}const y=t.computed(()=>{const g=r.value.trim().toLowerCase();return g?d.value.filter(N=>N.match.includes(g)):d.value}),f=t.computed(()=>{const g=r.value.trim().toLowerCase();return g?u.value.filter(N=>p(N,g)):u.value}),b=t.computed(()=>[...y.value,...f.value]);t.watch([y,f],()=>{l.value=0});function h(g){return b.value.indexOf(g)}function _(g){if(g.type==="goto")a.selection.value={kind:g.kind,id:g.id},a.requestFocus(g.id);else{if(g.disabled)return;g.run()}i("close")}function E(g){if(g.key==="Escape"){i("close"),g.preventDefault();return}if(g.key==="ArrowDown"){l.value=Math.min(l.value+1,b.value.length-1),g.preventDefault();return}if(g.key==="ArrowUp"){l.value=Math.max(l.value-1,0),g.preventDefault();return}if(g.key==="Enter"){const N=b.value[l.value];N&&_(N),g.preventDefault()}}return t.nextTick(()=>{var g;return(g=s.value)==null?void 0:g.focus()}),(g,N)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:N[1]||(N[1]=t.withModifiers(V=>i("close"),["self"]))},[t.createElementVNode("div",m$,[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":N[0]||(N[0]=V=>r.value=V),class:"em-cmdk__input",type:"text",placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:E},null,40,f$),[[t.vModelText,r.value]]),t.createElementVNode("div",p$,[b.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[y.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",h$,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,V=>(t.openBlock(),t.createElementBlock("button",{key:V.id,type:"button",class:t.normalizeClass(["em-cmdk__item",{"is-active":h(V)===l.value}]),onMouseenter:T=>l.value=h(V),onClick:T=>_(V)},[t.createElementVNode("span",g$,t.toDisplayString(V.label),1),V.tag?(t.openBlock(),t.createElementBlock("span",b$,t.toDisplayString(V.tag),1)):V.sub?(t.openBlock(),t.createElementBlock("span",_$,t.toDisplayString(V.sub),1)):t.createCommentVNode("",!0)],42,y$))),128))],64)):t.createCommentVNode("",!0),f.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",k$,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,V=>(t.openBlock(),t.createElementBlock("button",{key:V.id,type:"button",class:t.normalizeClass(["em-cmdk__item",{"is-active":h(V)===l.value,"is-disabled":V.disabled}]),onMouseenter:T=>l.value=h(V),onClick:T=>_(V)},[t.createElementVNode("span",N$,t.toDisplayString(V.label),1)],42,E$))),128))],64)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",w$,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])])],32)]))}}),[["__scopeId","data-v-a5a7d1c2"]]);function I$(e){return e?e.kind==="missing"?{title:"편집이 잠겼습니다",detail:"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요."}:{title:"편집이 잠겼습니다",detail:"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요."}:null}const x$={key:0,class:"em-canvas__empty","aria-hidden":"true"},C$={class:"em-canvas__empty-title"},S$=["innerHTML"],$$=["innerHTML"],R$={key:1,class:"em-canvas__empty-title"},A$={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},T$={class:"em-conflict-banner__body"},V$={class:"em-conflict-banner__title"},M$={class:"em-conflict-banner__detail"},B$={key:0,class:"em-toast",role:"status","aria-live":"polite"},jl="nc:",Sf=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=le.useModal(),r=t.ref(!1),l=t.ref(null);let s;t.watch(()=>i.notice.value,P=>{P&&(l.value=P.text,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200))}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const c=t.computed(()=>I$(i.opConflict.value)),d=t.ref(!1),m=t.ref(!1),u={x:0,y:0};function p(P){u.x=P.clientX,u.y=P.clientY}const y=t.ref(null);t.provide(va,y);const f=t.ref(null);t.provide(um,f);const b=t.ref(null),h=t.computed(()=>{const P=b.value,A=new Set;if(!P)return A;if(P.kind==="entity")A.add(P.id);else if(P.kind==="group"){const ce=i.resolved.value.groups.find(Ce=>Ce.group.modelId===P.id);for(const Ce of(ce==null?void 0:ce.group.memberEntityRefs)??[])A.add(Ce)}return A}),_=t.computed(()=>{const P=b.value,A=new Set(h.value),ce=new Set,Ce=new Set;if(!P)return{related:A,edges:ce,notes:Ce};if(P.kind==="note"){Ce.add(P.id);for(const Pe of i.resolved.value.noteConnections)Pe.noteRef===P.id&&A.add(Pe.targetRef);return{related:A,edges:ce,notes:Ce}}const Ve=h.value;if(!Ve.size)return{related:A,edges:ce,notes:Ce};for(const Pe of i.resolved.value.associations){const{end1:we,end2:ze}=Pe.association;(Ve.has(we.entityRef)||Ve.has(ze.entityRef))&&(ce.add(Pe.association.modelId),A.add(we.entityRef),A.add(ze.entityRef))}for(const Pe of i.resolved.value.noteConnections)A.has(Pe.targetRef)&&Ce.add(Pe.noteRef);return{related:A,edges:ce,notes:Ce}});t.provide(mo,{source:b,active:t.computed(()=>b.value!==null),primaryEntityIds:h,relatedEntityIds:t.computed(()=>_.value.related),relatedEdgeIds:t.computed(()=>_.value.edges),relatedNoteIds:t.computed(()=>_.value.notes),hoverGroupId:t.computed(()=>{var P;return((P=b.value)==null?void 0:P.kind)==="group"?b.value.id:null}),setEntityHover:P=>{f.value||m.value||(b.value=P?{kind:"entity",id:P}:null)},setGroupHover:P=>{f.value||m.value||(b.value=P?{kind:"group",id:P}:null)},setNoteHover:P=>{f.value||m.value||(b.value=P?{kind:"note",id:P}:null)}}),t.provide(Bn,i),t.provide(mm,{marks:t.toRef(o,"diffMarks")});function E(P,A){return`${jl}${P}:${A}`}function g(P){if(!P.startsWith(jl))return null;const[A,ce]=P.slice(jl.length).split(":");return A&&ce?{noteRef:A,targetRef:ce}:null}t.provide(kl,{points:P=>{var ce,Ce;const A=g(P);return A?((ce=i.resolved.value.noteConnections.find(Ve=>Ve.noteRef===A.noteRef&&Ve.targetRef===A.targetRef))==null?void 0:ce.waypoints)??[]:((Ce=i.resolved.value.associations.find(Ve=>Ve.association.modelId===P))==null?void 0:Ce.waypoints)??[]},movePoint:(P,A,ce)=>{const Ce=g(P);Ce?i.moveNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,A,ce):i.moveWaypoint(P,A,ce)},insertPoint:(P,A,ce)=>{const Ce=g(P);Ce?i.addNoteConnectionWaypoint(Ce.noteRef,Ce.targetRef,A,ce):i.addWaypoint(P,A,ce)},removePoint:(P,A)=>{const ce=g(P);ce?i.removeNoteConnectionWaypoint(ce.noteRef,ce.targetRef,A):i.removeWaypoint(P,A)}});const N=Ge(),{nodes:V,edges:T,findNode:I,findEdge:z,addNodes:w,addEdges:x,removeNodes:F,removeEdges:C,fitView:se,setCenter:k,getViewport:G,screenToFlowCoordinate:S,getSelectedNodes:H,updateNodeInternals:Q}=N,ie=t.ref(!1);async function oe(P){ie.value=!0,await t.nextTick(),await new Promise(A=>requestAnimationFrame(()=>A(null)));try{return await P()}finally{ie.value=!1}}function W(){return oe(()=>If(N))}function fe(){return oe(()=>xf(N))}n({exportSvg:W,exportPng:fe});const ge=t.computed(()=>i.resolved.value.entities.length===0);function $e(){const P=G(),{width:A,height:ce}=N.dimensions.value;return{x:(A/2-P.x)/P.zoom,y:(ce/2-P.y)/P.zoom}}function pe(){const P=$e();i.addEntity("NewEntity",{x:P.x,y:P.y})}function Ne(){const P=$e();i.addNote("메모",{x:P.x,y:P.y})}function ve(P){for(const A of i.resolved.value.groups){const{location:ce,size:Ce}=A.geo;if(P.x>=ce.x&&P.x<=ce.x+Ce.width&&P.y>=ce.y&&P.y<=ce.y+Ce.height)return A.group.modelId}return null}function Te(){const P=i.resolved.value,A=new Map(P.groups.map(we=>[we.group.modelId,we.geo])),ce=new Set(P.groups.map(we=>we.group.modelId)),Ce=new Set([...ce,...P.entities.map(we=>we.entity.modelId),...P.notes.map(we=>we.note.modelId)]);for(const we of[...V.value])Ce.has(we.id)||F([we.id]);for(const we of P.groups){const ze=we.group.modelId,je={width:`${we.geo.size.width}px`,height:`${we.geo.size.height}px`},he={group:we.group,style:we.style,locked:we.locked},qe=we.locked?!1:void 0,it=I(ze);it?(it.position={...we.geo.location},it.data=he,it.style=je,it.draggable=qe):w([{id:ze,type:"group",position:{...we.geo.location},draggable:qe,style:je,data:he}])}for(const we of P.entities){const ze=we.entity.modelId,je=we.groupRef&&ce.has(we.groupRef)?we.groupRef:void 0,he={entity:we.entity,displayMode:i.displayMode.value,collapsed:we.collapsed,locked:we.locked,groupRef:je,size:we.geo.size,style:we.style,attributeStyles:we.attributeStyles,operationStyles:we.operationStyles},qe=we.locked?!1:void 0,it=we.locked?!1:void 0,pt=je?A.get(je):void 0,ct=pt?{x:we.geo.location.x-pt.location.x,y:we.geo.location.y-pt.location.y}:{...we.geo.location},Je=I(ze);Je?(Je.position=ct,Je.data=he,Je.parentNode=je,Je.draggable=qe,Je.connectable=it):w([{id:ze,type:"entity",position:ct,parentNode:je,draggable:qe,connectable:it,data:he}])}for(const we of P.notes){const ze=we.note,je=ze.modelId,he=we.groupRef&&ce.has(we.groupRef)?we.groupRef:void 0,qe={note:ze,groupRef:he},it={width:`${ze.geo.size.width}px`,height:`${ze.geo.size.height}px`},pt=he?A.get(he):void 0,ct=pt?{x:ze.geo.location.x-pt.location.x,y:ze.geo.location.y-pt.location.y}:{...ze.geo.location},Je=I(je);Je?(Je.position=ct,Je.data=qe,Je.style=it,Je.parentNode=he):w([{id:je,type:"note",position:ct,parentNode:he,style:it,data:qe}])}const Ve=new Map(P.associations.map(we=>[we.association.modelId,we])),Pe=new Set(P.noteConnections.map(we=>E(we.noteRef,we.targetRef)));for(const we of[...T.value])!Ve.has(we.id)&&!Pe.has(we.id)&&C([we.id]);for(const[we,ze]of Ve){const je={id:we,type:"association",source:ze.association.end1.entityRef,target:ze.association.end2.entityRef,sourceHandle:ze.sourceColumnRef?`r:${ze.sourceColumnRef}`:void 0,targetHandle:ze.targetColumnRef?`l:${ze.targetColumnRef}`:void 0,data:{association:ze.association,sourceColumnRef:ze.sourceColumnRef,targetColumnRef:ze.targetColumnRef}},he=z(we);he?(he.data=je.data,he.sourceHandle=je.sourceHandle,he.targetHandle=je.targetHandle):x([je])}for(const we of P.noteConnections){const ze=E(we.noteRef,we.targetRef),je={noteRef:we.noteRef,targetRef:we.targetRef},he=z(ze);he?he.data=je:x([{id:ze,type:"note-connection",source:we.noteRef,target:we.targetRef,data:je}])}re()}function re(){t.nextTick(()=>requestAnimationFrame(()=>Q()))}function _e(){const P=H.value.map(ce=>ce.id);if(P.length)return P;const A=i.selection.value;return A&&(A.kind==="entity"||A.kind==="note"||A.kind==="group")?[A.id]:[]}function me(){return H.value.filter(P=>P.type==="entity").map(P=>P.id)}function ke(){return H.value.filter(P=>P.type==="group").map(P=>P.id)}function ue(P){var A;return[...((A=i.state.logical.groups.find(ce=>ce.modelId===P))==null?void 0:A.memberEntityRefs)??[]]}function L(){const P=ke().flatMap(ue);return[...new Set([...me(),...P])]}function D(){return ke().length>0||me().length>1}function K(){D()?i.copy(L()):i.copy()}async function Z(P){if(!P.length)return;await t.nextTick();const A=H.value;A.length&&N.removeSelectedNodes(A);const ce=P.map(Ce=>I(Ce)).filter(Ce=>!!Ce);ce.length&&N.addSelectedNodes(ce)}function ne(P){if(D()&&me().includes(P)){const A=L();return{caption:i.t("em.ctx.copyN",{n:A.length}),icon:"copy",handler:()=>i.copy(A)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:P},i.copy()}}}function te(P){var Ve;const A=P.target;if(A&&(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.isContentEditable))return;if(P.key==="?"){a.openModal({component:Cf,bind:{locale:i.uiLocale.value}}),P.preventDefault();return}if((P.metaKey||P.ctrlKey)&&P.key.toLowerCase()==="k"){r.value=!0,P.preventDefault();return}if(!i.editable.value){(P.metaKey||P.ctrlKey)&&P.key.toLowerCase()==="c"&&(K(),P.preventDefault());return}if(P.key==="Delete"||P.key==="Backspace"){i.deleteSelection()&&P.preventDefault();return}if(P.key==="ArrowUp"||P.key==="ArrowDown"||P.key==="ArrowLeft"||P.key==="ArrowRight"){if(((Ve=i.selection.value)==null?void 0:Ve.kind)==="attribute"){if(P.key==="ArrowUp"||P.key==="ArrowDown"){const je=P.key==="ArrowDown"?1:-1;(P.altKey?i.nudgeSelectedAttributes(je):i.moveAttributeFocus(je))&&P.preventDefault()}return}const Pe=P.shiftKey?10:1,we=P.key==="ArrowLeft"?-Pe:P.key==="ArrowRight"?Pe:0,ze=P.key==="ArrowUp"?-Pe:P.key==="ArrowDown"?Pe:0;i.nudgeNodes(_e(),we,ze)&&P.preventDefault();return}if(!(P.metaKey||P.ctrlKey))return;const Ce=P.key.toLowerCase();Ce==="c"?(K(),P.preventDefault()):Ce==="v"?(Z(i.paste()),P.preventDefault()):Ce==="z"&&(P.shiftKey?i.redo():i.undo(),P.preventDefault())}t.onMounted(async()=>{Te(),await t.nextTick(),se(),window.addEventListener("keydown",te),window.addEventListener("pointerup",ye),window.addEventListener("pointermove",p,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",te),window.removeEventListener("pointerup",ye),window.removeEventListener("pointermove",p)});function ye(){y.value=null}function J(){m.value=!0,b.value=null}function X(){var Ce;m.value=!1;const P=(Ce=document.elementFromPoint(u.x,u.y))==null?void 0:Ce.closest(".vue-flow__node"),A=P==null?void 0:P.dataset.id;if(!A){b.value=null;return}const ce=P.classList.contains("vue-flow__node-group")?"group":P.classList.contains("vue-flow__node-note")?"note":"entity";b.value={kind:ce,id:A}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],Te),t.watch(()=>i.revision.value,re),t.watch(()=>i.resolved.value,P=>{const A=b.value;if(!A)return;(A.kind==="entity"?P.entities.some(Ce=>Ce.entity.modelId===A.id):A.kind==="group"?P.groups.some(Ce=>Ce.group.modelId===A.id):P.notes.some(Ce=>Ce.note.modelId===A.id))||(b.value=null)});function ee(P){const A=P.computedPosition??P.position,ce=P.dimensions??{width:0,height:0};return{x:A.x+ce.width/2,y:A.y+ce.height/2}}function Re(P){const A=P.node;if(A){if(b.value=null,A.type==="group"){const ce=i.resolved.value.groups.find(Ce=>Ce.group.modelId===A.id);f.value=ce?{groupId:A.id,dx:A.position.x-ce.geo.location.x,dy:A.position.y-ce.geo.location.y}:null,y.value=null;return}if(A.type!=="entity"&&A.type!=="note"){y.value=null;return}y.value=ve(ee(A))}}function Le(P){var Ce;y.value=null,f.value=null;const A=(Ce=P.nodes)!=null&&Ce.length?P.nodes:[P.node],ce=A.filter(Ve=>(Ve==null?void 0:Ve.type)==="group");if(ce.length){for(const Ve of ce){if(!Ve)continue;const Pe=i.resolved.value.entities.filter(we=>we.groupRef===Ve.id).map(we=>{const ze=I(we.entity.modelId),je=(ze==null?void 0:ze.computedPosition)??(ze==null?void 0:ze.position)??{x:0,y:0};return{id:we.entity.modelId,location:{x:je.x,y:je.y}}});i.dragGroup(Ve.id,{x:Ve.position.x,y:Ve.position.y},Pe)}return}for(const Ve of A){if(!Ve||Ve.type==="group")continue;const Pe=Ve.computedPosition??Ve.position,we=Ve.dimensions??{width:0,height:0},ze={x:Pe.x+we.width/2,y:Pe.y+we.height/2};Ve.type==="note"?i.dropNote(Ve.id,{x:Pe.x,y:Pe.y},ve(ze)):i.dropEntity(Ve.id,{x:Pe.x,y:Pe.y},ve(ze))}}function He(P){var je,he,qe,it,pt;if(!i.editable.value||!P.source||!P.target)return;const A=((je=I(P.source))==null?void 0:je.type)==="note",ce=((he=I(P.target))==null?void 0:he.type)==="note";if(A||ce){if(A&&ce)return;const ct=A?P.source:P.target,Je=A?P.target:P.source;((qe=I(Je))==null?void 0:qe.type)==="entity"&&i.addNoteConnection(ct,Je);return}const Ce=ct=>{var Je;return(Je=i.state.logical.entities.find(zn=>zn.modelId===ct))==null?void 0:Je.stereotype},Ve=Ce(P.source)==="JPA_EMBEDDABLE",Pe=Ce(P.target)==="JPA_EMBEDDABLE";if(Ve||Pe){if(Ve&&Pe)return;const ct=Ve?P.source:P.target,Je=Ve?P.target:P.source;i.addEmbedAssociation(Je,ct);return}const we=(it=P.sourceHandle)!=null&&it.startsWith("r:")?P.sourceHandle.slice(2):void 0,ze=(pt=P.targetHandle)!=null&&pt.startsWith("l:")?P.targetHandle.slice(2):void 0;i.addAssociation(P.source,P.target,we,ze)}const Oe=t.ref(null);function et(P,A){var Ce;const ce=i.state.layout.entityLayouts.find(Ve=>Ve.entityRef===P);return ft((Ce=ce==null?void 0:ce.attributeStyles)==null?void 0:Ce[A])}function v(P,A){var Ce;const ce=i.state.layout.entityLayouts.find(Ve=>Ve.entityRef===P);return ft((Ce=ce==null?void 0:ce.operationStyles)==null?void 0:Ce[A])}function M(P){var A;return ft((A=i.state.layout.groupLayouts.find(ce=>ce.groupRef===P))==null?void 0:A.style)}function ae(P){var A;return ft((A=i.state.layout.notes.find(ce=>ce.modelId===P))==null?void 0:A.style)}function de(P){var Ve,Pe;if(P.preventDefault(),!i.editable.value)return;const A=()=>S({x:P.clientX,y:P.clientY}),ce=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const we=A();i.addEntity("NewEntity",{x:we.x,y:we.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const we=A();i.addNote("메모",{x:we.x,y:we.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const we=A();i.addEmptyGroup({x:we.x,y:we.y})}}],Ce=(Ve=i.clipboard.value)==null?void 0:Ve.kind;(Ce==="entity"||Ce==="entities")&&ce.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Z(i.paste())}),i.resolved.value.entities.length>0&&ce.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Pe=Oe.value)==null||Pe.open(P,ce)}function Ie({event:P,node:A}){var je,he,qe,it,pt,ct,Je,zn,ui,ht,Vf,Mf,Bf,Df,Of,Lf,Pf,zf;const ce=P;if(ce.preventDefault(),!i.editable.value){if(A.type==="group"||A.type==="note")return;const Ye=(he=(je=ce.target)==null?void 0:je.closest("[data-attr]"))==null?void 0:he.dataset.attr;if(Ye){const tt=i.selection.value;(tt==null?void 0:tt.kind)==="attribute"&&tt.entityId===A.id&&tt.ids.includes(Ye)||i.selectAttribute(A.id,Ye);const Qt=((qe=i.selection.value)==null?void 0:qe.kind)==="attribute"&&i.selection.value.entityId===A.id?[...i.selection.value.ids]:[Ye];(it=Oe.value)==null||it.open(ce,[{caption:Qt.length>1?i.t("em.ctx.copyN",{n:Qt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(pt=Oe.value)==null||pt.open(ce,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Na(a,i,A.id)},ne(A.id)]);return}if(A.type==="group"){const Ye=i.isGroupLocked(A.id),tt=[];Ye||tt.push({type:"swatches",caption:i.t("em.common.color"),current:M(A.id),onPick:Qt=>i.setGroupSwatch(A.id,Qt)},{type:"separator"});const st=D()&&ke().includes(A.id)?L():ue(A.id);st.length&&tt.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(st)}),tt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(A.id,!Ye)}),Ye||tt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(A.id)}),(ct=Oe.value)==null||ct.open(ce,tt);return}if(A.type==="note"){(Je=Oe.value)==null||Je.open(ce,[{type:"swatches",caption:i.t("em.common.color"),current:ae(A.id),onPick:Ye=>i.setNoteSwatch(A.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(A.id)}]);return}const Ce=(ui=(zn=ce.target)==null?void 0:zn.closest("[data-attr]"))==null?void 0:ui.dataset.attr;if(Ce){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===A.id&&Ye.ids.includes(Ce)||i.selectAttribute(A.id,Ce);const st=((ht=i.selection.value)==null?void 0:ht.kind)==="attribute"&&i.selection.value.entityId===A.id?[...i.selection.value.ids]:[Ce];if(i.isEntityLocked(A.id)){(Vf=Oe.value)==null||Vf.open(ce,[{caption:st.length>1?i.t("em.ctx.copyN",{n:st.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Qt=st.length>1,Gl=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(A.id)},{type:"swatches",caption:Qt?i.t("em.ctx.colorN",{n:st.length}):i.t("em.common.color"),current:Qt?null:et(A.id,Ce),onPick:S2=>i.setAttributeSwatches(A.id,st,S2)},{type:"separator"},{caption:Qt?i.t("em.ctx.copyN",{n:st.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],mi=i.clipboard.value;(mi==null?void 0:mi.kind)==="attribute"&&Gl.push({caption:mi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:mi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.paste()}}),Gl.push({type:"separator"},{caption:Qt?i.t("em.ctx.deleteAttrN",{n:st.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(A.id,st)}),(Mf=Oe.value)==null||Mf.open(ce,Gl);return}const Ve=(Df=(Bf=ce.target)==null?void 0:Bf.closest("[data-op]"))==null?void 0:Df.dataset.op;if(Ve){if(i.isEntityLocked(A.id))return;(Of=Oe.value)==null||Of.open(ce,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(A.id)},{type:"swatches",caption:i.t("em.common.color"),current:v(A.id,Ve),onPick:Ye=>i.setOperationSwatch(A.id,Ve,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(A.id,Ve)}]);return}const Pe=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===A.id),we=!!(Pe!=null&&Pe.locked),ze=[{caption:we?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Na(a,i,A.id)}];if(!we){ze.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(A.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(A.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const tt=H.value.filter(st=>st.type==="entity").map(st=>st.id);i.createGroup(tt.includes(A.id)&&tt.length?tt:[A.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(A.id,A.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){ze.push({type:"separator"});for(const tt of Ye){const st=((Lf=tt.label)==null?void 0:Lf.ko)??((Pf=tt.label)==null?void 0:Pf.en)??tt.type;ze.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:st}),icon:"link",handler:()=>i.addPredefinedEmbed(A.id,tt.type)})}}}if(ze.push({type:"separator"}),ze.push({caption:Pe!=null&&Pe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Pe!=null&&Pe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(A.id,!(Pe!=null&&Pe.collapsed))}),Pe!=null&&Pe.groupRef&&!we&&ze.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(A.id)}),ze.push({caption:we?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:we?"unlock":"lock",handler:()=>i.setEntityLocked(A.id,!we)}),ze.push(ne(A.id)),!we){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&ze.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:A.id},i.paste()}}),ze.push({type:"separator"}),ze.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(A.id)})}(zf=Oe.value)==null||zf.open(ce,ze)}function O({event:P,edge:A}){var Ve,Pe;const ce=P;if(ce.preventDefault(),!i.editable.value)return;const Ce=g(A.id);if(Ce){(Ve=Oe.value)==null||Ve.open(ce,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(Ce.noteRef,Ce.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(Ce.noteRef,Ce.targetRef)}]);return}(Pe=Oe.value)==null||Pe.open(ce,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(A.id)},{type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(A.id)}])}function U(P){return P==="group"?"group":P==="note"?"note":"entity"}function R({node:P}){if(H.value.length>1){i.selection.value=null;return}i.selection.value={kind:U(P.type),id:P.id}}function be({nodes:P}){P.length>1&&(i.selection.value=null)}function Se({edge:P}){const A=g(P.id);i.selection.value=A?{kind:"note",id:A.noteRef}:{kind:"association",id:P.id}}function Ae(P){const A=i.selection.value;return!!A&&A.kind!=="attribute"&&A.id===P.id}function j(P){var A,ce;return Ae(P)?P.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":P.type==="note"?"var(--em-note-soft)":P.type==="group"?Zu(ft((A=P.data)==null?void 0:A.style),!0)??"var(--em-mm-group)":Zu(ft((ce=P.data)==null?void 0:ce.style))??"var(--em-mm-entity)"}function Y(P){return Ae(P)?"var(--em-selection)":P.type==="note"?"var(--em-note-accent)":P.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function B(P,A){k(P,A,{zoom:G().zoom,duration:350})}t.watch(()=>i.focusRequest.value,P=>{if(!P)return;const A=I(P.id);if(!A)return;const ce=A.computedPosition??A.position,Ce=A.dimensions??{width:0,height:0};B(ce.x+Ce.width/2,ce.y+Ce.height/2)});function q({position:P}){B(P.x,P.y)}function $({node:P}){i.selection.value={kind:U(P.type),id:P.id};const A=P.computedPosition??P.position,ce=P.dimensions??{width:0,height:0};B(A.x+ce.width/2,A.y+ce.height/2)}function xe({node:P}){se({nodes:[P.id],duration:350,maxZoom:1.2,padding:.6})}return(P,A)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-canvas",{"is-connecting":d.value,"is-panning":m.value}])},[t.createVNode(t.unref(z0),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ie.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(qt).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:J,onMoveEnd:X,onConnect:He,onConnectStart:A[1]||(A[1]=ce=>d.value=!0),onConnectEnd:A[2]||(A[2]=ce=>d.value=!1),onNodeDrag:Re,onNodeDragStop:Le,onNodeClick:R,onEdgeClick:Se,onSelectionChange:be,onPaneClick:A[3]||(A[3]=ce=>t.unref(i).selection.value=null),onPaneContextMenu:de,onNodeContextMenu:Ie,onEdgeContextMenu:O},{"node-group":t.withCtx(ce=>[t.createVNode(pm,t.normalizeProps(t.guardReactiveProps(ce)),null,16)]),"node-entity":t.withCtx(ce=>[t.createVNode(fm,t.normalizeProps(t.guardReactiveProps(ce)),null,16)]),"node-note":t.withCtx(ce=>[t.createVNode(hm,t.normalizeProps(t.guardReactiveProps(ce)),null,16)]),"edge-association":t.withCtx(ce=>[t.createVNode($m,t.normalizeProps(t.guardReactiveProps(ce)),null,16)]),"edge-note-connection":t.withCtx(ce=>[t.createVNode(zS,t.normalizeProps(t.guardReactiveProps(ce)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Sv),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(eI),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(Dn),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:pe},{default:t.withCtx(()=>[t.createVNode(De,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Dn),{title:t.unref(i).t("em.ctx.addNote"),onClick:Ne},{default:t.withCtx(()=>[t.createVNode(De,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Dn),{title:t.unref(i).t("em.palette.autoLayout"),onClick:A[0]||(A[0]=ce=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(De,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(DS),{key:1,pannable:"",width:224,height:160,"node-color":j,"node-stroke-color":Y,"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:q,onNodeClick:$,onNodeDblclick:xe})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ge.value?(t.openBlock(),t.createElementBlock("div",x$,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",C$,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,S$),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,$$)],64)):(t.openBlock(),t.createElementBlock("p",R$,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(v$,{key:1,controller:t.unref(i),onClose:A[4]||(A[4]=ce=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[c.value?(t.openBlock(),t.createElementBlock("div",A$,[t.createVNode(De,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",T$,[t.createElementVNode("strong",V$,t.toDisplayString(c.value.title),1),t.createElementVNode("span",M$,t.toDisplayString(c.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(JS,{ref_key:"menuRef",ref:Oe,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",B$,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-e7e32c26"]]),D$={class:"em-explorer em-scroll-overlay"},O$={class:"em-explorer__search"},L$=["placeholder","aria-label"],P$=["aria-label","title"],z$={key:0,class:"em-explorer__empty"},U$={class:"em-explorer__rows"},F$=["data-key","onClick","onDblclick"],H$=["onClick"],j$=["title"],G$={class:"em-key-slot"},K$={class:"em-key-slot"},Y$={class:"em-explorer__label"},$f=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{}},setup(e,{expose:n}){const i=e.controller,a=le.useModal(),r=t.computed(()=>{var oe;const T=i.resolved.value,I=i.displayMode.value,z=i.userLanguage.value,w=W=>{var fe,ge,$e;return pi(I,W.name,(ge=(fe=W.table)==null?void 0:fe.logicalName)==null?void 0:ge[z],($e=W.table)==null?void 0:$e.physicalName,i.t("em.node.logicalMissing"))},x=I==="PHYSICAL"||I==="LOGICAL_PHYSICAL",F=W=>{const fe=W.attrType.startsWith("RELATION")&&W.dbAttrs.length>0;return{icon:W.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:W.identifier,fk:fe&&x}}},C=W=>W.attrType.startsWith("EMBED")&&W.dbAttrs.length>0,se=I==="PHYSICAL"||I==="LOGICAL_PHYSICAL",k=W=>{if(W.attrType!=="EMBED_PREDEF")return W.dbAttrs;const fe=i.embeddableCatalog.value.find(ge=>ge.type===W.type);return fe?W.dbAttrs.map((ge,$e)=>{const pe=fe.fields[$e];return pe?{...ge,physicalName:ge.physicalName||pe.physicalName,logicalName:ge.logicalName??pe.logicalName,dataType:ge.dataType||pe.dataType,length:ge.length??pe.length}:ge}):W.dbAttrs},G=(W,fe)=>{var Ne,ve,Te,re,_e,me,ke,ue,L;const ge={entityId:fe,attrId:W.modelId};if(C(W)){const D=rr(I,W);return{key:`attr:${W.modelId}`,label:W.name+(D?` : ${D}`:""),icon:"table",attrRef:ge,focusId:fe,matchText:go(W.name,(ve=(Ne=W.dbAttrs[0])==null?void 0:Ne.logicalName)==null?void 0:ve[z],(Te=W.dbAttrs[0])==null?void 0:Te.physicalName),children:se?k(W).map(K=>{var Z,ne;return{key:`attr:${W.modelId}:col:${K.modelId}`,label:pi(I,K.physicalName,(Z=K.logicalName)==null?void 0:Z[z],K.physicalName,i.t("em.node.logicalMissing"))+(K.dataType?` : ${K.dataType}`:""),icon:"field",attrRef:ge,focusId:fe,matchText:go(K.physicalName,(ne=K.logicalName)==null?void 0:ne[z]),children:[]}}):[]}}const $e=ar(W,i.state.logical.associations),pe=rr(I,W,$e);return{key:`attr:${W.modelId}`,label:pi(I,W.name,(_e=(re=W.dbAttrs[0])==null?void 0:re.logicalName)==null?void 0:_e[z],(me=W.dbAttrs[0])==null?void 0:me.physicalName,i.t("em.node.logicalMissing"))+(pe?` : ${pe}`:""),...F(W),attrRef:ge,focusId:fe,matchText:go(W.name,(ue=(ke=W.dbAttrs[0])==null?void 0:ke.logicalName)==null?void 0:ue[z],(L=W.dbAttrs[0])==null?void 0:L.physicalName),children:[]}},S=W=>{var $e,pe,Ne;const fe=W.entity,ge=[...fe.attributes].sort((ve,Te)=>ve.order-Te.order);return{key:`entity:${fe.modelId}`,label:w(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:go(fe.name,(pe=($e=fe.table)==null?void 0:$e.logicalName)==null?void 0:pe[z],(Ne=fe.table)==null?void 0:Ne.physicalName),children:ge.map(ve=>G(ve,fe.modelId))}},H=new Map,Q=[];for(const W of T.entities)if(W.groupRef){const fe=H.get(W.groupRef)??[];fe.push(W),H.set(W.groupRef,fe)}else Q.push(W);const ie=[];for(const W of T.groups){const fe=W.group;ie.push({key:`group:${fe.modelId}`,label:((oe=fe.name)==null?void 0:oe.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(H.get(fe.modelId)??[]).map(S)})}for(const W of Q)ie.push(S(W));if(T.associations.length){const W=new Map(T.entities.map(fe=>[fe.entity.modelId,w(fe.entity)]));ie.push({key:"section:associations",label:i.t("em.explorer.associations",{n:T.associations.length}),icon:"arrow-lr",children:T.associations.map(fe=>{const ge=fe.association,$e=W.get(ge.end1.entityRef)??ge.end1.entityRef,pe=W.get(ge.end2.entityRef)??ge.end2.entityRef;return{key:`assoc:${ge.modelId}`,label:`${$e} — ${pe}`,icon:"arrow-lr",selectKind:"association",selectId:ge.modelId,children:[]}})})}return T.notes.length&&ie.push({key:"section:notes",label:i.t("em.explorer.notes",{n:T.notes.length}),icon:"note",children:T.notes.map(({note:W})=>{var fe;return{key:`note:${W.modelId}`,label:((fe=W.memo.split(`
62
+ `)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:W.modelId,focusId:W.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ie}});function l(T){return T?T.pk&&T.fk?i.t("em.node.keyPfk"):T.pk?i.t("em.node.keyPk"):T.fk?i.t("em.node.keyFk"):"":""}const s=t.ref(new Set);function c(T){const I=new Set(s.value);I.has(T)?I.delete(T):I.add(T),s.value=I}const d=t.ref(""),m=t.ref(null),u=t.computed(()=>d.value.trim().length>0),p=t.computed(()=>{const T=[];if(u.value){const z=u$(r.value,d.value.trim().toLowerCase()),w=(x,F)=>{if(z.has(x.key)){T.push({node:x,depth:F});for(const C of x.children)w(C,F+1)}};return w(r.value,0),T}const I=(z,w)=>{if(T.push({node:z,depth:w}),!s.value.has(z.key))for(const x of z.children)I(x,w+1)};return I(r.value,0),T}),y=t.computed(()=>u.value&&p.value.length<=1);function f(T){var w;if(T.key!=="/"||T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;const I=T.target,z=I==null?void 0:I.tagName;z==="INPUT"||z==="TEXTAREA"||z==="SELECT"||I!=null&&I.isContentEditable||(T.preventDefault(),(w=m.value)==null||w.focus())}t.onMounted(()=>window.addEventListener("keydown",f)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",f));const b=t.computed(()=>{const T=[],I=z=>{if(z.children.length){z.key!=="root"&&T.push(z.key);for(const w of z.children)I(w)}};return I(r.value),T}),h=t.computed(()=>!b.value.some(T=>s.value.has(T)));function _(){s.value=h.value?new Set(b.value):new Set}n({toggleAll:_,allExpanded:h,hasExpandable:t.computed(()=>b.value.length>0)});function E(T){const I=i.selection.value;return T.attrRef?(I==null?void 0:I.kind)==="attribute"&&I.entityId===T.attrRef.entityId&&I.ids.includes(T.attrRef.attrId):!!I&&I.kind!=="attribute"&&!!T.selectId&&T.selectKind===I.kind&&T.selectId===I.id}function g(T){const I=i.selection.value;return T.selectKind==="entity"&&(I==null?void 0:I.kind)==="attribute"&&I.entityId===T.selectId}function N(T,I){if(T.attrRef){const z=I.shiftKey?"range":I.metaKey||I.ctrlKey?"toggle":"replace";i.selectAttribute(T.attrRef.entityId,T.attrRef.attrId,z)}else T.selectKind&&T.selectId&&(i.selection.value={kind:T.selectKind,id:T.selectId});T.focusId&&i.requestFocus(T.focusId)}function V(T){T.selectKind==="entity"&&T.selectId&&Na(a,i,T.selectId)}return(T,I)=>(t.openBlock(),t.createElementBlock("section",D$,[t.createElementVNode("div",O$,[t.createVNode(De,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:m,"onUpdate:modelValue":I[0]||(I[0]=z=>d.value=z),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:I[1]||(I[1]=t.withKeys(z=>d.value="",["esc"]))},null,40,L$),[[t.vModelText,d.value]]),d.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:I[2]||(I[2]=z=>d.value="")},[t.createVNode(De,{name:"x",size:13})],8,P$)):t.createCommentVNode("",!0)]),y.value?(t.openBlock(),t.createElementBlock("p",z$,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",U$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,({node:z,depth:w})=>(t.openBlock(),t.createElementBlock("div",{key:z.key,class:t.normalizeClass(["em-explorer__row",{"is-active":E(z),"is-focus-parent":g(z),"is-selectable":!!z.selectKind||!!z.attrRef||!!z.focusId}]),"data-key":z.key,style:t.normalizeStyle({paddingLeft:4+w*14+"px"}),onClick:x=>N(z,x),onDblclick:x=>V(z)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!z.children.length,"is-open":!s.value.has(z.key)}]),onClick:t.withModifiers(x=>z.children.length&&c(z.key),["stop"])},[z.children.length?(t.openBlock(),t.createBlock(De,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,H$),z.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(z.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",G$,[z.keyMarks.pk?(t.openBlock(),t.createBlock(De,{key:0,name:"key",size:14,class:"em-key is-pk"})):z.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(De,{key:1,class:"em-explorer__icon",name:z.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",K$,[z.keyMarks.fk?(t.openBlock(),t.createBlock(De,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,j$)):(t.openBlock(),t.createBlock(De,{key:1,class:"em-explorer__icon",name:z.icon,size:15},null,8,["name"])),t.createElementVNode("span",Y$,t.toDisplayString(z.label),1)],46,F$))),128))])]))}}),[["__scopeId","data-v-7b20d13b"]]),q$={class:"em-text-export"},W$={key:0,class:"em-text-export__tabs",role:"tablist"},X$=["aria-selected","onClick"],J$={class:"em-text-export__pre"},Z$={class:"em-text-export__actions"},Q$=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=le.useModalHandle(),i=(c,d)=>St(n.locale??"ko",c,d),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}async function l(){try{await navigator.clipboard.writeText(r().content),le.showNotification(i("em.export.copied"),"info")}catch{le.showNotification(i("em.export.copyFailed"),"error")}}function s(){const c=r(),d=new Blob([c.content],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(d);try{const u=document.createElement("a");u.href=m,u.download=c.filename,document.body.appendChild(u),u.click(),u.remove()}finally{URL.revokeObjectURL(m)}}return(c,d)=>(t.openBlock(),t.createBlock(t.unref(le.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",q$,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",W$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(m,u)=>(t.openBlock(),t.createElementBlock("button",{key:m.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":u===a.value}]),"aria-selected":u===a.value,onClick:p=>a.value=u},t.toDisplayString(m.label),11,X$))),128))])):t.createCommentVNode("",!0),t.createElementVNode("pre",J$,t.toDisplayString(r().content),1),t.createElementVNode("div",Z$,[t.createVNode(t.unref(le.BSButton),{caption:i("em.export.copy"),onClick:l},null,8,["caption"]),t.createVNode(t.unref(le.BSButton),{caption:i("em.export.download"),onClick:s},null,8,["caption"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:i("em.common.close"),onClick:d[0]||(d[0]=m=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-f31001c1"]]),eR={class:"em-text-import"},tR={class:"em-text-import__formats",role:"tablist"},nR=["aria-selected","onClick"],oR=["placeholder"],iR={class:"em-text-import__status"},aR={class:"em-text-import__ok"},rR={key:0,class:"em-text-import__warn"},lR={key:1,class:"em-text-import__err"},sR={key:2,class:"em-text-import__err"},cR={key:3,class:"em-text-import__err"},dR={class:"em-text-import__actions"},uR=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=le.useModalHandle(),i=(p,y)=>St(n.locale??"ko",p,y),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}];function s(p){return p?p.startsWith("{")?"json":/\berdiagram\b/i.test(p)?"mermaid":/\bcreate\s+table\b/i.test(p)?"ddl":null:null}const c=t.computed(()=>r.value==="auto"?s(a.value.trim()):r.value),d=t.computed(()=>{const p=a.value.trim();if(!p)return{status:"empty"};const y=c.value;if(!y)return{status:"unknown"};try{let f,b=[];return y==="json"?f=_s(p):y==="mermaid"?f=rs(p):(f=ds(p),b=nr(p).warnings),f.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:f,warnings:b}}catch(f){return{status:"error",message:f instanceof Error?f.message:String(f)}}}),m=t.computed(()=>d.value.status==="ok");function u(){const p=d.value;p.status!=="ok"||!p.source||(n.onImport(p.source),o.close())}return(p,y)=>(t.openBlock(),t.createBlock(t.unref(le.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",eR,[t.createElementVNode("div",tR,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,f=>t.createElementVNode("button",{key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-import__fmt",{"is-active":f.key===r.value}]),"aria-selected":f.key===r.value,onClick:b=>r.value=f.key},t.toDisplayString(i(f.labelKey)),11,nR)),64))]),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":y[0]||(y[0]=f=>a.value=f),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,oR),[[t.vModelText,a.value]]),t.createElementVNode("div",iR,[d.value.status==="ok"&&d.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",aR,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${c.value==="json"?"Json":c.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:d.value.source.logical.entities.length,relations:d.value.source.logical.associations.length})),1),d.value.warnings&&d.value.warnings.length?(t.openBlock(),t.createElementBlock("span",rR," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:d.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):d.value.status==="error"?(t.openBlock(),t.createElementBlock("span",lR,t.toDisplayString(i("em.import.error",{message:d.value.message??""})),1)):d.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",sR,t.toDisplayString(i("em.import.unknownFormat")),1)):d.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",cR,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",dR,[t.createVNode(t.unref(le.BSButton),{caption:i("em.import.confirm"),disabled:!m.value,onClick:u},null,8,["caption","disabled"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:i("em.common.close"),onClick:y[1]||(y[1]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-43a94e55"]]),mR={class:"em-toolbar"},fR={class:"em-toolbar__mode"},Rf=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=le.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:f=>i.displayMode.value=f});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const f=i.resolved.value.entities;return f.length>0&&f.every(b=>b.collapsed)});function m(){d.value?i.expandAll():i.collapseAll()}function u(){const f=i.state.logical;r.openModal({component:Q$,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:es(f),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:er(f,"er"),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:er(f,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:ys(f,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:bs(f,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:uR,bind:{locale:i.uiLocale.value,onImport:f=>{i.importEntities(f,f.logical.entities.map(b=>b.modelId))}}})}function y(){r.openModal({component:Cf,bind:{locale:i.uiLocale.value}})}return(f,b)=>(t.openBlock(),t.createElementBlock("div",mR,[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:b[0]||(b[0]=h=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(De,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:b[1]||(b[1]=h=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(De,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),b[9]||(b[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",fR,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(le.BSSelect),{modelValue:s.value,"onUpdate:modelValue":b[2]||(b[2]=h=>s.value=h),items:l,"value-provider":h=>h.v,"label-provider":h=>t.unref(i).t(h.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(De,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:b[3]||(b[3]=h=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(De,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:b[4]||(b[4]=h=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(De,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:m},{left:t.withCtx(()=>[t.createVNode(De,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),b[10]||(b[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(De,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:u},{left:t.withCtx(()=>[t.createVNode(De,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:b[5]||(b[5]=h=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(De,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:b[6]||(b[6]=h=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(De,{name:"camera",size:16})]),_:1},8,["tooltip"]),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b[8]||(b[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(le.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:b[7]||(b[7]=h=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(De,{name:"undo",size:16})]),_:1},8,["class","caption","tooltip"])],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:y},{left:t.withCtx(()=>[t.createVNode(De,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-38de55b4"]]),pR=["title"],hR=["title"],yR=["disabled","aria-pressed"],gR=["disabled","aria-pressed"],bR=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>St(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(De,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,pR)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(De,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,yR),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(De,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,gR)],10,hR))}}),[["__scopeId","data-v-2b5162b7"]]),_R=["disabled"],kR={class:"em-panel__sub"},ER={class:"em-nav"},NR={key:0,class:"em-nav__divider","aria-hidden":"true"},wR={key:1},vR=["onClick","onKeydown"],IR={class:"em-nav__name"},xR=["title"],CR={key:0,class:"em-panel__note"},SR=["data-attr-block"],$R={class:"em-attr__row"},RR=["title"],AR={key:0,class:"em-attr__row"},TR={key:1,class:"em-attr__navhint"},VR={class:"em-attr__row"},MR={class:"em-attr__row"},BR={class:"em-attr__flags"},DR={class:"em-attr__pii"},OR={class:"em-attr__pii"},LR={key:0,class:"em-attr__pii"},PR={key:1,class:"em-attr__pii em-attr__codetop"},zR={class:"em-multilang"},UR={key:3,class:"em-embed-cols"},FR={class:"em-embed-col__label"},HR={class:"em-attr__row"},jR={class:"em-attr__row"},GR={key:0,class:"em-embed-upd"},KR={class:"em-embed-upd"},YR={class:"em-embed-upd"},qR={class:"em-swatch__row em-attr__swatch"},WR=["title","onClick"],XR=["title","onClick"],JR={key:0,class:"em-attr__swatch-hint"},Ga="__OWN__",ZR=Ke(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(B=>B.modelId===n.entityId)??null),a=t.computed(()=>i.value?o.state.layout.entityLayouts.find(B=>B.entityRef===i.value.modelId)??null:null),r=t.computed(()=>{var B;return((B=i.value)==null?void 0:B.stereotype)==="JPA_EMBEDDABLE"}),l=t.computed(()=>new Set(o.selectedAttrIds.value)),s=t.computed(()=>{var B;return((B=i.value)==null?void 0:B.attributes.filter(q=>q.attrType!=="DIVIDER"))??[]}),c=t.computed(()=>{var B;return((B=i.value)==null?void 0:B.attributes)??[]}),d=t.computed(()=>s.value.filter(B=>l.value.has(B.modelId)));function m(B){return{pk:B.identifier,fk:B.attrType.startsWith("RELATION")&&B.dbAttrs.length>0,required:B.notNull&&!B.identifier}}function u(B){return!!i.value&&!!Li(o.state.logical,i.value.modelId,B.modelId)}function p(B){const q=m(B),$=[q.pk&&"PK",q.fk&&"FK",q.required&&"NOT NULL"].filter(Boolean);return $.length?$.join(" · "):void 0}function y(B,q){i.value&&o.selectAttribute(i.value.modelId,B.modelId,q.shiftKey?"range":q.metaKey||q.ctrlKey?"toggle":"replace")}const f=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function b(B){return B==="none"?o.t("em.common.noneParen"):B}const h=B=>B;function _(B){var q,$;return ft(($=(q=a.value)==null?void 0:q.attributeStyles)==null?void 0:$[B.modelId])}function E(B){return l.value.size>1&&l.value.has(B.modelId)}function g(B,q){if(!i.value)return;const $=E(B)?o.selectedAttrIds.value:[B.modelId];o.setAttributeSwatches(i.value.modelId,$,q)}function N(B,q){i.value&&o.updateAttribute(i.value.modelId,B.modelId,q)}function V(B,q){N(B,{naturalId:q||void 0,naturalIdMutable:q?B.naturalIdMutable:void 0})}function T(){return{naturalId:void 0,naturalIdMutable:void 0}}function I(B,q){N(B,{identifier:q,...q?T():{}})}function z(B,q){N(B,{transient:q||void 0,...q?T():{}})}function w(B){return!!B.transient}function x(B){return ka(B)}function F(B,q=0){var $;return(($=pl(B,i.value,o.state.logical.entities,o.state.logical.associations,q))==null?void 0:$.physicalName)||void 0}const C=B=>B.value,se=B=>B.label;function k(B,q){if(!q)return;const $=fe.value.find(xe=>xe.type===q);if($){const xe=B.dbAttrs[0]??{modelId:B.modelId+".c",physicalName:B.name,dataType:"VARCHAR"};N(B,{type:q,customType:void 0,dbAttrs:[{...xe,dataType:$.dataType,length:$.length,scale:$.scale}]});return}N(B,q===At?{type:q}:{type:q,customType:void 0})}function G(B,q){N(B,{customType:q.trim()===""?void 0:q})}function S(B,q){if(B.attrType==="RELATION_REF")return;const xe={...B.dbAttrs[0]??{modelId:B.modelId+".c",physicalName:B.name,dataType:"VARCHAR"},...q};q.dataType!==void 0&&!wo.has(xe.dataType)&&(xe.scale=void 0),N(B,{dbAttrs:[xe]})}function H(B){var q;return wo.has(((q=B.dbAttrs[0])==null?void 0:q.dataType)??"")}function Q(B,q){S(B,{logicalName:Object.keys(q).length?q:void 0})}function ie(B,q){N(B,{description:Object.keys(q).length?q:void 0})}function oe(B){return B.personalInfoAttributeType??"none"}function W(B,q){N(B,{personalInfoAttributeType:q==="none"?void 0:q})}const fe=t.computed(()=>o.predefinedCustomTypeCatalog.value),ge=t.computed(()=>o.embeddableCatalog.value),$e=t.ref(void 0);function pe(B){var q,$;return((q=B.label)==null?void 0:q.ko)??(($=B.label)==null?void 0:$.en)??B.type}function Ne(B){if(!B||!i.value)return;const q=o.addPredefinedEmbed(i.value.modelId,B);q&&o.selectAttribute(i.value.modelId,q),$e.value=void 0}function ve(){if(!i.value)return;const B=o.addAttribute(i.value.modelId);o.selectAttribute(i.value.modelId,B)}const Te=t.computed(()=>o.groupCodeCatalog.value);function re(B){var q;return((q=Te.value.find($=>$.groupCode===B.groupCode))==null?void 0:q.codes)??[]}function _e(B){return["none",...re(B)]}function me(B){return B==="none"?"none":B.code}function ke(B){var $,xe;if(B==="none")return o.t("em.common.noneParen");const q=(($=B.label)==null?void 0:$.ko)??((xe=B.label)==null?void 0:xe.en);return q?`${B.code} (${q})`:B.code}function ue(B,q){i.value&&o.setAttributeGroupCode(i.value.modelId,B.modelId,q)}function L(B,q){N(B,{defaultValue:q==="none"?void 0:q})}function D(B,q){N(B,{defaultValue:q.trim()===""?void 0:q})}function K(B){return B.attrType.startsWith("EMBED")&&B.dbAttrs.length>0}function Z(B,q,$){const xe=B.dbAttrs.map((P,A)=>{if(A!==q)return P;const ce={...P,...$};for(const Ce of Object.keys($))$[Ce]===void 0&&delete ce[Ce];return ce});i.value&&o.setEmbedColumns(i.value.modelId,B.modelId,xe)}function ne(B,q,$){Z(B,q,{logicalName:Object.keys($).length?$:void 0})}function te(B,q){var P,A,ce;if(B.attrType==="EMBED_PREDEF"){const Ce=(P=o.embeddableCatalog.value.find(Ve=>Ve.type===B.type))==null?void 0:P.fields[q];return Ce?{name:Ce.name,physicalName:Ce.physicalName,dataType:Ce.dataType,length:Ce.length,shareable:Ce.shareable,logicalName:Ce.logicalName}:void 0}const $=(A=B.embedded)==null?void 0:A.embeddableRef;if(!$)return;const xe=(ce=o.state.logical.entities.find(Ce=>Ce.modelId===$))==null?void 0:ce.attributes.flatMap(Ce=>Ce.dbAttrs)[q];return xe?{physicalName:xe.physicalName,dataType:xe.dataType,length:xe.length,scale:xe.scale,logicalName:xe.logicalName}:void 0}function ye(B,q){var $,xe;return(($=te(B,q))==null?void 0:$.dataType)||((xe=B.dbAttrs[q])==null?void 0:xe.dataType)||""}function J(B,q){var $,xe;return(($=te(B,q))==null?void 0:$.length)??((xe=B.dbAttrs[q])==null?void 0:xe.length)}function X(B,q){var $,xe;return(($=te(B,q))==null?void 0:$.scale)??((xe=B.dbAttrs[q])==null?void 0:xe.scale)}const ee=["inherit","true","false"];function Re(B){return B==="inherit"?o.t("em.common.inherit"):B}function Le(B){return(B==null?void 0:B.updatable)===void 0?"inherit":B.updatable?"true":"false"}function He(B,q,$){Z(B,q,{updatable:$==="inherit"?void 0:$==="true"})}function Oe(B,q){S(B,{updatable:q==="inherit"?void 0:q==="true"})}const et=["inherit","true","false"];function v(B){return B==="inherit"?o.t("em.common.inherit"):B}function M(B){return(B==null?void 0:B.insertable)===void 0?"inherit":B.insertable?"true":"false"}function ae(B,q,$){Z(B,q,{insertable:$==="inherit"?void 0:$==="true"})}function de(B,q){S(B,{insertable:q==="inherit"?void 0:q==="true"})}const Ie=t.computed(()=>i.value?_i(i.value,o.state.logical.entities):[]),O=t.computed(()=>fn(Ie.value.flatMap(B=>B.attributes.flatMap(q=>q.dbAttrs)))),U=t.computed(()=>Ie.value.flatMap(B=>B.attributes.filter(q=>q.attrType==="NORMAL"&&q.dbAttrs.length===1&&q.dbAttrs[0]).map(q=>{var $;return{modelId:q.dbAttrs[0].modelId,physical:q.dbAttrs[0].physicalName||q.name,isCurrency:q.type==="Currency",ownerName:B.modelId===(($=i.value)==null?void 0:$.modelId)?void 0:B.name}})));function R(){const B=[...U.value].sort((q,$)=>Number($.isCurrency)-Number(q.isCurrency));return[Ga,...B.map(q=>q.modelId)]}function be(B){if(B===Ga)return o.t("em.attr.sharedOwn");const q=U.value.find(xe=>xe.modelId===B);if(!q)return B;const $=q.ownerName?`${q.ownerName}.`:"";return o.t("em.attr.sharedRef",{owner:$,physical:q.physical,mode:q.isCurrency?o.t("em.attr.currencyMode"):o.t("em.attr.sharedMode")})}function Se(B){return(B==null?void 0:B.sharedColumnRef)??Ga}function Ae(B,q,$){Z(B,q,{sharedColumnRef:$===Ga?void 0:$})}function j(B){return(B==null?void 0:B.sharedColumnRef)!=null}function Y(B){var q;return((q=Gn(B,O.value))==null?void 0:q.physicalName)??""}return(B,q)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",kR,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:s.value.length}))+" ",1),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ve},null,8,["caption"]),ge.value.length?(t.openBlock(),t.createBlock(t.unref(le.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":$e.value,items:ge.value,"value-provider":$=>$.type,"label-provider":pe,"onUpdate:modelValue":Ne},null,8,["placeholder","model-value","items","value-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",ER,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,$=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:$.modelId},[$.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",NR,[...q[0]||(q[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",wR,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":l.value.has($.modelId)}]),role:"button",tabindex:"0",onClick:xe=>y($,xe),onKeydown:[t.withKeys(t.withModifiers(xe=>y($,xe),["prevent"]),["enter"]),t.withKeys(t.withModifiers(xe=>y($,xe),["prevent"]),["space"])]},[t.createElementVNode("span",IR,t.toDisplayString($.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:p($)},[m($).pk?(t.openBlock(),t.createBlock(De,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):m($).required?(t.openBlock(),t.createBlock(De,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),m($).fk?(t.openBlock(),t.createBlock(De,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,xR)],42,vR)]))],64))),128))]),s.value.length&&!d.value.length?(t.openBlock(),t.createElementBlock("p",CR,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,$=>{var xe,P,A,ce,Ce,Ve,Pe,we,ze,je;return t.openBlock(),t.createElementBlock("div",{key:$.modelId,class:t.normalizeClass(["em-attr",{"is-focused":l.value.has($.modelId)}]),"data-attr-block":$.modelId},[t.createElementVNode("div",$R,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`attr-name-${$.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":$.name,"onUpdate:modelValue":he=>N($,{name:he})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSSelect),{name:`attr-type-${$.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:$.attrType.startsWith("EMBED")||!!$.groupCode||$.attrType==="RELATION_REF"||x($),items:t.unref(fs)($.type,fe.value),"value-provider":C,"label-provider":se,"model-value":$.type,"onUpdate:modelValue":he=>k($,he)},null,8,["name","placeholder","disabled","items","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:u($)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:he=>t.unref(o).removeAttribute(i.value.modelId,$.modelId)},null,8,["onClick"])],8,RR)]),$.type===t.unref(At)&&!x($)?(t.openBlock(),t.createElementBlock("div",AR,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`attr-customtype-${$.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":$.customType??"","onUpdate:modelValue":he=>G($,he)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),$.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",TR,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):K($)?(t.openBlock(),t.createElementBlock("div",UR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList($.dbAttrs,(he,qe)=>{var it,pt,ct,Je,zn,ui;return t.openBlock(),t.createElementBlock("div",{key:he.modelId,class:"em-embed-col"},[t.createElementVNode("span",FR,t.toDisplayString(((it=te($,qe))==null?void 0:it.name)??((pt=te($,qe))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:qe+1})),1),t.createElementVNode("div",HR,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`embed-col-${he.modelId}`,width:"100%",disabled:j(he),placeholder:((ct=te($,qe))==null?void 0:ct.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":j(he)?Y(he):he.physicalName,"onUpdate:modelValue":ht=>Z($,qe,{physicalName:ht})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSTextInput),{name:`embed-dtype-${he.modelId}`,width:"84px",disabled:"","model-value":ye($,qe)},null,8,["name","model-value"]),t.createVNode(t.unref(le.BSNumberInput),{name:`embed-len-${he.modelId}`,width:"48px",disabled:"","model-value":J($,qe)},null,8,["name","model-value"]),t.createVNode(t.unref(le.BSNumberInput),{name:`embed-scale-${he.modelId}`,width:"48px",disabled:"","model-value":X($,qe)},null,8,["name","model-value"])]),t.createVNode(Vn,{controller:t.unref(o),"ref-id":he.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",jR,[t.createVNode(Mn,{class:"grow",name:`embed-logical-${he.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((zn=(Je=te($,qe))==null?void 0:Je.logicalName)==null?void 0:zn.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":he.logicalName,"onUpdate:modelValue":ht=>ne($,qe,ht)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ui=te($,qe))!=null&&ui.shareable?(t.openBlock(),t.createElementBlock("label",GR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(le.BSSelect),{width:"110px","model-value":Se(he),items:R(),"value-provider":h,"label-provider":be,"onUpdate:modelValue":ht=>ht&&Ae($,qe,ht)},null,8,["model-value","items","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",KR,[q[3]||(q[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"110px",disabled:j(he),"model-value":j(he)?"false":M(he),items:et,"value-provider":h,"label-provider":v,"onUpdate:modelValue":ht=>ht&&ae($,qe,ht)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",YR,[q[4]||(q[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"110px",disabled:j(he),"model-value":j(he)?"false":Le(he),items:ee,"value-provider":h,"label-provider":Re,"onUpdate:modelValue":ht=>ht&&He($,qe,ht)},null,8,["disabled","model-value","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",VR,[t.createVNode(Mn,{class:"grow",name:`attr-logical-${$.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(xe=$.dbAttrs[0])==null?void 0:xe.logicalName,"onUpdate:modelValue":he=>Q($,he)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",MR,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`attr-col-${$.modelId}`,width:"100%",placeholder:F($)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:w($),"model-value":((P=$.dbAttrs[0])==null?void 0:P.physicalName)??"","onUpdate:modelValue":he=>S($,{physicalName:he})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSSelect),{name:`attr-dtype-${$.modelId}`,width:"84px",placeholder:"dataType",disabled:w($)||x($),items:t.unref(us)(((A=$.dbAttrs[0])==null?void 0:A.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":h,"label-provider":t.unref(or),"model-value":((ce=$.dbAttrs[0])==null?void 0:ce.dataType)??"","onUpdate:modelValue":he=>he&&S($,{dataType:he})},null,8,["name","disabled","items","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSNumberInput),{name:`attr-len-${$.modelId}`,width:"48px",placeholder:"len",disabled:w($)||x($),"model-value":(Ce=$.dbAttrs[0])==null?void 0:Ce.length,"onUpdate:modelValue":he=>S($,{length:he||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSNumberInput),{name:`attr-scale-${$.modelId}`,width:"48px",placeholder:"scale",disabled:w($)||x($)||!H($),"model-value":(Ve=$.dbAttrs[0])==null?void 0:Ve.scale,"onUpdate:modelValue":he=>S($,{scale:he||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])]),t.createVNode(Vn,{controller:t.unref(o),"ref-id":(Pe=$.dbAttrs[0])==null?void 0:Pe.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",BR,[t.createVNode(t.unref(le.BSCheckbox),{name:`attr-pk-${$.modelId}`,label:"Primary Key","model-value":$.identifier,disabled:r.value||w($)||x($),"onUpdate:modelValue":he=>I($,he)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-nn-${$.modelId}`,label:"Not Null","model-value":$.notNull,disabled:w($)||x($),"onUpdate:modelValue":he=>N($,{notNull:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-uq-${$.modelId}`,label:"Unique","model-value":!!((we=$.dbAttrs[0])!=null&&we.unique),disabled:w($)||x($),"onUpdate:modelValue":he=>S($,{unique:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-ai-${$.modelId}`,label:"Auto Increment","model-value":!!((ze=$.dbAttrs[0])!=null&&ze.autoIncrement),disabled:w($)||x($)||!$.identifier,"onUpdate:modelValue":he=>S($,{autoIncrement:he})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-tr-${$.modelId}`,label:"@Transient","model-value":!!$.transient,disabled:$.identifier||x($),"onUpdate:modelValue":he=>z($,he)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-nid-${$.modelId}`,label:"@NaturalId","model-value":!!$.naturalId,disabled:$.identifier||w($)||x($),"onUpdate:modelValue":he=>V($,he)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${$.modelId}`,label:"mutable","model-value":!!$.naturalIdMutable,disabled:w($)||!$.naturalId,"onUpdate:modelValue":he=>N($,{naturalIdMutable:he||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`attr-mv-${$.modelId}`,label:"Multi-Value (Set)","model-value":!!((je=$.dbAttrs[0])!=null&&je.multiValue),disabled:w($)||x($),"onUpdate:modelValue":he=>S($,{multiValue:he||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",DR,[q[1]||(q[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"100%",disabled:w($),"model-value":M($.dbAttrs[0]),items:et,"value-provider":h,"label-provider":v,"onUpdate:modelValue":he=>he&&de($,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",OR,[q[2]||(q[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(le.BSSelect),{width:"100%",disabled:w($),"model-value":Le($.dbAttrs[0]),items:ee,"value-provider":h,"label-provider":Re,"onUpdate:modelValue":he=>he&&Oe($,he)},null,8,["disabled","model-value","onUpdate:modelValue"])]),x($)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",LR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(le.BSSelect),{width:"100%","model-value":oe($),items:f,"value-provider":h,"label-provider":b,"onUpdate:modelValue":he=>he&&W($,he)},null,8,["model-value","onUpdate:modelValue"])])),Te.value.length&&!x($)?(t.openBlock(),t.createElementBlock("label",PR,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(am,{"model-value":$.groupCode,items:Te.value,locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":he=>ue($,he)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),x($)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:2,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!Te.value.length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),re($).length?(t.openBlock(),t.createBlock(t.unref(le.BSSelect),{key:0,width:"100%","model-value":$.defaultValue??"none",items:_e($),"value-provider":me,"label-provider":ke,"onUpdate:modelValue":he=>he&&L($,he)},null,8,["model-value","items","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(le.BSTextInput),{key:1,name:`attr-default-${$.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":$.defaultValue??"","onUpdate:modelValue":he=>D($,he)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",zR,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Mn,{multiline:"",name:`attr-desc-${$.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":$.description,"onUpdate:modelValue":he=>ie($,he)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",qR,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_($)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:he=>g($,null)},"∅",10,WR),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),he=>(t.openBlock(),t.createElementBlock("button",{key:he,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_($)===he}]),style:t.normalizeStyle({background:t.unref(so)(he)}),title:t.unref(lo)(he),onClick:qe=>g($,he)},null,14,XR))),128)),E($)?(t.openBlock(),t.createElementBlock("span",JR,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:l.value.size})),1)):t.createCommentVNode("",!0)])],10,SR)}),128))],8,_R)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-5c70af88"]]),QR=["disabled"],eA={class:"em-panel__sub-label"},tA={class:"em-attr__row"},nA={class:"em-field em-idx-params"},oA=["value","placeholder","onChange"],iA=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(b=>b.modelId===o.entityId)??null),l=t.computed(()=>r.value?ko(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var b;return[...(((b=r.value)==null?void 0:b.attributes)??[]).map(h=>({value:h.modelId,label:h.name})),...l.value.map(h=>({value:h.modelId,label:a.t("em.index.inherited",{field:h.field})}))]});function c(){var h;if(!r.value)return;const b=r.value.attributes[0];a.addIndex(r.value.modelId,{modelId:Ue(),name:`idx_${(((h=r.value.indexes)==null?void 0:h.length)??0)+1}`,unique:!1,columns:b?[{columnRef:b.modelId,descending:!1}]:[]})}function d(b,h){r.value&&a.updateIndex(r.value.modelId,b,h)}function m(b){var _;const h=(_=r.value)==null?void 0:_.attributes[0];h&&d(b.modelId,{columns:[...b.columns,{columnRef:h.modelId,descending:!1}]})}function u(b,h,_){d(b.modelId,{columns:b.columns.map((E,g)=>g===h?{...E,columnRef:_}:E)})}function p(b,h,_){d(b.modelId,{columns:b.columns.map((E,g)=>g===h?{...E,descending:_}:E)})}function y(b,h){d(b.modelId,{columns:b.columns.filter((_,E)=>E!==h)})}function f(b,h){d(b.modelId,{parameters:h.trim()===""?void 0:h})}return(b,h)=>{var _;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:h[0]||(h[0]=E=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",eA,[e.collapsible?(t.openBlock(),t.createBlock(De,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((_=r.value.indexes)==null?void 0:_.length)??0})),1)]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(c,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],E=>(t.openBlock(),t.createElementBlock("div",{key:E.modelId,class:"em-attr"},[t.createElementVNode("div",tA,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`idx-name-${E.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":E.name,"onUpdate:modelValue":g=>d(E.modelId,{name:g})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`idx-uq-${E.modelId}`,class:"em-check",label:"UQ","model-value":E.unique,"onUpdate:modelValue":g=>d(E.modelId,{unique:g})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:g=>t.unref(a).removeIndex(r.value.modelId,E.modelId)},null,8,["onClick"])]),t.createVNode(Vn,{controller:t.unref(a),"ref-id":E.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.columns,(g,N)=>(t.openBlock(),t.createElementBlock("div",{key:N,class:"em-attr__row"},[t.createVNode(t.unref(le.BSSelect),{class:"grow","model-value":g.columnRef,items:s.value,"value-provider":V=>V.value,"label-provider":V=>V.label,"onUpdate:modelValue":V=>V&&u(E,N,V)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSCheckbox),{name:`idx-${E.modelId}-desc-${N}`,class:"em-check",label:"DESC","model-value":g.descending,"onUpdate:modelValue":V=>p(E,N,V)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:"−",onClick:V=>y(E,N)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),onClick:g=>m(E)},null,8,["caption","onClick"]),t.createElementVNode("label",nA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:g=>f(E,g.target.value)},null,40,oA)])]))),128)):t.createCommentVNode("",!0)],8,QR)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d883aded"]]),aA=["disabled"],rA={class:"em-panel__sub-label"},lA={class:"em-attr__row"},sA={class:"em-attr__row"},cA={class:"em-multilang"},dA={class:"em-attr__pii"},uA={class:"em-swatch__row em-attr__swatch"},mA=["title","onClick"],fA=["title","onClick"],pA=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=le.useModal(),l=t.computed(()=>a.state.logical.entities.find(g=>g.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(g=>g.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function m(g){return g==="none"?a.t("em.common.noneParen"):g}const u=g=>g;function p(g,N){l.value&&a.updateOperation(l.value.modelId,g.modelId,N)}function y(g,N){p(g,{description:Object.keys(N).length?N:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function b(g,N){p(g,{personalInfoAttributeType:N==="none"?void 0:N})}function h(g){var N,V;return ft((V=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:V[g.modelId])}function _(g,N){l.value&&a.setOperationSwatch(l.value.modelId,g.modelId,N)}function E(g){r.openModal({component:rm,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:a.uiLocale.value,onSave:N=>p(g,{sourceCode:N})}})}return(g,N)=>{var V;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:N[1]||(N[1]=T=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",rA,[e.collapsible?(t.openBlock(),t.createBlock(De,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((V=l.value.operations)==null?void 0:V.length)??0})),1)]),t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:N[0]||(N[0]=t.withModifiers(T=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],T=>(t.openBlock(),t.createElementBlock("div",{key:T.modelId,class:"em-attr"},[t.createElementVNode("div",lA,[t.createVNode(t.unref(le.BSTextInput),{class:"grow",name:`op-name-${T.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":T.name,"onUpdate:modelValue":I=>p(T,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSSelect),{width:"96px","model-value":T.visibility??"PACKAGE",items:c,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&p(T,{visibility:I})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(le.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(a).removeOperation(l.value.modelId,T.modelId)},null,8,["onClick"])]),t.createElementVNode("div",sA,[t.createVNode(t.unref(le.BSButton),{variant:"text",caption:t.unref(a).t(T.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:I=>E(T)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",cA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Mn,{multiline:"",name:`op-desc-${T.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":T.description,"onUpdate:modelValue":I=>y(T,I)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",dA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(le.BSSelect),{width:"100%","model-value":f(T),items:d,"value-provider":u,"label-provider":m,"onUpdate:modelValue":I=>I&&b(T,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",uA,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":h(T)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:I=>_(T,null)},"∅",10,mA),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),I=>(t.openBlock(),t.createElementBlock("button",{key:I,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":h(T)===I}]),style:t.normalizeStyle({background:t.unref(so)(I)}),title:t.unref(lo)(I),onClick:z=>_(T,I)},null,14,fA))),128))])]))),128)):t.createCommentVNode("",!0)],8,aA)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-394829bc"]]),hA=["title"],yA={class:"em-panel__head"},gA={class:"em-panel__head-row"},bA=["title"],_A={class:"em-panel__context"},kA={key:0,class:"em-panel__lock"},EA=["disabled"],NA={key:0,class:"em-panel__note"},wA={key:1,class:"em-panel__note"},vA={key:2,class:"em-jpa"},IA={class:"em-field"},xA={class:"em-field"},CA={class:"em-field"},SA={key:0,class:"em-field"},$A={class:"em-panel__note"},RA={class:"em-panel__sub"},AA={class:"em-field"},TA={class:"em-field"},VA={class:"em-jpa"},MA={key:0,class:"em-panel__note"},BA={key:1,class:"em-panel__note"},DA={class:"em-jpa"},OA={class:"em-field"},LA={key:0,class:"em-panel__note"},PA={class:"em-field"},zA={class:"em-multilang"},UA={class:"em-field"},FA=["value"],HA={class:"em-field"},jA={class:"em-swatch"},GA={class:"em-swatch__row"},KA=["title"],YA=["title","onClick"],qA={class:"em-panel__note"},WA={class:"em-field"},XA=["value"],JA={class:"em-swatch"},ZA={class:"em-swatch__row"},QA=["title"],eT=["title","onClick"],Af=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.selection.value),l=t.computed(()=>a.inspectedEntityId.value),s=t.computed(()=>{const J=l.value;return J?a.state.logical.entities.find(X=>X.modelId===J)??null:null}),c=t.computed(()=>{const J=r.value;if((J==null?void 0:J.kind)==="association"){const ee=a.state.logical.associations.find(Re=>Re.modelId===J.id);return!!ee&&(a.isEntityLocked(ee.end1.entityRef)||a.isEntityLocked(ee.end2.entityRef))}const X=l.value;return!!X&&a.isEntityLocked(X)}),d=t.computed(()=>{var J;return((J=a.selectedAttr.value)==null?void 0:J.attrId)??null}),m=t.computed(()=>new Set(a.selectedAttrIds.value)),u=t.computed(()=>d.value!==null),p=t.ref({});t.watch(u,()=>{p.value={}});function y(J){return p.value[J]??u.value}function f(J){p.value={...p.value,[J]:!y(J)}}const b=t.computed(()=>{var ee;const J=s.value;if(!J)return a.t("em.entity.fallback");const X=(ee=J.table)==null?void 0:ee.physicalName;return X?`${J.name} (${X})`:J.name}),h=t.computed(()=>{const J=r.value;return(J==null?void 0:J.kind)==="association"?a.state.logical.associations.find(X=>X.modelId===J.id)??null:null}),_=t.computed(()=>{const J=r.value;return(J==null?void 0:J.kind)==="group"?a.state.logical.groups.find(X=>X.modelId===J.id)??null:null}),E=t.computed(()=>{const J=r.value;return(J==null?void 0:J.kind)==="note"?a.state.layout.notes.find(X=>X.modelId===J.id)??null:null}),g=t.computed(()=>{var X,ee;const J=(X=_.value)==null?void 0:X.name;return(J==null?void 0:J.ko)||(J==null?void 0:J.en)||(J==null?void 0:J.ja)||(J==null?void 0:J.zh)||((ee=_.value)==null?void 0:ee.packageName)||a.t("em.group.fallback")}),N=t.computed(()=>{if(s.value){const J=m.value.size;if(J>1)return a.t("em.inspector.ctxEntityAttrs",{name:s.value.name,n:J});if(d.value){const X=s.value.attributes.find(ee=>ee.modelId===d.value);return(X==null?void 0:X.attrType)==="DIVIDER"?a.t("em.inspector.ctxEntityDivider",{name:s.value.name}):a.t("em.inspector.ctxEntityAttr",{name:s.value.name,attr:(X==null?void 0:X.name)??""})}return a.t("em.inspector.ctxEntity",{name:s.value.name})}if(h.value){const J=X=>{var ee;return((ee=a.state.logical.entities.find(Re=>Re.modelId===X))==null?void 0:ee.name)??X};return a.t("em.inspector.ctxAssoc",{a:J(h.value.end1.entityRef),b:J(h.value.end2.entityRef)})}return _.value?a.t("em.inspector.ctxGroup",{name:g.value}):E.value?a.t("em.inspector.ctxNote"):a.t("em.inspector.ctxNone")}),V=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],T=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],I={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},z=J=>{const X=I[J];return X?a.t(X):J},w=J=>{var X;return((X=a.state.logical.entities.find(ee=>ee.modelId===J))==null?void 0:X.name)??J},x=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],F=["LIST","SET"],C=["inherit","LAZY","EAGER"],se=J=>J;function k(J){return J==="inherit"?a.t("em.common.inherit"):J}const G=t.computed(()=>!!h.value&&h.value.end1.entityRef===h.value.end2.entityRef);function S(J,X){h.value&&a.updateAssociationEnd(h.value.modelId,J,X)}function H(J){return re.value?J:J==="end1"?"end2":"end1"}function Q(J){var Le;const X=(Le=h.value)==null?void 0:Le[J];if(!(X!=null&&X.attributeRef))return;const ee=a.state.logical.entities.find(He=>He.modelId===X.entityRef),Re=ee==null?void 0:ee.attributes.find(He=>He.modelId===X.attributeRef);return Re&&(Re.attrType==="RELATION_OWN"||Re.attrType==="RELATION_REF")?Re.name:void 0}function ie(J,X){var Re;const ee=(Re=h.value)==null?void 0:Re[J];ee!=null&&ee.attributeRef&&a.updateAttribute(ee.entityRef,ee.attributeRef,{name:X})}function oe(J){var He;const X=Q(J);if(X!==void 0)return X;const ee=(He=h.value)==null?void 0:He[J];if(ee!=null&&ee.navFieldNameHint)return ee.navFieldNameHint;const Re=J==="end1"?"end2":"end1",Le=a.state.logical.entities.find(Oe=>{var et;return Oe.modelId===((et=h.value)==null?void 0:et[Re].entityRef)});return Le?gi(Le.name,hi(h.value[Re].multiplicity)):""}function W(J){return!!re.value||Q(J)!==void 0}function fe(J){h.value&&!G.value&&a.setAssociationIdentifying(h.value.modelId,J)}function ge(J){var X,ee,Re;return!!((Re=(ee=(X=h.value)==null?void 0:X[J].jpa)==null?void 0:ee.cascadeTypes)!=null&&Re.includes("ALL"))}function $e(J,X,ee){var He,Oe;const Re=(He=h.value)==null?void 0:He[J];if(X==="ALL"&&ee){S(J,{jpa:{...Re==null?void 0:Re.jpa,cascadeTypes:["ALL"]}});return}const Le=new Set(((Oe=Re==null?void 0:Re.jpa)==null?void 0:Oe.cascadeTypes)??[]);ee?Le.add(X):Le.delete(X),S(J,{jpa:{...Re==null?void 0:Re.jpa,cascadeTypes:[...Le]}})}function pe(J,X){var Re;const ee=(Re=h.value)==null?void 0:Re[J];S(J,{jpa:{...ee==null?void 0:ee.jpa,...X}})}function Ne(J){var X,ee;return((ee=(X=h.value)==null?void 0:X[J].jpa)==null?void 0:ee.fetchType)??"inherit"}function ve(J,X){pe(J,{fetchType:X==="inherit"?void 0:X})}function Te(J){var ee;const X=(ee=h.value)==null?void 0:ee[J==="end1"?"end2":"end1"];return(X==null?void 0:X.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(X==null?void 0:X.multiplicity)==="ONE_OR_MORE_INSTANCES"}const re=t.computed(()=>{const J=h.value;if(!J)return null;for(const X of a.state.logical.entities){const ee=X.attributes.find(Oe=>{var et;return((et=Oe.embedded)==null?void 0:et.associationRef)===J.modelId&&Oe.attrType==="EMBED_OWN"});if(!ee)continue;const Re=J.end2.entityRef===ee.embedded.embeddableRef?"end2":"end1",Le=J[Re].multiplicity,He=J[Re].jpa;return{which:Re,cardinality:Le,isCollection:Le==="ZERO_OR_MORE_INSTANCES"||Le==="ONE_OR_MORE_INSTANCES",collectionType:(He==null?void 0:He.collectionType)??"LIST",collectionTable:(He==null?void 0:He.collectionTable)??"",orderColumn:(He==null?void 0:He.orderColumn)??""}}return null});function _e(J){h.value&&a.setEmbedCardinality(h.value.modelId,J)}function me(J){const X=re.value;X&&pe(X.which,J==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function ke(J){const X=re.value;X&&pe(X.which,{collectionTable:J.trim()||void 0})}function ue(J){const X=re.value;X&&pe(X.which,{orderColumn:J.trim()||void 0})}function L(J){_.value&&a.updateGroup(_.value.modelId,J)}function D(J,X){var ee;L({name:{...(ee=_.value)==null?void 0:ee.name,[J]:X}})}const K=t.computed(()=>{var J;return _.value?ft((J=a.state.layout.groupLayouts.find(X=>X.groupRef===_.value.modelId))==null?void 0:J.style):null});function Z(J){_.value&&a.setGroupSwatch(_.value.modelId,J)}function ne(J){E.value&&a.setNoteMemo(E.value.modelId,J)}const te=t.computed(()=>{var J;return ft((J=E.value)==null?void 0:J.style)});function ye(J){E.value&&a.setNoteSwatch(E.value.modelId,J)}return(J,X)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(a).t("em.panel.resizeWidth"),onPointerdown:X[0]||(X[0]=(...ee)=>e.startResize&&e.startResize(...ee))},null,42,hA),t.createElementVNode("header",yA,[t.createElementVNode("div",gA,[X[14]||(X[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{type:"button",class:"em-panel__btn",title:t.unref(a).t("em.panel.collapse"),onClick:X[1]||(X[1]=ee=>i("collapse"))},[t.createVNode(De,{name:"panel-right-close",size:16})],8,bA)]),t.createElementVNode("p",_A,t.toDisplayString(N.value),1),c.value&&l.value?(t.openBlock(),t.createElementBlock("div",kA,[t.createVNode(De,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.panel.lockedBanner")),1),t.unref(a).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:X[2]||(X[2]=ee=>t.unref(a).setEntityLocked(l.value,!1))},t.toDisplayString(t.unref(a).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(a).editable.value||c.value},[s.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(em,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:y("basics"),title:b.value,onToggle:X[3]||(X[3]=ee=>f("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(ZR,{controller:t.unref(a),"entity-id":s.value.modelId},null,8,["controller","entity-id"]),t.createVNode(iA,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:y("index"),onToggle:X[4]||(X[4]=ee=>f("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(pA,{controller:t.unref(a),"entity-id":s.value.modelId,collapsible:"",collapsed:y("ops"),onToggle:X[5]||(X[5]=ee=>f("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(le.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(a).t("em.assoc.identifying"),"model-value":!!h.value.identifying,disabled:G.value||!!re.value,"onUpdate:modelValue":fe},null,8,["label","model-value","disabled"]),G.value?(t.openBlock(),t.createElementBlock("p",NA,t.toDisplayString(t.unref(a).t("em.assoc.selfNoIdentifying")),1)):re.value?(t.openBlock(),t.createElementBlock("p",wA,t.toDisplayString(t.unref(a).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),re.value?(t.openBlock(),t.createElementBlock("fieldset",vA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.embed.legend")),1),t.createElementVNode("label",IA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.embed.cardinality")),1),t.createVNode(t.unref(le.BSSelect),{"model-value":re.value.cardinality,items:T,"value-provider":se,"label-provider":z,"onUpdate:modelValue":X[6]||(X[6]=ee=>ee&&_e(ee))},null,8,["model-value"])]),re.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",xA,[X[15]||(X[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(le.BSSelect),{"model-value":re.value.collectionType,items:F,"value-provider":se,"label-provider":se,"onUpdate:modelValue":X[7]||(X[7]=ee=>ee&&me(ee))},null,8,["model-value"])]),t.createElementVNode("label",CA,[X[16]||(X[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(le.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(a).t("em.embed.collectionTablePlaceholder"),"model-value":re.value.collectionTable,"onUpdate:modelValue":ke},null,8,["placeholder","model-value"])]),re.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",SA,[X[17]||(X[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(le.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(a).t("em.embed.orderColumnPlaceholder"),"model-value":re.value.orderColumn,"onUpdate:modelValue":ue},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",$A,t.toDisplayString(t.unref(a).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],ee=>{var Re,Le,He;return t.withDirectives(t.createElementVNode("div",{key:ee,class:"em-end"},[t.createElementVNode("h4",RA,t.toDisplayString(ee)+" → "+t.toDisplayString(w(h.value[ee].entityRef)),1),re.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",AA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(le.BSSelect),{"model-value":h.value[ee].multiplicity,items:V,"value-provider":se,"label-provider":t.unref(yi),"onUpdate:modelValue":Oe=>S(ee,{multiplicity:Oe})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(le.BSCheckbox),{name:`${H(ee)}-navigable`,class:"em-check",label:"navigable","model-value":h.value[H(ee)].navigable,"onUpdate:modelValue":Oe=>S(H(ee),{navigable:Oe})},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("label",TA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(le.BSTextInput),{name:`${H(ee)}-navname`,width:"100%",disabled:!W(H(ee)),placeholder:t.unref(a).t("em.attr.namePlaceholder"),"model-value":oe(H(ee)),"onUpdate:modelValue":Oe=>ie(H(ee),Oe)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(le.BSCheckbox),{name:`${H(ee)}-composition`,class:"em-check",label:"composition","model-value":h.value[H(ee)].composition,"onUpdate:modelValue":Oe=>S(H(ee),{composition:Oe})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",VA,[X[18]||(X[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(x,Oe=>{var et,v;return t.createVNode(t.unref(le.BSCheckbox),{key:Oe,name:`${H(ee)}-cascade-${Oe}`,class:"em-check",label:Oe,"model-value":!!((v=(et=h.value[H(ee)].jpa)==null?void 0:et.cascadeTypes)!=null&&v.includes(Oe)),disabled:!W(H(ee))||Oe!=="ALL"&&ge(H(ee)),"onUpdate:modelValue":M=>$e(H(ee),Oe,M)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),W(H(ee))?ge(H(ee))?(t.openBlock(),t.createElementBlock("p",BA,t.toDisplayString(t.unref(a).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",MA,t.toDisplayString(t.unref(a).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",DA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",OA,[X[19]||(X[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(le.BSSelect),{disabled:!W(H(ee)),"model-value":Ne(H(ee)),items:C,"value-provider":se,"label-provider":k,"onUpdate:modelValue":Oe=>Oe&&ve(H(ee),Oe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(le.BSCheckbox),{name:`${H(ee)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Re=h.value[H(ee)].jpa)!=null&&Re.orphanRemoval),disabled:!W(H(ee))||Te(ee),"onUpdate:modelValue":Oe=>pe(H(ee),{orphanRemoval:Oe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),Te(ee)&&((Le=h.value[H(ee)].jpa)!=null&&Le.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",LA,t.toDisplayString(t.unref(a).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",PA,[X[20]||(X[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(le.BSTextInput),{name:`${H(ee)}-orderby`,width:"100%",disabled:!W(H(ee)),placeholder:t.unref(a).t("em.assoc.orderByPlaceholder"),"model-value":((He=h.value[H(ee)].jpa)==null?void 0:He.orderBy)??"","onUpdate:modelValue":Oe=>pe(H(ee),{orderBy:Oe.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!re.value||ee===re.value.which]])}),64))],64)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",zA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,ee=>{var Re;return t.openBlock(),t.createElementBlock("label",{key:ee,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(ee),1),t.createVNode(t.unref(le.BSTextInput),{name:`grp-name-${ee}`,width:"100%","model-value":((Re=_.value.name)==null?void 0:Re[ee])??"","onUpdate:modelValue":Le=>D(ee,Le)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",UA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:_.value.description??"",rows:"3",onChange:X[8]||(X[8]=ee=>L({description:ee.target.value}))},null,40,FA)]),t.createElementVNode("label",HA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(le.BSTextInput),{name:"grp-package",width:"100%","model-value":_.value.packageName??"","onUpdate:modelValue":X[9]||(X[9]=ee=>L({packageName:ee}))},null,8,["model-value"])]),t.createVNode(t.unref(le.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(a).t("em.group.excludeDDL"),"model-value":_.value.excludeDDLGeneration,"onUpdate:modelValue":X[10]||(X[10]=ee=>L({excludeDDLGeneration:ee}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",jA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.color")),1),t.createElementVNode("div",GA,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":K.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:X[11]||(X[11]=ee=>Z(null))},"∅",10,KA),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),ee=>(t.openBlock(),t.createElementBlock("button",{key:ee,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":K.value===ee}]),style:t.normalizeStyle({background:t.unref(so)(ee)}),title:t.unref(lo)(ee),onClick:Re=>Z(ee)},null,14,YA))),128))])]),t.createElementVNode("p",qA,t.toDisplayString(t.unref(a).t("em.group.members",{n:_.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",WA,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:E.value.memo,rows:"6",onChange:X[12]||(X[12]=ee=>ne(ee.target.value))},null,40,XA)]),t.createElementVNode("fieldset",JA,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.color")),1),t.createElementVNode("div",ZA,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":te.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:X[13]||(X[13]=ee=>ye(null))},"∅",10,QA),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tn),ee=>(t.openBlock(),t.createElementBlock("button",{key:ee,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":te.value===ee}]),style:t.normalizeStyle({background:t.unref(so)(ee)}),title:t.unref(lo)(ee),onClick:Re=>ye(ee)},null,14,eT))),128))])])],64)):t.createCommentVNode("",!0)],8,EA)],4))}}),[["__scopeId","data-v-b4f7ed60"]]),tT=["title"],nT={class:"em-validation__title"},oT=["title","onClick"],iT={key:0,class:"em-validation__body"},aT={class:"em-validation__opt"},rT={key:0,class:"em-validation__empty"},lT={key:1,class:"em-validation__empty"},sT={key:2,class:"em-validation__list"},cT=["onClick"],dT={class:"em-validation__item-msg"},uT={key:0,class:"em-validation__item-entity"},mT=["title","onClick"],fT=["title"],pT=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const b=new Map;for(const h of o.state.logical.entities)b.set(h.modelId,h.name);return b});function r(b){const h=eE(b);if(!h)return null;const _=a.value.get(h);return _===void 0?null:_.trim()===""?o.t("em.validation.nameless"):_}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const b={error:0,warning:0,info:0};for(const h of i.value)b[h.severity]++;return b}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(b=>c.value[b.severity]).slice().sort((b,h)=>l[b.severity].order-l[h.severity].order)),m=t.computed(()=>d.value.map(b=>({issue:b,entityName:r(b),message:Qu(o.t,b),category:Z0(o.t,b.ruleId)}))),u=t.ref(!1);function p(b){c.value[b]=!c.value[b]}function y(b){if(!u.value){u.value=!0;return}p(b)}function f(b){b.targetRef&&o.requestFocus(b.targetRef)}return(b,h)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":u.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(u.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:h[1]||(h[1]=_=>u.value=!u.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(u.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(De,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":u.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",nT,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,tT),t.createElementVNode("div",{class:"em-validation__counts",onClick:h[0]||(h[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],_=>t.createElementVNode("button",{key:_,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${_}`,{"is-off":!c.value[_]}]]),title:u.value?t.unref(o).t(c.value[_]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[_].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:E=>y(_)},[t.createVNode(De,{name:l[_].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[_]),1)],10,oT)),64))])]),u.value?(t.openBlock(),t.createElementBlock("div",iT,[t.createElementVNode("label",aT,[t.createVNode(t.unref(le.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":h[2]||(h[2]=_=>t.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",rT,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",lT,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",sT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,({issue:_,entityName:E,message:g,category:N},V)=>(t.openBlock(),t.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${V}`,class:t.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:T=>f(_)},[t.createVNode(De,{name:l[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",dT,[E?(t.openBlock(),t.createElementBlock("span",uT,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(g),1)]),t.unref(o).hasQuickFix(_)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(T=>t.unref(o).applyQuickFix(_),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,mT)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},t.toDisplayString(N),9,fT)],10,cT))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),hT={class:"em-history"},yT={class:"em-history__head"},gT={class:"em-history__title"},bT={class:"em-history__head-actions"},_T=["title","disabled"],kT=["title"],ET={class:"em-history__filters"},NT={class:"em-history__filter"},wT={key:0,class:"em-history__diffbar"},vT={class:"em-history__diffbar-range"},IT={class:"em-history__diffbar-count"},xT={class:"em-history__body"},CT={key:0,class:"em-history__empty"},ST={key:1,class:"em-history__diff-list"},$T=["onClick"],RT={class:"em-history__action-head"},AT={class:"em-history__action-name"},TT={key:0,class:"em-history__fields"},VT={class:"em-history__fname"},MT={key:0,class:"em-history__old"},BT={class:"em-history__val"},DT={key:1,class:"em-history__empty"},OT={key:2,class:"em-history__empty is-error"},LT={key:3,class:"em-history__empty"},PT={key:4,class:"em-history__list"},zT=["onClick"],UT={class:"em-history__summary"},FT={class:"em-history__seq"},HT={class:"em-history__gmeta"},jT={class:"em-history__who"},GT={key:0,class:"em-history__time"},KT={key:1,class:"em-history__restored-from"},YT=["onClick"],qT={key:0,class:"em-history__detail"},WT={class:"em-history__action-head"},XT={class:"em-history__action-name"},JT={key:0,class:"em-history__fields"},ZT={class:"em-history__fname"},QT={key:0,class:"em-history__old"},e2={class:"em-history__val"},t2={class:"em-history__preview"},n2=["disabled"],o2={key:0,class:"em-history__diff-list is-preview"},i2={class:"em-history__action-head"},a2={class:"em-history__action-name"},r2={key:0,class:"em-history__fields"},l2={class:"em-history__fname"},s2={key:0,class:"em-history__old"},c2={class:"em-history__val"},d2={class:"em-history__confirm-row"},u2={class:"em-history__confirm-msg"},m2=["disabled","onClick"],f2=["disabled"],p2=["onClick"],h2=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1);async function d(){if(a.historyTransport){l.value=!0,s.value=null;try{r.value=await a.historyTransport(),c.value=!0}catch(re){s.value=re instanceof Error?re.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await d()}t.watch(()=>o.open,re=>{re?m():S.value=null},{immediate:!0});let u=null;t.watch(()=>a.revision.value,()=>{o.open&&(u&&clearTimeout(u),u=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const p=t.computed(()=>new Map(a.state.logical.entities.map(re=>[re.modelId,re]))),y=t.computed(()=>new Map(a.state.logical.associations.map(re=>[re.modelId,re]))),f=t.computed(()=>new Map((a.state.logical.groups??[]).map(re=>{var _e;return[re.modelId,re.packageName||((_e=re.name)==null?void 0:_e.ko)||re.modelId]})));function b(re){var ue,L,D,K,Z,ne,te;const _e=y.value.get(re);if(!_e)return a.t("em.history.assocFallback");if((ue=_e.description)!=null&&ue.trim())return _e.description.trim();const me=(K=(D=p.value.get((L=_e.end1)==null?void 0:L.entityRef))==null?void 0:D.name)==null?void 0:K.trim(),ke=(te=(ne=p.value.get((Z=_e.end2)==null?void 0:Z.entityRef))==null?void 0:ne.name)==null?void 0:te.trim();return me&&ke?`${me}→${ke}`:a.t("em.history.assocFallback")}function h(re){var _e,me,ke,ue;if(re.kind==="entity")return((me=(_e=p.value.get(re.ref))==null?void 0:_e.name)==null?void 0:me.trim())||a.t("em.attr.nameless");if(re.kind==="attribute"||re.kind==="operation"||re.kind==="index"){const L=re.entityRef?p.value.get(re.entityRef):void 0,K=((re.kind==="attribute"?L==null?void 0:L.attributes:re.kind==="operation"?L==null?void 0:L.operations:L==null?void 0:L.indexes)??[]).find(ne=>ne.modelId===re.ref),Z=(ke=L==null?void 0:L.name)==null?void 0:ke.trim();return`${Z?Z+".":""}${((ue=K==null?void 0:K.name)==null?void 0:ue.trim())||re.ref}`}return re.kind==="association"?b(re.ref):re.kind==="associationEnd"?`${b(re.ref)}(${re.end})`:re.kind==="group"?a.t("em.history.groupSubject",{name:f.value.get(re.ref)??re.ref}):re.ref}const _={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},E={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},g=t.ref("all"),N=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],V=t.computed({get:()=>g.value,set:re=>{re&&(g.value=re)}}),T=t.computed(()=>kr(r.value)),I=t.computed(()=>T.value.length?T.value[0].seq:null),z=t.computed(()=>g.value==="all"?T.value:T.value.filter(re=>(re.kind??"edit")===g.value));function w(re){return re===void 0?"—":re===null?a.t("em.history.emptyValue"):typeof re=="object"?JSON.stringify(re):String(re)}function x(re){const _e=h(re.subject);if(re.verb==="add")return a.t("em.history.summaryAdd",{name:_e});if(re.verb==="remove")return a.t("em.history.summaryRemove",{name:_e});if(re.fields.length===1){const me=re.fields[0];return`${_e}.${me.field} ${me.oldValue!==void 0?w(me.oldValue)+"→":""}${w(me.value)}`}return a.t("em.history.summaryFields",{name:_e,n:re.fields.length})}function F(re){return re.actions.length===0?a.t("em.history.noChange"):re.actions.length===1?x(re.actions[0]):a.t("em.history.summaryMore",{summary:x(re.actions[0]),n:re.actions.length-1})}const C=t.ref(new Set);function se(re){const _e=new Set(C.value);_e.has(re)?_e.delete(re):_e.add(re),C.value=_e}function k(re){if(re==null)return"";const _e=new Date(re);return isNaN(_e.getTime())?String(re):_e.toLocaleString()}function G(re){const _e=re.author,me=re.origin;return _e&&me?`${_e}(${me})`:_e||(me?`(${me})`:"—")}const S=t.ref(null),H=t.computed(()=>S.value==null?null:Er(r.value,{fromSeq:S.value}));t.watch(()=>H.value?Ps(H.value):null,re=>i("diffChange",re));function Q(re){S.value=re,ge.value=null}function ie(re){return re.kind==="entity"?p.value.has(re.ref)?re.ref:null:(re.kind==="attribute"||re.kind==="operation"||re.kind==="index")&&re.entityRef?p.value.has(re.entityRef)?re.entityRef:null:re.kind==="group"&&f.value.has(re.ref)?re.ref:null}function oe(re){const _e=ie(re);_e&&a.requestFocus(_e)}const W={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},fe={added:"add",modified:"update",removed:"remove"},ge=t.ref(null),$e=t.ref(!1),pe=t.computed(()=>ge.value==null?null:Er(r.value,{fromSeq:ge.value})),Ne=t.ref(!1);function ve(re){ge.value=re,Ne.value=!1}async function Te(re){$e.value=!0;try{const _e=await a.restoreToSeq(re);_e.ok?S.value=null:s.value=a.t("em.history.restoreFailed",{reason:_e.reason??a.t("em.history.unknown")})}finally{$e.value=!1,ge.value=null}}return(re,_e)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var me,ke;return[t.withDirectives(t.createElementVNode("section",hT,[t.createElementVNode("header",yT,[t.createElementVNode("div",gT,[t.createVNode(De,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",bT,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:_e[0]||(_e[0]=ue=>d())},[t.createVNode(De,{name:"redo",size:15})],8,_T),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:_e[1]||(_e[1]=ue=>i("close"))},[t.createVNode(De,{name:"panel-close",size:15})],8,kT)])]),t.createElementVNode("div",ET,[t.createElementVNode("label",NT,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(le.BSSelect),{modelValue:V.value,"onUpdate:modelValue":_e[2]||(_e[2]=ue=>V.value=ue),items:N,"value-provider":ue=>ue.v,"label-provider":ue=>t.unref(a).t(ue.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),S.value!=null?(t.openBlock(),t.createElementBlock("div",wT,[t.createElementVNode("span",vT,t.toDisplayString(t.unref(a).t("em.history.diff.banner",{seq:S.value})),1),t.createElementVNode("span",IT,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((me=H.value)==null?void 0:me.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:_e[3]||(_e[3]=ue=>S.value=null)},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",xT,[S.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(ke=H.value)!=null&&ke.entries.length?(t.openBlock(),t.createElementBlock("ul",ST,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.value.entries,(ue,L)=>(t.openBlock(),t.createElementBlock("li",{key:L,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!ie(ue.subject)}]),onClick:D=>oe(ue.subject)},[t.createElementVNode("div",RT,[t.createVNode(De,{name:_[ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",AT,t.toDisplayString(h(ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${fe[ue.verb]}`])},t.toDisplayString(t.unref(a).t(W[ue.verb])),3)]),ue.fields.length?(t.openBlock(),t.createElementBlock("ul",TT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ue.fields,(D,K)=>(t.openBlock(),t.createElementBlock("li",{key:K,class:"em-history__field"},[t.createElementVNode("span",VT,t.toDisplayString(D.field),1),D.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",MT,t.toDisplayString(w(D.oldValue)),1)):t.createCommentVNode("",!0),D.oldValue!==void 0?(t.openBlock(),t.createBlock(De,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",BT,t.toDisplayString(w(D.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,$T))),128))])):(t.openBlock(),t.createElementBlock("p",CT,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",DT,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",OT,t.toDisplayString(s.value),1)):z.value.length===0?(t.openBlock(),t.createElementBlock("p",LT,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",PT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(z.value,ue=>{var L,D,K;return t.openBlock(),t.createElementBlock("li",{key:ue.seq,class:t.normalizeClass(["em-history__group",[`is-${ue.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Z=>se(ue.seq)},[t.createVNode(De,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":C.value.has(ue.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${ue.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(ue.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",UT,t.toDisplayString(F(ue)),1),t.createElementVNode("span",FT,"#"+t.toDisplayString(ue.seq),1)],8,zT),t.createElementVNode("div",HT,[t.createElementVNode("span",jT,t.toDisplayString(G(ue)),1),ue.ts?(t.openBlock(),t.createElementBlock("span",GT,t.toDisplayString(k(ue.ts)),1)):t.createCommentVNode("",!0),ue.kind==="restore"&&ue.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",KT,"← #"+t.toDisplayString(ue.restoredFromSeq),1)):t.createCommentVNode("",!0),ue.seq!==I.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Z=>Q(ue.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,YT)):t.createCommentVNode("",!0)]),C.value.has(ue.seq)?(t.openBlock(),t.createElementBlock("div",qT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ue.actions,(Z,ne)=>(t.openBlock(),t.createElementBlock("div",{key:ne,class:"em-history__action"},[t.createElementVNode("div",WT,[t.createVNode(De,{name:_[Z.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",XT,t.toDisplayString(h(Z.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Z.verb}`])},t.toDisplayString(t.unref(a).t(E[Z.verb])),3)]),Z.fields.length?(t.openBlock(),t.createElementBlock("ul",JT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.fields,(te,ye)=>(t.openBlock(),t.createElementBlock("li",{key:ye,class:"em-history__field"},[t.createElementVNode("span",ZT,t.toDisplayString(te.field),1),te.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",QT,t.toDisplayString(w(te.oldValue)),1)):t.createCommentVNode("",!0),te.oldValue!==void 0?(t.openBlock(),t.createBlock(De,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",e2,t.toDisplayString(w(te.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&ue.seq!==I.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":ge.value===ue.seq}])},[ge.value===ue.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",t2,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((L=pe.value)!=null&&L.entries.length),onClick:_e[4]||(_e[4]=Z=>Ne.value=!Ne.value)},[t.createVNode(De,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Ne.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((D=pe.value)!=null&&D.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:pe.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,n2),Ne.value&&((K=pe.value)!=null&&K.entries.length)?(t.openBlock(),t.createElementBlock("ul",o2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(pe.value.entries,(Z,ne)=>(t.openBlock(),t.createElementBlock("li",{key:ne,class:"em-history__diff-entry"},[t.createElementVNode("div",i2,[t.createVNode(De,{name:_[Z.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",a2,t.toDisplayString(h(Z.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${fe[Z.verb]}`])},t.toDisplayString(t.unref(a).t(W[Z.verb])),3)]),Z.fields.length?(t.openBlock(),t.createElementBlock("ul",r2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.fields,(te,ye)=>(t.openBlock(),t.createElementBlock("li",{key:ye,class:"em-history__field"},[t.createElementVNode("span",l2,t.toDisplayString(te.field),1),te.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",s2,t.toDisplayString(w(te.oldValue)),1)):t.createCommentVNode("",!0),te.oldValue!==void 0?(t.openBlock(),t.createBlock(De,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",c2,t.toDisplayString(w(te.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",d2,[t.createElementVNode("span",u2,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:$e.value,onClick:Z=>Te(ue.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,m2),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:$e.value,onClick:_e[5]||(_e[5]=Z=>ge.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,f2)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Z=>ve(ue.seq)},[t.createVNode(De,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,p2))],2)):t.createCommentVNode("",!0)],2)}),128))]))])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-03f53a89"]]);function y2(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function Tf(e){const n=t.ref(y2(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const m=e.edge==="left"?r-d.clientX:d.clientX-r;let u=l+m;u=Math.max(e.min,u),e.max!=null&&(u=Math.min(e.max,u)),n.value=u},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const g2={class:"em-modeler"},b2={class:"em-modeler__body"},_2={class:"em-drawer__inner"},k2={class:"em-drawer__head"},E2={class:"em-drawer__actions"},N2=["title"],w2=["title"],v2=["title"],I2=["title"],x2=["title"],C2=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(!1),a=t.shallowRef(null),{width:r,dragging:l,startResize:s}=Tf({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:c,dragging:d,startResize:m}=Tf({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),u=t.ref(null),p=t.ref(null);return(y,f)=>{var b,h,_;return t.openBlock(),t.createElementBlock("div",g2,[t.createVNode(Rf,{controller:e.controller,"history-open":i.value,onExportSvg:f[0]||(f[0]=E=>{var g;return(g=u.value)==null?void 0:g.exportSvg()}),onExportPng:f[1]||(f[1]=E=>{var g;return(g=u.value)==null?void 0:g.exportPng()}),onToggleHistory:f[2]||(f[2]=E=>i.value=!i.value)},null,8,["controller","history-open"]),t.createElementVNode("div",b2,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(r)+"px"})},[t.createElementVNode("div",_2,[t.createElementVNode("header",k2,[f[11]||(f[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",E2,[(b=p.value)!=null&&b.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((h=p.value)!=null&&h.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:f[3]||(f[3]=E=>{var g;return(g=p.value)==null?void 0:g.toggleAll()})},[t.createVNode(De,{name:(_=p.value)!=null&&_.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,N2)):t.createCommentVNode("",!0),t.createElementVNode("button",{type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:f[4]||(f[4]=E=>n.value=!1)},[t.createVNode(De,{name:"panel-close",size:16})],8,w2)])]),t.createVNode($f,{ref_key:"explorer",ref:p,controller:e.controller},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(l)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:f[5]||(f[5]=(...E)=>t.unref(s)&&t.unref(s)(...E))},null,42,v2),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:f[6]||(f[6]=E=>n.value=!0)},[t.createVNode(De,{name:"panel-open",size:18})],8,I2),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(l),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(r)-6+"px"})},[t.createVNode(Sf,{ref_key:"canvas",ref:u,controller:e.controller,"diff-marks":a.value},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Af,{controller:e.controller,width:t.unref(c),resizing:t.unref(d),"start-resize":t.unref(m),onCollapse:f[7]||(f[7]=E=>o.value=!1)},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:f[8]||(f[8]=E=>o.value=!0)},[t.createVNode(De,{name:"panel-right-open",size:18})],8,x2),[[t.vShow,!o.value]])]),_:1}),t.createVNode(h2,{controller:e.controller,open:i.value,onClose:f[9]||(f[9]=E=>i.value=!1),onDiffChange:f[10]||(f[10]=E=>a.value=E)},null,8,["controller","open"])]),t.createVNode(pT,{controller:e.controller,"panel-width":t.unref(c),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-d34c99f5"]]);Ee.APPLY_MODEL_OPS_INPUT_SCHEMA=sy,Ee.AssociationEdge=$m,Ee.CUSTOM_TYPE_VALUE=At,Ee.CommandStack=Nr,Ee.DEFAULT_JAVA_TYPE=ir,Ee.DIAGRAM_JSON_FORMAT=cr,Ee.DIAGRAM_JSON_VERSION=dr,Ee.DiagramCanvas=Sf,Ee.DiagramExplorer=$f,Ee.EDITOR=Bn,Ee.EditModeToggle=bR,Ee.EditorToolbar=Rf,Ee.EntityModeler=C2,Ee.EntityNode=fm,Ee.GROUP_CODE_ENUM_VALUE=Hn,Ee.GroupNode=pm,Ee.INHERITED_REF_PREFIX=fi,Ee.InvalidDiagramJsonError=pn,Ee.JAVA_TYPES=bi,Ee.NoteNode=hm,Ee.OpSyncAdapter=Rc,Ee.PHYSICAL_NAME_MAX_LENGTH=vo,Ee.PropertyPanel=Af,Ee.RevCache=$c,Ee.SELECTABLE_JAVA_TYPES=ms,Ee.SYMBOLIC_OP_KINDS=Ac,Ee.SYMBOLIC_OP_SCHEMA=jc,Ee.UI_LOCALES=xE,Ee.anchoredEdgePoint=Xa,Ee.buildAgentBatch=cy,Ee.buildDiagramSvg=Hl,Ee.buildDiffMarks=Ps,Ee.buildOrthogonalPath=Ka,Ee.buildSelfLoopPath=ql,Ee.buildStraightPath=qa,Ee.collectSharedColumns=mn,Ee.commands=wh,Ee.computeAutoLayout=Wl,Ee.createEditorController=Tw,Ee.defaultMermaidDialect=Xf,Ee.defaultSqlDialect=Np,Ee.diagramToJson=bs,Ee.displayLabel=pi,Ee.emptyState=sm,Ee.entityModelToDdl=ys,Ee.entityModelToMermaid=er,Ee.entityModelToText=es,Ee.estimateEntityHeight=Jl,Ee.exportDiagramPng=xf,Ee.exportDiagramSvg=If,Ee.fromPersisted=xy,Ee.indexColumnsByModelId=fn,Ee.isInheritedColumnRef=_o,Ee.javaTypeLabel=jn,Ee.makeInheritedColumnRef=Zl,Ee.mergeDiagram=Vs,Ee.mermaidErToImportSource=rs,Ee.migrateLegacyMoney=nh,Ee.multiplicityLabel=yi,Ee.newId=Ue,Ee.orthogonalMidpoints=Ya,Ee.packEntityBoxes=Za,Ee.parseDiagramJson=_s,Ee.parseInheritedColumnRef=Qa,Ee.parseMermaidEr=as,Ee.parseSqlDdl=nr,Ee.physicalNameLengthOverflow=ki,Ee.projectActionLog=kr,Ee.projectEntityAudit=Ds,Ee.projectFieldAudit=en,Ee.projectInheritedColumns=ko,Ee.projectSeqDiff=Er,Ee.rectExitPoint=Wa,Ee.renderDiagramSvg=Es,Ee.resolveColumnPhysicalName=Ei,Ee.resolveDiagram=Kl,Ee.resolveQuickFix=mr,Ee.resolveSharedColumn=Gn,Ee.resolveSymbolicOps=Kh,Ee.restoreDeepEqual=hn,Ee.scaffoldEntityJava=Mp,Ee.segmentMidpoints=Ja,Ee.sharedColumnScopeEntities=_i,Ee.sideDir=bo,Ee.sqlDdlToImportSource=ds,Ee.stereotypeLabel=Eo,Ee.synthesizeRestoreOps=fh,Ee.toPersisted=Uy,Ee.toPersistedV2=Fy,Ee.translate=St,Ee.uiMessagesEn=tm,Ee.uiMessagesJa=nm,Ee.uiMessagesKo=om,Ee.validateModel=hs,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})}));