@g1cloud/entity-modeler-next 5.2.5 → 5.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity-modeler.js +1031 -1029
- package/dist/entity-modeler.umd.cjs +13 -13
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(be,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):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,oe){"use strict";var VO=Object.defineProperty;var BO=(be,t,oe)=>t in be?VO(be,t,{enumerable:!0,configurable:!0,writable:!0,value:oe}):be[t]=oe;var ct=(be,t,oe)=>BO(be,typeof t!="symbol"?t+"":t,oe);const uy={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function my(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 mc(e,n,o={}){const i={...uy,...o},a=new Map(e.entities.map(b=>[b.modelId,b])),r=new Map(n.entityLayouts.map(b=>[b.entityRef,b])),l=new Map(n.associationLayouts.map(b=>[b.associationRef,b])),s=new Map;for(const b of e.groups)for(const _ of b.memberEntityRefs)s.set(_,b.modelId);const c=new Map;for(const b of n.groupLayouts)for(const _ of b.memberNoteRefs??[])c.set(_,b.groupRef);let d=0;const u=e.entities.map(b=>{const _=s.get(b.modelId),k=r.get(b.modelId);if(k){const y={location:{x:k.geo.location.x,y:k.geo.location.y},size:{width:k.geo.size.width,height:k.geo.size.height}};return{entity:b,geo:y,collapsed:k.collapsed??!1,locked:k.locked??!1,groupRef:_,style:k.style,attributeStyles:k.attributeStyles,operationStyles:k.operationStyles}}const N=my(d++,i);return{entity:b,geo:N,collapsed:!1,locked:!1,groupRef:_}}),m=new Map(n.groupLayouts.map(b=>[b.groupRef,b])),p=e.groups.map(b=>{const _=m.get(b.modelId),k=_?{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:b,geo:k,style:_==null?void 0:_.style,locked:(_==null?void 0:_.locked)??!1}}),f=e.associations.map(b=>{const _=l.get(b.modelId);return{association:b,waypoints:(_==null?void 0:_.waypoints)??[],sourceColumnRef:_==null?void 0:_.sourceColumnRef,targetColumnRef:_==null?void 0:_.targetColumnRef}}),h=n.notes.map(b=>({note:{...b,geo:{location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}}},groupRef:c.get(b.modelId)})),g=[];for(const b of n.notes)for(const _ of b.connections??[])a.has(_.targetRef)&&g.push({noteRef:b.modelId,targetRef:_.targetRef,waypoints:_.waypoints.map(k=>({x:k.x,y:k.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:g}}const fy={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function fc(e,n,o={}){const i={...fy,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,b)=>{const _=b%h,k=Math.floor(b/h);r.push({id:g,location:{x:p.x+i.pad+_*i.cellWidth,y:p.y+i.pad+i.headerHeight+k*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 p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const pc={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function py(e,n={}){const o={...pc,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Ur(e,n={}){const o={...pc,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=py(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}}})}function Jn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function hc(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const hy={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity",SERIALIZED_TYPE:"Serialized"};function li(e){return hy[e]??e}function _t(e){return e==="JPA_EMBEDDABLE"||e==="SERIALIZED_TYPE"}function hn(e){return e==="SERIALIZED_TYPE"}const oa="inherited:";function yc(e,n){return`${oa}${e}:${n}`}function Xn(e){return e.startsWith(oa)}function Hr(e){if(!Xn(e))return null;const n=e.slice(oa.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 si(e,n){var a;if(_t(e.stereotype))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:yc(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 ia(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function yn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function jr(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function Kr(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Zn(e,n,o,i,a=0){var d;if(!ia(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return Ao(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??Ao(s)[a]}}if(s)return Ao(s)[a]}function Ao(e){return((e==null?void 0:e.attributes)??[]).filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}function yy(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=gc(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function gn(e,n){return gc(e,n,new Set)}function gc(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=yy(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const bc=e=>e==null||e.trim()==="";function _c(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=gn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Zn(e,o,i.entities,i.associations,n)}function bn(e,n,o,i,a,r){const l=_c(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:gy(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function gy(e){return e!=null&&Object.values(e).some(n=>!bc(n))}function ci(e,n,o,i,a,r){var l;return bc(n.physicalName)?((l=_c(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function kc(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Gr(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 Dn(e,n){return Gr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function $o(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Qn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function To(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function by(e,n,o){const i=To(e,o),a=To(n,o);return i.kind===a.kind&&i.value!==a.value}function Mo(e){const n=new Map;for(const o of e.entities){if(o.stereotype!=="SERIALIZED_TYPE"||!o.name)continue;const i=n.get(o.name);i?i.push(o):n.set(o.name,[o])}return n}function Ec(e,n){var i,a;const o=(i=n==null?void 0:n.serialization)==null?void 0:i.collectionType;if(!o)return e;if(o==="MAP"){const r=(a=n==null?void 0:n.serialization)==null?void 0:a.mapKeyType;return`Map<${r&&r.trim()?r.slice(r.lastIndexOf(".")+1):"?"}, ${e}>`}return`${o==="SET"?"Set":"List"}<${e}>`}function di(e,n,o,i){if(n.size===0)return{kind:"none"};const a=n.has(e.type)?e.type:e.customType&&n.has(e.customType)?e.customType:void 0;if(!a)return{kind:"none"};const r=n.get(a);if(r.length===1)return{kind:"resolved",entity:r[0]};if(o&&i){const l=To(o,i),s=r.filter(c=>{const d=To(c,i);return d.kind===l.kind&&d.value===l.value});if(s.length===1)return{kind:"resolved",entity:s[0]}}return{kind:"ambiguous",name:a,candidates:r}}const Nc=["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"],_y=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"]),ky=Nc.filter(e=>!_y.has(e)),Ey={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Yr(e){return Ey[e]??e}const Ny=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),qr=new Set(["NUMERIC","DECIMAL"]);function wc(e,n=ky){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const _n="CustomType";function Ic(e){var o;if(e.type!==_n)return;const n=(o=e.customType)==null?void 0:o.trim();return n||void 0}const eo="GroupCodeEnum",Wr="String",ui=[{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:eo,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:_n,label:"CustomType"}],wy=new Map(ui.map(e=>[e.value,e.label]));function mi(e){return wy.get(e)??e}const Iy={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function vc(e){if(e)return Iy[e.toUpperCase()]}const vy={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[eo]:new Set(["VARCHAR","CHAR"])},Cy=new Map(ui.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function Sy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!Nc.includes(i))return;const a=Cy.get(o)??o,r=vy[a];if(r)return r.has(i)}const xy=new Set([eo,"CustomMoneyType"]),Cc=ui.filter(e=>!xy.has(e.value)).map(e=>e.value===_n?{...e,label:"CustomType (사용자정의)"}:e);function Sc(e,n=[],o=[]){const i=n.map(l=>{var c,d;const s=((c=l.label)==null?void 0:c.ko)??((d=l.label)==null?void 0:d.en);return{value:l.type,label:s?`${l.type} (${s})`:l.type}}),a=o.map(l=>({value:l,label:l})),r=[...Cc,...i,...a];return e&&!r.some(l=>l.value===e)?[{value:e,label:mi(e)},...r]:r}function Ry(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function aa(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 Jr(e,n,o,i,a){var r;if(n.attrType==="DIVIDER"||e==="LOGICAL")return"";if((e==="CLASS"||yn(n))&&n.attrType.startsWith("RELATION")&&i)return o?`${o==="SET"?"Set":"List"}<${i}>`:i;if(o&&n.attrType.startsWith("EMBED"))return`${o==="SET"?"Set":"List"}<${mi(n.type)}>`;if(Ry(n))return mi(n.type);if(e==="CLASS"){const l=Ic(n)??mi(n.type);return a?Ec(l,a):l}return Yr(((r=n.dbAttrs[0])==null?void 0:r.dataType)??"")}function ra(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}}const xc="(미지정)",Ay="(이름 없음)",la=e=>e==null||String(e).trim()==="",sa=e=>la(e)?Ay:String(e),Rc=e=>la(e)?xc:String(e);function Ac(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..*"}return xc}function $c(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=la(n)?Rc(e.physicalName):String(n),a=la(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Tc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Mc(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),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(`## ${sa(c.name)}${d} «${li(c.stereotype)}»${u?` [${u}]`:""}`);const m=$o(Dn(c,e.entities)),p=b=>{var _;return b.sharedColumnRef?(_=Qn(b,m))==null?void 0:_.physicalName:void 0},f=[...c.attributes].sort((b,_)=>b.order-_.order);for(const b of f){if(b.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${b.name?` ${b.name} ${"─".repeat(8)}`:""}`);continue}const _=b.dbAttrs.map((D,C)=>bn(b,D,C,c,e,n)),k=[b.identifier?"PK":"",b.notNull&&!hn(c.stereotype)?"NOT NULL":""].filter(Boolean),N=di(b,Mo(e),c,e),y=Ic(b)??b.type,E=N.kind==="resolved"?Ec(y,N.entity):Rc(y),S=` - ${sa(b.name)}: ${E}`,A=D=>D.length?` {${D.join(", ")}}`:"";if(_.length>1){a.push(`${S}${A(k)}`),_.forEach((D,C)=>{const R=kc(b,C,e,n);a.push(` · ${R?`${R} → `:""}${$c(D,p(D))}${A(Tc(D))}`)});continue}const V=_[0],T=V?` → ${$c(V,p(V))}`:"";a.push(`${S}${T}${A([...k,...V?Tc(V):[]])}`)}const h=Jn(c.attributes);for(const b of c.indexes??[]){const _=b.columns.map(k=>{var N,y;return`${((N=h.attributeOf(k.columnRef))==null?void 0:N.name)??((y=Hr(k.columnRef))==null?void 0:y.field)??k.columnRef}${k.descending?" DESC":""}`}).join(", ");a.push(` index ${sa(b.name)}${b.unique?" UNIQUE":""}: ${_}`)}const g=[...c.operations??[]].sort((b,_)=>b.order-_.order);for(const b of g){const _=b.visibility?` {${b.visibility}}`:"",k=(s=b.description)!=null&&s.ko?` — ${b.description.ko}`:"";a.push(` method ${sa(b.name)}()${_}${k}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ac(c.end1.multiplicity)} —— ${Ac(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
1
|
+
(function(be,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):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,oe){"use strict";var VO=Object.defineProperty;var BO=(be,t,oe)=>t in be?VO(be,t,{enumerable:!0,configurable:!0,writable:!0,value:oe}):be[t]=oe;var ct=(be,t,oe)=>BO(be,typeof t!="symbol"?t+"":t,oe);const uy={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function my(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 mc(e,n,o={}){const i={...uy,...o},a=new Map(e.entities.map(b=>[b.modelId,b])),r=new Map(n.entityLayouts.map(b=>[b.entityRef,b])),l=new Map(n.associationLayouts.map(b=>[b.associationRef,b])),s=new Map;for(const b of e.groups)for(const _ of b.memberEntityRefs)s.set(_,b.modelId);const c=new Map;for(const b of n.groupLayouts)for(const _ of b.memberNoteRefs??[])c.set(_,b.groupRef);let d=0;const u=e.entities.map(b=>{const _=s.get(b.modelId),E=r.get(b.modelId);if(E){const y={location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}};return{entity:b,geo:y,collapsed:E.collapsed??!1,locked:E.locked??!1,groupRef:_,style:E.style,attributeStyles:E.attributeStyles,operationStyles:E.operationStyles}}const N=my(d++,i);return{entity:b,geo:N,collapsed:!1,locked:!1,groupRef:_}}),m=new Map(n.groupLayouts.map(b=>[b.groupRef,b])),p=e.groups.map(b=>{const _=m.get(b.modelId),E=_?{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:b,geo:E,style:_==null?void 0:_.style,locked:(_==null?void 0:_.locked)??!1}}),f=e.associations.map(b=>{const _=l.get(b.modelId);return{association:b,waypoints:(_==null?void 0:_.waypoints)??[],sourceColumnRef:_==null?void 0:_.sourceColumnRef,targetColumnRef:_==null?void 0:_.targetColumnRef}}),h=n.notes.map(b=>({note:{...b,geo:{location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}}},groupRef:c.get(b.modelId)})),g=[];for(const b of n.notes)for(const _ of b.connections??[])a.has(_.targetRef)&&g.push({noteRef:b.modelId,targetRef:_.targetRef,waypoints:_.waypoints.map(E=>({x:E.x,y:E.y}))});return{entities:u,associations:f,groups:p,notes:h,noteConnections:g}}const fy={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function fc(e,n,o={}){const i={...fy,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const h=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,b)=>{const _=b%h,E=Math.floor(b/h);r.push({id:g,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(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 p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const pc={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function py(e,n={}){const o={...pc,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Ur(e,n={}){const o={...pc,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=py(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}}})}function Jn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function hc(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const hy={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity",SERIALIZED_TYPE:"Serialized"};function li(e){return hy[e]??e}function _t(e){return e==="JPA_EMBEDDABLE"||e==="SERIALIZED_TYPE"}function hn(e){return e==="SERIALIZED_TYPE"}const oa="inherited:";function yc(e,n){return`${oa}${e}:${n}`}function Xn(e){return e.startsWith(oa)}function Hr(e){if(!Xn(e))return null;const n=e.slice(oa.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 si(e,n){var a;if(_t(e.stereotype))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:yc(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 ia(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function yn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function jr(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function Kr(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Zn(e,n,o,i,a=0){var d;if(!ia(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return Ao(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??Ao(s)[a]}}if(s)return Ao(s)[a]}function Ao(e){return((e==null?void 0:e.attributes)??[]).filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}function yy(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=gc(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function gn(e,n){return gc(e,n,new Set)}function gc(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=yy(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const bc=e=>e==null||e.trim()==="";function _c(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=gn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Zn(e,o,i.entities,i.associations,n)}function bn(e,n,o,i,a,r){const l=_c(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:gy(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function gy(e){return e!=null&&Object.values(e).some(n=>!bc(n))}function ci(e,n,o,i,a,r){var l;return bc(n.physicalName)?((l=_c(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function kc(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Gr(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 Dn(e,n){return Gr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function $o(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Qn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function To(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function by(e,n,o){const i=To(e,o),a=To(n,o);return i.kind===a.kind&&i.value!==a.value}function Mo(e){const n=new Map;for(const o of e.entities){if(o.stereotype!=="SERIALIZED_TYPE"||!o.name)continue;const i=n.get(o.name);i?i.push(o):n.set(o.name,[o])}return n}function Ec(e,n){var i,a;const o=(i=n==null?void 0:n.serialization)==null?void 0:i.collectionType;if(!o)return e;if(o==="MAP"){const r=(a=n==null?void 0:n.serialization)==null?void 0:a.mapKeyType;return`Map<${r&&r.trim()?r.slice(r.lastIndexOf(".")+1):"?"}, ${e}>`}return`${o==="SET"?"Set":"List"}<${e}>`}function di(e,n,o,i){if(n.size===0)return{kind:"none"};const a=n.has(e.type)?e.type:e.customType&&n.has(e.customType)?e.customType:void 0;if(!a)return{kind:"none"};const r=n.get(a);if(r.length===1)return{kind:"resolved",entity:r[0]};if(o&&i){const l=To(o,i),s=r.filter(c=>{const d=To(c,i);return d.kind===l.kind&&d.value===l.value});if(s.length===1)return{kind:"resolved",entity:s[0]}}return{kind:"ambiguous",name:a,candidates:r}}const Nc=["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"],_y=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"]),ky=Nc.filter(e=>!_y.has(e)),Ey={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function Yr(e){return Ey[e]??e}const Ny=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),qr=new Set(["NUMERIC","DECIMAL"]);function wc(e,n=ky){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const _n="CustomType";function Ic(e){var o;if(e.type!==_n)return;const n=(o=e.customType)==null?void 0:o.trim();return n||void 0}const eo="GroupCodeEnum",Wr="String",ui=[{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:eo,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:_n,label:"CustomType"}],wy=new Map(ui.map(e=>[e.value,e.label]));function mi(e){return wy.get(e)??e}const Iy={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function vc(e){if(e)return Iy[e.toUpperCase()]}const vy={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[eo]:new Set(["VARCHAR","CHAR"])},Cy=new Map(ui.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function Sy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!Nc.includes(i))return;const a=Cy.get(o)??o,r=vy[a];if(r)return r.has(i)}const xy=new Set([eo,"CustomMoneyType"]),Cc=ui.filter(e=>!xy.has(e.value)).map(e=>e.value===_n?{...e,label:"CustomType (사용자정의)"}:e);function Sc(e,n=[],o=[]){const i=n.map(l=>{var c,d;const s=((c=l.label)==null?void 0:c.ko)??((d=l.label)==null?void 0:d.en);return{value:l.type,label:s?`${l.type} (${s})`:l.type}}),a=o.map(l=>({value:l,label:l})),r=[...Cc,...i,...a];return e&&!r.some(l=>l.value===e)?[{value:e,label:mi(e)},...r]:r}function Ry(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function aa(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 Jr(e,n,o,i,a){var r;if(n.attrType==="DIVIDER"||e==="LOGICAL")return"";if((e==="CLASS"||yn(n))&&n.attrType.startsWith("RELATION")&&i)return o?`${o==="SET"?"Set":"List"}<${i}>`:i;if(o&&n.attrType.startsWith("EMBED"))return`${o==="SET"?"Set":"List"}<${mi(n.type)}>`;if(Ry(n))return mi(n.type);if(e==="CLASS"){const l=Ic(n)??mi(n.type);return a?Ec(l,a):l}return Yr(((r=n.dbAttrs[0])==null?void 0:r.dataType)??"")}function ra(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}}const xc="(미지정)",Ay="(이름 없음)",la=e=>e==null||String(e).trim()==="",sa=e=>la(e)?Ay:String(e),Rc=e=>la(e)?xc:String(e);function Ac(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..*"}return xc}function $c(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=la(n)?Rc(e.physicalName):String(n),a=la(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function Tc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Mc(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),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(`## ${sa(c.name)}${d} «${li(c.stereotype)}»${u?` [${u}]`:""}`);const m=$o(Dn(c,e.entities)),p=b=>{var _;return b.sharedColumnRef?(_=Qn(b,m))==null?void 0:_.physicalName:void 0},f=[...c.attributes].sort((b,_)=>b.order-_.order);for(const b of f){if(b.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${b.name?` ${b.name} ${"─".repeat(8)}`:""}`);continue}const _=b.dbAttrs.map((D,C)=>bn(b,D,C,c,e,n)),E=[b.identifier?"PK":"",b.notNull&&!hn(c.stereotype)?"NOT NULL":""].filter(Boolean),N=di(b,Mo(e),c,e),y=Ic(b)??b.type,k=N.kind==="resolved"?Ec(y,N.entity):Rc(y),S=` - ${sa(b.name)}: ${k}`,A=D=>D.length?` {${D.join(", ")}}`:"";if(_.length>1){a.push(`${S}${A(E)}`),_.forEach((D,C)=>{const R=kc(b,C,e,n);a.push(` · ${R?`${R} → `:""}${$c(D,p(D))}${A(Tc(D))}`)});continue}const V=_[0],T=V?` → ${$c(V,p(V))}`:"";a.push(`${S}${T}${A([...E,...V?Tc(V):[]])}`)}const h=Jn(c.attributes);for(const b of c.indexes??[]){const _=b.columns.map(E=>{var N,y;return`${((N=h.attributeOf(E.columnRef))==null?void 0:N.name)??((y=Hr(E.columnRef))==null?void 0:y.field)??E.columnRef}${E.descending?" DESC":""}`}).join(", ");a.push(` index ${sa(b.name)}${b.unique?" UNIQUE":""}: ${_}`)}const g=[...c.operations??[]].sort((b,_)=>b.order-_.order);for(const b of g){const _=b.visibility?` {${b.visibility}}`:"",E=(s=b.description)!=null&&s.ko?` — ${b.description.ko}`:"";a.push(` method ${sa(b.name)}()${_}${E}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Ac(c.end1.multiplicity)} —— ${Ac(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
2
|
`).trim()}function Vo(e){return e.referenceOnly===!0}function Xr(e){const n=new Set;for(const o of e.entities)Vo(o)&&n.add(o.modelId);return n}function Vc(e){return e.entities.filter(n=>!Vo(n))}function Bc(e,n=Xr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function Zr(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function $y(e,n){return Vo(e)||n===!0}const Ty=e=>e&&e[0].toLowerCase()+e.slice(1);function ca(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Dc(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function da(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 My(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function ua(e,n){const o=Ty(e);return n?My(o):o}function to(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Vy(e){return e==="CLASS"?"class":"er"}function Qr(e,n,o){const i=By(e);return n==="class"?Uy(i):Py(i,o)}function By(e){const n=Xr(e);return n.size===0?e:{...e,entities:Vc(e),associations:Bc(e,n)}}function fi(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function el(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function Oc(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=fi(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 Dy(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const Lc=da;function tl(e){return e!=null&&Pc[e]!=null}const Pc={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function zc(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=tl(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?Pc:o)[i]}function Oy(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=bn(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:kc(e,l,o,i),d=fi(s.dataType||e.type,"unknown"),u=fi(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(Ly(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function Ly(e,n,o,i,a,r){const l=[o.identifier?"PK":"",Dy(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=el([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function Py(e,n){const o=Oc(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),i=["erDiagram"];for(const r of e.entities){const l=o.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){i.push(` ${l}`);continue}i.push(` ${l} {`);for(const c of s)for(const d of Oy(c,r,e,n))i.push(d);i.push(" }")}const a=[];for(const r of e.associations){const l=o.get(r.end1.entityRef),s=o.get(r.end2.entityRef);if(!l||!s)continue;const c=`${zc(r.end1.multiplicity,"left")}--${zc(r.end2.multiplicity,"right")}`,d=el(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!tl(r.end1.multiplicity)||!tl(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
|
|
3
3
|
`)}function zy(e){return e&&e!=="UNDEFINED"?li(e):null}function Fy(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function Uy(e){const n=Oc(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=zy(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(` +${Fy(c.type)} ${fi(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${fi(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=Hy(i),s=el(i.description),c=` ${a} "${Lc(i.end1.multiplicity)}" ${l} "${Lc(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
4
|
`)}function Hy(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Pe(){return crypto.randomUUID()}const jy={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},Ky={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function Gy(e,n,o){var a,r;if(!o.size)return;const i=new Map(e.map(l=>[l.modelId,l]));for(const l of e){const s=l.attributes.filter(d=>o.has(d.modelId));if(!s.length)continue;const c=n.filter(d=>d.end2.entityRef===l.modelId).map(d=>({assoc:d,parent:i.get(d.end1.entityRef)})).filter(d=>d.parent!=null);if(c.length)for(const d of s){const u=(a=d.dbAttrs[0])==null?void 0:a.physicalName,m=(f,h)=>f.attributes.find(g=>{var b;return g.identifier&&(h==null||((b=g.dbAttrs[0])==null?void 0:b.physicalName)===h)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(h=>m(h.parent,u)!=null);f.length===1&&(p=f[0])}p&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:p.assoc.modelId,sourceAttributeRef:((r=m(p.parent,u)??m(p.parent))==null?void 0:r.modelId)??""},p.assoc.end2.attributeRef||(p.assoc.end2.attributeRef=d.modelId))}}}function Yy(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(h=>h.trim()).filter(Boolean));let d,u,m;if(i!=null){const h=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(h){d=Number(h[1]),h[2]!=null&&(u=Number(h[2]));const g=i.slice(0,h.index).trim();g&&(m=g)}else i.trim()&&(m=i.trim())}const p={modelId:Pe(),physicalName:s,dataType:l};return d!=null&&(p.length=d),u!=null&&(p.scale=u),c.has("UK")&&(p.unique=!0),m&&(p.logicalName={ko:m}),{attr:{modelId:Pe(),name:s,type:vc(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function Fc(e){const n=e.split(`
|
|
5
|
-
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Pe(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=Yy(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,h]=p[2].split(/--|\.\./);let g=(p[4]??"").trim();const b=g.match(/^"([^"]*)"$/);b&&(g=b[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:h??"",label:g});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Pe(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:jy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:Ky[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return Gy(o,c,r),{modelId:Pe(),entities:o,associations:c,groups:[]}}function Uc(e){const n=Fc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Ur(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:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const Hc={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"}},qy=Object.keys(Hc).sort((e,n)=>n.length-e.length),jc=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Bo=`${jc}(?:\\.${jc})*`,Wy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Bo})\s*\(([\s\S]*)\)\s*$`,"i"),Jy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Bo})\s*\(([^)]*)\)`,"i"),Xy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Bo})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Bo})\s*\(([^)]*)\)`,"i"),Zy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Bo})\s+ON\s+(${Bo})\s*\(([^)]*)\)`,"i");function zt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function no(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 Qy(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=zt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const b of qy)if(a.startsWith(b)){const _=Hc[b];r=_.dataType,l=!!_.autoIncrement;let
|
|
6
|
-
`)}function lg(e,n){const o=ng(e),i=new Map,a=new Map,r=new Map;for(const m of e.entities)for(const p of ma(m)){i.set(p.modelId,m);const f=[];p.dbAttrs.forEach((h,g)=>{const b=bn(p,h,g,m,e,n);qc(b)&&(f[g]=b.physicalName,r.set(h.modelId,b.physicalName))}),a.set(p.modelId,f)}const l=(m,p)=>{const f=Ao(m)[p];return f?r.get(f.modelId):void 0},s=[],c=[],d=[];for(const m of o){const p=ol(m),f=ag(m,e,n);if(f.length===0)continue;const h=new Map,g=new Map;for(const{attr:T,col:D,name:C}of f){const R=T.dbAttrs.findIndex(w=>w.modelId===D.modelId),$=h.get(T.modelId)??[];$[R<0?$.length:R]=C,h.set(T.modelId,$),g.set(D.modelId,C)}const b=new Set,_=[],
|
|
5
|
+
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Pe(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=Yy(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,h]=p[2].split(/--|\.\./);let g=(p[4]??"").trim();const b=g.match(/^"([^"]*)"$/);b&&(g=b[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:h??"",label:g});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Pe(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:jy[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:Ky[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return Gy(o,c,r),{modelId:Pe(),entities:o,associations:c,groups:[]}}function Uc(e){const n=Fc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Ur(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:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const Hc={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"}},qy=Object.keys(Hc).sort((e,n)=>n.length-e.length),jc=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Bo=`${jc}(?:\\.${jc})*`,Wy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Bo})\s*\(([\s\S]*)\)\s*$`,"i"),Jy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Bo})\s*\(([^)]*)\)`,"i"),Xy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Bo})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Bo})\s*\(([^)]*)\)`,"i"),Zy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Bo})\s+ON\s+(${Bo})\s*\(([^)]*)\)`,"i");function zt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function no(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 Qy(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=zt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const b of qy)if(a.startsWith(b)){const _=Hc[b];r=_.dataType,l=!!_.autoIncrement;let E=i.slice(b.length);const N=E.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);N&&(s=Number(N[1]),N[2]!=null&&(c=Number(N[2])),E=E.slice(N[0].length)),d=E,u=!0;break}if(!u){const b=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);b&&(r=b[1].toUpperCase(),b[2]!=null&&(s=Number(b[2])),b[3]!=null&&(c=Number(b[3])),d=b[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),h=/\bUNIQUE\b/.test(m),g={modelId:Pe(),physicalName:o,dataType:r};return s!=null&&(g.length=s),c!=null&&(g.scale=c),h&&(g.unique=!0),l&&(g.autoIncrement=!0),{primaryKey:p,attr:{modelId:Pe(),name:o,type:vc(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[g]}}}function eg(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function Kc(e){const n=e.match(/\(([^)]*)\)/);return n?no(n[1]).map(zt):[]}function nl(e){var d;const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(u=>u.trim()).filter(Boolean);for(const u of c){const m=u.match(Wy);if(!m)continue;const p=zt(m[1]),f=m[2],h={modelId:Pe(),name:p,stereotype:"JPA_ENTITY",table:{physicalName:p},attributes:[]},g=new Map,b=[];let _=0;for(const E of no(f)){if(eg(E)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(E))b.push(...Kc(E));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(E))for(const k of Kc(E)){const S=g.get(k.toLowerCase());S!=null&&S.dbAttrs[0]&&(S.dbAttrs[0].unique=!0)}const y=E.match(Jy);y&&l.push({childTable:p,childCols:no(y[1]).map(zt),parentTable:zt(y[2]),parentCols:no(y[3]).map(zt)});continue}const N=Qy(E);if(!N){n.push(`컬럼 정의 해석 실패: ${E.slice(0,40)}`);continue}N.attr.order=_++,N.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${p}.${N.attr.name} — ${(d=N.attr.dbAttrs[0])==null?void 0:d.dataType}`),h.attributes.push(N.attr),g.set(N.attr.name.toLowerCase(),N.attr)}for(const E of b){const N=g.get(E.toLowerCase());N&&(N.identifier=!0,N.notNull=!0)}o.push(h),i.set(p.toLowerCase(),h);for(const[E,N]of g)a.set(`${p.toLowerCase()}.${E}`,N)}for(const u of c){const m=u.match(Xy);m&&l.push({childTable:zt(m[1]),childCols:no(m[2]).map(zt),parentTable:zt(m[3]),parentCols:no(m[4]).map(zt)})}for(const u of l){const m=i.get(u.childTable.toLowerCase()),p=i.get(u.parentTable.toLowerCase());if(!m||!p){n.push(`FK 대상 테이블 없음: ${u.childTable}→${u.parentTable}`);continue}const f=a.get(`${u.childTable.toLowerCase()}.${(u.childCols[0]??"").toLowerCase()}`),h={modelId:Pe(),end1:{entityRef:p.modelId,multiplicity:f!=null&&f.notNull?"EXACTLY_ONE_INSTANCE":"NO_INSTANCE_OR_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};u.childCols.forEach((g,b)=>{const _=a.get(`${u.childTable.toLowerCase()}.${g.toLowerCase()}`),E=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[b]??"").toLowerCase()}`);_&&(_.attrType="RELATION_OWN",_.derivedFrom={associationRef:h.modelId,sourceAttributeRef:(E==null?void 0:E.modelId)??""},b===0&&(h.end2.attributeRef=_.modelId))}),r.push(h)}for(const u of c){const m=u.match(Zy);if(!m)continue;const p=zt(m[3]),f=i.get(p.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${p}`);continue}const g=no(m[4]).map(_=>zt(_.replace(/\s+(ASC|DESC)$/i,""))).map(_=>{var E,N;return(N=(E=a.get(`${p.toLowerCase()}.${_.toLowerCase()}`))==null?void 0:E.dbAttrs[0])==null?void 0:N.modelId}).filter(_=>!!_).map(_=>({columnRef:_,descending:!1}));if(!g.length)continue;const b={modelId:Pe(),name:zt(m[2]),unique:!!m[1],columns:g};f.indexes=[...f.indexes??[],b]}return{logical:{modelId:Pe(),entities:o,associations:r,groups:[]},warnings:n}}function Gc(e){const{logical:n}=nl(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Ur(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:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function tg(){return"postgres"}function Yc(e,n="postgres",o){return lg(e,o)}const Do=e=>e==null||e.trim()==="";function ma(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function ng(e){const n=new Set;for(const o of e.groups)if(o.excludeDDLGeneration)for(const i of o.memberEntityRefs)n.add(i);return e.entities.filter(o=>!_t(o.stereotype)&&!n.has(o.modelId)&&!Vo(o))}function ol(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const og={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 ig(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":og[n]??n.toLowerCase()}function ag(e,n,o){const i=[];for(const a of ma(e))a.dbAttrs.forEach((r,l)=>{const s=bn(a,r,l,e,n,o);qc(s)&&i.push({attr:a,col:s,name:s.physicalName})});return i}function qc(e){return e.sharedColumnRef==null&&!Do(e.physicalName)&&!Do(e.dataType)}function rg(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function lg(e,n){const o=ng(e),i=new Map,a=new Map,r=new Map;for(const m of e.entities)for(const p of ma(m)){i.set(p.modelId,m);const f=[];p.dbAttrs.forEach((h,g)=>{const b=bn(p,h,g,m,e,n);qc(b)&&(f[g]=b.physicalName,r.set(h.modelId,b.physicalName))}),a.set(p.modelId,f)}const l=(m,p)=>{const f=Ao(m)[p];return f?r.get(f.modelId):void 0},s=[],c=[],d=[];for(const m of o){const p=ol(m),f=ag(m,e,n);if(f.length===0)continue;const h=new Map,g=new Map;for(const{attr:T,col:D,name:C}of f){const R=T.dbAttrs.findIndex(w=>w.modelId===D.modelId),$=h.get(T.modelId)??[];$[R<0?$.length:R]=C,h.set(T.modelId,$),g.set(D.modelId,C)}const b=new Set,_=[],E=[];for(const{attr:T,col:D,name:C}of f){if(b.has(C)){_.push({attr:T,col:D,name:C});continue}b.add(C);const R=[` ${C} ${ig(D)}`];T.notNull&&!T.identifier&&R.push("NOT NULL"),D.unique&&R.push("UNIQUE"),E.push(R.join(" "))}const N=ma(m).filter(T=>T.identifier).flatMap(T=>h.get(T.modelId)??[]).filter(T=>!Do(T));N.length&&E.push(` PRIMARY KEY (${N.join(", ")})`);const y=E.join(`,
|
|
7
7
|
`)+(_.length?`
|
|
8
8
|
${rg(_)}`:"");s.push(`CREATE TABLE ${p} (
|
|
9
9
|
${y}
|
|
10
|
-
);`);const
|
|
10
|
+
);`);const k=new Map,S=[];for(const T of ma(m)){const D=T.derivedFrom;if(!D)continue;const C=i.get(D.sourceAttributeRef);if(!C)continue;if(Vo(C)){S.push(`${T.name||T.modelId} → ${ol(C)}`);continue}const R=h.get(T.modelId)??[],$=a.get(D.sourceAttributeRef)??[],w=C.attributes.find(B=>B.modelId===D.sourceAttributeRef),I=[];for(let B=0;B<Math.max(R.length,$.length);B++){const M=R[B],x=w!=null&&w.dbAttrs[B]?$[B]:l(C,B);Do(M)||Do(x)||I.push([M,x])}if(!I.length)continue;const v=k.get(D.associationRef)??{childCols:[],parentTable:ol(C),parentCols:[]};for(const[B,M]of I)v.childCols.push(B),v.parentCols.push(M);k.set(D.associationRef,v)}S.length&&c.push(`-- ⚠ ${p}: 참고 전용 부모를 참조하는 FK ${S.length}개 생략 — ${S.join(", ")}`);let A=0;for(const T of k.values()){const D=`fk_${p}_${T.parentTable}${k.size>1?`_${++A}`:""}`;c.push(`ALTER TABLE ${p} ADD CONSTRAINT ${D} FOREIGN KEY (${T.childCols.join(", ")}) REFERENCES ${T.parentTable} (${T.parentCols.join(", ")});`)}const V=Jn(m.attributes);for(const T of m.indexes??[]){const D=[],C=[],R=[],$=new Set;for(const I of T.columns){const v=g.get(V.canon(I.columnRef));if(Do(v)){Xn(I.columnRef)||C.push(hc(V,I.columnRef));continue}if($.has(v)){R.push(v);continue}$.add(v),D.push(v)}if(C.length&&d.push(`-- ⚠ ${p} 인덱스 ${T.name||"(이름 없음)"}: 컬럼 참조 미해소 ${C.length}개 생략 — ${C.join(", ")}`),R.length&&d.push(`-- ⚠ ${p} 인덱스 ${T.name||"(이름 없음)"}: 중복 컬럼 ${R.length}개 생략 (CHK-DSN-7) — ${R.join(", ")}`),!D.length)continue;const w=T.name||`ix_${p}_${D.join("_")}`;d.push(`CREATE ${T.unique?"UNIQUE ":""}INDEX ${w} ON ${p} (${D.join(", ")});`)}}return[s.join(`
|
|
11
11
|
|
|
12
12
|
`),c.join(`
|
|
13
13
|
`),d.join(`
|
|
14
14
|
`)].filter(m=>m.length).join(`
|
|
15
15
|
|
|
16
|
-
`)}const il="entity-modeler-diagram",al=1;class oo extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function Wc(e,n){return JSON.stringify({format:il,version:al,logical:e,layout:n},null,2)}const fa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Oo=e=>Array.isArray(e)?e:[];function Jc(e){let n;try{n=JSON.parse(e)}catch{throw new oo("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!fa(n))throw new oo("최상위가 객체가 아닙니다.");if(n.format!==il)throw new oo(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>al)throw new oo(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!fa(o)||!Array.isArray(o.entities))throw new oo("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!fa(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new oo("엔티티 골격(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:Oo(o.associations),groups:Oo(o.groups)},a=fa(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Oo(a.entityLayouts),associationLayouts:Oo(a.associationLayouts),groupLayouts:Oo(a.groupLayouts),notes:Oo(a.notes)};return{logical:i,layout:r}}const sg=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ft(e){return e.replace(sg,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ke(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Xc(e){return`<text ${[`x="${Ke(e.x)}"`,`y="${Ke(e.y)}"`,`fill="${Ft(e.fill)}"`,`font-size="${Ke(e.fontSize)}"`,e.fontFamily?`font-family="${Ft(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ft(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ft(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ft(e.text)}</text>`}function cg(e){return`<line x1="${Ke(e.x1)}" y1="${Ke(e.y)}" x2="${Ke(e.x2)}" y2="${Ke(e.y)}" stroke="${Ft(e.stroke)}" stroke-width="${Ke(e.strokeWidth??1)}" />`}function dg(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 ug(e,n,o,i,a){return[`M${Ke(e+a.tl)},${Ke(n)}`,`L${Ke(e+o-a.tr)},${Ke(n)}`,a.tr?`Q${Ke(e+o)},${Ke(n)} ${Ke(e+o)},${Ke(n+a.tr)}`:"",`L${Ke(e+o)},${Ke(n+i-a.br)}`,a.br?`Q${Ke(e+o)},${Ke(n+i)} ${Ke(e+o-a.br)},${Ke(n+i)}`:"",`L${Ke(e+a.bl)},${Ke(n+i)}`,a.bl?`Q${Ke(e)},${Ke(n+i)} ${Ke(e)},${Ke(n+i-a.bl)}`:"",`L${Ke(e)},${Ke(n+a.tl)}`,a.tl?`Q${Ke(e)},${Ke(n)} ${Ke(e+a.tl)},${Ke(n)}`:"","Z"].filter(Boolean).join(" ")}function rl(e){const n=dg(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ft(e.fill)}"`,`stroke="${Ft(e.stroke)}"`,`stroke-width="${Ke(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ft(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ke(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${ug(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Ke(e.x)}" y="${Ke(e.y)}" width="${Ke(e.w)}" height="${Ke(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(cg(l));for(const l of e.texts)r.push(Xc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function mg(e){const o=[`<path ${[`d="${Ft(e.d)}"`,'fill="none"',`stroke="${Ft(e.stroke)}"`,`stroke-width="${Ke(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ft(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Xc(i));return`<g>${o.join("")}</g>`}function Zc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Ke(n)}" y="${Ke(o)}" width="${Ke(i)}" height="${Ke(a)}" fill="${Ft(e.background)}" />`);for(const l of e.groups)r.push(rl(l));for(const l of e.edges)r.push(mg(l));for(const l of e.entities)r.push(rl(l));for(const l of e.notes)r.push(rl(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ke(n)} ${Ke(o)} ${Ke(i)} ${Ke(a)}" width="${Ke(i)}" height="${Ke(a)}">`+r.join("")+"</svg>"}const pa=()=>crypto.randomUUID(),Qc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,fg=e=>e&&e[0].toLowerCase()+e.slice(1),pg=e=>e&&e[0].toUpperCase()+e.slice(1);function hg(e,n){return fg(e??"")+pg(n??"")}function yg(e,n){const o=to(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function ed(e,n){const o=e.entities.find(d=>d.modelId===n.end1.entityRef);if(!o)return[];if(_t(o.stereotype))return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Dc(n.end1.multiplicity),l=o.attributes.filter(d=>d.identifier&&(d.attrType==="NORMAL"||d.attrType==="RELATION_OWN")).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=hg(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const ha=(e,n)=>`${e}::${n}`,ya=e=>e??void 0;function gg(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||ya(s.length)!==ya(r.length)||ya(s.scale)!==ya(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 bg(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 pi(e,n,o=pa){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=_t(a.stereotype)?[]:r.flatMap(f=>ed(e,f)),s=new Map(l.map(f=>[ha(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ha(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=ha(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=ha(f.associationRef,f.sourceAttributeRef),g=d.get(h);if(g){const b=gg(g,f,o);b&&i.update.push({attributeId:g.modelId,patch:b})}else{const b=yg(f,m);m.add(b.name),i.add.push(bg(b,p++,o))}}return i}function td(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 _g(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function ll(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function sl(e,n,o=pa){const i=new Map,a=_g(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=pi(a,p,o);if(Qc(f))continue;const h=i.get(p);i.set(p,h?ll(h,f):f);const g=a.entities.find(b=>b.modelId===p);g&&td(g,f),r.has(p)||(r.add(p),c.push(p))}}return i}function kg(e,n,o=pa){const i=[],a=pi(e,n,o);let r=e;Qc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return td(s,a),s})});for(const[l,s]of sl(r,n,o))i.push({entityId:l,plan:s});return i}function nd(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function od(e,n,o=pa){const i=new Map;for(const a of n)for(const{entityId:r,plan:l}of kg(e,a,o)){const s=i.get(r);i.set(r,s?ll(s,l):l)}return[...i].map(([a,r])=>({entityId:a,plan:nd(r)}))}function Lo(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||!ia(a))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)}const hi=63;function cl(e){if(!e)return null;const n=e.length;return n>hi?n:null}function dl(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function At(e){return!e||e.trim()===""}function Po(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Eg(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),g=[...h].sort().join(" ");d.has(g)||(d.add(g),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function id(e){return!_t(e.stereotype)}function Ng(e){return e.filter(n=>!_t(n.stereotype)&&!n.abstractClass)}function ad(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function wg(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=At(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Ig(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>wg(a,o))).size===1}function rd(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function ul(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 ga(e,n){var p,f,h,g,b,_,k,N,y;const o=[],i=new Map(e.entities.map(E=>[E.modelId,E])),a=new Map(e.associations.map(E=>[E.modelId,E])),r=jr(e.associations),l=Xr(e),s=l.size===0?e.entities:Vc(e),c=Bc(e,l);for(const E of rd(s,S=>S.name))for(const S of E){const A=E.filter(D=>D!==S),V=id(S)&&A.some(id),T=A.some(D=>!by(S,D,e));!V&&!T||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:S.modelId,params:{name:S.name,reason:V?"entity":"package"}})}for(const E of rd(Ng(s),ad))if(new Set(E.map(S=>S.name)).size!==1&&!Ig(E,e))for(const S of E)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:S.modelId,params:{name:ad(S)}});const d=s.flatMap(E=>(E.indexes??[]).map(S=>({e:E,ix:S})));for(const E of ul(d,S=>S.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:E.ix.modelId,contextRef:E.e.modelId,params:{name:E.ix.name}});for(const E of s){const S=E.attributes.filter(I=>I.attrType!=="DIVIDER");if(At(E.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:E.modelId}),E.stereotype==="JPA_ENTITY"&&!E.abstractClass&&(S.some(I=>I.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:E.modelId}),At((p=E.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:E.modelId})),_t(E.stereotype))for(const I of S.filter(v=>v.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.identifier&&v.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S)if(!I.identifier)for(const v of I.dbAttrs)!v.autoIncrement&&At(v.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:v.autoIncrement?{name:I.name}:{name:I.name,seq:v.sequenceName??""}});const A=S.filter(I=>I.identifier&&!I.transient);if(A.reduce((I,v)=>I+v.dbAttrs.length,0)>=2)for(const I of A)for(const v of I.dbAttrs)!v.autoIncrement&&At(v.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&v.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&v.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&!v.notNull&&!v.identifier&&!v.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});!E.abstractClass&&S.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:E.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&S.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:E.modelId,params:{count:S.length,threshold:n.largeEntityThreshold}});for(const I of ul(S,v=>v.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of S)if(At(I.name)){const v=(I.attrType.startsWith("RELATION")||I.attrType.startsWith("EMBED"))&&!Kr(I,E,r);o.push({ruleId:v?"CHK-NAME-7":"CHK-NAME-4",severity:v?"error":"info",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,...v?{params:{attrType:I.attrType}}:{}})}const V=S.flatMap(I=>I.dbAttrs.map((v,B)=>({attr:I,index:B,col:v,eff:bn(I,v,B,E,e,n),name:ci(I,v,B,E,e,n)})).filter(v=>v.eff.sharedColumnRef==null));for(const I of ul(V,v=>v.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:I.col.modelId,contextRef:E.modelId,params:{name:I.name}});for(const I of V){if(!At(I.name)||I.attr.transient||At(I.attr.name)&&(I.attr.attrType.startsWith("RELATION")||I.attr.attrType.startsWith("EMBED"))||I.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const v=Zn(I.attr,E,e.entities,e.associations,I.index);At(v==null?void 0:v.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:E.modelId,params:{name:I.attr.name}})}for(const I of V){const v=I.col,B=cl(v.physicalName);B!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{max:hi,len:B}}),n!=null&&n.reservedWords&&!At(v.physicalName)&&n.reservedWords.has(v.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{name:v.physicalName}}),n!=null&&n.selectableDataTypes&&!At(v.dataType)&&!n.selectableDataTypes.has(v.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{dataType:v.dataType}});const M=I.attr.transient||v.multiValue||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")?void 0:Sy(I.attr.type,v.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{type:I.attr.type,dataType:dl(v)}}),M!==!1&&!At(v.dataType)&&Ny.has(v.dataType)&&!v.length&&(bn(I.attr,v,I.index,E,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{dataType:v.dataType}}))}for(const I of V)At(I.col.dataType)&&(I.attr.transient||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:E.modelId,params:{name:I.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const I=$o(Dn(E,e.entities));for(const v of S){if(v.attrType!=="EMBED_PREDEF")continue;const B=n.embeddableCatalog.find(M=>M.type===v.type);B&&v.dbAttrs.forEach((M,x)=>{if(M.sharedColumnRef==null)return;const P=B.fields[x],Y=I.get(M.sharedColumnRef);if(!P||!Y)return;(Y.dataType!==P.dataType||(Y.length??null)!==(P.length??null)||(Y.scale??null)!==(P.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:E.modelId,params:{targetType:dl(Y),metaName:P.name,metaType:dl(P)}})})}}for(const I of S){const v=I.dbAttrs[0];if(!(v!=null&&v.multiValue))continue;I.type===eo&&v.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:E.modelId,params:{type:I.type||"",dataType:v.dataType||""}})}for(const I of S){if(I.attrType!=="EMBED_OWN"||!I.embedded)continue;const v=i.get(I.embedded.embeddableRef);if(!v)continue;const B=a.get(I.embedded.associationRef),M=B==null?void 0:B.end1.entityRef===I.embedded.embeddableRef?B.end1:B.end2;if(M&&Po(M.multiplicity))continue;const x=gn(v).length;I.dbAttrs.length!==x&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name,embeddable:v.name,slots:I.dbAttrs.length,declared:x}})}const T=(h=E.table)==null?void 0:h.physicalName,D=cl(T);D!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{max:hi,len:D}}),n!=null&&n.reservedWords&&!At(T)&&n.reservedWords.has(T.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:E.modelId,params:{name:T}});const C=new Set;for(const I of E.attributes){C.add(I.modelId);for(const v of I.dbAttrs)C.add(v.modelId)}const R=new Set(si(E,(n==null?void 0:n.superClassCatalog)??[]).map(I=>I.modelId)),$=(((g=n==null?void 0:n.superClassCatalog)==null?void 0:g.length)??0)>0,w=Jn(E.attributes);for(const I of E.indexes??[]){const v=cl(I.name);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:E.modelId,params:{max:hi,len:v}}),n!=null&&n.reservedWords&&!At(I.name)&&n.reservedWords.has(I.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}});for(const B of I.columns){const M=B.columnRef;if(C.has(M)||R.has(M))continue;const x=Xn(M);x&&!$||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:E.modelId,params:x?{name:I.name,field:((b=Hr(M))==null?void 0:b.field)??M}:{name:I.name}})}I.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}}),new Set(I.columns.map(B=>w.canon(B.columnRef))).size!==I.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:E.modelId,params:{name:I.name}})}}const u=new Map;for(const E of e.entities)for(const S of E.attributes)S.attrType==="EMBED_OWN"&&S.embedded&&u.set(S.embedded.associationRef,S);for(const E of c){if(Po(E.end1.multiplicity)&&Po(E.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:E.modelId}),u.has(E.modelId)&&E.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:E.modelId}),!u.has(E.modelId)){const S=!!E.end2.attributeRef&&(((k=(_=E.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:k.length)??0)>0,A=!!E.end1.attributeRef&&E.end1.navigable&&(((y=(N=E.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:y.length)??0)>0;S&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:E.modelId})}if(!u.has(E.modelId)&&E.end1.navigable&&E.end1.attributeRef){const S=i.get(E.end1.entityRef),A=S==null?void 0:S.attributes.some(D=>D.modelId===E.end1.attributeRef),V=i.get(E.end2.entityRef),T=ed(e,E).length>0;A&&V&&T&&(E.end2.attributeRef&&V.attributes.some(C=>C.modelId===E.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:E.modelId,params:{child:V.name}}))}for(const S of["end1","end2"]){const A=E[S].jpa;if(!A)continue;const V=A.cascadeTypes??[];V.includes("ALL")&&V.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:S}}),Po(E[S].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:S}}),A.orphanRemoval&&Po(E[S==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:E.modelId,params:{which:S}}),!Po(E[S].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:S}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:E.modelId,params:{which:S}})}}const m=new Map(e.entities.map(E=>[E.modelId,E.name||E.modelId]));for(const E of Eg(s,c)){const S=[...E,E[0]].map(A=>m.get(A)??A).join(" → ");for(const A of E)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:S}})}if(n!=null&&n.flagEntitiesWithoutRelations){const E=new Set;for(const A of e.associations)E.add(A.end1.entityRef),E.add(A.end2.entityRef);const S=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const V of A.attributes)V.embedded&&(E.add(A.modelId),E.add(V.embedded.embeddableRef));if(!At(A.superClass)){E.add(A.modelId);const V=S.get(A.superClass);V&&E.add(V)}}for(const A of s)E.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function ml(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return vg(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(s=>s.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"]}:null}function vg(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Jn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const On="javax.persistence",rt={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"},Cg={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function ld(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Bt(o)?null:o??Cg[n]}const ba={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Sg(e){if(!e)return;if(ba[e])return{simpleName:e,fqn:ba[e]};const n=Object.entries(ba).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}const fl={List:"java.util.List",Set:"java.util.Set",Map:"java.util.Map"},xg={LIST:"List",SET:"Set",MAP:"Map"};function sd(e,n,o,i,a){var g,b,_;const r=di(e,Mo(o),n,o);if(r.kind==="none")return;if(r.kind==="ambiguous")return{type:r.name,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[`직렬화 타입 '${r.name}' 동명 ${r.candidates.length}개 — 어느 선언인지 결정 필요(패키지로 구분)`]};const l=r.entity,s=l.name,c=[],d=[],u=kn(l,o,i),m=kn(n,o,i);u?u!==m&&c.push(`${u}.${s}`):d.push(`직렬화 타입 '${s}' package 미지정 — import 확인 필요`);const p=(g=l.serialization)==null?void 0:g.collectionType;let f=s;if(p){const k=xg[p];if(c.push(fl[k]),p==="MAP"){const N=(b=l.serialization)==null?void 0:b.mapKeyType;if(Bt(N))d.push(`직렬화 타입 '${s}' Map 키 타입 미지정(serialization.mapKeyType) — 임시 'Object', 모델 확인 필요`),f=`Map<Object, ${s}>`;else{const y=N;y.includes(".")?(c.push(y),f=`Map<${y.slice(y.lastIndexOf(".")+1)}, ${s}>`):f=`Map<${y}, ${s}>`}}else f=`${k}<${s}>`}const h=[];if(a){const k=(_=cd(i,s))==null?void 0:_.converterFqn;k==null||Bt(k)?d.push(k===null?`직렬화 타입 '${s}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`직렬화 타입 '${s}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`):(c.push(`${On}.Convert`),h.push(`@Convert(converter = ${k}.class)`))}return{type:f,primitive:!1,imports:c,fieldAnnotations:h,fillIns:d}}function cd(e,n){const o=e.customTypeCatalog;if(!o||!n)return;if(o[n])return o[n];const i=Object.entries(o).find(([,a])=>(a.imports??[]).includes(n));return i==null?void 0:i[1]}function Rg(e,n){var c;const o=Bt(e.fieldType)?n:e.fieldType,i=[...e.imports??[]],a=[],r=(c=/^(\w+)\s*</.exec(o))==null?void 0:c[1];r&&(fl[r]?i.push(fl[r]):a.push(`컨테이너 '${r}' import 확인 필요 (java.util List·Set·Map 외)`));const l=e.converterFqn,s=!(l==null||Bt(l));return s?i.push(`${On}.Convert`):a.push(l===null?`CustomType '${n}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`CustomType '${n}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`),{type:o,primitive:!1,imports:i,fieldAnnotations:s?[`@Convert(converter = ${l}.class)`]:[],fillIns:a}}function dd(e){return!(Bt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Ag(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&&(Vo(l)||o.skipUngeneratable!==!1&&!dd(l)||a.push(Vg(l,e,o)))}return a}class pl{constructor(){ct(this,"imports",new Set);ct(this,"body",[]);ct(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${On}.${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(`
|
|
16
|
+
`)}const il="entity-modeler-diagram",al=1;class oo extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function Wc(e,n){return JSON.stringify({format:il,version:al,logical:e,layout:n},null,2)}const fa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Oo=e=>Array.isArray(e)?e:[];function Jc(e){let n;try{n=JSON.parse(e)}catch{throw new oo("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!fa(n))throw new oo("최상위가 객체가 아닙니다.");if(n.format!==il)throw new oo(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>al)throw new oo(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!fa(o)||!Array.isArray(o.entities))throw new oo("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!fa(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new oo("엔티티 골격(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:Oo(o.associations),groups:Oo(o.groups)},a=fa(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Oo(a.entityLayouts),associationLayouts:Oo(a.associationLayouts),groupLayouts:Oo(a.groupLayouts),notes:Oo(a.notes)};return{logical:i,layout:r}}const sg=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ft(e){return e.replace(sg,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ke(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Xc(e){return`<text ${[`x="${Ke(e.x)}"`,`y="${Ke(e.y)}"`,`fill="${Ft(e.fill)}"`,`font-size="${Ke(e.fontSize)}"`,e.fontFamily?`font-family="${Ft(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ft(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ft(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ft(e.text)}</text>`}function cg(e){return`<line x1="${Ke(e.x1)}" y1="${Ke(e.y)}" x2="${Ke(e.x2)}" y2="${Ke(e.y)}" stroke="${Ft(e.stroke)}" stroke-width="${Ke(e.strokeWidth??1)}" />`}function dg(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 ug(e,n,o,i,a){return[`M${Ke(e+a.tl)},${Ke(n)}`,`L${Ke(e+o-a.tr)},${Ke(n)}`,a.tr?`Q${Ke(e+o)},${Ke(n)} ${Ke(e+o)},${Ke(n+a.tr)}`:"",`L${Ke(e+o)},${Ke(n+i-a.br)}`,a.br?`Q${Ke(e+o)},${Ke(n+i)} ${Ke(e+o-a.br)},${Ke(n+i)}`:"",`L${Ke(e+a.bl)},${Ke(n+i)}`,a.bl?`Q${Ke(e)},${Ke(n+i)} ${Ke(e)},${Ke(n+i-a.bl)}`:"",`L${Ke(e)},${Ke(n+a.tl)}`,a.tl?`Q${Ke(e)},${Ke(n)} ${Ke(e+a.tl)},${Ke(n)}`:"","Z"].filter(Boolean).join(" ")}function rl(e){const n=dg(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ft(e.fill)}"`,`stroke="${Ft(e.stroke)}"`,`stroke-width="${Ke(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ft(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Ke(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${ug(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Ke(e.x)}" y="${Ke(e.y)}" width="${Ke(e.w)}" height="${Ke(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(cg(l));for(const l of e.texts)r.push(Xc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function mg(e){const o=[`<path ${[`d="${Ft(e.d)}"`,'fill="none"',`stroke="${Ft(e.stroke)}"`,`stroke-width="${Ke(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ft(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Xc(i));return`<g>${o.join("")}</g>`}function Zc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Ke(n)}" y="${Ke(o)}" width="${Ke(i)}" height="${Ke(a)}" fill="${Ft(e.background)}" />`);for(const l of e.groups)r.push(rl(l));for(const l of e.edges)r.push(mg(l));for(const l of e.entities)r.push(rl(l));for(const l of e.notes)r.push(rl(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Ke(n)} ${Ke(o)} ${Ke(i)} ${Ke(a)}" width="${Ke(i)}" height="${Ke(a)}">`+r.join("")+"</svg>"}const pa=()=>crypto.randomUUID(),Qc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,fg=e=>e&&e[0].toLowerCase()+e.slice(1),pg=e=>e&&e[0].toUpperCase()+e.slice(1);function hg(e,n){return fg(e??"")+pg(n??"")}function yg(e,n){const o=to(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function ed(e,n){const o=e.entities.find(d=>d.modelId===n.end1.entityRef);if(!o)return[];if(_t(o.stereotype))return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!Dc(n.end1.multiplicity),l=o.attributes.filter(d=>d.identifier&&(d.attrType==="NORMAL"||d.attrType==="RELATION_OWN")).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=hg(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const ha=(e,n)=>`${e}::${n}`,ya=e=>e??void 0;function gg(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||ya(s.length)!==ya(r.length)||ya(s.scale)!==ya(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 bg(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 pi(e,n,o=pa){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=_t(a.stereotype)?[]:r.flatMap(f=>ed(e,f)),s=new Map(l.map(f=>[ha(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ha(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const h=ha(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(h)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,h)=>Math.max(f,h.order),-1)+1;for(const f of l){const h=ha(f.associationRef,f.sourceAttributeRef),g=d.get(h);if(g){const b=gg(g,f,o);b&&i.update.push({attributeId:g.modelId,patch:b})}else{const b=yg(f,m);m.add(b.name),i.add.push(bg(b,p++,o))}}return i}function td(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 _g(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function ll(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function sl(e,n,o=pa){const i=new Map,a=_g(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=pi(a,p,o);if(Qc(f))continue;const h=i.get(p);i.set(p,h?ll(h,f):f);const g=a.entities.find(b=>b.modelId===p);g&&td(g,f),r.has(p)||(r.add(p),c.push(p))}}return i}function kg(e,n,o=pa){const i=[],a=pi(e,n,o);let r=e;Qc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return td(s,a),s})});for(const[l,s]of sl(r,n,o))i.push({entityId:l,plan:s});return i}function nd(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function od(e,n,o=pa){const i=new Map;for(const a of n)for(const{entityId:r,plan:l}of kg(e,a,o)){const s=i.get(r);i.set(r,s?ll(s,l):l)}return[...i].map(([a,r])=>({entityId:a,plan:nd(r)}))}function Lo(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||!ia(a))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)}const hi=63;function cl(e){if(!e)return null;const n=e.length;return n>hi?n:null}function dl(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function At(e){return!e||e.trim()===""}function Po(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Eg(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const h=s.slice(s.indexOf(p)),g=[...h].sort().join(" ");d.has(g)||(d.add(g),c.push(h))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function id(e){return!_t(e.stereotype)}function Ng(e){return e.filter(n=>!_t(n.stereotype)&&!n.abstractClass)}function ad(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function wg(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=At(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Ig(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>wg(a,o))).size===1}function rd(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function ul(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 ga(e,n){var p,f,h,g,b,_,E,N,y;const o=[],i=new Map(e.entities.map(k=>[k.modelId,k])),a=new Map(e.associations.map(k=>[k.modelId,k])),r=jr(e.associations),l=Xr(e),s=l.size===0?e.entities:Vc(e),c=Bc(e,l);for(const k of rd(s,S=>S.name))for(const S of k){const A=k.filter(D=>D!==S),V=id(S)&&A.some(id),T=A.some(D=>!by(S,D,e));!V&&!T||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:S.modelId,params:{name:S.name,reason:V?"entity":"package"}})}for(const k of rd(Ng(s),ad))if(new Set(k.map(S=>S.name)).size!==1&&!Ig(k,e))for(const S of k)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:S.modelId,params:{name:ad(S)}});const d=s.flatMap(k=>(k.indexes??[]).map(S=>({e:k,ix:S})));for(const k of ul(d,S=>S.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:k.ix.modelId,contextRef:k.e.modelId,params:{name:k.ix.name}});for(const k of s){const S=k.attributes.filter(I=>I.attrType!=="DIVIDER");if(At(k.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:k.modelId}),k.stereotype==="JPA_ENTITY"&&!k.abstractClass&&(S.some(I=>I.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:k.modelId}),At((p=k.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:k.modelId})),_t(k.stereotype))for(const I of S.filter(v=>v.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.identifier&&v.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S)if(!I.identifier)for(const v of I.dbAttrs)!v.autoIncrement&&At(v.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:v.autoIncrement?{name:I.name}:{name:I.name,seq:v.sequenceName??""}});const A=S.filter(I=>I.identifier&&!I.transient);if(A.reduce((I,v)=>I+v.dbAttrs.length,0)>=2)for(const I of A)for(const v of I.dbAttrs)!v.autoIncrement&&At(v.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&v.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&v.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S.filter(v=>v.naturalId&&!v.notNull&&!v.identifier&&!v.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});!k.abstractClass&&S.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:k.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&S.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:k.modelId,params:{count:S.length,threshold:n.largeEntityThreshold}});for(const I of ul(S,v=>v.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of S)if(At(I.name)){const v=(I.attrType.startsWith("RELATION")||I.attrType.startsWith("EMBED"))&&!Kr(I,k,r);o.push({ruleId:v?"CHK-NAME-7":"CHK-NAME-4",severity:v?"error":"info",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,...v?{params:{attrType:I.attrType}}:{}})}const V=S.flatMap(I=>I.dbAttrs.map((v,B)=>({attr:I,index:B,col:v,eff:bn(I,v,B,k,e,n),name:ci(I,v,B,k,e,n)})).filter(v=>v.eff.sharedColumnRef==null));for(const I of ul(V,v=>v.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:I.col.modelId,contextRef:k.modelId,params:{name:I.name}});for(const I of V){if(!At(I.name)||I.attr.transient||At(I.attr.name)&&(I.attr.attrType.startsWith("RELATION")||I.attr.attrType.startsWith("EMBED"))||I.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const v=Zn(I.attr,k,e.entities,e.associations,I.index);At(v==null?void 0:v.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:k.modelId,params:{name:I.attr.name}})}for(const I of V){const v=I.col,B=cl(v.physicalName);B!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{max:hi,len:B}}),n!=null&&n.reservedWords&&!At(v.physicalName)&&n.reservedWords.has(v.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{name:v.physicalName}}),n!=null&&n.selectableDataTypes&&!At(v.dataType)&&!n.selectableDataTypes.has(v.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{dataType:v.dataType}});const M=I.attr.transient||v.multiValue||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")?void 0:Sy(I.attr.type,v.dataType);M===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{type:I.attr.type,dataType:dl(v)}}),M!==!1&&!At(v.dataType)&&Ny.has(v.dataType)&&!v.length&&(bn(I.attr,v,I.index,k,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{dataType:v.dataType}}))}for(const I of V)At(I.col.dataType)&&(I.attr.transient||I.attr.attrType.startsWith("EMBED")||I.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:I.col.modelId,contextRef:k.modelId,params:{name:I.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const I=$o(Dn(k,e.entities));for(const v of S){if(v.attrType!=="EMBED_PREDEF")continue;const B=n.embeddableCatalog.find(M=>M.type===v.type);B&&v.dbAttrs.forEach((M,x)=>{if(M.sharedColumnRef==null)return;const P=B.fields[x],Y=I.get(M.sharedColumnRef);if(!P||!Y)return;(Y.dataType!==P.dataType||(Y.length??null)!==(P.length??null)||(Y.scale??null)!==(P.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:M.modelId,contextRef:k.modelId,params:{targetType:dl(Y),metaName:P.name,metaType:dl(P)}})})}}for(const I of S){const v=I.dbAttrs[0];if(!(v!=null&&v.multiValue))continue;I.type===eo&&v.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:v.modelId,contextRef:k.modelId,params:{type:I.type||"",dataType:v.dataType||""}})}for(const I of S){if(I.attrType!=="EMBED_OWN"||!I.embedded)continue;const v=i.get(I.embedded.embeddableRef);if(!v)continue;const B=a.get(I.embedded.associationRef),M=B==null?void 0:B.end1.entityRef===I.embedded.embeddableRef?B.end1:B.end2;if(M&&Po(M.multiplicity))continue;const x=gn(v).length;I.dbAttrs.length!==x&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name,embeddable:v.name,slots:I.dbAttrs.length,declared:x}})}const T=(h=k.table)==null?void 0:h.physicalName,D=cl(T);D!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{max:hi,len:D}}),n!=null&&n.reservedWords&&!At(T)&&n.reservedWords.has(T.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{name:T}});const C=new Set;for(const I of k.attributes){C.add(I.modelId);for(const v of I.dbAttrs)C.add(v.modelId)}const R=new Set(si(k,(n==null?void 0:n.superClassCatalog)??[]).map(I=>I.modelId)),$=(((g=n==null?void 0:n.superClassCatalog)==null?void 0:g.length)??0)>0,w=Jn(k.attributes);for(const I of k.indexes??[]){const v=cl(I.name);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:k.modelId,params:{max:hi,len:v}}),n!=null&&n.reservedWords&&!At(I.name)&&n.reservedWords.has(I.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}});for(const B of I.columns){const M=B.columnRef;if(C.has(M)||R.has(M))continue;const x=Xn(M);x&&!$||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:k.modelId,params:x?{name:I.name,field:((b=Hr(M))==null?void 0:b.field)??M}:{name:I.name}})}I.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}}),new Set(I.columns.map(B=>w.canon(B.columnRef))).size!==I.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:I.modelId,contextRef:k.modelId,params:{name:I.name}})}}const u=new Map;for(const k of e.entities)for(const S of k.attributes)S.attrType==="EMBED_OWN"&&S.embedded&&u.set(S.embedded.associationRef,S);for(const k of c){if(Po(k.end1.multiplicity)&&Po(k.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:k.modelId}),u.has(k.modelId)&&k.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:k.modelId}),!u.has(k.modelId)){const S=!!k.end2.attributeRef&&(((E=(_=k.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:E.length)??0)>0,A=!!k.end1.attributeRef&&k.end1.navigable&&(((y=(N=k.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:y.length)??0)>0;S&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:k.modelId})}if(!u.has(k.modelId)&&k.end1.navigable&&k.end1.attributeRef){const S=i.get(k.end1.entityRef),A=S==null?void 0:S.attributes.some(D=>D.modelId===k.end1.attributeRef),V=i.get(k.end2.entityRef),T=ed(e,k).length>0;A&&V&&T&&(k.end2.attributeRef&&V.attributes.some(C=>C.modelId===k.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:k.modelId,params:{child:V.name}}))}for(const S of["end1","end2"]){const A=k[S].jpa;if(!A)continue;const V=A.cascadeTypes??[];V.includes("ALL")&&V.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:S}}),Po(k[S].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:S}}),A.orphanRemoval&&Po(k[S==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:k.modelId,params:{which:S}}),!Po(k[S].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:S}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:S}})}}const m=new Map(e.entities.map(k=>[k.modelId,k.name||k.modelId]));for(const k of Eg(s,c)){const S=[...k,k[0]].map(A=>m.get(A)??A).join(" → ");for(const A of k)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:S}})}if(n!=null&&n.flagEntitiesWithoutRelations){const k=new Set;for(const A of e.associations)k.add(A.end1.entityRef),k.add(A.end2.entityRef);const S=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const V of A.attributes)V.embedded&&(k.add(A.modelId),k.add(V.embedded.embeddableRef));if(!At(A.superClass)){k.add(A.modelId);const V=S.get(A.superClass);V&&k.add(V)}}for(const A of s)k.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function ml(e,n){var r,l;if(e.ruleId==="CHK-DSN-7")return vg(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(s=>s.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"]}:null}function vg(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Jn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const On="javax.persistence",it={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"},Cg={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function ld(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Bt(o)?null:o??Cg[n]}const ba={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Sg(e){if(!e)return;if(ba[e])return{simpleName:e,fqn:ba[e]};const n=Object.entries(ba).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}const fl={List:"java.util.List",Set:"java.util.Set",Map:"java.util.Map"},xg={LIST:"List",SET:"Set",MAP:"Map"};function sd(e,n,o,i,a){var g,b,_,E;const r=di(e,Mo(o),n,o);if(r.kind==="none")return;if(r.kind==="ambiguous")return{type:r.name,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[`직렬화 타입 '${r.name}' 동명 ${r.candidates.length}개 — 어느 선언인지 결정 필요(패키지로 구분)`]};const l=r.entity,s=l.name,c=[],d=[],u=kn(l,o,i),m=kn(n,o,i);u?u!==m&&c.push(`${u}.${s}`):d.push(`직렬화 타입 '${s}' package 미지정 — import 확인 필요`);const p=(g=l.serialization)==null?void 0:g.collectionType;let f=s;if(p){const N=xg[p];if(c.push(fl[N]),p==="MAP"){const y=(b=l.serialization)==null?void 0:b.mapKeyType;if(Bt(y))d.push(`직렬화 타입 '${s}' Map 키 타입 미지정(serialization.mapKeyType) — 임시 'Object', 모델 확인 필요`),f=`Map<Object, ${s}>`;else{const k=y;k.includes(".")?(c.push(k),f=`Map<${k.slice(k.lastIndexOf(".")+1)}, ${s}>`):f=`Map<${k}, ${s}>`}}else f=`${N}<${s}>`}const h=[];if(a&&((_=e.dbAttrs[0])==null?void 0:_.dataType)==="JSONB")c.push(it.jdbcTypeCode,it.sqlTypes),h.push("@JdbcTypeCode(SqlTypes.JSON)");else if(a){const N=(E=cd(i,s))==null?void 0:E.converterFqn;N==null||Bt(N)?d.push(N===null?`직렬화 타입 '${s}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`직렬화 타입 '${s}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`):(c.push(`${On}.Convert`),h.push(`@Convert(converter = ${N}.class)`))}return{type:f,primitive:!1,imports:c,fieldAnnotations:h,fillIns:d}}function cd(e,n){const o=e.customTypeCatalog;if(!o||!n)return;if(o[n])return o[n];const i=Object.entries(o).find(([,a])=>(a.imports??[]).includes(n));return i==null?void 0:i[1]}function Rg(e,n){var c;const o=Bt(e.fieldType)?n:e.fieldType,i=[...e.imports??[]],a=[],r=(c=/^(\w+)\s*</.exec(o))==null?void 0:c[1];r&&(fl[r]?i.push(fl[r]):a.push(`컨테이너 '${r}' import 확인 필요 (java.util List·Set·Map 외)`));const l=e.converterFqn,s=!(l==null||Bt(l));return s?i.push(`${On}.Convert`):a.push(l===null?`CustomType '${n}' 컨버터 비활성(customTypeCatalog.converterFqn = null) — @Convert 손채움 필요`:`CustomType '${n}' 컨버터 미지정(customTypeCatalog.converterFqn) — @Convert 손채움 필요`),{type:o,primitive:!1,imports:i,fieldAnnotations:s?[`@Convert(converter = ${l}.class)`]:[],fillIns:a}}function dd(e){return!(Bt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Ag(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&&(Vo(l)||o.skipUngeneratable!==!1&&!dd(l)||a.push(Vg(l,e,o)))}return a}class pl{constructor(){ct(this,"imports",new Set);ct(this,"body",[]);ct(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${On}.${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(`
|
|
17
17
|
`)+`
|
|
18
|
-
`}}function ud(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function md(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function io(e,n){n&&(e.import(rt.lombokGetter),e.line(" @Getter"))}const $g=["ko","en","ja","zh"];function yi(e,n){if(!e)return[];const o=$g.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 gi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...ui,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===eo){if(i){const c=[`${On}.Enumerated`,`${On}.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:[`${On}.Enumerated`,`${On}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===_n){const c=Sg(n);if(c)return{...a,type:n||"Object",fillIns:[`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`]};const d=cd(o,n);return d?Rg(d,n):{...a,type:n||"Object",fillIns:[`CustomType 확인 필요: ${n??"(미지정)"}`]}}if(e==="CustomMoneyType"){const c=ld(o,"money");return{type:"Money",primitive:!1,imports:c?[rt.money,`${On}.Convert`]:[rt.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ba[e];if(s)return{type:e,primitive:!1,imports:[s,rt.jdbcTypeCode,rt.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 hl(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Tg(e,n){var a;const o=(a=e.derivedFrom)==null?void 0:a.associationRef;if(!o)return;const i=n.associations.find(r=>r.modelId===o);return i?n.entities.find(r=>r.modelId===i.end1.entityRef):void 0}function _a(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return{type:gi(e.type,e.customType,o,e.groupCode).type};const a=Tg(e,n)??n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return{type:gi(e.type,e.customType,o).type};const r=hl(a);return r.length>=2?{type:`${a.name}PK`,pkOwner:a}:r.length===1?_a(r[0],n,o,new Set([...i,a.modelId])):{type:gi(e.type,e.customType,o).type}}function fd(e,n,o,i=new Set){return _a(e,n,o,i).type}function pd(e,n,o,i){return`${kn(e,o,i)||ao}.${e.name}.${n}`}function ka(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!Ea(n.end2.multiplicity)&&e.dbAttrs.length===1}function yl(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=Nl(e,n,o,0);return md(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function Mg(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return fd(r||e,i,a)}function gl(e,n,o){var h,g,b;const i=new Map(n.entities.map(_=>[_.modelId,_])),a=jr(n.associations),r=new Map;for(const _ of n.associations)_.end2.attributeRef&&r.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&r.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const l=hl(e),s=new Set;for(const _ of l)ka(_,(h=r.get(_.modelId))==null?void 0:h.assoc)&&s.add(_.modelId);const c=new Set(l.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(k=>k.physicalName)).filter(Boolean)),d=[],u=[];for(const _ of l){if(!s.has(_.modelId))continue;const k=r.get(_.modelId).assoc,N=_.dbAttrs[0],y=(N==null?void 0:N.physicalName)||Nl(_,k,i,0)||"";if(y&&c.has(y))continue;const E=yl(_,k,i);if(!E){u.push(_);continue}const S=_.derivedFrom?(g=i.get(k.end1.entityRef))==null?void 0:g.attributes.find(A=>A.modelId===_.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${_.modelId}`,name:E,type:o?o(_,k):(S==null?void 0:S.type)??_.type,customType:(S==null?void 0:S.customType)??_.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:_.order,dbAttrs:[{...N??{modelId:`synthetic-col:${_.modelId}`,dataType:""},physicalName:y}]},role:"scalar",synthetic:!0,sourceAttr:_})}const m=[],p=[];for(const _ of e.attributes)if(_.attrType!=="DIVIDER"){if(_.attrType.startsWith("EMBED")){p.push({attr:_,role:"embed",synthetic:!1,sourceAttr:_,collection:aa(_,n.associations)});continue}if(_.attrType==="RELATION_OWN"){const k=r.get(_.modelId);k?p.push({attr:_,role:"relation-owner",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end1.entityRef)}):Kr(_,e,a)?m.push({attr:_,reason:"join-column-only"}):m.push({attr:_,reason:"no-anchor"});continue}if(_.attrType==="RELATION_REF"){const k=r.get(_.modelId);if(!k){m.push({attr:_,reason:"nav-not-materialized"});continue}p.push({attr:_,role:"relation-inverse",synthetic:!1,sourceAttr:_,assoc:k.assoc,target:i.get(k.assoc.end2.entityRef),collection:Ea(k.assoc.end2.multiplicity)?((b=k.assoc.end2.jpa)==null?void 0:b.collectionType)??"LIST":void 0});continue}p.push({attr:_,role:"scalar",synthetic:!1,sourceAttr:_})}return{fields:[...d,...p].sort((_,k)=>_.attr.order-k.attr.order),omitted:m,unresolvedDerivedIds:u}}function Vg(e,n,o){var R,$,w,I,v,B,M;if(e.stereotype==="JPA_EMBEDDABLE")return Bg(e,n,o);if(e.stereotype==="SERIALIZED_TYPE")return Dg(e,n,o);const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao);const l=new Map(n.entities.map(x=>[x.modelId,x])),s=r,c=Ed(e,o,i),d=new Map;for(const x of n.associations)x.end2.attributeRef&&d.set(x.end2.attributeRef,{assoc:x,role:"owner"}),x.end1.attributeRef&&x.end1.navigable&&d.set(x.end1.attributeRef,{assoc:x,role:"inverse"});const u=hl(e),m=new Set;for(const x of u)ka(x,(R=d.get(x.modelId))==null?void 0:R.assoc)&&m.add(x.modelId);const p=gl(e,n,(x,P)=>Mg(x,P,l,n,o)),f=p.fields.filter(x=>x.synthetic).map(x=>x.attr);for(const x of p.unresolvedDerivedIds)i.fillIn(`${a}.${x.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const x of p.omitted)x.reason==="no-anchor"&&i.fillIn(`${e.name}.${x.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const h=new Set(p.omitted.map(x=>x.attr.modelId)),g=[...u.filter(x=>!m.has(x.modelId)&&!h.has(x.modelId)),...f].sort((x,P)=>x.order-P.order),b=g.length>=2,_=g.length===1,k=`${a}PK`,N=x=>m.has(x.modelId)?"mapsId":x.identifier?"id":"none",y=o.lombok!==!1;i.jpa("Entity"),i.import(rt.jsonIdentityInfo),i.import(rt.jsogGenerator);const E=["@Entity"];E.push(Ug(e,n,o,i)),E.push('@SuppressWarnings("serial")'),E.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),b&&(i.jpa("IdClass"),i.import(`${r}.${a}.${k}`),E.push(`@IdClass(${a}.${k}.class)`)),($=e.jpaAttrs)!=null&&$.useDynamicInsert&&(E.push("@DynamicInsert"),i.import(rt.dynamicInsert)),(w=e.jpaAttrs)!=null&&w.useDynamicUpdate&&(E.push("@DynamicUpdate"),i.import(rt.dynamicUpdate)),(I=e.jpaAttrs)!=null&&I.useCacheable&&(E.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(yd),E.push("@PersonalInfo")),y&&(i.import(rt.lombokNoArgs),i.import(rt.lombokAccessLevel),E.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const x of yi((v=e.table)==null?void 0:v.logicalName,""))i.line(x);for(const x of E)i.line(x);const S=e.abstractClass?"abstract ":"";i.line(`public ${S}class ${a}${c}${_l(e,i)} {`);const A=p.fields.map(x=>x.attr),V=new Set(f.map(x=>x.modelId));for(const x of u){if(!m.has(x.modelId))continue;const P=(B=x.dbAttrs[0])==null?void 0:B.physicalName;if(P)for(const Y of u)Y.attrType==="NORMAL"&&Y.dbAttrs.some(se=>se.physicalName===P)&&V.add(Y.modelId)}const T=(M=e.jpaAttrs)!=null&&M.useVersion?u.length?u[u.length-1].modelId:null:void 0,D=[];for(const x of A){if(x.attrType.startsWith("EMBED"))D.push(..._d(x,e,n,o,i));else if(x.attrType==="RELATION_OWN"){const P=d.get(x.modelId),Y=jg(x,P.assoc,s,l,N(x),y,n,o,i);Y&&D.push(Y)}else if(x.attrType==="RELATION_REF"){const P=d.get(x.modelId),Y=Kg(x,P.assoc,s,l,y,n,o,i);Y&&D.push(Y)}else D.push(gd(x,e,n,o,i,V.has(x.modelId)));x.modelId===T&&hd(i,D,y)}T===null&&hd(i,D,y),y||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),bl(D,i,y),kl(e,i),b&&(i.import(rt.jsonBackReference),i.import(rt.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 ${k} getPK() {`),i.line(` return (${k}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Yg(k,g.map(x=>{const P=_a(x,n,o);return P.pkOwner&&i.import(pd(P.pkOwner,P.type,n,o)),{type:P.type,name:x.name}}),y,i)),i.line("}");let C;if(b)C=qg(a,k,r);else if(_){const x=_a(g[0],n,o);C=Wg(a,r,x.type,x.pkOwner?pd(x.pkOwner,x.type,n,o):void 0)}return{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:C}}function hd(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 bl(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${ud(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 Bg(e,n,o){var d;const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao),i.jpa("Embeddable"),i.import(rt.jsonIdentityInfo),i.import(rt.jsogGenerator),i.import(rt.serializable);for(const u of yi((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${_l(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(..._d(u,e,n,o,i));continue}c.push(gd(u,e,n,o,i))}return bl(c,i,o.lombok!==!1),kl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Dg(e,n,o){var u;const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao),i.import(rt.serializable);for(const m of yi((u=e.table)==null?void 0:u.logicalName,""))i.line(m);e.hasPersonalInfo&&(i.import(yd),i.line("@PersonalInfo"));const l=e.abstractClass?"abstract ":"",s=Ed(e,o,i,!1);i.line(`public ${l}class ${a}${s}${_l(e,i,["Serializable"])} {`);const c=e.attributes.filter(m=>m.attrType!=="DIVIDER").sort((m,p)=>m.order-p.order),d=[];for(const m of c){if(m.attrType.startsWith("EMBED")){i.fillIn(`${a}.${m.name||"(무명)"}: 직렬화 타입에 임베드 속성(${m.attrType}) — 직렬화 타입은 관계로 임베드되지 않으므로 방출하지 않음, 모델 정정 필요`);continue}if(m.attrType.startsWith("RELATION")){i.fillIn(`${a}.${m.name||"(무명)"}: 직렬화 타입에 연관 속성(${m.attrType}) — 직렬화 타입은 연관에 참여하지 않으므로 방출하지 않음, 모델 정정 필요`);continue}d.push(Og(m,e,n,o,i))}return bl(d,i,o.lombok!==!1),kl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Og(e,n,o,i,a){const r=n.name,l=e.name||"unnamedField";e.name||a.fillIn(`${r}.${l}: 속성 이름 미지정 — 직렬화 타입 필드명을 결정할 근거가 없음, 모델 정정 필요`);const s=sd(e,n,o,i,!1)??gi(e.type,e.customType,i,e.groupCode);for(const c of s.imports)a.import(c);for(const c of s.fillIns)a.fillIn(`${r}.${l}: ${c}`);a.line("");for(const c of yi(e.description," "))a.line(c);return io(a,i.lombok!==!1),a.line(` private ${s.type} ${l};`),{type:s.type,name:l,category:0}}function _l(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const yd="net.g1project.bluecomm.annotation.PersonalInfo",Lg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",Pg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function kl(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Bt(i.name)||Bt(a))continue;const r=a.replace(/\r\n/g,`
|
|
18
|
+
`}}function ud(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function md(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function io(e,n){n&&(e.import(it.lombokGetter),e.line(" @Getter"))}const $g=["ko","en","ja","zh"];function yi(e,n){if(!e)return[];const o=$g.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 gi(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...ui,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===eo){if(i){const c=[`${On}.Enumerated`,`${On}.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:[`${On}.Enumerated`,`${On}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===_n){const c=Sg(n);if(c)return{...a,type:n||"Object",fillIns:[`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`]};const d=cd(o,n);return d?Rg(d,n):{...a,type:n||"Object",fillIns:[`CustomType 확인 필요: ${n??"(미지정)"}`]}}if(e==="CustomMoneyType"){const c=ld(o,"money");return{type:"Money",primitive:!1,imports:c?[it.money,`${On}.Convert`]:[it.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ba[e];if(s)return{type:e,primitive:!1,imports:[s,it.jdbcTypeCode,it.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 hl(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Tg(e,n){var a;const o=(a=e.derivedFrom)==null?void 0:a.associationRef;if(!o)return;const i=n.associations.find(r=>r.modelId===o);return i?n.entities.find(r=>r.modelId===i.end1.entityRef):void 0}function _a(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return{type:gi(e.type,e.customType,o,e.groupCode).type};const a=Tg(e,n)??n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return{type:gi(e.type,e.customType,o).type};const r=hl(a);return r.length>=2?{type:`${a.name}PK`,pkOwner:a}:r.length===1?_a(r[0],n,o,new Set([...i,a.modelId])):{type:gi(e.type,e.customType,o).type}}function fd(e,n,o,i=new Set){return _a(e,n,o,i).type}function pd(e,n,o,i){return`${kn(e,o,i)||ao}.${e.name}.${n}`}function ka(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!Ea(n.end2.multiplicity)&&e.dbAttrs.length===1}function yl(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=Nl(e,n,o,0);return md(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function Mg(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return fd(r||e,i,a)}function gl(e,n,o){var h,g,b;const i=new Map(n.entities.map(_=>[_.modelId,_])),a=jr(n.associations),r=new Map;for(const _ of n.associations)_.end2.attributeRef&&r.set(_.end2.attributeRef,{assoc:_,role:"owner"}),_.end1.attributeRef&&_.end1.navigable&&r.set(_.end1.attributeRef,{assoc:_,role:"inverse"});const l=hl(e),s=new Set;for(const _ of l)ka(_,(h=r.get(_.modelId))==null?void 0:h.assoc)&&s.add(_.modelId);const c=new Set(l.filter(_=>_.attrType==="NORMAL").flatMap(_=>_.dbAttrs.map(E=>E.physicalName)).filter(Boolean)),d=[],u=[];for(const _ of l){if(!s.has(_.modelId))continue;const E=r.get(_.modelId).assoc,N=_.dbAttrs[0],y=(N==null?void 0:N.physicalName)||Nl(_,E,i,0)||"";if(y&&c.has(y))continue;const k=yl(_,E,i);if(!k){u.push(_);continue}const S=_.derivedFrom?(g=i.get(E.end1.entityRef))==null?void 0:g.attributes.find(A=>A.modelId===_.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${_.modelId}`,name:k,type:o?o(_,E):(S==null?void 0:S.type)??_.type,customType:(S==null?void 0:S.customType)??_.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:_.order,dbAttrs:[{...N??{modelId:`synthetic-col:${_.modelId}`,dataType:""},physicalName:y}]},role:"scalar",synthetic:!0,sourceAttr:_})}const m=[],p=[];for(const _ of e.attributes)if(_.attrType!=="DIVIDER"){if(_.attrType.startsWith("EMBED")){p.push({attr:_,role:"embed",synthetic:!1,sourceAttr:_,collection:aa(_,n.associations)});continue}if(_.attrType==="RELATION_OWN"){const E=r.get(_.modelId);E?p.push({attr:_,role:"relation-owner",synthetic:!1,sourceAttr:_,assoc:E.assoc,target:i.get(E.assoc.end1.entityRef)}):Kr(_,e,a)?m.push({attr:_,reason:"join-column-only"}):m.push({attr:_,reason:"no-anchor"});continue}if(_.attrType==="RELATION_REF"){const E=r.get(_.modelId);if(!E){m.push({attr:_,reason:"nav-not-materialized"});continue}p.push({attr:_,role:"relation-inverse",synthetic:!1,sourceAttr:_,assoc:E.assoc,target:i.get(E.assoc.end2.entityRef),collection:Ea(E.assoc.end2.multiplicity)?((b=E.assoc.end2.jpa)==null?void 0:b.collectionType)??"LIST":void 0});continue}p.push({attr:_,role:"scalar",synthetic:!1,sourceAttr:_})}return{fields:[...d,...p].sort((_,E)=>_.attr.order-E.attr.order),omitted:m,unresolvedDerivedIds:u}}function Vg(e,n,o){var R,$,w,I,v,B,M;if(e.stereotype==="JPA_EMBEDDABLE")return Bg(e,n,o);if(e.stereotype==="SERIALIZED_TYPE")return Dg(e,n,o);const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao);const l=new Map(n.entities.map(x=>[x.modelId,x])),s=r,c=Ed(e,o,i),d=new Map;for(const x of n.associations)x.end2.attributeRef&&d.set(x.end2.attributeRef,{assoc:x,role:"owner"}),x.end1.attributeRef&&x.end1.navigable&&d.set(x.end1.attributeRef,{assoc:x,role:"inverse"});const u=hl(e),m=new Set;for(const x of u)ka(x,(R=d.get(x.modelId))==null?void 0:R.assoc)&&m.add(x.modelId);const p=gl(e,n,(x,P)=>Mg(x,P,l,n,o)),f=p.fields.filter(x=>x.synthetic).map(x=>x.attr);for(const x of p.unresolvedDerivedIds)i.fillIn(`${a}.${x.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const x of p.omitted)x.reason==="no-anchor"&&i.fillIn(`${e.name}.${x.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const h=new Set(p.omitted.map(x=>x.attr.modelId)),g=[...u.filter(x=>!m.has(x.modelId)&&!h.has(x.modelId)),...f].sort((x,P)=>x.order-P.order),b=g.length>=2,_=g.length===1,E=`${a}PK`,N=x=>m.has(x.modelId)?"mapsId":x.identifier?"id":"none",y=o.lombok!==!1;i.jpa("Entity"),i.import(it.jsonIdentityInfo),i.import(it.jsogGenerator);const k=["@Entity"];k.push(Ug(e,n,o,i)),k.push('@SuppressWarnings("serial")'),k.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),b&&(i.jpa("IdClass"),i.import(`${r}.${a}.${E}`),k.push(`@IdClass(${a}.${E}.class)`)),($=e.jpaAttrs)!=null&&$.useDynamicInsert&&(k.push("@DynamicInsert"),i.import(it.dynamicInsert)),(w=e.jpaAttrs)!=null&&w.useDynamicUpdate&&(k.push("@DynamicUpdate"),i.import(it.dynamicUpdate)),(I=e.jpaAttrs)!=null&&I.useCacheable&&(k.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(yd),k.push("@PersonalInfo")),y&&(i.import(it.lombokNoArgs),i.import(it.lombokAccessLevel),k.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const x of yi((v=e.table)==null?void 0:v.logicalName,""))i.line(x);for(const x of k)i.line(x);const S=e.abstractClass?"abstract ":"";i.line(`public ${S}class ${a}${c}${_l(e,i)} {`);const A=p.fields.map(x=>x.attr),V=new Set(f.map(x=>x.modelId));for(const x of u){if(!m.has(x.modelId))continue;const P=(B=x.dbAttrs[0])==null?void 0:B.physicalName;if(P)for(const Y of u)Y.attrType==="NORMAL"&&Y.dbAttrs.some(se=>se.physicalName===P)&&V.add(Y.modelId)}const T=(M=e.jpaAttrs)!=null&&M.useVersion?u.length?u[u.length-1].modelId:null:void 0,D=[];for(const x of A){if(x.attrType.startsWith("EMBED"))D.push(..._d(x,e,n,o,i));else if(x.attrType==="RELATION_OWN"){const P=d.get(x.modelId),Y=jg(x,P.assoc,s,l,N(x),y,n,o,i);Y&&D.push(Y)}else if(x.attrType==="RELATION_REF"){const P=d.get(x.modelId),Y=Kg(x,P.assoc,s,l,y,n,o,i);Y&&D.push(Y)}else D.push(gd(x,e,n,o,i,V.has(x.modelId)));x.modelId===T&&hd(i,D,y)}T===null&&hd(i,D,y),y||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),bl(D,i,y),kl(e,i),b&&(i.import(it.jsonBackReference),i.import(it.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 ${E} getPK() {`),i.line(` return (${E}) HibernateBeanUtil.getPK(this);`),i.line(" }"),Yg(E,g.map(x=>{const P=_a(x,n,o);return P.pkOwner&&i.import(pd(P.pkOwner,P.type,n,o)),{type:P.type,name:x.name}}),y,i)),i.line("}");let C;if(b)C=qg(a,E,r);else if(_){const x=_a(g[0],n,o);C=Wg(a,r,x.type,x.pkOwner?pd(x.pkOwner,x.type,n,o):void 0)}return{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:C}}function hd(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 bl(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${ud(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 Bg(e,n,o){var d;const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao),i.jpa("Embeddable"),i.import(it.jsonIdentityInfo),i.import(it.jsogGenerator),i.import(it.serializable);for(const u of yi((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${_l(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(..._d(u,e,n,o,i));continue}c.push(gd(u,e,n,o,i))}return bl(c,i,o.lombok!==!1),kl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Dg(e,n,o){var u;const i=new pl,a=e.name;let r=kn(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ao}')`),r=ao),i.import(it.serializable);for(const m of yi((u=e.table)==null?void 0:u.logicalName,""))i.line(m);e.hasPersonalInfo&&(i.import(yd),i.line("@PersonalInfo"));const l=e.abstractClass?"abstract ":"",s=Ed(e,o,i,!1);i.line(`public ${l}class ${a}${s}${_l(e,i,["Serializable"])} {`);const c=e.attributes.filter(m=>m.attrType!=="DIVIDER").sort((m,p)=>m.order-p.order),d=[];for(const m of c){if(m.attrType.startsWith("EMBED")){i.fillIn(`${a}.${m.name||"(무명)"}: 직렬화 타입에 임베드 속성(${m.attrType}) — 직렬화 타입은 관계로 임베드되지 않으므로 방출하지 않음, 모델 정정 필요`);continue}if(m.attrType.startsWith("RELATION")){i.fillIn(`${a}.${m.name||"(무명)"}: 직렬화 타입에 연관 속성(${m.attrType}) — 직렬화 타입은 연관에 참여하지 않으므로 방출하지 않음, 모델 정정 필요`);continue}d.push(Og(m,e,n,o,i))}return bl(d,i,o.lombok!==!1),kl(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Og(e,n,o,i,a){const r=n.name,l=e.name||"unnamedField";e.name||a.fillIn(`${r}.${l}: 속성 이름 미지정 — 직렬화 타입 필드명을 결정할 근거가 없음, 모델 정정 필요`);const s=sd(e,n,o,i,!1)??gi(e.type,e.customType,i,e.groupCode);for(const c of s.imports)a.import(c);for(const c of s.fillIns)a.fillIn(`${r}.${l}: ${c}`);a.line("");for(const c of yi(e.description," "))a.line(c);return io(a,i.lombok!==!1),a.line(` private ${s.type} ${l};`),{type:s.type,name:l,category:0}}function _l(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const yd="net.g1project.bluecomm.annotation.PersonalInfo",Lg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",Pg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function kl(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Bt(i.name)||Bt(a))continue;const r=a.replace(/\r\n/g,`
|
|
19
19
|
`).split(`
|
|
20
|
-
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(Lg),n.import(Pg),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function gd(e,n,o,i,a,r=!1){const l=n.name,s=e.dbAttrs[0],c=e.name||md(s==null?void 0:s.physicalName)||"unnamedField";e.name||a.fillIn(`${l}.${c}: 속성 이름 미지정 — 물리명 '${(s==null?void 0:s.physicalName)??""}'에서 파생, 모델 정정 필요`);const d=sd(e,n,o,i,!0)??gi(e.type,e.customType,i,e.groupCode);for(const f of d.imports)a.import(f);for(const f of d.fillIns)a.fillIn(`${l}.${c}: ${f}`);const u=(s==null?void 0:s.multiValue)===!0,m=u?`Set<${d.type}>`:d.type;u&&(a.import("java.util.Set"),a.import("java.util.LinkedHashSet"),a.fillIn(`${l}.${c}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),a.line("");for(const f of yi(s==null?void 0:s.logicalName," "))a.line(f);e.identifier&&(a.jpa("Id"),a.line(" @Id"),s!=null&&s.autoIncrement&&r?a.fillIn(`${l}.${c}: 파생 식별(@MapsId) 스칼라에 autoIncrement 지정 — 값의 출처가 연관이므로 @GeneratedValue 미방출, 모델 확인 필요`):s!=null&&s.autoIncrement&&(a.jpa("GeneratedValue"),a.jpa("GenerationType"),a.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(a.import(
|
|
20
|
+
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(Lg),n.import(Pg),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function gd(e,n,o,i,a,r=!1){const l=n.name,s=e.dbAttrs[0],c=e.name||md(s==null?void 0:s.physicalName)||"unnamedField";e.name||a.fillIn(`${l}.${c}: 속성 이름 미지정 — 물리명 '${(s==null?void 0:s.physicalName)??""}'에서 파생, 모델 정정 필요`);const d=sd(e,n,o,i,!0)??gi(e.type,e.customType,i,e.groupCode);for(const f of d.imports)a.import(f);for(const f of d.fillIns)a.fillIn(`${l}.${c}: ${f}`);const u=(s==null?void 0:s.multiValue)===!0,m=u?`Set<${d.type}>`:d.type;u&&(a.import("java.util.Set"),a.import("java.util.LinkedHashSet"),a.fillIn(`${l}.${c}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),a.line("");for(const f of yi(s==null?void 0:s.logicalName," "))a.line(f);e.identifier&&(a.jpa("Id"),a.line(" @Id"),s!=null&&s.autoIncrement&&r?a.fillIn(`${l}.${c}: 파생 식별(@MapsId) 스칼라에 autoIncrement 지정 — 값의 출처가 연관이므로 @GeneratedValue 미방출, 모델 확인 필요`):s!=null&&s.autoIncrement&&(a.jpa("GeneratedValue"),a.jpa("GenerationType"),a.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(a.import(it.naturalId),a.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),(s==null?void 0:s.dataType)==="CLOB"&&(a.jpa("Lob"),a.line(" @Lob")),a.line(` ${Gg(e,s,a,r)}`);for(const f of d.fieldAnnotations)a.line(` ${f}`);const p=!u&&(s==null?void 0:s.dataType)==="VARCHAR"?e.type==="PrimitiveBoolean"?"booleanYnPrimitive":e.type==="Boolean"?"booleanYnBoxed":null:null;if(p){const f=ld(i,p);f?(a.jpa("Convert"),a.line(` @Convert(converter = ${f}.class)`)):a.fillIn(`${l}.${c}: Y/N 문자 플래그 컨버터 비활성(converterCatalog) — boolean × VARCHAR 매핑 @Convert 손채움 필요`)}return u?(a.line(` // TODO [손채움]: ${c} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),io(a,i.lombok!==!1),a.line(` private ${m} ${c} = new LinkedHashSet<>();`)):(io(a,i.lombok!==!1),a.line(` private ${m} ${c};`)),{type:m,name:c,category:0}}function bd(e,n,o){var s,c;if(e.attrType==="EMBED_PREDEF"){const d=(s=o.embeddableCatalog)==null?void 0:s.find(u=>u.type===e.type);return e.dbAttrs.map((u,m)=>{var p,f;return{propertyPath:((p=d==null?void 0:d.fields[m])==null?void 0:p.name)??"",defaultPhysical:((f=d==null?void 0:d.fields[m])==null?void 0:f.physicalName)??""}})}const i=(c=e.embedded)!=null&&c.embeddableRef?n.entities.find(d=>d.modelId===e.embedded.embeddableRef):void 0,a=gn(i,{entities:n.entities,embeddableCatalog:o.embeddableCatalog}),r=d=>({propertyPath:d.propertyPath,defaultPhysical:d.defaultPhysical,...d.defaultSharedRef!=null?{defaultSharedRef:d.defaultSharedRef}:{}});return e.dbAttrs.length===a.length?a.map(r):a.filter(d=>!!d.defaultPhysical).map(r)}function zg(e,n,o,i,a,r){var u;const l=$o(Dn(n,o.entities)),s=m=>{var p;return m==null?"":((p=l.get(m))==null?void 0:p.physicalName)??""},c=e.dbAttrs.length===gn((u=e.embedded)!=null&&u.embeddableRef?o.entities.find(m=>m.modelId===e.embedded.embeddableRef):void 0).length,d=[];return e.dbAttrs.forEach((m,p)=>{const f=i[p],h=c?bn(e,m,p,n,o,{embeddableCatalog:a.embeddableCatalog}):m,g=Qn(h,l),b=g?g.physicalName:h.physicalName||"",_=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!b||b===_)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${p}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(g?`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${b}", insertable = false, updatable = false))`:`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${b}"))`)}}),d}function Bt(e){return!e||e.trim()===""}function _d(e,n,o,i,a){var m,p,f,h;const r=n.name,l=kn(n,o,i);if(Bt(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const g=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(b=>b.modelId===e.embedded.embeddableRef):void 0;if(g){s=g.name;const b=kn(g,o,i);b&&b!==l&&a.import(`${b}.${g.name}`)}}if(Bt(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[Fg(e,n,o,i,a)];const c=bd(e,o,i),d=zg(e,n,o,c,i,a),u=aa(e,o.associations);if(a.line(""),u){const g=o.associations.find(k=>{var S;return k.modelId===((S=e.embedded)==null?void 0:S.associationRef)}),b=g?g.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?g.end2:g.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const _=(f=b==null?void 0:b.jpa)==null?void 0:f.collectionTable;_?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${_}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),El(d,a);const E=u==="SET";!E&&((h=b==null?void 0:b.jpa)!=null&&h.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${b.jpa.orderColumn}")`)),a.import(E?"java.util.Set":"java.util.List"),a.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const N=E?`Set<${s}>`:`List<${s}>`,y=E?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${N} ${e.name} = ${y};`),[{type:N,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),El(d,a),io(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function Fg(e,n,o,i,a){a.jpa("Embedded"),a.import(it.compositeType),a.import(it.money),a.import(it.moneyUserType);const r=bd(e,o,i),l=$o(Dn(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var b,_;const u=((b=r[d])==null?void 0:b.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Qn(c,l),p=((_=r[d])==null?void 0:_.defaultPhysical)||"",f=c.physicalName||"",h=c.insertable===!1||c.updatable===!1;if(!m&&!h&&(!f||f===p))return[];const g=[`name = "${m?m.physicalName:f||p}"`];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)"),El(s,a),io(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function El(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 Ug(e,n,o,i){var m;i.jpa("Table");const a=((m=e.table)==null?void 0:m.physicalName)??"",r=e.indexes??[];if(r.length===0)return`@Table(name = "${a}")`;const l={embeddableCatalog:o.embeddableCatalog},s=new Map;for(const p of e.attributes)p.dbAttrs.forEach((f,h)=>s.set(f.modelId,ci(p,f,h,e,n,l)));for(const p of si(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Jn(e.attributes),d=[];for(const p of r){const f=[];for(const g of p.columns){const b=s.get(c.canon(g.columnRef));if(!b){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${hc(c,g.columnRef)}) — 카탈로그 확인`);continue}f.includes(b)||f.push(b)}if(!f.length)continue;const h=p.unique?", unique = true":"";d.push(`@Index(name = "${p.name}", columnList = "${f.join(", ")}"${h})`)}if(d.length===0)return`@Table(name = "${a}")`;if(i.jpa("Index"),d.length===1)return`@Table(name = "${a}", indexes = { ${d[0]} })`;const u=d.map(p=>` ${p}`).join(`,
|
|
21
21
|
`);return`@Table(name = "${a}", indexes = {
|
|
22
22
|
${u}
|
|
23
|
-
})`}function Ea(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Nl(e,n,o,i=0){var r,l;const a=o.get(n.end1.entityRef);if(e.derivedFrom){const s=a==null?void 0:a.attributes.find(c=>c.modelId===e.derivedFrom.sourceAttributeRef);if(s!=null&&s.dbAttrs[i])return s.dbAttrs[i].physicalName;if(s&&i>0)return(r=Ao(a)[i])==null?void 0:r.physicalName}return(l=Ao(a)[i])==null?void 0:l.physicalName}function Hg(e,n,o,i){const a=n.modelId,r=o.attributes.filter(c=>{var d;return c.attrType==="RELATION_OWN"&&((d=c.derivedFrom)==null?void 0:d.associationRef)===a});if(r.length<=1)return[e];const l=i.get(n.end1.entityRef),s=c=>{const d=l==null?void 0:l.attributes.find(u=>{var m;return u.modelId===((m=c.derivedFrom)==null?void 0:m.sourceAttributeRef)});return d?d.order:Number.MAX_SAFE_INTEGER};return r.slice().sort((c,d)=>s(c)-s(d)||c.order-d.order)}function kd(e,n,o,i,a){if(!e)return;const r=kn(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function jg(e,n,o,i,a,r,l,s,c){var _;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Bt(e.name)||Bt(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=Ea(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),kd(d,o,l,s,c);const p=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${p.fetchType}`)),(_=p==null?void 0:p.cascadeTypes)!=null&&_.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(
|
|
23
|
+
})`}function Ea(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Nl(e,n,o,i=0){var r,l;const a=o.get(n.end1.entityRef);if(e.derivedFrom){const s=a==null?void 0:a.attributes.find(c=>c.modelId===e.derivedFrom.sourceAttributeRef);if(s!=null&&s.dbAttrs[i])return s.dbAttrs[i].physicalName;if(s&&i>0)return(r=Ao(a)[i])==null?void 0:r.physicalName}return(l=Ao(a)[i])==null?void 0:l.physicalName}function Hg(e,n,o,i){const a=n.modelId,r=o.attributes.filter(c=>{var d;return c.attrType==="RELATION_OWN"&&((d=c.derivedFrom)==null?void 0:d.associationRef)===a});if(r.length<=1)return[e];const l=i.get(n.end1.entityRef),s=c=>{const d=l==null?void 0:l.attributes.find(u=>{var m;return u.modelId===((m=c.derivedFrom)==null?void 0:m.sourceAttributeRef)});return d?d.order:Number.MAX_SAFE_INTEGER};return r.slice().sort((c,d)=>s(c)-s(d)||c.order-d.order)}function kd(e,n,o,i,a){if(!e)return;const r=kn(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function jg(e,n,o,i,a,r,l,s,c){var _;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Bt(e.name)||Bt(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=Ea(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),kd(d,o,l,s,c);const p=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${p.fetchType}`)),(_=p==null?void 0:p.cascadeTypes)!=null&&_.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(E=>`CascadeType.${E}`).join(", ")} }`)),c.jpa("JoinColumn");const h=i.get(n.end2.entityRef),g=h?Hg(e,n,h,i):[e],b=[];for(const E of g){const N=Math.max(1,E.dbAttrs.length);for(let y=0;y<N;y++){const k=E.dbAttrs[y],S=Nl(E,n,i,y),A=(k==null?void 0:k.physicalName)||S||"",V=[];A?V.push(`name = "${A}"`):c.fillIn(`${(h==null?void 0:h.name)??""}.${E.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),S&&V.push(`referencedColumnName = "${S}"`),E.notNull&&V.push("nullable = false"),(k==null?void 0:k.insertable)===!1&&V.push("insertable = false"),(k==null?void 0:k.updatable)===!1&&V.push("updatable = false"),b.push(`@JoinColumn(${V.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),b.length===1?c.line(` ${b[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${b[0]},`),b.slice(1).forEach((E,N)=>{const y=N===b.length-2;c.line(` ${E}${y?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),io(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function Kg(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;if(Bt(e.name)||Bt(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(k=>k.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"";if(!m)return s.fillIn(`${e.name}: 반대편(${d})에 대응 관계 속성이 없어 @OneToMany/@OneToOne(mappedBy) 방출 불가 — 자식에 FK 속성을 만들거나 관계를 단방향으로 정리 필요(CHK-JPA-19)`),null;kd(c,o,r,l,s);const p=Ea(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),io(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const f=n.end1.jpa,h=n.end1.composition||n.end2.composition;let g=(f==null?void 0:f.cascadeTypes)??[],b=f==null?void 0:f.orphanRemoval;h&&g.length===0&&(g=["ALL"],b==null&&(b=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const _=[`mappedBy = "${m}"`];g.length&&(s.jpa("CascadeType"),_.push(`cascade = { ${g.map(k=>`CascadeType.${k}`).join(", ")} }`)),b&&_.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),_.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${_.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const E=(f==null?void 0:f.collectionType)==="SET";s.import(E?"java.util.Set":"java.util.List"),s.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const N=E?`Set<${d}>`:`List<${d}>`,y=E?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${N} ${e.name} = ${y};`),{type:N,name:e.name,category:1,collection:!0}}function Gg(e,n,o,i=!1){o.jpa("Column");const a=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&a.push("nullable = false"),n){const r=qr.has(n.dataType);n.length!=null&&a.push(r?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&a.push(`scale = ${n.scale}`),i?a.push("insertable = false","updatable = false"):(n.insertable===!1&&a.push("insertable = false"),n.updatable===!1&&a.push("updatable = false")),n.unique&&a.push("unique = true")}return`@Column(${a.join(", ")})`}function Ed(e,n,o,i=!0){var s;const a=n.superClassCatalog??[],r=e.superClass||(i?(s=a.find(c=>c.default))==null?void 0:s.name:void 0);if(!r||r==="Object")return"";const l=a.find(c=>c.name===r);return l!=null&&l.packageName?o.import(`${l.packageName}.${l.name}`):o.fillIn(`${e.name}: superClass '${r}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${r}`}function Yg(e,n,o,i){i.import(it.serializable),i.import(it.objects),i.import(it.jsonUtils),o&&i.import(it.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${ud(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 qg(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,it.jpaRepository,it.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(`
|
|
24
24
|
`)+`
|
|
25
|
-
`}}function Wg(e,n,o,i){const a=[`${n}.${e}`,...i?[i]:[],
|
|
25
|
+
`}}function Wg(e,n,o,i){const a=[`${n}.${e}`,...i?[i]:[],it.jpaRepository,it.querydslExecutor].sort(),r=[`package ${n};`,""];for(const l of a)r.push(`import ${l};`);return r.push(""),r.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),r.push("}"),{fileName:`${e}Repository.java`,source:r.join(`
|
|
26
26
|
`)+`
|
|
27
|
-
`}}const ao="com.example",Jg="command.domain";function kn(e,n,o={}){const i=To(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??Jg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Xg="CustomMoneyType",Zg="Money";function Qg(e){return!(e.type!==Xg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function eb(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Zg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function tb(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Qg(l)?(a=!0,n=!0,eb(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function nb(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const g=new Map,b=new Map,_=new Map,k=(N,y,E)=>{if(!N)return;o.get(N)||o.set(N,[{entityId:y,assignedId:N}]),i.push({id:N,entityId:y,sink:E}),E(N)};for(const N of h.attributes){k(N.modelId,h.modelId,y=>g.set(N,y));for(const y of N.dbAttrs)k(y.modelId,h.modelId,E=>b.set(y,E))}for(const N of h.indexes??[])k(N.modelId,h.modelId,y=>_.set(N,y));a.set(h,{attrs:g,cols:b,idx:_})}const r=new Set(o.keys()),l=new Map;for(const h of i){const g=(l.get(h.id)??0)+1;if(l.set(h.id,g),g===1)continue;const b=ob(h.id,g-1,r);r.add(b),o.get(h.id).push({entityId:h.entityId,assignedId:b}),h.sink(b)}const s=[...o.values()].reduce((h,g)=>h+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,g)=>{var _;if(!g||!h)return g;const b=o.get(g);return!b||b.length<2?g:((_=b.find(k=>k.entityId===h))==null?void 0:_.assignedId)??g},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,g)=>{const b=d.get(h);if(b)return b.end1.entityRef===g?b.end2.entityRef:b.end1.entityRef},m=e.entities.map(h=>{var N;const g=a.get(h),b=h.attributes.map(y=>{const E=g.attrs.get(y),S=y.dbAttrs.map(T=>{const D=g.cols.get(T);return D===T.modelId?T:{...T,modelId:D}});let A=y.derivedFrom;if(A){const T=u(A.associationRef,h.modelId),D=c(T,A.sourceAttributeRef);D!==A.sourceAttributeRef&&(A={...A,sourceAttributeRef:D})}return E!==y.modelId||A!==y.derivedFrom||S.some((T,D)=>T!==y.dbAttrs[D])?{...y,modelId:E,dbAttrs:S,derivedFrom:A}:y}),_=(N=h.indexes)==null?void 0:N.map(y=>{const E=g.idx.get(y),S=y.columns.map(V=>{const T=c(h.modelId,V.columnRef);return T===V.columnRef?V:{...V,columnRef:T}});return E!==y.modelId||S.some((V,T)=>V!==y.columns[T])?{...y,modelId:E,columns:S}:y});return b.some((y,E)=>y!==h.attributes[E])||_&&h.indexes&&_.some((y,E)=>y!==h.indexes[E])?{...h,attributes:b,..._?{indexes:_}:{}}:h}),p=e.associations.map(h=>{const g=c(h.end1.entityRef,h.end1.attributeRef),b=c(h.end2.entityRef,h.end2.attributeRef);return g===h.end1.attributeRef&&b===h.end2.attributeRef?h:{...h,end1:g===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:g},end2:b===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:b}}}),f=n.associationLayouts.map(h=>{const g=d.get(h.associationRef);if(!g)return h;const b=c(g.end1.entityRef,h.sourceColumnRef),_=c(g.end2.entityRef,h.targetColumnRef);return b===h.sourceColumnRef&&_===h.targetColumnRef?h:{...h,sourceColumnRef:b,targetColumnRef:_}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,g)=>h!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function ob(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}const ib="5.2.5";function jt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function wl(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Nd(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function wd(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Nd);if(!i.length)continue;const a=o.filter(s=>!Nd(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 zo(e){return JSON.parse(JSON.stringify(e))}function Id(e,n,o){var V;const i=o.idFactory??Pe,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const D of r.associations){const C=T.has(D.end1.entityRef),R=T.has(D.end2.entityRef);C!==R&&s.add(C?D.end2.entityRef:D.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),p=new Map,f=T=>{let D=p.get(T);return D||(D=i(),p.set(T,D)),D};for(const T of c){f(T.modelId);for(const D of T.attributes){f(D.modelId);for(const C of D.dbAttrs)f(C.modelId)}for(const D of T.indexes??[])f(D.modelId);for(const D of T.operations??[])f(D.modelId)}for(const T of u)f(T.modelId);const h=T=>p.get(T),g=c.map(T=>{const D=zo(T);D.modelId=h(T.modelId),D.attributes=D.attributes.map(C=>ab(C,h,m,d));for(const C of D.indexes??[])C.modelId=h(C.modelId),C.columns=C.columns.map(R=>Xn(R.columnRef)?R:{...R,columnRef:h(R.columnRef)}).filter(R=>R.columnRef!==void 0);for(const C of D.operations??[])C.modelId=h(C.modelId);return D});wd(g);const b=u.map(T=>{const D=zo(T);return D.modelId=h(T.modelId),D.end1=vd(D.end1,h),D.end2=vd(D.end2,h),D}),_=[];for(const T of r.groups){const D=T.memberEntityRefs.filter(R=>d.has(R));if(D.length===0)continue;const C=zo(T);C.modelId=f(T.modelId),C.memberEntityRefs=D.map(R=>h(R)),_.push(C)}const k=o.collisionSuffix??"_imported",N=new Set(o.existing.entities.map(T=>T.name)),y=new Set(o.existing.entities.map(T=>{var D;return(D=T.table)==null?void 0:D.physicalName}).filter(T=>!!T));for(const T of g)N.has(T.name)&&(T.name=`${T.name}${k}`),(V=T.table)!=null&&V.physicalName&&y.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${k}`);const E=[];for(const T of l.entityLayouts){const D=h(T.entityRef);if(!D)continue;const C=zo(T);C.entityRef=D,C.geo={...C.geo,location:Il(C.geo.location,a)},C.attributeStyles&&(C.attributeStyles=Na(C.attributeStyles,h)),C.operationStyles&&(C.operationStyles=Na(C.operationStyles,h)),E.push(C)}const S=[];for(const T of l.associationLayouts){const D=h(T.associationRef);if(!D)continue;const C=zo(T);C.associationRef=D,C.sourceColumnRef=T.sourceColumnRef?h(T.sourceColumnRef):void 0,C.targetColumnRef=T.targetColumnRef?h(T.targetColumnRef):void 0,C.waypoints=C.waypoints.map(R=>Il(R,a)),S.push(C)}const A=[];for(const T of l.groupLayouts){const D=h(T.groupRef);if(!D)continue;const C=zo(T);C.groupRef=D,C.geo={...C.geo,location:Il(C.geo.location,a)},delete C.memberNoteRefs,A.push(C)}return{logical:{entities:g,associations:b,groups:_},layout:{entityLayouts:E,associationLayouts:S,groupLayouts:A},idMap:p}}function Il(e,n){return{x:e.x+n.x,y:e.y+n.y}}function ab(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 vd(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function Na(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function vl(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function ro(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)=>ro(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(!ro(e[i],n[i]))return!1;return!0}return!1}function lo(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||ro(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function so(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,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 rb(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 lb=new Set(["attributes","operations","indexes","rev"]),sb=new Set(["end1","end2","rev"]),cb=new Set(["memberEntityRefs","rev"]),Cd=new Set(["modelId"]),db=new Set(["modelId","columns"]),ub=new Set([]);function mb(e,n,o,i){const a=so(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=lo(s,c,Cd);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=so(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=lo(s,c,Cd);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=so(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(!ro(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=lo(s,c,db);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function fb(e,n,o){const i=so(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:vl(l)});for(const{cur:l,tgt:s}of i.common){const c=lo(l,s,lb);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),mb(l.modelId,l,s,o)}const a=so(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:vl(l)});for(const{cur:l,tgt:s}of a.common){const c=lo(l,s,sb);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=lo(l[d]??{},s[d]??{},ub);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=so(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:vl(l)});for(const{cur:l,tgt:s}of r.common){const c=lo(l,s,cb);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=rb(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 wa(e,n,o,i,a,r,l){const s=so(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)ro(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 pb(e,n,o){wa(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),wa(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),wa(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),wa(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function hb(e,n){const o=[];return fb(e.logical,n.logical,o),pb(e.layout,n.layout,o),o}function yb(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 gb={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 bb{constructor(n){ct(this,"out",[]);ct(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({...bi(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({...bi(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({...bi(n),field:a,value:void 0,removed:!0});continue}this.out.push({...bi(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({...bi(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function bi(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 rn(e,n,o,i){if(o==null||typeof o!="object")return;const a=gb[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function co(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Cl(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Ln(e,n){var r,l,s,c,d,u,m,p;const o=yb(n),i=new bb(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?rn(i,f,h.value,"entity"):h.kind==="entity.update"?co(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((r=h.value)==null?void 0:r.attributes,n.attributeRef);g&&rn(i,f,g,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?rn(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?co(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((s=h.value)==null?void 0:s.operations,n.operationRef);g&&rn(i,f,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?rn(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?co(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((d=h.value)==null?void 0:d.indexes,n.indexRef);g&&rn(i,f,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?rn(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?co(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?rn(i,f,h.value,"association"):h.kind==="association.update"?co(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const g=(m=h.value)==null?void 0:m[n.end];rn(i,f,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?co(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){rn(i,f,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const b of g)i.member(f,b,!1)}else h.kind==="group.update"?co(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const lt={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},_b={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":lt,"entityLayout.remove":lt,"entityLayout.move":lt,"entityLayout.resize":lt,"entityLayout.setCollapsed":lt,"entityLayout.setLocked":lt,"entityLayout.setStyle":lt,"entityLayout.setAttrStyle":lt,"entityLayout.setOpStyle":lt,"groupLayout.add":lt,"groupLayout.remove":lt,"groupLayout.move":lt,"groupLayout.resize":lt,"groupLayout.setLocked":lt,"groupLayout.setStyle":lt,"groupLayout.addNoteMember":lt,"groupLayout.removeNoteMember":lt,"associationLayout.add":lt,"associationLayout.remove":lt,"associationLayout.setWaypoints":lt,"note.add":lt,"note.remove":lt,"note.move":lt,"note.resize":lt,"note.setMemo":lt,"note.setStyle":lt,"noteConnection.add":lt,"noteConnection.remove":lt,"noteConnection.setWaypoints":lt},Kt=e=>typeof e=="string"?e:void 0,kb=e=>{var n;return Kt((n=e.value)==null?void 0:n.modelId)};function Sd(e){return Kt(e.containerRef)??Kt(e.entityRef)}function Sl(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=Kt(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function xl(e){const n=_b[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Kt(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Sl(o,"attributes","attribute",a),...Sl(o,"operations","operation",a),...Sl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Sd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?kb(o):Kt(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Kt(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=Kt(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Eb(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Kt(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Sd(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Kt(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Kt(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Nb(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function wb(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of xl(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function Ia(e,n){return e.map(o=>({...o,subject:n}))}function xd(e,n){const o=e.filter(s=>s.ops.some(c=>Nb(c,n))),{attributes:i,operations:a,indexes:r}=wb(o,n),l=[...Ia(Ln(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...Ia(Ln(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...Ia(Ln(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...Ia(Ln(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 Rl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ib(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of xl(i))a.existence==="add"&&n.add(Rl(a.subject));return n}function vb(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Eb(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Cb(e){const{entities:n,associations:o,groups:i}=vb(e),a=[];for(const r of n)for(const l of xd(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Ln(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Ln(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Ln(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Al(e){const n=Cb(e),o=Ib(e),i=new Map;for(const l of n){const s=Rl(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=Rl(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)}function Rd(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Sb(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of xl(r)){if(!l.existence||l.inline)continue;const s=l.subject;xb.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const xb=new Set(["attribute","operation","index"]);function $l(e,n){const{fromSeq:o}=n,i=Al(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=Rd(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Sb(e,o,r)){const p=s.get(Rd(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let g=null;for(const _ of m.evs){_.verb==="add"&&g!==null&&g!=="add"&&h.clear(),g=_.verb;for(const k of _.fields){const N=h.get(k.field);N?N.lastValue=k.value:h.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const _=[];for(const[k,N]of h)_.push({field:k,value:N.lastValue});d.push({subject:m.subject,verb:"added",fields:_});continue}const b=[];for(const[_,k]of h)k.hasOld&&ro(k.firstOld,k.lastValue)||b.push({field:_,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});b.length!==0&&d.push({subject:m.subject,verb:"modified",fields:b})}return{fromSeq:o,toSeq:r,entries:d}}function Ad(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 Tl{constructor(n){ct(this,"undoStack",[]);ct(this,"redoStack",[]);ct(this,"savePoint",null);ct(this,"listeners",new Set);ct(this,"commandListeners",new Set);ct(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.sealCoalesce(),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 Dt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function $d(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function Nt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Gt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function ut(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function En(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 va(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=$d(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=Nt(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 Td(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=$d(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=Nt(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})}),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((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(p=>p.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(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 Ml(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=ut(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(ut(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Dt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Dt(o)}]}}}}function Md(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=ut(i,e);o=a.name,a.name=n},invert(i){ut(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 Fo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=Nt(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=Nt(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 Vd(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Nt(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=Nt(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 _i(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 Bd(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=Nt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=_i(r.style,n)},invert(i){const a=Nt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Nt(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 Dd(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Nt(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=Nt(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 Od(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Nt(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=Nt(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 Vl(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 Ca(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=Nt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=_i(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=Nt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=Nt(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 Sa(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 Ld(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:Dt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Dt(o)}]}}}}function Pd(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 zd(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 xa(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 Fd(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 Ud(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 Hd(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=_i(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 jd(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 Yt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){ut(o,e).attributes.push(n)},invert(o){const i=ut(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 qt(e,n,o){const i={},a=r=>{const l=ut(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:Dt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Dt(i)}]}}}}function Kd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=ut(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&&ut(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 Gd(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 u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Bl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=ut(a,e);i=r.attributes.map(s=>({...s}));const l=wl([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&ut(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=ut(a,e).attributes;return Gd("attribute.update","attributeRef",e,r,i??[])}}}function Yd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=ut(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=ut(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 qd(e,n,o){const i={},a=r=>{var s;const l=(s=ut(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:Dt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Dt(i)}]}}}}function Wd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=ut(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=ut(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 Jd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=ut(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=wl([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=ut(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=ut(a,e).operations??[];return Gd("operation.update","operationRef",e,r,i??[])}}}function Xd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=Nt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=_i(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=Nt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=Nt(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 Ra(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 Zd(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 Aa(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:Dt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Dt(o)}]}}}}function Wt(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:Dt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Dt(i)}]}}}}function Qd(e,n){return{label:"인덱스 추가",apply(o){const i=ut(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=ut(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 $a(e,n,o){const i={},a=r=>{var s;const l=(s=ut(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:Dt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Dt(i)}]}}}}function eu(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=ut(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&&ut(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 ln=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ki=(e,n)=>{var o;return((o=Gt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function tu(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Gt(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=Gt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ki(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[ln(e,r)],invert:[ln(e,l)]}}}}function nu(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Gt(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=Gt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ki(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[ln(e,a)],invert:[ln(e,r)]}}}}function ou(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Gt(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=Gt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[ln(e,ki(a,e))],invert:[ln(e,i??[])]}}}}function iu(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Gt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Gt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[ln(e,ki(o,e))],invert:[ln(e,n??[])]}}}}function au(e,n,o){return{label:"waypoint 추가",apply(i){const a=Gt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Gt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ki(i,e),r=a.slice();return r.splice(n,1),{forward:[ln(e,a)],invert:[ln(e,r)]}}}}function ru(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 lu(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 Ei(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 su(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 cu(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 du(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=_i(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 uu(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 mu(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 Pn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Ta=(e,n,o)=>{var i;return((i=En(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function fu(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 pu(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 hu(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=En(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=En(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ta(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Pn(e,n,l)],invert:[Pn(e,n,s)]}}}}function yu(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=En(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=En(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ta(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Pn(e,n,r)],invert:[Pn(e,n,l)]}}}}function gu(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=En(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=En(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ta(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Pn(e,n,r)],invert:[Pn(e,n,l)]}}}}function bu(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=En(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=En(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Pn(e,n,Ta(i,e,n))],invert:[Pn(e,n,o??[])]}}}}function at(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 Rb=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ra,addAttribute:Yt,addEntity:va,addEntityToGroup:zd,addGroup:Sa,addIndex:Qd,addNote:ru,addNoteConnection:fu,addNoteConnectionWaypoint:yu,addNoteToGroup:uu,addOperation:Yd,addWaypoint:au,clearNoteConnectionWaypoints:bu,clearWaypoints:iu,composite:at,moveEntity:Fo,moveGroup:Fd,moveNote:Ei,moveNoteConnectionWaypoint:hu,moveWaypoint:tu,removeAssociation:Zd,removeAttribute:Kd,removeEntity:Td,removeEntityFromGroup:xa,removeGroup:Pd,removeIndex:eu,removeNote:lu,removeNoteConnection:pu,removeNoteConnectionWaypoint:gu,removeNoteFromGroup:mu,removeOperation:Wd,removeWaypoint:nu,renameEntity:Md,reorderAttributes:Bl,reorderOperations:Jd,resizeEntity:Vd,resizeGroup:Ud,resizeNote:su,setAllEntitiesCollapsed:Vl,setAttributeSwatch:Ca,setEntityCollapsed:Dd,setEntityLocked:Od,setEntitySwatch:Bd,setGroupLocked:jd,setGroupSwatch:Hd,setNoteMemo:cu,setNoteSwatch:du,setOperationSwatch:Xd,translateWaypoints:ou,updateAssociation:Aa,updateAssociationEnd:Wt,updateAttribute:qt,updateEntity:Ml,updateGroup:Ld,updateIndex:$a,updateOperation:qd},Symbol.toStringTag,{value:"Module"}));class _u{constructor(){ct(this,"revs",new Map);ct(this,"layoutVersion",0);ct(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}}}const Ab=[400,1200];function $b(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Tb(e){const n=$b(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Mb=e=>new Promise(n=>setTimeout(n,e));class ku{constructor(n){ct(this,"cache",new _u);ct(this,"newClientOpId");ct(this,"debounceMs");ct(this,"retryDelaysMs");ct(this,"emissions",new WeakMap);ct(this,"open",null);ct(this,"debounceHandle",null);ct(this,"queue",[]);ct(this,"sending",!1);ct(this,"_frozen",!1);ct(this,"stack",null);ct(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Pe,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Ab}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();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,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}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(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}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;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Tb(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Mb(c)}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 Eu=["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","group.update","group.remove","group.addMember","group.removeMember"],Nu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function wu(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Vb(e){return gn(e).length}function Dl(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function Bb(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=ci(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Iu(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Vb(i);if(a===0)return[];const r=Dl(e,n),l=gn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Bb(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function vu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=Dl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=c.map(_=>h.dbAttrs[d.get(_)]),b=g.reduce((_,k,N)=>k===h.dbAttrs[N]?_:_+1,0);b&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,moved:b})}return m}function Cu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=gn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(gn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,h)=>{c.has(f)&&d.add(h)}),d.size===s.length)return[];const u=Dl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=h.dbAttrs.filter((k,N)=>d.has(N)),b=h.dbAttrs.filter((k,N)=>!d.has(N));h.dbAttrs.some((k,N)=>{if(d.has(N))return!1;const y=l[N],E=!!k.physicalName&&k.physicalName!==((y==null?void 0:y.physicalName)??""),S=k.sharedColumnRef!=null&&k.sharedColumnRef!==(y==null?void 0:y.sharedColumnRef);return E||S})||m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,dropped:b})}return m}function Db(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==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ob(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==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Su(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function St(e,n){const o=Db(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>zb(i,e))}}function Lb(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ol(e,n){const o=Lb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function Ll(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Pb=new Set(["name","description","packageName","excludeDDLGeneration"]);function zb(e,n){var a;const o=To(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function xu(e,n){const o=Ob(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 Fb(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==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ub(e,n){const o=Fb(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 Ru(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 Pl(e){return e.by!==void 0&&e.by!=="name"}function Hb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function jb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Kb(e,n){const o=Hb(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 Au(e,n){const o=jb(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 $u(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Tu(e){return $u(e)&&e.dataType==null}function Mu(e,n,o){const i=$u(e);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 Vu(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},b=Ru(Dn(i,a),g);if(!b.ok){s.push(b.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:b.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.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:m}}const Gb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),Uo=e=>new Set(Object.keys(e)),Yb=Uo({name:!0,stereotype:!0,physicalName:!0,useVersion:!0,attributes:!0,indexes:!0,operations:!0,serialization:!0}),Bu=Uo({name:!0,type:!0,identifier:!0,notNull:!0,transient:!0,physicalName:!0,dataType:!0,length:!0,scale:!0,groupCode:!0,defaultValue:!0,attributeGroup:!0,description:!0,columnLogicalName:!0,unique:!0,updatable:!0,embeddableOverrides:!0}),Du=Uo({name:!0,unique:!0,columns:!0,description:!0,parameters:!0}),Ou=Uo({name:!0,visibility:!0,sourceCode:!0,description:!0,personalInfoAttributeType:!0}),qb=Uo({from:!0,to:!0,fromMultiplicity:!0,toMultiplicity:!0,identifying:!0,composition:!0}),Wb=Uo({name:!0,packageName:!0,description:!0,excludeDDLGeneration:!0,members:!0});function Nn(e,n){return uo(e,n)}const Jb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly","serialization"]),Xb=new Set(["description","identifying"]),Zb=new Set(["multiplicity","navigable","composition"]),Qb=new Set(["name","unique","description","parameters"]),e_=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function uo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const zl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),t_=new Set([...zl].filter(e=>e!=="sharedColumnRef"));function n_(e,n,o,i){if(i||o.some(l=>!t_.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))zl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function o_(e,n,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,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const b={ref:h.sharedColumnPhysicalName,by:"physicalName"},_=Ru(Dn(i,a),b);if(!_.ok){s.push(_.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:_.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function Lu(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 Pu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Ub(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 Ho(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function i_(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of wu(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function a_(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:h}of m){if(a.has(f))continue;const g=p.get(f)??[];g.push(h),p.set(f,g)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of Cu(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(h=>h.modelId===m?{...h,attributes:[...h.attributes,...p]}:h)};for(const h of Iu(f,m,r))u(h)}}function zu(e,n){const o={...e},i=[];for(const[a,r]of Object.entries(n)){if(!a.includes(".")){o[a]=r===null?void 0:r;continue}const l=/^dbAttrs\.(\d+)\.(.+)$/.exec(a);l&&i.push([Number(l[1]),l[2],r])}if(i.length){const a=(o.dbAttrs??[]).map(r=>({...r}));for(const[r,l,s]of i)a[r]&&(a[r][l]=s===null?void 0:s);o.dbAttrs=a}return o}function Fu(e,n,o,i,a,r,l){var p;for(const f of i.remove)Ho(e,r,o,f);for(const f of i.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:f.attributeId,patch:f.patch}),a.attrPatches.push({entityId:o,attributeId:f.attributeId,patch:f.patch});const s=((p=n.entities.find(f=>f.modelId===o))==null?void 0:p.attributes)??[],c=[];for(const f of i.add){const h={...f,order:l(o,s)};e.push({kind:"attribute.add",casUnit:"logical",containerRef:o,entityRef:o,value:h}),a.cascadeAdds.push({entityId:o,attribute:h}),c.push(h)}const d=new Set(i.remove),u=[...s.filter(f=>!d.has(f.modelId)),...c],m=new Set(u.map(f=>f.modelId));for(const f of n.associations){if(f.end2.entityRef!==o)continue;const h=f.end2.attributeRef;if(h&&m.has(h))continue;const b=u.filter(_=>{var k;return((k=_.derivedFrom)==null?void 0:k.associationRef)===f.modelId&&_.dbAttrs.length>0}).sort((_,k)=>_.order-k.order)[0];b&&(e.push({kind:"associationEnd.update",casUnit:"logical",containerRef:f.modelId,associationRef:f.modelId,end:"end2",patch:{attributeRef:b.modelId}}),a.endPatches.push({associationRef:f.modelId,end:"end2",patch:{attributeRef:b.modelId}}))}}function Fl(e,n,o,i,a,r,l){for(const{entityId:s,plan:c}of od(n,o,i))Fu(e,n,s,c,a,r,l)}function r_(e,n,o,i,a,r){const l=new Map;for(const{entityId:p,attributeId:f}of i.pairs)l.has(p)||l.set(p,new Set),l.get(p).add(f);const s=new Map;for(const p of r.attrPatches)s.has(p.entityId)||s.set(p.entityId,[]),s.get(p.entityId).push(p);const c=new Map;for(const{entityId:p,attribute:f}of[...a,...r.cascadeAdds])c.has(p)||c.set(p,[]),c.get(p).push(f);const d=p=>{const f={};for(const[h,g]of Object.entries(p))h.includes(".")||(f[h]=g===null?void 0:g);return f},u=e.entities.filter(p=>!n.has(p.modelId)).map(p=>{const f=l.get(p.modelId),h=s.get(p.modelId),g=c.get(p.modelId);if(!f&&!h&&!g)return p;let b=p.attributes;return f&&(b=b.filter(_=>!f.has(_.modelId))),h&&(b=b.map(_=>{const k=h.filter(N=>N.attributeId===_.modelId);return k.length?k.reduce((N,y)=>zu(N,y.patch),_):_})),g&&(b=[...b,...g]),{...p,attributes:b}}),m=e.associations.filter(p=>!o.has(p.modelId)&&!n.has(p.end1.entityRef)&&!n.has(p.end2.entityRef)).map(p=>{let f=p;for(const h of r.assocPatches)h.associationRef===p.modelId&&(f={...f,...d(h.patch)});for(const h of r.endPatches)h.associationRef===p.modelId&&(f={...f,[h.end]:{...f[h.end],...d(h.patch)}});return f}).concat(r.addedAssociations);return{...e,entities:u,associations:m}}function l_(e,n,o,i,a,r,l,s,c){if(!l.identifierCascadeParents.size)return;const d=r_(n,o,i,a,r,l),u=new Map;for(const m of l.identifierCascadeParents)for(const[p,f]of sl(d,m,s)){const h=u.get(p);u.set(p,h?ll(h,f):f)}for(const[m,p]of u)Fu(e,d,m,nd(p),l,a,c)}function s_(e,n,o={}){const i=o.mkId??Pe,a=o.embeddableCatalog??[],r=y=>a.find(E=>E.type===y),l=[],s=[],c=new Map,d=(y,E)=>{const S=c.get(y)??jt(E);return c.set(y,S+1),S},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},h=[],g={attrPatches:[],cascadeAdds:[],addedAssociations:[],assocPatches:[],endPatches:[],identifierCascadeParents:new Set},b=new Set,_=(y,E)=>`${y}\0${E}`,k=new Set;for(const y of n)y.kind==="entity.add"&&(k.add(y.spec.name),y.spec.physicalName&&k.add(y.spec.physicalName));const N=new Set;return n.forEach((y,E)=>{var S,A,V,T,D;switch(y.kind){case"entity.add":{{const M={ref:y.spec.name},x=Nn(y.spec,Yb);if(x.length){s.push({code:"entity-spec-unknown-key",opIndex:E,handle:M,keys:x});break}let P=!1;for(const Y of y.spec.attributes??[]){const se=Nn(Y,Bu);se.length&&(s.push({code:"attribute-spec-unknown-key",opIndex:E,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}for(const Y of y.spec.indexes??[]){const se=Nn(Y,Du);se.length&&(s.push({code:"index-spec-unknown-key",opIndex:E,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}for(const Y of y.spec.operations??[]){const se=Nn(Y,Ou);se.length&&(s.push({code:"operation-spec-unknown-key",opIndex:E,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}if(P)break}const C=e.entities.filter(M=>M.name===y.spec.name).map(M=>M.modelId);if(C.length||N.has(y.spec.name)){s.push({code:"entity-name-conflict",opIndex:E,handle:{ref:y.spec.name},matches:C});break}N.add(y.spec.name);const R=i(),$={modelId:R,name:y.spec.name,stereotype:y.spec.stereotype??"JPA_ENTITY",attributes:[],...y.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...y.spec.physicalName?{table:{physicalName:y.spec.physicalName}}:{},...y.spec.serialization?{serialization:y.spec.serialization}:{}},w={ref:y.spec.name};let I=!1;for(const[M,x]of(y.spec.attributes??[]).entries()){if(x.type==="GroupCodeEnum"&&!x.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:w,handle:{ref:x.name}}),I=!0;continue}if(!r(x.type)&&!((S=x.embeddableOverrides)!=null&&S.length)&&Tu(x)){s.push({code:"datatype-required",opIndex:E,entity:w,handle:{ref:x.name}}),I=!0;continue}const P=r(x.type);if(P){const Y=Vu(x,P,M,$,e.entities,E,w,s,i);Y?$.attributes.push(Y):I=!0}else(A=x.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:E,entity:w,handle:{ref:x.name}}),I=!0):$.attributes.push(Mu(x,M,i))}const v=(y.spec.operations??[]).map((M,x)=>Lu(M,x,i));v.length&&($.operations=v);const B=[];for(const M of y.spec.indexes??[]){const x=Pu($,M,E,w,s,i);x?B.push(x):I=!0}if(B.length&&($.indexes=B),I)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:$});break}case"entity.update":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}const R=uo(y.patch,Jb,["jpaAttrs.","table.","serialization."]);if(R.length){s.push({code:"entity-patch-unknown-key",opIndex:E,entity:y.entity,keys:R});break}const $=y.patch.stereotype;if(typeof $=="string"&&$!==C.value.stereotype){const w=$==="JPA_EMBEDDABLE"||C.value.stereotype==="JPA_EMBEDDABLE",I=$==="SERIALIZED_TYPE"||C.value.stereotype==="SERIALIZED_TYPE";if(w||I){s.push({code:w?"stereotype-embeddable-transition-unsupported":"stereotype-serialized-transition-unsupported",opIndex:E,entity:y.entity,from:C.value.stereotype??"",to:$});break}}l.push({kind:"entity.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,patch:y.patch});break}case"entity.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}const R=C.value.modelId,$=e.associations.filter(B=>B.end1.entityRef===R||B.end2.entityRef===R),w=new Set($.map(B=>B.modelId));for(const B of $)m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));for(const B of e.entities)if(B.modelId!==R)for(const M of B.attributes)M.embedded&&w.has(M.embedded.associationRef)&&Ho(l,f,B.modelId,M.modelId);for(const B of $){if(B.end1.entityRef===R||!B.end1.attributeRef)continue;const M=e.entities.find(P=>P.modelId===B.end1.entityRef),x=M==null?void 0:M.attributes.find(P=>P.modelId===B.end1.attributeRef&&P.attrType==="RELATION_REF");x&&Ho(l,f,M.modelId,x.modelId)}const I={...e,entities:e.entities.filter(B=>B.modelId!==R),associations:e.associations.filter(B=>!w.has(B.modelId))},v=new Set($.filter(B=>B.end1.entityRef===R&&B.end2.entityRef!==R).map(B=>B.end2.entityRef));Fl(l,I,[...v],i,g,f,d);for(const B of e.groups)B.memberEntityRefs.includes(R)&&(b.has(_(B.modelId,R))||(b.add(_(B.modelId,R)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:B.modelId,groupRef:B.modelId,entityRef:R})));p.add(R),l.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{{const I=Nn(y.spec,Bu);if(I.length){s.push({code:"attribute-spec-unknown-key",opIndex:E,entity:y.entity,handle:{ref:y.spec.name},keys:I});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}if(y.spec.type==="GroupCodeEnum"&&!y.spec.groupCode){s.push({code:"groupcode-required",opIndex:E,entity:y.entity,handle:{ref:y.spec.name}});break}if(!r(y.spec.type)&&!((V=y.spec.embeddableOverrides)!=null&&V.length)&&Tu(y.spec)){s.push({code:"datatype-required",opIndex:E,entity:y.entity,handle:{ref:y.spec.name}});break}const R=d(C.value.modelId,C.value.attributes),$=r(y.spec.type);let w;if($)w=Vu(y.spec,$,R,C.value,e.entities,E,y.entity,s,i);else if((T=y.spec.embeddableOverrides)!=null&&T.length){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:y.entity,handle:{ref:y.spec.name}});break}else w=Mu(y.spec,R,i);if(!w)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,value:w}),h.push({entityId:C.value.modelId,attribute:w}),w.identifier&&g.identifierCascadeParents.add(C.value.modelId);break}case"attribute.update":case"attribute.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}const R=xu(C.value,y.attribute);if(!R.ok){s.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:E,entity:y.entity,handle:y.attribute}:{code:"attribute-ambiguous",opIndex:E,entity:y.entity,handle:y.attribute,matches:R.matches});break}if(y.kind==="attribute.update"){const $=[],w=[];let I=!1;for(const x of Object.keys(y.patch)){if(x.includes(".")){x.startsWith("dbAttrs.")?I=!0:w.push(x);continue}zl.has(x)?$.push(x):Gb.has(x)||w.push(x)}if(w.length){s.push({code:"attribute-patch-unknown-key",opIndex:E,entity:y.entity,handle:y.attribute,keys:w});break}if("attrType"in y.patch){const x=String(y.patch.attrType),P=Nu.includes(x)?x!==R.value.attrType?"transition":void 0:"unknown-value";if(P){s.push({code:"attribute-attrtype-unsupported",opIndex:E,entity:y.entity,handle:y.attribute,reason:P,current:R.value.attrType,requested:x});break}}const v="type"in y.patch?y.patch.type:R.value.type,B="groupCode"in y.patch?y.patch.groupCode:R.value.groupCode;if(v==="GroupCodeEnum"&&!B){s.push({code:"groupcode-required",opIndex:E,entity:y.entity,handle:y.attribute});break}let M=y.patch;if($.length){const x=n_(R.value,y.patch,$,I);if(!x){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:E,entity:y.entity,handle:y.attribute,keys:$});break}M=x}if((D=y.embeddableOverrides)!=null&&D.length){const x=r(R.value.type);if(!x||R.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:E,entity:y.entity,handle:y.attribute});break}const P=o_(R.value,x,y.embeddableOverrides,C.value,e.entities,E,y.entity,s);if(!P)break;M={...M,dbAttrs:P}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,attributeRef:R.value.modelId,patch:M}),g.attrPatches.push({entityId:C.value.modelId,attributeId:R.value.modelId,patch:M});{const x=R.value,P=zu(x,M),Y=(P.identifier??!1)!==(x.identifier??!1),se=(x.identifier||P.identifier)&&("type"in M||"customType"in M||"dbAttrs"in M||Object.keys(M).some(he=>he.startsWith("dbAttrs.")));(Y||se)&&g.identifierCascadeParents.add(C.value.modelId)}}else{const $=Lo(e,C.value.modelId,R.value.modelId);if($){const w=I=>{var v;return((v=e.entities.find(B=>B.modelId===I))==null?void 0:v.name)??I};s.push({code:"attribute-fk-managed",opIndex:E,entity:y.entity,handle:y.attribute,association:{from:w($.end1.entityRef),to:w($.end2.entityRef)}});break}Ho(l,f,C.value.modelId,R.value.modelId),R.value.identifier&&g.identifierCascadeParents.add(C.value.modelId)}break}case"association.add":{{const B=Nn(y.spec,qb);if(B.length){s.push({code:"association-spec-unknown-key",opIndex:E,handle:{from:y.spec.from,to:y.spec.to},keys:B});break}}const C=St(e,y.spec.from),R=St(e,y.spec.to);if(C.ok||s.push(xt(C.reason,E,y.spec.from,C.matches,k)),R.ok||s.push(xt(R.reason,E,y.spec.to,R.matches,k)),!C.ok||!R.ok)break;if(y.spec.identifying&&C.value.modelId===R.value.modelId){s.push({code:"self-identifying",opIndex:E,handle:{from:y.spec.from,to:y.spec.to}});break}if(C.value.stereotype==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:E,handle:{from:y.spec.from,to:y.spec.to}});break}if(C.value.stereotype==="SERIALIZED_TYPE"||R.value.stereotype==="SERIALIZED_TYPE"){s.push({code:"serialized-relation-invalid",opIndex:E,handle:{from:y.spec.from,to:y.spec.to}});break}const $=i(),w={modelId:$,...y.spec.identifying!=null?{identifying:y.spec.identifying}:{},end1:{entityRef:C.value.modelId,multiplicity:y.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:y.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:y.spec.composition??!1}},I={...e,associations:[...e.associations,w]},v=pi(I,R.value.modelId,i);v.add[0]&&(w.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:$,value:w}),g.addedAssociations.push(w);for(const B of v.add){const M={...B,order:d(R.value.modelId,R.value.attributes)};l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:M}),g.cascadeAdds.push({entityId:R.value.modelId,attribute:M})}break}case"association.remove":{const C=St(e,y.association.from),R=St(e,y.association.to);if(C.ok||s.push(xt(C.reason,E,y.association.from,C.matches,k)),R.ok||s.push(xt(R.reason,E,y.association.to,R.matches,k)),!C.ok||!R.ok)break;const $=Su(e,C.value.modelId,R.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:E,handle:y.association}:{code:"association-ambiguous",opIndex:E,handle:y.association,matches:$.map(B=>B.modelId)});break}const w=$[0];m.has(w.modelId)||(m.add(w.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:w.modelId}));const I=e.entities.find(B=>B.attributes.some(M=>{var x;return((x=M.embedded)==null?void 0:x.associationRef)===w.modelId}));if(I){const B=I.attributes.find(M=>{var x;return((x=M.embedded)==null?void 0:x.associationRef)===w.modelId});Ho(l,f,I.modelId,B.modelId);break}if(w.end1.attributeRef){const B=e.entities.find(x=>x.modelId===w.end1.entityRef),M=B==null?void 0:B.attributes.find(x=>x.modelId===w.end1.attributeRef&&x.attrType==="RELATION_REF");M&&Ho(l,f,B.modelId,M.modelId)}const v={...e,associations:e.associations.filter(B=>B.modelId!==w.modelId)};Fl(l,v,[w.end2.entityRef],i,g,f,d);break}case"association.update":{const C=Uu(e,y.association,E,s,k);if(!C)break;const R=y.patch.identifying,$=typeof R=="boolean"?R:void 0;if($===!0&&C.end1.entityRef===C.end2.entityRef){s.push({code:"self-identifying",opIndex:E,handle:y.association});break}const w=uo(y.patch,Xb);if(w.length){s.push({code:"association-patch-unknown-key",opIndex:E,handle:y.association,keys:w});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,patch:y.patch}),g.assocPatches.push({associationRef:C.modelId,patch:y.patch}),$!==void 0&&$!==(C.identifying??!1)){const I={...e,associations:e.associations.map(v=>v.modelId===C.modelId?{...v,identifying:$}:v)};Fl(l,I,[C.end2.entityRef],i,g,f,d)}break}case"associationEnd.update":{const C=Uu(e,y.association,E,s,k);if(!C)break;const R=y.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(y.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:E,handle:y.association});break}const $=uo(y.patch,Zb,["jpa."]);if($.length){s.push({code:"association-end-patch-unknown-key",opIndex:E,handle:y.association,keys:$});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,end:R,patch:y.patch}),g.endPatches.push({associationRef:C.modelId,end:R,patch:y.patch});break}case"index.add":{{const $=Nn(y.spec,Du);if($.length){s.push({code:"index-spec-unknown-key",opIndex:E,entity:y.entity,handle:{ref:y.spec.name},keys:$});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}const R=Pu(C.value,y.spec,E,y.entity,s,i);if(!R)break;l.push({kind:"index.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}if(Pl(y.index)){s.push({code:"handle-by-unsupported",opIndex:E,entity:y.entity,handle:y.index,target:"index"});break}const R=Kb(C.value,y.index);if(!R.ok){s.push(R.reason==="not-found"?{code:"index-not-found",opIndex:E,entity:y.entity,handle:y.index}:{code:"index-ambiguous",opIndex:E,entity:y.entity,handle:y.index,matches:R.matches});break}if(y.kind==="index.update"){if("columns"in y.patch){s.push({code:"index-columns-patch-unsupported",opIndex:E,entity:y.entity,handle:y.index});break}const $=uo(y.patch,Qb);if($.length){s.push({code:"index-patch-unknown-key",opIndex:E,entity:y.entity,handle:y.index,keys:$});break}l.push({kind:"index.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.value.modelId,patch:y.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{{const w=Nn(y.spec,Ou);if(w.length){s.push({code:"operation-spec-unknown-key",opIndex:E,entity:y.entity,handle:{ref:y.spec.name},keys:w});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}const R=u.get(C.value.modelId)??(C.value.operations?jt(C.value.operations):0);u.set(C.value.modelId,R+1);const $=Lu(y.spec,R,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,E,y.entity,C.matches,k));break}if(Pl(y.operation)){s.push({code:"handle-by-unsupported",opIndex:E,entity:y.entity,handle:y.operation,target:"operation"});break}const R=Au(C.value,y.operation);if(!R.ok){s.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:E,entity:y.entity,handle:y.operation}:{code:"operation-ambiguous",opIndex:E,entity:y.entity,handle:y.operation,matches:R.matches});break}if(y.kind==="operation.update"){const $=uo(y.patch,e_);if($.length){s.push({code:"operation-patch-unknown-key",opIndex:E,entity:y.entity,handle:y.operation,keys:$});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:R.value.modelId,patch:y.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const C=y.kind==="attribute.reorder",R=St(e,y.entity);if(!R.ok){s.push(xt(R.reason,E,y.entity,R.matches,k));break}const $=C?y.order:y.operations,w=[],I=new Set;let v=!1;for(const P of $){if(!C&&Pl(P)){s.push({code:"handle-by-unsupported",opIndex:E,entity:y.entity,handle:P,target:"operation"}),v=!0;continue}const Y=C?xu(R.value,P):Au(R.value,P);if(!Y.ok){s.push(Y.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:E,entity:y.entity,handle:P}:{code:"reorder-handle-ambiguous",opIndex:E,entity:y.entity,handle:P,matches:Y.matches}),v=!0;continue}if(I.has(Y.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:E,entity:y.entity,handle:P}),v=!0;continue}I.add(Y.value.modelId),w.push(Y.value)}if(v)break;const M=[...C?R.value.attributes:R.value.operations??[]].sort((P,Y)=>P.order-Y.order).filter(P=>!I.has(P.modelId)),x=[...w,...M];if(x.forEach((P,Y)=>{P.order!==Y&&l.push(C?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:P.modelId,patch:{order:Y}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:P.modelId,patch:{order:Y}})}),C)for(const P of vu(e,R.value.modelId,x.map(Y=>Y.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:P.entityId,entityRef:P.entityId,attributeRef:P.attributeId,patch:{dbAttrs:P.dbAttrs}});break}case"group.add":{{const I=Nn(y.spec,Wb);if(I.length){s.push({code:"group-spec-unknown-key",opIndex:E,keys:I});break}}const C=[];let R=!1;for(const I of y.spec.members){const v=St(e,I);if(!v.ok){s.push(xt(v.reason,E,I,v.matches,k)),R=!0;continue}C.push(v.value.modelId)}if(R)break;const $=i(),w={modelId:$,excludeDDLGeneration:y.spec.excludeDDLGeneration??!1,memberEntityRefs:C,...y.spec.name?{name:y.spec.name}:{},...y.spec.packageName?{packageName:y.spec.packageName}:{},...y.spec.description?{description:y.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:$,value:w});break}case"group.update":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,E,y.group));break}const R=uo(y.patch,Pb);if(R.length){s.push({code:"group-patch-unknown-key",opIndex:E,handle:y.group,keys:R});break}l.push({kind:"group.update",casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,patch:y.patch});break}case"group.remove":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,E,y.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:C.value.modelId});break}case"group.addMember":case"group.removeMember":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,E,y.group));break}const R=St(e,y.entity);if(!R.ok){s.push(xt(R.reason,E,y.entity,R.matches,k));break}const $=C.value.memberEntityRefs.includes(R.value.modelId);if(y.kind==="group.addMember"?$:!$)break;if(y.kind==="group.removeMember"){if(b.has(_(C.value.modelId,R.value.modelId)))break;b.add(_(C.value.modelId,R.value.modelId))}l.push({kind:y.kind,casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,entityRef:R.value.modelId});break}}}),s.length||l_(l,e,p,m,f,h,g,i,d),s.length||i_(l,e,f,p),s.length||a_(l,e,f,h,p,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function xt(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 Uu(e,n,o,i,a){const r=St(e,n.from),l=St(e,n.to);if(r.ok||i.push(xt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(xt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Su(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 Hu={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},c_={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},d_={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},u_={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","SERIALIZED_TYPE"],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"}},serialization:{$ref:"#/$defs/serialization"}},required:["name"],additionalProperties:!1},m_={type:"object",description:"직렬화 타입의 컨테이너(SERIALIZED_TYPE 전용). 미지정 = 컬렉션이 아닌 단일 값(한 컬럼에 구조 하나). 신규 엔티티는 entity.add 에 함께 줘야 한다 — 같은 배치의 entity.update 는 갓 만든 엔티티에 닿지 못한다.",properties:{collectionType:{type:"string",enum:["LIST","SET","MAP"],description:"컨테이너 종류. 코퍼스 실재가 java.util 3종뿐이라 그만 표현한다(미지 컨테이너는 발명하지 않는다)."},mapKeyType:{type:"string",description:"collectionType='MAP' 일 때의 키 타입(단순명 또는 FQN). 그 외엔 무의미."}},additionalProperties:!1},zn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},f_={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:{...zn,description:"속성 설명(다국어)."},columnLogicalName:{...zn,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},p_={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}},ju={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},h_={type:"object",description:'일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)·직렬화 타입을 end 로 주면 거부된다. 직렬화 타입은 관계가 아니라 소비 속성의 type 으로 지목한다(attribute.update {type: "<타입명>"}). (임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).',properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...ju,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...ju,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},y_={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Hu,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},g_={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...zn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},b_={type:"object",properties:{name:{...zn,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},__={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",enum:[...Nu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...zn,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:{...zn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},k_={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},E_={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},N_={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...zn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},w_={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table·serialization. serialization(직렬화 타입 컨테이너)은 통째로 주거나(예: {"serialization":{"collectionType":"LIST"}}) dotted-key로 준다({"serialization.collectionType":"LIST"}). 컬렉션 아님으로 되돌릴 땐 null 로 비운다(wire clear 규약). jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 값 타입(JPA_EMBEDDABLE·SERIALIZED_TYPE) 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},I_={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function ht(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const v_={"entity.add":ht("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":ht("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":ht("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":ht("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":ht("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":ht("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":ht("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":ht("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":ht("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":ht("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":ht("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":ht("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":ht("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":ht("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":ht("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":ht("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":ht("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":ht("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":ht("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":ht("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":ht("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":ht("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":ht("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},C_={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},S_={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...zn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},Ku={anyOf:Eu.map(e=>v_[e])},x_={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Hu,nameHandle:c_,groupHandle:C_,assocHandle:d_,entitySpec:u_,serialization:m_,attrSpec:f_,embeddableOverrides:p_,assocSpec:h_,indexSpec:y_,operationSpec:g_,groupSpec:b_,entityUpdatePatch:w_,attrUpdatePatch:__,assocUpdatePatch:k_,assocEndUpdatePatch:I_,indexUpdatePatch:E_,operationUpdatePatch:N_,groupUpdatePatch:S_,symbolicOp:Ku}};function R_(e,n,o,i={}){const a=i.mkClientOpId??Pe,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 Gu={location:{x:0,y:0},size:{width:220,height:140}};function Yu(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 A_=/^[-=_*~\s]{3,}$/;function $_(e){return e.attrType&&e.attrType!=="NORMAL"||!A_.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function T_(e){return e.type===_n&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function M_(e,n){if(e.attrType==="DIVIDER"||$_(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=T_(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(Yu)}}function V_(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function B_(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 D_(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(M_),operations:(n=e.operations)==null?void 0:n.map(V_),indexes:(o=e.indexes)==null?void 0:o.map(B_),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function O_(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??{...Gu},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 qu(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 Ul(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:qu(e)}}function L_(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>Hl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function P_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:L_(e),end1:Ul(e.end1),end2:Ul(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 Hl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Wu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Ju(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 Xu(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(Yu)}}function z_(e,n,o){var y,E;const i=Hl(e.end1.attribute),a=Hl(e.end2.attribute);if(i===a)return P_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(E=(y=s.dbAttrs)==null?void 0:y[0])==null?void 0:E.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((S,A)=>Math.max(S,A.order),-1)+1:s.order??0,p={...Xu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let g;if(h&&f&&r.navigable){const S=ca(l.multiplicity);g={modelId:h.modelId??crypto.randomUUID(),name:to(h.name??ua((u==null?void 0:u.name)??l.endModel.refId,S),new Set(f.attributes.map(A=>A.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((A,V)=>Math.max(A,V.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const b=(S,A)=>({entityRef:S.endModel.refId,multiplicity:S.multiplicity,navigable:S.navigable,composition:S.composition,attributeRef:A?g==null?void 0:g.modelId:p.modelId,jpa:qu(S)}),_=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!_&&p.identifier===!0?!0:void 0,end1:b(e.end1,i),end2:b(e.end2,a)},N={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:k,layout:N}}function F_(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 U_(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.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((g,b)=>Math.max(g,b.order),-1)+1:l.order??0,d={...Xu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>F_(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...Ul(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function H_(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,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Zu(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 u=H_(o,s);u.length&&(d=u)}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 Qu(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 j_(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||_t(a.stereotype)||_t(r.stereotype))continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=ca(i.end2.multiplicity),u=ua(r.name,d),m=to(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function K_(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||_t(a.stereotype)||_t(r.stereotype))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 em(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if(l&&_t(l.stereotype))continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Dc(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function tm(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?G_(n):Y_(n)}function G_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);j_(a,r),K_(a,r),em(a,r);const{version:s,...c}=e.layout;Qu(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}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Y_(e){var _,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(N,y)=>{o.push(D_(N));const E=O_(N);E.geo={location:{x:E.geo.location.x+y.x,y:E.geo.location.y+y.y},size:E.geo.size},i.push(E);for(const S of N.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const N of e.entities??[])d(N,u);const m=[];for(const N of e.groups??[]){const y=N.entities??[];l.push({modelId:N.modelId,name:N.name,description:N.description,packageName:N.packageName,excludeDDLGeneration:N.excludeDDLGeneration??!1,memberEntityRefs:y.map(S=>S.modelId)});const E=((_=N.geo)==null?void 0:_.location)??u;if(N.geo){const S=(N.notes??[]).map(A=>A.modelId);s.push({groupRef:N.modelId,geo:N.geo,style:N.style,locked:N.locked,memberNoteRefs:S.length?S:void 0})}for(const S of y)d(S,E);for(const S of N.notes??[])m.push(Zu(S,E))}const p=new Map(o.map(N=>[N.modelId,N])),f=new Map,h=new Map;for(const N of o)for(const y of N.attributes)for(const E of y.dbAttrs)f.set(E.modelId,y.modelId),h.set(E.modelId,E);for(const N of c)for(const y of[N.end1,N.end2]){const E=y.attribute;if(E&&(((k=E.dbAttrs)==null?void 0:k.length)??0)>0)for(const S of E.dbAttrs)S.modelId&&f.set(S.modelId,E.modelId)}for(const N of c){const y=Wu(N.end1.attribute),E=Wu(N.end2.attribute),S=Ju(N.end1)||Ju(N.end2),{assoc:A,layout:V}=y!==E||S?U_(N,p,h):z_(N,p,f);a.push(A),r.push(V)}Qu(o,a,r),wd(o),em(o,a);const g={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(N=>Zu(N)),...m]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:b}}function nm(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 q_(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(nm),style:n}}function W_(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 J_(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 Fn(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 X_(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{...nm(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Z_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function om(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 Q_(e){const n=new Set;for(const o of e.logical.associations){const i=om(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function ek(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 tk(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function nk(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:tk(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 ok(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.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,p)=>nk(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Fn(e.end1,c?s:u),end2:Fn(e.end2,c?u:s)}}function ik(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:Fn(e.end1,e.end1.legacyEmbedRaw),end2:Fn(e.end2,e.end2.legacyEmbedRaw)};const a=ok(e,n,i);if(a)return a;const r=om(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?X_(r.fk,l):void 0,c=Z_(r.navAttr);return{...i,end1:Fn(e.end1,r.navEnd===e.end1?s:c),end2:Fn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Fn(e.end1),end2:Fn(e.end2)}}function im(e,n,o,i,a={x:0,y:0}){var u,m;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(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...Gu},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 f;return q_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return W_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>ik(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(J_),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 ak(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=>am(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>im(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 am(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 rk(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Q_(e),r=ek(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=>im(s,e,a,r)),groups:e.logical.groups.map(s=>ak(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>am(s))}}function lk(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,referenceOnly:n.referenceOnly,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}}}const sk=["notNull"];function ck(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=tm(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const b of sk)f[b]===!0!=(h[b]===!0)&&(g[b]=f[b],s.attributeFieldsByName[b]=(s.attributeFieldsByName[b]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function Ni(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function wn(e){return typeof e=="function"?e():t.unref(e)}const dk=typeof window<"u"&&typeof document<"u",uk=e=>typeof e<"u",mk=Object.prototype.toString,fk=e=>mk.call(e)==="[object Object]",pk=()=>{};function hk(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 rm=e=>e();function yk(e=rm){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 lm(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function gk(e,n,o={}){const{eventFilter:i=rm,...a}=o;return t.watch(e,hk(i,n),a)}function jo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=yk(i);return{stop:gk(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function bk(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=wn(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 jl(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:g}={}){let b=null;const k=[new Promise(N=>{b=t.watch(e,y=>{m(y)!==n&&(b==null||b(),N(y))},{flush:p,deep:f,immediate:!0})})];return h!=null&&k.push(lm(h,g).then(()=>wn(e)).finally(()=>b==null?void 0:b())),Promise.race(k)}function i(m,p){if(!t.isRef(m))return o(y=>y===m,p);const{flush:f="sync",deep:h=!1,timeout:g,throwOnTimeout:b}=p??{};let _=null;const N=[new Promise(y=>{_=t.watch([e,m],([E,S])=>{n!==(E===S)&&(_==null||_(),y(E))},{flush:f,deep:h,immediate:!0})})];return g!=null&&N.push(lm(g,b).then(()=>wn(e)).finally(()=>(_==null||_(),wn(e)))),Promise.race(N)}function a(m){return o(p=>!!p,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,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(wn(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(wn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return jl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return jl(e,!n)}}}function Kl(e){return jl(e)}function _k(e){var n;const o=wn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const sm=dk?window:void 0;function cm(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=sm):[n,o,i,a]=e,!n)return pk;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[_k(n),wn(a)],([u,m])=>{if(l(),!u)return;const p=fk(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return Ni(d),d}function kk(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function dm(...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=sm,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=kk(n);return cm(a,r,u=>{u.repeat&&wn(s)||c(u)&&o(u)},l)}function Ek(e){return JSON.parse(JSON.stringify(e))}function Gl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const b=N=>s?typeof s=="function"?s(N):Ek(N):N,_=()=>uk(e[n])?b(e[n]):m,k=N=>{p?p(N)&&h(g,N):h(g,N)};if(c){const N=_(),y=t.ref(N);let E=!1;return t.watch(()=>e[n],S=>{E||(E=!0,y.value=b(S),t.nextTick(()=>E=!1))}),t.watch(y,S=>{!E&&(S!==e[n]||u)&&k(S)},{deep:u}),y}else return t.computed({get(){return _()},set(N){k(N)}})}var Nk={value:()=>{}};function Ma(){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 Va(o)}function Va(e){this._=e}function wk(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}})}Va.prototype=Ma.prototype={constructor:Va,on:function(e,n){var o=this._,i=wk(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Ik(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]=um(o[a],e.name,n);else if(n==null)for(a in o)o[a]=um(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 Va(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 Ik(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function um(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Nk,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Yl="http://www.w3.org/1999/xhtml";const mm={svg:"http://www.w3.org/2000/svg",xhtml:Yl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ba(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),mm.hasOwnProperty(n)?{space:mm[n],local:e}:e}function vk(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Yl&&n.documentElement.namespaceURI===Yl?n.createElement(e):n.createElementNS(o,e)}}function Ck(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fm(e){var n=Ba(e);return(n.local?Ck:vk)(n)}function Sk(){}function ql(e){return e==null?Sk:function(){return this.querySelector(e)}}function xk(e){typeof e!="function"&&(e=ql(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,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 Ut(i,this._parents)}function Rk(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ak(){return[]}function pm(e){return e==null?Ak:function(){return this.querySelectorAll(e)}}function $k(e){return function(){return Rk(e.apply(this,arguments))}}function Tk(e){typeof e=="function"?e=$k(e):e=pm(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 Ut(i,a)}function hm(e){return function(){return this.matches(e)}}function ym(e){return function(n){return n.matches(e)}}var Mk=Array.prototype.find;function Vk(e){return function(){return Mk.call(this.children,e)}}function Bk(){return this.firstElementChild}function Dk(e){return this.select(e==null?Bk:Vk(typeof e=="function"?e:ym(e)))}var Ok=Array.prototype.filter;function Lk(){return Array.from(this.children)}function Pk(e){return function(){return Ok.call(this.children,e)}}function zk(e){return this.selectAll(e==null?Lk:Pk(typeof e=="function"?e:ym(e)))}function Fk(e){typeof e!="function"&&(e=hm(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 Ut(i,this._parents)}function gm(e){return new Array(e.length)}function Uk(){return new Ut(this._enter||this._groups.map(gm),this._parents)}function Da(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Da.prototype={constructor:Da,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 Hk(e){return function(){return e}}function jk(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 Da(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function Kk(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Da(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Gk(e){return e.__data__}function Yk(e,n){if(!arguments.length)return Array.from(this,Gk);var o=n?Kk:jk,i=this._parents,a=this._groups;typeof e!="function"&&(e=Hk(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],p=m.length,f=qk(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),b=l[d]=new Array(h),_=c[d]=new Array(p);o(u,m,g,b,_,f,n);for(var k=0,N=0,y,E;k<h;++k)if(y=g[k]){for(k>=N&&(N=k+1);!(E=b[N])&&++N<h;);y._next=E||null}}return l=new Ut(l,i),l._enter=s,l._exit=c,l}function qk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wk(){return new Ut(this._exit||this._groups.map(gm),this._parents)}function Jk(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 Xk(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],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ut(s,this._parents)}function Zk(){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 Qk(e){e||(e=eE);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!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,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ut(a,this._parents).order()}function eE(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function tE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nE(){return Array.from(this)}function oE(){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 iE(){let e=0;for(const n of this)++e;return e}function aE(){return!this.node()}function rE(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 lE(e){return function(){this.removeAttribute(e)}}function sE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cE(e,n){return function(){this.setAttribute(e,n)}}function dE(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function uE(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function mE(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 fE(e,n){var o=Ba(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?sE:lE:typeof n=="function"?o.local?mE:uE:o.local?dE:cE)(o,n))}function bm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pE(e){return function(){this.style.removeProperty(e)}}function hE(e,n,o){return function(){this.style.setProperty(e,n,o)}}function yE(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function gE(e,n,o){return arguments.length>1?this.each((n==null?pE:typeof n=="function"?yE:hE)(e,n,o??"")):Ko(this.node(),e)}function Ko(e,n){return e.style.getPropertyValue(n)||bm(e).getComputedStyle(e,null).getPropertyValue(n)}function bE(e){return function(){delete this[e]}}function _E(e,n){return function(){this[e]=n}}function kE(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function EE(e,n){return arguments.length>1?this.each((n==null?bE:typeof n=="function"?kE:_E)(e,n)):this.node()[e]}function _m(e){return e.trim().split(/^|\s+/)}function Wl(e){return e.classList||new km(e)}function km(e){this._node=e,this._names=_m(e.getAttribute("class")||"")}km.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 Em(e,n){for(var o=Wl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Nm(e,n){for(var o=Wl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function NE(e){return function(){Em(this,e)}}function wE(e){return function(){Nm(this,e)}}function IE(e,n){return function(){(n.apply(this,arguments)?Em:Nm)(this,e)}}function vE(e,n){var o=_m(e+"");if(arguments.length<2){for(var i=Wl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?IE:n?NE:wE)(o,n))}function CE(){this.textContent=""}function SE(e){return function(){this.textContent=e}}function xE(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function RE(e){return arguments.length?this.each(e==null?CE:(typeof e=="function"?xE:SE)(e)):this.node().textContent}function AE(){this.innerHTML=""}function $E(e){return function(){this.innerHTML=e}}function TE(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function ME(e){return arguments.length?this.each(e==null?AE:(typeof e=="function"?TE:$E)(e)):this.node().innerHTML}function VE(){this.nextSibling&&this.parentNode.appendChild(this)}function BE(){return this.each(VE)}function DE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function OE(){return this.each(DE)}function LE(e){var n=typeof e=="function"?e:fm(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function PE(){return null}function zE(e,n){var o=typeof e=="function"?e:fm(e),i=n==null?PE:typeof n=="function"?n:ql(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function FE(){var e=this.parentNode;e&&e.removeChild(this)}function UE(){return this.each(FE)}function HE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function jE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function KE(e){return this.select(e?jE:HE)}function GE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function YE(e){return function(n){e.call(this,n,this.__data__)}}function qE(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 WE(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 JE(e,n,o){return function(){var i=this.__on,a,r=YE(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 XE(e,n,o){var i=qE(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=n?JE:WE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function wm(e,n,o){var i=bm(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 ZE(e,n){return function(){return wm(this,e,n)}}function QE(e,n){return function(){return wm(this,e,n.apply(this,arguments))}}function e1(e,n){return this.each((typeof n=="function"?QE:ZE)(e,n))}function*t1(){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 Im=[null];function Ut(e,n){this._groups=e,this._parents=n}function wi(){return new Ut([[document.documentElement]],Im)}function n1(){return this}Ut.prototype=wi.prototype={constructor:Ut,select:xk,selectAll:Tk,selectChild:Dk,selectChildren:zk,filter:Fk,data:Yk,enter:Uk,exit:Wk,join:Jk,merge:Xk,selection:n1,order:Zk,sort:Qk,call:tE,nodes:nE,node:oE,size:iE,empty:aE,each:rE,attr:fE,style:gE,property:EE,classed:vE,text:RE,html:ME,raise:BE,lower:OE,append:LE,insert:zE,remove:UE,clone:KE,datum:GE,on:XE,dispatch:e1,[Symbol.iterator]:t1};function Jt(e){return typeof e=="string"?new Ut([[document.querySelector(e)]],[document.documentElement]):new Ut([[e]],Im)}function o1(e){let n;for(;n=e.sourceEvent;)e=n;return e}function sn(e,n){if(e=o1(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 i1={passive:!1},Ii={capture:!0,passive:!1};function Jl(e){e.stopImmediatePropagation()}function Go(e){e.preventDefault(),e.stopImmediatePropagation()}function vm(e){var n=e.document.documentElement,o=Jt(e).on("dragstart.drag",Go,Ii);"onselectstart"in n?o.on("selectstart.drag",Go,Ii):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Cm(e,n){var o=e.document.documentElement,i=Jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Go,Ii),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 Oa=e=>()=>e;function Xl(e,{sourceEvent:n,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: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:u}})}Xl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function a1(e){return!e.ctrlKey&&!e.button}function r1(){return this.parentNode}function l1(e,n){return n??{x:e.x,y:e.y}}function s1(){return navigator.maxTouchPoints||"ontouchstart"in this}function c1(){var e=a1,n=r1,o=l1,i=s1,a={},r=Ma("start","drag","end"),l=0,s,c,d,u,m=0;function p(y){y.on("mousedown.drag",f).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,i1).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(y,E){if(!(u||!e.call(this,y,E))){var S=N(this,n.call(this,y,E),y,E,"mouse");S&&(Jt(y.view).on("mousemove.drag",h,Ii).on("mouseup.drag",g,Ii),vm(y.view),Jl(y),d=!1,s=y.clientX,c=y.clientY,S("start",y))}}function h(y){if(Go(y),!d){var E=y.clientX-s,S=y.clientY-c;d=E*E+S*S>m}a.mouse("drag",y)}function g(y){Jt(y.view).on("mousemove.drag mouseup.drag",null),Cm(y.view,d),Go(y),a.mouse("end",y)}function b(y,E){if(e.call(this,y,E)){var S=y.changedTouches,A=n.call(this,y,E),V=S.length,T,D;for(T=0;T<V;++T)(D=N(this,A,y,E,S[T].identifier,S[T]))&&(Jl(y),D("start",y,S[T]))}}function _(y){var E=y.changedTouches,S=E.length,A,V;for(A=0;A<S;++A)(V=a[E[A].identifier])&&(Go(y),V("drag",y,E[A]))}function k(y){var E=y.changedTouches,S=E.length,A,V;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<S;++A)(V=a[E[A].identifier])&&(Jl(y),V("end",y,E[A]))}function N(y,E,S,A,V,T){var D=r.copy(),C=sn(T||S,E),R,$,w;if((w=o.call(y,new Xl("beforestart",{sourceEvent:S,target:p,identifier:V,active:l,x:C[0],y:C[1],dx:0,dy:0,dispatch:D}),A))!=null)return R=w.x-C[0]||0,$=w.y-C[1]||0,function I(v,B,M){var x=C,P;switch(v){case"start":a[V]=I,P=l++;break;case"end":delete a[V],--l;case"drag":C=sn(M||B,E),P=l;break}D.call(v,y,new Xl(v,{sourceEvent:B,subject:w,target:p,identifier:V,active:P,x:C[0]+R,y:C[1]+$,dx:C[0]-x[0],dy:C[1]-x[1],dispatch:D}),A)}}return p.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Oa(!!y),p):e},p.container=function(y){return arguments.length?(n=typeof y=="function"?y:Oa(y),p):n},p.subject=function(y){return arguments.length?(o=typeof y=="function"?y:Oa(y),p):o},p.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Oa(!!y),p):i},p.on=function(){var y=r.on.apply(r,arguments);return y===r?p:y},p.clickDistance=function(y){return arguments.length?(m=(y=+y)*y,p):Math.sqrt(m)},p}function Zl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Sm(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function vi(){}var Ci=.7,La=1/Ci,Yo="\\s*([+-]?\\d+)\\s*",Si="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",d1=/^#([0-9a-f]{3,8})$/,u1=new RegExp(`^rgb\\(${Yo},${Yo},${Yo}\\)$`),m1=new RegExp(`^rgb\\(${cn},${cn},${cn}\\)$`),f1=new RegExp(`^rgba\\(${Yo},${Yo},${Yo},${Si}\\)$`),p1=new RegExp(`^rgba\\(${cn},${cn},${cn},${Si}\\)$`),h1=new RegExp(`^hsl\\(${Si},${cn},${cn}\\)$`),y1=new RegExp(`^hsla\\(${Si},${cn},${cn},${Si}\\)$`),xm={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};Zl(vi,mo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rm,formatHex:Rm,formatHex8:g1,formatHsl:b1,formatRgb:Am,toString:Am});function Rm(){return this.rgb().formatHex()}function g1(){return this.rgb().formatHex8()}function b1(){return Bm(this).formatHsl()}function Am(){return this.rgb().formatRgb()}function mo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=d1.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$m(n):o===3?new Ot(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Pa(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Pa(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=u1.exec(e))?new Ot(n[1],n[2],n[3],1):(n=m1.exec(e))?new Ot(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=f1.exec(e))?Pa(n[1],n[2],n[3],n[4]):(n=p1.exec(e))?Pa(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=h1.exec(e))?Vm(n[1],n[2]/100,n[3]/100,1):(n=y1.exec(e))?Vm(n[1],n[2]/100,n[3]/100,n[4]):xm.hasOwnProperty(e)?$m(xm[e]):e==="transparent"?new Ot(NaN,NaN,NaN,0):null}function $m(e){return new Ot(e>>16&255,e>>8&255,e&255,1)}function Pa(e,n,o,i){return i<=0&&(e=n=o=NaN),new Ot(e,n,o,i)}function _1(e){return e instanceof vi||(e=mo(e)),e?(e=e.rgb(),new Ot(e.r,e.g,e.b,e.opacity)):new Ot}function Ql(e,n,o,i){return arguments.length===1?_1(e):new Ot(e,n,o,i??1)}function Ot(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Zl(Ot,Ql,Sm(vi,{brighter(e){return e=e==null?La:Math.pow(La,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ot(fo(this.r),fo(this.g),fo(this.b),za(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:k1,formatRgb:Mm,toString:Mm}));function Tm(){return`#${po(this.r)}${po(this.g)}${po(this.b)}`}function k1(){return`#${po(this.r)}${po(this.g)}${po(this.b)}${po((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mm(){const e=za(this.opacity);return`${e===1?"rgb(":"rgba("}${fo(this.r)}, ${fo(this.g)}, ${fo(this.b)}${e===1?")":`, ${e})`}`}function za(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function fo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function po(e){return e=fo(e),(e<16?"0":"")+e.toString(16)}function Vm(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 Bm(e){if(e instanceof Xt)return new Xt(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=mo(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 E1(e,n,o,i){return arguments.length===1?Bm(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}Zl(Xt,E1,Sm(vi,{brighter(e){return e=e==null?La:Math.pow(La,e),new Xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,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 Ot(es(e>=240?e-240:e+120,a,i),es(e,a,i),es(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Xt(Dm(this.h),Fa(this.s),Fa(this.l),za(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=za(this.opacity);return`${e===1?"hsl(":"hsla("}${Dm(this.h)}, ${Fa(this.s)*100}%, ${Fa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dm(e){return e=(e||0)%360,e<0?e+360:e}function Fa(e){return Math.max(0,Math.min(1,e||0))}function es(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 ts=e=>()=>e;function N1(e,n){return function(o){return e+o*n}}function w1(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 I1(e){return(e=+e)==1?Om:function(n,o){return o-n?w1(n,o,e):ts(isNaN(n)?o:n)}}function Om(e,n){var o=n-e;return o?N1(e,o):ts(isNaN(e)?n:e)}const Ua=(function e(n){var o=I1(n);function i(a,r){var l=o((a=Ql(a)).r,(r=Ql(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Om(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 v1(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 C1(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function S1(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]=xi(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 x1(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function dn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function R1(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]=xi(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,os=new RegExp(ns.source,"g");function A1(e){return function(){return e}}function $1(e){return function(n){return e(n)+""}}function Lm(e,n){var o=ns.lastIndex=os.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ns.exec(e))&&(a=os.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=os.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?$1(c[0].x):A1(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function xi(e,n){var o=typeof n,i;return n==null||o==="boolean"?ts(n):(o==="number"?dn:o==="string"?(i=mo(n))?(n=i,Ua):Lm:n instanceof mo?Ua:n instanceof Date?x1:C1(n)?v1:Array.isArray(n)?S1:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?R1:dn)(e,n)}var Pm=180/Math.PI,is={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zm(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)*Pm,skewX:Math.atan(c)*Pm,scaleX:l,scaleY:s}}var Ha;function T1(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?is:zm(n.a,n.b,n.c,n.d,n.e,n.f)}function M1(e){return e==null||(Ha||(Ha=document.createElementNS("http://www.w3.org/2000/svg","g")),Ha.setAttribute("transform",e),!(e=Ha.transform.baseVal.consolidate()))?is:(e=e.matrix,zm(e.a,e.b,e.c,e.d,e.e,e.f))}function Fm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:dn(d,m)},{i:g-2,x:dn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:dn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:dn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:dn(d,m)},{i:g-2,x:dn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,b;++h<g;)m[(b=p[h]).i]=b.x(f);return m.join("")}}}var V1=Fm(T1,"px, ","px)","deg)"),B1=Fm(M1,", ",")",")"),D1=1e-12;function Um(e){return((e=Math.exp(e))+1/e)/2}function O1(e){return((e=Math.exp(e))-1/e)/2}function L1(e){return((e=Math.exp(2*e))-1)/(e+1)}const ja=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,b,_;if(g<D1)_=Math.log(p/d)/n,b=function(A){return[s+A*f,c+A*h,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(g),N=(p*p-d*d+i*g)/(2*d*o*k),y=(p*p-d*d-i*g)/(2*p*o*k),E=Math.log(Math.sqrt(N*N+1)-N),S=Math.log(Math.sqrt(y*y+1)-y);_=(S-E)/n,b=function(A){var V=A*_,T=Um(E),D=d/(o*k)*(T*L1(n*V+E)-O1(E));return[s+D*f,c+D*h,d*T/Um(n*V+E)]}}return b.duration=_*1e3*n/Math.SQRT2,b}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 qo=0,Ri=0,Ai=0,Hm=1e3,Ka,$i,Ga=0,ho=0,Ya=0,Ti=typeof performance=="object"&&performance.now?performance:Date,jm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function as(){return ho||(jm(P1),ho=Ti.now()+Ya)}function P1(){ho=0}function qa(){this._call=this._time=this._next=null}qa.prototype=Km.prototype={constructor:qa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?as():+o)+(n==null?0:+n),!this._next&&$i!==this&&($i?$i._next=this:Ka=this,$i=this),this._call=e,this._time=o,rs()},stop:function(){this._call&&(this._call=null,this._time=1/0,rs())}};function Km(e,n,o){var i=new qa;return i.restart(e,n,o),i}function z1(){as(),++qo;for(var e=Ka,n;e;)(n=ho-e._time)>=0&&e._call.call(void 0,n),e=e._next;--qo}function Gm(){ho=(Ga=Ti.now())+Ya,qo=Ri=0;try{z1()}finally{qo=0,U1(),ho=0}}function F1(){var e=Ti.now(),n=e-Ga;n>Hm&&(Ya-=n,Ga=e)}function U1(){for(var e,n=Ka,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:Ka=o);$i=e,rs(i)}function rs(e){if(!qo){Ri&&(Ri=clearTimeout(Ri));var n=e-ho;n>24?(e<1/0&&(Ri=setTimeout(Gm,e-Ti.now()-Ya)),Ai&&(Ai=clearInterval(Ai))):(Ai||(Ga=Ti.now(),Ai=setInterval(F1,Hm)),qo=1,jm(Gm))}}function Ym(e,n,o){var i=new qa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var H1=Ma("start","end","cancel","interrupt"),j1=[],qm=0,Wm=1,ls=2,Wa=3,Jm=4,ss=5,Ja=6;function Xa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;K1(e,o,{name:n,index:i,group:a,on:H1,tween:j1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:qm})}function cs(e,n){var o=Zt(e,n);if(o.state>qm)throw new Error("too late; already scheduled");return o}function un(e,n){var o=Zt(e,n);if(o.state>Wa)throw new Error("too late; already running");return o}function Zt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function K1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Km(r,0,o.time);function r(d){o.state=Wm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==Wm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Wa)return Ym(l);f.state===Jm?(f.state=Ja,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ja,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Ym(function(){o.state===Wa&&(o.state=Jm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ls,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ls){for(o.state=Wa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=ss,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===ss&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ja,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Za(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>ls&&i.state<ss,i.state=Ja,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function G1(e){return this.each(function(){Za(this,e)})}function Y1(e,n){var o,i;return function(){var a=un(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 q1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=un(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 W1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Zt(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?Y1:q1)(o,e,n))}function ds(e,n,o){var i=e._id;return e.each(function(){var a=un(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Zt(a,i).value[n]}}function Xm(e,n){var o;return(typeof n=="number"?dn:n instanceof mo?Ua:(o=mo(n))?(n=o,Ua):Lm)(e,n)}function J1(e){return function(){this.removeAttribute(e)}}function X1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Z1(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 Q1(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 e0(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 t0(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 n0(e,n){var o=Ba(e),i=o==="transform"?B1:Xm;return this.attrTween(e,typeof n=="function"?(o.local?t0:e0)(o,i,ds(this,"attr."+e,n)):n==null?(o.local?X1:J1)(o):(o.local?Q1:Z1)(o,i,n))}function o0(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function i0(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function a0(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&i0(e,r)),o}return a._value=n,a}function r0(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&o0(e,r)),o}return a._value=n,a}function l0(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=Ba(e);return this.tween(o,(i.local?a0:r0)(i,n))}function s0(e,n){return function(){cs(this,e).delay=+n.apply(this,arguments)}}function c0(e,n){return n=+n,function(){cs(this,e).delay=n}}function d0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?s0:c0)(n,e)):Zt(this.node(),n).delay}function u0(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function m0(e,n){return n=+n,function(){un(this,e).duration=n}}function f0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?u0:m0)(n,e)):Zt(this.node(),n).duration}function p0(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function h0(e){var n=this._id;return arguments.length?this.each(p0(n,e)):Zt(this.node(),n).ease}function y0(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function g0(e){if(typeof e!="function")throw new Error;return this.each(y0(this._id,e))}function b0(e){typeof e!="function"&&(e=hm(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 In(i,this._parents,this._name,this._id)}function _0(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],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new In(l,this._parents,this._name,this._id)}function k0(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 E0(e,n,o){var i,a,r=k0(n)?cs:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function N0(e,n){var o=this._id;return arguments.length<2?Zt(this.node(),o).on.on(e):this.each(E0(o,e,n))}function w0(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function I0(){return this.on("end.remove",w0(this._id))}function v0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ql(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Xa(d[p],n,o,p,d,Zt(u,o)));return new In(r,this._parents,n,o)}function C0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=pm(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 p=e.call(u,u.__data__,m,c),f,h=Zt(u,o),g=0,b=p.length;g<b;++g)(f=p[g])&&Xa(f,n,o,g,p,h);r.push(p),l.push(u)}return new In(r,l,n,o)}var S0=wi.prototype.constructor;function x0(){return new S0(this._groups,this._parents)}function R0(e,n){var o,i,a;return function(){var r=Ko(this,e),l=(this.style.removeProperty(e),Ko(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Zm(e){return function(){this.style.removeProperty(e)}}function A0(e,n,o){var i,a=o+"",r;return function(){var l=Ko(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function $0(e,n,o){var i,a,r;return function(){var l=Ko(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Ko(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function T0(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=un(this,e),d=c.on,u=c.value[r]==null?s||(s=Zm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function M0(e,n,o){var i=(e+="")=="transform"?V1:Xm;return n==null?this.styleTween(e,R0(e,i)).on("end.style."+e,Zm(e)):typeof n=="function"?this.styleTween(e,$0(e,i,ds(this,"style."+e,n))).each(T0(this._id,e)):this.styleTween(e,A0(e,i,n),o).on("end.style."+e,null)}function V0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function B0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&V0(e,l,o)),i}return r._value=n,r}function D0(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,B0(e,n,o??""))}function O0(e){return function(){this.textContent=e}}function L0(e){return function(){var n=e(this);this.textContent=n??""}}function P0(e){return this.tween("text",typeof e=="function"?L0(ds(this,"text",e)):O0(e==null?"":e+""))}function z0(e){return function(n){this.textContent=e.call(this,n)}}function F0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&z0(a)),n}return i._value=e,i}function U0(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,F0(e))}function H0(){for(var e=this._name,n=this._id,o=Qm(),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=Zt(c,n);Xa(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new In(i,this._parents,e,o)}function j0(){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=un(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var K0=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Qm(){return++K0}var vn=wi.prototype;In.prototype={constructor:In,select:v0,selectAll:C0,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:b0,merge:_0,selection:x0,transition:H0,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:N0,attr:n0,attrTween:l0,style:M0,styleTween:D0,text:P0,textTween:U0,remove:I0,tween:W1,delay:d0,duration:f0,ease:h0,easeVarying:g0,end:j0,[Symbol.iterator]:vn[Symbol.iterator]};function G0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Y0={time:null,delay:0,duration:250,ease:G0};function q0(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 W0(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=Qm(),(o=Y0).time=as(),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])&&Xa(c,e,n,d,l,o||q0(c,n));return new In(i,this._parents,e,n)}wi.prototype.interrupt=G1,wi.prototype.transition=W0;const Qa=e=>()=>e;function J0(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 Cn(e,n,o){this.k=e,this.x=n,this.y=o}Cn.prototype={constructor:Cn,scale:function(e){return e===1?this:new Cn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cn(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 Wo=new Cn(1,0,0);Cn.prototype;function us(e){e.stopImmediatePropagation()}function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function X0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Z0(){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||Wo}function Q0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function eN(){return navigator.maxTouchPoints||"ontouchstart"in this}function tN(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 nN(){var e=X0,n=Z0,o=tN,i=Q0,a=eN,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ja,d=Ma("start","zoom","end"),u,m,p,f=500,h=150,g=0,b=10;function _(w){w.property("__zoom",ef).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,I,v,B){var M=w.selection?w.selection():w;M.property("__zoom",ef),w!==M?E(w,I,v,B):M.interrupt().each(function(){S(this,arguments).event(B).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},_.scaleBy=function(w,I,v,B){_.scaleTo(w,function(){var M=this.__zoom.k,x=typeof I=="function"?I.apply(this,arguments):I;return M*x},v,B)},_.scaleTo=function(w,I,v,B){_.transform(w,function(){var M=n.apply(this,arguments),x=this.__zoom,P=v==null?y(M):typeof v=="function"?v.apply(this,arguments):v,Y=x.invert(P),se=typeof I=="function"?I.apply(this,arguments):I;return o(N(k(x,se),P,Y),M,l)},v,B)},_.translateBy=function(w,I,v,B){_.transform(w,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,B)},_.translateTo=function(w,I,v,B,M){_.transform(w,function(){var x=n.apply(this,arguments),P=this.__zoom,Y=B==null?y(x):typeof B=="function"?B.apply(this,arguments):B;return o(Wo.translate(Y[0],Y[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),x,l)},B,M)};function k(w,I){return I=Math.max(r[0],Math.min(r[1],I)),I===w.k?w:new Cn(I,w.x,w.y)}function N(w,I,v){var B=I[0]-v[0]*w.k,M=I[1]-v[1]*w.k;return B===w.x&&M===w.y?w:new Cn(w.k,B,M)}function y(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,I,v,B){w.on("start.zoom",function(){S(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(B).end()}).tween("zoom",function(){var M=this,x=arguments,P=S(M,x).event(B),Y=n.apply(M,x),se=v==null?y(Y):typeof v=="function"?v.apply(M,x):v,he=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=M.__zoom,fe=typeof I=="function"?I.apply(M,x):I,pe=c(ie.invert(se).concat(he/ie.k),fe.invert(se).concat(he/fe.k));return function(ge){if(ge===1)ge=fe;else{var Te=pe(ge),He=he/Te[2];ge=new Cn(He,se[0]-Te[0]*He,se[1]-Te[1]*He)}P.zoom(null,ge)}})}function S(w,I,v){return!v&&w.__zooming||new A(w,I)}function A(w,I){this.that=w,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,I),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,I){return this.mouse&&w!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var I=Jt(this.that).datum();d.call(w,this.that,new J0(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),I)}};function V(w,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(w),B=this.__zoom,M=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),x=sn(w);if(v.wheel)(v.mouse[0][0]!==x[0]||v.mouse[0][1]!==x[1])&&(v.mouse[1]=B.invert(v.mouse[0]=x)),clearTimeout(v.wheel);else{if(B.k===M)return;v.mouse=[x,B.invert(x)],Za(this),v.start()}Mi(w),v.wheel=setTimeout(P,h),v.zoom("mouse",o(N(k(B,M),v.mouse[0],v.mouse[1]),v.extent,l));function P(){v.wheel=null,v.end()}}function T(w,...I){if(p||!e.apply(this,arguments))return;var v=w.currentTarget,B=S(this,I,!0).event(w),M=Jt(w.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),x=sn(w,v),P=w.clientX,Y=w.clientY;vm(w.view),us(w),B.mouse=[x,this.__zoom.invert(x)],Za(this),B.start();function se(ie){if(Mi(ie),!B.moved){var fe=ie.clientX-P,pe=ie.clientY-Y;B.moved=fe*fe+pe*pe>g}B.event(ie).zoom("mouse",o(N(B.that.__zoom,B.mouse[0]=sn(ie,v),B.mouse[1]),B.extent,l))}function he(ie){M.on("mousemove.zoom mouseup.zoom",null),Cm(ie.view,B.moved),Mi(ie),B.event(ie).end()}}function D(w,...I){if(e.apply(this,arguments)){var v=this.__zoom,B=sn(w.changedTouches?w.changedTouches[0]:w,this),M=v.invert(B),x=v.k*(w.shiftKey?.5:2),P=o(N(k(v,x),B,M),n.apply(this,I),l);Mi(w),s>0?Jt(this).transition().duration(s).call(E,P,B,w):Jt(this).call(_.transform,P,B,w)}}function C(w,...I){if(e.apply(this,arguments)){var v=w.touches,B=v.length,M=S(this,I,w.changedTouches.length===B).event(w),x,P,Y,se;for(us(w),P=0;P<B;++P)Y=v[P],se=sn(Y,this),se=[se,this.__zoom.invert(se),Y.identifier],M.touch0?!M.touch1&&M.touch0[2]!==se[2]&&(M.touch1=se,M.taps=0):(M.touch0=se,x=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),x&&(M.taps<2&&(m=se[0],u=setTimeout(function(){u=null},f)),Za(this),M.start())}}function R(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P,Y,se;for(Mi(w),x=0;x<M;++x)P=B[x],Y=sn(P,this),v.touch0&&v.touch0[2]===P.identifier?v.touch0[0]=Y:v.touch1&&v.touch1[2]===P.identifier&&(v.touch1[0]=Y);if(P=v.that.__zoom,v.touch1){var he=v.touch0[0],ie=v.touch0[1],fe=v.touch1[0],pe=v.touch1[1],ge=(ge=fe[0]-he[0])*ge+(ge=fe[1]-he[1])*ge,Te=(Te=pe[0]-ie[0])*Te+(Te=pe[1]-ie[1])*Te;P=k(P,Math.sqrt(ge/Te)),Y=[(he[0]+fe[0])/2,(he[1]+fe[1])/2],se=[(ie[0]+pe[0])/2,(ie[1]+pe[1])/2]}else if(v.touch0)Y=v.touch0[0],se=v.touch0[1];else return;v.zoom("touch",o(N(P,Y,se),v.extent,l))}}function $(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P;for(us(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),x=0;x<M;++x)P=B[x],v.touch0&&v.touch0[2]===P.identifier?delete v.touch0:v.touch1&&v.touch1[2]===P.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(P=sn(P,this),Math.hypot(m[0]-P[0],m[1]-P[1])<b)){var Y=Jt(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Qa(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Qa(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Qa(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Qa([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,_):Math.sqrt(g)},_.tapDistance=function(w){return arguments.length?(b=+w,_):b},_}var Oe=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Oe||{}),ms=(e=>(e.Partial="partial",e.Full="full",e))(ms||{}),yo=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(yo||{}),Sn=(e=>(e.Strict="strict",e.Loose="loose",e))(Sn||{}),fs=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(fs||{}),Vi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Vi||{}),tf=(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))(tf||{});const oN=["INPUT","SELECT","TEXTAREA"],iN=typeof document<"u"?document:null;function ps(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 oN.includes(i==null?void 0:i.nodeName)||a||!!r}function aN(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function nf(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const ao="com.example",Jg="command.domain";function kn(e,n,o={}){const i=To(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??Jg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Xg="CustomMoneyType",Zg="Money";function Qg(e){return!(e.type!==Xg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function eb(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:Zg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function tb(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Qg(l)?(a=!0,n=!0,eb(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function nb(e,n){const o=new Map,i=[],a=new Map;for(const h of e.entities){const g=new Map,b=new Map,_=new Map,E=(N,y,k)=>{if(!N)return;o.get(N)||o.set(N,[{entityId:y,assignedId:N}]),i.push({id:N,entityId:y,sink:k}),k(N)};for(const N of h.attributes){E(N.modelId,h.modelId,y=>g.set(N,y));for(const y of N.dbAttrs)E(y.modelId,h.modelId,k=>b.set(y,k))}for(const N of h.indexes??[])E(N.modelId,h.modelId,y=>_.set(N,y));a.set(h,{attrs:g,cols:b,idx:_})}const r=new Set(o.keys()),l=new Map;for(const h of i){const g=(l.get(h.id)??0)+1;if(l.set(h.id,g),g===1)continue;const b=ob(h.id,g-1,r);r.add(b),o.get(h.id).push({entityId:h.entityId,assignedId:b}),h.sink(b)}const s=[...o.values()].reduce((h,g)=>h+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(h,g)=>{var _;if(!g||!h)return g;const b=o.get(g);return!b||b.length<2?g:((_=b.find(E=>E.entityId===h))==null?void 0:_.assignedId)??g},d=new Map(e.associations.map(h=>[h.modelId,h])),u=(h,g)=>{const b=d.get(h);if(b)return b.end1.entityRef===g?b.end2.entityRef:b.end1.entityRef},m=e.entities.map(h=>{var N;const g=a.get(h),b=h.attributes.map(y=>{const k=g.attrs.get(y),S=y.dbAttrs.map(T=>{const D=g.cols.get(T);return D===T.modelId?T:{...T,modelId:D}});let A=y.derivedFrom;if(A){const T=u(A.associationRef,h.modelId),D=c(T,A.sourceAttributeRef);D!==A.sourceAttributeRef&&(A={...A,sourceAttributeRef:D})}return k!==y.modelId||A!==y.derivedFrom||S.some((T,D)=>T!==y.dbAttrs[D])?{...y,modelId:k,dbAttrs:S,derivedFrom:A}:y}),_=(N=h.indexes)==null?void 0:N.map(y=>{const k=g.idx.get(y),S=y.columns.map(V=>{const T=c(h.modelId,V.columnRef);return T===V.columnRef?V:{...V,columnRef:T}});return k!==y.modelId||S.some((V,T)=>V!==y.columns[T])?{...y,modelId:k,columns:S}:y});return b.some((y,k)=>y!==h.attributes[k])||_&&h.indexes&&_.some((y,k)=>y!==h.indexes[k])?{...h,attributes:b,..._?{indexes:_}:{}}:h}),p=e.associations.map(h=>{const g=c(h.end1.entityRef,h.end1.attributeRef),b=c(h.end2.entityRef,h.end2.attributeRef);return g===h.end1.attributeRef&&b===h.end2.attributeRef?h:{...h,end1:g===h.end1.attributeRef?h.end1:{...h.end1,attributeRef:g},end2:b===h.end2.attributeRef?h.end2:{...h.end2,attributeRef:b}}}),f=n.associationLayouts.map(h=>{const g=d.get(h.associationRef);if(!g)return h;const b=c(g.end1.entityRef,h.sourceColumnRef),_=c(g.end2.entityRef,h.targetColumnRef);return b===h.sourceColumnRef&&_===h.targetColumnRef?h:{...h,sourceColumnRef:b,targetColumnRef:_}});return{logical:{...e,entities:m,associations:p},layout:f.some((h,g)=>h!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function ob(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}const ib="5.2.6";function jt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function wl(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function Nd(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function wd(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(Nd);if(!i.length)continue;const a=o.filter(s=>!Nd(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 zo(e){return JSON.parse(JSON.stringify(e))}function Id(e,n,o){var V;const i=o.idFactory??Pe,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const D of r.associations){const C=T.has(D.end1.entityRef),R=T.has(D.end2.entityRef);C!==R&&s.add(C?D.end2.entityRef:D.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),p=new Map,f=T=>{let D=p.get(T);return D||(D=i(),p.set(T,D)),D};for(const T of c){f(T.modelId);for(const D of T.attributes){f(D.modelId);for(const C of D.dbAttrs)f(C.modelId)}for(const D of T.indexes??[])f(D.modelId);for(const D of T.operations??[])f(D.modelId)}for(const T of u)f(T.modelId);const h=T=>p.get(T),g=c.map(T=>{const D=zo(T);D.modelId=h(T.modelId),D.attributes=D.attributes.map(C=>ab(C,h,m,d));for(const C of D.indexes??[])C.modelId=h(C.modelId),C.columns=C.columns.map(R=>Xn(R.columnRef)?R:{...R,columnRef:h(R.columnRef)}).filter(R=>R.columnRef!==void 0);for(const C of D.operations??[])C.modelId=h(C.modelId);return D});wd(g);const b=u.map(T=>{const D=zo(T);return D.modelId=h(T.modelId),D.end1=vd(D.end1,h),D.end2=vd(D.end2,h),D}),_=[];for(const T of r.groups){const D=T.memberEntityRefs.filter(R=>d.has(R));if(D.length===0)continue;const C=zo(T);C.modelId=f(T.modelId),C.memberEntityRefs=D.map(R=>h(R)),_.push(C)}const E=o.collisionSuffix??"_imported",N=new Set(o.existing.entities.map(T=>T.name)),y=new Set(o.existing.entities.map(T=>{var D;return(D=T.table)==null?void 0:D.physicalName}).filter(T=>!!T));for(const T of g)N.has(T.name)&&(T.name=`${T.name}${E}`),(V=T.table)!=null&&V.physicalName&&y.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${E}`);const k=[];for(const T of l.entityLayouts){const D=h(T.entityRef);if(!D)continue;const C=zo(T);C.entityRef=D,C.geo={...C.geo,location:Il(C.geo.location,a)},C.attributeStyles&&(C.attributeStyles=Na(C.attributeStyles,h)),C.operationStyles&&(C.operationStyles=Na(C.operationStyles,h)),k.push(C)}const S=[];for(const T of l.associationLayouts){const D=h(T.associationRef);if(!D)continue;const C=zo(T);C.associationRef=D,C.sourceColumnRef=T.sourceColumnRef?h(T.sourceColumnRef):void 0,C.targetColumnRef=T.targetColumnRef?h(T.targetColumnRef):void 0,C.waypoints=C.waypoints.map(R=>Il(R,a)),S.push(C)}const A=[];for(const T of l.groupLayouts){const D=h(T.groupRef);if(!D)continue;const C=zo(T);C.groupRef=D,C.geo={...C.geo,location:Il(C.geo.location,a)},delete C.memberNoteRefs,A.push(C)}return{logical:{entities:g,associations:b,groups:_},layout:{entityLayouts:k,associationLayouts:S,groupLayouts:A},idMap:p}}function Il(e,n){return{x:e.x+n.x,y:e.y+n.y}}function ab(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 vd(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function Na(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function vl(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function ro(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)=>ro(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(!ro(e[i],n[i]))return!1;return!0}return!1}function lo(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||ro(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function so(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,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 rb(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 lb=new Set(["attributes","operations","indexes","rev"]),sb=new Set(["end1","end2","rev"]),cb=new Set(["memberEntityRefs","rev"]),Cd=new Set(["modelId"]),db=new Set(["modelId","columns"]),ub=new Set([]);function mb(e,n,o,i){const a=so(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=lo(s,c,Cd);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=so(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=lo(s,c,Cd);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=so(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(!ro(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=lo(s,c,db);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function fb(e,n,o){const i=so(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:vl(l)});for(const{cur:l,tgt:s}of i.common){const c=lo(l,s,lb);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),mb(l.modelId,l,s,o)}const a=so(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:vl(l)});for(const{cur:l,tgt:s}of a.common){const c=lo(l,s,sb);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=lo(l[d]??{},s[d]??{},ub);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=so(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:vl(l)});for(const{cur:l,tgt:s}of r.common){const c=lo(l,s,cb);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=rb(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 wa(e,n,o,i,a,r,l){const s=so(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)ro(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 pb(e,n,o){wa(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),wa(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),wa(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),wa(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function hb(e,n){const o=[];return fb(e.logical,n.logical,o),pb(e.layout,n.layout,o),o}function yb(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 gb={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 bb{constructor(n){ct(this,"out",[]);ct(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({...bi(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({...bi(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({...bi(n),field:a,value:void 0,removed:!0});continue}this.out.push({...bi(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({...bi(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function bi(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 rn(e,n,o,i){if(o==null||typeof o!="object")return;const a=gb[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function co(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Cl(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Ln(e,n){var r,l,s,c,d,u,m,p;const o=yb(n),i=new bb(n.field),a=[...e].sort((f,h)=>f.seq-h.seq);for(const f of a)for(const h of f.ops)switch(o){case"entity":if(h.entityRef!==n.entityRef)break;h.kind==="entity.add"?rn(i,f,h.value,"entity"):h.kind==="entity.update"?co(i,f,h.patch):h.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((r=h.value)==null?void 0:r.attributes,n.attributeRef);g&&rn(i,f,g,"attribute")}else h.kind==="attribute.add"&&((l=h.value)==null?void 0:l.modelId)===n.attributeRef?rn(i,f,h.value,"attribute"):h.kind==="attribute.update"&&h.attributeRef===n.attributeRef?co(i,f,h.patch):(h.kind==="attribute.remove"&&h.attributeRef===n.attributeRef||h.kind==="entity.remove")&&i.remove(f);break;case"operation":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((s=h.value)==null?void 0:s.operations,n.operationRef);g&&rn(i,f,g,"operation")}else h.kind==="operation.add"&&((c=h.value)==null?void 0:c.modelId)===n.operationRef?rn(i,f,h.value,"operation"):h.kind==="operation.update"&&h.operationRef===n.operationRef?co(i,f,h.patch):(h.kind==="operation.remove"&&h.operationRef===n.operationRef||h.kind==="entity.remove")&&i.remove(f);break;case"index":if(h.entityRef!==n.entityRef)break;if(h.kind==="entity.add"){const g=Cl((d=h.value)==null?void 0:d.indexes,n.indexRef);g&&rn(i,f,g,"index")}else h.kind==="index.add"&&((u=h.value)==null?void 0:u.modelId)===n.indexRef?rn(i,f,h.value,"index"):h.kind==="index.update"&&h.indexRef===n.indexRef?co(i,f,h.patch):(h.kind==="index.remove"&&h.indexRef===n.indexRef||h.kind==="entity.remove")&&i.remove(f);break;case"association":if(h.associationRef!==n.associationRef)break;h.kind==="association.add"?rn(i,f,h.value,"association"):h.kind==="association.update"?co(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(h.associationRef!==n.associationRef)break;if(h.kind==="association.add"){const g=(m=h.value)==null?void 0:m[n.end];rn(i,f,g,"associationEnd")}else h.kind==="associationEnd.update"&&h.end===n.end?co(i,f,h.patch):h.kind==="association.remove"&&i.remove(f);break;case"group":if(h.groupRef!==n.groupRef)break;if(h.kind==="group.add"){rn(i,f,h.value,"group");const g=(p=h.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(g))for(const b of g)i.member(f,b,!1)}else h.kind==="group.update"?co(i,f,h.patch):h.kind==="group.remove"?i.remove(f):h.kind==="group.addMember"&&h.entityRef!=null?i.member(f,h.entityRef,!1):h.kind==="group.removeMember"&&h.entityRef!=null&&i.member(f,h.entityRef,!0);break}return i.result()}const lt={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},_b={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":lt,"entityLayout.remove":lt,"entityLayout.move":lt,"entityLayout.resize":lt,"entityLayout.setCollapsed":lt,"entityLayout.setLocked":lt,"entityLayout.setStyle":lt,"entityLayout.setAttrStyle":lt,"entityLayout.setOpStyle":lt,"groupLayout.add":lt,"groupLayout.remove":lt,"groupLayout.move":lt,"groupLayout.resize":lt,"groupLayout.setLocked":lt,"groupLayout.setStyle":lt,"groupLayout.addNoteMember":lt,"groupLayout.removeNoteMember":lt,"associationLayout.add":lt,"associationLayout.remove":lt,"associationLayout.setWaypoints":lt,"note.add":lt,"note.remove":lt,"note.move":lt,"note.resize":lt,"note.setMemo":lt,"note.setStyle":lt,"noteConnection.add":lt,"noteConnection.remove":lt,"noteConnection.setWaypoints":lt},Kt=e=>typeof e=="string"?e:void 0,kb=e=>{var n;return Kt((n=e.value)==null?void 0:n.modelId)};function Sd(e){return Kt(e.containerRef)??Kt(e.entityRef)}function Sl(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=Kt(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function xl(e){const n=_b[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Kt(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Sl(o,"attributes","attribute",a),...Sl(o,"operations","operation",a),...Sl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Sd(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?kb(o):Kt(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Kt(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=Kt(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Eb(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Kt(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Sd(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Kt(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Kt(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function Nb(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function wb(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of xl(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function Ia(e,n){return e.map(o=>({...o,subject:n}))}function xd(e,n){const o=e.filter(s=>s.ops.some(c=>Nb(c,n))),{attributes:i,operations:a,indexes:r}=wb(o,n),l=[...Ia(Ln(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...Ia(Ln(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...Ia(Ln(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...Ia(Ln(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 Rl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ib(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of xl(i))a.existence==="add"&&n.add(Rl(a.subject));return n}function vb(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=Eb(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Cb(e){const{entities:n,associations:o,groups:i}=vb(e),a=[];for(const r of n)for(const l of xd(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Ln(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Ln(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Ln(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function Al(e){const n=Cb(e),o=Ib(e),i=new Map;for(const l of n){const s=Rl(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=Rl(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)}function Rd(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Sb(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of xl(r)){if(!l.existence||l.inline)continue;const s=l.subject;xb.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const xb=new Set(["attribute","operation","index"]);function $l(e,n){const{fromSeq:o}=n,i=Al(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const p=Rd(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Sb(e,o,r)){const p=s.get(Rd(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,h)=>f.seq-h.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const h=new Map;let g=null;for(const _ of m.evs){_.verb==="add"&&g!==null&&g!=="add"&&h.clear(),g=_.verb;for(const E of _.fields){const N=h.get(E.field);N?N.lastValue=E.value:h.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const _=[];for(const[E,N]of h)_.push({field:E,value:N.lastValue});d.push({subject:m.subject,verb:"added",fields:_});continue}const b=[];for(const[_,E]of h)E.hasOld&&ro(E.firstOld,E.lastValue)||b.push({field:_,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});b.length!==0&&d.push({subject:m.subject,verb:"modified",fields:b})}return{fromSeq:o,toSeq:r,entries:d}}function Ad(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 Tl{constructor(n){ct(this,"undoStack",[]);ct(this,"redoStack",[]);ct(this,"savePoint",null);ct(this,"listeners",new Set);ct(this,"commandListeners",new Set);ct(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.sealCoalesce(),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 Dt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function $d(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function Nt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Gt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function ut(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function En(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 va(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=$d(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=Nt(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 Td(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=$d(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=Nt(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})}),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((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(p=>p.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(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 Ml(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=ut(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(ut(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Dt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Dt(o)}]}}}}function Md(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=ut(i,e);o=a.name,a.name=n},invert(i){ut(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 Fo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=Nt(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=Nt(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 Vd(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=Nt(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=Nt(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 _i(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 Bd(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=Nt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=_i(r.style,n)},invert(i){const a=Nt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=Nt(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 Dd(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=Nt(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=Nt(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 Od(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=Nt(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=Nt(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 Vl(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 Ca(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=Nt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=_i(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=Nt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=Nt(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 Sa(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 Ld(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:Dt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Dt(o)}]}}}}function Pd(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 zd(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 xa(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 Fd(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 Ud(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 Hd(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=_i(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 jd(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 Yt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){ut(o,e).attributes.push(n)},invert(o){const i=ut(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 qt(e,n,o){const i={},a=r=>{const l=ut(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:Dt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Dt(i)}]}}}}function Kd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=ut(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&&ut(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 Gd(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 u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Bl(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=ut(a,e);i=r.attributes.map(s=>({...s}));const l=wl([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&ut(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=ut(a,e).attributes;return Gd("attribute.update","attributeRef",e,r,i??[])}}}function Yd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=ut(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=ut(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 qd(e,n,o){const i={},a=r=>{var s;const l=(s=ut(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:Dt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Dt(i)}]}}}}function Wd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=ut(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=ut(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 Jd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=ut(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=wl([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=ut(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=ut(a,e).operations??[];return Gd("operation.update","operationRef",e,r,i??[])}}}function Xd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=Nt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=_i(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=Nt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=Nt(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 Ra(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 Zd(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 Aa(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:Dt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Dt(o)}]}}}}function Wt(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:Dt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Dt(i)}]}}}}function Qd(e,n){return{label:"인덱스 추가",apply(o){const i=ut(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=ut(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 $a(e,n,o){const i={},a=r=>{var s;const l=(s=ut(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:Dt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Dt(i)}]}}}}function eu(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=ut(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&&ut(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 ln=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ki=(e,n)=>{var o;return((o=Gt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function tu(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Gt(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=Gt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ki(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[ln(e,r)],invert:[ln(e,l)]}}}}function nu(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Gt(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=Gt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ki(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[ln(e,a)],invert:[ln(e,r)]}}}}function ou(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Gt(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=Gt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[ln(e,ki(a,e))],invert:[ln(e,i??[])]}}}}function iu(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Gt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Gt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[ln(e,ki(o,e))],invert:[ln(e,n??[])]}}}}function au(e,n,o){return{label:"waypoint 추가",apply(i){const a=Gt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Gt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ki(i,e),r=a.slice();return r.splice(n,1),{forward:[ln(e,a)],invert:[ln(e,r)]}}}}function ru(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 lu(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 Ei(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 su(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 cu(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 du(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=_i(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 uu(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 mu(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 Pn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Ta=(e,n,o)=>{var i;return((i=En(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function fu(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 pu(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 hu(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=En(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=En(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ta(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Pn(e,n,l)],invert:[Pn(e,n,s)]}}}}function yu(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=En(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=En(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ta(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Pn(e,n,r)],invert:[Pn(e,n,l)]}}}}function gu(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=En(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=En(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ta(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Pn(e,n,r)],invert:[Pn(e,n,l)]}}}}function bu(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=En(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=En(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Pn(e,n,Ta(i,e,n))],invert:[Pn(e,n,o??[])]}}}}function rt(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 Rb=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ra,addAttribute:Yt,addEntity:va,addEntityToGroup:zd,addGroup:Sa,addIndex:Qd,addNote:ru,addNoteConnection:fu,addNoteConnectionWaypoint:yu,addNoteToGroup:uu,addOperation:Yd,addWaypoint:au,clearNoteConnectionWaypoints:bu,clearWaypoints:iu,composite:rt,moveEntity:Fo,moveGroup:Fd,moveNote:Ei,moveNoteConnectionWaypoint:hu,moveWaypoint:tu,removeAssociation:Zd,removeAttribute:Kd,removeEntity:Td,removeEntityFromGroup:xa,removeGroup:Pd,removeIndex:eu,removeNote:lu,removeNoteConnection:pu,removeNoteConnectionWaypoint:gu,removeNoteFromGroup:mu,removeOperation:Wd,removeWaypoint:nu,renameEntity:Md,reorderAttributes:Bl,reorderOperations:Jd,resizeEntity:Vd,resizeGroup:Ud,resizeNote:su,setAllEntitiesCollapsed:Vl,setAttributeSwatch:Ca,setEntityCollapsed:Dd,setEntityLocked:Od,setEntitySwatch:Bd,setGroupLocked:jd,setGroupSwatch:Hd,setNoteMemo:cu,setNoteSwatch:du,setOperationSwatch:Xd,translateWaypoints:ou,updateAssociation:Aa,updateAssociationEnd:Wt,updateAttribute:qt,updateEntity:Ml,updateGroup:Ld,updateIndex:$a,updateOperation:qd},Symbol.toStringTag,{value:"Module"}));class _u{constructor(){ct(this,"revs",new Map);ct(this,"layoutVersion",0);ct(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}}}const Ab=[400,1200];function $b(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Tb(e){const n=$b(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Mb=e=>new Promise(n=>setTimeout(n,e));class ku{constructor(n){ct(this,"cache",new _u);ct(this,"newClientOpId");ct(this,"debounceMs");ct(this,"retryDelaysMs");ct(this,"emissions",new WeakMap);ct(this,"open",null);ct(this,"debounceHandle",null);ct(this,"queue",[]);ct(this,"sending",!1);ct(this,"_frozen",!1);ct(this,"stack",null);ct(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Pe,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??Ab}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();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,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}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(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}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;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Tb(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Mb(c)}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 Eu=["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","group.update","group.remove","group.addMember","group.removeMember"],Nu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function wu(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Vb(e){return gn(e).length}function Dl(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function Bb(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=ci(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Iu(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Vb(i);if(a===0)return[];const r=Dl(e,n),l=gn(i).map(c=>c.col),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;Bb(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function vu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const h=r.get(f);if(!h)return[];l.push(h)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,h)=>f===c[h]))return[];const d=new Map(s.map((f,h)=>[f,h])),u=Dl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=c.map(_=>h.dbAttrs[d.get(_)]),b=g.reduce((_,E,N)=>E===h.dbAttrs[N]?_:_+1,0);b&&m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,moved:b})}return m}function Cu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=gn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(gn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,h)=>{c.has(f)&&d.add(h)}),d.size===s.length)return[];const u=Dl(e,n),m=[];for(const f of e.entities)for(const h of f.attributes){if(h.attrType!=="EMBED_OWN"||((p=h.embedded)==null?void 0:p.embeddableRef)!==n||u.has(h.embedded.associationRef)||h.dbAttrs.length!==s.length)continue;const g=h.dbAttrs.filter((E,N)=>d.has(N)),b=h.dbAttrs.filter((E,N)=>!d.has(N));h.dbAttrs.some((E,N)=>{if(d.has(N))return!1;const y=l[N],k=!!E.physicalName&&E.physicalName!==((y==null?void 0:y.physicalName)??""),S=E.sharedColumnRef!=null&&E.sharedColumnRef!==(y==null?void 0:y.sharedColumnRef);return k||S})||m.push({entityId:f.modelId,attributeId:h.modelId,dbAttrs:g,dropped:b})}return m}function Db(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==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ob(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==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Su(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function St(e,n){const o=Db(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>zb(i,e))}}function Lb(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ol(e,n){const o=Lb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function Ll(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Pb=new Set(["name","description","packageName","excludeDDLGeneration"]);function zb(e,n){var a;const o=To(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function xu(e,n){const o=Ob(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 Fb(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==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Ub(e,n){const o=Fb(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 Ru(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 Pl(e){return e.by!==void 0&&e.by!=="name"}function Hb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function jb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Kb(e,n){const o=Hb(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 Au(e,n){const o=jb(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 $u(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Tu(e){return $u(e)&&e.dataType==null}function Mu(e,n,o){const i=$u(e);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 Vu(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const h=u.get(f.name);if(h!=null&&h.sharedColumnPhysicalName){const g={ref:h.sharedColumnPhysicalName,by:"physicalName"},b=Ru(Dn(i,a),g);if(!b.ok){s.push(b.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:b.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});continue}m.push({modelId:c(),physicalName:(h==null?void 0:h.physicalName)??"",dataType:"",...h!=null&&h.length?{length:h.length}:{},...h!=null&&h.scale?{scale:h.scale}:{},...(h==null?void 0:h.insertable)!=null?{insertable:h.insertable}:{},...(h==null?void 0:h.updatable)!=null?{updatable:h.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:m}}const Gb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),Uo=e=>new Set(Object.keys(e)),Yb=Uo({name:!0,stereotype:!0,physicalName:!0,useVersion:!0,attributes:!0,indexes:!0,operations:!0,serialization:!0}),Bu=Uo({name:!0,type:!0,identifier:!0,notNull:!0,transient:!0,physicalName:!0,dataType:!0,length:!0,scale:!0,groupCode:!0,defaultValue:!0,attributeGroup:!0,description:!0,columnLogicalName:!0,unique:!0,updatable:!0,embeddableOverrides:!0}),Du=Uo({name:!0,unique:!0,columns:!0,description:!0,parameters:!0}),Ou=Uo({name:!0,visibility:!0,sourceCode:!0,description:!0,personalInfoAttributeType:!0}),qb=Uo({from:!0,to:!0,fromMultiplicity:!0,toMultiplicity:!0,identifying:!0,composition:!0}),Wb=Uo({name:!0,packageName:!0,description:!0,excludeDDLGeneration:!0,members:!0});function Nn(e,n){return uo(e,n)}const Jb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly","serialization"]),Xb=new Set(["description","identifying"]),Zb=new Set(["multiplicity","navigable","composition"]),Qb=new Set(["name","unique","description","parameters"]),e_=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function uo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const zl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),t_=new Set([...zl].filter(e=>e!=="sharedColumnRef"));function n_(e,n,o,i){if(i||o.some(l=>!t_.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))zl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function o_(e,n,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,p)=>{const f=n.fields[p],h=f?c.get(f.name):void 0;if(!h){d.push(m);return}if(h.sharedColumnPhysicalName){const b={ref:h.sharedColumnPhysicalName,by:"physicalName"},_=Ru(Dn(i,a),b);if(!_.ok){s.push(_.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:_.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:_.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...h.physicalName!=null?{physicalName:h.physicalName}:{},...h.length!=null?{length:h.length}:{},...h.scale!=null?{scale:h.scale}:{},...h.insertable!=null?{insertable:h.insertable}:{},...h.updatable!=null?{updatable:h.updatable}:{}})}),u?null:d}function Lu(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 Pu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Ub(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 Ho(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function i_(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of wu(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function a_(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:h}of m){if(a.has(f))continue;const g=p.get(f)??[];g.push(h),p.set(f,g)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of Cu(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(h=>h.modelId===m?{...h,attributes:[...h.attributes,...p]}:h)};for(const h of Iu(f,m,r))u(h)}}function zu(e,n){const o={...e},i=[];for(const[a,r]of Object.entries(n)){if(!a.includes(".")){o[a]=r===null?void 0:r;continue}const l=/^dbAttrs\.(\d+)\.(.+)$/.exec(a);l&&i.push([Number(l[1]),l[2],r])}if(i.length){const a=(o.dbAttrs??[]).map(r=>({...r}));for(const[r,l,s]of i)a[r]&&(a[r][l]=s===null?void 0:s);o.dbAttrs=a}return o}function Fu(e,n,o,i,a,r,l){var p;for(const f of i.remove)Ho(e,r,o,f);for(const f of i.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:f.attributeId,patch:f.patch}),a.attrPatches.push({entityId:o,attributeId:f.attributeId,patch:f.patch});const s=((p=n.entities.find(f=>f.modelId===o))==null?void 0:p.attributes)??[],c=[];for(const f of i.add){const h={...f,order:l(o,s)};e.push({kind:"attribute.add",casUnit:"logical",containerRef:o,entityRef:o,value:h}),a.cascadeAdds.push({entityId:o,attribute:h}),c.push(h)}const d=new Set(i.remove),u=[...s.filter(f=>!d.has(f.modelId)),...c],m=new Set(u.map(f=>f.modelId));for(const f of n.associations){if(f.end2.entityRef!==o)continue;const h=f.end2.attributeRef;if(h&&m.has(h))continue;const b=u.filter(_=>{var E;return((E=_.derivedFrom)==null?void 0:E.associationRef)===f.modelId&&_.dbAttrs.length>0}).sort((_,E)=>_.order-E.order)[0];b&&(e.push({kind:"associationEnd.update",casUnit:"logical",containerRef:f.modelId,associationRef:f.modelId,end:"end2",patch:{attributeRef:b.modelId}}),a.endPatches.push({associationRef:f.modelId,end:"end2",patch:{attributeRef:b.modelId}}))}}function Fl(e,n,o,i,a,r,l){for(const{entityId:s,plan:c}of od(n,o,i))Fu(e,n,s,c,a,r,l)}function r_(e,n,o,i,a,r){const l=new Map;for(const{entityId:p,attributeId:f}of i.pairs)l.has(p)||l.set(p,new Set),l.get(p).add(f);const s=new Map;for(const p of r.attrPatches)s.has(p.entityId)||s.set(p.entityId,[]),s.get(p.entityId).push(p);const c=new Map;for(const{entityId:p,attribute:f}of[...a,...r.cascadeAdds])c.has(p)||c.set(p,[]),c.get(p).push(f);const d=p=>{const f={};for(const[h,g]of Object.entries(p))h.includes(".")||(f[h]=g===null?void 0:g);return f},u=e.entities.filter(p=>!n.has(p.modelId)).map(p=>{const f=l.get(p.modelId),h=s.get(p.modelId),g=c.get(p.modelId);if(!f&&!h&&!g)return p;let b=p.attributes;return f&&(b=b.filter(_=>!f.has(_.modelId))),h&&(b=b.map(_=>{const E=h.filter(N=>N.attributeId===_.modelId);return E.length?E.reduce((N,y)=>zu(N,y.patch),_):_})),g&&(b=[...b,...g]),{...p,attributes:b}}),m=e.associations.filter(p=>!o.has(p.modelId)&&!n.has(p.end1.entityRef)&&!n.has(p.end2.entityRef)).map(p=>{let f=p;for(const h of r.assocPatches)h.associationRef===p.modelId&&(f={...f,...d(h.patch)});for(const h of r.endPatches)h.associationRef===p.modelId&&(f={...f,[h.end]:{...f[h.end],...d(h.patch)}});return f}).concat(r.addedAssociations);return{...e,entities:u,associations:m}}function l_(e,n,o,i,a,r,l,s,c){if(!l.identifierCascadeParents.size)return;const d=r_(n,o,i,a,r,l),u=new Map;for(const m of l.identifierCascadeParents)for(const[p,f]of sl(d,m,s)){const h=u.get(p);u.set(p,h?ll(h,f):f)}for(const[m,p]of u)Fu(e,d,m,nd(p),l,a,c)}function s_(e,n,o={}){const i=o.mkId??Pe,a=o.embeddableCatalog??[],r=y=>a.find(k=>k.type===y),l=[],s=[],c=new Map,d=(y,k)=>{const S=c.get(y)??jt(k);return c.set(y,S+1),S},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},h=[],g={attrPatches:[],cascadeAdds:[],addedAssociations:[],assocPatches:[],endPatches:[],identifierCascadeParents:new Set},b=new Set,_=(y,k)=>`${y}\0${k}`,E=new Set;for(const y of n)y.kind==="entity.add"&&(E.add(y.spec.name),y.spec.physicalName&&E.add(y.spec.physicalName));const N=new Set;return n.forEach((y,k)=>{var S,A,V,T,D;switch(y.kind){case"entity.add":{{const M={ref:y.spec.name},x=Nn(y.spec,Yb);if(x.length){s.push({code:"entity-spec-unknown-key",opIndex:k,handle:M,keys:x});break}let P=!1;for(const Y of y.spec.attributes??[]){const se=Nn(Y,Bu);se.length&&(s.push({code:"attribute-spec-unknown-key",opIndex:k,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}for(const Y of y.spec.indexes??[]){const se=Nn(Y,Du);se.length&&(s.push({code:"index-spec-unknown-key",opIndex:k,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}for(const Y of y.spec.operations??[]){const se=Nn(Y,Ou);se.length&&(s.push({code:"operation-spec-unknown-key",opIndex:k,entity:M,handle:{ref:Y.name},keys:se}),P=!0)}if(P)break}const C=e.entities.filter(M=>M.name===y.spec.name).map(M=>M.modelId);if(C.length||N.has(y.spec.name)){s.push({code:"entity-name-conflict",opIndex:k,handle:{ref:y.spec.name},matches:C});break}N.add(y.spec.name);const R=i(),$={modelId:R,name:y.spec.name,stereotype:y.spec.stereotype??"JPA_ENTITY",attributes:[],...y.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...y.spec.physicalName?{table:{physicalName:y.spec.physicalName}}:{},...y.spec.serialization?{serialization:y.spec.serialization}:{}},w={ref:y.spec.name};let I=!1;for(const[M,x]of(y.spec.attributes??[]).entries()){if(x.type==="GroupCodeEnum"&&!x.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:w,handle:{ref:x.name}}),I=!0;continue}if(!r(x.type)&&!((S=x.embeddableOverrides)!=null&&S.length)&&Tu(x)){s.push({code:"datatype-required",opIndex:k,entity:w,handle:{ref:x.name}}),I=!0;continue}const P=r(x.type);if(P){const Y=Vu(x,P,M,$,e.entities,k,w,s,i);Y?$.attributes.push(Y):I=!0}else(A=x.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:k,entity:w,handle:{ref:x.name}}),I=!0):$.attributes.push(Mu(x,M,i))}const v=(y.spec.operations??[]).map((M,x)=>Lu(M,x,i));v.length&&($.operations=v);const B=[];for(const M of y.spec.indexes??[]){const x=Pu($,M,k,w,s,i);x?B.push(x):I=!0}if(B.length&&($.indexes=B),I)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:R,value:$});break}case"entity.update":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}const R=uo(y.patch,Jb,["jpaAttrs.","table.","serialization."]);if(R.length){s.push({code:"entity-patch-unknown-key",opIndex:k,entity:y.entity,keys:R});break}const $=y.patch.stereotype;if(typeof $=="string"&&$!==C.value.stereotype){const w=$==="JPA_EMBEDDABLE"||C.value.stereotype==="JPA_EMBEDDABLE",I=$==="SERIALIZED_TYPE"||C.value.stereotype==="SERIALIZED_TYPE";if(w||I){s.push({code:w?"stereotype-embeddable-transition-unsupported":"stereotype-serialized-transition-unsupported",opIndex:k,entity:y.entity,from:C.value.stereotype??"",to:$});break}}l.push({kind:"entity.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,patch:y.patch});break}case"entity.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}const R=C.value.modelId,$=e.associations.filter(B=>B.end1.entityRef===R||B.end2.entityRef===R),w=new Set($.map(B=>B.modelId));for(const B of $)m.has(B.modelId)||(m.add(B.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:B.modelId}));for(const B of e.entities)if(B.modelId!==R)for(const M of B.attributes)M.embedded&&w.has(M.embedded.associationRef)&&Ho(l,f,B.modelId,M.modelId);for(const B of $){if(B.end1.entityRef===R||!B.end1.attributeRef)continue;const M=e.entities.find(P=>P.modelId===B.end1.entityRef),x=M==null?void 0:M.attributes.find(P=>P.modelId===B.end1.attributeRef&&P.attrType==="RELATION_REF");x&&Ho(l,f,M.modelId,x.modelId)}const I={...e,entities:e.entities.filter(B=>B.modelId!==R),associations:e.associations.filter(B=>!w.has(B.modelId))},v=new Set($.filter(B=>B.end1.entityRef===R&&B.end2.entityRef!==R).map(B=>B.end2.entityRef));Fl(l,I,[...v],i,g,f,d);for(const B of e.groups)B.memberEntityRefs.includes(R)&&(b.has(_(B.modelId,R))||(b.add(_(B.modelId,R)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:B.modelId,groupRef:B.modelId,entityRef:R})));p.add(R),l.push({kind:"entity.remove",casUnit:"logical",entityRef:R});break}case"attribute.add":{{const I=Nn(y.spec,Bu);if(I.length){s.push({code:"attribute-spec-unknown-key",opIndex:k,entity:y.entity,handle:{ref:y.spec.name},keys:I});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}if(y.spec.type==="GroupCodeEnum"&&!y.spec.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:y.entity,handle:{ref:y.spec.name}});break}if(!r(y.spec.type)&&!((V=y.spec.embeddableOverrides)!=null&&V.length)&&Tu(y.spec)){s.push({code:"datatype-required",opIndex:k,entity:y.entity,handle:{ref:y.spec.name}});break}const R=d(C.value.modelId,C.value.attributes),$=r(y.spec.type);let w;if($)w=Vu(y.spec,$,R,C.value,e.entities,k,y.entity,s,i);else if((T=y.spec.embeddableOverrides)!=null&&T.length){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:y.entity,handle:{ref:y.spec.name}});break}else w=Mu(y.spec,R,i);if(!w)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,value:w}),h.push({entityId:C.value.modelId,attribute:w}),w.identifier&&g.identifierCascadeParents.add(C.value.modelId);break}case"attribute.update":case"attribute.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}const R=xu(C.value,y.attribute);if(!R.ok){s.push(R.reason==="not-found"?{code:"attribute-not-found",opIndex:k,entity:y.entity,handle:y.attribute}:{code:"attribute-ambiguous",opIndex:k,entity:y.entity,handle:y.attribute,matches:R.matches});break}if(y.kind==="attribute.update"){const $=[],w=[];let I=!1;for(const x of Object.keys(y.patch)){if(x.includes(".")){x.startsWith("dbAttrs.")?I=!0:w.push(x);continue}zl.has(x)?$.push(x):Gb.has(x)||w.push(x)}if(w.length){s.push({code:"attribute-patch-unknown-key",opIndex:k,entity:y.entity,handle:y.attribute,keys:w});break}if("attrType"in y.patch){const x=String(y.patch.attrType),P=Nu.includes(x)?x!==R.value.attrType?"transition":void 0:"unknown-value";if(P){s.push({code:"attribute-attrtype-unsupported",opIndex:k,entity:y.entity,handle:y.attribute,reason:P,current:R.value.attrType,requested:x});break}}const v="type"in y.patch?y.patch.type:R.value.type,B="groupCode"in y.patch?y.patch.groupCode:R.value.groupCode;if(v==="GroupCodeEnum"&&!B){s.push({code:"groupcode-required",opIndex:k,entity:y.entity,handle:y.attribute});break}let M=y.patch;if($.length){const x=n_(R.value,y.patch,$,I);if(!x){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:k,entity:y.entity,handle:y.attribute,keys:$});break}M=x}if((D=y.embeddableOverrides)!=null&&D.length){const x=r(R.value.type);if(!x||R.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:y.entity,handle:y.attribute});break}const P=o_(R.value,x,y.embeddableOverrides,C.value,e.entities,k,y.entity,s);if(!P)break;M={...M,dbAttrs:P}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,attributeRef:R.value.modelId,patch:M}),g.attrPatches.push({entityId:C.value.modelId,attributeId:R.value.modelId,patch:M});{const x=R.value,P=zu(x,M),Y=(P.identifier??!1)!==(x.identifier??!1),se=(x.identifier||P.identifier)&&("type"in M||"customType"in M||"dbAttrs"in M||Object.keys(M).some(he=>he.startsWith("dbAttrs.")));(Y||se)&&g.identifierCascadeParents.add(C.value.modelId)}}else{const $=Lo(e,C.value.modelId,R.value.modelId);if($){const w=I=>{var v;return((v=e.entities.find(B=>B.modelId===I))==null?void 0:v.name)??I};s.push({code:"attribute-fk-managed",opIndex:k,entity:y.entity,handle:y.attribute,association:{from:w($.end1.entityRef),to:w($.end2.entityRef)}});break}Ho(l,f,C.value.modelId,R.value.modelId),R.value.identifier&&g.identifierCascadeParents.add(C.value.modelId)}break}case"association.add":{{const B=Nn(y.spec,qb);if(B.length){s.push({code:"association-spec-unknown-key",opIndex:k,handle:{from:y.spec.from,to:y.spec.to},keys:B});break}}const C=St(e,y.spec.from),R=St(e,y.spec.to);if(C.ok||s.push(xt(C.reason,k,y.spec.from,C.matches,E)),R.ok||s.push(xt(R.reason,k,y.spec.to,R.matches,E)),!C.ok||!R.ok)break;if(y.spec.identifying&&C.value.modelId===R.value.modelId){s.push({code:"self-identifying",opIndex:k,handle:{from:y.spec.from,to:y.spec.to}});break}if(C.value.stereotype==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:k,handle:{from:y.spec.from,to:y.spec.to}});break}if(C.value.stereotype==="SERIALIZED_TYPE"||R.value.stereotype==="SERIALIZED_TYPE"){s.push({code:"serialized-relation-invalid",opIndex:k,handle:{from:y.spec.from,to:y.spec.to}});break}const $=i(),w={modelId:$,...y.spec.identifying!=null?{identifying:y.spec.identifying}:{},end1:{entityRef:C.value.modelId,multiplicity:y.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:R.value.modelId,multiplicity:y.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:y.spec.composition??!1}},I={...e,associations:[...e.associations,w]},v=pi(I,R.value.modelId,i);v.add[0]&&(w.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:$,value:w}),g.addedAssociations.push(w);for(const B of v.add){const M={...B,order:d(R.value.modelId,R.value.attributes)};l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:M}),g.cascadeAdds.push({entityId:R.value.modelId,attribute:M})}break}case"association.remove":{const C=St(e,y.association.from),R=St(e,y.association.to);if(C.ok||s.push(xt(C.reason,k,y.association.from,C.matches,E)),R.ok||s.push(xt(R.reason,k,y.association.to,R.matches,E)),!C.ok||!R.ok)break;const $=Su(e,C.value.modelId,R.value.modelId);if($.length!==1){s.push($.length===0?{code:"association-not-found",opIndex:k,handle:y.association}:{code:"association-ambiguous",opIndex:k,handle:y.association,matches:$.map(B=>B.modelId)});break}const w=$[0];m.has(w.modelId)||(m.add(w.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:w.modelId}));const I=e.entities.find(B=>B.attributes.some(M=>{var x;return((x=M.embedded)==null?void 0:x.associationRef)===w.modelId}));if(I){const B=I.attributes.find(M=>{var x;return((x=M.embedded)==null?void 0:x.associationRef)===w.modelId});Ho(l,f,I.modelId,B.modelId);break}if(w.end1.attributeRef){const B=e.entities.find(x=>x.modelId===w.end1.entityRef),M=B==null?void 0:B.attributes.find(x=>x.modelId===w.end1.attributeRef&&x.attrType==="RELATION_REF");M&&Ho(l,f,B.modelId,M.modelId)}const v={...e,associations:e.associations.filter(B=>B.modelId!==w.modelId)};Fl(l,v,[w.end2.entityRef],i,g,f,d);break}case"association.update":{const C=Uu(e,y.association,k,s,E);if(!C)break;const R=y.patch.identifying,$=typeof R=="boolean"?R:void 0;if($===!0&&C.end1.entityRef===C.end2.entityRef){s.push({code:"self-identifying",opIndex:k,handle:y.association});break}const w=uo(y.patch,Xb);if(w.length){s.push({code:"association-patch-unknown-key",opIndex:k,handle:y.association,keys:w});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,patch:y.patch}),g.assocPatches.push({associationRef:C.modelId,patch:y.patch}),$!==void 0&&$!==(C.identifying??!1)){const I={...e,associations:e.associations.map(v=>v.modelId===C.modelId?{...v,identifying:$}:v)};Fl(l,I,[C.end2.entityRef],i,g,f,d)}break}case"associationEnd.update":{const C=Uu(e,y.association,k,s,E);if(!C)break;const R=y.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(y.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:k,handle:y.association});break}const $=uo(y.patch,Zb,["jpa."]);if($.length){s.push({code:"association-end-patch-unknown-key",opIndex:k,handle:y.association,keys:$});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:C.modelId,associationRef:C.modelId,end:R,patch:y.patch}),g.endPatches.push({associationRef:C.modelId,end:R,patch:y.patch});break}case"index.add":{{const $=Nn(y.spec,Du);if($.length){s.push({code:"index-spec-unknown-key",opIndex:k,entity:y.entity,handle:{ref:y.spec.name},keys:$});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}const R=Pu(C.value,y.spec,k,y.entity,s,i);if(!R)break;l.push({kind:"index.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.modelId,value:R});break}case"index.update":case"index.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}if(Pl(y.index)){s.push({code:"handle-by-unsupported",opIndex:k,entity:y.entity,handle:y.index,target:"index"});break}const R=Kb(C.value,y.index);if(!R.ok){s.push(R.reason==="not-found"?{code:"index-not-found",opIndex:k,entity:y.entity,handle:y.index}:{code:"index-ambiguous",opIndex:k,entity:y.entity,handle:y.index,matches:R.matches});break}if(y.kind==="index.update"){if("columns"in y.patch){s.push({code:"index-columns-patch-unsupported",opIndex:k,entity:y.entity,handle:y.index});break}const $=uo(y.patch,Qb);if($.length){s.push({code:"index-patch-unknown-key",opIndex:k,entity:y.entity,handle:y.index,keys:$});break}l.push({kind:"index.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.value.modelId,patch:y.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,indexRef:R.value.modelId});break}case"operation.add":{{const w=Nn(y.spec,Ou);if(w.length){s.push({code:"operation-spec-unknown-key",opIndex:k,entity:y.entity,handle:{ref:y.spec.name},keys:w});break}}const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}const R=u.get(C.value.modelId)??(C.value.operations?jt(C.value.operations):0);u.set(C.value.modelId,R+1);const $=Lu(y.spec,R,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:$.modelId,value:$});break}case"operation.update":case"operation.remove":{const C=St(e,y.entity);if(!C.ok){s.push(xt(C.reason,k,y.entity,C.matches,E));break}if(Pl(y.operation)){s.push({code:"handle-by-unsupported",opIndex:k,entity:y.entity,handle:y.operation,target:"operation"});break}const R=Au(C.value,y.operation);if(!R.ok){s.push(R.reason==="not-found"?{code:"operation-not-found",opIndex:k,entity:y.entity,handle:y.operation}:{code:"operation-ambiguous",opIndex:k,entity:y.entity,handle:y.operation,matches:R.matches});break}if(y.kind==="operation.update"){const $=uo(y.patch,e_);if($.length){s.push({code:"operation-patch-unknown-key",opIndex:k,entity:y.entity,handle:y.operation,keys:$});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:R.value.modelId,patch:y.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:C.value.modelId,entityRef:C.value.modelId,operationRef:R.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const C=y.kind==="attribute.reorder",R=St(e,y.entity);if(!R.ok){s.push(xt(R.reason,k,y.entity,R.matches,E));break}const $=C?y.order:y.operations,w=[],I=new Set;let v=!1;for(const P of $){if(!C&&Pl(P)){s.push({code:"handle-by-unsupported",opIndex:k,entity:y.entity,handle:P,target:"operation"}),v=!0;continue}const Y=C?xu(R.value,P):Au(R.value,P);if(!Y.ok){s.push(Y.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:k,entity:y.entity,handle:P}:{code:"reorder-handle-ambiguous",opIndex:k,entity:y.entity,handle:P,matches:Y.matches}),v=!0;continue}if(I.has(Y.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:k,entity:y.entity,handle:P}),v=!0;continue}I.add(Y.value.modelId),w.push(Y.value)}if(v)break;const M=[...C?R.value.attributes:R.value.operations??[]].sort((P,Y)=>P.order-Y.order).filter(P=>!I.has(P.modelId)),x=[...w,...M];if(x.forEach((P,Y)=>{P.order!==Y&&l.push(C?{kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:P.modelId,patch:{order:Y}}:{kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:P.modelId,patch:{order:Y}})}),C)for(const P of vu(e,R.value.modelId,x.map(Y=>Y.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:P.entityId,entityRef:P.entityId,attributeRef:P.attributeId,patch:{dbAttrs:P.dbAttrs}});break}case"group.add":{{const I=Nn(y.spec,Wb);if(I.length){s.push({code:"group-spec-unknown-key",opIndex:k,keys:I});break}}const C=[];let R=!1;for(const I of y.spec.members){const v=St(e,I);if(!v.ok){s.push(xt(v.reason,k,I,v.matches,E)),R=!0;continue}C.push(v.value.modelId)}if(R)break;const $=i(),w={modelId:$,excludeDDLGeneration:y.spec.excludeDDLGeneration??!1,memberEntityRefs:C,...y.spec.name?{name:y.spec.name}:{},...y.spec.packageName?{packageName:y.spec.packageName}:{},...y.spec.description?{description:y.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:$,value:w});break}case"group.update":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,k,y.group));break}const R=uo(y.patch,Pb);if(R.length){s.push({code:"group-patch-unknown-key",opIndex:k,handle:y.group,keys:R});break}l.push({kind:"group.update",casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,patch:y.patch});break}case"group.remove":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,k,y.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:C.value.modelId});break}case"group.addMember":case"group.removeMember":{const C=Ol(e,y.group);if(!C.ok){s.push(Ll(C,k,y.group));break}const R=St(e,y.entity);if(!R.ok){s.push(xt(R.reason,k,y.entity,R.matches,E));break}const $=C.value.memberEntityRefs.includes(R.value.modelId);if(y.kind==="group.addMember"?$:!$)break;if(y.kind==="group.removeMember"){if(b.has(_(C.value.modelId,R.value.modelId)))break;b.add(_(C.value.modelId,R.value.modelId))}l.push({kind:y.kind,casUnit:"logical",containerRef:C.value.modelId,groupRef:C.value.modelId,entityRef:R.value.modelId});break}}}),s.length||l_(l,e,p,m,f,h,g,i,d),s.length||i_(l,e,f,p),s.length||a_(l,e,f,h,p,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function xt(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 Uu(e,n,o,i,a){const r=St(e,n.from),l=St(e,n.to);if(r.ok||i.push(xt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(xt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Su(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 Hu={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},c_={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},d_={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},u_={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","SERIALIZED_TYPE"],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"}},serialization:{$ref:"#/$defs/serialization"}},required:["name"],additionalProperties:!1},m_={type:"object",description:"직렬화 타입의 컨테이너(SERIALIZED_TYPE 전용). 미지정 = 컬렉션이 아닌 단일 값(한 컬럼에 구조 하나). 신규 엔티티는 entity.add 에 함께 줘야 한다 — 같은 배치의 entity.update 는 갓 만든 엔티티에 닿지 못한다.",properties:{collectionType:{type:"string",enum:["LIST","SET","MAP"],description:"컨테이너 종류. 코퍼스 실재가 java.util 3종뿐이라 그만 표현한다(미지 컨테이너는 발명하지 않는다)."},mapKeyType:{type:"string",description:"collectionType='MAP' 일 때의 키 타입(단순명 또는 FQN). 그 외엔 무의미."}},additionalProperties:!1},zn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},f_={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:{...zn,description:"속성 설명(다국어)."},columnLogicalName:{...zn,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},p_={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}},ju={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},h_={type:"object",description:'일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)·직렬화 타입을 end 로 주면 거부된다. 직렬화 타입은 관계가 아니라 소비 속성의 type 으로 지목한다(attribute.update {type: "<타입명>"}). (임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).',properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...ju,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...ju,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},y_={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Hu,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},g_={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...zn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},b_={type:"object",properties:{name:{...zn,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},__={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",enum:[...Nu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...zn,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:{...zn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},k_={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},E_={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},N_={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...zn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},w_={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table·serialization. serialization(직렬화 타입 컨테이너)은 통째로 주거나(예: {"serialization":{"collectionType":"LIST"}}) dotted-key로 준다({"serialization.collectionType":"LIST"}). 컬렉션 아님으로 되돌릴 땐 null 로 비운다(wire clear 규약). jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 값 타입(JPA_EMBEDDABLE·SERIALIZED_TYPE) 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},I_={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function ht(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const v_={"entity.add":ht("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":ht("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":ht("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":ht("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":ht("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":ht("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":ht("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":ht("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":ht("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":ht("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":ht("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":ht("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":ht("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":ht("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":ht("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":ht("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":ht("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":ht("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":ht("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":ht("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":ht("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":ht("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":ht("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},C_={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},S_={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...zn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},Ku={anyOf:Eu.map(e=>v_[e])},x_={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Hu,nameHandle:c_,groupHandle:C_,assocHandle:d_,entitySpec:u_,serialization:m_,attrSpec:f_,embeddableOverrides:p_,assocSpec:h_,indexSpec:y_,operationSpec:g_,groupSpec:b_,entityUpdatePatch:w_,attrUpdatePatch:__,assocUpdatePatch:k_,assocEndUpdatePatch:I_,indexUpdatePatch:E_,operationUpdatePatch:N_,groupUpdatePatch:S_,symbolicOp:Ku}};function R_(e,n,o,i={}){const a=i.mkClientOpId??Pe,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 Gu={location:{x:0,y:0},size:{width:220,height:140}};function Yu(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 A_=/^[-=_*~\s]{3,}$/;function $_(e){return e.attrType&&e.attrType!=="NORMAL"||!A_.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function T_(e){return e.type===_n&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function M_(e,n){if(e.attrType==="DIVIDER"||$_(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=T_(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(Yu)}}function V_(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function B_(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 D_(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(M_),operations:(n=e.operations)==null?void 0:n.map(V_),indexes:(o=e.indexes)==null?void 0:o.map(B_),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function O_(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??{...Gu},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 qu(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 Ul(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:qu(e)}}function L_(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>Hl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function P_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:L_(e),end1:Ul(e.end1),end2:Ul(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 Hl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Wu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Ju(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 Xu(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(Yu)}}function z_(e,n,o){var y,k;const i=Hl(e.end1.attribute),a=Hl(e.end2.attribute);if(i===a)return P_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(k=(y=s.dbAttrs)==null?void 0:y[0])==null?void 0:k.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((S,A)=>Math.max(S,A.order),-1)+1:s.order??0,p={...Xu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),h=l.attribute;let g;if(h&&f&&r.navigable){const S=ca(l.multiplicity);g={modelId:h.modelId??crypto.randomUUID(),name:to(h.name??ua((u==null?void 0:u.name)??l.endModel.refId,S),new Set(f.attributes.map(A=>A.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((A,V)=>Math.max(A,V.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const b=(S,A)=>({entityRef:S.endModel.refId,multiplicity:S.multiplicity,navigable:S.navigable,composition:S.composition,attributeRef:A?g==null?void 0:g.modelId:p.modelId,jpa:qu(S)}),_=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!_&&p.identifier===!0?!0:void 0,end1:b(e.end1,i),end2:b(e.end2,a)},N={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:N}}function F_(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 U_(e,n,o){var h;const i=((h=e.end1.attribute)==null?void 0:h.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((g,b)=>Math.max(g,b.order),-1)+1:l.order??0,d={...Xu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>F_(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...Ul(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function H_(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,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Zu(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 u=H_(o,s);u.length&&(d=u)}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 Qu(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 j_(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||_t(a.stereotype)||_t(r.stereotype))continue;const l=i.end1.attributeRef?a.attributes.find(p=>p.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=ca(i.end2.multiplicity),u=ua(r.name,d),m=to(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function K_(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||_t(a.stereotype)||_t(r.stereotype))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 em(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if(l&&_t(l.stereotype))continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Dc(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function tm(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?G_(n):Y_(n)}function G_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);j_(a,r),K_(a,r),em(a,r);const{version:s,...c}=e.layout;Qu(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}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Y_(e){var _,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(N,y)=>{o.push(D_(N));const k=O_(N);k.geo={location:{x:k.geo.location.x+y.x,y:k.geo.location.y+y.y},size:k.geo.size},i.push(k);for(const S of N.ownedAssociations??[])c.push(S)},u={x:0,y:0};for(const N of e.entities??[])d(N,u);const m=[];for(const N of e.groups??[]){const y=N.entities??[];l.push({modelId:N.modelId,name:N.name,description:N.description,packageName:N.packageName,excludeDDLGeneration:N.excludeDDLGeneration??!1,memberEntityRefs:y.map(S=>S.modelId)});const k=((_=N.geo)==null?void 0:_.location)??u;if(N.geo){const S=(N.notes??[]).map(A=>A.modelId);s.push({groupRef:N.modelId,geo:N.geo,style:N.style,locked:N.locked,memberNoteRefs:S.length?S:void 0})}for(const S of y)d(S,k);for(const S of N.notes??[])m.push(Zu(S,k))}const p=new Map(o.map(N=>[N.modelId,N])),f=new Map,h=new Map;for(const N of o)for(const y of N.attributes)for(const k of y.dbAttrs)f.set(k.modelId,y.modelId),h.set(k.modelId,k);for(const N of c)for(const y of[N.end1,N.end2]){const k=y.attribute;if(k&&(((E=k.dbAttrs)==null?void 0:E.length)??0)>0)for(const S of k.dbAttrs)S.modelId&&f.set(S.modelId,k.modelId)}for(const N of c){const y=Wu(N.end1.attribute),k=Wu(N.end2.attribute),S=Ju(N.end1)||Ju(N.end2),{assoc:A,layout:V}=y!==k||S?U_(N,p,h):z_(N,p,f);a.push(A),r.push(V)}Qu(o,a,r),wd(o),em(o,a);const g={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(N=>Zu(N)),...m]}},b={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:b}}function nm(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 q_(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(nm),style:n}}function W_(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 J_(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 Fn(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 X_(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{...nm(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Z_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function om(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 Q_(e){const n=new Set;for(const o of e.logical.associations){const i=om(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function ek(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 tk(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function nk(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:tk(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 ok(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var h;return((h=f.embedded)==null?void 0:h.associationRef)===e.modelId});if(p){i=p;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.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,p)=>nk(m,l[p]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:Fn(e.end1,c?s:u),end2:Fn(e.end2,c?u:s)}}function ik(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:Fn(e.end1,e.end1.legacyEmbedRaw),end2:Fn(e.end2,e.end2.legacyEmbedRaw)};const a=ok(e,n,i);if(a)return a;const r=om(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?X_(r.fk,l):void 0,c=Z_(r.navAttr);return{...i,end1:Fn(e.end1,r.navEnd===e.end1?s:c),end2:Fn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Fn(e.end1),end2:Fn(e.end2)}}function im(e,n,o,i,a={x:0,y:0}){var u,m;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(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...Gu},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 f;return q_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return W_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>ik(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(J_),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 ak(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=>am(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>im(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 am(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 rk(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Q_(e),r=ek(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=>im(s,e,a,r)),groups:e.logical.groups.map(s=>ak(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>am(s))}}function lk(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,referenceOnly:n.referenceOnly,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}}}const sk=["notNull"];function ck(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=tm(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const h=p.get(f.modelId);if(!h){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const b of sk)f[b]===!0!=(h[b]===!0)&&(g[b]=f[b],s.attributeFieldsByName[b]=(s.attributeFieldsByName[b]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&p.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function Ni(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function wn(e){return typeof e=="function"?e():t.unref(e)}const dk=typeof window<"u"&&typeof document<"u",uk=e=>typeof e<"u",mk=Object.prototype.toString,fk=e=>mk.call(e)==="[object Object]",pk=()=>{};function hk(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 rm=e=>e();function yk(e=rm){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 lm(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function gk(e,n,o={}){const{eventFilter:i=rm,...a}=o;return t.watch(e,hk(i,n),a)}function jo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=yk(i);return{stop:gk(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function bk(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=wn(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 jl(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:h,throwOnTimeout:g}={}){let b=null;const E=[new Promise(N=>{b=t.watch(e,y=>{m(y)!==n&&(b==null||b(),N(y))},{flush:p,deep:f,immediate:!0})})];return h!=null&&E.push(lm(h,g).then(()=>wn(e)).finally(()=>b==null?void 0:b())),Promise.race(E)}function i(m,p){if(!t.isRef(m))return o(y=>y===m,p);const{flush:f="sync",deep:h=!1,timeout:g,throwOnTimeout:b}=p??{};let _=null;const N=[new Promise(y=>{_=t.watch([e,m],([k,S])=>{n!==(k===S)&&(_==null||_(),y(k))},{flush:f,deep:h,immediate:!0})})];return g!=null&&N.push(lm(g,b).then(()=>wn(e)).finally(()=>(_==null||_(),wn(e)))),Promise.race(N)}function a(m){return o(p=>!!p,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,p){return o(f=>{const h=Array.from(f);return h.includes(m)||h.includes(wn(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(wn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return jl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return jl(e,!n)}}}function Kl(e){return jl(e)}function _k(e){var n;const o=wn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const sm=dk?window:void 0;function cm(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=sm):[n,o,i,a]=e,!n)return pk;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[_k(n),wn(a)],([u,m])=>{if(l(),!u)return;const p=fk(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(h=>s(u,f,h,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return Ni(d),d}function kk(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function dm(...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=sm,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=kk(n);return cm(a,r,u=>{u.repeat&&wn(s)||c(u)&&o(u)},l)}function Ek(e){return JSON.parse(JSON.stringify(e))}function Gl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),h=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const b=N=>s?typeof s=="function"?s(N):Ek(N):N,_=()=>uk(e[n])?b(e[n]):m,E=N=>{p?p(N)&&h(g,N):h(g,N)};if(c){const N=_(),y=t.ref(N);let k=!1;return t.watch(()=>e[n],S=>{k||(k=!0,y.value=b(S),t.nextTick(()=>k=!1))}),t.watch(y,S=>{!k&&(S!==e[n]||u)&&E(S)},{deep:u}),y}else return t.computed({get(){return _()},set(N){E(N)}})}var Nk={value:()=>{}};function Ma(){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 Va(o)}function Va(e){this._=e}function wk(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}})}Va.prototype=Ma.prototype={constructor:Va,on:function(e,n){var o=this._,i=wk(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Ik(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]=um(o[a],e.name,n);else if(n==null)for(a in o)o[a]=um(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 Va(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 Ik(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function um(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Nk,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Yl="http://www.w3.org/1999/xhtml";const mm={svg:"http://www.w3.org/2000/svg",xhtml:Yl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ba(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),mm.hasOwnProperty(n)?{space:mm[n],local:e}:e}function vk(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Yl&&n.documentElement.namespaceURI===Yl?n.createElement(e):n.createElementNS(o,e)}}function Ck(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fm(e){var n=Ba(e);return(n.local?Ck:vk)(n)}function Sk(){}function ql(e){return e==null?Sk:function(){return this.querySelector(e)}}function xk(e){typeof e!="function"&&(e=ql(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,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 Ut(i,this._parents)}function Rk(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ak(){return[]}function pm(e){return e==null?Ak:function(){return this.querySelectorAll(e)}}function $k(e){return function(){return Rk(e.apply(this,arguments))}}function Tk(e){typeof e=="function"?e=$k(e):e=pm(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 Ut(i,a)}function hm(e){return function(){return this.matches(e)}}function ym(e){return function(n){return n.matches(e)}}var Mk=Array.prototype.find;function Vk(e){return function(){return Mk.call(this.children,e)}}function Bk(){return this.firstElementChild}function Dk(e){return this.select(e==null?Bk:Vk(typeof e=="function"?e:ym(e)))}var Ok=Array.prototype.filter;function Lk(){return Array.from(this.children)}function Pk(e){return function(){return Ok.call(this.children,e)}}function zk(e){return this.selectAll(e==null?Lk:Pk(typeof e=="function"?e:ym(e)))}function Fk(e){typeof e!="function"&&(e=hm(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 Ut(i,this._parents)}function gm(e){return new Array(e.length)}function Uk(){return new Ut(this._enter||this._groups.map(gm),this._parents)}function Da(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Da.prototype={constructor:Da,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 Hk(e){return function(){return e}}function jk(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 Da(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function Kk(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Da(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function Gk(e){return e.__data__}function Yk(e,n){if(!arguments.length)return Array.from(this,Gk);var o=n?Kk:jk,i=this._parents,a=this._groups;typeof e!="function"&&(e=Hk(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],p=m.length,f=qk(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),b=l[d]=new Array(h),_=c[d]=new Array(p);o(u,m,g,b,_,f,n);for(var E=0,N=0,y,k;E<h;++E)if(y=g[E]){for(E>=N&&(N=E+1);!(k=b[N])&&++N<h;);y._next=k||null}}return l=new Ut(l,i),l._enter=s,l._exit=c,l}function qk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wk(){return new Ut(this._exit||this._groups.map(gm),this._parents)}function Jk(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 Xk(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],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ut(s,this._parents)}function Zk(){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 Qk(e){e||(e=eE);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!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,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ut(a,this._parents).order()}function eE(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function tE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nE(){return Array.from(this)}function oE(){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 iE(){let e=0;for(const n of this)++e;return e}function aE(){return!this.node()}function rE(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 lE(e){return function(){this.removeAttribute(e)}}function sE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cE(e,n){return function(){this.setAttribute(e,n)}}function dE(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function uE(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function mE(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 fE(e,n){var o=Ba(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?sE:lE:typeof n=="function"?o.local?mE:uE:o.local?dE:cE)(o,n))}function bm(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function pE(e){return function(){this.style.removeProperty(e)}}function hE(e,n,o){return function(){this.style.setProperty(e,n,o)}}function yE(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function gE(e,n,o){return arguments.length>1?this.each((n==null?pE:typeof n=="function"?yE:hE)(e,n,o??"")):Ko(this.node(),e)}function Ko(e,n){return e.style.getPropertyValue(n)||bm(e).getComputedStyle(e,null).getPropertyValue(n)}function bE(e){return function(){delete this[e]}}function _E(e,n){return function(){this[e]=n}}function kE(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function EE(e,n){return arguments.length>1?this.each((n==null?bE:typeof n=="function"?kE:_E)(e,n)):this.node()[e]}function _m(e){return e.trim().split(/^|\s+/)}function Wl(e){return e.classList||new km(e)}function km(e){this._node=e,this._names=_m(e.getAttribute("class")||"")}km.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 Em(e,n){for(var o=Wl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Nm(e,n){for(var o=Wl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function NE(e){return function(){Em(this,e)}}function wE(e){return function(){Nm(this,e)}}function IE(e,n){return function(){(n.apply(this,arguments)?Em:Nm)(this,e)}}function vE(e,n){var o=_m(e+"");if(arguments.length<2){for(var i=Wl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?IE:n?NE:wE)(o,n))}function CE(){this.textContent=""}function SE(e){return function(){this.textContent=e}}function xE(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function RE(e){return arguments.length?this.each(e==null?CE:(typeof e=="function"?xE:SE)(e)):this.node().textContent}function AE(){this.innerHTML=""}function $E(e){return function(){this.innerHTML=e}}function TE(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function ME(e){return arguments.length?this.each(e==null?AE:(typeof e=="function"?TE:$E)(e)):this.node().innerHTML}function VE(){this.nextSibling&&this.parentNode.appendChild(this)}function BE(){return this.each(VE)}function DE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function OE(){return this.each(DE)}function LE(e){var n=typeof e=="function"?e:fm(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function PE(){return null}function zE(e,n){var o=typeof e=="function"?e:fm(e),i=n==null?PE:typeof n=="function"?n:ql(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function FE(){var e=this.parentNode;e&&e.removeChild(this)}function UE(){return this.each(FE)}function HE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function jE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function KE(e){return this.select(e?jE:HE)}function GE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function YE(e){return function(n){e.call(this,n,this.__data__)}}function qE(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 WE(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 JE(e,n,o){return function(){var i=this.__on,a,r=YE(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 XE(e,n,o){var i=qE(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=n?JE:WE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function wm(e,n,o){var i=bm(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 ZE(e,n){return function(){return wm(this,e,n)}}function QE(e,n){return function(){return wm(this,e,n.apply(this,arguments))}}function e1(e,n){return this.each((typeof n=="function"?QE:ZE)(e,n))}function*t1(){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 Im=[null];function Ut(e,n){this._groups=e,this._parents=n}function wi(){return new Ut([[document.documentElement]],Im)}function n1(){return this}Ut.prototype=wi.prototype={constructor:Ut,select:xk,selectAll:Tk,selectChild:Dk,selectChildren:zk,filter:Fk,data:Yk,enter:Uk,exit:Wk,join:Jk,merge:Xk,selection:n1,order:Zk,sort:Qk,call:tE,nodes:nE,node:oE,size:iE,empty:aE,each:rE,attr:fE,style:gE,property:EE,classed:vE,text:RE,html:ME,raise:BE,lower:OE,append:LE,insert:zE,remove:UE,clone:KE,datum:GE,on:XE,dispatch:e1,[Symbol.iterator]:t1};function Jt(e){return typeof e=="string"?new Ut([[document.querySelector(e)]],[document.documentElement]):new Ut([[e]],Im)}function o1(e){let n;for(;n=e.sourceEvent;)e=n;return e}function sn(e,n){if(e=o1(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 i1={passive:!1},Ii={capture:!0,passive:!1};function Jl(e){e.stopImmediatePropagation()}function Go(e){e.preventDefault(),e.stopImmediatePropagation()}function vm(e){var n=e.document.documentElement,o=Jt(e).on("dragstart.drag",Go,Ii);"onselectstart"in n?o.on("selectstart.drag",Go,Ii):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Cm(e,n){var o=e.document.documentElement,i=Jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Go,Ii),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 Oa=e=>()=>e;function Xl(e,{sourceEvent:n,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: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:u}})}Xl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function a1(e){return!e.ctrlKey&&!e.button}function r1(){return this.parentNode}function l1(e,n){return n??{x:e.x,y:e.y}}function s1(){return navigator.maxTouchPoints||"ontouchstart"in this}function c1(){var e=a1,n=r1,o=l1,i=s1,a={},r=Ma("start","drag","end"),l=0,s,c,d,u,m=0;function p(y){y.on("mousedown.drag",f).filter(i).on("touchstart.drag",b).on("touchmove.drag",_,i1).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(y,k){if(!(u||!e.call(this,y,k))){var S=N(this,n.call(this,y,k),y,k,"mouse");S&&(Jt(y.view).on("mousemove.drag",h,Ii).on("mouseup.drag",g,Ii),vm(y.view),Jl(y),d=!1,s=y.clientX,c=y.clientY,S("start",y))}}function h(y){if(Go(y),!d){var k=y.clientX-s,S=y.clientY-c;d=k*k+S*S>m}a.mouse("drag",y)}function g(y){Jt(y.view).on("mousemove.drag mouseup.drag",null),Cm(y.view,d),Go(y),a.mouse("end",y)}function b(y,k){if(e.call(this,y,k)){var S=y.changedTouches,A=n.call(this,y,k),V=S.length,T,D;for(T=0;T<V;++T)(D=N(this,A,y,k,S[T].identifier,S[T]))&&(Jl(y),D("start",y,S[T]))}}function _(y){var k=y.changedTouches,S=k.length,A,V;for(A=0;A<S;++A)(V=a[k[A].identifier])&&(Go(y),V("drag",y,k[A]))}function E(y){var k=y.changedTouches,S=k.length,A,V;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<S;++A)(V=a[k[A].identifier])&&(Jl(y),V("end",y,k[A]))}function N(y,k,S,A,V,T){var D=r.copy(),C=sn(T||S,k),R,$,w;if((w=o.call(y,new Xl("beforestart",{sourceEvent:S,target:p,identifier:V,active:l,x:C[0],y:C[1],dx:0,dy:0,dispatch:D}),A))!=null)return R=w.x-C[0]||0,$=w.y-C[1]||0,function I(v,B,M){var x=C,P;switch(v){case"start":a[V]=I,P=l++;break;case"end":delete a[V],--l;case"drag":C=sn(M||B,k),P=l;break}D.call(v,y,new Xl(v,{sourceEvent:B,subject:w,target:p,identifier:V,active:P,x:C[0]+R,y:C[1]+$,dx:C[0]-x[0],dy:C[1]-x[1],dispatch:D}),A)}}return p.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Oa(!!y),p):e},p.container=function(y){return arguments.length?(n=typeof y=="function"?y:Oa(y),p):n},p.subject=function(y){return arguments.length?(o=typeof y=="function"?y:Oa(y),p):o},p.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Oa(!!y),p):i},p.on=function(){var y=r.on.apply(r,arguments);return y===r?p:y},p.clickDistance=function(y){return arguments.length?(m=(y=+y)*y,p):Math.sqrt(m)},p}function Zl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Sm(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function vi(){}var Ci=.7,La=1/Ci,Yo="\\s*([+-]?\\d+)\\s*",Si="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",d1=/^#([0-9a-f]{3,8})$/,u1=new RegExp(`^rgb\\(${Yo},${Yo},${Yo}\\)$`),m1=new RegExp(`^rgb\\(${cn},${cn},${cn}\\)$`),f1=new RegExp(`^rgba\\(${Yo},${Yo},${Yo},${Si}\\)$`),p1=new RegExp(`^rgba\\(${cn},${cn},${cn},${Si}\\)$`),h1=new RegExp(`^hsl\\(${Si},${cn},${cn}\\)$`),y1=new RegExp(`^hsla\\(${Si},${cn},${cn},${Si}\\)$`),xm={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};Zl(vi,mo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Rm,formatHex:Rm,formatHex8:g1,formatHsl:b1,formatRgb:Am,toString:Am});function Rm(){return this.rgb().formatHex()}function g1(){return this.rgb().formatHex8()}function b1(){return Bm(this).formatHsl()}function Am(){return this.rgb().formatRgb()}function mo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=d1.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$m(n):o===3?new Ot(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Pa(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Pa(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=u1.exec(e))?new Ot(n[1],n[2],n[3],1):(n=m1.exec(e))?new Ot(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=f1.exec(e))?Pa(n[1],n[2],n[3],n[4]):(n=p1.exec(e))?Pa(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=h1.exec(e))?Vm(n[1],n[2]/100,n[3]/100,1):(n=y1.exec(e))?Vm(n[1],n[2]/100,n[3]/100,n[4]):xm.hasOwnProperty(e)?$m(xm[e]):e==="transparent"?new Ot(NaN,NaN,NaN,0):null}function $m(e){return new Ot(e>>16&255,e>>8&255,e&255,1)}function Pa(e,n,o,i){return i<=0&&(e=n=o=NaN),new Ot(e,n,o,i)}function _1(e){return e instanceof vi||(e=mo(e)),e?(e=e.rgb(),new Ot(e.r,e.g,e.b,e.opacity)):new Ot}function Ql(e,n,o,i){return arguments.length===1?_1(e):new Ot(e,n,o,i??1)}function Ot(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Zl(Ot,Ql,Sm(vi,{brighter(e){return e=e==null?La:Math.pow(La,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ot(fo(this.r),fo(this.g),fo(this.b),za(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:k1,formatRgb:Mm,toString:Mm}));function Tm(){return`#${po(this.r)}${po(this.g)}${po(this.b)}`}function k1(){return`#${po(this.r)}${po(this.g)}${po(this.b)}${po((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mm(){const e=za(this.opacity);return`${e===1?"rgb(":"rgba("}${fo(this.r)}, ${fo(this.g)}, ${fo(this.b)}${e===1?")":`, ${e})`}`}function za(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function fo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function po(e){return e=fo(e),(e<16?"0":"")+e.toString(16)}function Vm(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 Bm(e){if(e instanceof Xt)return new Xt(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=mo(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 E1(e,n,o,i){return arguments.length===1?Bm(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}Zl(Xt,E1,Sm(vi,{brighter(e){return e=e==null?La:Math.pow(La,e),new Xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,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 Ot(es(e>=240?e-240:e+120,a,i),es(e,a,i),es(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Xt(Dm(this.h),Fa(this.s),Fa(this.l),za(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=za(this.opacity);return`${e===1?"hsl(":"hsla("}${Dm(this.h)}, ${Fa(this.s)*100}%, ${Fa(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dm(e){return e=(e||0)%360,e<0?e+360:e}function Fa(e){return Math.max(0,Math.min(1,e||0))}function es(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 ts=e=>()=>e;function N1(e,n){return function(o){return e+o*n}}function w1(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 I1(e){return(e=+e)==1?Om:function(n,o){return o-n?w1(n,o,e):ts(isNaN(n)?o:n)}}function Om(e,n){var o=n-e;return o?N1(e,o):ts(isNaN(e)?n:e)}const Ua=(function e(n){var o=I1(n);function i(a,r){var l=o((a=Ql(a)).r,(r=Ql(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Om(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 v1(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 C1(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function S1(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]=xi(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 x1(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function dn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function R1(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]=xi(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,os=new RegExp(ns.source,"g");function A1(e){return function(){return e}}function $1(e){return function(n){return e(n)+""}}function Lm(e,n){var o=ns.lastIndex=os.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ns.exec(e))&&(a=os.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=os.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?$1(c[0].x):A1(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function xi(e,n){var o=typeof n,i;return n==null||o==="boolean"?ts(n):(o==="number"?dn:o==="string"?(i=mo(n))?(n=i,Ua):Lm:n instanceof mo?Ua:n instanceof Date?x1:C1(n)?v1:Array.isArray(n)?S1:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?R1:dn)(e,n)}var Pm=180/Math.PI,is={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zm(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)*Pm,skewX:Math.atan(c)*Pm,scaleX:l,scaleY:s}}var Ha;function T1(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?is:zm(n.a,n.b,n.c,n.d,n.e,n.f)}function M1(e){return e==null||(Ha||(Ha=document.createElementNS("http://www.w3.org/2000/svg","g")),Ha.setAttribute("transform",e),!(e=Ha.transform.baseVal.consolidate()))?is:(e=e.matrix,zm(e.a,e.b,e.c,e.d,e.e,e.f))}function Fm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:dn(d,m)},{i:g-2,x:dn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:dn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:dn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:dn(d,m)},{i:g-2,x:dn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,b;++h<g;)m[(b=p[h]).i]=b.x(f);return m.join("")}}}var V1=Fm(T1,"px, ","px)","deg)"),B1=Fm(M1,", ",")",")"),D1=1e-12;function Um(e){return((e=Math.exp(e))+1/e)/2}function O1(e){return((e=Math.exp(e))-1/e)/2}function L1(e){return((e=Math.exp(2*e))-1)/(e+1)}const ja=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,b,_;if(g<D1)_=Math.log(p/d)/n,b=function(A){return[s+A*f,c+A*h,d*Math.exp(n*A*_)]};else{var E=Math.sqrt(g),N=(p*p-d*d+i*g)/(2*d*o*E),y=(p*p-d*d-i*g)/(2*p*o*E),k=Math.log(Math.sqrt(N*N+1)-N),S=Math.log(Math.sqrt(y*y+1)-y);_=(S-k)/n,b=function(A){var V=A*_,T=Um(k),D=d/(o*E)*(T*L1(n*V+k)-O1(k));return[s+D*f,c+D*h,d*T/Um(n*V+k)]}}return b.duration=_*1e3*n/Math.SQRT2,b}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 qo=0,Ri=0,Ai=0,Hm=1e3,Ka,$i,Ga=0,ho=0,Ya=0,Ti=typeof performance=="object"&&performance.now?performance:Date,jm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function as(){return ho||(jm(P1),ho=Ti.now()+Ya)}function P1(){ho=0}function qa(){this._call=this._time=this._next=null}qa.prototype=Km.prototype={constructor:qa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?as():+o)+(n==null?0:+n),!this._next&&$i!==this&&($i?$i._next=this:Ka=this,$i=this),this._call=e,this._time=o,rs()},stop:function(){this._call&&(this._call=null,this._time=1/0,rs())}};function Km(e,n,o){var i=new qa;return i.restart(e,n,o),i}function z1(){as(),++qo;for(var e=Ka,n;e;)(n=ho-e._time)>=0&&e._call.call(void 0,n),e=e._next;--qo}function Gm(){ho=(Ga=Ti.now())+Ya,qo=Ri=0;try{z1()}finally{qo=0,U1(),ho=0}}function F1(){var e=Ti.now(),n=e-Ga;n>Hm&&(Ya-=n,Ga=e)}function U1(){for(var e,n=Ka,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:Ka=o);$i=e,rs(i)}function rs(e){if(!qo){Ri&&(Ri=clearTimeout(Ri));var n=e-ho;n>24?(e<1/0&&(Ri=setTimeout(Gm,e-Ti.now()-Ya)),Ai&&(Ai=clearInterval(Ai))):(Ai||(Ga=Ti.now(),Ai=setInterval(F1,Hm)),qo=1,jm(Gm))}}function Ym(e,n,o){var i=new qa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var H1=Ma("start","end","cancel","interrupt"),j1=[],qm=0,Wm=1,ls=2,Wa=3,Jm=4,ss=5,Ja=6;function Xa(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;K1(e,o,{name:n,index:i,group:a,on:H1,tween:j1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:qm})}function cs(e,n){var o=Zt(e,n);if(o.state>qm)throw new Error("too late; already scheduled");return o}function un(e,n){var o=Zt(e,n);if(o.state>Wa)throw new Error("too late; already running");return o}function Zt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function K1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Km(r,0,o.time);function r(d){o.state=Wm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==Wm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Wa)return Ym(l);f.state===Jm?(f.state=Ja,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ja,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Ym(function(){o.state===Wa&&(o.state=Jm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ls,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ls){for(o.state=Wa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=ss,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===ss&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ja,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Za(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>ls&&i.state<ss,i.state=Ja,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function G1(e){return this.each(function(){Za(this,e)})}function Y1(e,n){var o,i;return function(){var a=un(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 q1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=un(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 W1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Zt(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?Y1:q1)(o,e,n))}function ds(e,n,o){var i=e._id;return e.each(function(){var a=un(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Zt(a,i).value[n]}}function Xm(e,n){var o;return(typeof n=="number"?dn:n instanceof mo?Ua:(o=mo(n))?(n=o,Ua):Lm)(e,n)}function J1(e){return function(){this.removeAttribute(e)}}function X1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Z1(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 Q1(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 e0(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 t0(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 n0(e,n){var o=Ba(e),i=o==="transform"?B1:Xm;return this.attrTween(e,typeof n=="function"?(o.local?t0:e0)(o,i,ds(this,"attr."+e,n)):n==null?(o.local?X1:J1)(o):(o.local?Q1:Z1)(o,i,n))}function o0(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function i0(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function a0(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&i0(e,r)),o}return a._value=n,a}function r0(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&o0(e,r)),o}return a._value=n,a}function l0(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=Ba(e);return this.tween(o,(i.local?a0:r0)(i,n))}function s0(e,n){return function(){cs(this,e).delay=+n.apply(this,arguments)}}function c0(e,n){return n=+n,function(){cs(this,e).delay=n}}function d0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?s0:c0)(n,e)):Zt(this.node(),n).delay}function u0(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function m0(e,n){return n=+n,function(){un(this,e).duration=n}}function f0(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?u0:m0)(n,e)):Zt(this.node(),n).duration}function p0(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function h0(e){var n=this._id;return arguments.length?this.each(p0(n,e)):Zt(this.node(),n).ease}function y0(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function g0(e){if(typeof e!="function")throw new Error;return this.each(y0(this._id,e))}function b0(e){typeof e!="function"&&(e=hm(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 In(i,this._parents,this._name,this._id)}function _0(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],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new In(l,this._parents,this._name,this._id)}function k0(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 E0(e,n,o){var i,a,r=k0(n)?cs:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function N0(e,n){var o=this._id;return arguments.length<2?Zt(this.node(),o).on.on(e):this.each(E0(o,e,n))}function w0(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function I0(){return this.on("end.remove",w0(this._id))}function v0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ql(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Xa(d[p],n,o,p,d,Zt(u,o)));return new In(r,this._parents,n,o)}function C0(e){var n=this._name,o=this._id;typeof e!="function"&&(e=pm(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 p=e.call(u,u.__data__,m,c),f,h=Zt(u,o),g=0,b=p.length;g<b;++g)(f=p[g])&&Xa(f,n,o,g,p,h);r.push(p),l.push(u)}return new In(r,l,n,o)}var S0=wi.prototype.constructor;function x0(){return new S0(this._groups,this._parents)}function R0(e,n){var o,i,a;return function(){var r=Ko(this,e),l=(this.style.removeProperty(e),Ko(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Zm(e){return function(){this.style.removeProperty(e)}}function A0(e,n,o){var i,a=o+"",r;return function(){var l=Ko(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function $0(e,n,o){var i,a,r;return function(){var l=Ko(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Ko(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function T0(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=un(this,e),d=c.on,u=c.value[r]==null?s||(s=Zm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function M0(e,n,o){var i=(e+="")=="transform"?V1:Xm;return n==null?this.styleTween(e,R0(e,i)).on("end.style."+e,Zm(e)):typeof n=="function"?this.styleTween(e,$0(e,i,ds(this,"style."+e,n))).each(T0(this._id,e)):this.styleTween(e,A0(e,i,n),o).on("end.style."+e,null)}function V0(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function B0(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&V0(e,l,o)),i}return r._value=n,r}function D0(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,B0(e,n,o??""))}function O0(e){return function(){this.textContent=e}}function L0(e){return function(){var n=e(this);this.textContent=n??""}}function P0(e){return this.tween("text",typeof e=="function"?L0(ds(this,"text",e)):O0(e==null?"":e+""))}function z0(e){return function(n){this.textContent=e.call(this,n)}}function F0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&z0(a)),n}return i._value=e,i}function U0(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,F0(e))}function H0(){for(var e=this._name,n=this._id,o=Qm(),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=Zt(c,n);Xa(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new In(i,this._parents,e,o)}function j0(){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=un(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var K0=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Qm(){return++K0}var vn=wi.prototype;In.prototype={constructor:In,select:v0,selectAll:C0,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:b0,merge:_0,selection:x0,transition:H0,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:N0,attr:n0,attrTween:l0,style:M0,styleTween:D0,text:P0,textTween:U0,remove:I0,tween:W1,delay:d0,duration:f0,ease:h0,easeVarying:g0,end:j0,[Symbol.iterator]:vn[Symbol.iterator]};function G0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Y0={time:null,delay:0,duration:250,ease:G0};function q0(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 W0(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=Qm(),(o=Y0).time=as(),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])&&Xa(c,e,n,d,l,o||q0(c,n));return new In(i,this._parents,e,n)}wi.prototype.interrupt=G1,wi.prototype.transition=W0;const Qa=e=>()=>e;function J0(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 Cn(e,n,o){this.k=e,this.x=n,this.y=o}Cn.prototype={constructor:Cn,scale:function(e){return e===1?this:new Cn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cn(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 Wo=new Cn(1,0,0);Cn.prototype;function us(e){e.stopImmediatePropagation()}function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function X0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Z0(){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||Wo}function Q0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function eN(){return navigator.maxTouchPoints||"ontouchstart"in this}function tN(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 nN(){var e=X0,n=Z0,o=tN,i=Q0,a=eN,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ja,d=Ma("start","zoom","end"),u,m,p,f=500,h=150,g=0,b=10;function _(w){w.property("__zoom",ef).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,I,v,B){var M=w.selection?w.selection():w;M.property("__zoom",ef),w!==M?k(w,I,v,B):M.interrupt().each(function(){S(this,arguments).event(B).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},_.scaleBy=function(w,I,v,B){_.scaleTo(w,function(){var M=this.__zoom.k,x=typeof I=="function"?I.apply(this,arguments):I;return M*x},v,B)},_.scaleTo=function(w,I,v,B){_.transform(w,function(){var M=n.apply(this,arguments),x=this.__zoom,P=v==null?y(M):typeof v=="function"?v.apply(this,arguments):v,Y=x.invert(P),se=typeof I=="function"?I.apply(this,arguments):I;return o(N(E(x,se),P,Y),M,l)},v,B)},_.translateBy=function(w,I,v,B){_.transform(w,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,B)},_.translateTo=function(w,I,v,B,M){_.transform(w,function(){var x=n.apply(this,arguments),P=this.__zoom,Y=B==null?y(x):typeof B=="function"?B.apply(this,arguments):B;return o(Wo.translate(Y[0],Y[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),x,l)},B,M)};function E(w,I){return I=Math.max(r[0],Math.min(r[1],I)),I===w.k?w:new Cn(I,w.x,w.y)}function N(w,I,v){var B=I[0]-v[0]*w.k,M=I[1]-v[1]*w.k;return B===w.x&&M===w.y?w:new Cn(w.k,B,M)}function y(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function k(w,I,v,B){w.on("start.zoom",function(){S(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(B).end()}).tween("zoom",function(){var M=this,x=arguments,P=S(M,x).event(B),Y=n.apply(M,x),se=v==null?y(Y):typeof v=="function"?v.apply(M,x):v,he=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=M.__zoom,fe=typeof I=="function"?I.apply(M,x):I,pe=c(ie.invert(se).concat(he/ie.k),fe.invert(se).concat(he/fe.k));return function(ge){if(ge===1)ge=fe;else{var Te=pe(ge),He=he/Te[2];ge=new Cn(He,se[0]-Te[0]*He,se[1]-Te[1]*He)}P.zoom(null,ge)}})}function S(w,I,v){return!v&&w.__zooming||new A(w,I)}function A(w,I){this.that=w,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,I),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,I){return this.mouse&&w!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var I=Jt(this.that).datum();d.call(w,this.that,new J0(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),I)}};function V(w,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(w),B=this.__zoom,M=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),x=sn(w);if(v.wheel)(v.mouse[0][0]!==x[0]||v.mouse[0][1]!==x[1])&&(v.mouse[1]=B.invert(v.mouse[0]=x)),clearTimeout(v.wheel);else{if(B.k===M)return;v.mouse=[x,B.invert(x)],Za(this),v.start()}Mi(w),v.wheel=setTimeout(P,h),v.zoom("mouse",o(N(E(B,M),v.mouse[0],v.mouse[1]),v.extent,l));function P(){v.wheel=null,v.end()}}function T(w,...I){if(p||!e.apply(this,arguments))return;var v=w.currentTarget,B=S(this,I,!0).event(w),M=Jt(w.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),x=sn(w,v),P=w.clientX,Y=w.clientY;vm(w.view),us(w),B.mouse=[x,this.__zoom.invert(x)],Za(this),B.start();function se(ie){if(Mi(ie),!B.moved){var fe=ie.clientX-P,pe=ie.clientY-Y;B.moved=fe*fe+pe*pe>g}B.event(ie).zoom("mouse",o(N(B.that.__zoom,B.mouse[0]=sn(ie,v),B.mouse[1]),B.extent,l))}function he(ie){M.on("mousemove.zoom mouseup.zoom",null),Cm(ie.view,B.moved),Mi(ie),B.event(ie).end()}}function D(w,...I){if(e.apply(this,arguments)){var v=this.__zoom,B=sn(w.changedTouches?w.changedTouches[0]:w,this),M=v.invert(B),x=v.k*(w.shiftKey?.5:2),P=o(N(E(v,x),B,M),n.apply(this,I),l);Mi(w),s>0?Jt(this).transition().duration(s).call(k,P,B,w):Jt(this).call(_.transform,P,B,w)}}function C(w,...I){if(e.apply(this,arguments)){var v=w.touches,B=v.length,M=S(this,I,w.changedTouches.length===B).event(w),x,P,Y,se;for(us(w),P=0;P<B;++P)Y=v[P],se=sn(Y,this),se=[se,this.__zoom.invert(se),Y.identifier],M.touch0?!M.touch1&&M.touch0[2]!==se[2]&&(M.touch1=se,M.taps=0):(M.touch0=se,x=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),x&&(M.taps<2&&(m=se[0],u=setTimeout(function(){u=null},f)),Za(this),M.start())}}function R(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P,Y,se;for(Mi(w),x=0;x<M;++x)P=B[x],Y=sn(P,this),v.touch0&&v.touch0[2]===P.identifier?v.touch0[0]=Y:v.touch1&&v.touch1[2]===P.identifier&&(v.touch1[0]=Y);if(P=v.that.__zoom,v.touch1){var he=v.touch0[0],ie=v.touch0[1],fe=v.touch1[0],pe=v.touch1[1],ge=(ge=fe[0]-he[0])*ge+(ge=fe[1]-he[1])*ge,Te=(Te=pe[0]-ie[0])*Te+(Te=pe[1]-ie[1])*Te;P=E(P,Math.sqrt(ge/Te)),Y=[(he[0]+fe[0])/2,(he[1]+fe[1])/2],se=[(ie[0]+pe[0])/2,(ie[1]+pe[1])/2]}else if(v.touch0)Y=v.touch0[0],se=v.touch0[1];else return;v.zoom("touch",o(N(P,Y,se),v.extent,l))}}function $(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P;for(us(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),x=0;x<M;++x)P=B[x],v.touch0&&v.touch0[2]===P.identifier?delete v.touch0:v.touch1&&v.touch1[2]===P.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(P=sn(P,this),Math.hypot(m[0]-P[0],m[1]-P[1])<b)){var Y=Jt(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Qa(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Qa(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Qa(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Qa([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,_):Math.sqrt(g)},_.tapDistance=function(w){return arguments.length?(b=+w,_):b},_}var Oe=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Oe||{}),ms=(e=>(e.Partial="partial",e.Full="full",e))(ms||{}),yo=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(yo||{}),Sn=(e=>(e.Strict="strict",e.Loose="loose",e))(Sn||{}),fs=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(fs||{}),Vi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Vi||{}),tf=(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))(tf||{});const oN=["INPUT","SELECT","TEXTAREA"],iN=typeof document<"u"?document:null;function ps(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 oN.includes(i==null?void 0:i.nodeName)||a||!!r}function aN(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function nf(e,n,o,i){const a=n.replace("+",`
|
|
28
28
|
`).replace(`
|
|
29
29
|
|
|
30
30
|
`,`
|
|
@@ -49,7 +49,7 @@ Edge: ${e}
|
|
|
49
49
|
Source: ${n}
|
|
50
50
|
Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
51
51
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
52
|
-
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 wt extends Error{constructor(n,...o){var i;super((i=Sf[n])==null?void 0:i.call(Sf,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function ks(e){return"clientX"in e}function IN(e){return"sourceEvent"in e}function mn(e,n){const o=ks(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 zi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function vN(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 ar(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const CN=()=>!0;function Es(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function SN(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())tr(a,er(r))>0&&i.push(r);return i}const xN=250;function RN(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=SN(e,o,n+xN);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:p,y:f}=Zo(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}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 xf(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=CN},u,m,p,f){const h=r==="target",g=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:b,y:_}=mn(e),k=l.elementFromPoint(b,_),N=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:g,y={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const E=Rf(void 0,N),S=N.getAttribute("data-nodeid"),A=N.getAttribute("data-handleid"),V=N.classList.contains("connectable"),T=N.classList.contains("connectableend");if(!S||!E)return y;const D={source:h?S:i,sourceHandle:h?A:a,target:h?i:S,targetHandle:h?a:A};y.connection=D;const R=V&&T&&(o===Sn.Strict?h&&E==="source"||!h&&E==="target":S!==i||A!==a);y.isValid=R&&d(D,{nodes:m,edges:u,sourceNode:p(D.source),targetNode:p(D.target)}),y.toHandle=Af(S,E,A,f,o,!0)}return y}function Rf(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function AN(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function $N(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Af(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Sn.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)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Zo(d,m,m.position,!0)}:m}const Ns={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},TN=["production","prod"];function Fi(e,...n){$f()&&console.warn(`[Vue Flow]: ${e}`,...n)}function $f(){return!TN.includes(process.env.NODE_ENV||"")}function Tf(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,...nr(l)}}):null}function ws(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 Et(e){return typeof t.unref(e)<"u"}function MN(e,n,o,i){if(!e||!e.source||!e.target)return o(new wt(kt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Un(e)?a=e:a={...e,id:uf(e)},a=cf(a,void 0,i),fN(a,n)?!1:a}function VN(e,n,o,i,a){if(!n.source||!n.target)return a(new wt(kt.EDGE_INVALID,e.id)),!1;if(!o)return a(new wt(kt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?uf(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Mf(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!bo(l)){o(new wt(kt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=dN(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 wt(kt.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 Vf(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 Is(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}`,u=`${r}-${s}--${a}-${l}`;Vf("source",c,u,e,a,l),Vf("target",c,d,e,r,s)}}function Bf(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function vs(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Un(d)?d:MN(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new wt(kt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new wt(kt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new wt(kt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new wt(kt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...cf(u,f,r),sourceNode:m,targetNode:p})}return c}const Df=Symbol("vueFlow"),Of=Symbol("nodeId"),Lf=Symbol("nodeRef"),BN=Symbol("edgeId"),DN=Symbol("edgeRef"),rr=Symbol("slots");function Pf(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:k,updateNodePositions:N,emits:y}=tt(),{onStart:E,onDrag:S,onStop:A,onClick:V,el:T,disabled:D,id:C,selectable:R,dragHandle:$}=e,w=t.shallowRef(!1);let I=[],v,B=null,M={x:void 0,y:void 0},x={x:0,y:0},P=null,Y=!1,se=!1,he=0,ie=!1;const fe=PN(),pe=({x:re,y:ue})=>{M={x:re,y:ue};let z=!1;if(I=I.map(L=>{const F={x:re-L.distance.x,y:ue-L.distance.y},{computedPosition:X}=_s(L,o.value?ar(F,i.value):F,y.error,l.value,L.parentNode?f(L.parentNode):void 0);return z=z||L.position.x!==X.x||L.position.y!==X.y,L.position=X,L}),se=se||z,!!z&&(N(I,!0,!0),w.value=!0,P)){const[L,F]=bs({id:C,dragItems:I,findNode:f});S({event:P,node:L,nodes:F})}},ge=()=>{if(!B)return;const[re,ue]=bf(x,B,u.value);if(re!==0||ue!==0){const z={x:(M.x??0)-re/c.value.zoom,y:(M.y??0)-ue/c.value.zoom};p({x:re,y:ue})&&pe(z)}he=requestAnimationFrame(ge)},Te=(re,ue)=>{Y=!0;const z=f(C);!b.value&&!h.value&&z&&(z.selected||_()),z&&t.toValue(R)&&b.value&&ws(z,h.value,k,_,g,!1,ue);const L=fe(re.sourceEvent);if(M=L,I=bN(r.value,m.value,L,C),I.length){const[F,X]=bs({id:C,dragItems:I,findNode:f});E({event:re.sourceEvent,node:F,nodes:X})}},He=(re,ue)=>{var z;re.sourceEvent.type==="touchmove"&&re.sourceEvent.touches.length>1||(se=!1,s.value===0&&Te(re,ue),M=fe(re.sourceEvent),B=((z=n.value)==null?void 0:z.getBoundingClientRect())||null,x=mn(re.sourceEvent,B))},De=(re,ue)=>{const z=fe(re.sourceEvent);if(!ie&&Y&&d.value&&(ie=!0,ge()),!Y){const L=z.xSnapped-(M.x??0),F=z.ySnapped-(M.y??0);Math.sqrt(L*L+F*F)>s.value&&Te(re,ue)}(M.x!==z.xSnapped||M.y!==z.ySnapped)&&I.length&&Y&&(P=re.sourceEvent,x=mn(re.sourceEvent,B),pe(z))},Z=re=>{let ue=!1;if(!Y&&!w.value&&!h.value){const z=re.sourceEvent,L=fe(z),F=L.xSnapped-(M.x??0),X=L.ySnapped-(M.y??0),ee=Math.sqrt(F*F+X*X);ee!==0&&ee<=s.value&&(V==null||V(z),ue=!0)}if(I.length&&!ue){se&&(N(I,!1,!1),se=!1);const[z,L]=bs({id:C,dragItems:I,findNode:f});A({event:re.sourceEvent,node:z,nodes:L})}I=[],w.value=!1,ie=!1,Y=!1,M={x:void 0,y:void 0},cancelAnimationFrame(he)};return t.watch([()=>t.toValue(D),T],([re,ue],z,L)=>{if(ue){const F=Jt(ue);re||(v=c1().on("start",X=>He(X,ue)).on("drag",X=>De(X,ue)).on("end",X=>Z(X)).filter(X=>{const ee=X.target,ke=t.toValue($);return!X.button&&(!a.value||!If(ee,`.${a.value}`,ue)&&(!ke||If(ee,ke,ue)))}),F.call(v)),L(()=>{F.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),w}function ON(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function LN(e,n){const o=ON();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 PN(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=tt();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=IN(a)?a.sourceEvent:a,{x:c,y:d}=mn(s,l),u=Li({x:c,y:d},e.value),{x:m,y:p}=o.value?ar(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function lr(){return!0}function zf({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:g,findNode:b,panBy:_,startConnection:k,updateConnection:N,endConnection:y,emits:E,viewport:S,edges:A,nodes:V,isValidConnection:T,nodeLookup:D}=tt();let C=null,R=!1,$=null;function w(v){var B;const M=t.toValue(o)==="target",x=ks(v),P=sf(v.target),Y=v.currentTarget;if(Y&&(x&&v.button===0||!x)){let se=function(we){z=mn(we,Z),pe=RN(Li(z,S.value,!1,[1,1]),u.value,D.value,X),L||(F(),L=!0);const G=xf(we,{handle:pe,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:fe,doc:P,lib:"vue",flowId:s,nodeLookup:D.value},A.value,V.value,b,D.value);$=G.handleDomNode,C=G.connection,R=$N(!!pe,G.isValid);const q={...Ne,isValid:R,to:G.toHandle&&R?Oi({x:G.toHandle.x,y:G.toHandle.y},S.value):z,toHandle:G.toHandle,toPosition:R&&G.toHandle?G.toHandle.position:Ns[X.position],toNode:G.toHandle?D.value.get(G.toHandle.nodeId):null};if(R&&pe&&(Ne!=null&&Ne.toHandle)&&q.toHandle&&Ne.toHandle.type===q.toHandle.type&&Ne.toHandle.nodeId===q.toHandle.nodeId&&Ne.toHandle.id===q.toHandle.id&&Ne.to.x===q.to.x&&Ne.to.y===q.to.y)return;const W=pe??G.toHandle;if(N(W&&R?Oi({x:W.x,y:W.y},S.value):z,W,AN(!!W,R)),Ne=q,!pe&&!R&&!$)return Es(ue);C&&C.source!==C.target&&$&&(Es(ue),ue=$,$.classList.add("connecting","vue-flow__handle-connecting"),$.classList.toggle("valid",!!R),$.classList.toggle("vue-flow__handle-valid",!!R))},he=function(we){"touches"in we&&we.touches.length>0||((pe||$)&&C&&R&&(r?r(we,C):E.connect(C)),E.connectEnd(we),a&&(l==null||l(we)),Es(ue),cancelAnimationFrame(ge),y(we),L=!1,R=!1,C=null,$=null,P.removeEventListener("mousemove",se),P.removeEventListener("mouseup",he),P.removeEventListener("touchmove",se),P.removeEventListener("touchend",he))};const ie=b(t.toValue(n));let fe=t.toValue(i)||T.value||lr;!fe&&ie&&(fe=(M?ie.isValidSourcePos:ie.isValidTargetPos)||lr);let pe,ge=0;const{x:Te,y:He}=mn(v),De=Rf(t.toValue(a),Y),Z=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!Z||!De)return;const re=Af(t.toValue(n),De,t.toValue(e),D.value,d.value);if(!re)return;let ue,z=mn(v,Z),L=!1;const F=()=>{if(!h.value)return;const[we,G]=bf(z,Z,g.value);_({x:we,y:G}),ge=requestAnimationFrame(F)},X={...re,nodeId:t.toValue(n),type:De,position:re.position},ee=D.value.get(t.toValue(n)),ye={inProgress:!0,isValid:null,from:Zo(ee,X,Oe.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ee,to:z,toHandle:null,toPosition:Ns[X.position],toNode:null};k({nodeId:t.toValue(n),id:t.toValue(e),type:De,position:(Y==null?void 0:Y.getAttribute("data-handlepos"))||Oe.Top,...z},{x:Te-Z.left,y:He-Z.top}),E.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:De});let Ne=ye;P.addEventListener("mousemove",se),P.addEventListener("mouseup",he),P.addEventListener("touchmove",se),P.addEventListener("touchend",he)}}function I(v){var B,M;if(!m.value)return;const x=t.toValue(o)==="target";if(!p.value){E.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Oe.Top,...mn(v)},void 0,!0);return}let P=t.toValue(i)||T.value||lr;const Y=b(t.toValue(n));if(!P&&Y&&(P=(x?Y.isValidSourcePos:Y.isValidTargetPos)||lr),Y&&(typeof Y.connectable>"u"?f.value:Y.connectable)===!1)return;const se=sf(v.target),he=xf(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Oe.Top,...mn(v)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:P,doc:se,lib:"vue",flowId:s,nodeLookup:D.value},A.value,V.value,b,D.value),ie=((B=he.connection)==null?void 0:B.source)===((M=he.connection)==null?void 0:M.target);he.isValid&&he.connection&&!ie&&E.connect(he.connection),E.clickConnectEnd(v),y(v,!0)}return{handlePointerDown:w,handleClick:I}}function zN(){return t.inject(Of,"")}function Ff(e){const n=e??zN()??"",o=t.inject(Lf,t.ref(null)),{findNode:i,edges:a,emits:r}=tt(),l=i(n);return l||r.error(new wt(kt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>_o([l],a.value))}}function FN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function UN(e,n){const o=FN();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 Uf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=tt();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,g=[];for(const b of e.value)if(b.draggable||l&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+f,y:b.computedPosition.y+h},{position:k}=_s(b,_,s.error,n.value,b.parentNode?i(b.parentNode):void 0);g.push({id:b.id,position:k,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(g,!0,!1)}}const sr=.1,HN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kn(){return Fi("Viewport not initialized yet."),Promise.resolve(!1)}const jN={zoomIn:Kn,zoomOut:Kn,zoomTo:Kn,fitView:Kn,setCenter:Kn,fitBounds:Kn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kn,setTransform:Kn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function KN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?xi:ja).scaleBy(Cs(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}=lf({x:-i,y:-a},e.translateExtent),m=Wo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?xi:ja).transform(Cs(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):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"?xi:ja).scaleTo(Cs(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:sr,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=hs(s),{x:d,y:u,zoom:m}=hf(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??sr);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:sr})=>{const{x:l,y:s,zoom:c}=hf(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??sr);return o(l,s,c,r)},project:a=>Li(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 Li(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 Oi(s,e.viewport)}return{x:0,y:0}}}:jN)}function Cs(e,n=0,o=HN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function GN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,b,_=!!(o.nodes.value.length||o.edges.value.length);g=jo([e.modelValue,()=>{var k,N;return(N=(k=e.modelValue)==null?void 0:k.value)==null?void 0:N.length}],([k])=>{k&&Array.isArray(k)&&(b==null||b.pause(),o.setElements(k),!b&&!_&&k.length?_=!0:b==null||b.resume())}),b=jo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,N])=>{var y;(y=e.modelValue)!=null&&y.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...k,...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let g,b,_=!!o.nodes.value.length;g=jo([e.nodes,()=>{var k,N;return(N=(k=e.nodes)==null?void 0:k.value)==null?void 0:N.length}],([k])=>{k&&Array.isArray(k)&&(b==null||b.pause(),o.setNodes(k),!b&&!_&&k.length?_=!0:b==null||b.resume())}),b=jo([o.nodes,()=>o.nodes.value.length],([k])=>{var N;(N=e.nodes)!=null&&N.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...k],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let g,b,_=!!o.edges.value.length;g=jo([e.edges,()=>{var k,N;return(N=(k=e.edges)==null?void 0:k.value)==null?void 0:N.length}],([k])=>{k&&Array.isArray(k)&&(b==null||b.pause(),o.setEdges(k),!b&&!_&&k.length?_=!0:b==null||b.resume())}),b=jo([o.edges,()=>o.edges.value.length],([k])=>{var N;(N=e.edges)!=null&&N.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...k],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&Et(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&Et(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&Et(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&Et(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{Et(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async b=>{let _=b;typeof n.autoConnect=="function"&&(_=await n.autoConnect(b)),_!==!1&&o.addEdges([_])};t.watch(()=>n.autoConnect,()=>{Et(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(b,_,k)=>{b?o.onConnect(g):o.hooks.value.connect.off(g),k(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(n)){const _=b;if(!g.includes(_)){const k=t.toRef(()=>n[_]),N=o[_];t.isRef(N)&&i.run(()=>{t.watch(k,y=>{Et(y)&&(N.value=y)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function YN(){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=>Fi(e.message))}}function qN(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),Ni(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),Ni(r.removeHasEmitListeners)}});function i(a){var r;const l=WN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function WN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Hf(){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:ms.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Vi.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:yo.Bezier,style:{}},connectionMode:Sn.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:zi()?"Meta":"Control",zoomActivationKeyCode:zi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:YN(),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 JN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function XN(e,n,o){const i=KN(e),a=z=>{const L=z??[];e.hooks.updateNodeInternals.trigger(L)},r=z=>mN(z,e.nodes,e.edges),l=z=>uN(z,e.nodes,e.edges),s=z=>_o(z,e.edges),c=({id:z,type:L,nodeId:F})=>{var X;const ee=z?`-${L}-${z}`:`-${L}`;return Array.from(((X=e.connectionLookup.get(`${F}${ee}`))==null?void 0:X.values())??[])},d=z=>{if(z)return n.value.get(z)},u=z=>{if(z)return o.value.get(z)},m=(z,L,F)=>{var X,ee;const ke=[];for(const ye of z){const Ne={id:ye.id,type:"position",dragging:F,from:ye.from};if(L&&(Ne.position=ye.position,ye.parentNode)){const we=d(ye.parentNode);Ne.position={x:Ne.position.x-(((X=we==null?void 0:we.computedPosition)==null?void 0:X.x)??0),y:Ne.position.y-(((ee=we==null?void 0:we.computedPosition)==null?void 0:ee.y)??0)}}ke.push(Ne)}ke!=null&&ke.length&&e.hooks.nodesChange.trigger(ke)},p=z=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const F=window.getComputedStyle(L),{m22:X}=new window.DOMMatrixReadOnly(F.transform),ee=[];for(const ke of z){const ye=ke,Ne=d(ye.id);if(Ne){const we=nr(ye.nodeElement);if(!!(we.width&&we.height&&(Ne.dimensions.width!==we.width||Ne.dimensions.height!==we.height||ye.forceUpdate))){const q=ye.nodeElement.getBoundingClientRect();Ne.dimensions=we,Ne.handleBounds.source=Tf("source",ye.nodeElement,q,X,Ne.id),Ne.handleBounds.target=Tf("target",ye.nodeElement,q,X,Ne.id),ee.push({id:Ne.id,type:"dimensions",dimensions:we})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ee.length&&e.hooks.nodesChange.trigger(ee)},f=(z,L)=>{const F=new Set,X=new Set;for(const ye of z)bo(ye)?F.add(ye.id):Un(ye)&&X.add(ye.id);const ee=jn(n.value,F,!0),ke=jn(o.value,X);if(e.multiSelectionActive){for(const ye of F)ee.push(Hn(ye,L));for(const ye of X)ke.push(Hn(ye,L))}ee.length&&e.hooks.nodesChange.trigger(ee),ke.length&&e.hooks.edgesChange.trigger(ke)},h=z=>{if(e.multiSelectionActive){const L=z.map(F=>Hn(F.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(jn(n.value,new Set(z.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(jn(o.value))},g=z=>{if(e.multiSelectionActive){const L=z.map(F=>Hn(F.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(jn(o.value,new Set(z.map(L=>L.id)))),e.hooks.nodesChange.trigger(jn(n.value,new Set,!0))},b=z=>{f(z,!0)},_=z=>{const F=(z||e.nodes).map(X=>(X.selected=!1,Hn(X.id,!1)));e.hooks.nodesChange.trigger(F)},k=z=>{const F=(z||e.edges).map(X=>(X.selected=!1,Hn(X.id,!1)));e.hooks.edgesChange.trigger(F)},N=z=>{if(!z||!z.length)return f([],!1);const L=z.reduce((F,X)=>{const ee=Hn(X.id,!1);return bo(X)?F.nodes.push(ee):F.edges.push(ee),F},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},y=z=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([z,e.maxZoom]),e.minZoom=z},E=z=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,z]),e.maxZoom=z},S=z=>{var L;(L=e.d3Zoom)==null||L.translateExtent(z),e.translateExtent=z},A=z=>{e.nodeExtent=z,a()},V=z=>{var L;(L=e.d3Zoom)==null||L.clickDistance(z)},T=z=>{e.nodesDraggable=z,e.nodesConnectable=z,e.elementsSelectable=z},D=z=>{const L=z instanceof Function?z(e.nodes):z;!e.initialized&&!L.length||(e.nodes=Mf(L,d,e.hooks.error.trigger))},C=z=>{const L=z instanceof Function?z(e.edges):z;if(!e.initialized&&!L.length)return;const F=vs(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Is(e.connectionLookup,o.value,F),e.edges=F},R=z=>{const L=z instanceof Function?z([...e.nodes,...e.edges]):z;!e.initialized&&!L.length||(D(L.filter(bo)),C(L.filter(Un)))},$=z=>{let L=z instanceof Function?z(e.nodes):z;L=Array.isArray(L)?L:[L];const F=Mf(L,d,e.hooks.error.trigger),X=[];for(const ee of F)X.push(kf(ee));X.length&&e.hooks.nodesChange.trigger(X)},w=z=>{let L=z instanceof Function?z(e.edges):z;L=Array.isArray(L)?L:[L];const F=vs(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),X=[];for(const ee of F)X.push(kf(ee));X.length&&e.hooks.edgesChange.trigger(X)},I=(z,L=!0,F=!1)=>{const X=z instanceof Function?z(e.nodes):z,ee=Array.isArray(X)?X:[X],ke=[],ye=[];function Ne(G){const q=s(G);for(const W of q)(!Et(W.deletable)||W.deletable)&&ye.push(Nf(W.id,W.source,W.target,W.sourceHandle,W.targetHandle))}function we(G){const q=[];for(const W of e.nodes)W.parentNode===G&&q.push(W);if(q.length){for(const W of q)ke.push(Ef(W.id));L&&Ne(q);for(const W of q)we(W.id)}}for(const G of ee){const q=typeof G=="string"?d(G):G;q&&(Et(q.deletable)&&!q.deletable||(ke.push(Ef(q.id)),L&&Ne([q]),F&&we(q.id)))}ye.length&&e.hooks.edgesChange.trigger(ye),ke.length&&e.hooks.nodesChange.trigger(ke)},v=z=>{const L=z instanceof Function?z(e.edges):z,F=Array.isArray(L)?L:[L],X=[];for(const ee of F){const ke=typeof ee=="string"?u(ee):ee;ke&&(Et(ke.deletable)&&!ke.deletable||X.push(Nf(typeof ee=="string"?ee:ee.id,ke.source,ke.target,ke.sourceHandle,ke.targetHandle)))}e.hooks.edgesChange.trigger(X)},B=(z,L,F=!0)=>{const X=u(z.id);if(!X)return!1;const ee=e.edges.indexOf(X),ke=VN(z,L,X,F,e.hooks.error.trigger);if(ke){const[ye]=vs([ke],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ne,we)=>we===ee?ye:Ne),Is(e.connectionLookup,o.value,[ye]),ye}return!1},M=(z,L,F={replace:!1})=>{const X=u(z);if(!X)return;const ee=typeof L=="function"?L(X):L;X.data=F.replace?ee:{...X.data,...ee}},x=z=>_f(z,e.nodes),P=z=>{const L=_f(z,e.edges);return Is(e.connectionLookup,o.value,L),L},Y=(z,L,F={replace:!1})=>{const X=d(z);if(!X)return;const ee=typeof L=="function"?L(X):L;F.replace?e.nodes.splice(e.nodes.indexOf(X),1,ee):Object.assign(X,ee)},se=(z,L,F={replace:!1})=>{const X=d(z);if(!X)return;const ee=typeof L=="function"?L(X):L;X.data=F.replace?ee:{...X.data,...ee}},he=(z,L,F=!1)=>{F?e.connectionClickStartHandle=z:e.connectionStartHandle=z,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},ie=(z,L=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=z,e.connectionEndHandle=L,e.connectionStatus=F)},fe=(z,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},pe=z=>{const L=cN(z),F=L?null:Di(z)?z:d(z.id);return!L&&!F?[null,null,L]:[L?z:er(F),F,L]},ge=(z,L=!0,F=e.nodes)=>{const[X,ee,ke]=pe(z);if(!X)return[];const ye=[];for(const Ne of F||e.nodes){if(!ke&&(Ne.id===ee.id||!Ne.computedPosition))continue;const we=er(Ne),G=tr(we,X);(L&&G>0||G>=we.width*we.height||G>=Number(X.width)*Number(X.height))&&ye.push(Ne)}return ye},Te=(z,L,F=!0)=>{const[X]=pe(z);if(!X)return!1;const ee=tr(X,L);return F&&ee>0||ee>=Number(X.width)*Number(X.height)},He=z=>{const{viewport:L,dimensions:F,d3Zoom:X,d3Selection:ee,translateExtent:ke}=e;if(!X||!ee||!z.x&&!z.y)return!1;const ye=Wo.translate(L.x+z.x,L.y+z.y).scale(L.zoom),Ne=[[0,0],[F.width,F.height]],we=X.constrain()(ye,Ne,ke),G=e.viewport.x!==we.x||e.viewport.y!==we.y||e.viewport.zoom!==we.k;return X.transform(ee,we),G},De=z=>{const L=z instanceof Function?z(e):z,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Et(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const X=L.modelValue||L.nodes||L.edges?[]:void 0;X&&(L.modelValue&&X.push(...L.modelValue),L.nodes&&X.push(...L.nodes),L.edges&&X.push(...L.edges),R(X));const ee=()=>{Et(L.maxZoom)&&E(L.maxZoom),Et(L.minZoom)&&y(L.minZoom),Et(L.translateExtent)&&S(L.translateExtent)};for(const ke of Object.keys(L)){const ye=ke,Ne=L[ye];![...JN,...F].includes(ye)&&Et(Ne)&&(e[ye]=Ne)}Kl(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:R,setNodes:D,setEdges:C,addNodes:$,addEdges:w,removeNodes:I,removeEdges:v,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:M,updateNode:Y,updateNodeData:se,applyEdgeChanges:P,applyNodeChanges:x,addSelectedElements:b,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:y,setMaxZoom:E,setTranslateExtent:S,setNodeExtent:A,setPaneClickDistance:V,removeSelectedElements:N,removeSelectedNodes:_,removeSelectedEdges:k,startConnection:he,updateConnection:ie,endConnection:fe,setInteractive:T,setState:De,getIntersectingNodes:ge,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Te,panBy:He,fitView:z=>i.value.fitView(z),zoomIn:z=>i.value.zoomIn(z),zoomOut:z=>i.value.zoomOut(z),zoomTo:(z,L)=>i.value.zoomTo(z,L),setViewport:(z,L)=>i.value.setViewport(z,L),setTransform:(z,L)=>i.value.setTransform(z,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(z,L,F)=>i.value.setCenter(z,L,F),fitBounds:(z,L)=>i.value.fitBounds(z,L),project:z=>i.value.project(z),screenToFlowCoordinate:z=>i.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>i.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],L=[];for(const F of e.nodes){const{computedPosition:X,handleBounds:ee,selected:ke,dimensions:ye,isParent:Ne,resizing:we,dragging:G,events:q,...W}=F;z.push(W)}for(const F of e.edges){const{selected:X,sourceNode:ee,targetNode:ke,events:ye,...Ne}=F;L.push(Ne)}return JSON.parse(JSON.stringify({nodes:z,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:z=>new Promise(L=>{const{nodes:F,edges:X,position:ee,zoom:ke,viewport:ye}=z;F&&D(F),X&&C(X);const[Ne,we]=ye!=null&&ye.x&&(ye!=null&&ye.y)?[ye.x,ye.y]:ee??[null,null];if(Ne&&we){const G=(ye==null?void 0:ye.zoom)||ke||e.viewport.zoom;return Kl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ne,y:we,zoom:G}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const z=Hf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=Wo.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(go(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),F=e.viewportRef.getBoundingClientRect(),X=[[0,0],[F.width,F.height]],ee=e.d3Zoom.constrain()(L,X,z.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}De(z)},$destroy:()=>{}}}const ZN=["data-id","data-handleid","data-nodeid","data-handlepos"],QN={name:"Handle",compatConfig:{MODE:3}},ko=t.defineComponent({...QN,props:{id:{default:null},type:{},position:{default:()=>Oe.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:u,noDragClassName:m,noPanClassName:p}=tt(),{id:f,node:h,nodeEl:g,connectedEdges:b}=Ff(),_=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),N=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),y=t.toRef(()=>{var C,R,$,w,I,v;return((C=l.value)==null?void 0:C.nodeId)===f&&((R=l.value)==null?void 0:R.id)===e.id&&(($=l.value)==null?void 0:$.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),E=t.toRef(()=>{var C,R,$;return((C=s.value)==null?void 0:C.nodeId)===f&&((R=s.value)==null?void 0:R.id)===e.id&&(($=s.value)==null?void 0:$.type)===i.value}),{handlePointerDown:S,handleClick:A}=zf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),V=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(C=>{const R=C[`${i.value}Handle`];return C[i.value]!==f?!1:R?R===e.id:!0}):typeof e.connectable=="number"?b.value.filter(C=>{const R=C[`${i.value}Handle`];return C[i.value]!==f?!1:R?R===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,b.value):Et(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var C;if(!h.dimensions.width||!h.dimensions.height)return;const R=(C=h.handleBounds[i.value])==null?void 0:C.find(x=>x.id===e.id);if(!d.value||R)return;const $=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!$||!e.id)return;const w=g.value.getBoundingClientRect(),I=_.value.getBoundingClientRect(),v=window.getComputedStyle($),{m22:B}=new window.DOMMatrixReadOnly(v.transform),M={id:e.id,position:e.position,x:(I.left-w.left)/B,y:(I.top-w.top)/B,type:i.value,nodeId:f,...nr(_.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],M]});function T(C){const R=ks(C);V.value&&k.value&&(R&&C.button===0||!R)&&S(C)}function D(C){!f||!s.value&&!k.value||V.value&&A(C)}return n({handleClick:A,handlePointerDown:S,onClick:D,onPointerDown:T}),(C,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":C.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${C.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:V.value,connecting:E.value,connectablestart:k.value,connectableend:N.value,connectionindicator:V.value&&(k.value&&!y.value||N.value&&y.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:D},[t.renderSlot(C.$slots,"default",{id:C.id})],42,ZN))}}),cr=function({sourcePosition:e=Oe.Bottom,targetPosition:n=Oe.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(ko,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(ko,{type:"source",position:e,connectable:i,isValidConnection:r})]};cr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],cr.inheritAttrs=!1,cr.compatConfig={MODE:3};const ew=cr,dr=function({targetPosition:e=Oe.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(ko,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};dr.props=["targetPosition","label","isValidTargetPos","connectable","data"],dr.inheritAttrs=!1,dr.compatConfig={MODE:3};const tw=dr,ur=function({sourcePosition:e=Oe.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(ko,{type:"source",position:e,connectable:o,isValidConnection:i})]};ur.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ur.inheritAttrs=!1,ur.compatConfig={MODE:3};const nw=ur,ow=["transform"],iw=["width","height","x","y","rx","ry"],aw=["y"],rw={name:"EdgeText",compatConfig:{MODE:3}},lw=t.defineComponent({...rw,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,iw)):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,aw)],8,ow))}}),sw=["id","d","marker-end","marker-start"],cw=["d","stroke-width"],dw={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},mr=t.defineComponent({...dw,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,sw),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,cw)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(lw,{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 jf({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 Kf({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,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function fr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Gf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Oe.Left:l=n-fr(n-i,r),s=o;break;case Oe.Right:l=n+fr(i-n,r),s=o;break;case Oe.Top:l=n,s=o-fr(o-a,r);break;case Oe.Bottom:l=n,s=o+fr(a-o,r);break}return[l,s]}function Yf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top,curvature:s=.25}=e,[c,d]=Gf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Gf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,g]=Kf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,g]}function qf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Oe.Left:case Oe.Right:r=.5*(n+i),l=o;break;case Oe.Top:case Oe.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Wf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top}=e,[s,c]=qf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=qf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=Kf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const Jf={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}};function uw({source:e,sourcePosition:n=Oe.Bottom,target:o}){return n===Oe.Left||n===Oe.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 Xf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function mw({source:e,sourcePosition:n=Oe.Bottom,target:o,targetPosition:i=Oe.Top,center:a,offset:r}){const l=Jf[n],s=Jf[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=uw({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,g;const b={x:0,y:0},_={x:0,y:0},[k,N,y,E]=jf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??k,g=a.y??N;const A=[{x:h,y:c.y},{x:h,y:d.y}],V=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===p?f=m==="x"?A:V:f=m==="x"?V:A}else{const A=[{x:c.x,y:d.y}],V=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?V:A:f=l.y===p?A:V,n===i){const $=Math.abs(e[m]-o[m]);if($<=r){const w=Math.min(r-1,r-$);l[m]===p?b[m]=(c[m]>e[m]?-1:1)*w:_[m]=(d[m]>o[m]?-1:1)*w}}if(n!==i){const $=m==="x"?"y":"x",w=l[m]===s[$],I=c[$]>d[$],v=c[$]<d[$];(l[m]===1&&(!w&&I||w&&v)||l[m]!==1&&(!w&&v||w&&I))&&(f=m==="x"?A:V)}const T={x:c.x+b.x,y:c.y+b.y},D={x:d.x+_.x,y:d.y+_.y},C=Math.max(Math.abs(T.x-f[0].x),Math.abs(D.x-f[0].x)),R=Math.max(Math.abs(T.y-f[0].y),Math.abs(D.y-f[0].y));C>=R?(h=(T.x+D.x)/2,g=f[0].y):(h=f[0].x,g=(T.y+D.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...f,{x:d.x+_.x,y:d.y+_.y},o],h,g,y,E]}function fw(e,n,o,i){const a=Math.min(Xf(e,n)/2,Xf(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,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 Ss(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,g]=mw({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((_,k,N)=>{let y;return N>0&&N<m.length-1?y=fw(m[N-1],k,m[N+1],s):y=`${N===0?"M":"L"}${k.x} ${k.y}`,_+=y,_},""),p,f,h,g]}function pw(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=jf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const hw=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]=pw(e);return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),Zf=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]=Ss({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),yw=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(Zf,{...e,...n,borderRadius:0})}}),gw=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]=Yf({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),bw=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]=Wf({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),_w={input:nw,default:ew,output:tw},kw={default:gw,straight:hw,step:yw,smoothstep:Zf,simplebezier:bw};function Ew(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...kw,...e.edgeTypes},b=Object.keys(g);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),l=t.computed(()=>{const g={..._w,...e.nodeTypes},b=Object.keys(g);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?pf(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 g=[];for(const b of e.edges){const _=n.value.get(b.source),k=n.value.get(b.target);NN({sourcePos:_.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:_.dimensions.width,sourceHeight:_.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(b)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const b of e.nodes)b.selected&&g.push(b);return g}),m=t.computed(()=>{const g=[];for(const b of e.edges)b.selected&&g.push(b);return g}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&g.push(b);return g}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class Eo{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)??Eo.instance;return Eo.instance=i??new Eo,o&&(o.config.globalProperties.$vueFlowStorage=Eo.instance),Eo.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=Hf(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=Ew(a,s,c),u=XN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...bk(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function tt(e){const n=Eo.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(Df,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,(m,p,f)=>{const h=b=>{d.applyNodeChanges(b)},g=b=>{d.applyEdgeChanges(b)};m?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),Ni(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Fi(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Df,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new wt(kt.USEVUEFLOW_OPTIONS))}return s}function Nw(e){const{emits:n,dimensions:o}=tt();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=nr(e.value);(s.width===0||s.height===0)&&n.error(new wt(kt.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 ww={name:"UserSelection",compatConfig:{MODE:3}},Iw=t.defineComponent({...ww,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))}}),vw=["tabIndex"],Cw={name:"NodesSelection",compatConfig:{MODE:3}},Sw=t.defineComponent({...Cw,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=tt(),s=Uf(),c=t.ref(null),d=Pf({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>hs(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||Jo[h.key]&&(h.preventDefault(),s({x:Jo[h.key].x,y:Jo[h.key].y},h.shiftKey))}return(h,g)=>!t.unref(l)&&u.value.width&&u.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(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,vw)],6)):t.createCommentVNode("",!0)}});function xw(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const Rw={name:"Pane",compatConfig:{MODE:3}},Aw=t.defineComponent({...Rw,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:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:k,nodeLookup:N,connectionLookup:y,defaultEdgeOptions:E,connectionStartHandle:S,panOnDrag:A}=tt(),V=t.shallowRef(null),T=t.shallowRef(new Set),D=t.shallowRef(new Set),C=t.shallowRef(null),R=t.toRef(()=>c.value&&(e.isSelecting||r.value)),$=t.toRef(()=>S.value!==null);let w=!1,I=!1;const v=Bi(g,{actInsideInputWithModifier:!1}),B=Bi(b);t.watch(v,fe=>{fe&&(p(m.value),f(u.value),d.value=!1)}),t.watch(B,fe=>{_.value=fe});function M(fe,pe){return ge=>{ge.target===pe&&(fe==null||fe(ge))}}function x(fe){if(w||$.value){w=!1;return}a.paneClick(fe),l(),d.value=!1}function P(fe){var pe;if(Array.isArray(A.value)&&((pe=A.value)!=null&&pe.includes(2))){fe.preventDefault();return}a.paneContextMenu(fe)}function Y(fe){a.paneScroll(fe)}function se(fe){var pe,ge,Te;if(C.value=((pe=n.value)==null?void 0:pe.getBoundingClientRect())??null,!c.value||!e.isSelecting||fe.button!==0||fe.target!==V.value||!C.value)return;(Te=(ge=fe.target)==null?void 0:ge.setPointerCapture)==null||Te.call(ge,fe.pointerId);const{x:He,y:De}=xw(fe,C.value);I=!0,w=!1,l(),s.value={width:0,height:0,startX:He,startY:De,x:He,y:De},a.selectionStart(fe)}function he(fe){var pe;if(!C.value||!s.value)return;w=!0;const{x:ge,y:Te}=mn(fe,C.value),{startX:He=0,startY:De=0}=s.value,Z={startX:He,startY:De,x:ge<He?ge:He,y:Te<De?Te:De,width:Math.abs(ge-He),height:Math.abs(Te-De)},re=T.value,ue=D.value;T.value=new Set(pf(o.value,Z,i.value,h.value===ms.Partial,!0).map(L=>L.id)),D.value=new Set;const z=((pe=E.value)==null?void 0:pe.selectable)??!0;for(const L of T.value){const F=y.value.get(L);if(F)for(const{edgeId:X}of F.values()){const ee=k.value.get(X);ee&&(ee.selectable??z)&&D.value.add(X)}}if(!Bf(re,T.value)){const L=jn(N.value,T.value,!0);a.nodesChange(L)}if(!Bf(ue,D.value)){const L=jn(k.value,D.value);a.edgesChange(L)}s.value=Z,r.value=!0,d.value=!1}function ie(fe){var pe;fe.button!==0||!I||((pe=fe.target)==null||pe.releasePointerCapture(fe.pointerId),!r.value&&s.value&&fe.target===V.value&&x(fe),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(fe),e.selectionKeyPressed&&(w=!1),I=!1)}return(fe,pe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:V,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:fe.isSelecting}]),onClick:pe[0]||(pe[0]=ge=>R.value?void 0:M(x,V.value)(ge)),onContextmenu:pe[1]||(pe[1]=ge=>M(P,V.value)(ge)),onWheelPassive:pe[2]||(pe[2]=ge=>M(Y,V.value)(ge)),onPointerenter:pe[3]||(pe[3]=ge=>R.value?void 0:t.unref(a).paneMouseEnter(ge)),onPointerdown:pe[4]||(pe[4]=ge=>R.value?se(ge):t.unref(a).paneMouseMove(ge)),onPointermove:pe[5]||(pe[5]=ge=>R.value?he(ge):t.unref(a).paneMouseMove(ge)),onPointerup:pe[6]||(pe[6]=ge=>R.value?ie(ge):void 0),onPointerleave:pe[7]||(pe[7]=ge=>t.unref(a).paneMouseLeave(ge))},[t.renderSlot(fe.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(Iw,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(Sw,{key:1})):t.createCommentVNode("",!0)],34))}}),$w={name:"Transform",compatConfig:{MODE:3}},Tw=t.defineComponent({...$w,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=tt(),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))}}),Mw={name:"Viewport",compatConfig:{MODE:3}},Vw=t.defineComponent({...Mw,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:g,noWheelClassName:b,noPanClassName:_,emits:k,connectionStartHandle:N,userSelectionActive:y,paneDragging:E,d3Zoom:S,d3Selection:A,d3ZoomHandler:V,viewport:T,viewportRef:D,paneClickDistance:C}=tt();Nw(D);const R=t.shallowRef(!1),$=t.shallowRef(!1);let w=null,I=!1,v=0,B={x:0,y:0,zoom:0};const M=Bi(s),x=Bi(l),P=Bi(r),Y=t.toRef(()=>(!x.value||x.value&&l.value===!0)&&(M.value||m.value)),se=t.toRef(()=>M.value||c.value),he=t.toRef(()=>l.value===!0&&Y.value!==!0),ie=t.toRef(()=>x.value&&l.value!==!0||y.value||he.value),fe=t.toRef(()=>N.value!==null);t.onMounted(()=>{if(!D.value){Fi("Viewport element is missing");return}const De=D.value,Z=De.getBoundingClientRect(),re=nN().clickDistance(C.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Jt(De).call(re),z=ue.on("wheel.zoom"),L=Wo.translate(i.value.x??0,i.value.y??0).scale(go(i.value.zoom??1,n.value,o.value)),F=[[0,0],[Z.width,Z.height]],X=re.constrain()(L,F,a.value);re.transform(ue,X),re.wheelDelta(ys),S.value=re,A.value=ue,V.value=z,T.value={x:X.x,y:X.y,zoom:X.k},re.on("start",ee=>{var ke;if(!ee.sourceEvent)return null;v=ee.sourceEvent.button,R.value=!0;const ye=Te(ee.transform);((ke=ee.sourceEvent)==null?void 0:ke.type)==="mousedown"&&(E.value=!0),B=ye,k.viewportChangeStart(ye),k.moveStart({event:ee,flowTransform:ye})}),re.on("end",ee=>{if(!ee.sourceEvent)return null;if(R.value=!1,E.value=!1,pe(Y.value,v??0)&&!I&&k.paneContextMenu(ee.sourceEvent),I=!1,ge(B,ee.transform)){const ke=Te(ee.transform);B=ke,k.viewportChangeEnd(ke),k.moveEnd({event:ee,flowTransform:ke})}}),re.filter(ee=>{var ke;const ye=P.value||h.value,Ne=f.value&&ee.ctrlKey,we=ee.button,G=ee.type==="wheel";if(we===1&&ee.type==="mousedown"&&(He(ee,"vue-flow__node")||He(ee,"vue-flow__edge")))return!0;if(!Y.value&&!ye&&!se.value&&!p.value&&!f.value||y.value||fe.value&&!G||!p.value&&ee.type==="dblclick"||He(ee,b.value)&&G||He(ee,_.value)&&(!G||se.value&&G&&!P.value)||!f.value&&ee.ctrlKey&&G||!ye&&!se.value&&!Ne&&G)return!1;if(!f&&ee.type==="touchstart"&&((ke=ee.touches)==null?void 0:ke.length)>1)return ee.preventDefault(),!1;if(!Y.value&&(ee.type==="mousedown"||ee.type==="touchstart")||he.value&&Array.isArray(m.value)&&m.value.includes(0)&&we===0||Array.isArray(m.value)&&!m.value.includes(we)&&(ee.type==="mousedown"||ee.type==="touchstart"))return!1;const q=Array.isArray(m.value)&&m.value.includes(we)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!we||we<=1;return(!ee.ctrlKey||M.value||G)&&q}),t.watch([y,Y],()=>{y.value&&!R.value?re.on("zoom",null):y.value||re.on("zoom",ee=>{T.value={x:ee.transform.x,y:ee.transform.y,zoom:ee.transform.k};const ke=Te(ee.transform);I=pe(Y.value,v??0),k.viewportChange(ke),k.move({event:ee,flowTransform:ke})})},{immediate:!0}),t.watch([y,se,d,P,f,g,b],()=>{se.value&&!P.value&&!y.value?ue.on("wheel.zoom",ee=>{if(He(ee,b.value))return!1;const ke=P.value||h.value,ye=f.value&&ee.ctrlKey;if(!(!g.value||se.value||ke||ye))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const we=ue.property("__zoom").k||1,G=zi();if(!M.value&&ee.ctrlKey&&f.value&&G){const ze=sn(ee),Fe=ys(ee),ae=we*2**Fe;re.scaleTo(ue,ae,ze,ee);return}const q=ee.deltaMode===1?20:1;let W=d.value===Vi.Vertical?0:ee.deltaX*q,Ce=d.value===Vi.Horizontal?0:ee.deltaY*q;!G&&ee.shiftKey&&d.value!==Vi.Vertical&&!W&&Ce&&(W=Ce,Ce=0),re.translateBy(ue,-(W/we)*u.value,-(Ce/we)*u.value);const $e=Te(ue.property("__zoom"));w&&clearTimeout(w),$.value?(k.move({event:ee,flowTransform:$e}),k.viewportChange($e),w=setTimeout(()=>{k.moveEnd({event:ee,flowTransform:$e}),k.viewportChangeEnd($e),$.value=!1},150)):($.value=!0,k.moveStart({event:ee,flowTransform:$e}),k.viewportChangeStart($e))},{passive:!1}):typeof z<"u"&&ue.on("wheel.zoom",function(ee,ke){const ye=!g.value&&ee.type==="wheel"&&!ee.ctrlKey,Ne=P.value||h.value,we=f.value&&ee.ctrlKey;if(!Ne&&!c.value&&!we&&ee.type==="wheel"||ye||He(ee,b.value))return null;ee.preventDefault(),z.call(this,ee,ke)},{passive:!1})},{immediate:!0})});function pe(De,Z){return Z===2&&Array.isArray(De)&&De.includes(2)}function ge(De,Z){return De.x!==Z.x&&!Number.isNaN(Z.x)||De.y!==Z.y&&!Number.isNaN(Z.y)||De.zoom!==Z.k&&!Number.isNaN(Z.k)}function Te(De){return{x:De.x,y:De.y,zoom:De.k}}function He(De,Z){return De.target.closest(`.${Z}`)}return(De,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:D,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(Aw,{"is-selecting":ie.value,"selection-key-pressed":t.unref(x),class:t.normalizeClass({connecting:fe.value,dragging:t.unref(E),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(Tw,null,{default:t.withCtx(()=>[t.renderSlot(De.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Bw=["id"],Dw=["id"],Ow=["id"],Lw={name:"A11yDescriptions",compatConfig:{MODE:3}},Pw=t.defineComponent({...Lw,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(of)}-${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,Bw),t.createElementVNode("div",{id:`${t.unref(af)}-${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,Dw),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(sN)}-${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,Ow))],64))}});function zw(){const e=tt();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Fw(e,n,o){return o===Oe.Left?e-n:o===Oe.Right?e+n:e}function Uw(e,n,o){return o===Oe.Top?e-n:o===Oe.Bottom?e+n:e}const xs=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Oe.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:Fw(n,e,i),cy:Uw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};xs.props=["radius","centerX","centerY","position","type"],xs.compatConfig={MODE:3};const Qf=xs,Hw=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:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:b,edgesFocusable:_,hooks:k}=tt(),N=t.computed(()=>u(e.id)),{emit:y,on:E}=LN(N.value,r),S=t.inject(rr),A=t.getCurrentInstance(),V=t.ref(!1),T=t.ref(!1),D=t.ref(""),C=t.ref(null),R=t.ref("source"),$=t.ref(null),w=t.toRef(()=>typeof N.value.selectable>"u"?g.value:N.value.selectable),I=t.toRef(()=>typeof N.value.updatable>"u"?b.value:N.value.updatable),v=t.toRef(()=>typeof N.value.focusable>"u"?_.value:N.value.focusable);t.provide(BN,e.id),t.provide(DN,$);const B=t.computed(()=>N.value.class instanceof Function?N.value.class(N.value):N.value.class),M=t.computed(()=>N.value.style instanceof Function?N.value.style(N.value):N.value.style),x=t.computed(()=>{const L=N.value.type||"default",F=S==null?void 0:S[`edge-${L}`];if(F)return F;let X=N.value.template??c.value[L];if(typeof X=="string"&&A){const ee=Object.keys(A.appContext.components);ee&&ee.includes(L)&&(X=t.resolveComponent(L,!1))}return X&&typeof X!="string"?X:(r.error(new wt(kt.EDGE_TYPE_MISSING,X)),!1)}),{handlePointerDown:P}=zf({nodeId:D,handleId:C,type:R,isValidConnection:p,edgeUpdaterType:R,onEdgeUpdate:he,onEdgeUpdateEnd:ie});return()=>{const L=m(N.value.source),F=m(N.value.target),X="pathOptions"in N.value?N.value.pathOptions:{};if(!L&&!F)return r.error(new wt(kt.EDGE_SOURCE_TARGET_MISSING,N.value.id,N.value.source,N.value.target)),null;if(!L)return r.error(new wt(kt.EDGE_SOURCE_MISSING,N.value.id,N.value.source)),null;if(!F)return r.error(new wt(kt.EDGE_TARGET_MISSING,N.value.id,N.value.target)),null;if(!N.value||N.value.hidden||L.hidden||F.hidden)return null;let ee;i.value===Sn.Strict?ee=L.handleBounds.source:ee=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const ke=Cf(ee,N.value.sourceHandle);let ye;i.value===Sn.Strict?ye=F.handleBounds.target:ye=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const Ne=Cf(ye,N.value.targetHandle),we=(ke==null?void 0:ke.position)||Oe.Bottom,G=(Ne==null?void 0:Ne.position)||Oe.Top,{x:q,y:W}=Zo(L,ke,we),{x:Ce,y:$e}=Zo(F,Ne,G);return N.value.sourceX=q,N.value.sourceY=W,N.value.targetX=Ce,N.value.targetY=$e,t.h("g",{ref:$,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${x.value===!1?"default":N.value.type||"default"}`,s.value,B.value,{updating:V.value,selected:N.value.selected,animated:N.value.animated,inactive:!w.value&&!k.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":N.value.ariaLabel===null?void 0:N.value.ariaLabel??`Edge from ${N.value.source} to ${N.value.target}`,"aria-describedby":v.value?`${af}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...N.value.domAttributes,onClick:pe,onContextmenu:ge,onDblclick:Te,onMouseenter:He,onMousemove:De,onMouseleave:Z,onKeyDown:v.value?z:void 0},[T.value?null:t.h(x.value===!1?c.value.default:x.value,{id:e.id,sourceNode:L,targetNode:F,source:N.value.source,target:N.value.target,type:N.value.type,updatable:I.value,selected:N.value.selected,animated:N.value.animated,label:N.value.label,labelStyle:N.value.labelStyle,labelShowBg:N.value.labelShowBg,labelBgStyle:N.value.labelBgStyle,labelBgPadding:N.value.labelBgPadding,labelBgBorderRadius:N.value.labelBgBorderRadius,data:N.value.data,events:{...N.value.events,...E},style:M.value,markerStart:`url('#${Pi(N.value.markerStart,n)}')`,markerEnd:`url('#${Pi(N.value.markerEnd,n)}')`,sourcePosition:we,targetPosition:G,sourceX:q,sourceY:W,targetX:Ce,targetY:$e,sourceHandleId:N.value.sourceHandle,targetHandleId:N.value.targetHandle,interactionWidth:N.value.interactionWidth,...X}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:re,onMouseenter:Y,onMouseout:se},t.h(Qf,{position:we,centerX:q,centerY:W,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:Y,onMouseout:se},t.h(Qf,{position:G,centerX:Ce,centerY:$e,radius:a.value,type:"target","data-type":"target"}))]:null]])};function Y(){V.value=!0}function se(){V.value=!1}function he(L,F){y.update({event:L,edge:N.value,connection:F})}function ie(L){y.updateEnd({event:L,edge:N.value}),T.value=!1}function fe(L,F){L.button===0&&(T.value=!0,D.value=F?N.value.target:N.value.source,C.value=(F?N.value.targetHandle:N.value.sourceHandle)??null,R.value=F?"target":"source",y.updateStart({event:L,edge:N.value}),P(L))}function pe(L){var F;const X={event:L,edge:N.value};w.value&&(l.value=!1,N.value.selected&&f.value?(d([N.value]),(F=$.value)==null||F.blur()):o([N.value])),y.click(X)}function ge(L){y.contextMenu({event:L,edge:N.value})}function Te(L){y.doubleClick({event:L,edge:N.value})}function He(L){y.mouseEnter({event:L,edge:N.value})}function De(L){y.mouseMove({event:L,edge:N.value})}function Z(L){y.mouseLeave({event:L,edge:N.value})}function re(L){fe(L,!0)}function ue(L){fe(L,!1)}function z(L){var F;!h.value&&rf.includes(L.key)&&w.value&&(L.key==="Escape"?((F=$.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),jw=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:u,findNode:m}=tt(),p=(e=t.inject(rr))==null?void 0:e["connection-line"],f=t.computed(()=>{var k;return m((k=i.value)==null?void 0:k.nodeId)}),h=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),b=t.computed(()=>c.value.markerStart?`url(#${Pi(c.value.markerStart,n)})`:""),_=t.computed(()=>c.value.markerEnd?`url(#${Pi(c.value.markerEnd,n)})`:"");return()=>{var k,N,y;if(!f.value||!i.value)return null;const E=i.value.id,S=i.value.type,A=f.value.handleBounds;let V=(A==null?void 0:A[S])??[];if(o.value===Sn.Loose){const M=(A==null?void 0:A[S==="source"?"target":"source"])??[];V=[...V,...M]}if(!V)return null;const T=(E?V.find(M=>M.id===E):V[0])??null,D=(T==null?void 0:T.position)??Oe.Top,{x:C,y:R}=Zo(f.value,T,D);let $=null;h.value&&(o.value===Sn.Strict?$=((k=h.value.handleBounds[S==="source"?"target":"source"])==null?void 0:k.find(M=>{var x;return M.id===((x=a.value)==null?void 0:x.id)}))||null:$=((N=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:N.find(M=>{var x;return M.id===((x=a.value)==null?void 0:x.id)}))||null);const w=((y=a.value)==null?void 0:y.position)??(D?Ns[D]:null);if(!D||!w)return null;const I=l.value??c.value.type??yo.Bezier;let v="";const B={sourceX:C,sourceY:R,sourcePosition:D,targetX:g.value.x,targetY:g.value.y,targetPosition:w};return I===yo.Bezier?[v]=Yf(B):I===yo.Step?[v]=Ss({...B,borderRadius:0}):I===yo.SmoothStep?[v]=Ss(B):I===yo.SimpleBezier?[v]=Wf(B):v=`M${C},${R} ${g.value.x},${g.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:C,sourceY:R,sourcePosition:D,targetX:g.value.x,targetY:g.value.y,targetPosition:w,sourceNode:f.value,sourceHandle:T,targetNode:h.value,targetHandle:$,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),Kw=["id","markerWidth","markerHeight","markerUnits","orient"],Gw={name:"MarkerType",compatConfig:{MODE:3}},Yw=t.defineComponent({...Gw,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(fs).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(fs).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,Kw))}}),qw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ww={name:"MarkerDefinitions",compatConfig:{MODE:3}},Jw=t.defineComponent({...Ww,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=tt(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Pi(d,n);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)=>(t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(Yw,{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))])]))}}),Xw={name:"Edges",compatConfig:{MODE:3}},Zw=t.defineComponent({...Xw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Jw),(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(wN)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(Hw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(jw))],64))}}),Qw=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:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:b,snapGrid:_,nodeDragThreshold:k,nodesDraggable:N,elementsSelectable:y,nodesConnectable:E,nodesFocusable:S,hooks:A}=tt(),V=t.ref(null);t.provide(Lf,V),t.provide(Of,e.id);const T=t.inject(rr),D=t.getCurrentInstance(),C=Uf(),{node:R,parentNode:$}=Ff(e.id),{emit:w,on:I}=UN(R,l),v=t.toRef(()=>typeof R.draggable>"u"?N.value:R.draggable),B=t.toRef(()=>typeof R.selectable>"u"?y.value:R.selectable),M=t.toRef(()=>typeof R.connectable>"u"?E.value:R.connectable),x=t.toRef(()=>typeof R.focusable>"u"?S.value:R.focusable),P=t.computed(()=>B.value||v.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.value.nodeMouseLeave.hasListeners()),Y=t.toRef(()=>!!R.dimensions.width&&!!R.dimensions.height),se=t.computed(()=>{const F=R.type||"default",X=T==null?void 0:T[`node-${F}`];if(X)return X;let ee=R.template||m.value[F];if(typeof ee=="string"&&D){const ke=Object.keys(D.appContext.components);ke&&ke.includes(F)&&(ee=t.resolveComponent(F,!1))}return ee&&typeof ee!="string"?ee:(l.error(new wt(kt.NODE_TYPE_MISSING,ee)),!1)}),he=Pf({id:e.id,el:V,disabled:()=>!v.value,selectable:B,dragHandle:()=>R.dragHandle,onStart(F){w.dragStart(F)},onDrag(F){w.drag(F)},onStop(F){w.dragStop(F)},onClick(F){z(F)}}),ie=t.computed(()=>R.class instanceof Function?R.class(R):R.class),fe=t.computed(()=>{const F=(R.style instanceof Function?R.style(R):R.style)||{},X=R.width instanceof Function?R.width(R):R.width,ee=R.height instanceof Function?R.height(R):R.height;return!F.width&&X&&(F.width=typeof X=="string"?X:`${X}px`),!F.height&&ee&&(F.height=typeof ee=="string"?ee:`${ee}px`),F}),pe=t.toRef(()=>Number(R.zIndex??fe.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Te()}),t.onMounted(()=>{t.watch(()=>R.hidden,(F=!1,X,ee)=>{!F&&V.value&&(e.resizeObserver.observe(V.value),ee(()=>{V.value&&e.resizeObserver.unobserve(V.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>R.type,()=>R.sourcePosition,()=>R.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])})}),t.watch([()=>R.position.x,()=>R.position.y,()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.z},pe,()=>R.selected,()=>R.dimensions.height,()=>R.dimensions.width,()=>{var F;return(F=$.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=$.value)==null?void 0:F.dimensions.width}],([F,X,ee,ke,ye,Ne])=>{const we={x:F,y:X,z:Ne+(f.value&&R.selected?1e3:0)};typeof ee<"u"&&typeof ke<"u"?R.computedPosition=gN({x:ee,y:ke,z:ye},we):R.computedPosition=we},{flush:"post",immediate:!0}),t.watch([()=>R.extent,p],([F,X],[ee,ke])=>{(F!==ee||X!==ke)&&ge()}),R.extent==="parent"||typeof R.extent=="object"&&"range"in R.extent&&R.extent.range==="parent"?Kl(()=>Y).toBe(!0).then(ge):ge(),()=>R.hidden?null:t.h("div",{ref:V,"data-id":R.id,class:["vue-flow__node",`vue-flow__node-${se.value===!1?"default":R.type||"default"}`,{[o.value]:v.value,dragging:he==null?void 0:he.value,draggable:v.value,selected:R.selected,selectable:B.value,parent:R.isParent},ie.value],style:{visibility:Y.value?"visible":"hidden",zIndex:R.computedPosition.z??pe.value,transform:`translate(${R.computedPosition.x}px,${R.computedPosition.y}px)`,pointerEvents:P.value?"all":"none",...fe.value},tabIndex:x.value?0:void 0,role:x.value?"group":void 0,"aria-describedby":h.value?void 0:`${of}-${n}`,"aria-label":R.ariaLabel,"aria-roledescription":"node",...R.domAttributes,onMouseenter:He,onMousemove:De,onMouseleave:Z,onContextmenu:re,onClick:z,onDblclick:ue,onKeydown:L},[t.h(se.value===!1?m.value.default:se.value,{id:R.id,type:R.type,data:R.data,events:{...R.events,...I},selected:R.selected,resizing:R.resizing,dragging:he.value,connectable:M.value,position:R.computedPosition,dimensions:R.dimensions,isValidTargetPos:R.isValidTargetPos,isValidSourcePos:R.isValidSourcePos,parent:R.parentNode,parentNodeId:R.parentNode,zIndex:R.computedPosition.z??pe.value,targetPosition:R.targetPosition,sourcePosition:R.sourcePosition,label:R.label,dragHandle:R.dragHandle,onUpdateNodeInternals:Te})]);function ge(){const F=R.computedPosition,{computedPosition:X,position:ee}=_s(R,b.value?ar(F,_.value):F,l.error,p.value,$.value);(R.computedPosition.x!==X.x||R.computedPosition.y!==X.y)&&(R.computedPosition={...R.computedPosition,...X}),(R.position.x!==ee.x||R.position.y!==ee.y)&&(R.position=ee)}function Te(){V.value&&d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])}function He(F){he!=null&&he.value||w.mouseEnter({event:F,node:R})}function De(F){he!=null&&he.value||w.mouseMove({event:F,node:R})}function Z(F){he!=null&&he.value||w.mouseLeave({event:F,node:R})}function re(F){return w.contextMenu({event:F,node:R})}function ue(F){return w.doubleClick({event:F,node:R})}function z(F){B.value&&(!i.value||!v.value||k.value>0)&&ws(R,r.value,c,s,a,!1,V.value),w.click({event:F,node:R})}function L(F){if(!(ps(F)||h.value))if(rf.includes(F.key)&&B.value){const X=F.key==="Escape";ws(R,r.value,c,s,a,X,V.value)}else v.value&&R.selected&&Jo[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~R.position.x}, y: ${~~R.position.y}`,C({x:Jo[F.key].x,y:Jo[F.key].y},F.shiftKey))}}});function eI(e={includeHiddenNodes:!1}){const{nodes:n}=tt();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 tI={class:"vue-flow__nodes vue-flow__container"},nI={name:"Nodes",compatConfig:{MODE:3}},oI=t.defineComponent({...nI,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=tt(),a=eI(),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",tI,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(Qw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function iI(){const{emits:e}=tt();t.onMounted(()=>{if($f()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new wt(kt.MISSING_STYLES))}})}const aI=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),rI={name:"VueFlow",compatConfig:{MODE:3}},lI=t.defineComponent({...rI,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=Gl(i,"modelValue",o),l=Gl(i,"nodes",o),s=Gl(i,"edges",o),c=tt(i),d=GN({modelValue:r,nodes:l,edges:s},i,c);return qN(o,c.hooks),zw(),iI(),t.provide(rr,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(Vw,null,{default:t.withCtx(()=>[t.createVNode(Zw),aI,t.createVNode(oI),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(Pw)],512))}}),sI={name:"Panel",compatConfig:{MODE:3}},ep=t.defineComponent({...sI,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=tt(),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))}}),cI=["width","height","innerHTML"],dI=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"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"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,cI))}}),Qe=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=Qe(dI,[["__scopeId","data-v-05aac699"]]),No=["red","amber","green","teal","blue","indigo","violet","pink"],tp={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function uI(e){return typeof e=="string"&&e in tp}const mI={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},fI=.15;function pI(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 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 hI(e){if(typeof e!="string")return null;const n=pI(e);if(!n||n.s<fI)return null;let o=null,i=1/0;for(const a of No){const r=Math.abs(n.h-mI[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function $t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(uI(n))return n;const o=e==null?void 0:e.properties;return hI((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Rs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const yI={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)"},gI={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 np(e,n=!1){return e?n?gI[e]:yI[e]:null}function wo(e){return tp[e]}function Qo(e){return`var(--em-swatch-${e}-bar)`}function bI(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 _I(e,n){const o=bI(n);return o?e(o):n.split("-")[1]??n}function kI(e){var o,i,a;const n=r=>e.params!=null&&r 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((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";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-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";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-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-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";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-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";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";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function op(e,n){const o=kI(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 EI(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const NI={class:"em-inline-issue__msgs"},Io=Qe(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(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",NI,[(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(op)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),wI=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],II={key:0,class:"em-mlang__dot"},vI=["id","role","aria-labelledby"],CI=["title"],Qt=Qe(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const _=o.defaultLang;return _&&o.languages.includes(_)?_:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const _=o.activeLang;return _&&o.languages.includes(_)?_:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(_){var k,N;return!!((N=(k=o.modelValue)==null?void 0:k[_])!=null&&N.trim())}const d=_=>`${o.name}-tab-${_}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(_){var y,E;const k=o.languages,N=k[(_+k.length)%k.length];N&&(l.value=N,await t.nextTick(),(E=(y=m.value)==null?void 0:y.querySelectorAll('[role="tab"]')[k.indexOf(N)])==null||E.focus())}function f(_){p(o.languages.indexOf(s.value)+_)}const h=t.computed(()=>o.languages.filter(_=>{var k,N;return _!==s.value&&!!((N=(k=o.modelValue)==null?void 0:k[_])!=null&&N.trim())})),g=t.computed(()=>{var _;return((_=o.modelValue)==null?void 0:_[s.value])??""});function b(_){const k={...o.modelValue};_.trim()===""?delete k[s.value]:k[s.value]=_,i("update:modelValue",k)}return(_,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,N=>(t.openBlock(),t.createElementBlock("span",{id:d(N),key:N,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===N}]),role:"tab","aria-selected":s.value===N,"aria-controls":u.value,tabindex:s.value===N?0:-1,onClick:y=>l.value=N,onKeydown:[t.withKeys(t.withModifiers(y=>l.value=N,["prevent"]),["enter"]),t.withKeys(t.withModifiers(y=>l.value=N,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(y=>f(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(y=>f(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(y=>p(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(y=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(N),1),c(N)?(t.openBlock(),t.createElementBlock("span",II,"•")):t.createCommentVNode("",!0)],42,wI))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(oe.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":b},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":b},null,8,["name","placeholder","model-value"]))],8,vI),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,CI)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),SI=["disabled"],xI={class:"em-panel__sub-label"},RI={class:"em-field"},AI={class:"em-field"},$I={class:"em-field"},TI={key:0,class:"em-field"},MI={class:"em-field"},VI={class:"em-class"},BI={class:"em-field"},DI={class:"em-field"},OI={key:1,class:"em-attr__navhint"},LI={key:2,class:"em-field"},PI={key:3,class:"em-field"},zI={class:"em-multilang"},FI={class:"em-multilang"},UI={key:4,class:"em-jpa"},HI={class:"em-field"},jI={class:"em-field"},KI={class:"em-field"},GI=["title"],YI={class:"em-swatch"},qI={class:"em-swatch__row"},WI=["title"],JI=["title","onClick"],ip=Qe(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(M=>M.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(M=>M.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var M;return $t(((M=l.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","SERIALIZED_TYPE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=["none","LIST","SET","MAP"],u=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.serialization)==null?void 0:x.collectionType)??"none"});function m(M){return M==="none"?a.t("em.entity.serializedContainerNone"):M}function p(M){var Y,se;const x=M==="none"?void 0:M,P=x==="MAP"?(se=(Y=r.value)==null?void 0:Y.serialization)==null?void 0:se.mapKeyType:void 0;k({serialization:x?{collectionType:x,...P?{mapKeyType:P}:{}}:null})}function f(M){var P,Y;((Y=(P=r.value)==null?void 0:P.serialization)==null?void 0:Y.collectionType)==="MAP"&&k({serialization:{collectionType:"MAP",...M.trim()?{mapKeyType:M.trim()}:{}}})}const h=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],g=["inherit","STRING","CHAR","INTEGER"],b=M=>M;function _(M){return M==="inherit"?a.t("em.common.inherit"):M}function k(M){r.value&&a.updateEntity(r.value.modelId,M)}function N(M,x,P){var se;const Y=((se=r.value)==null?void 0:se.table)??{physicalName:""};k(M==="physicalName"?{table:{...Y,physicalName:P}}:{table:{...Y,logicalName:{...Y.logicalName,[x]:P}}})}function y(M){k({description:Object.keys(M).length?M:void 0})}function E(M,x){var P;k({jpaAttrs:{...(P=r.value)==null?void 0:P.jpaAttrs,[M]:x}})}function S(M,x){E(M,x)}const A=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.jpaAttrs)==null?void 0:x.discriminatorType)??"inherit"}),V=t.computed(()=>{var M,x;return!((x=(M=r.value)==null?void 0:M.jpaAttrs)!=null&&x.useDiscriminator)});function T(M){E("discriminatorType",M==="inherit"?void 0:M)}function D(M){k({hasPersonalInfo:M})}function C(M){k({referenceOnly:M?!0:void 0})}function R(M){k({superClass:M.trim()||void 0})}function $(M){k({schema:M.trim()||void 0})}function w(M){k({abstractClass:M})}const I=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:x.join(", "))??""});function v(M){const x=M.split(",").map(P=>P.trim()).filter(Boolean);k({declarationOfInterfaces:x.length?x:void 0})}function B(M){r.value&&a.setEntitySwatch(r.value.modelId,M)}return(M,x)=>{var P,Y,se,he;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:x[0]||(x[0]=ie=>i("toggle"))},[t.createElementVNode("span",xI,[t.createVNode(Ve,{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(Io,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",RI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":x[1]||(x[1]=ie=>k({name:ie}))},null,8,["model-value"])]),t.createElementVNode("label",AI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":b,"label-provider":t.unref(li),"onUpdate:modelValue":x[2]||(x[2]=ie=>k({stereotype:ie}))},null,8,["model-value","label-provider"])]),r.value.stereotype==="SERIALIZED_TYPE"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",$I,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedContainer")),1),t.createVNode(t.unref(oe.BSSelect),{name:"ent-ser-container","model-value":u.value,items:d,"value-provider":b,"label-provider":m,"onUpdate:modelValue":x[3]||(x[3]=ie=>ie&&p(ie))},null,8,["model-value"])]),u.value==="MAP"?(t.openBlock(),t.createElementBlock("label",TI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedMapKey")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-ser-mapkey",width:"100%",placeholder:t.unref(a).t("em.entity.serializedMapKeyPlaceholder"),"model-value":((P=r.value.serialization)==null?void 0:P.mapKeyType)??"","onUpdate:modelValue":f},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("label",MI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":x[4]||(x[4]=ie=>k({packageName:ie}))},null,8,["model-value"])]),t.createElementVNode("fieldset",VI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",BI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":x[5]||(x[5]=ie=>R(ie))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",DI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":I.value,"onUpdate:modelValue":x[6]||(x[6]=ie=>v(ie))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":x[7]||(x[7]=ie=>w(ie))},null,8,["label","model-value"])]),t.unref(_t)(r.value.stereotype)?(t.openBlock(),t.createElementBlock("p",OI,t.toDisplayString(t.unref(a).t("em.entity.noOwnTableNote")),1)):(t.openBlock(),t.createElementBlock("label",LI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-table",width:"100%","model-value":((Y=r.value.table)==null?void 0:Y.physicalName)??"","onUpdate:modelValue":x[8]||(x[8]=ie=>N("physicalName",null,ie))},null,8,["model-value"])])),t.unref(hn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",PI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":x[9]||(x[9]=ie=>$(ie))},null,8,["placeholder","model-value"])])),t.createElementVNode("fieldset",zI,[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,ie=>{var fe,pe;return t.openBlock(),t.createElementBlock("label",{key:ie,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(ie),1),t.createVNode(t.unref(oe.BSTextInput),{name:`ent-logical-${ie}`,width:"100%","model-value":((pe=(fe=r.value.table)==null?void 0:fe.logicalName)==null?void 0:pe[ie])??"","onUpdate:modelValue":ge=>N("logicalName",ie,ge)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",FI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":y},null,8,["languages","default-lang","model-value"])]),t.unref(hn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",UI,[x[14]||(x[14]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(h,ie=>{var fe;return t.createVNode(t.unref(oe.BSCheckbox),{key:ie.key,name:`jpa-${ie.key}`,class:"em-check",label:ie.label,"model-value":!!((fe=r.value.jpaAttrs)!=null&&fe[ie.key]),"onUpdate:modelValue":pe=>S(ie.key,pe)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",HI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:V.value,"model-value":((se=r.value.jpaAttrs)==null?void 0:se.discriminatorColumnName)??"","onUpdate:modelValue":x[10]||(x[10]=ie=>E("discriminatorColumnName",ie.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",jI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(oe.BSSelect),{disabled:V.value,"model-value":A.value,items:g,"value-provider":b,"label-provider":_,"onUpdate:modelValue":x[11]||(x[11]=ie=>ie&&T(ie))},null,8,["disabled","model-value"])]),t.createElementVNode("label",KI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(oe.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:V.value,"model-value":(he=r.value.jpaAttrs)==null?void 0:he.discriminatorLength,"onUpdate:modelValue":x[12]||(x[12]=ie=>E("discriminatorLength",ie||void 0))},null,8,["disabled","model-value"])])])),t.createVNode(t.unref(oe.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":D},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(oe.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":C},null,8,["label","model-value"])],8,GI),t.createElementVNode("fieldset",YI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",qI,[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:x[13]||(x[13]=ie=>B(null))},"∅",10,WI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),ie=>(t.openBlock(),t.createElementBlock("button",{key:ie,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===ie}]),style:t.normalizeStyle({background:t.unref(Qo)(ie)}),title:t.unref(a).t(t.unref(wo)(ie)),onClick:fe=>B(ie)},null,14,JI))),128))])])],64)):t.createCommentVNode("",!0)],8,SI)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1b3b91f5"]]),XI=["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"],ap=["inherit","true","false"],pr="__OWN__";function rp(e,n){const o=t.computed(()=>e.state.logical.entities.find(J=>J.modelId===n())??null),i=t.computed(()=>{var J;return _t(((J=o.value)==null?void 0:J.stereotype)??"UNDEFINED")}),a=t.computed(()=>{var J;return hn(((J=o.value)==null?void 0:J.stereotype)??"UNDEFINED")}),r=t.computed(()=>new Set(e.selectedAttrIds.value));function l(J){return J==="none"?e.t("em.common.noneParen"):J}const s=J=>J;function c(J,ce){o.value&&e.updateAttribute(o.value.modelId,J.modelId,ce)}const d=t.computed(()=>jr(e.state.logical.associations));function u(J){if(!o.value)return;const ce=Lo(e.state.logical,o.value.modelId,J.modelId);return ce&&ka(J,ce)?ce:void 0}function m(J){return!!u(J)}function p(J){return m(J)?J.derivedIdFieldName??"":J.name??""}function f(J){const ce=u(J);if(!ce)return e.t("em.attr.namePlaceholder");const Ae=new Map(e.state.logical.entities.map(Ee=>[Ee.modelId,Ee]));return yl({...J,derivedIdFieldName:void 0},ce,Ae)||e.t("em.attr.namePlaceholder")}function h(J,ce){m(J)?c(J,{derivedIdFieldName:ce||void 0}):c(J,{name:ce})}function g(J){return J.name??""}function b(J,ce){c(J,{name:ce})}function _(J){return!!o.value&&Kr(J,o.value,d.value)}function k(J){var Ee,H;const ce=(Ee=J.derivedFrom)==null?void 0:Ee.associationRef,Ae=(H=o.value)==null?void 0:H.attributes.find(It=>{var Rt;return It.attrType==="RELATION_OWN"&&((Rt=It.derivedFrom)==null?void 0:Rt.associationRef)===ce&&d.value.has(It.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Ae==null?void 0:Ae.name)||e.t("em.attr.nameless")})}function N(J){return!!o.value&&!!Lo(e.state.logical,o.value.modelId,J.modelId)}function y(J,ce){c(J,{naturalId:ce||void 0,naturalIdMutable:ce?J.naturalIdMutable:void 0})}function E(){return{naturalId:void 0,naturalIdMutable:void 0}}function S(J,ce){c(J,{identifier:ce,...ce?E():{}})}function A(J,ce){c(J,{transient:ce||void 0,...ce?E():{}})}function V(J){return!!J.transient||J.attrType==="RELATION_REF"}function T(J){return ia(J)}function D(J,ce=0){var Ae;return((Ae=Zn(J,o.value,e.state.logical.entities,e.state.logical.associations,ce))==null?void 0:Ae.physicalName)||void 0}const C=J=>J.value,R=J=>J.label;function $(J,ce){if(!ce)return;const Ae=se.value.find(Ee=>Ee.type===ce);if(Ae){const Ee=J.dbAttrs[0]??{modelId:J.modelId+".c",physicalName:J.name,dataType:"VARCHAR"};c(J,{type:ce,customType:void 0,dbAttrs:[{...Ee,dataType:Ae.dataType,length:Ae.length,scale:Ae.scale}]});return}c(J,ce===_n?{type:ce}:{type:ce,customType:void 0})}function w(J,ce){c(J,{customType:ce.trim()===""?void 0:ce})}function I(J,ce){if(J.attrType==="RELATION_REF")return;const Ee={...J.dbAttrs[0]??{modelId:J.modelId+".c",physicalName:J.name,dataType:"VARCHAR"},...ce};ce.dataType!==void 0&&!qr.has(Ee.dataType)&&(Ee.scale=void 0),c(J,{dbAttrs:[Ee]})}function v(J){var ce;return qr.has(((ce=J.dbAttrs[0])==null?void 0:ce.dataType)??"")}function B(J){return!v(J)&&!T(J)&&!V(J)?e.t("em.attr.scaleTypeHint"):void 0}function M(J,ce){I(J,{logicalName:Object.keys(ce).length?ce:void 0})}function x(J,ce){c(J,{description:Object.keys(ce).length?ce:void 0})}function P(J){return J.personalInfoAttributeType??"none"}function Y(J,ce){c(J,{personalInfoAttributeType:ce==="none"?void 0:ce})}const se=t.computed(()=>e.predefinedCustomTypeCatalog.value),he=t.computed(()=>[...Mo(e.state.logical).keys()].sort()),ie=t.computed(()=>e.embeddableCatalog.value);function fe(J){var ce,Ae,Ee;return((ce=J.label)==null?void 0:ce[e.userLanguage.value])??((Ae=J.label)==null?void 0:Ae.ko)??((Ee=J.label)==null?void 0:Ee.en)??J.type}const pe=t.computed(()=>e.groupCodeCatalog.value);function ge(J){var ce;return((ce=pe.value.find(Ae=>Ae.groupCode===J.groupCode))==null?void 0:ce.codes)??[]}function Te(J){return["none",...ge(J)]}function He(J){return J==="none"?"none":J.code}function De(J){var Ae,Ee,H;if(J==="none")return e.t("em.common.noneParen");const ce=((Ae=J.label)==null?void 0:Ae[e.userLanguage.value])??((Ee=J.label)==null?void 0:Ee.ko)??((H=J.label)==null?void 0:H.en);return ce?`${J.code} (${ce})`:J.code}function Z(J,ce){o.value&&e.setAttributeGroupCode(o.value.modelId,J.modelId,ce)}function re(J,ce){c(J,{defaultValue:ce==="none"?void 0:ce})}function ue(J,ce){c(J,{defaultValue:ce.trim()===""?void 0:ce})}function z(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}const L=yn;function F(J){return z(J)||L(J)}function X(J,ce,Ae){const Ee=J.dbAttrs.map((H,It)=>{if(It!==ce)return H;const Rt={...H,...Ae};for(const ot of Object.keys(Ae))Ae[ot]===void 0&&delete Rt[ot];return Rt});o.value&&e.setEmbedColumns(o.value.modelId,J.modelId,Ee)}function ee(J,ce,Ae){X(J,ce,{logicalName:Object.keys(Ae).length?Ae:void 0})}function ke(J,ce){var H,It,Rt;if(L(J)){const ot=Zn(J,o.value,e.state.logical.entities,e.state.logical.associations,ce);return ot?{physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,logicalName:ot.logicalName}:void 0}if(J.attrType==="EMBED_PREDEF"){const ot=(H=e.embeddableCatalog.value.find(We=>We.type===J.type))==null?void 0:H.fields[ce];return ot?{name:ot.name,physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,shareable:ot.shareable,logicalName:ot.logicalName}:void 0}const Ae=(It=J.embedded)==null?void 0:It.embeddableRef;if(!Ae)return;const Ee=(Rt=e.state.logical.entities.find(ot=>ot.modelId===Ae))==null?void 0:Rt.attributes.flatMap(ot=>ot.dbAttrs)[ce];return Ee?{physicalName:Ee.physicalName,dataType:Ee.dataType,length:Ee.length,scale:Ee.scale,logicalName:Ee.logicalName}:void 0}function ye(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.dataType)||((Ee=J.dbAttrs[ce])==null?void 0:Ee.dataType)||""}function Ne(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.length)??((Ee=J.dbAttrs[ce])==null?void 0:Ee.length)}function we(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.scale)??((Ee=J.dbAttrs[ce])==null?void 0:Ee.scale)}function G(J){return e.t(L(J)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const q=ap;function W(J){return J==="inherit"?e.t("em.common.inherit"):J}function Ce(J){return(J==null?void 0:J.updatable)===void 0?"inherit":J.updatable?"true":"false"}function $e(J,ce,Ae){X(J,ce,{updatable:Ae==="inherit"?void 0:Ae==="true"})}function ze(J,ce){I(J,{updatable:ce==="inherit"?void 0:ce==="true"})}const Fe=ap;function ae(J){return J==="inherit"?e.t("em.common.inherit"):J}function Se(J){return(J==null?void 0:J.insertable)===void 0?"inherit":J.insertable?"true":"false"}function Ge(J,ce,Ae){X(J,ce,{insertable:Ae==="inherit"?void 0:Ae==="true"})}function et(J,ce){I(J,{insertable:ce==="inherit"?void 0:ce==="true"})}const te=t.computed(()=>o.value?Gr(o.value,e.state.logical.entities):[]),de=t.computed(()=>$o(te.value.flatMap(J=>J.attributes.flatMap(ce=>ce.dbAttrs)))),Le=t.computed(()=>te.value.flatMap(J=>J.attributes.filter(ce=>ce.attrType==="NORMAL"&&ce.dbAttrs.length===1&&ce.dbAttrs[0]).map(ce=>{var Ae;return{modelId:ce.dbAttrs[0].modelId,physical:ce.dbAttrs[0].physicalName||ce.name,isCurrency:ce.type==="Currency",ownerName:J.modelId===((Ae=o.value)==null?void 0:Ae.modelId)?void 0:J.name}})));function dt(){const J=[...Le.value].sort((ce,Ae)=>Number(Ae.isCurrency)-Number(ce.isCurrency));return[pr,...J.map(ce=>ce.modelId)]}function Xe(J){if(J===pr)return e.t("em.attr.sharedOwn");const ce=Le.value.find(Ee=>Ee.modelId===J);if(!ce)return J;const Ae=ce.ownerName?`${ce.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Ae,physical:ce.physical,mode:ce.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function yt(J){return(J==null?void 0:J.sharedColumnRef)??pr}function st(J,ce,Ae){X(J,ce,{sharedColumnRef:Ae===pr?void 0:Ae})}function ft(J){return(J==null?void 0:J.sharedColumnRef)!=null}function nt(J){var ce;return((ce=Qn(J,de.value))==null?void 0:ce.physicalName)??""}return{entity:o,isValueType:i,isColumnless:a,focusedAttrIds:r,personalInfoItems:XI,piiLabel:l,idn:s,setAttr:c,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:k,isManagedFk:N,setNaturalId:y,clearNaturalIdPatch:E,setIdentifier:S,setTransient:A,dbLocked:V,fkDerived:T,fkOriginPhysical:D,typeValueOf:C,typeLabelOf:R,setAttrType:$,setAttrCustomType:w,setDb:I,scaleApplicable:v,scaleHint:B,setDbLogical:M,setAttrDescription:x,attrPiiValue:P,setAttrPii:Y,predefinedCustomTypeCatalog:se,serializedTypeNames:he,embeddableCatalog:ie,predefinedLabel:fe,groupCodeCatalog:pe,attrGroupCodes:ge,attrCodeItems:Te,codeValueOf:He,codeLabelOf:De,setAttrGroupCode:Z,setAttrCode:re,setAttrDefaultValue:ue,isEmbedExpanded:z,isMultiColFk:L,hasColumnSlots:F,setDbAt:X,setDbLogicalAt:ee,colSlotMeta:ke,fixedDataType:ye,fixedLength:Ne,fixedScale:we,slotFixedHint:G,updatableItems:q,updatableLabel:W,updatableValue:Ce,setUpdatableAt:$e,setUpdatable:ze,insertableItems:Fe,insertableLabel:ae,insertableValue:Se,setInsertableAt:Ge,setInsertable:et,scopeEntities:te,columnsById:de,sharedCandidates:Le,sharedItems:dt,sharedLabel:Xe,sharedValue:yt,setSharedAt:st,isShared:ft,sharedPhysical:nt}}const lp={"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.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","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.formatGroup":"Input format","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.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","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.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","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.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","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.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","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.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","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.fkChildCols":"Composite foreign key — {n} 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.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.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","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.title":"Command palette","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.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","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.connectHint":"Drag to connect a relationship to another entity","em.node.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-column(s) hidden","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.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","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.treeAria":"Diagram tree","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.current":"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.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","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.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"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.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.entity.valueTypeSwitchEmbedded":'"{name}" is currently embedded by {owners} entit(y/ies), so it cannot be switched directly between a serialized type and an embeddable — remove the embedded attributes first (a serialized type is referenced by type, not by a relation)',"em.attr.serializedNoColumnNote":"A serialized type has no per-field physical columns — it is serialized whole into a single column on the consuming attribute","em.entity.noOwnTableNote":"A value type has no table of its own — an embeddable is flattened into the owner table, and a serialized type is serialized into a single column on the consuming attribute","em.entity.serializedTypeHasRelations":'"{name}" participates in {count} relationship(s), so it cannot be turned into a serialized type — remove those relationships first (a serialized type is referenced by an attribute type, not by a relationship)',"em.entity.serializedContainer":"Container","em.entity.serializedContainerNone":"none (single value)","em.entity.serializedMapKey":"Map key type","em.entity.serializedMapKeyPlaceholder":"e.g. PromoType (unset → codegen emits a placeholder Object + fill-in)","em.entity.noIndexNote":"A serialized type cannot have indexes — an index is placed on columns, and this type is serialized whole into a single column on the consuming attribute","em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'A value type (embeddable / 직렬화 타입) 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.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.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"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.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","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.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},sp={"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.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","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.formatGroup":"入力形式","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.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","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.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","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.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","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.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","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.fkChildCols":"複合外部キー — カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","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.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","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.title":"コマンドパレット","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.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","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.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティのサブカラムをすべて折りたたむ","em.node.embedAllShow":"折りたたまれたサブカラムをすべて展開","em.node.embedAllSummary":"サブカラム {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","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.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{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.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.entity.valueTypeSwitchEmbedded":'"{name}" は現在 {owners} 件のエンティティに組み込まれているため、シリアライズ型と組込み可能の間を直接切り替えられません — 先に組込み属性を整理してください(シリアライズ型は関係ではなく型参照で指定されます)',"em.attr.serializedNoColumnNote":"シリアライズ型はフィールドごとの物理カラムを持ちません — 利用側属性の単一カラムにまとめてシリアライズされます","em.entity.noOwnTableNote":"値型は自身のテーブルを持ちません — 組込み可能は所有者テーブルに展開され、シリアライズ型は利用側属性の単一カラムにシリアライズされます","em.entity.serializedTypeHasRelations":'"{name}" は {count} 件の関連に参加しているためシリアライズ型に変更できません — 先に関連を整理してください(シリアライズ型は関係ではなく属性の型参照で指定されます)',"em.entity.serializedContainer":"コンテナ","em.entity.serializedContainerNone":"なし(単一値)","em.entity.serializedMapKey":"Map キー型","em.entity.serializedMapKeyPlaceholder":"例: PromoType(未指定ならコード生成が仮の Object + 手入力箇所を出す)","em.entity.noIndexNote":"シリアライズ型はインデックスを持てません — インデックスはカラムに張られますが、この型は利用側属性の単一カラムにまとめてシリアライズされます","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'値型(組込み可能・シリアライズ型)は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","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.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","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.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","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.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},cp={"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.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","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.formatGroup":"입력 형식","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.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","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.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","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.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","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.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","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.fkChildCols":"복합 외래키 — 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","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.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","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.title":"명령 팔레트","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.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","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.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 서브컬럼 모두 접기","em.node.embedAllShow":"접힌 서브컬럼 모두 펼치기","em.node.embedAllSummary":"서브컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","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.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{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.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.entity.valueTypeSwitchEmbedded":'"{name}"은(는) 현재 {owners}개 엔티티에 임베드되어 있어 직렬화 타입/임베더블 사이를 바로 전환할 수 없습니다 — 임베드 속성을 먼저 정리한 뒤 전환하세요(직렬화 타입은 관계가 아니라 타입 참조로 지목됩니다)',"em.attr.serializedNoColumnNote":"직렬화 타입은 필드별 물리 컬럼이 없습니다 — 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.entity.noOwnTableNote":"값 타입은 자체 테이블이 없습니다 — 임베더블은 소유자 테이블로 펼쳐지고, 직렬화 타입은 소비 속성의 컬럼 하나에 직렬화됩니다","em.entity.serializedTypeHasRelations":'"{name}"은(는) 연관관계 {count}개에 참여 중이라 직렬화 타입으로 바꿀 수 없습니다 — 연관을 먼저 정리하세요(직렬화 타입은 관계가 아니라 소비 속성의 타입 참조로 지목됩니다)',"em.entity.serializedContainer":"컨테이너","em.entity.serializedContainerNone":"없음 (단일 값)","em.entity.serializedMapKey":"Map 키 타입","em.entity.serializedMapKeyPlaceholder":"예: PromoType (미지정 시 코드젠이 임시 Object + 손채움)","em.entity.noIndexNote":"직렬화 타입은 인덱스를 가질 수 없습니다 — 인덱스는 컬럼에 걸리는데 이 타입은 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'값 타입(임베더블·직렬화 타입)은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","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.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"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.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","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.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},ZI=["ko","en","ja"],As={ko:cp,en:lp,ja:sp};function en(e,n,o){let a=(As[e]??As.ko)[n]??As.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const dp=["ko","en","ja","zh"];function QI(e){if(e)for(const n of dp){const o=e[n];if(o)return o}}function $s(e){const n=QI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function ev(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:dp.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const tv=["aria-expanded","placeholder"],nv=["aria-selected","onClick","onMouseenter"],ov={key:0,class:"gcc__opt gcc__opt--empty"},up=Qe(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,D)=>en(o.locale??"ko",T,D),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),f=t.computed(()=>p.value?$s(p.value):"");t.watch(f,T=>{d.value||(c.value=T)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:ev(o.items,c.value));function g(){var D;const T=(D=r.value)==null?void 0:D.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function b(){d.value=!0,g(),u.value=Math.max(0,h.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",V)}function _(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",V)}t.onBeforeUnmount(_);function k(){b(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function N(){d.value||b(),u.value=0}function y(T){i("update:modelValue",T.groupCode),c.value=$s(T),_()}function E(){i("update:modelValue",void 0),c.value="",_()}function S(){c.value.trim()===""?E():(c.value=f.value,_())}function A(T){var D;if(T.key==="ArrowDown")d.value||b(),u.value=Math.min(u.value+1,h.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const C=h.value[u.value];C&&y(C),T.preventDefault()}else T.key==="Escape"&&(c.value=f.value,_(),(D=l.value)==null||D.blur())}function V(T){var C,R;const D=T.target;!((C=r.value)!=null&&C.contains(D))&&!((R=s.value)!=null&&R.contains(D))&&S()}return(T,D)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":D[0]||(D[0]=C=>c.value=C),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:N,onKeydown:A},null,40,tv),[[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(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:D[1]||(D[1]=t.withModifiers(()=>{},["prevent"])),onClick:E},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(C,R)=>(t.openBlock(),t.createElementBlock("li",{key:C.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":R===u.value,"is-selected":C.groupCode===e.modelValue}]),role:"option","aria-selected":C.groupCode===e.modelValue,onMousedown:D[2]||(D[2]=t.withModifiers(()=>{},["prevent"])),onClick:$=>y(C),onMouseenter:$=>u.value=R},t.toDisplayString(t.unref($s)(C)),43,nv))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",ov,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),iv=["aria-labelledby"],av=["aria-checked","tabindex","onClick","onKeydown"],mp=Qe(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,av))),128))],8,iv))}}),[["__scopeId","data-v-5c793bbb"]]),rv=["disabled"],lv={class:"em-aw__toolbar"},sv={class:"em-aw__count"},cv={class:"em-aw__scroll"},dv={class:"em-aw__table"},uv={class:"c-name"},mv={class:"c-type"},fv={class:"c-logical"},pv=["id"],hv={class:"c-col"},yv={class:"c-constraints"},gv={class:"c-del"},bv={class:"c-expand"},_v=["title","onClick","onKeydown"],kv=["title"],Ev=["title"],Nv={key:1,class:"em-aw__muted"},wv=["title"],Iv=["title"],vv=["title"],Cv={class:"em-aw__cflags"},Sv=["title"],xv={key:0,class:"em-aw__embed-col"},Rv={class:"em-aw__embed-label"},Av=["title"],$v={colspan:"8"},Tv={class:"em-aw__detail"},Mv={class:"em-aw__dgroup"},Vv=["title"],Bv={class:"em-aw__df"},Dv={class:"em-aw__df"},Ov={class:"em-aw__dgroup"},Lv={key:0,class:"em-aw__dgroup"},Pv={class:"em-aw__df"},zv={key:0,class:"em-aw__df"},Fv={class:"em-aw__df"},Uv={class:"em-aw__dgroup em-aw__ddesc"},Hv={class:"c-expand"},jv=["title","onClick","onKeydown"],Kv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},Gv=["title"],Yv=["title"],qv=["colspan"],Wv=["title"],Jv={class:"em-aw__cflags"},Xv=["title"],Zv={colspan:"8"},Qv={class:"em-aw__detail"},eC={class:"em-aw__dgroup em-aw__ddesc"},tC={class:"c-expand"},nC=["title","onClick","onKeydown"],oC={class:"em-aw__embed-label"},iC=["title"],aC=["title"],rC={class:"em-aw__ro"},lC=["title"],sC={class:"em-aw__ro"},cC=["title"],dC={class:"em-aw__ro"},uC={key:0,class:"em-aw__detail-row em-aw__embed-detail"},mC={colspan:"8"},fC={class:"em-aw__detail"},pC={class:"em-aw__dgroup"},hC={key:0,class:"em-aw__df"},yC={class:"em-aw__df"},gC={class:"em-aw__df"},bC={key:0},_C={colspan:"99",class:"em-aw__empty"},kC=6,fp=5,EC=Qe(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttr:u,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:k,isManagedFk:N,setNaturalId:y,setIdentifier:E,setTransient:S,dbLocked:A,fkDerived:V,fkOriginPhysical:T,typeValueOf:D,typeLabelOf:C,setAttrType:R,setAttrCustomType:$,setDb:w,scaleApplicable:I,scaleHint:v,setDbLogical:B,attrPiiValue:M,setAttrPii:x,predefinedCustomTypeCatalog:P,serializedTypeNames:Y,embeddableCatalog:se,predefinedLabel:he,groupCodeCatalog:ie,attrGroupCodes:fe,attrCodeItems:pe,codeValueOf:ge,codeLabelOf:Te,setAttrGroupCode:He,setAttrCode:De,setAttrDefaultValue:Z,setAttrDescription:re,hasColumnSlots:ue,isMultiColFk:z,setDbAt:L,setDbLogicalAt:F,colSlotMeta:X,fixedDataType:ee,fixedLength:ke,fixedScale:ye,slotFixedHint:Ne,updatableItems:we,updatableLabel:G,updatableValue:q,setUpdatableAt:W,setUpdatable:Ce,insertableItems:$e,insertableLabel:ze,insertableValue:Fe,setInsertableAt:ae,setInsertable:Se,sharedItems:Ge,sharedLabel:et,sharedValue:te,setSharedAt:de,isShared:Le,sharedPhysical:dt}=rp(o,()=>n.entityId),Xe=t.computed(()=>{var Ae;return[...((Ae=i.value)==null?void 0:Ae.attributes)??[]].sort((Ee,H)=>Ee.order-H.order)}),yt=t.computed(()=>{var Ae;return(((Ae=i.value)==null?void 0:Ae.attributes)??[]).filter(Ee=>Ee.attrType!=="DIVIDER").length}),st=t.ref(new Set);function ft(Ae){return st.value.has(Ae)}function nt(Ae){const Ee=new Set(st.value);Ee.has(Ae)?Ee.delete(Ae):Ee.add(Ae),st.value=Ee}const J=t.ref(o.userLanguage.value);function ce(Ae){!Ae||!i.value||o.addPredefinedEmbed(i.value.modelId,Ae)}return(Ae,Ee)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",lv,[t.createElementVNode("span",sv,t.toDisplayString(t.unref(o).t("em.attr.section",{n:yt.value})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ee[0]||(Ee[0]=H=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:Ee[1]||(Ee[1]=H=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(se).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(se),"value-provider":H=>H.type,"label-provider":t.unref(he),"onUpdate:modelValue":ce},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",cv,[t.createElementVNode("table",dv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Ee[3]||(Ee[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",uv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",mv,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",fv,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,pv),t.createVNode(mp,{modelValue:J.value,"onUpdate:modelValue":Ee[2]||(Ee[2]=H=>J.value=H),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",hv,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Ee[4]||(Ee[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Ee[5]||(Ee[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",yv,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Ee[6]||(Ee[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.value,H=>{var It,Rt,ot,We,Ze,Q,Mt,Vt,Mn,an;return t.openBlock(),t.createElementBlock(t.Fragment,{key:H.modelId},[H.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[7]||(Ee[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-divlabel-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":H.name,"onUpdate:modelValue":_e=>t.unref(u)(H,{name:_e})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:kC,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",gv,[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])])],2)):t.unref(ue)(H)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(l).has(H.modelId)}])},[t.createElementVNode("td",Hv,[t.unref(z)(H)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":ft(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:_e=>nt(H.modelId),onKeydown:[t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,jv)):(t.openBlock(),t.createElementBlock("span",Kv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(_)(H)?t.unref(k)(H):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(_)(H),placeholder:t.unref(f)(H),"model-value":t.unref(p)(H),"onUpdate:modelValue":_e=>t.unref(h)(H,_e)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,Gv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-type-${H.modelId}`,width:"100%",disabled:"","model-value":H.type},null,8,["name","model-value"])],8,Yv),t.createElementVNode("td",{colspan:t.unref(z)(H)?fp-1:fp,class:"em-aw__embed-note"},t.toDisplayString(t.unref(z)(H)?t.unref(o).t("em.attr.fkChildCols",{n:H.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:H.dbAttrs.length})),9,qv),t.unref(z)(H)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",Jv,[t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:"","onUpdate:modelValue":_e=>t.unref(E)(H,_e)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:"","onUpdate:modelValue":_e=>t.unref(u)(H,{notNull:_e})},null,8,["name","model-value","onUpdate:modelValue"])])],8,Wv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(N)(H)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])],8,Xv)],2),t.unref(z)(H)&&ft(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[15]||(Ee[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Zv,[t.createElementVNode("div",Qv,[t.createElementVNode("fieldset",eC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":_e=>t.unref(re)(H,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.dbAttrs,(_e,mt)=>{var vt,O,U,le,ne,xe,Be,qe;return t.openBlock(),t.createElementBlock(t.Fragment,{key:_e.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ft(_e.modelId)}])},[t.createElementVNode("td",tC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(_e.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(_e.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:je=>nt(_e.modelId),onKeydown:[t.withKeys(t.withModifiers(je=>nt(_e.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(je=>nt(_e.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,nC)]),t.createElementVNode("td",oC,"↳ "+t.toDisplayString(((vt=t.unref(X)(H,mt))==null?void 0:vt.name)??((O=t.unref(X)(H,mt))==null?void 0:O.physicalName)??t.unref(o).t("em.attr.colFallback",{n:mt+1})),1),Ee[16]||(Ee[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Qt,{name:`aw-embed-logical-${_e.modelId}`,languages:t.unref(o).languages.value,"active-lang":J.value,placeholder:((le=(U=t.unref(X)(H,mt))==null?void 0:U.logicalName)==null?void 0:le[J.value])??((xe=(ne=t.unref(X)(H,mt))==null?void 0:ne.logicalName)==null?void 0:xe.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":_e.logicalName,"onUpdate:modelValue":je=>t.unref(F)(H,mt,je)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(Le)(_e)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-embed-col-${_e.modelId}`,width:"100%",disabled:t.unref(Le)(_e),placeholder:((Be=t.unref(X)(H,mt))==null?void 0:Be.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Le)(_e)?t.unref(dt)(_e):_e.physicalName,"onUpdate:modelValue":je=>t.unref(L)(H,mt,{physicalName:je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"])],8,iC),t.createElementVNode("td",{title:t.unref(Ne)(H)},[t.createElementVNode("span",rC,t.toDisplayString(t.unref(ee)(H,mt)),1)],8,aC),t.createElementVNode("td",{title:t.unref(Ne)(H)},[t.createElementVNode("span",sC,t.toDisplayString(t.unref(ke)(H,mt)??""),1)],8,lC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(Ne)(H)},[t.createElementVNode("span",dC,t.toDisplayString(t.unref(ye)(H,mt)!=null?`scale ${t.unref(ye)(H,mt)}`:""),1)],8,cC),Ee[17]||(Ee[17]=t.createElementVNode("td",null,null,-1))],2),ft(_e.modelId)?(t.openBlock(),t.createElementBlock("tr",uC,[Ee[20]||(Ee[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",mC,[t.createElementVNode("div",fC,[t.createElementVNode("fieldset",pC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(qe=t.unref(X)(H,mt))!=null&&qe.shareable?(t.openBlock(),t.createElementBlock("label",hC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(oe.BSSelect),{width:"150px","model-value":t.unref(te)(_e),items:t.unref(Ge)(),"value-provider":t.unref(d),"label-provider":t.unref(et),"onUpdate:modelValue":je=>je&&t.unref(de)(H,mt,je)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",yC,[Ee[18]||(Ee[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(_e),"model-value":t.unref(Le)(_e)?"false":t.unref(Fe)(_e),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":je=>je&&t.unref(ae)(H,mt,je)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",gC,[Ee[19]||(Ee[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(_e),"model-value":t.unref(Le)(_e)?"false":t.unref(q)(_e),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":je=>je&&t.unref(W)(H,mt,je)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(l).has(H.modelId),"em-aw__open":ft(H.modelId)})},[t.createElementVNode("td",bv,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:_e=>nt(H.modelId),onKeydown:[t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,_v)]),t.createElementVNode("td",{title:t.unref(_)(H)?t.unref(k)(H):t.unref(m)(H)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(_)(H),placeholder:t.unref(f)(H),"model-value":t.unref(p)(H),"onUpdate:modelValue":_e=>t.unref(h)(H,_e)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,kv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSSelect),{name:`aw-type-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!H.groupCode||H.attrType==="RELATION_REF"||t.unref(V)(H),items:t.unref(Sc)(H.type,t.unref(P),t.unref(Y)),"value-provider":t.unref(D),"label-provider":t.unref(C),"model-value":H.type,"onUpdate:modelValue":_e=>t.unref(R)(H,_e)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),H.type===t.unref(_n)&&!t.unref(V)(H)?(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:0,name:`aw-customtype-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":H.customType??"","onUpdate:modelValue":_e=>t.unref($)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,Ev),t.createElementVNode("td",null,[H.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Qt,{key:0,name:`aw-logical-${H.modelId}`,languages:t.unref(o).languages.value,"active-lang":J.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(It=H.dbAttrs[0])==null?void 0:It.logicalName,"onUpdate:modelValue":_e=>t.unref(B)(H,_e)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",Nv,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-col-${H.modelId}`,width:"100%",placeholder:t.unref(T)(H)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(r)||t.unref(A)(H),"model-value":((Rt=H.dbAttrs[0])==null?void 0:Rt.physicalName)??"","onUpdate:modelValue":_e=>t.unref(w)(H,{physicalName:_e})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":(ot=H.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(r)?t.unref(o).t("em.attr.serializedNoColumnNote"):t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSSelect),{name:`aw-dtype-${H.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(r)||t.unref(A)(H)||t.unref(V)(H),items:t.unref(wc)(((We=H.dbAttrs[0])==null?void 0:We.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(Yr),"model-value":((Ze=H.dbAttrs[0])==null?void 0:Ze.dataType)??"","onUpdate:modelValue":_e=>_e&&t.unref(w)(H,{dataType:_e})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,wv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSNumberInput),{name:`aw-len-${H.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(A)(H)||t.unref(V)(H),"model-value":(Q=H.dbAttrs[0])==null?void 0:Q.length,"onUpdate:modelValue":_e=>t.unref(w)(H,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,Iv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",Cv,[t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:t.unref(a)||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(E)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":t.unref(r)?!1:H.notNull,disabled:t.unref(r)||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(u)(H,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-uq-${H.modelId}`,label:"UQ","model-value":!!((Mt=H.dbAttrs[0])!=null&&Mt.unique),disabled:t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(w)(H,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,vv),t.createElementVNode("td",{class:"c-del",title:t.unref(N)(H)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])],8,Sv)],2),t.unref(m)(H)?(t.openBlock(),t.createElementBlock("tr",xv,[Ee[8]||(Ee[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",Rv,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-assocname-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(g)(H),"onUpdate:modelValue":_e=>t.unref(b)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,Av)])):t.createCommentVNode("",!0),ft(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[14]||(Ee[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",$v,[t.createElementVNode("div",Tv,[t.createElementVNode("fieldset",Mv,[Ee[12]||(Ee[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(H)},[Ee[9]||(Ee[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(oe.BSNumberInput),{name:`aw-scale-${H.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(A)(H)||t.unref(V)(H)||!t.unref(I)(H),"model-value":(Vt=H.dbAttrs[0])==null?void 0:Vt.scale,"onUpdate:modelValue":_e=>t.unref(w)(H,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,Vv),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-ai-${H.modelId}`,label:"Auto Increment","model-value":!!((Mn=H.dbAttrs[0])!=null&&Mn.autoIncrement),disabled:t.unref(A)(H)||t.unref(V)(H)||!H.identifier,"onUpdate:modelValue":_e=>t.unref(w)(H,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",Bv,[Ee[10]||(Ee[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{name:`aw-ins-${H.modelId}`,width:"110px",disabled:t.unref(A)(H),"model-value":t.unref(Fe)(H.dbAttrs[0]),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":_e=>_e&&t.unref(Se)(H,_e)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Dv,[Ee[11]||(Ee[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{name:`aw-upd-${H.modelId}`,width:"110px",disabled:t.unref(A)(H),"model-value":t.unref(q)(H.dbAttrs[0]),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":_e=>_e&&t.unref(Ce)(H,_e)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",Ov,[Ee[13]||(Ee[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-tr-${H.modelId}`,label:"@Transient","model-value":!!H.transient,disabled:H.identifier||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(S)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nid-${H.modelId}`,label:"@NaturalId","model-value":!!H.naturalId,disabled:H.identifier||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(y)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${H.modelId}`,label:"mutable","model-value":!!H.naturalIdMutable,disabled:t.unref(A)(H)||!H.naturalId,"onUpdate:modelValue":_e=>t.unref(u)(H,{naturalIdMutable:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-mv-${H.modelId}`,label:"Multi-Value (Set)","model-value":!!((an=H.dbAttrs[0])!=null&&an.multiValue),disabled:t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(w)(H,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(V)(H)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",Lv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",Pv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"150px","model-value":t.unref(M)(H),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":_e=>_e&&t.unref(x)(H,_e)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ie).length?(t.openBlock(),t.createElementBlock("label",zv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(up,{"model-value":H.groupCode,items:t.unref(ie),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":_e=>t.unref(He)(H,_e)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Fv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(fe)(H).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"150px","model-value":H.defaultValue??"none",items:t.unref(pe)(H),"value-provider":t.unref(ge),"label-provider":t.unref(Te),"onUpdate:modelValue":_e=>_e&&t.unref(De)(H,_e)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`aw-default-${H.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":H.defaultValue??"","onUpdate:modelValue":_e=>t.unref(Z)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",Uv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":_e=>t.unref(re)(H,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",bC,[t.createElementVNode("td",_C,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,rv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2bbe40a8"]]);function Ts(e,n){return n&&n!==e?`${e} (${n})`:e}function pp(e,n,o){const i=e.dbAttrs[n];return i?ci(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function NC(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Ts(o,pp(e,0,n))}function Ms(e,n){var l;if(Xn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Ts(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Ts(i,pp(o,r<0?0:r,n))}function hp(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:NC(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:Ms(a.modelId,e)})}}return n}const wC=["disabled"],IC={class:"em-idxw__list"},vC={class:"em-idxw__list-head"},CC=["aria-label"],SC=["aria-current","onClick","onKeydown"],xC={class:"em-idxw__item-name"},RC={key:0,class:"em-idxw__badge"},AC={class:"em-idxw__item-cnt"},$C={key:0,class:"em-idxw__empty"},TC={key:0,class:"em-idxw__edit"},MC={class:"em-idxw__form"},VC={class:"em-field em-idxw__name"},BC={class:"em-field"},DC=["value","placeholder"],OC={class:"em-idxw__transfer"},LC={class:"em-idxw__pane"},PC={class:"em-idxw__pane-head"},zC=["aria-label"],FC=["aria-pressed","onClick","onKeydown"],UC=["title"],HC={key:0,class:"em-idxw__empty"},jC={class:"em-idxw__arrows"},KC={class:"em-idxw__pane"},GC={class:"em-idxw__pane-head"},YC={class:"em-idxw__col-name"},qC=["title"],WC={class:"em-idxw__col-ops"},JC=["title","disabled","onClick"],XC=["title","disabled","onClick"],ZC=["title","onClick"],QC={key:0,class:"em-idxw__empty"},eS={key:1,class:"em-idxw__edit em-idxw__edit--empty"},tS=Qe(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find($=>$.modelId===n.entityId)??null),a=t.computed(()=>{var $;return(($=i.value)==null?void 0:$.indexes)??[]}),r=t.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,$=>{var w;$.some(I=>I.modelId===s.value)||(s.value=((w=$[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find($=>$.modelId===s.value)??null),d=t.computed(()=>i.value?si(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Jn(r.value)),m=$=>u.value.canon($),p=t.computed(()=>{var $;return new Set(((($=c.value)==null?void 0:$.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h($){return $.physicalName&&$.physicalName!==$.field?`${$.field} (${$.physicalName})`:$.field}function g($){return Ms($,f.value)}const b=t.computed(()=>[...hp(f.value).filter($=>!p.value.has(m($.ref))).map($=>({ref:$.ref,label:$.label,inherited:!1})),...d.value.filter($=>!p.value.has(m($.modelId))).map($=>({ref:$.modelId,label:h($),inherited:!0}))]),_=t.ref(new Set);t.watch(s,()=>_.value=new Set);function k($){return Xn($)}function N($,w){i.value&&o.updateIndex(i.value.modelId,$,w)}function y(){var w;if(!i.value)return;const $=Pe();o.addIndex(i.value.modelId,{modelId:$,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=$}function E($){i.value&&o.removeIndex(i.value.modelId,$)}function S($){c.value&&N(c.value.modelId,{parameters:$.trim()===""?void 0:$})}function A($){const w=new Set(_.value);w.has($)?w.delete($):w.add($),_.value=w}function V(){const $=c.value;if(!$||!_.value.size)return;const w=[..._.value].map(I=>({columnRef:I,descending:!1}));N($.modelId,{columns:[...$.columns,...w]}),_.value=new Set}function T($){const w=c.value;w&&N(w.modelId,{columns:w.columns.filter((I,v)=>v!==$)})}function D($,w){const I=c.value;I&&N(I.modelId,{columns:I.columns.map((v,B)=>B===$?{...v,descending:w}:v)})}function C($,w){const I=c.value;if(!I)return;const v=$+w;if(v<0||v>=I.columns.length)return;const B=[...I.columns];[B[$],B[v]]=[B[v],B[$]],N(I.modelId,{columns:B}),R(v,w)}async function R($,w){var x,P;await t.nextTick();const I=(x=l.value)==null?void 0:x.querySelectorAll(".em-idxw__col--idx")[$];if(!I)return;const v=Y=>I.querySelector(`[data-move="${Y}"]`),B=v(w<0?"up":"down"),M=v(w<0?"down":"up");(P=B&&!B.disabled?B:M)==null||P.focus()}return($,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",IC,[t.createElementVNode("div",vC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:y},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:v=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(v=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",xC,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",RC,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",AC,t.toDisplayString(I.columns.length),1)],42,SC))),128))],8,CC),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$C,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",TC,[t.createElementVNode("div",MC,[t.createElementVNode("label",VC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=I=>N(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=I=>N(c.value.modelId,{unique:I}))},null,8,["model-value"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=I=>E(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",BC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=I=>S(I.target.value))},null,40,DC)]),t.createElementVNode("div",OC,[t.createElementVNode("div",LC,[t.createElementVNode("div",PC,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:b.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:b.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":_.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":_.value.has(I.ref),onClick:v=>A(I.ref),onKeydown:[t.withKeys(t.withModifiers(v=>A(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>A(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.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,UC)):t.createCommentVNode("",!0)],42,FC))),128))],8,zC),b.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",HC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",jC,[t.createVNode(t.unref(oe.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!_.value.size,onClick:V},null,8,["caption","disabled"])]),t.createElementVNode("div",KC,[t.createElementVNode("div",GC,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(I,v)=>(t.openBlock(),t.createElementBlock("li",{key:v,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",YC,[t.createTextVNode(t.toDisplayString(g(I.columnRef)),1),k(I.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,qC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idxw-desc-${v}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":B=>D(v,B)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",WC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:v===0,onClick:B=>C(v,-1)},"↑",8,JC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:v===c.value.columns.length-1,onClick:B=>C(v,1)},"↓",8,XC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:B=>T(v)},"✕",8,ZC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",QC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",eS,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,wC)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),nS={class:"em-op-src"},oS=["placeholder"],iS={class:"em-op-src__actions"},yp=Qe(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(l,s)=>en(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(oe.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",nS,[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,oS),[[t.vModelText,a.value]]),t.createElementVNode("div",iS,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(oe.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"]]),aS=["disabled"],rS={class:"em-ow__toolbar"},lS={class:"em-ow__count"},sS={class:"em-ow__scroll"},cS={class:"em-ow__table"},dS={class:"c-name"},uS={class:"c-desc"},mS=["id"],fS={class:"c-pii"},pS={class:"c-src"},hS={class:"c-del"},yS={key:0},gS={colspan:"6",class:"em-ow__empty"},bS=Qe(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=oe.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((_,k)=>_.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(b){return b==="none"?o.t("em.common.noneParen"):b}const u=b=>b;function m(b,_){a.value&&o.updateOperation(a.value.modelId,b.modelId,_)}function p(b,_){m(b,{description:Object.keys(_).length?_:void 0})}function f(b){return b.personalInfoAttributeType??"none"}function h(b,_){m(b,{personalInfoAttributeType:_==="none"?void 0:_})}function g(b){i.openModal({component:yp,bind:{operationName:b.name,sourceCode:b.sourceCode??"",locale:o.uiLocale.value,onSave:_=>m(b,{sourceCode:_})}})}return(b,_)=>{var k,N;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",rS,[t.createElementVNode("span",lS,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:_[0]||(_[0]=y=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",sS,[t.createElementVNode("table",cS,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",dS,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),_[2]||(_[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",uS,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,mS),t.createVNode(mp,{modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=y=>l.value=y),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",fS,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",pS,t.toDisplayString(t.unref(o).t("em.op.body")),1),_[3]||(_[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,y=>(t.openBlock(),t.createElementBlock("tr",{key:y.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`ow-name-${y.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":y.name,"onUpdate:modelValue":E=>m(y,{name:E})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":y.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":E=>E&&m(y,{visibility:E})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Qt,{name:`ow-desc-${y.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":y.description,"onUpdate:modelValue":E=>p(y,E)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":f(y),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":E=>E&&h(y,E)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t(y.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:E=>g(y)},null,8,["caption","onClick"])]),t.createElementVNode("td",hS,[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:E=>t.unref(o).removeOperation(a.value.modelId,y.modelId)},null,8,["onClick"])])]))),128)),(N=a.value.operations)!=null&&N.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",yS,[t.createElementVNode("td",gS,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,aS)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),_S={class:"em-detail__tabs"},kS=["onClick"],ES={key:0,class:"em-detail__lock"},NS=["disabled"],wS={key:0,class:"em-detail__narrow"},IS=Qe(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=oe.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",_S,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,kS)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",ES,[t.createVNode(Ve,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",wS,[t.createVNode(ip,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(EC,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(tS,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(bS,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,NS)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function hr(e,n,o){e.openModal({component:IS,bind:{controller:t.markRaw(n),entityId:o}})}function xn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>Kd(e,r))}function tn(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of wu(l,r))i.push($a(a,s.indexRef,{columns:s.columns}))}return i}function yr(e,n,o,i){var c;const a=[];a.push(...xn(n,o.remove,i));for(const d of o.update)a.push(qt(n,d.attributeId,d.patch));for(const d of o.add)a.push(Yt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(Wt(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function ei(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ui(e,n,o){const i=[];for(const[a,r]of sl(e,n,Pe))i.push(...yr(e,a,r,o));for(const a of Iu(e,n,Pe))i.push(qt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function vS(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=wl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return vu(e,n,r).map(l=>qt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function gp(e,n,o){return Cu(e,n,o).map(i=>qt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function CS(e,n,o){const i=new Set(o.remove);return ei(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 gr(e,n,o){const i=[];for(const{entityId:a,plan:r}of od(e,n,Pe))i.push(...yr(e,a,r,o));return i}function bp(e,n,o=new Set){var r,l;if(!hn(n))return[];const i=[];for(const s of e.attributes){if(o.has(s.modelId))continue;const c={};s.dbAttrs.length>0&&(c.dbAttrs=[]),s.notNull&&(c.notNull=!1),Object.keys(c).length>0&&i.push(qt(e.modelId,s.modelId,c))}const a={};return(r=e.table)!=null&&r.physicalName&&(a.table=null),(l=e.indexes)!=null&&l.length&&(a.indexes=[]),e.schema&&(a.schema=null),e.jpaAttrs&&(a.jpaAttrs=null),Object.keys(a).length>0&&i.push(Ml(e.modelId,a)),i}function _p(e){return gn(e).map(n=>({...n.col,modelId:Pe()}))}function SS(e,n){var u;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=jt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Pe(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Pe(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Yt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(_=>_.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,g=h?f.end1:f.end2,b=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.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 p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=pi(l,n,Pe);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...xn(m.ownerId,[m.dispId],c)),i.push(Aa(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...yr(l,n,s,c));const d=CS(l,n,s);return i.push(...Ui(d,n,c)),i.push(...tn(e,c)),i}function xS(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(N=>N.modelId===c);if(!d||d.attributes.some(N=>{var y;return((y=N.embedded)==null?void 0:y.associationRef)===r.modelId}))continue;const u=Pe(),m=jt(d.attributes),p=new Set(d.attributes.map(N=>N.name)),f=a(o.name);let h=f;for(let N=2;p.has(h);N++)h=`${f}${N}`;const g=o.attributes.filter(N=>!N.identifier&&!N.derivedFrom).flatMap(N=>N.dbAttrs).map(N=>({...N,modelId:Pe()})),b={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Yt(c,b));const _=l?"end2":"end1",k=l?"end1":"end2";i.push(Aa(r.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function kp(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[Fd(n,o),...i.map(u=>Fo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(ou(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(Ei(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function RS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Pe(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=pi(p,s,Pe),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},b=Ra(m,g),_=yr(p,s,f,[]);return i(_.length?at("관계 추가",[b,..._]):b),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(S=>S.modelId===l),d=n.logical.entities.find(S=>S.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Pe(),m=Pe(),p=Pe(),f=jt(c.attributes),h=_p(d),g=S=>S&&S.charAt(0).toLowerCase()+S.slice(1),b=new Set(c.attributes.map(S=>S.name)),_=g(d.name);let k=_;for(let S=2;b.has(k);S++)k=`${_}${S}`;const N={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},y={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},E={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(at("임베드 추가",[Yt(l,N),Ra(y,E)])),u},setEmbedCardinality(l,s){var _;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const N=k.attributes.find(y=>{var E;return((E=y.embedded)==null?void 0:E.associationRef)===l&&y.attrType==="EMBED_OWN"});if(N){d=k.modelId,u=N;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",g=h(f.multiplicity),b=h(s);if(g===b){i(Wt(l,p,{multiplicity:s}));return}if(b)i(at("임베드 컬렉션 전환",[qt(d,u.modelId,{dbAttrs:[]}),Wt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((_=f.jpa)==null?void 0:_.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(N=>N.modelId===m);if(!k)return;i(at("임베드 단일 전환",[qt(d,u.modelId,{dbAttrs:_p(k)}),Wt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=Zd(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(g=>{var b;return((b=g.embedded)==null?void 0:b.associationRef)===l});if(h){const g=[];i(at("임베드 삭제",[c,...xn(f.modelId,[h.modelId],g),...tn(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=gr(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");h&&p.push(...xn(f.modelId,[h.modelId],m))}p.push(...tn(n.logical,m)),i(p.length?at("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=Aa(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=gr(m,[u],p);f.push(...tn(n.logical,p)),i(f.length?at("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=ca(d.end2.multiplicity),h=d.end1.navFieldNameHint||ua(m.name,f),g=to(h,new Set(u.attributes.map(N=>N.name))),b=Pe(),_=jt(u.attributes),k={modelId:b,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:_,dbAttrs:[]};i(at("inverse nav 추가",[Yt(d.end1.entityRef,k),Wt(l,"end1",{...c,attributeRef:b,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,h=u.attributes.find(k=>k.modelId===f&&k.attrType==="RELATION_REF"),g=Wt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(h==null?void 0:h.name)??d.end1.navFieldNameHint}),b=[],_=h?xn(d.end1.entityRef,[f],b):[];i(h?at("inverse nav 제거",[..._,g,...tn(n.logical,b)]):g);return}}}i(Wt(l,s,c))}}}function AS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=qt(u,m,p),h=ei(n.logical,u,_=>_.map(k=>k.modelId===m?{...k,...p}:k)),g=[],b=Ui(h,u,g);b.push(...tn(n.logical,g)),i(b.length?at("속성 수정",[f,...b]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(k=>k.type===m),f=n.logical.entities.find(k=>k.modelId===u);if(!p||!f)return null;const h=jt(f.attributes),g=Pe(),b=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),_={modelId:g,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:h,dbAttrs:b};return i(Yt(u,_)),g},addSerializedTypeAttribute(u,m){if(!o.value||a(u))return null;const p=n.logical.entities.find(_=>_.modelId===u),f=n.logical.entities.find(_=>_.modelId===m);if(!p||!f||!hn(f.stereotype)||!f.name)return null;const h=f.name.charAt(0).toLowerCase()+f.name.slice(1),g=to(h,new Set(p.attributes.map(_=>_.name))),b=Pe();return i(Yt(u,{modelId:b,name:g,type:f.name,attrType:"NORMAL",identifier:!1,notNull:!1,order:jt(p.attributes),dbAttrs:[{modelId:Pe(),physicalName:g,dataType:"CLOB"}]})),b},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(E=>E.modelId===u),f=p?jt(p.attributes):0,h=m.modelId??Pe(),g=m.name??`field${f}`,b={modelId:h,name:g,type:m.type??Wr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??(p&&hn(p.stereotype)?[]:[{modelId:Pe(),physicalName:g,dataType:"VARCHAR"}]),...m},_=Yt(u,b),k=ei(n.logical,u,E=>[...E,b]),N=[],y=Ui(k,u,N);return y.push(...tn(n.logical,N)),i(y.length?at("속성 추가",[_,...y]):_),h},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),p=m?jt(m.attributes):0,f=Pe();return i(Yt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?eo:Wr})},setEmbedColumns(u,m,p){var k,N;if(a(u))return;const f=qt(u,m,{dbAttrs:p}),h=(k=n.logical.entities.find(y=>y.modelId===u))==null?void 0:k.attributes.find(y=>y.modelId===m),g=(N=h==null?void 0:h.embedded)==null?void 0:N.associationRef,b=g?n.logical.associations.find(y=>y.modelId===g):void 0,_=[];b&&g&&(b.end1.legacyEmbedRaw&&_.push(Wt(g,"end1",{legacyEmbedRaw:void 0})),b.end2.legacyEmbedRaw&&_.push(Wt(g,"end2",{legacyEmbedRaw:void 0}))),i(_.length?at("임베드 컬럼 수정",[f,..._]):f)},removeAttribute(u,m){if(a(u))return;if(Lo(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=xn(u,[m],p),h=ei(n.logical,u,_=>_.filter(k=>k.modelId!==m)),g=[...Ui(h,u,p),...tn(n.logical,p),...gp(n.logical,u,[m])],b=[...f,...g];i(b.length===1?b[0]:at("속성 삭제",b))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const p=m.filter(N=>!Lo(n.logical,u,N));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],h=xn(u,p,f),g=new Set(p),b=ei(n.logical,u,N=>N.filter(y=>!g.has(y.modelId))),_=[...h,...Ui(b,u,f),...tn(n.logical,f),...gp(n.logical,u,p)];i(_.length===1?_[0]:at("속성 삭제",_)),((k=c.value)==null?void 0:k.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(Ca(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(Ca(u,m[0],p)):i(at("속성 색상",m.map(f=>Ca(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=Bl(u,m,p),h=vS(n.logical,u,m,p);i(h.length?at("속성 재정렬",[f,...h]):f)}}}function $S(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Pe(),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=Pe();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Pe()}for(const a of n.indexes??[]){a.modelId=Pe();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Pe();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const TS=220;function MS(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||TS));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 Vs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function VS(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(b=>n.logical.entities.some(_=>_.modelId===b));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(_=>_.modelId===d.entityId);if(!g)return;const b=[...g.attributes].sort((_,k)=>_.order-k.order).filter(_=>d.ids.includes(_.modelId));if(!b.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:b}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),p=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:g,geo:b,locked:_,...k}=p;Object.keys(k).length&&(h=k)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(y=>y.modelId===f);if(!h)return[];const g=new Set(h.attributes.map(y=>y.name)),b=new Set(h.attributes.flatMap(y=>y.dbAttrs.map(E=>E.physicalName))),_=jt(h.attributes),k=[],N=c.attributes.map((y,E)=>{const S=JSON.parse(JSON.stringify(y));S.modelId=Pe();for(const A of S.dbAttrs)A.modelId=Pe();g.has(S.name)&&(S.name=to(`${S.name}_copy`,g)),g.add(S.name);for(const A of S.dbAttrs)A.physicalName&&b.has(A.physicalName)&&(A.physicalName=to(`${A.physicalName}_copy`,b)),A.physicalName&&b.add(A.physicalName);return S.order=_+E,k.push(S.modelId),Yt(f,S)});return l(N.length===1?N[0]:at("속성 붙여넣기",N)),i.value={kind:"attribute",entityId:f,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=$S(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=Na(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=Na(f.operationStyles,h)),p=f}return l(va(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Id(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?MS(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(N=>[N.entityRef,N])),g=new Map(m.layout.associationLayouts.map(N=>[N.associationRef,N])),b=new Map(m.layout.groupLayouts.map(N=>[N.groupRef,N])),_=[];let k=80;for(const N of m.logical.entities){const y=h.get(N.modelId),E=y?{location:Vs(y.geo.location,f),size:{...y.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let S;if(y){const{entityRef:A,geo:V,locked:T,...D}=y;S=D}_.push(va(N,E,S))}for(const N of m.logical.associations){const y=g.get(N.modelId),E=y?{...y,waypoints:y.waypoints.map(S=>Vs(S,f))}:{associationRef:N.modelId,waypoints:[]};_.push(Ra(N,E))}for(const N of m.logical.groups){const y=b.get(N.modelId),E=y?{location:Vs(y.geo.location,f),size:{...y.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let S;if(y){const{groupRef:A,geo:V,locked:T,memberNoteRefs:D,...C}=y;S=C}_.push(Sa(N,E,S))}return l(at("다이어그램 가져오기",_)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(N=>N.modelId)}};return s}function BS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l,t:s,emitGateNotice:c}=e;return{addEntity(d="NewEntity",u={x:80,y:80}){if(!o.value)return null;const m=Pe(),p={modelId:m,name:d,stereotype:"JPA_ENTITY",table:{physicalName:d.toLowerCase()},attributes:[{modelId:Pe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Pe(),physicalName:"id",dataType:"BIGINT"}]}]};return i(va(p,{location:{...u},size:{width:220,height:140}})),m},renameEntity(d,u){a(d)||i(Md(d,u))},updateEntity(d,u){if(a(d))return;const m=Ml(d,u),p=n.logical.entities.find(k=>k.modelId===d),f=p==null?void 0:p.stereotype,h=u.stereotype,g=!!h&&!!p&&!!f&&_t(h)&&!_t(f),b=!!h&&!!p&&!!f&&!_t(h)&&_t(f);if(!!h&&!!p&&!!f&&h!==f&&_t(h)&&_t(f)&&p){const k=n.logical.entities.filter(y=>y.attributes.some(E=>{var S;return((S=E.embedded)==null?void 0:S.embeddableRef)===d}));if(k.length>0){c(s("em.entity.valueTypeSwitchEmbedded",{name:p.name,owners:k.length}));return}const N=bp(p,h);i(N.length?at("직렬화 타입 변환",[m,...N]):m);return}if(h==="SERIALIZED_TYPE"&&p){const k=n.logical.associations.filter(N=>N.end1.entityRef===d||N.end2.entityRef===d);if(k.length>0){c(s("em.entity.serializedTypeHasRelations",{name:p.name,count:k.length}));return}}if(g&&p&&h){const k=p.attributes.filter(T=>T.identifier&&!T.derivedFrom).map(T=>qt(d,T.modelId,{identifier:!1})),N=ei({...n.logical,entities:n.logical.entities.map(T=>T.modelId===d?{...T,stereotype:h}:T)},d,T=>T.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),y=[],E=gr(N,[d],y);E.push(...tn(n.logical,y));const S=h==="JPA_EMBEDDABLE"?xS(n.logical,d):[],A=bp(p,h,new Set(y.filter(T=>T.entityId===d).map(T=>T.attributeId))),V=[m,...k,...E,...S,...A];i(V.length>1?at(h==="SERIALIZED_TYPE"?"직렬화 타입 변환":"임베더블 변환",V):m);return}if(b){const k=SS(n.logical,d),N=[m,...k];i(N.length>1?at("엔터티 전환",N):m);return}i(m)},moveEntity(d,u){a(d)||i(Fo(d,u))},resizeEntity(d,u){a(d)||i(Vd(d,u))},removeEntity(d){if(a(d))return;const u=Td(d);if(!n.logical.entities.find(k=>k.modelId===d)){i(u);return}const p=n.logical.associations.filter(k=>k.end1.entityRef===d||k.end2.entityRef===d),f=new Set(p.map(k=>k.modelId)),h=[],g=[];for(const k of n.logical.entities)if(k.modelId!==d)for(const N of k.attributes)N.embedded&&f.has(N.embedded.associationRef)&&h.push(...xn(k.modelId,[N.modelId],g));for(const k of p){if(k.end1.entityRef===d||!k.end1.attributeRef)continue;const N=n.logical.entities.find(E=>E.modelId===k.end1.entityRef),y=N==null?void 0:N.attributes.find(E=>E.modelId===k.end1.attributeRef&&E.attrType==="RELATION_REF");y&&h.push(...xn(N.modelId,[y.modelId],g))}const b={...n.logical,entities:n.logical.entities.filter(k=>k.modelId!==d),associations:n.logical.associations.filter(k=>!f.has(k.modelId))},_=new Set(p.filter(k=>k.end1.entityRef===d&&k.end2.entityRef!==d).map(k=>k.end2.entityRef));h.push(...gr(b,[..._],g)),h.push(...tn(n.logical,g.filter(k=>k.entityId!==d))),i(h.length?at("엔티티 삭제",[u,...h]):u)},setEntitySwatch(d,u){i(Bd(d,u))},setEntityCollapsed(d,u){i(Dd(d,u))},setEntityLocked(d,u){i(Od(d,u))},isEntityLocked(d){return r(d)},isAssociationLocked(d){return l(d)},collapseAll(){i(Vl(!0))},expandAll(){i(Vl(!1))}}}function DS(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(_=>n.layout.entityLayouts.find(k=>k.entityRef===_)).filter(_=>!!_);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const _ of u){const k=_.geo.size.width||220,N=_.geo.size.height||140;m=Math.min(m,_.geo.location.x),p=Math.min(p,_.geo.location.y),f=Math.max(f,_.geo.location.x+k),h=Math.max(h,_.geo.location.y+N)}const g=40,b=28;return{location:{x:m-g,y:p-g-b},size:{width:f-m+g*2,height:h-p+g*2+b}}}return{dragGroup(d,u,m){l(d)||i(at("그룹 이동",kp(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Ud(d,u))},setGroupSwatch(d,u){i(Hd(d,u))},setGroupLocked(d,u){i(jd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(Ld(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const g of d)h.memberEntityRefs.includes(g)&&m.push(xa(h.modelId,g));const p=Pe(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(Sa(f,c(d))),i(at("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Pe();return i(Sa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(Pd(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[Fo(d,u)];p!==m&&(p&&f.push(xa(p,d)),m&&f.push(zd(m,d))),i(at("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(xa(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(g=>{var b;return(b=g.memberNoteRefs)==null?void 0:b.includes(d)}))==null?void 0:h.groupRef)??null,f=[Ei(d,u)];p!==m&&(p&&f.push(mu(p,d)),m&&f.push(uu(m,d))),i(at("이동",f))}}}function OS(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,b){if(d(),!o.value||!e.opTransport)return;const _=new ku({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});_.seed((b==null?void 0:b.revSeed)??{}),c=_.attach(g),s=_}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let b;try{b=await l(g)}catch(_){return{ok:!1,reason:_ instanceof Error?_.message:String(_)}}return b.ok&&p.value++,b}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function LS(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Pe();return o(ru({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(lu(i))},moveNote(i,a){o(Ei(i,a))},resizeNote(i,a){o(su(i,a))},setNoteMemo(i,a){o(cu(i,a))},setNoteSwatch(i,a){o(du(i,a))},addNoteConnection(i,a){o(fu(i,a))},removeNoteConnection(i,a){o(pu(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(hu(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(yu(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(gu(i,a,r))},clearNoteConnectionWaypoints(i,a){o(bu(i,a))}}}function PS(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const y=p.ids.includes(u),E=y?p.ids.filter(A=>A!==u):[...p.ids,u];if(!E.length){o.value=null;return}const S=y&&p.anchor===u?E[E.length-1]:y?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:E,anchor:S};return}const h=n.logical.entities.find(y=>y.modelId===d),g=[...(h==null?void 0:h.attributes)??[]].sort((y,E)=>y.order-E.order).map(y=>y.modelId),b=g.indexOf(p.anchor),_=g.indexOf(u);if(b<0||_<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,N]=b<=_?[b,_]:[_,b];o.value={kind:"attribute",entityId:d,ids:g.slice(k,N+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(g=>g.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(y=>y.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((y,E)=>f.has(y.modelId)?E:-1).filter(y=>y>=0);if(!h.length)return!1;const g=Math.min(...h),b=p.filter(y=>!f.has(y.modelId)),_=p.slice(0,g).filter(y=>!f.has(y.modelId)).length;let k;if(d<0){if(_<=0)return!0;k=_-1}else{if(b.length-_<=0)return!0;k=_+1}if(r(u.entityId))return!0;const N=p.filter(y=>f.has(y.modelId)).map(y=>y.modelId);return a(Bl(u.entityId,N,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(k=>k.modelId)),f=new Set(n.logical.groups.map(k=>k.modelId)),h=new Set(n.layout.notes.map(k=>k.modelId)),g=new Set;for(const k of d){if(!f.has(k))continue;const N=n.logical.groups.find(y=>y.modelId===k);for(const y of(N==null?void 0:N.memberEntityRefs)??[])g.add(y)}const b=[],_=[];for(const k of d)if(f.has(k)){if(s(k))continue;const N=n.layout.groupLayouts.find(A=>A.groupRef===k);if(!N)continue;const y=n.logical.groups.find(A=>A.modelId===k),E=((y==null?void 0:y.memberEntityRefs)??[]).map(A=>{var T;const V=((T=n.layout.entityLayouts.find(D=>D.entityRef===A))==null?void 0:T.geo.location)??{x:0,y:0};return{id:A,location:{x:V.x+u,y:V.y+m}}}),S={x:N.geo.location.x+u,y:N.geo.location.y+m};b.push(at("그룹 이동",kp(n,k,S,E))),_.push("g:"+k)}else if(p.has(k)){if(g.has(k)||l(k))continue;const N=n.layout.entityLayouts.find(y=>y.entityRef===k);if(!N)continue;b.push(Fo(k,{x:N.geo.location.x+u,y:N.geo.location.y+m})),_.push("e:"+k)}else if(h.has(k)){const N=n.layout.notes.find(y=>y.modelId===k);if(!N)continue;b.push(Ei(k,{x:N.geo.location.x+u,y:N.geo.location.y+m})),_.push("n:"+k)}return b.length?(a(at("이동",b,"nudge:"+_.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const Gn=Symbol("editorController");function Ep(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zS(e=Ep(),n={}){var Se,Ge,et;const o=t.reactive(e);let i=new Tl(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"),u=t.ref(n.uiLocale??"ko"),m=(te,de)=>en(u.value,te,de),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),b=t.ref(!1),_=t.ref(!1),k=t.ref(!1),N=t.ref(0),y=t.ref(null);let E=0;const S=te=>{if(n.onNotice){n.onNotice(te);return}y.value={text:te,id:++E}},A=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),V=t.ref(((Ge=n.meta)==null?void 0:Ge.opWriteEnabled)??!1),T=t.ref(((et=n.meta)==null?void 0:et.referenceOnly)??!1),D=t.computed(()=>A.value>=2&&V.value),C=t.ref(!(A.value>=2&&V.value===!1)),R=t.ref("LOGICAL_PHYSICAL"),$=t.ref("straight"),w=t.ref(!0),I=t.ref(!0),v=t.ref(null),B=t.computed(()=>{var te;return((te=v.value)==null?void 0:te.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),M=t.computed(()=>{var te;return((te=v.value)==null?void 0:te.kind)==="attribute"?v.value.ids:[]}),x=t.computed(()=>{var te,de;return((te=v.value)==null?void 0:te.kind)==="entity"?v.value.id:((de=v.value)==null?void 0:de.kind)==="attribute"?v.value.entityId:null}),P=t.ref(null),Y=t.ref(null),se=t.ref(null),he=t.ref(null),ie=OS({state:o,opMode:D,editable:C,opConflict:se,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function fe(){i.onChange(()=>{b.value=i.canUndo,_.value=i.canRedo,k.value=i.isDirty,N.value++})}fe(),ie.setupOpAdapter(i,n.meta);const pe=t.computed(()=>mc(o.logical,o.layout)),ge=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Te=()=>Zr(o.logical,T.value),He=n.validationDebounceMs??250;let De,Z=()=>{};if(He>0){const te=t.shallowRef(ga(Te(),ge.value));let de;Z=()=>{de!==void 0&&(clearTimeout(de),de=void 0),te.value=ga(Te(),ge.value)},t.watch([N,ge,T],()=>{de!==void 0&&clearTimeout(de),de=setTimeout(Z,He)},{flush:"sync"}),De=t.computed(()=>te.value)}else De=t.computed(()=>ga(Te(),ge.value));const re=t.computed(()=>{const te=new Map;for(const de of De.value){if(!de.targetRef)continue;const Le=te.get(de.targetRef);Le?Le.push(de):te.set(de.targetRef,[de])}return te}),ue=1500,z=new Map,L=te=>{const de=Date.now();de-(z.get(te)??0)<ue||(z.set(te,de),S(te))},F=te=>{if(!he.value){if(!C.value){L(m("em.notice.readOnly"));return}try{i.execute(te)}catch(de){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${te.label}):`,de),C.value=!1,he.value={label:te.label}}}},X=te=>o.layout.entityLayouts.some(de=>de.entityRef===te&&!!de.locked),ee=te=>o.layout.groupLayouts.some(de=>de.groupRef===te&&!!de.locked),ke=te=>{const de=o.logical.associations.find(Le=>Le.modelId===te);return!!de&&(X(de.end1.entityRef)||X(de.end2.entityRef))},ye=te=>X(te)?(L(m("em.notice.entityLocked")),!0):!1,Ne=te=>ee(te)?(L(m("em.notice.groupLocked")),!0):!1,we=te=>ke(te)?(L(m("em.notice.assocLocked")),!0):!1,G=VS({state:o,clipboard:Y,selection:v,inspectedEntityId:x,editable:C,run:F}),q=PS({state:o,selection:v,focusRequest:P,run:F,gateEntityLocked:ye,isEntityLockedFn:X,isGroupLockedFn:ee}),W=BS({state:o,editable:C,run:F,gateEntityLocked:ye,isEntityLockedFn:X,isAssocLockedFn:ke,t:m,emitGateNotice:L}),Ce=AS({state:o,editable:C,run:F,gateEntityLocked:ye,embeddableCatalog:a,t:m,emitGateNotice:L,selection:v}),$e=DS({state:o,editable:C,run:F,selection:v,gateEntityLocked:ye,gateGroupLocked:Ne,isGroupLockedFn:ee}),ze=LS({editable:C,run:F}),Fe=RS({state:o,editable:C,run:F,gateEntityLocked:ye,gateAssocLocked:we});return{state:o,resolved:pe,issues:De,issuesByRef:re,flagEntitiesWithoutRelations:g,canUndo:b,canRedo:_,dirty:k,revision:N,notice:y,editable:C,schemaVersion:A,opWriteEnabled:V,opMode:D,opConflict:se,commandFailure:he,historyTransport:ie.historyTransport,historyAvailable:ie.historyAvailable,restoreTransport:ie.restoreTransport,restoreAvailable:ie.restoreAvailable,restoreToSeq:ie.restoreToSeq,reloadRequest:ie.reloadRequest,displayMode:R,routingMode:$,showGrid:w,showMinimap:I,selection:v,selectedAttr:B,selectedAttrIds:M,inspectedEntityId:x,focusRequest:P,clipboard:Y,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:T,uiLocale:u,t:m,selectableDataTypes:f,setEditable(te){C.value=te&&D.value},setEmbeddableCatalog(te){a.value=te},setGroupCodeCatalog(te){r.value=te},setPredefinedCustomTypeCatalog(te){l.value=te},setSuperClassCatalog(te){s.value=te},selectAttribute:q.selectAttribute,moveAttributeFocus:q.moveAttributeFocus,nudgeSelectedAttributes:q.nudgeSelectedAttributes,nudgeNodes:q.nudgeNodes,requestFocus:q.requestFocus,deleteSelection(){if(!C.value)return!1;const te=v.value;if(!te)return!1;if(te.kind==="attribute"){if(ye(te.entityId))return!1;const de=te.ids;if(!de.length)return!1;de.length===1?Ce.removeAttribute(te.entityId,de[0]):Ce.removeAttributes(te.entityId,de)}else if(te.kind==="entity"){if(ye(te.id))return!1;W.removeEntity(te.id)}else if(te.kind==="note")ze.removeNote(te.id);else if(te.kind==="group"){if(Ne(te.id))return!1;$e.removeGroup(te.id)}else Fe.removeAssociation(te.id);return v.value=null,!0},undo:()=>{C.value&&i.undo()},redo:()=>{C.value&&i.redo()},markSaved:()=>{C.value&&(ie.flush(),i.markSavePoint())},loadDiagram(te,de){ie.teardownOpAdapter(),o.logical=te.logical,o.layout=te.layout,i=new Tl(o),fe(),A.value=(de==null?void 0:de.schemaVersion)??1,V.value=(de==null?void 0:de.opWriteEnabled)??!1,T.value=(de==null?void 0:de.referenceOnly)??!1,C.value=!(A.value>=2&&V.value===!1),se.value=null,he.value=null,v.value=null,b.value=i.canUndo,_.value=i.canRedo,k.value=i.isDirty,ie.setupOpAdapter(i,de),Z()},flush:ie.flush,whenOpsSettled:ie.whenOpsSettled,addEntity:W.addEntity,renameEntity:W.renameEntity,updateEntity:W.updateEntity,moveEntity:W.moveEntity,resizeEntity:W.resizeEntity,removeEntity:W.removeEntity,setEntitySwatch:W.setEntitySwatch,setEntityCollapsed:W.setEntityCollapsed,setEntityLocked:W.setEntityLocked,isEntityLocked:W.isEntityLocked,isAssociationLocked:W.isAssociationLocked,collapseAll:W.collapseAll,expandAll:W.expandAll,setAttributeSwatch:Ce.setAttributeSwatch,dragGroup:$e.dragGroup,resizeGroup:$e.resizeGroup,setGroupSwatch:$e.setGroupSwatch,setGroupLocked:$e.setGroupLocked,isGroupLocked:$e.isGroupLocked,updateGroup:$e.updateGroup,createGroup:$e.createGroup,addEmptyGroup:$e.addEmptyGroup,removeGroup:$e.removeGroup,dropEntity:$e.dropEntity,ungroupEntity:$e.ungroupEntity,dropNote:$e.dropNote,addPredefinedEmbed:Ce.addPredefinedEmbed,addSerializedTypeAttribute:Ce.addSerializedTypeAttribute,addAttribute:Ce.addAttribute,addDivider:Ce.addDivider,updateAttribute:Ce.updateAttribute,setAttributeGroupCode:Ce.setAttributeGroupCode,setEmbedColumns:Ce.setEmbedColumns,removeAttribute:Ce.removeAttribute,removeAttributes:Ce.removeAttributes,setAttributeSwatches:Ce.setAttributeSwatches,reorderAttributes:Ce.reorderAttributes,addIndex(te,de){ye(te)||F(Qd(te,de))},updateIndex(te,de,Le){ye(te)||F($a(te,de,Le))},removeIndex(te,de){ye(te)||F(eu(te,de))},addOperation(te,de={}){if(!C.value||ye(te))return null;const Le=o.logical.entities.find(st=>st.modelId===te),dt=Le!=null&&Le.operations?jt(Le.operations):0,Xe=de.modelId??Pe(),yt={modelId:Xe,name:de.name??`method${dt}`,visibility:de.visibility??"PACKAGE",order:dt,...de};return F(Yd(te,yt)),Xe},updateOperation(te,de,Le){ye(te)||F(qd(te,de,Le))},removeOperation(te,de){ye(te)||F(Wd(te,de))},reorderOperations(te,de,Le){!de.length||ye(te)||F(Jd(te,de,Le))},setOperationSwatch(te,de,Le){F(Xd(te,de,Le))},addAssociation:Fe.addAssociation,addEmbedAssociation:Fe.addEmbedAssociation,setEmbedCardinality:Fe.setEmbedCardinality,removeAssociation:Fe.removeAssociation,setAssociationIdentifying:Fe.setAssociationIdentifying,updateAssociationEnd:Fe.updateAssociationEnd,hasQuickFix(te){if(!C.value)return!1;const de=ml(te,o.logical);return de?de.kind==="setEndCascades"?!ke(de.assocRef):!X(de.entityRef):!1},applyQuickFix(te){if(!C.value)return!1;const de=ml(te,o.logical);if(!de)return!1;if(de.kind==="setIndexColumns")return ye(de.entityRef)?!1:(F($a(de.entityRef,de.indexRef,{columns:de.columns})),!0);if(we(de.assocRef))return!1;const Le=o.logical.associations.find(dt=>dt.modelId===de.assocRef);return Le?(F(Wt(de.assocRef,de.which,{jpa:{...Le[de.which].jpa,cascadeTypes:de.cascades}})),!0):!1},moveWaypoint(te,de,Le){F(tu(te,de,Le))},addWaypoint(te,de,Le){F(au(te,de,Le))},removeWaypoint(te,de){F(nu(te,de))},clearWaypoints(te){F(iu(te))},addNote:ze.addNote,removeNote:ze.removeNote,moveNote:ze.moveNote,resizeNote:ze.resizeNote,setNoteMemo:ze.setNoteMemo,setNoteSwatch:ze.setNoteSwatch,addNoteConnection:ze.addNoteConnection,removeNoteConnection:ze.removeNoteConnection,moveNoteConnectionWaypoint:ze.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:ze.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:ze.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:ze.clearNoteConnectionWaypoints,autoLayout(){const te=fc(o.logical,o.layout);te.length&&F(at("자동 배치",te.map(de=>Fo(de.id,de.location))))},copy:G.copy,paste:G.paste,importEntities:G.importEntities}}const br=Symbol("groupHover"),Np=Symbol("groupDrag"),vo=Symbol("relationHighlight"),wp=Symbol("diffOverlay"),Ip=Symbol("nodeInternals"),vp=Symbol("columnResolution");function FS(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Cp(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!FS(e[o],n[o]))return!1;return!0}function Sp(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Cp(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function US(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function HS(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!US(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!Sp(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Cp(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!jS(e.classRows,n.classRows)}function jS(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!Sp(i.attr,a.attr))return!1}return!0}function KS(){let e;return(n,o)=>e=GS(n,o,e)}function GS(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const p=()=>m??(m=$o(Dn(s,i)));for(const k of s.attributes){if(ia(k)){const S=k.dbAttrs[0];if(!(S!=null&&S.physicalName&&(S!=null&&S.dataType))){const A=Zn(k,s,i,e.associations);A&&c.set(k.modelId,{...k,dbAttrs:[{...S,physicalName:(S==null?void 0:S.physicalName)||A.physicalName,dataType:(S==null?void 0:S.dataType)||A.dataType,length:(S==null?void 0:S.length)??A.length,scale:(S==null?void 0:S.scale)??A.scale},...k.dbAttrs.slice(1)]})}}if(k.identifier&&k.attrType==="RELATION_OWN"){const S=Lo(e,s.modelId,k.modelId);if(S&&ka(k,S)){const A=c.get(k.modelId)??k,V=k.derivedIdFieldName||yl({...k,derivedIdFieldName:void 0},S,l());V&&c.set(k.modelId,{...A,derivedIdFieldName:V})}}const N=aa(k,e.associations);if(N&&u.set(k.modelId,N),yn(k)){d.set(k.modelId,k.dbAttrs.map((S,A)=>{const V=Zn(k,s,i,e.associations,A);return V?{...S,physicalName:S.physicalName||V.physicalName,dataType:S.dataType||V.dataType,length:S.length??V.length,scale:S.scale??V.scale}:S}));continue}if(!k.attrType.startsWith("EMBED")||k.dbAttrs.length===0)continue;if(k.attrType!=="EMBED_PREDEF"){const S=p();d.set(k.modelId,k.dbAttrs.map((A,V)=>{const T=Qn(A,S);return T?{...A,physicalName:T.physicalName}:bn(k,A,V,s,e)}));continue}const y=n==null?void 0:n.find(S=>S.type===k.type);if(!y)continue;const E=p();d.set(k.modelId,k.dbAttrs.map((S,A)=>{const V=y.fields[A],T=Qn(S,E);return T?{...S,physicalName:T.physicalName,logicalName:S.logicalName??(V==null?void 0:V.logicalName),dataType:S.dataType||(V==null?void 0:V.dataType)||""}:V?{...S,physicalName:S.physicalName||V.physicalName,logicalName:S.logicalName??V.logicalName,dataType:S.dataType||V.dataType,length:S.length??V.length}:S}))}const f=new Map,h=new Map;for(const k of s.attributes){const N=d.get(k.modelId);if(N)for(let y=0;y<N.length;y++){const E=`${k.attrType}\0${k.type??""}\0${y}`,S={attrId:k.modelId,slot:y,name:N[y].physicalName??""},A=h.get(E);A?A.push(S):h.set(E,[S])}}for(const k of h.values()){if(k.length<2)continue;const N=new Map;for(const y of k)N.set(y.name,(N.get(y.name)??0)+1);for(const y of k){if((N.get(y.name)??0)<2)continue;const E=f.get(y.attrId);E?E.add(y.slot):f.set(y.attrId,new Set([y.slot]))}}const g=gl(s,e).fields.map(k=>{var N;return{attr:k.attr,synthetic:k.synthetic,sourceAttrId:k.sourceAttr.modelId,targetName:(N=k.target)==null?void 0:N.name,collection:k.collection}}),b={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:g},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&HS(b,_)?_:b)}return a}const xp=Symbol("embedSlotCollapse"),Rp=(e,n)=>`${e}:${n}`,Ap="all:",$p="one:",Tp="fk:",Mp=e=>`${Ap}${e}`,YS=(e,n)=>`${$p}${e}:${n}`,qS=(e,n)=>`${Tp}${e}:${n}`,WS=e=>e.startsWith(Tp)||!e.startsWith(Ap)&&!e.startsWith($p),JS=["title"],XS={key:0,class:"em-sel","aria-hidden":"true"},ZS=["title","aria-expanded","disabled"],QS={class:"em-entity__stereotype"},ex={key:1,class:"em-entity__name"},tx=["title","aria-expanded"],nx={"aria-hidden":"true"},ox=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],ix=["onPointerdown"],ax={key:1,class:"em-entity__divider-label"},rx=["title"],lx={class:"em-key-slot"},sx={class:"em-key-slot"},cx=["title","aria-expanded","onClick"],dx=["title","onClick"],ux=["title","aria-expanded","onClick"],mx={key:2,class:"em-entity__type"},fx=["onClick"],px={class:"em-entity__attrname"},hx={class:"em-entity__type"},yx={key:1,class:"em-entity__embed-summary"},gx=["title"],bx=["data-op"],_x=["onPointerdown"],kx={class:"em-entity__op-vis","aria-hidden":"true"},Ex=["title"],Nx={key:4,class:"em-entity__footer"},Vp=Qe(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=(j,K)=>o?o.t(j,K):en("ko",j,K),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=oe.useModal();function l(){o&&hr(r,o,n.id)}const s=t.inject(br,null),c=t.inject(vo,null),d=t.inject(wp,null),u=t.computed(()=>{var j;return((j=d==null?void 0:d.marks.value)==null?void 0:j.get(n.id))??null}),m=t.inject(vp,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(xp,void 0),h=t.inject(Ip,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function b(){s&&(s.value=n.data.groupRef??null)}function _(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const N=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),y=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!N.value),E=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}),S=t.computed(()=>!!n.selected&&!E.value),A=t.computed(()=>{var j;return o&&((j=o.selectedAttr.value)==null?void 0:j.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),V=t.computed(()=>A.value.size>0);function T(j,K){const ve=K.shiftKey?"range":K.metaKey||K.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,B(j),ve)}const D=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!E.value),C=t.computed(()=>n.data.entity),R=t.computed(()=>$y(C.value,o==null?void 0:o.referenceOnlyDocument.value)),$=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>{var j;if($.value==="CLASS"){const K=(j=p.value)==null?void 0:j.classRows;if(K)return K.map(ve=>ve.attr)}return[...C.value.attributes].sort((K,ve)=>K.order-ve.order)}),I=t.computed(()=>{var K;const j=$.value==="CLASS"?(K=p.value)==null?void 0:K.classRows:void 0;return new Set((j??[]).filter(ve=>ve.synthetic).map(ve=>ve.attr.modelId))});function v(j){return I.value.has(j.modelId)}function B(j){return P.value.get(j.modelId)??j.modelId}function M(j){return A.value.has(B(j))}function x(j){var K;return!!((K=u.value)!=null&&K.changedAttributeIds.has(B(j)))}const P=t.computed(()=>{var K;const j=new Map;if($.value!=="CLASS")return j;for(const ve of((K=p.value)==null?void 0:K.classRows)??[])ve.synthetic&&j.set(ve.attr.modelId,ve.sourceAttrId);return j}),Y=t.computed(()=>{var ve;const j=new Map,K=$.value==="CLASS";for(const Re of((ve=p.value)==null?void 0:ve.classRows)??[])!K&&!yn(Re.attr)||(Re.targetName||Re.collection)&&j.set(Re.attr.modelId,{targetName:Re.targetName,collection:Re.collection});return j}),se=t.computed(()=>n.data.collapsed??!1),he=t.computed(()=>n.data.locked??!1),ie=t.computed(()=>g.value&&!he.value);function fe(){g.value&&(o==null||o.setEntityCollapsed(n.id,!se.value))}const pe=t.computed(()=>$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL"),ge=t.computed(()=>{var ve;const j=$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL",K={};for(const Re of w.value){const me=Re.attrType.startsWith("RELATION")&&Re.dbAttrs.length>0,Ue=hn(((ve=C.value)==null?void 0:ve.stereotype)??"UNDEFINED");K[Re.modelId]={pk:Re.identifier,fk:me&&j,required:!Ue&&Re.notNull&&!Re.identifier}}return K});function Te(j){if(!j)return"";const K=[];return j.pk&&j.fk?K.push(i("em.node.keyPfk")):j.pk?K.push(i("em.node.keyPk")):j.fk&&K.push(i("em.node.keyFk")),j.required&&K.push(i("em.node.required")),K.join(" · ")}const He=t.computed(()=>{const j=Rs($t(n.data.style)),K={};return j&&(K["--em-header-bg"]=j.bar,K["--em-header-fg"]=j.barOn),K});function De(j){var K,ve;return(ve=Rs($t((K=n.data.attributeStyles)==null?void 0:K[j.modelId])))==null?void 0:ve.text}const Z=t.computed(()=>[...C.value.operations??[]].sort((j,K)=>j.order-K.order)),re=t.computed(()=>$.value==="CLASS"&&Z.value.length>0),ue={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function z(j){return j?ue[j]:"~"}function L(j){var K,ve;return(ve=Rs($t((K=n.data.operationStyles)==null?void 0:K[j.modelId])))==null?void 0:ve.text}function F(j,K,ve){switch($.value){case"CLASS":return[{text:j}];case"PHYSICAL":return[{text:ve||j}];case"LOGICAL":return[K?{text:K}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Re=K?{text:K}:{text:i("em.node.logicalMissing"),missing:!0};return ve?[Re,{text:` · ${ve}`}]:[Re]}}}function X(j){var K;return((K=p.value)==null?void 0:K.effectiveAttrs.get(j.modelId))??j}function ee(j){var ve,Re,me;if(we(j))return[{text:j.name}];const K=X(j);return F(ke(j),(Re=(ve=K.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:Re[a.value],((me=K.dbAttrs[0])==null?void 0:me.physicalName)??"")}function ke(j){return $.value==="CLASS"?j.name:X(j).derivedIdFieldName||j.name}function ye(j){return j.attrType.startsWith("EMBED")&&j.dbAttrs.length>0}const Ne=yn;function we(j){return ye(j)||Ne(j)}function G(j){return Ne(j)?qS(n.id,j.modelId):YS(n.id,j.modelId)}function q(j){return j.attrType==="DIVIDER"}function W(j){var K;return((K=p.value)==null?void 0:K.embedCols.get(j.modelId))??j.dbAttrs}function Ce(j){var K;return(K=p.value)==null?void 0:K.redundantSlots.get(j.modelId)}const $e=t.computed(()=>(f==null?void 0:f.isCollapsed(Mp(n.id)))??!1),ze=t.computed(()=>$e.value&&pe.value?w.value.reduce((j,K)=>we(K)?j+W(K).length:j,0):0),Fe=t.computed(()=>w.value.some(j=>we(j)));function ae(j){const K=Ce(j);return!K||K.size===0?!1:f?f.isCollapsed(Rp(n.id,j.modelId)):!1}function Se(j){var K;return ae(j)?((K=Ce(j))==null?void 0:K.size)??0:0}function Ge(j){return f?f.isCollapsed(G(j)):!1}function et(j){var K;return!pe.value||$e.value?null:Ge(j)?"attr":(((K=Ce(j))==null?void 0:K.size)??0)>0?"slot":null}function te(j){return!$e.value&&we(j)}function de(j){return Ge(j)?W(j).length:0}function Le(j){if($e.value||Ge(j))return[];const K=W(j);if(!ae(j))return K;const ve=Ce(j);return K.filter((Re,me)=>!ve.has(me))}function dt(j){f==null||f.toggle(Rp(n.id,j.modelId))}function Xe(j){f==null||f.toggle(G(j))}function yt(){f==null||f.toggle(Mp(n.id))}function st(j){var K;return F(j.physicalName,(K=j.logicalName)==null?void 0:K[a.value],j.physicalName)}function ft(j){var Ue;const K=Y.value.get(j.modelId),ve=(K==null?void 0:K.collection)??((Ue=p.value)==null?void 0:Ue.collectionTypes.get(j.modelId)),Re=o?di(j,Mo(o.state.logical),C.value,o.state.logical):void 0,me=(Re==null?void 0:Re.kind)==="resolved"?Re.entity:void 0;return Jr($.value,X(j),ve,K==null?void 0:K.targetName,me)}const nt=t.computed(()=>{const j={};for(const K of w.value)j[K.modelId]=ft(K);return j}),J=t.computed(()=>{var j,K,ve;return F(C.value.name,(K=(j=C.value.table)==null?void 0:j.logicalName)==null?void 0:K[a.value],((ve=C.value.table)==null?void 0:ve.physicalName)??"")}),ce=t.ref(!1),Ae=t.ref(""),Ee=t.ref(null);async function H(){var j,K;ie.value&&(Ae.value=C.value.name,ce.value=!0,await t.nextTick(),(j=Ee.value)==null||j.focus(),(K=Ee.value)==null||K.select())}function It(){if(!ce.value)return;ce.value=!1;const j=Ae.value.trim();j&&j!==C.value.name&&(o==null||o.renameEntity(n.id,j))}function Rt(){o==null||o.addAttribute(n.id)}function ot(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:We,findNode:Ze}=tt(),Q=t.ref(null),Mt=t.computed(()=>{const j=Q.value??n.data.size;return j?{width:`${j.width}px`,minHeight:`${j.height}px`}:void 0});let Vt=null;function Mn(j){var Re,me,Ue;if(!ie.value)return;j.stopPropagation();const K=(Re=Ze(n.id))==null?void 0:Re.dimensions,ve=We({x:j.clientX,y:j.clientY});Vt={fx:ve.x,fy:ve.y,w:(K==null?void 0:K.width)??((me=n.data.size)==null?void 0:me.width)??200,h:(K==null?void 0:K.height)??((Ue=n.data.size)==null?void 0:Ue.height)??120},j.target.setPointerCapture(j.pointerId)}function an(j){if(!Vt)return;const K=We({x:j.clientX,y:j.clientY});Q.value={width:Math.max(40,Vt.w+(K.x-Vt.fx)),height:Math.max(40,Vt.h+(K.y-Vt.fy))}}function _e(j){var K,ve,Re;if(Vt&&Q.value&&o){const me=(K=Ze(n.id))==null?void 0:K.dimensions;o.resizeEntity(n.id,{width:Math.round((me==null?void 0:me.width)??Q.value.width),height:Math.round((me==null?void 0:me.height)??Q.value.height)})}Vt=null,Q.value=null,(Re=(ve=j.target).releasePointerCapture)==null||Re.call(ve,j.pointerId)}const mt=t.ref(null),vt=t.ref(null);function O(j,K){if(!ie.value)return;K.stopPropagation(),K.preventDefault();const ve=A.value,Re=ve.has(j.modelId)?new Set(ve):new Set([j.modelId]);vt.value={ids:Re,dropIndex:-1,lineY:0},K.target.setPointerCapture(K.pointerId)}function U(j){if(!vt.value||!mt.value)return;const K=Array.from(mt.value.querySelectorAll(".em-entity__row"));if(!K.length)return;let ve=K.length;for(let Ue=0;Ue<K.length;Ue++){const Ye=K[Ue].getBoundingClientRect();if(j.clientY<Ye.top+Ye.height/2){ve=Ue;break}}const Re=K[K.length-1],me=ve<K.length?K[ve].offsetTop:Re.offsetTop+Re.offsetHeight;vt.value={...vt.value,dropIndex:ve,lineY:me}}function le(){const j=vt.value;if(vt.value=null,!j||j.dropIndex<0)return;const K=w.value,ve=K.filter(pt=>j.ids.has(pt.modelId)).map(pt=>pt.modelId),Re=K.filter((pt,Pt)=>j.ids.has(pt.modelId)&&Pt<j.dropIndex).length,me=j.dropIndex-Re,Ue=K.filter(pt=>!j.ids.has(pt.modelId)).map(pt=>pt.modelId);[...Ue.slice(0,me),...ve,...Ue.slice(me)].join(",")!==K.map(pt=>pt.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,ve,me))}function ne(){vt.value=null}const xe=t.ref(null),Be=t.ref(null);function qe(j,K){ie.value&&(K.stopPropagation(),K.preventDefault(),Be.value={id:j.modelId,dropIndex:-1,lineY:0},K.target.setPointerCapture(K.pointerId))}function je(j){if(!Be.value||!xe.value)return;const K=Array.from(xe.value.querySelectorAll(".em-entity__op-row"));if(!K.length)return;let ve=K.length;for(let Ue=0;Ue<K.length;Ue++){const Ye=K[Ue].getBoundingClientRect();if(j.clientY<Ye.top+Ye.height/2){ve=Ue;break}}const Re=K[K.length-1],me=ve<K.length?K[ve].offsetTop:Re.offsetTop+Re.offsetHeight;Be.value={...Be.value,dropIndex:ve,lineY:me}}function Ie(){const j=Be.value;if(Be.value=null,!j||j.dropIndex<0)return;const ve=Z.value.findIndex(me=>me.modelId===j.id);if(ve<0)return;const Re=j.dropIndex-(ve<j.dropIndex?1:0);Re!==ve&&(o==null||o.reorderOperations(n.id,[j.id],Re))}function Je(){Be.value=null}return(j,K)=>{var ve,Re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":N.value,"is-related":y.value,"is-dimmed":D.value,"is-selected":E.value,"is-multi-selected":S.value,"has-focused-attr":V.value,"is-locked":he.value,"is-reference-only":R.value,"is-diff-added":((ve=u.value)==null?void 0:ve.verb)==="added","is-diff-modified":((Re=u.value)==null?void 0:Re.verb)==="modified"}]),tabindex:"-1",title:R.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Mt.value),onPointerdown:b,onMouseenter:_,onMouseleave:k,onDblclick:l},[E.value?(t.openBlock(),t.createElementBlock("div",XS,[...K[11]||(K[11]=[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(He.value),onDblclick:t.withModifiers(H,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(se.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!se.value,disabled:!g.value,onClick:t.withModifiers(fe,["stop"]),onPointerdown:K[0]||(K[0]=t.withModifiers(()=>{},["stop"])),onDblclick:K[1]||(K[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(se.value?"▸":"▾"),41,ZS),t.createElementVNode("span",QS,"«"+t.toDisplayString(t.unref(li)(C.value.stereotype))+"»",1),ce.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ee,"onUpdate:modelValue":K[2]||(K[2]=me=>Ae.value=me),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(It,["enter"]),K[3]||(K[3]=t.withKeys(me=>ce.value=!1,["esc"]))],onBlur:It,onPointerdown:K[4]||(K[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Ae.value]]):(t.openBlock(),t.createElementBlock("span",ex,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,(me,Ue)=>(t.openBlock(),t.createElementBlock("span",{key:Ue,class:t.normalizeClass({"em-entity__missing":me.missing})},t.toDisplayString(me.text),3))),128))])),!se.value&&pe.value&&Fe.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:$e.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!$e.value,onClick:t.withModifiers(yt,["stop"]),onPointerdown:K[5]||(K[5]=t.withModifiers(()=>{},["stop"])),onDblclick:K[6]||(K[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",nx,t.toDisplayString($e.value?"▸":"▾"),1)],40,tx)):t.createCommentVNode("",!0),he.value?(t.openBlock(),t.createBlock(Ve,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),se.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:mt,class:"em-entity__attrs"},[vt.value&&vt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${vt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,me=>{var Ue,Ye,pt,Pt,ta;return t.openBlock(),t.createElementBlock(t.Fragment,{key:me.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":M(me),"is-dragging":(Ue=vt.value)==null?void 0:Ue.ids.has(me.modelId),"is-embed":we(me),"is-divider":q(me),"has-embed-badge":!!et(me),nodrag:q(me)&&ie.value,"is-diff-changed":x(me),"is-synthetic":v(me)}]),"data-attr":me.modelId,title:v(me)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(gt=>T(me,gt),["stop"]),onPointerdown:gt=>q(me)?O(me,gt):void 0,onPointermove:gt=>q(me)?U(gt):void 0,onPointerup:gt=>q(me)?le():void 0,onPointercancel:gt=>q(me)?ne():void 0},[ie.value&&!q(me)&&!v(me)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:gt=>O(me,gt),onPointermove:U,onPointerup:le,onPointercancel:ne,onClick:K[7]||(K[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,ix)):t.createCommentVNode("",!0),q(me)?(t.openBlock(),t.createElementBlock("span",ax,t.toDisplayString(me.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(ko),{id:`l:${me.modelId}`,type:"target",position:t.unref(Oe).Left,class:"em-handle",title:ie.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Te(ge.value[me.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",lx,[(Ye=ge.value[me.modelId])!=null&&Ye.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(pt=ge.value[me.modelId])!=null&&pt.required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",sx,[pe.value&&te(me)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:Ge(me)?i("em.node.embedAttrShow",{count:de(me)}):i("em.node.embedAttrHide"),"aria-expanded":!Ge(me),onClick:t.withModifiers(gt=>Xe(me),["stop"]),onPointerdown:K[8]||(K[8]=t.withModifiers(()=>{},["stop"])),onDblclick:K[9]||(K[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(Ge(me)?"▸":"▾"),41,cx)):we(me)?(t.openBlock(),t.createBlock(Ve,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(Pt=ge.value[me.modelId])!=null&&Pt.fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,rx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:De(me)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ee(me),(gt,Vn)=>(t.openBlock(),t.createElementBlock("span",{key:Vn,class:t.normalizeClass({"em-entity__missing":gt.missing})},t.toDisplayString(gt.text),3))),128))],4),et(me)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:de(me)}),onClick:t.withModifiers(gt=>Xe(me),["stop"])},"+"+t.toDisplayString(de(me)),9,dx)):et(me)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:ae(me)?i("em.node.embedRepeatedShow",{count:((ta=Ce(me))==null?void 0:ta.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!ae(me),onClick:t.withModifiers(gt=>dt(me),["stop"])},t.toDisplayString(ae(me)?`+${Se(me)}`:"−"),9,ux)):t.createCommentVNode("",!0),nt.value[me.modelId]?(t.openBlock(),t.createElementBlock("span",mx,t.toDisplayString(nt.value[me.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(ko),{id:`r:${me.modelId}`,type:"source",position:t.unref(Oe).Right,class:"em-handle",title:ie.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,ox),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(we(me)&&pe.value?Le(me):[],gt=>(t.openBlock(),t.createElementBlock("li",{key:`${me.modelId}:${gt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":M(me)}]),onClick:t.withModifiers(Vn=>T(me,Vn),["stop"])},[K[12]||(K[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",px,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(st(gt),(Vn,Fr)=>(t.openBlock(),t.createElementBlock("span",{key:Fr,class:t.normalizeClass({"em-entity__missing":Vn.missing})},t.toDisplayString(Vn.text),3))),128))]),t.createElementVNode("span",hx,t.toDisplayString(gt.dataType),1)],10,fx))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",yx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(yt,["stop"])},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ze.value})),1)],8,gx)])):t.createCommentVNode("",!0)],512)),!se.value&&re.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:xe,class:"em-entity__ops"},[Be.value&&Be.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${Be.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.value,me=>{var Ue,Ye;return t.openBlock(),t.createElementBlock("li",{key:me.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ue=Be.value)==null?void 0:Ue.id)===me.modelId,"is-diff-changed":!!((Ye=u.value)!=null&&Ye.changedOperationIds.has(me.modelId))}]),"data-op":me.modelId},[ie.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:pt=>qe(me,pt),onPointermove:je,onPointerup:Ie,onPointercancel:Je,onClick:K[10]||(K[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,_x)):t.createCommentVNode("",!0),t.createElementVNode("span",kx,t.toDisplayString(z(me.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:L(me)})},t.toDisplayString(me.name)+"()",5)],10,bx)}),128))],512)):Z.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Z.value.length})},[t.createVNode(Ve,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:Z.value.length})),1)],8,Ex)):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("footer",Nx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Rt},t.toDisplayString(i("em.node.addAttr")),1),K[13]||(K[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:ot},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),ie.value&&!ce.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:Mn,onPointermove:an,onPointerup:_e},null,32)):t.createCommentVNode("",!0)],46,JS)}}}),[["__scopeId","data-v-2bcc3efa"]]),wx={key:0,class:"em-sel","aria-hidden":"true"},Ix={class:"em-group__label"},vx={class:"em-group__name"},Cx={key:0,class:"em-group__pkg"},Sx={key:1,class:"em-group__flag"},Bp=Qe(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(()=>$t(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(Gn,null),s=(C,R)=>l?l.t(C,R):en("ko",C,R),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var C;return!!n.id&&((C=l==null?void 0:l.selection.value)==null?void 0:C.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(br,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(vo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const b=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),_=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:N}=tt();let y=null,E=null;function S(C){var w;if(!n.id||!c.value)return;C.stopPropagation();const R=((w=N(n.id))==null?void 0:w.dimensions)??{width:400,height:300},$=k({x:C.clientX,y:C.clientY});y={fx:$.x,fy:$.y,w:R.width,h:R.height},C.target.setPointerCapture(C.pointerId)}function A(C){if(!y||!n.id)return;const R=k({x:C.clientX,y:C.clientY});E={width:Math.max(160,y.w+(R.x-y.fx)),height:Math.max(120,y.h+(R.y-y.fy))};const $=N(n.id);$&&($.style={width:`${E.width}px`,height:`${E.height}px`})}function V(C){var R,$;y&&E&&n.id&&l&&l.resizeGroup(n.id,E),y=null,E=null,($=(R=C.target).releasePointerCapture)==null||$.call(R,C.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),D=t.computed(()=>{const C=o.value.name;return(C==null?void 0:C[T.value])||(C==null?void 0:C.ko)||(C==null?void 0:C.en)||(C==null?void 0:C.ja)||(C==null?void 0:C.zh)||o.value.packageName||s("em.group.fallback")});return(C,R)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":b.value,"is-dimmed":_.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",wx,[...R[0]||(R[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",Ix,[t.createElementVNode("span",vx,t.toDisplayString(D.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Cx,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Sx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ve,{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:S,onPointermove:A,onPointerup:V},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),xx={key:0,class:"em-sel","aria-hidden":"true"},Rx={key:2,class:"em-note__text"},Dp=Qe(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=t.inject(br,null),a=t.inject(vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>$t(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 u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var w;return((w=a==null?void 0:a.source.value)==null?void 0:w.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!h.value),b=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),_=[{id:"n-top",pos:Oe.Top},{id:"n-right",pos:Oe.Right},{id:"n-bottom",pos:Oe.Bottom},{id:"n-left",pos:Oe.Left}],k=t.ref(!1),N=t.ref(""),y=t.ref(null);async function E(){var w;l.value&&(N.value=r.value.memo,k.value=!0,await t.nextTick(),(w=y.value)==null||w.focus())}function S(){k.value&&(k.value=!1,N.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,N.value)))}const{screenToFlowCoordinate:A,findNode:V}=tt();let T=null,D=null;function C(w){var B;if(!l.value)return;w.stopPropagation();const I=((B=V(n.id))==null?void 0:B.dimensions)??r.value.geo.size,v=A({x:w.clientX,y:w.clientY});T={fx:v.x,fy:v.y,w:I.width,h:I.height},w.target.setPointerCapture(w.pointerId)}function R(w){if(!T)return;const I=A({x:w.clientX,y:w.clientY});D={width:Math.max(140,T.w+(I.x-T.fx)),height:Math.max(60,T.h+(I.y-T.fy))};const v=V(n.id);v&&(v.style={width:`${D.width}px`,height:`${D.height}px`})}function $(w){var I,v;T&&D&&o&&o.resizeNote(n.id,D),T=null,D=null,(v=(I=w.target).releasePointerCapture)==null||v.call(I,w.pointerId)}return(w,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":b.value,"is-selected":h.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:E,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",xx,[...I[4]||(I[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),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:y,"onUpdate:modelValue":I[0]||(I[0]=v=>N.value=v),class:"em-note__edit nodrag",onBlur:S,onKeydown:I[1]||(I[1]=t.withKeys(v=>k.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,N.value]]):(t.openBlock(),t.createElementBlock("div",Rx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(_,v=>t.createVNode(t.unref(ko),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:I[3]||(I[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:C,onPointermove:R,onPointerup:$},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function _r(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 ti=.5;function Op(e,n,o,i,a,r){const l=_r(n),s=_r(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 p=e;const f=(b,_)=>{(Math.abs(b.x-p.x)>=ti||Math.abs(b.y-p.y)>=ti)&&(m.push({a:p,b,seg:_}),p=b)};f(c,0);let h=l.x!==0,g=c;for(let b=1;b<u.length;b++){const _=u[b],k=b<=o.length?b-1:o.length,N=Math.abs(_.x-g.x)<ti,y=Math.abs(_.y-g.y)<ti;N&&y||(N?(f(_,k),h=!1):y?(f(_,k),h=!0):h?(f({x:g.x,y:_.y},k),f(_,k),h=!0):(f({x:_.x,y:g.y},k),f(_,k),h=!1),g=_)}return f(i,o.length),m}function Bs(e,n,o,i,a,r=20){const l=Op(e,n,o,i,a,r);let s=`M ${Tt(e.x)},${Tt(e.y)}`;for(const c of l)s+=` L ${Tt(c.b.x)},${Tt(c.b.y)}`;return s}const Ax=14;function Lp(e,n,o,i,a,r=20){return Op(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Ax).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function Tt(e){return Math.round(e*100)/100}const $x=36;function Tx(e,n,o=$x){const i=Math.max(e.x,n.x)+o;return`M ${Tt(e.x)},${Tt(e.y)} L ${Tt(i)},${Tt(e.y)} L ${Tt(i)},${Tt(n.y)} L ${Tt(n.x)},${Tt(n.y)}`}function Ds(e,n,o){const i=[e,...n,o];let a=`M ${Tt(i[0].x)},${Tt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${Tt(i[r].x)},${Tt(i[r].y)}`;return a}function Mx(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Pp(e,n){const o=Mx(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<ti&&Math.abs(l)<ti)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 zp(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 Fp(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 Vx=20,Bx=22,Dx=7,Ox=22,Up=31,Hp=7,Lx=20,jp=11,Kp=11,Px=Up+Hp;function zx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Fx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function kr(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 Gp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Er(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Yp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Gp(e,n);return[Er(o,a,r-Math.PI/2),Er(o,a,r+Math.PI/2)]}function qp(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 Wp(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=kr(e,n,Vx),[d,u]=Yp(e,n,c,Bx);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}),zx(o.multiplicity)){const m=kr(e,n,Up);r.push({cx:m.x,cy:m.y,r:Hp})}if(Fx(o.multiplicity)){const m=kr(e,n,Dx),[p,f]=Yp(e,n,m,Ox);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),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=kr(e,n,Lx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Gp(e,n),m=Er(d,jp/2,u-Math.PI/2),p=Er(d,jp/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=qp(s,c,Kp,!0),u=qp(s,c,Kp,!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 Jp=200,Xp=120,Os=24;function Zp(e){var a,r;if(!e)return{x:0,y:0,width:Jp,height:Xp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Jp,i=((r=e.dimensions)==null?void 0:r.height)||Xp;return{x:n.x,y:n.y,width:o,height:i}}function Qp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ls(e){const n=t.computed(()=>Zp(e.sourceNode())),o=t.computed(()=>Zp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<Os){const g=(m+p)/2;m=g-Os/2,p=g+Os/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Qp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Qp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?zp(n.value,d,r.value.x):Pp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?zp(o.value,d,l.value.x):Pp(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 Ps=Symbol("waypointController"),Ux=["d"],Hx=["d"],jx=["d"],Kx=["x1","y1","x2","y2"],Gx=["cx","cy","r"],Yx=["x","y"],qx=["x","y"],Wx=["cx","cy","onDblclick"],Jx=["x","y","onPointerdown","onDblclick"],eh=Qe(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(Ps),a=t.inject(Gn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Np,null),s=t.inject(vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var Z;return((Z=a==null?void 0:a.selection.value)==null?void 0:Z.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const Z=l==null?void 0:l.value;if(!Z||!a)return null;const re=a.resolved.value.entities,ue=L=>{var F;return(F=re.find(X=>X.entity.modelId===L))==null?void 0:F.groupRef},z=n.data.association;return ue(z.end1.entityRef)===Z.groupId&&ue(z.end2.entityRef)===Z.groupId?{dx:Z.dx,dy:Z.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),g=t.computed(()=>{const Z=m.value;return p.value.map((re,ue)=>ue===f.value?h.value:Z?{x:re.x+Z.dx,y:re.y+Z.dy}:re)}),b=t.computed(()=>{var Z;return!!((Z=n.sourceNode.data)!=null&&Z.collapsed)}),_=t.computed(()=>{var Z;return!!((Z=n.targetNode.data)!=null&&Z.collapsed)}),{source:k,target:N,sourceSide:y,targetSide:E,isSelf:S}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!b.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!_.value?n.targetY:void 0}),A=Px+4,V=t.computed(()=>S.value?Tx(k.value,N.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Bs(k.value,y.value,g.value,N.value,E.value,A):Ds(k.value,g.value,N.value)),T=t.computed(()=>S.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Lp(k.value,y.value,g.value,N.value,E.value,A):Fp(k.value,g.value,N.value).map((Z,re)=>({point:Z,segIndex:re}))),D=t.computed(()=>S.value||!r.value?[]:g.value),C=da;function R(Z,re){f.value=Z,h.value={...p.value[Z]},re.target.setPointerCapture(re.pointerId),re.stopPropagation()}function $(Z){if(f.value<0)return;const re=o({x:Z.clientX,y:Z.clientY});h.value={x:re.x,y:re.y}}function w(Z){var re,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(ue=(re=Z.target).releasePointerCapture)==null||ue.call(re,Z.pointerId)}function I(Z,re){re.stopPropagation(),i==null||i.removePoint(n.id,Z)}function v(Z,re){if(!i)return;const ue=o({x:re.clientX,y:re.clientY});i.insertPoint(n.id,Z,{x:ue.x,y:ue.y})}const B=t.computed(()=>C(n.data.association.end1.multiplicity)),M=t.computed(()=>C(n.data.association.end2.multiplicity)),x=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),P=t.computed(()=>x.value==="class"),Y=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Z=_r(y.value);return{x:k.value.x+Z.x*10,y:k.value.y+Z.y*10}}return g.value[0]??N.value}),se=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const re=_r(E.value);return{x:N.value.x+re.x*10,y:N.value.y+re.y*10}}const Z=g.value;return Z[Z.length-1]??k.value}),he=t.computed(()=>{const Z=n.data.association;return{multiplicity:Z.end1.multiplicity,navigable:Z.end1.navigable,composition:Z.end1.composition,otherNavigable:Z.end2.navigable}}),ie=t.computed(()=>{const Z=n.data.association;return{multiplicity:Z.end2.multiplicity,navigable:Z.end2.navigable,composition:Z.end2.composition,otherNavigable:Z.end1.navigable}}),fe=t.computed(()=>Wp(k.value,Y.value,he.value,x.value)),pe=t.computed(()=>Wp(N.value,se.value,ie.value,x.value)),ge=t.computed(()=>[...fe.value.lines,...pe.value.lines]),Te=t.computed(()=>[...fe.value.circles,...pe.value.circles]),He=t.computed(()=>[...fe.value.polygons,...pe.value.polygons].map(Z=>`M${Z.points.map(re=>`${re.x},${re.y}`).join(" L")} Z`)),De=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(Z,re)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:V.value,fill:"none",class:"em-edge__hit"},null,8,Ux),t.createElementVNode("path",{d:V.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Hx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(He.value,(ue,z)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${z}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",De.value])},null,10,jx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,(ue,z)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${z}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",De.value])},null,10,Kx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Te.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${z}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",De.value])},null,10,Gx))),128)),P.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(B.value),11,Yx),t.createElementVNode("text",{x:t.unref(N).x-8,y:t.unref(N).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,qx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${z}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>v(ue.segIndex,L),["stop"])},null,42,Wx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,(ue,z)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${z}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>R(z,L),onPointermove:$,onPointerup:w,onDblclick:L=>I(z,L)},null,42,Jx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var Rn=(e=>(e.Lines="lines",e.Dots="dots",e))(Rn||{});const th=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]}`})},nh=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Rn.Lines+"",Rn.Dots+"";const Xx={[Rn.Dots]:"#81818a",[Rn.Lines]:"#eee"},Zx=["id","x","y","width","height","patternTransform"],Qx={key:2,height:"100",width:"100"},eR=["fill"],tR=["x","y","fill"],nR={name:"Background",compatConfig:{MODE:3}},oR=t.defineComponent({...nR,props:{id:{},variant:{default:()=>Rn.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}=tt(),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],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Xx[e.variant||Rn.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(Rn).Lines?(t.openBlock(),t.createBlock(t.unref(th),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Rn).Dots?(t.openBlock(),t.createBlock(t.unref(nh),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",Qx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,eR)])):t.createCommentVNode("",!0)])],8,Zx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,tR),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),iR={name:"ControlButton",compatConfig:{MODE:3}},aR=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},rR={type:"button",class:"vue-flow__controls-button"};function lR(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",rR,[t.renderSlot(e.$slots,"default")])}const Co=aR(iR,[["render",lR]]),sR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},cR=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function dR(e,n){return t.openBlock(),t.createElementBlock("svg",sR,cR)}const uR={render:dR},mR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fR=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function pR(e,n){return t.openBlock(),t.createElementBlock("svg",mR,fR)}const hR={render:pR},yR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},gR=[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 bR(e,n){return t.openBlock(),t.createElementBlock("svg",yR,gR)}const _R={render:bR},kR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ER=[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 NR(e,n){return t.openBlock(),t.createElementBlock("svg",kR,ER)}const wR={render:NR},IR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},vR=[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 CR(e,n){return t.openBlock(),t.createElementBlock("svg",IR,vR)}const SR={render:CR},xR={name:"Controls",compatConfig:{MODE:3}},RR=t.defineComponent({...xR,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>tf.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:u,maxZoom:m}=tt(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function b(){s(),n("zoomOut")}function _(){c(e.fitViewParams),n("fitView")}function k(){r(!p.value),n("interactionChange",!p.value)}return(N,y)=>(t.openBlock(),t.createBlock(t.unref(ep),{class:"vue-flow__controls",position:N.position},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"top"),N.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(N.$slots,"control-zoom-in",{},()=>[t.createVNode(Co,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(uR))))])]),_:3},8,["disabled"])]),t.renderSlot(N.$slots,"control-zoom-out",{},()=>[t.createVNode(Co,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(hR))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),N.showFitView?t.renderSlot(N.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Co,{class:"vue-flow__controls-fitview",onClick:_},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_R))))])]),_:3})]):t.createCommentVNode("",!0),N.showInteractive?t.renderSlot(N.$slots,"control-interactive",{key:2},()=>[N.showInteractive?(t.openBlock(),t.createBlock(Co,{key:0,class:"vue-flow__controls-interactive",onClick:k},{default:t.withCtx(()=>[p.value?t.renderSlot(N.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(SR))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(N.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(wR))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(N.$slots,"default")]),_:3},8,["position"]))}});var AR={value:()=>{}};function zs(){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 Nr(o)}function Nr(e){this._=e}function $R(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}})}Nr.prototype=zs.prototype={constructor:Nr,on:function(e,n){var o=this._,i=$R(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=TR(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]=oh(o[a],e.name,n);else if(n==null)for(a in o)o[a]=oh(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 Nr(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 TR(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function oh(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=AR,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Fs="http://www.w3.org/1999/xhtml";const ih={svg:"http://www.w3.org/2000/svg",xhtml:Fs,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ih.hasOwnProperty(n)?{space:ih[n],local:e}:e}function MR(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Fs&&n.documentElement.namespaceURI===Fs?n.createElement(e):n.createElementNS(o,e)}}function VR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ah(e){var n=wr(e);return(n.local?VR:MR)(n)}function BR(){}function Us(e){return e==null?BR:function(){return this.querySelector(e)}}function DR(e){typeof e!="function"&&(e=Us(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,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 Ht(i,this._parents)}function OR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function LR(){return[]}function rh(e){return e==null?LR:function(){return this.querySelectorAll(e)}}function PR(e){return function(){return OR(e.apply(this,arguments))}}function zR(e){typeof e=="function"?e=PR(e):e=rh(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 Ht(i,a)}function lh(e){return function(){return this.matches(e)}}function sh(e){return function(n){return n.matches(e)}}var FR=Array.prototype.find;function UR(e){return function(){return FR.call(this.children,e)}}function HR(){return this.firstElementChild}function jR(e){return this.select(e==null?HR:UR(typeof e=="function"?e:sh(e)))}var KR=Array.prototype.filter;function GR(){return Array.from(this.children)}function YR(e){return function(){return KR.call(this.children,e)}}function qR(e){return this.selectAll(e==null?GR:YR(typeof e=="function"?e:sh(e)))}function WR(e){typeof e!="function"&&(e=lh(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 Ht(i,this._parents)}function ch(e){return new Array(e.length)}function JR(){return new Ht(this._enter||this._groups.map(ch),this._parents)}function Ir(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Ir.prototype={constructor:Ir,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 XR(e){return function(){return e}}function ZR(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 Ir(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function QR(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Ir(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function eA(e){return e.__data__}function tA(e,n){if(!arguments.length)return Array.from(this,eA);var o=n?QR:ZR,i=this._parents,a=this._groups;typeof e!="function"&&(e=XR(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],p=m.length,f=nA(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),b=l[d]=new Array(h),_=c[d]=new Array(p);o(u,m,g,b,_,f,n);for(var k=0,N=0,y,E;k<h;++k)if(y=g[k]){for(k>=N&&(N=k+1);!(E=b[N])&&++N<h;);y._next=E||null}}return l=new Ht(l,i),l._enter=s,l._exit=c,l}function nA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function oA(){return new Ht(this._exit||this._groups.map(ch),this._parents)}function iA(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 aA(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],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ht(s,this._parents)}function rA(){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 lA(e){e||(e=sA);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!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,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ht(a,this._parents).order()}function sA(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function cA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dA(){return Array.from(this)}function uA(){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 mA(){let e=0;for(const n of this)++e;return e}function fA(){return!this.node()}function pA(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 hA(e){return function(){this.removeAttribute(e)}}function yA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gA(e,n){return function(){this.setAttribute(e,n)}}function bA(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function _A(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function kA(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 EA(e,n){var o=wr(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?yA:hA:typeof n=="function"?o.local?kA:_A:o.local?bA:gA)(o,n))}function dh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function NA(e){return function(){this.style.removeProperty(e)}}function wA(e,n,o){return function(){this.style.setProperty(e,n,o)}}function IA(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function vA(e,n,o){return arguments.length>1?this.each((n==null?NA:typeof n=="function"?IA:wA)(e,n,o??"")):ni(this.node(),e)}function ni(e,n){return e.style.getPropertyValue(n)||dh(e).getComputedStyle(e,null).getPropertyValue(n)}function CA(e){return function(){delete this[e]}}function SA(e,n){return function(){this[e]=n}}function xA(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function RA(e,n){return arguments.length>1?this.each((n==null?CA:typeof n=="function"?xA:SA)(e,n)):this.node()[e]}function uh(e){return e.trim().split(/^|\s+/)}function Hs(e){return e.classList||new mh(e)}function mh(e){this._node=e,this._names=uh(e.getAttribute("class")||"")}mh.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 fh(e,n){for(var o=Hs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function ph(e,n){for(var o=Hs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function AA(e){return function(){fh(this,e)}}function $A(e){return function(){ph(this,e)}}function TA(e,n){return function(){(n.apply(this,arguments)?fh:ph)(this,e)}}function MA(e,n){var o=uh(e+"");if(arguments.length<2){for(var i=Hs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?TA:n?AA:$A)(o,n))}function VA(){this.textContent=""}function BA(e){return function(){this.textContent=e}}function DA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function OA(e){return arguments.length?this.each(e==null?VA:(typeof e=="function"?DA:BA)(e)):this.node().textContent}function LA(){this.innerHTML=""}function PA(e){return function(){this.innerHTML=e}}function zA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function FA(e){return arguments.length?this.each(e==null?LA:(typeof e=="function"?zA:PA)(e)):this.node().innerHTML}function UA(){this.nextSibling&&this.parentNode.appendChild(this)}function HA(){return this.each(UA)}function jA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KA(){return this.each(jA)}function GA(e){var n=typeof e=="function"?e:ah(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function YA(){return null}function qA(e,n){var o=typeof e=="function"?e:ah(e),i=n==null?YA:typeof n=="function"?n:Us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function WA(){var e=this.parentNode;e&&e.removeChild(this)}function JA(){return this.each(WA)}function XA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function ZA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function QA(e){return this.select(e?ZA:XA)}function e$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function t$(e){return function(n){e.call(this,n,this.__data__)}}function n$(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 o$(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 i$(e,n,o){return function(){var i=this.__on,a,r=t$(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 a$(e,n,o){var i=n$(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=n?i$:o$,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function hh(e,n,o){var i=dh(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 r$(e,n){return function(){return hh(this,e,n)}}function l$(e,n){return function(){return hh(this,e,n.apply(this,arguments))}}function s$(e,n){return this.each((typeof n=="function"?l$:r$)(e,n))}function*c$(){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 yh=[null];function Ht(e,n){this._groups=e,this._parents=n}function Hi(){return new Ht([[document.documentElement]],yh)}function d$(){return this}Ht.prototype=Hi.prototype={constructor:Ht,select:DR,selectAll:zR,selectChild:jR,selectChildren:qR,filter:WR,data:tA,enter:JR,exit:oA,join:iA,merge:aA,selection:d$,order:rA,sort:lA,call:cA,nodes:dA,node:uA,size:mA,empty:fA,each:pA,attr:EA,style:vA,property:RA,classed:MA,text:OA,html:FA,raise:HA,lower:KA,append:GA,insert:qA,remove:JA,clone:QA,datum:e$,on:a$,dispatch:s$,[Symbol.iterator]:c$};function Yn(e){return typeof e=="string"?new Ht([[document.querySelector(e)]],[document.documentElement]):new Ht([[e]],yh)}function u$(e){let n;for(;n=e.sourceEvent;)e=n;return e}function qn(e,n){if(e=u$(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 js={capture:!0,passive:!1};function Ks(e){e.preventDefault(),e.stopImmediatePropagation()}function m$(e){var n=e.document.documentElement,o=Yn(e).on("dragstart.drag",Ks,js);"onselectstart"in n?o.on("selectstart.drag",Ks,js):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function f$(e,n){var o=e.document.documentElement,i=Yn(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ks,js),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 Gs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function gh(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ji(){}var Ki=.7,vr=1/Ki,oi="\\s*([+-]?\\d+)\\s*",Gi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",p$=/^#([0-9a-f]{3,8})$/,h$=new RegExp(`^rgb\\(${oi},${oi},${oi}\\)$`),y$=new RegExp(`^rgb\\(${fn},${fn},${fn}\\)$`),g$=new RegExp(`^rgba\\(${oi},${oi},${oi},${Gi}\\)$`),b$=new RegExp(`^rgba\\(${fn},${fn},${fn},${Gi}\\)$`),_$=new RegExp(`^hsl\\(${Gi},${fn},${fn}\\)$`),k$=new RegExp(`^hsla\\(${Gi},${fn},${fn},${Gi}\\)$`),bh={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};Gs(ji,Yi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_h,formatHex:_h,formatHex8:E$,formatHsl:N$,formatRgb:kh,toString:kh});function _h(){return this.rgb().formatHex()}function E$(){return this.rgb().formatHex8()}function N$(){return vh(this).formatHsl()}function kh(){return this.rgb().formatRgb()}function Yi(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=p$.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Eh(n):o===3?new Lt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Cr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Cr(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=h$.exec(e))?new Lt(n[1],n[2],n[3],1):(n=y$.exec(e))?new Lt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=g$.exec(e))?Cr(n[1],n[2],n[3],n[4]):(n=b$.exec(e))?Cr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=_$.exec(e))?Ih(n[1],n[2]/100,n[3]/100,1):(n=k$.exec(e))?Ih(n[1],n[2]/100,n[3]/100,n[4]):bh.hasOwnProperty(e)?Eh(bh[e]):e==="transparent"?new Lt(NaN,NaN,NaN,0):null}function Eh(e){return new Lt(e>>16&255,e>>8&255,e&255,1)}function Cr(e,n,o,i){return i<=0&&(e=n=o=NaN),new Lt(e,n,o,i)}function w$(e){return e instanceof ji||(e=Yi(e)),e?(e=e.rgb(),new Lt(e.r,e.g,e.b,e.opacity)):new Lt}function Ys(e,n,o,i){return arguments.length===1?w$(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Gs(Lt,Ys,gh(ji,{brighter(e){return e=e==null?vr:Math.pow(vr,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lt(So(this.r),So(this.g),So(this.b),Sr(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:Nh,formatHex:Nh,formatHex8:I$,formatRgb:wh,toString:wh}));function Nh(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function I$(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function wh(){const e=Sr(this.opacity);return`${e===1?"rgb(":"rgba("}${So(this.r)}, ${So(this.g)}, ${So(this.b)}${e===1?")":`, ${e})`}`}function Sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function So(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=So(e),(e<16?"0":"")+e.toString(16)}function Ih(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new nn(e,n,o,i)}function vh(e){if(e instanceof nn)return new nn(e.h,e.s,e.l,e.opacity);if(e instanceof ji||(e=Yi(e)),!e)return new nn;if(e instanceof nn)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 nn(l,s,c,e.opacity)}function v$(e,n,o,i){return arguments.length===1?vh(e):new nn(e,n,o,i??1)}function nn(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Gs(nn,v$,gh(ji,{brighter(e){return e=e==null?vr:Math.pow(vr,e),new nn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new nn(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 Lt(qs(e>=240?e-240:e+120,a,i),qs(e,a,i),qs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new nn(Ch(this.h),xr(this.s),xr(this.l),Sr(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=Sr(this.opacity);return`${e===1?"hsl(":"hsla("}${Ch(this.h)}, ${xr(this.s)*100}%, ${xr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ch(e){return e=(e||0)%360,e<0?e+360:e}function xr(e){return Math.max(0,Math.min(1,e||0))}function qs(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 Sh=e=>()=>e;function C$(e,n){return function(o){return e+o*n}}function S$(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 x$(e){return(e=+e)==1?xh:function(n,o){return o-n?S$(n,o,e):Sh(isNaN(n)?o:n)}}function xh(e,n){var o=n-e;return o?C$(e,o):Sh(isNaN(e)?n:e)}const Rh=(function e(n){var o=x$(n);function i(a,r){var l=o((a=Ys(a)).r,(r=Ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=xh(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 Wn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var Ws=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Js=new RegExp(Ws.source,"g");function R$(e){return function(){return e}}function A$(e){return function(n){return e(n)+""}}function $$(e,n){var o=Ws.lastIndex=Js.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ws.exec(e))&&(a=Js.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:Wn(i,a)})),o=Js.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?A$(c[0].x):R$(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Ah=180/Math.PI,Xs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $h(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)*Ah,skewX:Math.atan(c)*Ah,scaleX:l,scaleY:s}}var Rr;function T$(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Xs:$h(n.a,n.b,n.c,n.d,n.e,n.f)}function M$(e){return e==null||(Rr||(Rr=document.createElementNS("http://www.w3.org/2000/svg","g")),Rr.setAttribute("transform",e),!(e=Rr.transform.baseVal.consolidate()))?Xs:(e=e.matrix,$h(e.a,e.b,e.c,e.d,e.e,e.f))}function Th(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:Wn(d,m)},{i:g-2,x:Wn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Wn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Wn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:Wn(d,m)},{i:g-2,x:Wn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,b;++h<g;)m[(b=p[h]).i]=b.x(f);return m.join("")}}}var V$=Th(T$,"px, ","px)","deg)"),B$=Th(M$,", ",")",")"),D$=1e-12;function Mh(e){return((e=Math.exp(e))+1/e)/2}function O$(e){return((e=Math.exp(e))-1/e)/2}function L$(e){return((e=Math.exp(2*e))-1)/(e+1)}const P$=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,b,_;if(g<D$)_=Math.log(p/d)/n,b=function(A){return[s+A*f,c+A*h,d*Math.exp(n*A*_)]};else{var k=Math.sqrt(g),N=(p*p-d*d+i*g)/(2*d*o*k),y=(p*p-d*d-i*g)/(2*p*o*k),E=Math.log(Math.sqrt(N*N+1)-N),S=Math.log(Math.sqrt(y*y+1)-y);_=(S-E)/n,b=function(A){var V=A*_,T=Mh(E),D=d/(o*k)*(T*L$(n*V+E)-O$(E));return[s+D*f,c+D*h,d*T/Mh(n*V+E)]}}return b.duration=_*1e3*n/Math.SQRT2,b}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 ii=0,qi=0,Wi=0,Vh=1e3,Ar,Ji,$r=0,Ro=0,Tr=0,Xi=typeof performance=="object"&&performance.now?performance:Date,Bh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zs(){return Ro||(Bh(z$),Ro=Xi.now()+Tr)}function z$(){Ro=0}function Mr(){this._call=this._time=this._next=null}Mr.prototype=Dh.prototype={constructor:Mr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Zs():+o)+(n==null?0:+n),!this._next&&Ji!==this&&(Ji?Ji._next=this:Ar=this,Ji=this),this._call=e,this._time=o,Qs()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qs())}};function Dh(e,n,o){var i=new Mr;return i.restart(e,n,o),i}function F$(){Zs(),++ii;for(var e=Ar,n;e;)(n=Ro-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ii}function Oh(){Ro=($r=Xi.now())+Tr,ii=qi=0;try{F$()}finally{ii=0,H$(),Ro=0}}function U$(){var e=Xi.now(),n=e-$r;n>Vh&&(Tr-=n,$r=e)}function H$(){for(var e,n=Ar,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:Ar=o);Ji=e,Qs(i)}function Qs(e){if(!ii){qi&&(qi=clearTimeout(qi));var n=e-Ro;n>24?(e<1/0&&(qi=setTimeout(Oh,e-Xi.now()-Tr)),Wi&&(Wi=clearInterval(Wi))):(Wi||($r=Xi.now(),Wi=setInterval(U$,Vh)),ii=1,Bh(Oh))}}function Lh(e,n,o){var i=new Mr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var j$=zs("start","end","cancel","interrupt"),K$=[],Ph=0,zh=1,ec=2,Vr=3,Fh=4,tc=5,Br=6;function Dr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;G$(e,o,{name:n,index:i,group:a,on:j$,tween:K$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ph})}function nc(e,n){var o=on(e,n);if(o.state>Ph)throw new Error("too late; already scheduled");return o}function pn(e,n){var o=on(e,n);if(o.state>Vr)throw new Error("too late; already running");return o}function on(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function G$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Dh(r,0,o.time);function r(d){o.state=zh,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==zh)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Vr)return Lh(l);f.state===Fh?(f.state=Br,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Br,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Lh(function(){o.state===Vr&&(o.state=Fh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ec,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ec){for(o.state=Vr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=tc,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===tc&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Br,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Or(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>ec&&i.state<tc,i.state=Br,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function Y$(e){return this.each(function(){Or(this,e)})}function q$(e,n){var o,i;return function(){var a=pn(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 W$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=pn(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 J$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=on(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?q$:W$)(o,e,n))}function oc(e,n,o){var i=e._id;return e.each(function(){var a=pn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return on(a,i).value[n]}}function Uh(e,n){var o;return(typeof n=="number"?Wn:n instanceof Yi?Rh:(o=Yi(n))?(n=o,Rh):$$)(e,n)}function X$(e){return function(){this.removeAttribute(e)}}function Z$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q$(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 eT(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 tT(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 nT(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 oT(e,n){var o=wr(e),i=o==="transform"?B$:Uh;return this.attrTween(e,typeof n=="function"?(o.local?nT:tT)(o,i,oc(this,"attr."+e,n)):n==null?(o.local?Z$:X$)(o):(o.local?eT:Q$)(o,i,n))}function iT(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function aT(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function rT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&aT(e,r)),o}return a._value=n,a}function lT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&iT(e,r)),o}return a._value=n,a}function sT(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=wr(e);return this.tween(o,(i.local?rT:lT)(i,n))}function cT(e,n){return function(){nc(this,e).delay=+n.apply(this,arguments)}}function dT(e,n){return n=+n,function(){nc(this,e).delay=n}}function uT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?cT:dT)(n,e)):on(this.node(),n).delay}function mT(e,n){return function(){pn(this,e).duration=+n.apply(this,arguments)}}function fT(e,n){return n=+n,function(){pn(this,e).duration=n}}function pT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?mT:fT)(n,e)):on(this.node(),n).duration}function hT(e,n){if(typeof n!="function")throw new Error;return function(){pn(this,e).ease=n}}function yT(e){var n=this._id;return arguments.length?this.each(hT(n,e)):on(this.node(),n).ease}function gT(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;pn(this,e).ease=o}}function bT(e){if(typeof e!="function")throw new Error;return this.each(gT(this._id,e))}function _T(e){typeof e!="function"&&(e=lh(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 An(i,this._parents,this._name,this._id)}function kT(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],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new An(l,this._parents,this._name,this._id)}function ET(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 NT(e,n,o){var i,a,r=ET(n)?nc:pn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function wT(e,n){var o=this._id;return arguments.length<2?on(this.node(),o).on.on(e):this.each(NT(o,e,n))}function IT(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function vT(){return this.on("end.remove",IT(this._id))}function CT(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Us(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Dr(d[p],n,o,p,d,on(u,o)));return new An(r,this._parents,n,o)}function ST(e){var n=this._name,o=this._id;typeof e!="function"&&(e=rh(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 p=e.call(u,u.__data__,m,c),f,h=on(u,o),g=0,b=p.length;g<b;++g)(f=p[g])&&Dr(f,n,o,g,p,h);r.push(p),l.push(u)}return new An(r,l,n,o)}var xT=Hi.prototype.constructor;function RT(){return new xT(this._groups,this._parents)}function AT(e,n){var o,i,a;return function(){var r=ni(this,e),l=(this.style.removeProperty(e),ni(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Hh(e){return function(){this.style.removeProperty(e)}}function $T(e,n,o){var i,a=o+"",r;return function(){var l=ni(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function TT(e,n,o){var i,a,r;return function(){var l=ni(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ni(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function MT(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=pn(this,e),d=c.on,u=c.value[r]==null?s||(s=Hh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function VT(e,n,o){var i=(e+="")=="transform"?V$:Uh;return n==null?this.styleTween(e,AT(e,i)).on("end.style."+e,Hh(e)):typeof n=="function"?this.styleTween(e,TT(e,i,oc(this,"style."+e,n))).each(MT(this._id,e)):this.styleTween(e,$T(e,i,n),o).on("end.style."+e,null)}function BT(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function DT(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&BT(e,l,o)),i}return r._value=n,r}function OT(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,DT(e,n,o??""))}function LT(e){return function(){this.textContent=e}}function PT(e){return function(){var n=e(this);this.textContent=n??""}}function zT(e){return this.tween("text",typeof e=="function"?PT(oc(this,"text",e)):LT(e==null?"":e+""))}function FT(e){return function(n){this.textContent=e.call(this,n)}}function UT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&FT(a)),n}return i._value=e,i}function HT(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,UT(e))}function jT(){for(var e=this._name,n=this._id,o=jh(),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=on(c,n);Dr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new An(i,this._parents,e,o)}function KT(){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=pn(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var GT=0;function An(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function jh(){return++GT}var $n=Hi.prototype;An.prototype={constructor:An,select:CT,selectAll:ST,selectChild:$n.selectChild,selectChildren:$n.selectChildren,filter:_T,merge:kT,selection:RT,transition:jT,call:$n.call,nodes:$n.nodes,node:$n.node,size:$n.size,empty:$n.empty,each:$n.each,on:wT,attr:oT,attrTween:sT,style:VT,styleTween:OT,text:zT,textTween:HT,remove:vT,tween:J$,delay:uT,duration:pT,ease:yT,easeVarying:bT,end:KT,[Symbol.iterator]:$n[Symbol.iterator]};function YT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qT={time:null,delay:0,duration:250,ease:YT};function WT(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 JT(e){var n,o;e instanceof An?(n=e._id,e=e._name):(n=jh(),(o=qT).time=Zs(),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])&&Dr(c,e,n,d,l,o||WT(c,n));return new An(i,this._parents,e,n)}Hi.prototype.interrupt=Y$,Hi.prototype.transition=JT;const Lr=e=>()=>e;function XT(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 Tn(e,n,o){this.k=e,this.x=n,this.y=o}Tn.prototype={constructor:Tn,scale:function(e){return e===1?this:new Tn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tn(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 ic=new Tn(1,0,0);Tn.prototype;function ac(e){e.stopImmediatePropagation()}function Zi(e){e.preventDefault(),e.stopImmediatePropagation()}function ZT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QT(){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 Kh(){return this.__zoom||ic}function eM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tM(){return navigator.maxTouchPoints||"ontouchstart"in this}function nM(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 oM(){var e=ZT,n=QT,o=nM,i=eM,a=tM,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=P$,d=zs("start","zoom","end"),u,m,p,f=500,h=150,g=0,b=10;function _(w){w.property("__zoom",Kh).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,I,v,B){var M=w.selection?w.selection():w;M.property("__zoom",Kh),w!==M?E(w,I,v,B):M.interrupt().each(function(){S(this,arguments).event(B).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},_.scaleBy=function(w,I,v,B){_.scaleTo(w,function(){var M=this.__zoom.k,x=typeof I=="function"?I.apply(this,arguments):I;return M*x},v,B)},_.scaleTo=function(w,I,v,B){_.transform(w,function(){var M=n.apply(this,arguments),x=this.__zoom,P=v==null?y(M):typeof v=="function"?v.apply(this,arguments):v,Y=x.invert(P),se=typeof I=="function"?I.apply(this,arguments):I;return o(N(k(x,se),P,Y),M,l)},v,B)},_.translateBy=function(w,I,v,B){_.transform(w,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,B)},_.translateTo=function(w,I,v,B,M){_.transform(w,function(){var x=n.apply(this,arguments),P=this.__zoom,Y=B==null?y(x):typeof B=="function"?B.apply(this,arguments):B;return o(ic.translate(Y[0],Y[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),x,l)},B,M)};function k(w,I){return I=Math.max(r[0],Math.min(r[1],I)),I===w.k?w:new Tn(I,w.x,w.y)}function N(w,I,v){var B=I[0]-v[0]*w.k,M=I[1]-v[1]*w.k;return B===w.x&&M===w.y?w:new Tn(w.k,B,M)}function y(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,I,v,B){w.on("start.zoom",function(){S(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(B).end()}).tween("zoom",function(){var M=this,x=arguments,P=S(M,x).event(B),Y=n.apply(M,x),se=v==null?y(Y):typeof v=="function"?v.apply(M,x):v,he=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=M.__zoom,fe=typeof I=="function"?I.apply(M,x):I,pe=c(ie.invert(se).concat(he/ie.k),fe.invert(se).concat(he/fe.k));return function(ge){if(ge===1)ge=fe;else{var Te=pe(ge),He=he/Te[2];ge=new Tn(He,se[0]-Te[0]*He,se[1]-Te[1]*He)}P.zoom(null,ge)}})}function S(w,I,v){return!v&&w.__zooming||new A(w,I)}function A(w,I){this.that=w,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,I),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,I){return this.mouse&&w!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var I=Yn(this.that).datum();d.call(w,this.that,new XT(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),I)}};function V(w,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(w),B=this.__zoom,M=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),x=qn(w);if(v.wheel)(v.mouse[0][0]!==x[0]||v.mouse[0][1]!==x[1])&&(v.mouse[1]=B.invert(v.mouse[0]=x)),clearTimeout(v.wheel);else{if(B.k===M)return;v.mouse=[x,B.invert(x)],Or(this),v.start()}Zi(w),v.wheel=setTimeout(P,h),v.zoom("mouse",o(N(k(B,M),v.mouse[0],v.mouse[1]),v.extent,l));function P(){v.wheel=null,v.end()}}function T(w,...I){if(p||!e.apply(this,arguments))return;var v=w.currentTarget,B=S(this,I,!0).event(w),M=Yn(w.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),x=qn(w,v),P=w.clientX,Y=w.clientY;m$(w.view),ac(w),B.mouse=[x,this.__zoom.invert(x)],Or(this),B.start();function se(ie){if(Zi(ie),!B.moved){var fe=ie.clientX-P,pe=ie.clientY-Y;B.moved=fe*fe+pe*pe>g}B.event(ie).zoom("mouse",o(N(B.that.__zoom,B.mouse[0]=qn(ie,v),B.mouse[1]),B.extent,l))}function he(ie){M.on("mousemove.zoom mouseup.zoom",null),f$(ie.view,B.moved),Zi(ie),B.event(ie).end()}}function D(w,...I){if(e.apply(this,arguments)){var v=this.__zoom,B=qn(w.changedTouches?w.changedTouches[0]:w,this),M=v.invert(B),x=v.k*(w.shiftKey?.5:2),P=o(N(k(v,x),B,M),n.apply(this,I),l);Zi(w),s>0?Yn(this).transition().duration(s).call(E,P,B,w):Yn(this).call(_.transform,P,B,w)}}function C(w,...I){if(e.apply(this,arguments)){var v=w.touches,B=v.length,M=S(this,I,w.changedTouches.length===B).event(w),x,P,Y,se;for(ac(w),P=0;P<B;++P)Y=v[P],se=qn(Y,this),se=[se,this.__zoom.invert(se),Y.identifier],M.touch0?!M.touch1&&M.touch0[2]!==se[2]&&(M.touch1=se,M.taps=0):(M.touch0=se,x=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),x&&(M.taps<2&&(m=se[0],u=setTimeout(function(){u=null},f)),Or(this),M.start())}}function R(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P,Y,se;for(Zi(w),x=0;x<M;++x)P=B[x],Y=qn(P,this),v.touch0&&v.touch0[2]===P.identifier?v.touch0[0]=Y:v.touch1&&v.touch1[2]===P.identifier&&(v.touch1[0]=Y);if(P=v.that.__zoom,v.touch1){var he=v.touch0[0],ie=v.touch0[1],fe=v.touch1[0],pe=v.touch1[1],ge=(ge=fe[0]-he[0])*ge+(ge=fe[1]-he[1])*ge,Te=(Te=pe[0]-ie[0])*Te+(Te=pe[1]-ie[1])*Te;P=k(P,Math.sqrt(ge/Te)),Y=[(he[0]+fe[0])/2,(he[1]+fe[1])/2],se=[(ie[0]+pe[0])/2,(ie[1]+pe[1])/2]}else if(v.touch0)Y=v.touch0[0],se=v.touch0[1];else return;v.zoom("touch",o(N(P,Y,se),v.extent,l))}}function $(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P;for(ac(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),x=0;x<M;++x)P=B[x],v.touch0&&v.touch0[2]===P.identifier?delete v.touch0:v.touch1&&v.touch1[2]===P.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(P=qn(P,this),Math.hypot(m[0]-P[0],m[1]-P[1])<b)){var Y=Yn(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Lr(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Lr(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Lr(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Lr([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,_):Math.sqrt(g)},_.tapDistance=function(w){return arguments.length?(b=+w,_):b},_}const Gh=Symbol("MiniMapSlots"),iM=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],aM={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},rM=t.defineComponent({...aM,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(Gh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.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,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.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,iM))],64)):t.createCommentVNode("",!0)}}),lM=["width","height","viewBox","aria-labelledby"],sM=["id"],cM=["d","fill","stroke","stroke-width"],dM={name:"MiniMap",compatConfig:{MODE:3}},uM=t.defineComponent({...dM,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:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=tt(),g=t.ref();t.provide(Gh,o);const b=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),_=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",N=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),y=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),E=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),S=t.computed(()=>hs(h.value.filter(M=>!M.hidden))),A=t.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})),V=t.computed(()=>h.value&&h.value.length?pN(S.value,A.value):A.value),T=t.computed(()=>{const M=V.value.width/b.value,x=V.value.height/_.value;return Math.max(M,x)}),D=t.computed(()=>{const M=T.value*b.value,x=T.value*_.value,P=e.offsetScale*T.value;return{offset:P,x:V.value.x-(M-V.value.width)/2-P,y:V.value.y-(x-V.value.height)/2-P,width:M+P*2,height:x+P*2}}),C=t.computed(()=>!D.value.x||!D.value.y?"":`
|
|
52
|
+
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 wt extends Error{constructor(n,...o){var i;super((i=Sf[n])==null?void 0:i.call(Sf,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function ks(e){return"clientX"in e}function IN(e){return"sourceEvent"in e}function mn(e,n){const o=ks(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 zi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function vN(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 ar(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const CN=()=>!0;function Es(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function SN(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())tr(a,er(r))>0&&i.push(r);return i}const xN=250;function RN(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=SN(e,o,n+xN);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:p,y:f}=Zo(d,m,m.position,!0),h=Math.sqrt((p-e.x)**2+(f-e.y)**2);h>n||(h<s?(l=[{...m,x:p,y:f}],s=h):h===s&&l.push({...m,x:p,y:f}))}}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 xf(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=CN},u,m,p,f){const h=r==="target",g=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:b,y:_}=mn(e),E=l.elementFromPoint(b,_),N=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:g,y={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const k=Rf(void 0,N),S=N.getAttribute("data-nodeid"),A=N.getAttribute("data-handleid"),V=N.classList.contains("connectable"),T=N.classList.contains("connectableend");if(!S||!k)return y;const D={source:h?S:i,sourceHandle:h?A:a,target:h?i:S,targetHandle:h?a:A};y.connection=D;const R=V&&T&&(o===Sn.Strict?h&&k==="source"||!h&&k==="target":S!==i||A!==a);y.isValid=R&&d(D,{nodes:m,edges:u,sourceNode:p(D.source),targetNode:p(D.target)}),y.toHandle=Af(S,k,A,f,o,!0)}return y}function Rf(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function AN(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function $N(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Af(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===Sn.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)??[]],m=(o?u==null?void 0:u.find(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Zo(d,m,m.position,!0)}:m}const Ns={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top},TN=["production","prod"];function Fi(e,...n){$f()&&console.warn(`[Vue Flow]: ${e}`,...n)}function $f(){return!TN.includes(process.env.NODE_ENV||"")}function Tf(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,...nr(l)}}):null}function ws(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 Et(e){return typeof t.unref(e)<"u"}function MN(e,n,o,i){if(!e||!e.source||!e.target)return o(new wt(kt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Un(e)?a=e:a={...e,id:uf(e)},a=cf(a,void 0,i),fN(a,n)?!1:a}function VN(e,n,o,i,a){if(!n.source||!n.target)return a(new wt(kt.EDGE_INVALID,e.id)),!1;if(!o)return a(new wt(kt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?uf(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Mf(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!bo(l)){o(new wt(kt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=dN(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 wt(kt.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 Vf(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 Is(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}`,u=`${r}-${s}--${a}-${l}`;Vf("source",c,u,e,a,l),Vf("target",c,d,e,r,s)}}function Bf(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function vs(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Un(d)?d:MN(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new wt(kt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new wt(kt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new wt(kt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new wt(kt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...cf(u,f,r),sourceNode:m,targetNode:p})}return c}const Df=Symbol("vueFlow"),Of=Symbol("nodeId"),Lf=Symbol("nodeRef"),BN=Symbol("edgeId"),DN=Symbol("edgeRef"),rr=Symbol("slots");function Pf(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:p,findNode:f,multiSelectionActive:h,nodesSelectionActive:g,selectNodesOnDrag:b,removeSelectedElements:_,addSelectedNodes:E,updateNodePositions:N,emits:y}=tt(),{onStart:k,onDrag:S,onStop:A,onClick:V,el:T,disabled:D,id:C,selectable:R,dragHandle:$}=e,w=t.shallowRef(!1);let I=[],v,B=null,M={x:void 0,y:void 0},x={x:0,y:0},P=null,Y=!1,se=!1,he=0,ie=!1;const fe=PN(),pe=({x:re,y:ue})=>{M={x:re,y:ue};let z=!1;if(I=I.map(L=>{const F={x:re-L.distance.x,y:ue-L.distance.y},{computedPosition:X}=_s(L,o.value?ar(F,i.value):F,y.error,l.value,L.parentNode?f(L.parentNode):void 0);return z=z||L.position.x!==X.x||L.position.y!==X.y,L.position=X,L}),se=se||z,!!z&&(N(I,!0,!0),w.value=!0,P)){const[L,F]=bs({id:C,dragItems:I,findNode:f});S({event:P,node:L,nodes:F})}},ge=()=>{if(!B)return;const[re,ue]=bf(x,B,u.value);if(re!==0||ue!==0){const z={x:(M.x??0)-re/c.value.zoom,y:(M.y??0)-ue/c.value.zoom};p({x:re,y:ue})&&pe(z)}he=requestAnimationFrame(ge)},Te=(re,ue)=>{Y=!0;const z=f(C);!b.value&&!h.value&&z&&(z.selected||_()),z&&t.toValue(R)&&b.value&&ws(z,h.value,E,_,g,!1,ue);const L=fe(re.sourceEvent);if(M=L,I=bN(r.value,m.value,L,C),I.length){const[F,X]=bs({id:C,dragItems:I,findNode:f});k({event:re.sourceEvent,node:F,nodes:X})}},He=(re,ue)=>{var z;re.sourceEvent.type==="touchmove"&&re.sourceEvent.touches.length>1||(se=!1,s.value===0&&Te(re,ue),M=fe(re.sourceEvent),B=((z=n.value)==null?void 0:z.getBoundingClientRect())||null,x=mn(re.sourceEvent,B))},De=(re,ue)=>{const z=fe(re.sourceEvent);if(!ie&&Y&&d.value&&(ie=!0,ge()),!Y){const L=z.xSnapped-(M.x??0),F=z.ySnapped-(M.y??0);Math.sqrt(L*L+F*F)>s.value&&Te(re,ue)}(M.x!==z.xSnapped||M.y!==z.ySnapped)&&I.length&&Y&&(P=re.sourceEvent,x=mn(re.sourceEvent,B),pe(z))},Z=re=>{let ue=!1;if(!Y&&!w.value&&!h.value){const z=re.sourceEvent,L=fe(z),F=L.xSnapped-(M.x??0),X=L.ySnapped-(M.y??0),ee=Math.sqrt(F*F+X*X);ee!==0&&ee<=s.value&&(V==null||V(z),ue=!0)}if(I.length&&!ue){se&&(N(I,!1,!1),se=!1);const[z,L]=bs({id:C,dragItems:I,findNode:f});A({event:re.sourceEvent,node:z,nodes:L})}I=[],w.value=!1,ie=!1,Y=!1,M={x:void 0,y:void 0},cancelAnimationFrame(he)};return t.watch([()=>t.toValue(D),T],([re,ue],z,L)=>{if(ue){const F=Jt(ue);re||(v=c1().on("start",X=>He(X,ue)).on("drag",X=>De(X,ue)).on("end",X=>Z(X)).filter(X=>{const ee=X.target,ke=t.toValue($);return!X.button&&(!a.value||!If(ee,`.${a.value}`,ue)&&(!ke||If(ee,ke,ue)))}),F.call(v)),L(()=>{F.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),w}function ON(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function LN(e,n){const o=ON();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 PN(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=tt();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=IN(a)?a.sourceEvent:a,{x:c,y:d}=mn(s,l),u=Li({x:c,y:d},e.value),{x:m,y:p}=o.value?ar(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function lr(){return!0}function zf({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:p,nodesConnectable:f,autoPanOnConnect:h,autoPanSpeed:g,findNode:b,panBy:_,startConnection:E,updateConnection:N,endConnection:y,emits:k,viewport:S,edges:A,nodes:V,isValidConnection:T,nodeLookup:D}=tt();let C=null,R=!1,$=null;function w(v){var B;const M=t.toValue(o)==="target",x=ks(v),P=sf(v.target),Y=v.currentTarget;if(Y&&(x&&v.button===0||!x)){let se=function(we){z=mn(we,Z),pe=RN(Li(z,S.value,!1,[1,1]),u.value,D.value,X),L||(F(),L=!0);const G=xf(we,{handle:pe,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:fe,doc:P,lib:"vue",flowId:s,nodeLookup:D.value},A.value,V.value,b,D.value);$=G.handleDomNode,C=G.connection,R=$N(!!pe,G.isValid);const q={...Ne,isValid:R,to:G.toHandle&&R?Oi({x:G.toHandle.x,y:G.toHandle.y},S.value):z,toHandle:G.toHandle,toPosition:R&&G.toHandle?G.toHandle.position:Ns[X.position],toNode:G.toHandle?D.value.get(G.toHandle.nodeId):null};if(R&&pe&&(Ne!=null&&Ne.toHandle)&&q.toHandle&&Ne.toHandle.type===q.toHandle.type&&Ne.toHandle.nodeId===q.toHandle.nodeId&&Ne.toHandle.id===q.toHandle.id&&Ne.to.x===q.to.x&&Ne.to.y===q.to.y)return;const W=pe??G.toHandle;if(N(W&&R?Oi({x:W.x,y:W.y},S.value):z,W,AN(!!W,R)),Ne=q,!pe&&!R&&!$)return Es(ue);C&&C.source!==C.target&&$&&(Es(ue),ue=$,$.classList.add("connecting","vue-flow__handle-connecting"),$.classList.toggle("valid",!!R),$.classList.toggle("vue-flow__handle-valid",!!R))},he=function(we){"touches"in we&&we.touches.length>0||((pe||$)&&C&&R&&(r?r(we,C):k.connect(C)),k.connectEnd(we),a&&(l==null||l(we)),Es(ue),cancelAnimationFrame(ge),y(we),L=!1,R=!1,C=null,$=null,P.removeEventListener("mousemove",se),P.removeEventListener("mouseup",he),P.removeEventListener("touchmove",se),P.removeEventListener("touchend",he))};const ie=b(t.toValue(n));let fe=t.toValue(i)||T.value||lr;!fe&&ie&&(fe=(M?ie.isValidSourcePos:ie.isValidTargetPos)||lr);let pe,ge=0;const{x:Te,y:He}=mn(v),De=Rf(t.toValue(a),Y),Z=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!Z||!De)return;const re=Af(t.toValue(n),De,t.toValue(e),D.value,d.value);if(!re)return;let ue,z=mn(v,Z),L=!1;const F=()=>{if(!h.value)return;const[we,G]=bf(z,Z,g.value);_({x:we,y:G}),ge=requestAnimationFrame(F)},X={...re,nodeId:t.toValue(n),type:De,position:re.position},ee=D.value.get(t.toValue(n)),ye={inProgress:!0,isValid:null,from:Zo(ee,X,Oe.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:ee,to:z,toHandle:null,toPosition:Ns[X.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:De,position:(Y==null?void 0:Y.getAttribute("data-handlepos"))||Oe.Top,...z},{x:Te-Z.left,y:He-Z.top}),k.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:De});let Ne=ye;P.addEventListener("mousemove",se),P.addEventListener("mouseup",he),P.addEventListener("touchmove",se),P.addEventListener("touchend",he)}}function I(v){var B,M;if(!m.value)return;const x=t.toValue(o)==="target";if(!p.value){k.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Oe.Top,...mn(v)},void 0,!0);return}let P=t.toValue(i)||T.value||lr;const Y=b(t.toValue(n));if(!P&&Y&&(P=(x?Y.isValidSourcePos:Y.isValidTargetPos)||lr),Y&&(typeof Y.connectable>"u"?f.value:Y.connectable)===!1)return;const se=sf(v.target),he=xf(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Oe.Top,...mn(v)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:P,doc:se,lib:"vue",flowId:s,nodeLookup:D.value},A.value,V.value,b,D.value),ie=((B=he.connection)==null?void 0:B.source)===((M=he.connection)==null?void 0:M.target);he.isValid&&he.connection&&!ie&&k.connect(he.connection),k.clickConnectEnd(v),y(v,!0)}return{handlePointerDown:w,handleClick:I}}function zN(){return t.inject(Of,"")}function Ff(e){const n=e??zN()??"",o=t.inject(Lf,t.ref(null)),{findNode:i,edges:a,emits:r}=tt(),l=i(n);return l||r.error(new wt(kt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>_o([l],a.value))}}function FN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function UN(e,n){const o=FN();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 Uf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=tt();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,h=c.y*m*p,g=[];for(const b of e.value)if(b.draggable||l&&typeof b.draggable>"u"){const _={x:b.computedPosition.x+f,y:b.computedPosition.y+h},{position:E}=_s(b,_,s.error,n.value,b.parentNode?i(b.parentNode):void 0);g.push({id:b.id,position:E,from:b.position,distance:{x:c.x,y:c.y},dimensions:b.dimensions})}o(g,!0,!1)}}const sr=.1,HN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Kn(){return Fi("Viewport not initialized yet."),Promise.resolve(!1)}const jN={zoomIn:Kn,zoomOut:Kn,zoomTo:Kn,fitView:Kn,setCenter:Kn,fitBounds:Kn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Kn,setTransform:Kn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function KN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?xi:ja).scaleBy(Cs(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}=lf({x:-i,y:-a},e.translateExtent),m=Wo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?xi:ja).transform(Cs(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):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"?xi:ja).scaleTo(Cs(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:sr,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=hs(s),{x:d,y:u,zoom:m}=hf(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??sr);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:sr})=>{const{x:l,y:s,zoom:c}=hf(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??sr);return o(l,s,c,r)},project:a=>Li(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 Li(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 Oi(s,e.viewport)}return{x:0,y:0}}}:jN)}function Cs(e,n=0,o=HN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function GN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,b,_=!!(o.nodes.value.length||o.edges.value.length);g=jo([e.modelValue,()=>{var E,N;return(N=(E=e.modelValue)==null?void 0:E.value)==null?void 0:N.length}],([E])=>{E&&Array.isArray(E)&&(b==null||b.pause(),o.setElements(E),!b&&!_&&E.length?_=!0:b==null||b.resume())}),b=jo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,N])=>{var y;(y=e.modelValue)!=null&&y.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...E,...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},r=()=>{i.run(()=>{let g,b,_=!!o.nodes.value.length;g=jo([e.nodes,()=>{var E,N;return(N=(E=e.nodes)==null?void 0:E.value)==null?void 0:N.length}],([E])=>{E&&Array.isArray(E)&&(b==null||b.pause(),o.setNodes(E),!b&&!_&&E.length?_=!0:b==null||b.resume())}),b=jo([o.nodes,()=>o.nodes.value.length],([E])=>{var N;(N=e.nodes)!=null&&N.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...E],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},l=()=>{i.run(()=>{let g,b,_=!!o.edges.value.length;g=jo([e.edges,()=>{var E,N;return(N=(E=e.edges)==null?void 0:E.value)==null?void 0:N.length}],([E])=>{E&&Array.isArray(E)&&(b==null||b.pause(),o.setEdges(E),!b&&!_&&E.length?_=!0:b==null||b.resume())}),b=jo([o.edges,()=>o.edges.value.length],([E])=>{var N;(N=e.edges)!=null&&N.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...E],t.nextTick(()=>{g==null||g.resume()}))},{immediate:_}),t.onScopeDispose(()=>{g==null||g.stop(),b==null||b.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&Et(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&Et(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&Et(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&Et(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{Et(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const g=async b=>{let _=b;typeof n.autoConnect=="function"&&(_=await n.autoConnect(b)),_!==!1&&o.addEdges([_])};t.watch(()=>n.autoConnect,()=>{Et(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(b,_,E)=>{b?o.onConnect(g):o.hooks.value.connect.off(g),E(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(n)){const _=b;if(!g.includes(_)){const E=t.toRef(()=>n[_]),N=o[_];t.isRef(N)&&i.run(()=>{t.watch(E,y=>{Et(y)&&(N.value=y)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function YN(){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=>Fi(e.message))}}function qN(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),Ni(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),Ni(r.removeHasEmitListeners)}});function i(a){var r;const l=WN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function WN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Hf(){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:ms.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Vi.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:yo.Bezier,style:{}},connectionMode:Sn.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:zi()?"Meta":"Control",zoomActivationKeyCode:zi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:YN(),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 JN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function XN(e,n,o){const i=KN(e),a=z=>{const L=z??[];e.hooks.updateNodeInternals.trigger(L)},r=z=>mN(z,e.nodes,e.edges),l=z=>uN(z,e.nodes,e.edges),s=z=>_o(z,e.edges),c=({id:z,type:L,nodeId:F})=>{var X;const ee=z?`-${L}-${z}`:`-${L}`;return Array.from(((X=e.connectionLookup.get(`${F}${ee}`))==null?void 0:X.values())??[])},d=z=>{if(z)return n.value.get(z)},u=z=>{if(z)return o.value.get(z)},m=(z,L,F)=>{var X,ee;const ke=[];for(const ye of z){const Ne={id:ye.id,type:"position",dragging:F,from:ye.from};if(L&&(Ne.position=ye.position,ye.parentNode)){const we=d(ye.parentNode);Ne.position={x:Ne.position.x-(((X=we==null?void 0:we.computedPosition)==null?void 0:X.x)??0),y:Ne.position.y-(((ee=we==null?void 0:we.computedPosition)==null?void 0:ee.y)??0)}}ke.push(Ne)}ke!=null&&ke.length&&e.hooks.nodesChange.trigger(ke)},p=z=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const F=window.getComputedStyle(L),{m22:X}=new window.DOMMatrixReadOnly(F.transform),ee=[];for(const ke of z){const ye=ke,Ne=d(ye.id);if(Ne){const we=nr(ye.nodeElement);if(!!(we.width&&we.height&&(Ne.dimensions.width!==we.width||Ne.dimensions.height!==we.height||ye.forceUpdate))){const q=ye.nodeElement.getBoundingClientRect();Ne.dimensions=we,Ne.handleBounds.source=Tf("source",ye.nodeElement,q,X,Ne.id),Ne.handleBounds.target=Tf("target",ye.nodeElement,q,X,Ne.id),ee.push({id:Ne.id,type:"dimensions",dimensions:we})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ee.length&&e.hooks.nodesChange.trigger(ee)},f=(z,L)=>{const F=new Set,X=new Set;for(const ye of z)bo(ye)?F.add(ye.id):Un(ye)&&X.add(ye.id);const ee=jn(n.value,F,!0),ke=jn(o.value,X);if(e.multiSelectionActive){for(const ye of F)ee.push(Hn(ye,L));for(const ye of X)ke.push(Hn(ye,L))}ee.length&&e.hooks.nodesChange.trigger(ee),ke.length&&e.hooks.edgesChange.trigger(ke)},h=z=>{if(e.multiSelectionActive){const L=z.map(F=>Hn(F.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(jn(n.value,new Set(z.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(jn(o.value))},g=z=>{if(e.multiSelectionActive){const L=z.map(F=>Hn(F.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(jn(o.value,new Set(z.map(L=>L.id)))),e.hooks.nodesChange.trigger(jn(n.value,new Set,!0))},b=z=>{f(z,!0)},_=z=>{const F=(z||e.nodes).map(X=>(X.selected=!1,Hn(X.id,!1)));e.hooks.nodesChange.trigger(F)},E=z=>{const F=(z||e.edges).map(X=>(X.selected=!1,Hn(X.id,!1)));e.hooks.edgesChange.trigger(F)},N=z=>{if(!z||!z.length)return f([],!1);const L=z.reduce((F,X)=>{const ee=Hn(X.id,!1);return bo(X)?F.nodes.push(ee):F.edges.push(ee),F},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},y=z=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([z,e.maxZoom]),e.minZoom=z},k=z=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,z]),e.maxZoom=z},S=z=>{var L;(L=e.d3Zoom)==null||L.translateExtent(z),e.translateExtent=z},A=z=>{e.nodeExtent=z,a()},V=z=>{var L;(L=e.d3Zoom)==null||L.clickDistance(z)},T=z=>{e.nodesDraggable=z,e.nodesConnectable=z,e.elementsSelectable=z},D=z=>{const L=z instanceof Function?z(e.nodes):z;!e.initialized&&!L.length||(e.nodes=Mf(L,d,e.hooks.error.trigger))},C=z=>{const L=z instanceof Function?z(e.edges):z;if(!e.initialized&&!L.length)return;const F=vs(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Is(e.connectionLookup,o.value,F),e.edges=F},R=z=>{const L=z instanceof Function?z([...e.nodes,...e.edges]):z;!e.initialized&&!L.length||(D(L.filter(bo)),C(L.filter(Un)))},$=z=>{let L=z instanceof Function?z(e.nodes):z;L=Array.isArray(L)?L:[L];const F=Mf(L,d,e.hooks.error.trigger),X=[];for(const ee of F)X.push(kf(ee));X.length&&e.hooks.nodesChange.trigger(X)},w=z=>{let L=z instanceof Function?z(e.edges):z;L=Array.isArray(L)?L:[L];const F=vs(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),X=[];for(const ee of F)X.push(kf(ee));X.length&&e.hooks.edgesChange.trigger(X)},I=(z,L=!0,F=!1)=>{const X=z instanceof Function?z(e.nodes):z,ee=Array.isArray(X)?X:[X],ke=[],ye=[];function Ne(G){const q=s(G);for(const W of q)(!Et(W.deletable)||W.deletable)&&ye.push(Nf(W.id,W.source,W.target,W.sourceHandle,W.targetHandle))}function we(G){const q=[];for(const W of e.nodes)W.parentNode===G&&q.push(W);if(q.length){for(const W of q)ke.push(Ef(W.id));L&&Ne(q);for(const W of q)we(W.id)}}for(const G of ee){const q=typeof G=="string"?d(G):G;q&&(Et(q.deletable)&&!q.deletable||(ke.push(Ef(q.id)),L&&Ne([q]),F&&we(q.id)))}ye.length&&e.hooks.edgesChange.trigger(ye),ke.length&&e.hooks.nodesChange.trigger(ke)},v=z=>{const L=z instanceof Function?z(e.edges):z,F=Array.isArray(L)?L:[L],X=[];for(const ee of F){const ke=typeof ee=="string"?u(ee):ee;ke&&(Et(ke.deletable)&&!ke.deletable||X.push(Nf(typeof ee=="string"?ee:ee.id,ke.source,ke.target,ke.sourceHandle,ke.targetHandle)))}e.hooks.edgesChange.trigger(X)},B=(z,L,F=!0)=>{const X=u(z.id);if(!X)return!1;const ee=e.edges.indexOf(X),ke=VN(z,L,X,F,e.hooks.error.trigger);if(ke){const[ye]=vs([ke],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ne,we)=>we===ee?ye:Ne),Is(e.connectionLookup,o.value,[ye]),ye}return!1},M=(z,L,F={replace:!1})=>{const X=u(z);if(!X)return;const ee=typeof L=="function"?L(X):L;X.data=F.replace?ee:{...X.data,...ee}},x=z=>_f(z,e.nodes),P=z=>{const L=_f(z,e.edges);return Is(e.connectionLookup,o.value,L),L},Y=(z,L,F={replace:!1})=>{const X=d(z);if(!X)return;const ee=typeof L=="function"?L(X):L;F.replace?e.nodes.splice(e.nodes.indexOf(X),1,ee):Object.assign(X,ee)},se=(z,L,F={replace:!1})=>{const X=d(z);if(!X)return;const ee=typeof L=="function"?L(X):L;X.data=F.replace?ee:{...X.data,...ee}},he=(z,L,F=!1)=>{F?e.connectionClickStartHandle=z:e.connectionStartHandle=z,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},ie=(z,L=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=z,e.connectionEndHandle=L,e.connectionStatus=F)},fe=(z,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},pe=z=>{const L=cN(z),F=L?null:Di(z)?z:d(z.id);return!L&&!F?[null,null,L]:[L?z:er(F),F,L]},ge=(z,L=!0,F=e.nodes)=>{const[X,ee,ke]=pe(z);if(!X)return[];const ye=[];for(const Ne of F||e.nodes){if(!ke&&(Ne.id===ee.id||!Ne.computedPosition))continue;const we=er(Ne),G=tr(we,X);(L&&G>0||G>=we.width*we.height||G>=Number(X.width)*Number(X.height))&&ye.push(Ne)}return ye},Te=(z,L,F=!0)=>{const[X]=pe(z);if(!X)return!1;const ee=tr(X,L);return F&&ee>0||ee>=Number(X.width)*Number(X.height)},He=z=>{const{viewport:L,dimensions:F,d3Zoom:X,d3Selection:ee,translateExtent:ke}=e;if(!X||!ee||!z.x&&!z.y)return!1;const ye=Wo.translate(L.x+z.x,L.y+z.y).scale(L.zoom),Ne=[[0,0],[F.width,F.height]],we=X.constrain()(ye,Ne,ke),G=e.viewport.x!==we.x||e.viewport.y!==we.y||e.viewport.zoom!==we.k;return X.transform(ee,we),G},De=z=>{const L=z instanceof Function?z(e):z,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Et(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const X=L.modelValue||L.nodes||L.edges?[]:void 0;X&&(L.modelValue&&X.push(...L.modelValue),L.nodes&&X.push(...L.nodes),L.edges&&X.push(...L.edges),R(X));const ee=()=>{Et(L.maxZoom)&&k(L.maxZoom),Et(L.minZoom)&&y(L.minZoom),Et(L.translateExtent)&&S(L.translateExtent)};for(const ke of Object.keys(L)){const ye=ke,Ne=L[ye];![...JN,...F].includes(ye)&&Et(Ne)&&(e[ye]=Ne)}Kl(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:R,setNodes:D,setEdges:C,addNodes:$,addEdges:w,removeNodes:I,removeEdges:v,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:M,updateNode:Y,updateNodeData:se,applyEdgeChanges:P,applyNodeChanges:x,addSelectedElements:b,addSelectedNodes:h,addSelectedEdges:g,setMinZoom:y,setMaxZoom:k,setTranslateExtent:S,setNodeExtent:A,setPaneClickDistance:V,removeSelectedElements:N,removeSelectedNodes:_,removeSelectedEdges:E,startConnection:he,updateConnection:ie,endConnection:fe,setInteractive:T,setState:De,getIntersectingNodes:ge,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Te,panBy:He,fitView:z=>i.value.fitView(z),zoomIn:z=>i.value.zoomIn(z),zoomOut:z=>i.value.zoomOut(z),zoomTo:(z,L)=>i.value.zoomTo(z,L),setViewport:(z,L)=>i.value.setViewport(z,L),setTransform:(z,L)=>i.value.setTransform(z,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(z,L,F)=>i.value.setCenter(z,L,F),fitBounds:(z,L)=>i.value.fitBounds(z,L),project:z=>i.value.project(z),screenToFlowCoordinate:z=>i.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>i.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],L=[];for(const F of e.nodes){const{computedPosition:X,handleBounds:ee,selected:ke,dimensions:ye,isParent:Ne,resizing:we,dragging:G,events:q,...W}=F;z.push(W)}for(const F of e.edges){const{selected:X,sourceNode:ee,targetNode:ke,events:ye,...Ne}=F;L.push(Ne)}return JSON.parse(JSON.stringify({nodes:z,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:z=>new Promise(L=>{const{nodes:F,edges:X,position:ee,zoom:ke,viewport:ye}=z;F&&D(F),X&&C(X);const[Ne,we]=ye!=null&&ye.x&&(ye!=null&&ye.y)?[ye.x,ye.y]:ee??[null,null];if(Ne&&we){const G=(ye==null?void 0:ye.zoom)||ke||e.viewport.zoom;return Kl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ne,y:we,zoom:G}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const z=Hf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=Wo.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(go(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),F=e.viewportRef.getBoundingClientRect(),X=[[0,0],[F.width,F.height]],ee=e.d3Zoom.constrain()(L,X,z.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}De(z)},$destroy:()=>{}}}const ZN=["data-id","data-handleid","data-nodeid","data-handlepos"],QN={name:"Handle",compatConfig:{MODE:3}},ko=t.defineComponent({...QN,props:{id:{default:null},type:{},position:{default:()=>Oe.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:u,noDragClassName:m,noPanClassName:p}=tt(),{id:f,node:h,nodeEl:g,connectedEdges:b}=Ff(),_=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),N=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),y=t.toRef(()=>{var C,R,$,w,I,v;return((C=l.value)==null?void 0:C.nodeId)===f&&((R=l.value)==null?void 0:R.id)===e.id&&(($=l.value)==null?void 0:$.type)===i.value||((w=c.value)==null?void 0:w.nodeId)===f&&((I=c.value)==null?void 0:I.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),k=t.toRef(()=>{var C,R,$;return((C=s.value)==null?void 0:C.nodeId)===f&&((R=s.value)==null?void 0:R.id)===e.id&&(($=s.value)==null?void 0:$.type)===i.value}),{handlePointerDown:S,handleClick:A}=zf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),V=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some(C=>{const R=C[`${i.value}Handle`];return C[i.value]!==f?!1:R?R===e.id:!0}):typeof e.connectable=="number"?b.value.filter(C=>{const R=C[`${i.value}Handle`];return C[i.value]!==f?!1:R?R===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(h,b.value):Et(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var C;if(!h.dimensions.width||!h.dimensions.height)return;const R=(C=h.handleBounds[i.value])==null?void 0:C.find(x=>x.id===e.id);if(!d.value||R)return;const $=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!_.value||!$||!e.id)return;const w=g.value.getBoundingClientRect(),I=_.value.getBoundingClientRect(),v=window.getComputedStyle($),{m22:B}=new window.DOMMatrixReadOnly(v.transform),M={id:e.id,position:e.position,x:(I.left-w.left)/B,y:(I.top-w.top)/B,type:i.value,nodeId:f,...nr(_.value)};h.handleBounds[i.value]=[...h.handleBounds[i.value]??[],M]});function T(C){const R=ks(C);V.value&&E.value&&(R&&C.button===0||!R)&&S(C)}function D(C){!f||!s.value&&!E.value||V.value&&A(C)}return n({handleClick:A,handlePointerDown:S,onClick:D,onPointerDown:T}),(C,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:_,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":C.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${C.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:V.value,connecting:k.value,connectablestart:E.value,connectableend:N.value,connectionindicator:V.value&&(E.value&&!y.value||N.value&&y.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:D},[t.renderSlot(C.$slots,"default",{id:C.id})],42,ZN))}}),cr=function({sourcePosition:e=Oe.Bottom,targetPosition:n=Oe.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(ko,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(ko,{type:"source",position:e,connectable:i,isValidConnection:r})]};cr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],cr.inheritAttrs=!1,cr.compatConfig={MODE:3};const ew=cr,dr=function({targetPosition:e=Oe.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(ko,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};dr.props=["targetPosition","label","isValidTargetPos","connectable","data"],dr.inheritAttrs=!1,dr.compatConfig={MODE:3};const tw=dr,ur=function({sourcePosition:e=Oe.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(ko,{type:"source",position:e,connectable:o,isValidConnection:i})]};ur.props=["sourcePosition","label","isValidSourcePos","connectable","data"],ur.inheritAttrs=!1,ur.compatConfig={MODE:3};const nw=ur,ow=["transform"],iw=["width","height","x","y","rx","ry"],aw=["y"],rw={name:"EdgeText",compatConfig:{MODE:3}},lw=t.defineComponent({...rw,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,iw)):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,aw)],8,ow))}}),sw=["id","d","marker-end","marker-start"],cw=["d","stroke-width"],dw={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},mr=t.defineComponent({...dw,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,sw),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,cw)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(lw,{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 jf({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 Kf({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,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function fr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Gf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Oe.Left:l=n-fr(n-i,r),s=o;break;case Oe.Right:l=n+fr(i-n,r),s=o;break;case Oe.Top:l=n,s=o-fr(o-a,r);break;case Oe.Bottom:l=n,s=o+fr(a-o,r);break}return[l,s]}function Yf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top,curvature:s=.25}=e,[c,d]=Gf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=Gf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,h,g]=Kf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,p,f,h,g]}function qf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Oe.Left:case Oe.Right:r=.5*(n+i),l=o;break;case Oe.Top:case Oe.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Wf(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top}=e,[s,c]=qf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=qf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,h]=Kf({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,p,f,h]}const Jf={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}};function uw({source:e,sourcePosition:n=Oe.Bottom,target:o}){return n===Oe.Left||n===Oe.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 Xf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function mw({source:e,sourcePosition:n=Oe.Bottom,target:o,targetPosition:i=Oe.Top,center:a,offset:r}){const l=Jf[n],s=Jf[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=uw({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,h,g;const b={x:0,y:0},_={x:0,y:0},[E,N,y,k]=jf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){h=a.x??E,g=a.y??N;const A=[{x:h,y:c.y},{x:h,y:d.y}],V=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===p?f=m==="x"?A:V:f=m==="x"?V:A}else{const A=[{x:c.x,y:d.y}],V=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?V:A:f=l.y===p?A:V,n===i){const $=Math.abs(e[m]-o[m]);if($<=r){const w=Math.min(r-1,r-$);l[m]===p?b[m]=(c[m]>e[m]?-1:1)*w:_[m]=(d[m]>o[m]?-1:1)*w}}if(n!==i){const $=m==="x"?"y":"x",w=l[m]===s[$],I=c[$]>d[$],v=c[$]<d[$];(l[m]===1&&(!w&&I||w&&v)||l[m]!==1&&(!w&&v||w&&I))&&(f=m==="x"?A:V)}const T={x:c.x+b.x,y:c.y+b.y},D={x:d.x+_.x,y:d.y+_.y},C=Math.max(Math.abs(T.x-f[0].x),Math.abs(D.x-f[0].x)),R=Math.max(Math.abs(T.y-f[0].y),Math.abs(D.y-f[0].y));C>=R?(h=(T.x+D.x)/2,g=f[0].y):(h=f[0].x,g=(T.y+D.y)/2)}return[[e,{x:c.x+b.x,y:c.y+b.y},...f,{x:d.x+_.x,y:d.y+_.y},o],h,g,y,k]}function fw(e,n,o,i){const a=Math.min(Xf(e,n)/2,Xf(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,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 Ss(e){const{sourceX:n,sourceY:o,sourcePosition:i=Oe.Bottom,targetX:a,targetY:r,targetPosition:l=Oe.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,h,g]=mw({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((_,E,N)=>{let y;return N>0&&N<m.length-1?y=fw(m[N-1],E,m[N+1],s):y=`${N===0?"M":"L"}${E.x} ${E.y}`,_+=y,_},""),p,f,h,g]}function pw(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=jf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const hw=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]=pw(e);return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),Zf=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]=Ss({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),yw=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(Zf,{...e,...n,borderRadius:0})}}),gw=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]=Yf({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),bw=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]=Wf({...e,sourcePosition:e.sourcePosition??Oe.Bottom,targetPosition:e.targetPosition??Oe.Top});return t.h(mr,{path:o,labelX:i,labelY:a,...n,...e})}}}),_w={input:nw,default:ew,output:tw},kw={default:gw,straight:hw,step:yw,smoothstep:Zf,simplebezier:bw};function Ew(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...kw,...e.edgeTypes},b=Object.keys(g);for(const _ of e.edges)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),l=t.computed(()=>{const g={..._w,...e.nodeTypes},b=Object.keys(g);for(const _ of e.nodes)_.type&&!b.includes(_.type)&&(g[_.type]=_.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?pf(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 g=[];for(const b of e.edges){const _=n.value.get(b.source),E=n.value.get(b.target);NN({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})&&g.push(b)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const b of e.nodes)b.selected&&g.push(b);return g}),m=t.computed(()=>{const g=[];for(const b of e.edges)b.selected&&g.push(b);return g}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const b of e.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&g.push(b);return g}),h=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:h}}class Eo{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)??Eo.instance;return Eo.instance=i??new Eo,o&&(o.config.globalProperties.$vueFlowStorage=Eo.instance),Eo.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=Hf(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const h=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[h]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=Ew(a,s,c),u=XN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...bk(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function tt(e){const n=Eo.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(Df,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,(m,p,f)=>{const h=b=>{d.applyNodeChanges(b)},g=b=>{d.applyEdgeChanges(b)};m?(d.onNodesChange(h),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(h),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),Ni(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Fi(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Df,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new wt(kt.USEVUEFLOW_OPTIONS))}return s}function Nw(e){const{emits:n,dimensions:o}=tt();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=nr(e.value);(s.width===0||s.height===0)&&n.error(new wt(kt.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 ww={name:"UserSelection",compatConfig:{MODE:3}},Iw=t.defineComponent({...ww,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))}}),vw=["tabIndex"],Cw={name:"NodesSelection",compatConfig:{MODE:3}},Sw=t.defineComponent({...Cw,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=tt(),s=Uf(),c=t.ref(null),d=Pf({el:c,onStart(h){n.selectionDragStart(h),n.nodeDragStart(h)},onDrag(h){n.selectionDrag(h),n.nodeDrag(h)},onStop(h){n.selectionDragStop(h),n.nodeDragStop(h)}});t.onMounted(()=>{var h;r.value||(h=c.value)==null||h.focus({preventScroll:!0})});const u=t.computed(()=>hs(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function p(h){n.selectionContextMenu({event:h,nodes:i.value})}function f(h){r.value||Jo[h.key]&&(h.preventDefault(),s({x:Jo[h.key].x,y:Jo[h.key].y},h.shiftKey))}return(h,g)=>!t.unref(l)&&u.value.width&&u.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(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:p,onKeydown:f},null,46,vw)],6)):t.createCommentVNode("",!0)}});function xw(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const Rw={name:"Pane",compatConfig:{MODE:3}},Aw=t.defineComponent({...Rw,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:u,getSelectedNodes:m,removeNodes:p,removeEdges:f,selectionMode:h,deleteKeyCode:g,multiSelectionKeyCode:b,multiSelectionActive:_,edgeLookup:E,nodeLookup:N,connectionLookup:y,defaultEdgeOptions:k,connectionStartHandle:S,panOnDrag:A}=tt(),V=t.shallowRef(null),T=t.shallowRef(new Set),D=t.shallowRef(new Set),C=t.shallowRef(null),R=t.toRef(()=>c.value&&(e.isSelecting||r.value)),$=t.toRef(()=>S.value!==null);let w=!1,I=!1;const v=Bi(g,{actInsideInputWithModifier:!1}),B=Bi(b);t.watch(v,fe=>{fe&&(p(m.value),f(u.value),d.value=!1)}),t.watch(B,fe=>{_.value=fe});function M(fe,pe){return ge=>{ge.target===pe&&(fe==null||fe(ge))}}function x(fe){if(w||$.value){w=!1;return}a.paneClick(fe),l(),d.value=!1}function P(fe){var pe;if(Array.isArray(A.value)&&((pe=A.value)!=null&&pe.includes(2))){fe.preventDefault();return}a.paneContextMenu(fe)}function Y(fe){a.paneScroll(fe)}function se(fe){var pe,ge,Te;if(C.value=((pe=n.value)==null?void 0:pe.getBoundingClientRect())??null,!c.value||!e.isSelecting||fe.button!==0||fe.target!==V.value||!C.value)return;(Te=(ge=fe.target)==null?void 0:ge.setPointerCapture)==null||Te.call(ge,fe.pointerId);const{x:He,y:De}=xw(fe,C.value);I=!0,w=!1,l(),s.value={width:0,height:0,startX:He,startY:De,x:He,y:De},a.selectionStart(fe)}function he(fe){var pe;if(!C.value||!s.value)return;w=!0;const{x:ge,y:Te}=mn(fe,C.value),{startX:He=0,startY:De=0}=s.value,Z={startX:He,startY:De,x:ge<He?ge:He,y:Te<De?Te:De,width:Math.abs(ge-He),height:Math.abs(Te-De)},re=T.value,ue=D.value;T.value=new Set(pf(o.value,Z,i.value,h.value===ms.Partial,!0).map(L=>L.id)),D.value=new Set;const z=((pe=k.value)==null?void 0:pe.selectable)??!0;for(const L of T.value){const F=y.value.get(L);if(F)for(const{edgeId:X}of F.values()){const ee=E.value.get(X);ee&&(ee.selectable??z)&&D.value.add(X)}}if(!Bf(re,T.value)){const L=jn(N.value,T.value,!0);a.nodesChange(L)}if(!Bf(ue,D.value)){const L=jn(E.value,D.value);a.edgesChange(L)}s.value=Z,r.value=!0,d.value=!1}function ie(fe){var pe;fe.button!==0||!I||((pe=fe.target)==null||pe.releasePointerCapture(fe.pointerId),!r.value&&s.value&&fe.target===V.value&&x(fe),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(fe),e.selectionKeyPressed&&(w=!1),I=!1)}return(fe,pe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:V,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:fe.isSelecting}]),onClick:pe[0]||(pe[0]=ge=>R.value?void 0:M(x,V.value)(ge)),onContextmenu:pe[1]||(pe[1]=ge=>M(P,V.value)(ge)),onWheelPassive:pe[2]||(pe[2]=ge=>M(Y,V.value)(ge)),onPointerenter:pe[3]||(pe[3]=ge=>R.value?void 0:t.unref(a).paneMouseEnter(ge)),onPointerdown:pe[4]||(pe[4]=ge=>R.value?se(ge):t.unref(a).paneMouseMove(ge)),onPointermove:pe[5]||(pe[5]=ge=>R.value?he(ge):t.unref(a).paneMouseMove(ge)),onPointerup:pe[6]||(pe[6]=ge=>R.value?ie(ge):void 0),onPointerleave:pe[7]||(pe[7]=ge=>t.unref(a).paneMouseLeave(ge))},[t.renderSlot(fe.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(Iw,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(Sw,{key:1})):t.createCommentVNode("",!0)],34))}}),$w={name:"Transform",compatConfig:{MODE:3}},Tw=t.defineComponent({...$w,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=tt(),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))}}),Mw={name:"Viewport",compatConfig:{MODE:3}},Vw=t.defineComponent({...Mw,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:p,zoomOnPinch:f,zoomOnScroll:h,preventScrolling:g,noWheelClassName:b,noPanClassName:_,emits:E,connectionStartHandle:N,userSelectionActive:y,paneDragging:k,d3Zoom:S,d3Selection:A,d3ZoomHandler:V,viewport:T,viewportRef:D,paneClickDistance:C}=tt();Nw(D);const R=t.shallowRef(!1),$=t.shallowRef(!1);let w=null,I=!1,v=0,B={x:0,y:0,zoom:0};const M=Bi(s),x=Bi(l),P=Bi(r),Y=t.toRef(()=>(!x.value||x.value&&l.value===!0)&&(M.value||m.value)),se=t.toRef(()=>M.value||c.value),he=t.toRef(()=>l.value===!0&&Y.value!==!0),ie=t.toRef(()=>x.value&&l.value!==!0||y.value||he.value),fe=t.toRef(()=>N.value!==null);t.onMounted(()=>{if(!D.value){Fi("Viewport element is missing");return}const De=D.value,Z=De.getBoundingClientRect(),re=nN().clickDistance(C.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Jt(De).call(re),z=ue.on("wheel.zoom"),L=Wo.translate(i.value.x??0,i.value.y??0).scale(go(i.value.zoom??1,n.value,o.value)),F=[[0,0],[Z.width,Z.height]],X=re.constrain()(L,F,a.value);re.transform(ue,X),re.wheelDelta(ys),S.value=re,A.value=ue,V.value=z,T.value={x:X.x,y:X.y,zoom:X.k},re.on("start",ee=>{var ke;if(!ee.sourceEvent)return null;v=ee.sourceEvent.button,R.value=!0;const ye=Te(ee.transform);((ke=ee.sourceEvent)==null?void 0:ke.type)==="mousedown"&&(k.value=!0),B=ye,E.viewportChangeStart(ye),E.moveStart({event:ee,flowTransform:ye})}),re.on("end",ee=>{if(!ee.sourceEvent)return null;if(R.value=!1,k.value=!1,pe(Y.value,v??0)&&!I&&E.paneContextMenu(ee.sourceEvent),I=!1,ge(B,ee.transform)){const ke=Te(ee.transform);B=ke,E.viewportChangeEnd(ke),E.moveEnd({event:ee,flowTransform:ke})}}),re.filter(ee=>{var ke;const ye=P.value||h.value,Ne=f.value&&ee.ctrlKey,we=ee.button,G=ee.type==="wheel";if(we===1&&ee.type==="mousedown"&&(He(ee,"vue-flow__node")||He(ee,"vue-flow__edge")))return!0;if(!Y.value&&!ye&&!se.value&&!p.value&&!f.value||y.value||fe.value&&!G||!p.value&&ee.type==="dblclick"||He(ee,b.value)&&G||He(ee,_.value)&&(!G||se.value&&G&&!P.value)||!f.value&&ee.ctrlKey&&G||!ye&&!se.value&&!Ne&&G)return!1;if(!f&&ee.type==="touchstart"&&((ke=ee.touches)==null?void 0:ke.length)>1)return ee.preventDefault(),!1;if(!Y.value&&(ee.type==="mousedown"||ee.type==="touchstart")||he.value&&Array.isArray(m.value)&&m.value.includes(0)&&we===0||Array.isArray(m.value)&&!m.value.includes(we)&&(ee.type==="mousedown"||ee.type==="touchstart"))return!1;const q=Array.isArray(m.value)&&m.value.includes(we)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!we||we<=1;return(!ee.ctrlKey||M.value||G)&&q}),t.watch([y,Y],()=>{y.value&&!R.value?re.on("zoom",null):y.value||re.on("zoom",ee=>{T.value={x:ee.transform.x,y:ee.transform.y,zoom:ee.transform.k};const ke=Te(ee.transform);I=pe(Y.value,v??0),E.viewportChange(ke),E.move({event:ee,flowTransform:ke})})},{immediate:!0}),t.watch([y,se,d,P,f,g,b],()=>{se.value&&!P.value&&!y.value?ue.on("wheel.zoom",ee=>{if(He(ee,b.value))return!1;const ke=P.value||h.value,ye=f.value&&ee.ctrlKey;if(!(!g.value||se.value||ke||ye))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const we=ue.property("__zoom").k||1,G=zi();if(!M.value&&ee.ctrlKey&&f.value&&G){const ze=sn(ee),Fe=ys(ee),ae=we*2**Fe;re.scaleTo(ue,ae,ze,ee);return}const q=ee.deltaMode===1?20:1;let W=d.value===Vi.Vertical?0:ee.deltaX*q,Ce=d.value===Vi.Horizontal?0:ee.deltaY*q;!G&&ee.shiftKey&&d.value!==Vi.Vertical&&!W&&Ce&&(W=Ce,Ce=0),re.translateBy(ue,-(W/we)*u.value,-(Ce/we)*u.value);const $e=Te(ue.property("__zoom"));w&&clearTimeout(w),$.value?(E.move({event:ee,flowTransform:$e}),E.viewportChange($e),w=setTimeout(()=>{E.moveEnd({event:ee,flowTransform:$e}),E.viewportChangeEnd($e),$.value=!1},150)):($.value=!0,E.moveStart({event:ee,flowTransform:$e}),E.viewportChangeStart($e))},{passive:!1}):typeof z<"u"&&ue.on("wheel.zoom",function(ee,ke){const ye=!g.value&&ee.type==="wheel"&&!ee.ctrlKey,Ne=P.value||h.value,we=f.value&&ee.ctrlKey;if(!Ne&&!c.value&&!we&&ee.type==="wheel"||ye||He(ee,b.value))return null;ee.preventDefault(),z.call(this,ee,ke)},{passive:!1})},{immediate:!0})});function pe(De,Z){return Z===2&&Array.isArray(De)&&De.includes(2)}function ge(De,Z){return De.x!==Z.x&&!Number.isNaN(Z.x)||De.y!==Z.y&&!Number.isNaN(Z.y)||De.zoom!==Z.k&&!Number.isNaN(Z.k)}function Te(De){return{x:De.x,y:De.y,zoom:De.k}}function He(De,Z){return De.target.closest(`.${Z}`)}return(De,Z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:D,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(Aw,{"is-selecting":ie.value,"selection-key-pressed":t.unref(x),class:t.normalizeClass({connecting:fe.value,dragging:t.unref(k),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(Tw,null,{default:t.withCtx(()=>[t.renderSlot(De.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Bw=["id"],Dw=["id"],Ow=["id"],Lw={name:"A11yDescriptions",compatConfig:{MODE:3}},Pw=t.defineComponent({...Lw,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(of)}-${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,Bw),t.createElementVNode("div",{id:`${t.unref(af)}-${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,Dw),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(sN)}-${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,Ow))],64))}});function zw(){const e=tt();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Fw(e,n,o){return o===Oe.Left?e-n:o===Oe.Right?e+n:e}function Uw(e,n,o){return o===Oe.Top?e-n:o===Oe.Bottom?e+n:e}const xs=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Oe.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:Fw(n,e,i),cy:Uw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};xs.props=["radius","centerX","centerY","position","type"],xs.compatConfig={MODE:3};const Qf=xs,Hw=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:u,findNode:m,isValidConnection:p,multiSelectionActive:f,disableKeyboardA11y:h,elementsSelectable:g,edgesUpdatable:b,edgesFocusable:_,hooks:E}=tt(),N=t.computed(()=>u(e.id)),{emit:y,on:k}=LN(N.value,r),S=t.inject(rr),A=t.getCurrentInstance(),V=t.ref(!1),T=t.ref(!1),D=t.ref(""),C=t.ref(null),R=t.ref("source"),$=t.ref(null),w=t.toRef(()=>typeof N.value.selectable>"u"?g.value:N.value.selectable),I=t.toRef(()=>typeof N.value.updatable>"u"?b.value:N.value.updatable),v=t.toRef(()=>typeof N.value.focusable>"u"?_.value:N.value.focusable);t.provide(BN,e.id),t.provide(DN,$);const B=t.computed(()=>N.value.class instanceof Function?N.value.class(N.value):N.value.class),M=t.computed(()=>N.value.style instanceof Function?N.value.style(N.value):N.value.style),x=t.computed(()=>{const L=N.value.type||"default",F=S==null?void 0:S[`edge-${L}`];if(F)return F;let X=N.value.template??c.value[L];if(typeof X=="string"&&A){const ee=Object.keys(A.appContext.components);ee&&ee.includes(L)&&(X=t.resolveComponent(L,!1))}return X&&typeof X!="string"?X:(r.error(new wt(kt.EDGE_TYPE_MISSING,X)),!1)}),{handlePointerDown:P}=zf({nodeId:D,handleId:C,type:R,isValidConnection:p,edgeUpdaterType:R,onEdgeUpdate:he,onEdgeUpdateEnd:ie});return()=>{const L=m(N.value.source),F=m(N.value.target),X="pathOptions"in N.value?N.value.pathOptions:{};if(!L&&!F)return r.error(new wt(kt.EDGE_SOURCE_TARGET_MISSING,N.value.id,N.value.source,N.value.target)),null;if(!L)return r.error(new wt(kt.EDGE_SOURCE_MISSING,N.value.id,N.value.source)),null;if(!F)return r.error(new wt(kt.EDGE_TARGET_MISSING,N.value.id,N.value.target)),null;if(!N.value||N.value.hidden||L.hidden||F.hidden)return null;let ee;i.value===Sn.Strict?ee=L.handleBounds.source:ee=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const ke=Cf(ee,N.value.sourceHandle);let ye;i.value===Sn.Strict?ye=F.handleBounds.target:ye=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const Ne=Cf(ye,N.value.targetHandle),we=(ke==null?void 0:ke.position)||Oe.Bottom,G=(Ne==null?void 0:Ne.position)||Oe.Top,{x:q,y:W}=Zo(L,ke,we),{x:Ce,y:$e}=Zo(F,Ne,G);return N.value.sourceX=q,N.value.sourceY=W,N.value.targetX=Ce,N.value.targetY=$e,t.h("g",{ref:$,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${x.value===!1?"default":N.value.type||"default"}`,s.value,B.value,{updating:V.value,selected:N.value.selected,animated:N.value.animated,inactive:!w.value&&!E.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":N.value.ariaLabel===null?void 0:N.value.ariaLabel??`Edge from ${N.value.source} to ${N.value.target}`,"aria-describedby":v.value?`${af}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...N.value.domAttributes,onClick:pe,onContextmenu:ge,onDblclick:Te,onMouseenter:He,onMousemove:De,onMouseleave:Z,onKeyDown:v.value?z:void 0},[T.value?null:t.h(x.value===!1?c.value.default:x.value,{id:e.id,sourceNode:L,targetNode:F,source:N.value.source,target:N.value.target,type:N.value.type,updatable:I.value,selected:N.value.selected,animated:N.value.animated,label:N.value.label,labelStyle:N.value.labelStyle,labelShowBg:N.value.labelShowBg,labelBgStyle:N.value.labelBgStyle,labelBgPadding:N.value.labelBgPadding,labelBgBorderRadius:N.value.labelBgBorderRadius,data:N.value.data,events:{...N.value.events,...k},style:M.value,markerStart:`url('#${Pi(N.value.markerStart,n)}')`,markerEnd:`url('#${Pi(N.value.markerEnd,n)}')`,sourcePosition:we,targetPosition:G,sourceX:q,sourceY:W,targetX:Ce,targetY:$e,sourceHandleId:N.value.sourceHandle,targetHandleId:N.value.targetHandle,interactionWidth:N.value.interactionWidth,...X}),[I.value==="source"||I.value===!0?[t.h("g",{onMousedown:re,onMouseenter:Y,onMouseout:se},t.h(Qf,{position:we,centerX:q,centerY:W,radius:a.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:Y,onMouseout:se},t.h(Qf,{position:G,centerX:Ce,centerY:$e,radius:a.value,type:"target","data-type":"target"}))]:null]])};function Y(){V.value=!0}function se(){V.value=!1}function he(L,F){y.update({event:L,edge:N.value,connection:F})}function ie(L){y.updateEnd({event:L,edge:N.value}),T.value=!1}function fe(L,F){L.button===0&&(T.value=!0,D.value=F?N.value.target:N.value.source,C.value=(F?N.value.targetHandle:N.value.sourceHandle)??null,R.value=F?"target":"source",y.updateStart({event:L,edge:N.value}),P(L))}function pe(L){var F;const X={event:L,edge:N.value};w.value&&(l.value=!1,N.value.selected&&f.value?(d([N.value]),(F=$.value)==null||F.blur()):o([N.value])),y.click(X)}function ge(L){y.contextMenu({event:L,edge:N.value})}function Te(L){y.doubleClick({event:L,edge:N.value})}function He(L){y.mouseEnter({event:L,edge:N.value})}function De(L){y.mouseMove({event:L,edge:N.value})}function Z(L){y.mouseLeave({event:L,edge:N.value})}function re(L){fe(L,!0)}function ue(L){fe(L,!1)}function z(L){var F;!h.value&&rf.includes(L.key)&&w.value&&(L.key==="Escape"?((F=$.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),jw=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:u,findNode:m}=tt(),p=(e=t.inject(rr))==null?void 0:e["connection-line"],f=t.computed(()=>{var E;return m((E=i.value)==null?void 0:E.nodeId)}),h=t.computed(()=>{var E;return m((E=a.value)==null?void 0:E.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),b=t.computed(()=>c.value.markerStart?`url(#${Pi(c.value.markerStart,n)})`:""),_=t.computed(()=>c.value.markerEnd?`url(#${Pi(c.value.markerEnd,n)})`:"");return()=>{var E,N,y;if(!f.value||!i.value)return null;const k=i.value.id,S=i.value.type,A=f.value.handleBounds;let V=(A==null?void 0:A[S])??[];if(o.value===Sn.Loose){const M=(A==null?void 0:A[S==="source"?"target":"source"])??[];V=[...V,...M]}if(!V)return null;const T=(k?V.find(M=>M.id===k):V[0])??null,D=(T==null?void 0:T.position)??Oe.Top,{x:C,y:R}=Zo(f.value,T,D);let $=null;h.value&&(o.value===Sn.Strict?$=((E=h.value.handleBounds[S==="source"?"target":"source"])==null?void 0:E.find(M=>{var x;return M.id===((x=a.value)==null?void 0:x.id)}))||null:$=((N=[...h.value.handleBounds.source??[],...h.value.handleBounds.target??[]])==null?void 0:N.find(M=>{var x;return M.id===((x=a.value)==null?void 0:x.id)}))||null);const w=((y=a.value)==null?void 0:y.position)??(D?Ns[D]:null);if(!D||!w)return null;const I=l.value??c.value.type??yo.Bezier;let v="";const B={sourceX:C,sourceY:R,sourcePosition:D,targetX:g.value.x,targetY:g.value.y,targetPosition:w};return I===yo.Bezier?[v]=Yf(B):I===yo.Step?[v]=Ss({...B,borderRadius:0}):I===yo.SmoothStep?[v]=Ss(B):I===yo.SimpleBezier?[v]=Wf(B):v=`M${C},${R} ${g.value.x},${g.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:C,sourceY:R,sourcePosition:D,targetX:g.value.x,targetY:g.value.y,targetPosition:w,sourceNode:f.value,sourceHandle:T,targetNode:h.value,targetHandle:$,markerEnd:_.value,markerStart:b.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":_.value,"marker-start":b.value})))}}}),Kw=["id","markerWidth","markerHeight","markerUnits","orient"],Gw={name:"MarkerType",compatConfig:{MODE:3}},Yw=t.defineComponent({...Gw,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(fs).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(fs).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,Kw))}}),qw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ww={name:"MarkerDefinitions",compatConfig:{MODE:3}},Jw=t.defineComponent({...Ww,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=tt(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Pi(d,n);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)=>(t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(Yw,{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))])]))}}),Xw={name:"Edges",compatConfig:{MODE:3}},Zw=t.defineComponent({...Xw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=tt();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Jw),(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(wN)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(Hw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(jw))],64))}}),Qw=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:u,getNodeTypes:m,nodeExtent:p,elevateNodesOnSelect:f,disableKeyboardA11y:h,ariaLiveMessage:g,snapToGrid:b,snapGrid:_,nodeDragThreshold:E,nodesDraggable:N,elementsSelectable:y,nodesConnectable:k,nodesFocusable:S,hooks:A}=tt(),V=t.ref(null);t.provide(Lf,V),t.provide(Of,e.id);const T=t.inject(rr),D=t.getCurrentInstance(),C=Uf(),{node:R,parentNode:$}=Ff(e.id),{emit:w,on:I}=UN(R,l),v=t.toRef(()=>typeof R.draggable>"u"?N.value:R.draggable),B=t.toRef(()=>typeof R.selectable>"u"?y.value:R.selectable),M=t.toRef(()=>typeof R.connectable>"u"?k.value:R.connectable),x=t.toRef(()=>typeof R.focusable>"u"?S.value:R.focusable),P=t.computed(()=>B.value||v.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.value.nodeMouseLeave.hasListeners()),Y=t.toRef(()=>!!R.dimensions.width&&!!R.dimensions.height),se=t.computed(()=>{const F=R.type||"default",X=T==null?void 0:T[`node-${F}`];if(X)return X;let ee=R.template||m.value[F];if(typeof ee=="string"&&D){const ke=Object.keys(D.appContext.components);ke&&ke.includes(F)&&(ee=t.resolveComponent(F,!1))}return ee&&typeof ee!="string"?ee:(l.error(new wt(kt.NODE_TYPE_MISSING,ee)),!1)}),he=Pf({id:e.id,el:V,disabled:()=>!v.value,selectable:B,dragHandle:()=>R.dragHandle,onStart(F){w.dragStart(F)},onDrag(F){w.drag(F)},onStop(F){w.dragStop(F)},onClick(F){z(F)}}),ie=t.computed(()=>R.class instanceof Function?R.class(R):R.class),fe=t.computed(()=>{const F=(R.style instanceof Function?R.style(R):R.style)||{},X=R.width instanceof Function?R.width(R):R.width,ee=R.height instanceof Function?R.height(R):R.height;return!F.width&&X&&(F.width=typeof X=="string"?X:`${X}px`),!F.height&&ee&&(F.height=typeof ee=="string"?ee:`${ee}px`),F}),pe=t.toRef(()=>Number(R.zIndex??fe.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Te()}),t.onMounted(()=>{t.watch(()=>R.hidden,(F=!1,X,ee)=>{!F&&V.value&&(e.resizeObserver.observe(V.value),ee(()=>{V.value&&e.resizeObserver.unobserve(V.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>R.type,()=>R.sourcePosition,()=>R.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])})}),t.watch([()=>R.position.x,()=>R.position.y,()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=$.value)==null?void 0:F.computedPosition.z},pe,()=>R.selected,()=>R.dimensions.height,()=>R.dimensions.width,()=>{var F;return(F=$.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=$.value)==null?void 0:F.dimensions.width}],([F,X,ee,ke,ye,Ne])=>{const we={x:F,y:X,z:Ne+(f.value&&R.selected?1e3:0)};typeof ee<"u"&&typeof ke<"u"?R.computedPosition=gN({x:ee,y:ke,z:ye},we):R.computedPosition=we},{flush:"post",immediate:!0}),t.watch([()=>R.extent,p],([F,X],[ee,ke])=>{(F!==ee||X!==ke)&&ge()}),R.extent==="parent"||typeof R.extent=="object"&&"range"in R.extent&&R.extent.range==="parent"?Kl(()=>Y).toBe(!0).then(ge):ge(),()=>R.hidden?null:t.h("div",{ref:V,"data-id":R.id,class:["vue-flow__node",`vue-flow__node-${se.value===!1?"default":R.type||"default"}`,{[o.value]:v.value,dragging:he==null?void 0:he.value,draggable:v.value,selected:R.selected,selectable:B.value,parent:R.isParent},ie.value],style:{visibility:Y.value?"visible":"hidden",zIndex:R.computedPosition.z??pe.value,transform:`translate(${R.computedPosition.x}px,${R.computedPosition.y}px)`,pointerEvents:P.value?"all":"none",...fe.value},tabIndex:x.value?0:void 0,role:x.value?"group":void 0,"aria-describedby":h.value?void 0:`${of}-${n}`,"aria-label":R.ariaLabel,"aria-roledescription":"node",...R.domAttributes,onMouseenter:He,onMousemove:De,onMouseleave:Z,onContextmenu:re,onClick:z,onDblclick:ue,onKeydown:L},[t.h(se.value===!1?m.value.default:se.value,{id:R.id,type:R.type,data:R.data,events:{...R.events,...I},selected:R.selected,resizing:R.resizing,dragging:he.value,connectable:M.value,position:R.computedPosition,dimensions:R.dimensions,isValidTargetPos:R.isValidTargetPos,isValidSourcePos:R.isValidSourcePos,parent:R.parentNode,parentNodeId:R.parentNode,zIndex:R.computedPosition.z??pe.value,targetPosition:R.targetPosition,sourcePosition:R.sourcePosition,label:R.label,dragHandle:R.dragHandle,onUpdateNodeInternals:Te})]);function ge(){const F=R.computedPosition,{computedPosition:X,position:ee}=_s(R,b.value?ar(F,_.value):F,l.error,p.value,$.value);(R.computedPosition.x!==X.x||R.computedPosition.y!==X.y)&&(R.computedPosition={...R.computedPosition,...X}),(R.position.x!==ee.x||R.position.y!==ee.y)&&(R.position=ee)}function Te(){V.value&&d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])}function He(F){he!=null&&he.value||w.mouseEnter({event:F,node:R})}function De(F){he!=null&&he.value||w.mouseMove({event:F,node:R})}function Z(F){he!=null&&he.value||w.mouseLeave({event:F,node:R})}function re(F){return w.contextMenu({event:F,node:R})}function ue(F){return w.doubleClick({event:F,node:R})}function z(F){B.value&&(!i.value||!v.value||E.value>0)&&ws(R,r.value,c,s,a,!1,V.value),w.click({event:F,node:R})}function L(F){if(!(ps(F)||h.value))if(rf.includes(F.key)&&B.value){const X=F.key==="Escape";ws(R,r.value,c,s,a,X,V.value)}else v.value&&R.selected&&Jo[F.key]&&(F.preventDefault(),g.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~R.position.x}, y: ${~~R.position.y}`,C({x:Jo[F.key].x,y:Jo[F.key].y},F.shiftKey))}}});function eI(e={includeHiddenNodes:!1}){const{nodes:n}=tt();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 tI={class:"vue-flow__nodes vue-flow__container"},nI={name:"Nodes",compatConfig:{MODE:3}},oI=t.defineComponent({...nI,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=tt(),a=eI(),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",tI,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(Qw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function iI(){const{emits:e}=tt();t.onMounted(()=>{if($f()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new wt(kt.MISSING_STYLES))}})}const aI=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),rI={name:"VueFlow",compatConfig:{MODE:3}},lI=t.defineComponent({...rI,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=Gl(i,"modelValue",o),l=Gl(i,"nodes",o),s=Gl(i,"edges",o),c=tt(i),d=GN({modelValue:r,nodes:l,edges:s},i,c);return qN(o,c.hooks),zw(),iI(),t.provide(rr,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(Vw,null,{default:t.withCtx(()=>[t.createVNode(Zw),aI,t.createVNode(oI),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(Pw)],512))}}),sI={name:"Panel",compatConfig:{MODE:3}},ep=t.defineComponent({...sI,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=tt(),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))}}),cI=["width","height","innerHTML"],dI=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"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"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,cI))}}),Qe=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=Qe(dI,[["__scopeId","data-v-05aac699"]]),No=["red","amber","green","teal","blue","indigo","violet","pink"],tp={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function uI(e){return typeof e=="string"&&e in tp}const mI={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},fI=.15;function pI(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 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 hI(e){if(typeof e!="string")return null;const n=pI(e);if(!n||n.s<fI)return null;let o=null,i=1/0;for(const a of No){const r=Math.abs(n.h-mI[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function $t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(uI(n))return n;const o=e==null?void 0:e.properties;return hI((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Rs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const yI={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)"},gI={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 np(e,n=!1){return e?n?gI[e]:yI[e]:null}function wo(e){return tp[e]}function Qo(e){return`var(--em-swatch-${e}-bar)`}function bI(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 _I(e,n){const o=bI(n);return o?e(o):n.split("-")[1]??n}function kI(e){var o,i,a;const n=r=>e.params!=null&&r 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((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";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-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";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-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-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";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-TYPE-6":return"em.check.type6";case"CHK-TYPE-7":return"em.check.type7";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";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function op(e,n){const o=kI(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 EI(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const NI={class:"em-inline-issue__msgs"},Io=Qe(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(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",NI,[(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(op)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),wI=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],II={key:0,class:"em-mlang__dot"},vI=["id","role","aria-labelledby"],CI=["title"],Qt=Qe(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const _=o.defaultLang;return _&&o.languages.includes(_)?_:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const _=o.activeLang;return _&&o.languages.includes(_)?_:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(_){var E,N;return!!((N=(E=o.modelValue)==null?void 0:E[_])!=null&&N.trim())}const d=_=>`${o.name}-tab-${_}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(_){var y,k;const E=o.languages,N=E[(_+E.length)%E.length];N&&(l.value=N,await t.nextTick(),(k=(y=m.value)==null?void 0:y.querySelectorAll('[role="tab"]')[E.indexOf(N)])==null||k.focus())}function f(_){p(o.languages.indexOf(s.value)+_)}const h=t.computed(()=>o.languages.filter(_=>{var E,N;return _!==s.value&&!!((N=(E=o.modelValue)==null?void 0:E[_])!=null&&N.trim())})),g=t.computed(()=>{var _;return((_=o.modelValue)==null?void 0:_[s.value])??""});function b(_){const E={...o.modelValue};_.trim()===""?delete E[s.value]:E[s.value]=_,i("update:modelValue",E)}return(_,E)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,N=>(t.openBlock(),t.createElementBlock("span",{id:d(N),key:N,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===N}]),role:"tab","aria-selected":s.value===N,"aria-controls":u.value,tabindex:s.value===N?0:-1,onClick:y=>l.value=N,onKeydown:[t.withKeys(t.withModifiers(y=>l.value=N,["prevent"]),["enter"]),t.withKeys(t.withModifiers(y=>l.value=N,["prevent"]),["space"]),E[0]||(E[0]=t.withKeys(t.withModifiers(y=>f(-1),["prevent"]),["left"])),E[1]||(E[1]=t.withKeys(t.withModifiers(y=>f(1),["prevent"]),["right"])),E[2]||(E[2]=t.withKeys(t.withModifiers(y=>p(0),["prevent"]),["home"])),E[3]||(E[3]=t.withKeys(t.withModifiers(y=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(N),1),c(N)?(t.openBlock(),t.createElementBlock("span",II,"•")):t.createCommentVNode("",!0)],42,wI))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(oe.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":b},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":b},null,8,["name","placeholder","model-value"]))],8,vI),r.value&&h.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:h.value.join(", "),"aria-hidden":"true"},"•",8,CI)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),SI=["disabled"],xI={class:"em-panel__sub-label"},RI={class:"em-field"},AI={class:"em-field"},$I={class:"em-field"},TI={key:0,class:"em-field"},MI={class:"em-field"},VI={class:"em-class"},BI={class:"em-field"},DI={class:"em-field"},OI={key:1,class:"em-attr__navhint"},LI={key:2,class:"em-field"},PI={key:3,class:"em-field"},zI={class:"em-multilang"},FI={class:"em-multilang"},UI={key:4,class:"em-jpa"},HI={class:"em-field"},jI={class:"em-field"},KI={class:"em-field"},GI=["title"],YI={class:"em-swatch"},qI={class:"em-swatch__row"},WI=["title"],JI=["title","onClick"],ip=Qe(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(M=>M.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(M=>M.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var M;return $t(((M=l.value)==null?void 0:M.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","SERIALIZED_TYPE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=["none","LIST","SET","MAP"],u=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.serialization)==null?void 0:x.collectionType)??"none"});function m(M){return M==="none"?a.t("em.entity.serializedContainerNone"):M}function p(M){var Y,se;const x=M==="none"?void 0:M,P=x==="MAP"?(se=(Y=r.value)==null?void 0:Y.serialization)==null?void 0:se.mapKeyType:void 0;E({serialization:x?{collectionType:x,...P?{mapKeyType:P}:{}}:null})}function f(M){var P,Y;((Y=(P=r.value)==null?void 0:P.serialization)==null?void 0:Y.collectionType)==="MAP"&&E({serialization:{collectionType:"MAP",...M.trim()?{mapKeyType:M.trim()}:{}}})}const h=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],g=["inherit","STRING","CHAR","INTEGER"],b=M=>M;function _(M){return M==="inherit"?a.t("em.common.inherit"):M}function E(M){r.value&&a.updateEntity(r.value.modelId,M)}function N(M,x,P){var se;const Y=((se=r.value)==null?void 0:se.table)??{physicalName:""};E(M==="physicalName"?{table:{...Y,physicalName:P}}:{table:{...Y,logicalName:{...Y.logicalName,[x]:P}}})}function y(M){E({description:Object.keys(M).length?M:void 0})}function k(M,x){var P;E({jpaAttrs:{...(P=r.value)==null?void 0:P.jpaAttrs,[M]:x}})}function S(M,x){k(M,x)}const A=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.jpaAttrs)==null?void 0:x.discriminatorType)??"inherit"}),V=t.computed(()=>{var M,x;return!((x=(M=r.value)==null?void 0:M.jpaAttrs)!=null&&x.useDiscriminator)});function T(M){k("discriminatorType",M==="inherit"?void 0:M)}function D(M){E({hasPersonalInfo:M})}function C(M){E({referenceOnly:M?!0:void 0})}function R(M){E({superClass:M.trim()||void 0})}function $(M){E({schema:M.trim()||void 0})}function w(M){E({abstractClass:M})}const I=t.computed(()=>{var M,x;return((x=(M=r.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:x.join(", "))??""});function v(M){const x=M.split(",").map(P=>P.trim()).filter(Boolean);E({declarationOfInterfaces:x.length?x:void 0})}function B(M){r.value&&a.setEntitySwatch(r.value.modelId,M)}return(M,x)=>{var P,Y,se,he;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:x[0]||(x[0]=ie=>i("toggle"))},[t.createElementVNode("span",xI,[t.createVNode(Ve,{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(Io,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",RI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":x[1]||(x[1]=ie=>E({name:ie}))},null,8,["model-value"])]),t.createElementVNode("label",AI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":b,"label-provider":t.unref(li),"onUpdate:modelValue":x[2]||(x[2]=ie=>E({stereotype:ie}))},null,8,["model-value","label-provider"])]),r.value.stereotype==="SERIALIZED_TYPE"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",$I,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedContainer")),1),t.createVNode(t.unref(oe.BSSelect),{name:"ent-ser-container","model-value":u.value,items:d,"value-provider":b,"label-provider":m,"onUpdate:modelValue":x[3]||(x[3]=ie=>ie&&p(ie))},null,8,["model-value"])]),u.value==="MAP"?(t.openBlock(),t.createElementBlock("label",TI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.serializedMapKey")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-ser-mapkey",width:"100%",placeholder:t.unref(a).t("em.entity.serializedMapKeyPlaceholder"),"model-value":((P=r.value.serialization)==null?void 0:P.mapKeyType)??"","onUpdate:modelValue":f},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("label",MI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":x[4]||(x[4]=ie=>E({packageName:ie}))},null,8,["model-value"])]),t.createElementVNode("fieldset",VI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",BI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":x[5]||(x[5]=ie=>R(ie))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",DI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":I.value,"onUpdate:modelValue":x[6]||(x[6]=ie=>v(ie))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":x[7]||(x[7]=ie=>w(ie))},null,8,["label","model-value"])]),t.unref(_t)(r.value.stereotype)?(t.openBlock(),t.createElementBlock("p",OI,t.toDisplayString(t.unref(a).t("em.entity.noOwnTableNote")),1)):(t.openBlock(),t.createElementBlock("label",LI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-table",width:"100%","model-value":((Y=r.value.table)==null?void 0:Y.physicalName)??"","onUpdate:modelValue":x[8]||(x[8]=ie=>N("physicalName",null,ie))},null,8,["model-value"])])),t.unref(hn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",PI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":x[9]||(x[9]=ie=>$(ie))},null,8,["placeholder","model-value"])])),t.createElementVNode("fieldset",zI,[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,ie=>{var fe,pe;return t.openBlock(),t.createElementBlock("label",{key:ie,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(ie),1),t.createVNode(t.unref(oe.BSTextInput),{name:`ent-logical-${ie}`,width:"100%","model-value":((pe=(fe=r.value.table)==null?void 0:fe.logicalName)==null?void 0:pe[ie])??"","onUpdate:modelValue":ge=>N("logicalName",ie,ge)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",FI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":y},null,8,["languages","default-lang","model-value"])]),t.unref(hn)(r.value.stereotype)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",UI,[x[14]||(x[14]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(h,ie=>{var fe;return t.createVNode(t.unref(oe.BSCheckbox),{key:ie.key,name:`jpa-${ie.key}`,class:"em-check",label:ie.label,"model-value":!!((fe=r.value.jpaAttrs)!=null&&fe[ie.key]),"onUpdate:modelValue":pe=>S(ie.key,pe)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",HI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:V.value,"model-value":((se=r.value.jpaAttrs)==null?void 0:se.discriminatorColumnName)??"","onUpdate:modelValue":x[10]||(x[10]=ie=>k("discriminatorColumnName",ie.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",jI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(oe.BSSelect),{disabled:V.value,"model-value":A.value,items:g,"value-provider":b,"label-provider":_,"onUpdate:modelValue":x[11]||(x[11]=ie=>ie&&T(ie))},null,8,["disabled","model-value"])]),t.createElementVNode("label",KI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(oe.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:V.value,"model-value":(he=r.value.jpaAttrs)==null?void 0:he.discriminatorLength,"onUpdate:modelValue":x[12]||(x[12]=ie=>k("discriminatorLength",ie||void 0))},null,8,["disabled","model-value"])])])),t.createVNode(t.unref(oe.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":D},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(oe.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":C},null,8,["label","model-value"])],8,GI),t.createElementVNode("fieldset",YI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",qI,[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:x[13]||(x[13]=ie=>B(null))},"∅",10,WI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),ie=>(t.openBlock(),t.createElementBlock("button",{key:ie,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===ie}]),style:t.normalizeStyle({background:t.unref(Qo)(ie)}),title:t.unref(a).t(t.unref(wo)(ie)),onClick:fe=>B(ie)},null,14,JI))),128))])])],64)):t.createCommentVNode("",!0)],8,SI)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1b3b91f5"]]),XI=["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"],ap=["inherit","true","false"],pr="__OWN__";function rp(e,n){const o=t.computed(()=>e.state.logical.entities.find(J=>J.modelId===n())??null),i=t.computed(()=>{var J;return _t(((J=o.value)==null?void 0:J.stereotype)??"UNDEFINED")}),a=t.computed(()=>{var J;return hn(((J=o.value)==null?void 0:J.stereotype)??"UNDEFINED")}),r=t.computed(()=>new Set(e.selectedAttrIds.value));function l(J){return J==="none"?e.t("em.common.noneParen"):J}const s=J=>J;function c(J,ce){o.value&&e.updateAttribute(o.value.modelId,J.modelId,ce)}const d=t.computed(()=>jr(e.state.logical.associations));function u(J){if(!o.value)return;const ce=Lo(e.state.logical,o.value.modelId,J.modelId);return ce&&ka(J,ce)?ce:void 0}function m(J){return!!u(J)}function p(J){return m(J)?J.derivedIdFieldName??"":J.name??""}function f(J){const ce=u(J);if(!ce)return e.t("em.attr.namePlaceholder");const Ae=new Map(e.state.logical.entities.map(Ee=>[Ee.modelId,Ee]));return yl({...J,derivedIdFieldName:void 0},ce,Ae)||e.t("em.attr.namePlaceholder")}function h(J,ce){m(J)?c(J,{derivedIdFieldName:ce||void 0}):c(J,{name:ce})}function g(J){return J.name??""}function b(J,ce){c(J,{name:ce})}function _(J){return!!o.value&&Kr(J,o.value,d.value)}function E(J){var Ee,H;const ce=(Ee=J.derivedFrom)==null?void 0:Ee.associationRef,Ae=(H=o.value)==null?void 0:H.attributes.find(It=>{var Rt;return It.attrType==="RELATION_OWN"&&((Rt=It.derivedFrom)==null?void 0:Rt.associationRef)===ce&&d.value.has(It.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Ae==null?void 0:Ae.name)||e.t("em.attr.nameless")})}function N(J){return!!o.value&&!!Lo(e.state.logical,o.value.modelId,J.modelId)}function y(J,ce){c(J,{naturalId:ce||void 0,naturalIdMutable:ce?J.naturalIdMutable:void 0})}function k(){return{naturalId:void 0,naturalIdMutable:void 0}}function S(J,ce){c(J,{identifier:ce,...ce?k():{}})}function A(J,ce){c(J,{transient:ce||void 0,...ce?k():{}})}function V(J){return!!J.transient||J.attrType==="RELATION_REF"}function T(J){return ia(J)}function D(J,ce=0){var Ae;return((Ae=Zn(J,o.value,e.state.logical.entities,e.state.logical.associations,ce))==null?void 0:Ae.physicalName)||void 0}const C=J=>J.value,R=J=>J.label;function $(J,ce){if(!ce)return;const Ae=se.value.find(Ee=>Ee.type===ce);if(Ae){const Ee=J.dbAttrs[0]??{modelId:J.modelId+".c",physicalName:J.name,dataType:"VARCHAR"};c(J,{type:ce,customType:void 0,dbAttrs:[{...Ee,dataType:Ae.dataType,length:Ae.length,scale:Ae.scale}]});return}c(J,ce===_n?{type:ce}:{type:ce,customType:void 0})}function w(J,ce){c(J,{customType:ce.trim()===""?void 0:ce})}function I(J,ce){if(J.attrType==="RELATION_REF")return;const Ee={...J.dbAttrs[0]??{modelId:J.modelId+".c",physicalName:J.name,dataType:"VARCHAR"},...ce};ce.dataType!==void 0&&!qr.has(Ee.dataType)&&(Ee.scale=void 0),c(J,{dbAttrs:[Ee]})}function v(J){var ce;return qr.has(((ce=J.dbAttrs[0])==null?void 0:ce.dataType)??"")}function B(J){return!v(J)&&!T(J)&&!V(J)?e.t("em.attr.scaleTypeHint"):void 0}function M(J,ce){I(J,{logicalName:Object.keys(ce).length?ce:void 0})}function x(J,ce){c(J,{description:Object.keys(ce).length?ce:void 0})}function P(J){return J.personalInfoAttributeType??"none"}function Y(J,ce){c(J,{personalInfoAttributeType:ce==="none"?void 0:ce})}const se=t.computed(()=>e.predefinedCustomTypeCatalog.value),he=t.computed(()=>[...Mo(e.state.logical).keys()].sort()),ie=t.computed(()=>e.embeddableCatalog.value);function fe(J){var ce,Ae,Ee;return((ce=J.label)==null?void 0:ce[e.userLanguage.value])??((Ae=J.label)==null?void 0:Ae.ko)??((Ee=J.label)==null?void 0:Ee.en)??J.type}const pe=t.computed(()=>e.groupCodeCatalog.value);function ge(J){var ce;return((ce=pe.value.find(Ae=>Ae.groupCode===J.groupCode))==null?void 0:ce.codes)??[]}function Te(J){return["none",...ge(J)]}function He(J){return J==="none"?"none":J.code}function De(J){var Ae,Ee,H;if(J==="none")return e.t("em.common.noneParen");const ce=((Ae=J.label)==null?void 0:Ae[e.userLanguage.value])??((Ee=J.label)==null?void 0:Ee.ko)??((H=J.label)==null?void 0:H.en);return ce?`${J.code} (${ce})`:J.code}function Z(J,ce){o.value&&e.setAttributeGroupCode(o.value.modelId,J.modelId,ce)}function re(J,ce){c(J,{defaultValue:ce==="none"?void 0:ce})}function ue(J,ce){c(J,{defaultValue:ce.trim()===""?void 0:ce})}function z(J){return J.attrType.startsWith("EMBED")&&J.dbAttrs.length>0}const L=yn;function F(J){return z(J)||L(J)}function X(J,ce,Ae){const Ee=J.dbAttrs.map((H,It)=>{if(It!==ce)return H;const Rt={...H,...Ae};for(const ot of Object.keys(Ae))Ae[ot]===void 0&&delete Rt[ot];return Rt});o.value&&e.setEmbedColumns(o.value.modelId,J.modelId,Ee)}function ee(J,ce,Ae){X(J,ce,{logicalName:Object.keys(Ae).length?Ae:void 0})}function ke(J,ce){var H,It,Rt;if(L(J)){const ot=Zn(J,o.value,e.state.logical.entities,e.state.logical.associations,ce);return ot?{physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,logicalName:ot.logicalName}:void 0}if(J.attrType==="EMBED_PREDEF"){const ot=(H=e.embeddableCatalog.value.find(We=>We.type===J.type))==null?void 0:H.fields[ce];return ot?{name:ot.name,physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,shareable:ot.shareable,logicalName:ot.logicalName}:void 0}const Ae=(It=J.embedded)==null?void 0:It.embeddableRef;if(!Ae)return;const Ee=(Rt=e.state.logical.entities.find(ot=>ot.modelId===Ae))==null?void 0:Rt.attributes.flatMap(ot=>ot.dbAttrs)[ce];return Ee?{physicalName:Ee.physicalName,dataType:Ee.dataType,length:Ee.length,scale:Ee.scale,logicalName:Ee.logicalName}:void 0}function ye(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.dataType)||((Ee=J.dbAttrs[ce])==null?void 0:Ee.dataType)||""}function Ne(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.length)??((Ee=J.dbAttrs[ce])==null?void 0:Ee.length)}function we(J,ce){var Ae,Ee;return((Ae=ke(J,ce))==null?void 0:Ae.scale)??((Ee=J.dbAttrs[ce])==null?void 0:Ee.scale)}function G(J){return e.t(L(J)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const q=ap;function W(J){return J==="inherit"?e.t("em.common.inherit"):J}function Ce(J){return(J==null?void 0:J.updatable)===void 0?"inherit":J.updatable?"true":"false"}function $e(J,ce,Ae){X(J,ce,{updatable:Ae==="inherit"?void 0:Ae==="true"})}function ze(J,ce){I(J,{updatable:ce==="inherit"?void 0:ce==="true"})}const Fe=ap;function ae(J){return J==="inherit"?e.t("em.common.inherit"):J}function Se(J){return(J==null?void 0:J.insertable)===void 0?"inherit":J.insertable?"true":"false"}function Ge(J,ce,Ae){X(J,ce,{insertable:Ae==="inherit"?void 0:Ae==="true"})}function et(J,ce){I(J,{insertable:ce==="inherit"?void 0:ce==="true"})}const te=t.computed(()=>o.value?Gr(o.value,e.state.logical.entities):[]),de=t.computed(()=>$o(te.value.flatMap(J=>J.attributes.flatMap(ce=>ce.dbAttrs)))),Le=t.computed(()=>te.value.flatMap(J=>J.attributes.filter(ce=>ce.attrType==="NORMAL"&&ce.dbAttrs.length===1&&ce.dbAttrs[0]).map(ce=>{var Ae;return{modelId:ce.dbAttrs[0].modelId,physical:ce.dbAttrs[0].physicalName||ce.name,isCurrency:ce.type==="Currency",ownerName:J.modelId===((Ae=o.value)==null?void 0:Ae.modelId)?void 0:J.name}})));function dt(){const J=[...Le.value].sort((ce,Ae)=>Number(Ae.isCurrency)-Number(ce.isCurrency));return[pr,...J.map(ce=>ce.modelId)]}function Xe(J){if(J===pr)return e.t("em.attr.sharedOwn");const ce=Le.value.find(Ee=>Ee.modelId===J);if(!ce)return J;const Ae=ce.ownerName?`${ce.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Ae,physical:ce.physical,mode:ce.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function yt(J){return(J==null?void 0:J.sharedColumnRef)??pr}function st(J,ce,Ae){X(J,ce,{sharedColumnRef:Ae===pr?void 0:Ae})}function ft(J){return(J==null?void 0:J.sharedColumnRef)!=null}function nt(J){var ce;return((ce=Qn(J,de.value))==null?void 0:ce.physicalName)??""}return{entity:o,isValueType:i,isColumnless:a,focusedAttrIds:r,personalInfoItems:XI,piiLabel:l,idn:s,setAttr:c,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:E,isManagedFk:N,setNaturalId:y,clearNaturalIdPatch:k,setIdentifier:S,setTransient:A,dbLocked:V,fkDerived:T,fkOriginPhysical:D,typeValueOf:C,typeLabelOf:R,setAttrType:$,setAttrCustomType:w,setDb:I,scaleApplicable:v,scaleHint:B,setDbLogical:M,setAttrDescription:x,attrPiiValue:P,setAttrPii:Y,predefinedCustomTypeCatalog:se,serializedTypeNames:he,embeddableCatalog:ie,predefinedLabel:fe,groupCodeCatalog:pe,attrGroupCodes:ge,attrCodeItems:Te,codeValueOf:He,codeLabelOf:De,setAttrGroupCode:Z,setAttrCode:re,setAttrDefaultValue:ue,isEmbedExpanded:z,isMultiColFk:L,hasColumnSlots:F,setDbAt:X,setDbLogicalAt:ee,colSlotMeta:ke,fixedDataType:ye,fixedLength:Ne,fixedScale:we,slotFixedHint:G,updatableItems:q,updatableLabel:W,updatableValue:Ce,setUpdatableAt:$e,setUpdatable:ze,insertableItems:Fe,insertableLabel:ae,insertableValue:Se,setInsertableAt:Ge,setInsertable:et,scopeEntities:te,columnsById:de,sharedCandidates:Le,sharedItems:dt,sharedLabel:Xe,sharedValue:yt,setSharedAt:st,isShared:ft,sharedPhysical:nt}}const lp={"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.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","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.formatGroup":"Input format","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.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","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.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","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.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","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.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","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.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","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.fkChildCols":"Composite foreign key — {n} 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.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.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","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.title":"Command palette","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.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","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.connectHint":"Drag to connect a relationship to another entity","em.node.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-column(s) hidden","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.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","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.treeAria":"Diagram tree","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.current":"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.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","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.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"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.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.entity.valueTypeSwitchEmbedded":'"{name}" is currently embedded by {owners} entit(y/ies), so it cannot be switched directly between a serialized type and an embeddable — remove the embedded attributes first (a serialized type is referenced by type, not by a relation)',"em.attr.serializedNoColumnNote":"A serialized type has no per-field physical columns — it is serialized whole into a single column on the consuming attribute","em.entity.noOwnTableNote":"A value type has no table of its own — an embeddable is flattened into the owner table, and a serialized type is serialized into a single column on the consuming attribute","em.entity.serializedTypeHasRelations":'"{name}" participates in {count} relationship(s), so it cannot be turned into a serialized type — remove those relationships first (a serialized type is referenced by an attribute type, not by a relationship)',"em.entity.serializedContainer":"Container","em.entity.serializedContainerNone":"none (single value)","em.entity.serializedMapKey":"Map key type","em.entity.serializedMapKeyPlaceholder":"e.g. PromoType (unset → codegen emits a placeholder Object + fill-in)","em.entity.noIndexNote":"A serialized type cannot have indexes — an index is placed on columns, and this type is serialized whole into a single column on the consuming attribute","em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'A value type (embeddable / 직렬화 타입) 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.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.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"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.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","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.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},sp={"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.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","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.formatGroup":"入力形式","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.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","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.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","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.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","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.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","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.fkChildCols":"複合外部キー — カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","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.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","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.title":"コマンドパレット","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.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","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.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティのサブカラムをすべて折りたたむ","em.node.embedAllShow":"折りたたまれたサブカラムをすべて展開","em.node.embedAllSummary":"サブカラム {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","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.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{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.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.entity.valueTypeSwitchEmbedded":'"{name}" は現在 {owners} 件のエンティティに組み込まれているため、シリアライズ型と組込み可能の間を直接切り替えられません — 先に組込み属性を整理してください(シリアライズ型は関係ではなく型参照で指定されます)',"em.attr.serializedNoColumnNote":"シリアライズ型はフィールドごとの物理カラムを持ちません — 利用側属性の単一カラムにまとめてシリアライズされます","em.entity.noOwnTableNote":"値型は自身のテーブルを持ちません — 組込み可能は所有者テーブルに展開され、シリアライズ型は利用側属性の単一カラムにシリアライズされます","em.entity.serializedTypeHasRelations":'"{name}" は {count} 件の関連に参加しているためシリアライズ型に変更できません — 先に関連を整理してください(シリアライズ型は関係ではなく属性の型参照で指定されます)',"em.entity.serializedContainer":"コンテナ","em.entity.serializedContainerNone":"なし(単一値)","em.entity.serializedMapKey":"Map キー型","em.entity.serializedMapKeyPlaceholder":"例: PromoType(未指定ならコード生成が仮の Object + 手入力箇所を出す)","em.entity.noIndexNote":"シリアライズ型はインデックスを持てません — インデックスはカラムに張られますが、この型は利用側属性の単一カラムにまとめてシリアライズされます","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'値型(組込み可能・シリアライズ型)は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","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.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","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.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと DDL のカラムが異なる型で出力されます","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.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},cp={"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.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","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.formatGroup":"입력 형식","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.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","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.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","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.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","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.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","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.fkChildCols":"복합 외래키 — 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","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.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","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.title":"명령 팔레트","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.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","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.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 서브컬럼 모두 접기","em.node.embedAllShow":"접힌 서브컬럼 모두 펼치기","em.node.embedAllSummary":"서브컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","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.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{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.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.entity.valueTypeSwitchEmbedded":'"{name}"은(는) 현재 {owners}개 엔티티에 임베드되어 있어 직렬화 타입/임베더블 사이를 바로 전환할 수 없습니다 — 임베드 속성을 먼저 정리한 뒤 전환하세요(직렬화 타입은 관계가 아니라 타입 참조로 지목됩니다)',"em.attr.serializedNoColumnNote":"직렬화 타입은 필드별 물리 컬럼이 없습니다 — 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.entity.noOwnTableNote":"값 타입은 자체 테이블이 없습니다 — 임베더블은 소유자 테이블로 펼쳐지고, 직렬화 타입은 소비 속성의 컬럼 하나에 직렬화됩니다","em.entity.serializedTypeHasRelations":'"{name}"은(는) 연관관계 {count}개에 참여 중이라 직렬화 타입으로 바꿀 수 없습니다 — 연관을 먼저 정리하세요(직렬화 타입은 관계가 아니라 소비 속성의 타입 참조로 지목됩니다)',"em.entity.serializedContainer":"컨테이너","em.entity.serializedContainerNone":"없음 (단일 값)","em.entity.serializedMapKey":"Map 키 타입","em.entity.serializedMapKeyPlaceholder":"예: PromoType (미지정 시 코드젠이 임시 Object + 손채움)","em.entity.noIndexNote":"직렬화 타입은 인덱스를 가질 수 없습니다 — 인덱스는 컬럼에 걸리는데 이 타입은 소비 속성의 컬럼 하나에 통째로 직렬화됩니다","em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'값 타입(임베더블·직렬화 타입)은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","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.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"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.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 DDL 컬럼이 서로 다른 타입으로 산출됩니다","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.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},ZI=["ko","en","ja"],As={ko:cp,en:lp,ja:sp};function en(e,n,o){let a=(As[e]??As.ko)[n]??As.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const dp=["ko","en","ja","zh"];function QI(e){if(e)for(const n of dp){const o=e[n];if(o)return o}}function $s(e){const n=QI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function ev(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:dp.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const tv=["aria-expanded","placeholder"],nv=["aria-selected","onClick","onMouseenter"],ov={key:0,class:"gcc__opt gcc__opt--empty"},up=Qe(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,D)=>en(o.locale??"ko",T,D),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),f=t.computed(()=>p.value?$s(p.value):"");t.watch(f,T=>{d.value||(c.value=T)},{immediate:!0});const h=t.computed(()=>c.value===f.value?o.items:ev(o.items,c.value));function g(){var D;const T=(D=r.value)==null?void 0:D.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function b(){d.value=!0,g(),u.value=Math.max(0,h.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",V)}function _(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",V)}t.onBeforeUnmount(_);function E(){b(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function N(){d.value||b(),u.value=0}function y(T){i("update:modelValue",T.groupCode),c.value=$s(T),_()}function k(){i("update:modelValue",void 0),c.value="",_()}function S(){c.value.trim()===""?k():(c.value=f.value,_())}function A(T){var D;if(T.key==="ArrowDown")d.value||b(),u.value=Math.min(u.value+1,h.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const C=h.value[u.value];C&&y(C),T.preventDefault()}else T.key==="Escape"&&(c.value=f.value,_(),(D=l.value)==null||D.blur())}function V(T){var C,R;const D=T.target;!((C=r.value)!=null&&C.contains(D))&&!((R=s.value)!=null&&R.contains(D))&&S()}return(T,D)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":D[0]||(D[0]=C=>c.value=C),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:N,onKeydown:A},null,40,tv),[[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(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:D[1]||(D[1]=t.withModifiers(()=>{},["prevent"])),onClick:k},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,(C,R)=>(t.openBlock(),t.createElementBlock("li",{key:C.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":R===u.value,"is-selected":C.groupCode===e.modelValue}]),role:"option","aria-selected":C.groupCode===e.modelValue,onMousedown:D[2]||(D[2]=t.withModifiers(()=>{},["prevent"])),onClick:$=>y(C),onMouseenter:$=>u.value=R},t.toDisplayString(t.unref($s)(C)),43,nv))),128)),h.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",ov,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),iv=["aria-labelledby"],av=["aria-checked","tabindex","onClick","onKeydown"],mp=Qe(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,av))),128))],8,iv))}}),[["__scopeId","data-v-5c793bbb"]]),rv=["disabled"],lv={class:"em-aw__toolbar"},sv={class:"em-aw__count"},cv={class:"em-aw__scroll"},dv={class:"em-aw__table"},uv={class:"c-name"},mv={class:"c-type"},fv={class:"c-logical"},pv=["id"],hv={class:"c-col"},yv={class:"c-constraints"},gv={class:"c-del"},bv={class:"c-expand"},_v=["title","onClick","onKeydown"],kv=["title"],Ev=["title"],Nv={key:1,class:"em-aw__muted"},wv=["title"],Iv=["title"],vv=["title"],Cv={class:"em-aw__cflags"},Sv=["title"],xv={key:0,class:"em-aw__embed-col"},Rv={class:"em-aw__embed-label"},Av=["title"],$v={colspan:"8"},Tv={class:"em-aw__detail"},Mv={class:"em-aw__dgroup"},Vv=["title"],Bv={class:"em-aw__df"},Dv={class:"em-aw__df"},Ov={class:"em-aw__dgroup"},Lv={key:0,class:"em-aw__dgroup"},Pv={class:"em-aw__df"},zv={key:0,class:"em-aw__df"},Fv={class:"em-aw__df"},Uv={class:"em-aw__dgroup em-aw__ddesc"},Hv={class:"c-expand"},jv=["title","onClick","onKeydown"],Kv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},Gv=["title"],Yv=["title"],qv=["colspan"],Wv=["title"],Jv={class:"em-aw__cflags"},Xv=["title"],Zv={colspan:"8"},Qv={class:"em-aw__detail"},eC={class:"em-aw__dgroup em-aw__ddesc"},tC={class:"c-expand"},nC=["title","onClick","onKeydown"],oC={class:"em-aw__embed-label"},iC=["title"],aC=["title"],rC={class:"em-aw__ro"},lC=["title"],sC={class:"em-aw__ro"},cC=["title"],dC={class:"em-aw__ro"},uC={key:0,class:"em-aw__detail-row em-aw__embed-detail"},mC={colspan:"8"},fC={class:"em-aw__detail"},pC={class:"em-aw__dgroup"},hC={key:0,class:"em-aw__df"},yC={class:"em-aw__df"},gC={class:"em-aw__df"},bC={key:0},_C={colspan:"99",class:"em-aw__empty"},kC=6,fp=5,EC=Qe(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttr:u,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:E,isManagedFk:N,setNaturalId:y,setIdentifier:k,setTransient:S,dbLocked:A,fkDerived:V,fkOriginPhysical:T,typeValueOf:D,typeLabelOf:C,setAttrType:R,setAttrCustomType:$,setDb:w,scaleApplicable:I,scaleHint:v,setDbLogical:B,attrPiiValue:M,setAttrPii:x,predefinedCustomTypeCatalog:P,serializedTypeNames:Y,embeddableCatalog:se,predefinedLabel:he,groupCodeCatalog:ie,attrGroupCodes:fe,attrCodeItems:pe,codeValueOf:ge,codeLabelOf:Te,setAttrGroupCode:He,setAttrCode:De,setAttrDefaultValue:Z,setAttrDescription:re,hasColumnSlots:ue,isMultiColFk:z,setDbAt:L,setDbLogicalAt:F,colSlotMeta:X,fixedDataType:ee,fixedLength:ke,fixedScale:ye,slotFixedHint:Ne,updatableItems:we,updatableLabel:G,updatableValue:q,setUpdatableAt:W,setUpdatable:Ce,insertableItems:$e,insertableLabel:ze,insertableValue:Fe,setInsertableAt:ae,setInsertable:Se,sharedItems:Ge,sharedLabel:et,sharedValue:te,setSharedAt:de,isShared:Le,sharedPhysical:dt}=rp(o,()=>n.entityId),Xe=t.computed(()=>{var Ae;return[...((Ae=i.value)==null?void 0:Ae.attributes)??[]].sort((Ee,H)=>Ee.order-H.order)}),yt=t.computed(()=>{var Ae;return(((Ae=i.value)==null?void 0:Ae.attributes)??[]).filter(Ee=>Ee.attrType!=="DIVIDER").length}),st=t.ref(new Set);function ft(Ae){return st.value.has(Ae)}function nt(Ae){const Ee=new Set(st.value);Ee.has(Ae)?Ee.delete(Ae):Ee.add(Ae),st.value=Ee}const J=t.ref(o.userLanguage.value);function ce(Ae){!Ae||!i.value||o.addPredefinedEmbed(i.value.modelId,Ae)}return(Ae,Ee)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",lv,[t.createElementVNode("span",sv,t.toDisplayString(t.unref(o).t("em.attr.section",{n:yt.value})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ee[0]||(Ee[0]=H=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:Ee[1]||(Ee[1]=H=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(se).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(se),"value-provider":H=>H.type,"label-provider":t.unref(he),"onUpdate:modelValue":ce},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",cv,[t.createElementVNode("table",dv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[Ee[3]||(Ee[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",uv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",mv,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",fv,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,pv),t.createVNode(mp,{modelValue:J.value,"onUpdate:modelValue":Ee[2]||(Ee[2]=H=>J.value=H),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",hv,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),Ee[4]||(Ee[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),Ee[5]||(Ee[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",yv,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),Ee[6]||(Ee[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.value,H=>{var It,Rt,ot,We,Ze,Q,Mt,Vt,Mn,an;return t.openBlock(),t.createElementBlock(t.Fragment,{key:H.modelId},[H.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[7]||(Ee[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-divlabel-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":H.name,"onUpdate:modelValue":_e=>t.unref(u)(H,{name:_e})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:kC,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",gv,[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])])],2)):t.unref(ue)(H)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(l).has(H.modelId)}])},[t.createElementVNode("td",Hv,[t.unref(z)(H)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":ft(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:_e=>nt(H.modelId),onKeydown:[t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,jv)):(t.openBlock(),t.createElementBlock("span",Kv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(_)(H)?t.unref(E)(H):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(_)(H),placeholder:t.unref(f)(H),"model-value":t.unref(p)(H),"onUpdate:modelValue":_e=>t.unref(h)(H,_e)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,Gv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-type-${H.modelId}`,width:"100%",disabled:"","model-value":H.type},null,8,["name","model-value"])],8,Yv),t.createElementVNode("td",{colspan:t.unref(z)(H)?fp-1:fp,class:"em-aw__embed-note"},t.toDisplayString(t.unref(z)(H)?t.unref(o).t("em.attr.fkChildCols",{n:H.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:H.dbAttrs.length})),9,qv),t.unref(z)(H)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",Jv,[t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:"","onUpdate:modelValue":_e=>t.unref(k)(H,_e)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":H.notNull,disabled:"","onUpdate:modelValue":_e=>t.unref(u)(H,{notNull:_e})},null,8,["name","model-value","onUpdate:modelValue"])])],8,Wv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(N)(H)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])],8,Xv)],2),t.unref(z)(H)&&ft(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[15]||(Ee[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Zv,[t.createElementVNode("div",Qv,[t.createElementVNode("fieldset",eC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":_e=>t.unref(re)(H,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.dbAttrs,(_e,mt)=>{var vt,O,U,le,ne,xe,Be,qe;return t.openBlock(),t.createElementBlock(t.Fragment,{key:_e.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ft(_e.modelId)}])},[t.createElementVNode("td",tC,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(_e.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(_e.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:je=>nt(_e.modelId),onKeydown:[t.withKeys(t.withModifiers(je=>nt(_e.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(je=>nt(_e.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,nC)]),t.createElementVNode("td",oC,"↳ "+t.toDisplayString(((vt=t.unref(X)(H,mt))==null?void 0:vt.name)??((O=t.unref(X)(H,mt))==null?void 0:O.physicalName)??t.unref(o).t("em.attr.colFallback",{n:mt+1})),1),Ee[16]||(Ee[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Qt,{name:`aw-embed-logical-${_e.modelId}`,languages:t.unref(o).languages.value,"active-lang":J.value,placeholder:((le=(U=t.unref(X)(H,mt))==null?void 0:U.logicalName)==null?void 0:le[J.value])??((xe=(ne=t.unref(X)(H,mt))==null?void 0:ne.logicalName)==null?void 0:xe.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":_e.logicalName,"onUpdate:modelValue":je=>t.unref(F)(H,mt,je)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(Le)(_e)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-embed-col-${_e.modelId}`,width:"100%",disabled:t.unref(Le)(_e),placeholder:((Be=t.unref(X)(H,mt))==null?void 0:Be.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Le)(_e)?t.unref(dt)(_e):_e.physicalName,"onUpdate:modelValue":je=>t.unref(L)(H,mt,{physicalName:je})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":_e.modelId},null,8,["controller","ref-id"])],8,iC),t.createElementVNode("td",{title:t.unref(Ne)(H)},[t.createElementVNode("span",rC,t.toDisplayString(t.unref(ee)(H,mt)),1)],8,aC),t.createElementVNode("td",{title:t.unref(Ne)(H)},[t.createElementVNode("span",sC,t.toDisplayString(t.unref(ke)(H,mt)??""),1)],8,lC),t.createElementVNode("td",{class:"c-constraints",title:t.unref(Ne)(H)},[t.createElementVNode("span",dC,t.toDisplayString(t.unref(ye)(H,mt)!=null?`scale ${t.unref(ye)(H,mt)}`:""),1)],8,cC),Ee[17]||(Ee[17]=t.createElementVNode("td",null,null,-1))],2),ft(_e.modelId)?(t.openBlock(),t.createElementBlock("tr",uC,[Ee[20]||(Ee[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",mC,[t.createElementVNode("div",fC,[t.createElementVNode("fieldset",pC,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(qe=t.unref(X)(H,mt))!=null&&qe.shareable?(t.openBlock(),t.createElementBlock("label",hC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(oe.BSSelect),{width:"150px","model-value":t.unref(te)(_e),items:t.unref(Ge)(),"value-provider":t.unref(d),"label-provider":t.unref(et),"onUpdate:modelValue":je=>je&&t.unref(de)(H,mt,je)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",yC,[Ee[18]||(Ee[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(_e),"model-value":t.unref(Le)(_e)?"false":t.unref(Fe)(_e),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":je=>je&&t.unref(ae)(H,mt,je)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",gC,[Ee[19]||(Ee[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(_e),"model-value":t.unref(Le)(_e)?"false":t.unref(q)(_e),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":je=>je&&t.unref(W)(H,mt,je)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(l).has(H.modelId),"em-aw__open":ft(H.modelId)})},[t.createElementVNode("td",bv,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ft(H.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ft(H.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:_e=>nt(H.modelId),onKeydown:[t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(_e=>nt(H.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,_v)]),t.createElementVNode("td",{title:t.unref(_)(H)?t.unref(E)(H):t.unref(m)(H)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-name-${H.modelId}`,width:"100%",disabled:t.unref(_)(H),placeholder:t.unref(f)(H),"model-value":t.unref(p)(H),"onUpdate:modelValue":_e=>t.unref(h)(H,_e)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,kv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSSelect),{name:`aw-type-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!H.groupCode||H.attrType==="RELATION_REF"||t.unref(V)(H),items:t.unref(Sc)(H.type,t.unref(P),t.unref(Y)),"value-provider":t.unref(D),"label-provider":t.unref(C),"model-value":H.type,"onUpdate:modelValue":_e=>t.unref(R)(H,_e)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),H.type===t.unref(_n)&&!t.unref(V)(H)?(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:0,name:`aw-customtype-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":H.customType??"","onUpdate:modelValue":_e=>t.unref($)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,Ev),t.createElementVNode("td",null,[H.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Qt,{key:0,name:`aw-logical-${H.modelId}`,languages:t.unref(o).languages.value,"active-lang":J.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(It=H.dbAttrs[0])==null?void 0:It.logicalName,"onUpdate:modelValue":_e=>t.unref(B)(H,_e)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",Nv,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-col-${H.modelId}`,width:"100%",placeholder:t.unref(T)(H)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(r)||t.unref(A)(H),"model-value":((Rt=H.dbAttrs[0])==null?void 0:Rt.physicalName)??"","onUpdate:modelValue":_e=>t.unref(w)(H,{physicalName:_e})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":(ot=H.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(r)?t.unref(o).t("em.attr.serializedNoColumnNote"):t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSSelect),{name:`aw-dtype-${H.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(r)||t.unref(A)(H)||t.unref(V)(H),items:t.unref(wc)(((We=H.dbAttrs[0])==null?void 0:We.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(Yr),"model-value":((Ze=H.dbAttrs[0])==null?void 0:Ze.dataType)??"","onUpdate:modelValue":_e=>_e&&t.unref(w)(H,{dataType:_e})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,wv),t.createElementVNode("td",{title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(oe.BSNumberInput),{name:`aw-len-${H.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(A)(H)||t.unref(V)(H),"model-value":(Q=H.dbAttrs[0])==null?void 0:Q.length,"onUpdate:modelValue":_e=>t.unref(w)(H,{length:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,Iv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(V)(H)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",Cv,[t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-pk-${H.modelId}`,label:"PK","model-value":H.identifier,disabled:t.unref(a)||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(k)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nn-${H.modelId}`,label:"NN","model-value":t.unref(r)?!1:H.notNull,disabled:t.unref(r)||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(u)(H,{notNull:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-uq-${H.modelId}`,label:"UQ","model-value":!!((Mt=H.dbAttrs[0])!=null&&Mt.unique),disabled:t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(w)(H,{unique:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,vv),t.createElementVNode("td",{class:"c-del",title:t.unref(N)(H)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:_e=>t.unref(o).removeAttribute(t.unref(i).modelId,H.modelId)},null,8,["onClick"])],8,Sv)],2),t.unref(m)(H)?(t.openBlock(),t.createElementBlock("tr",xv,[Ee[8]||(Ee[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",Rv,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(oe.BSTextInput),{name:`aw-assocname-${H.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(g)(H),"onUpdate:modelValue":_e=>t.unref(b)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,Av)])):t.createCommentVNode("",!0),ft(H.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(l).has(H.modelId)}])},[Ee[14]||(Ee[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",$v,[t.createElementVNode("div",Tv,[t.createElementVNode("fieldset",Mv,[Ee[12]||(Ee[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(H)},[Ee[9]||(Ee[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(oe.BSNumberInput),{name:`aw-scale-${H.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(A)(H)||t.unref(V)(H)||!t.unref(I)(H),"model-value":(Vt=H.dbAttrs[0])==null?void 0:Vt.scale,"onUpdate:modelValue":_e=>t.unref(w)(H,{scale:_e||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,Vv),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-ai-${H.modelId}`,label:"Auto Increment","model-value":!!((Mn=H.dbAttrs[0])!=null&&Mn.autoIncrement),disabled:t.unref(A)(H)||t.unref(V)(H)||!H.identifier,"onUpdate:modelValue":_e=>t.unref(w)(H,{autoIncrement:_e})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",Bv,[Ee[10]||(Ee[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{name:`aw-ins-${H.modelId}`,width:"110px",disabled:t.unref(A)(H),"model-value":t.unref(Fe)(H.dbAttrs[0]),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":_e=>_e&&t.unref(Se)(H,_e)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Dv,[Ee[11]||(Ee[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{name:`aw-upd-${H.modelId}`,width:"110px",disabled:t.unref(A)(H),"model-value":t.unref(q)(H.dbAttrs[0]),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":_e=>_e&&t.unref(Ce)(H,_e)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",Ov,[Ee[13]||(Ee[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-tr-${H.modelId}`,label:"@Transient","model-value":!!H.transient,disabled:H.identifier||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(S)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-nid-${H.modelId}`,label:"@NaturalId","model-value":!!H.naturalId,disabled:H.identifier||t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(y)(H,_e)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${H.modelId}`,label:"mutable","model-value":!!H.naturalIdMutable,disabled:t.unref(A)(H)||!H.naturalId,"onUpdate:modelValue":_e=>t.unref(u)(H,{naturalIdMutable:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`aw-mv-${H.modelId}`,label:"Multi-Value (Set)","model-value":!!((an=H.dbAttrs[0])!=null&&an.multiValue),disabled:t.unref(A)(H)||t.unref(V)(H),"onUpdate:modelValue":_e=>t.unref(w)(H,{multiValue:_e||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(V)(H)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",Lv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",Pv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"150px","model-value":t.unref(M)(H),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":_e=>_e&&t.unref(x)(H,_e)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ie).length?(t.openBlock(),t.createElementBlock("label",zv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(up,{"model-value":H.groupCode,items:t.unref(ie),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":_e=>t.unref(He)(H,_e)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",Fv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(fe)(H).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"150px","model-value":H.defaultValue??"none",items:t.unref(pe)(H),"value-provider":t.unref(ge),"label-provider":t.unref(Te),"onUpdate:modelValue":_e=>_e&&t.unref(De)(H,_e)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`aw-default-${H.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":H.defaultValue??"","onUpdate:modelValue":_e=>t.unref(Z)(H,_e)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",Uv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`aw-desc-${H.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":H.description,"onUpdate:modelValue":_e=>t.unref(re)(H,_e)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",bC,[t.createElementVNode("td",_C,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,rv)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2bbe40a8"]]);function Ts(e,n){return n&&n!==e?`${e} (${n})`:e}function pp(e,n,o){const i=e.dbAttrs[n];return i?ci(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function NC(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):Ts(o,pp(e,0,n))}function Ms(e,n){var l;if(Xn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?Ts(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return Ts(i,pp(o,r<0?0:r,n))}function hp(e){const n=[];for(const o of e.entity.attributes??[]){const i=o.dbAttrs.filter(a=>!a.sharedColumnRef);if(i.length!==0){if(o.dbAttrs.length===1){n.push({ref:o.modelId,label:NC(o,e)});continue}for(const a of i)n.push({ref:a.modelId,label:Ms(a.modelId,e)})}}return n}const wC=["disabled"],IC={class:"em-idxw__list"},vC={class:"em-idxw__list-head"},CC=["aria-label"],SC=["aria-current","onClick","onKeydown"],xC={class:"em-idxw__item-name"},RC={key:0,class:"em-idxw__badge"},AC={class:"em-idxw__item-cnt"},$C={key:0,class:"em-idxw__empty"},TC={key:0,class:"em-idxw__edit"},MC={class:"em-idxw__form"},VC={class:"em-field em-idxw__name"},BC={class:"em-field"},DC=["value","placeholder"],OC={class:"em-idxw__transfer"},LC={class:"em-idxw__pane"},PC={class:"em-idxw__pane-head"},zC=["aria-label"],FC=["aria-pressed","onClick","onKeydown"],UC=["title"],HC={key:0,class:"em-idxw__empty"},jC={class:"em-idxw__arrows"},KC={class:"em-idxw__pane"},GC={class:"em-idxw__pane-head"},YC={class:"em-idxw__col-name"},qC=["title"],WC={class:"em-idxw__col-ops"},JC=["title","disabled","onClick"],XC=["title","disabled","onClick"],ZC=["title","onClick"],QC={key:0,class:"em-idxw__empty"},eS={key:1,class:"em-idxw__edit em-idxw__edit--empty"},tS=Qe(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find($=>$.modelId===n.entityId)??null),a=t.computed(()=>{var $;return(($=i.value)==null?void 0:$.indexes)??[]}),r=t.computed(()=>{var $;return(($=i.value)==null?void 0:$.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,$=>{var w;$.some(I=>I.modelId===s.value)||(s.value=((w=$[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find($=>$.modelId===s.value)??null),d=t.computed(()=>i.value?si(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Jn(r.value)),m=$=>u.value.canon($),p=t.computed(()=>{var $;return new Set(((($=c.value)==null?void 0:$.columns)??[]).map(w=>m(w.columnRef)))}),f=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function h($){return $.physicalName&&$.physicalName!==$.field?`${$.field} (${$.physicalName})`:$.field}function g($){return Ms($,f.value)}const b=t.computed(()=>[...hp(f.value).filter($=>!p.value.has(m($.ref))).map($=>({ref:$.ref,label:$.label,inherited:!1})),...d.value.filter($=>!p.value.has(m($.modelId))).map($=>({ref:$.modelId,label:h($),inherited:!0}))]),_=t.ref(new Set);t.watch(s,()=>_.value=new Set);function E($){return Xn($)}function N($,w){i.value&&o.updateIndex(i.value.modelId,$,w)}function y(){var w;if(!i.value)return;const $=Pe();o.addIndex(i.value.modelId,{modelId:$,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=$}function k($){i.value&&o.removeIndex(i.value.modelId,$)}function S($){c.value&&N(c.value.modelId,{parameters:$.trim()===""?void 0:$})}function A($){const w=new Set(_.value);w.has($)?w.delete($):w.add($),_.value=w}function V(){const $=c.value;if(!$||!_.value.size)return;const w=[..._.value].map(I=>({columnRef:I,descending:!1}));N($.modelId,{columns:[...$.columns,...w]}),_.value=new Set}function T($){const w=c.value;w&&N(w.modelId,{columns:w.columns.filter((I,v)=>v!==$)})}function D($,w){const I=c.value;I&&N(I.modelId,{columns:I.columns.map((v,B)=>B===$?{...v,descending:w}:v)})}function C($,w){const I=c.value;if(!I)return;const v=$+w;if(v<0||v>=I.columns.length)return;const B=[...I.columns];[B[$],B[v]]=[B[v],B[$]],N(I.modelId,{columns:B}),R(v,w)}async function R($,w){var x,P;await t.nextTick();const I=(x=l.value)==null?void 0:x.querySelectorAll(".em-idxw__col--idx")[$];if(!I)return;const v=Y=>I.querySelector(`[data-move="${Y}"]`),B=v(w<0?"up":"down"),M=v(w<0?"down":"up");(P=B&&!B.disabled?B:M)==null||P.focus()}return($,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",IC,[t.createElementVNode("div",vC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:y},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:v=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(v=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",xC,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",RC,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",AC,t.toDisplayString(I.columns.length),1)],42,SC))),128))],8,CC),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$C,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",TC,[t.createElementVNode("div",MC,[t.createElementVNode("label",VC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=I=>N(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(Io,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=I=>N(c.value.modelId,{unique:I}))},null,8,["model-value"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=I=>k(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",BC,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=I=>S(I.target.value))},null,40,DC)]),t.createElementVNode("div",OC,[t.createElementVNode("div",LC,[t.createElementVNode("div",PC,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:b.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:b.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":_.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":_.value.has(I.ref),onClick:v=>A(I.ref),onKeydown:[t.withKeys(t.withModifiers(v=>A(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>A(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.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,UC)):t.createCommentVNode("",!0)],42,FC))),128))],8,zC),b.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",HC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",jC,[t.createVNode(t.unref(oe.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!_.value.size,onClick:V},null,8,["caption","disabled"])]),t.createElementVNode("div",KC,[t.createElementVNode("div",GC,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(I,v)=>(t.openBlock(),t.createElementBlock("li",{key:v,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",YC,[t.createTextVNode(t.toDisplayString(g(I.columnRef)),1),E(I.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,qC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idxw-desc-${v}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":B=>D(v,B)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",WC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:v===0,onClick:B=>C(v,-1)},"↑",8,JC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:v===c.value.columns.length-1,onClick:B=>C(v,1)},"↓",8,XC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:B=>T(v)},"✕",8,ZC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",QC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",eS,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,wC)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-76dd7610"]]),nS={class:"em-op-src"},oS=["placeholder"],iS={class:"em-op-src__actions"},yp=Qe(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(l,s)=>en(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(oe.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",nS,[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,oS),[[t.vModelText,a.value]]),t.createElementVNode("div",iS,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(oe.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"]]),aS=["disabled"],rS={class:"em-ow__toolbar"},lS={class:"em-ow__count"},sS={class:"em-ow__scroll"},cS={class:"em-ow__table"},dS={class:"c-name"},uS={class:"c-desc"},mS=["id"],fS={class:"c-pii"},pS={class:"c-src"},hS={class:"c-del"},yS={key:0},gS={colspan:"6",class:"em-ow__empty"},bS=Qe(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=oe.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((_,E)=>_.order-E.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(b){return b==="none"?o.t("em.common.noneParen"):b}const u=b=>b;function m(b,_){a.value&&o.updateOperation(a.value.modelId,b.modelId,_)}function p(b,_){m(b,{description:Object.keys(_).length?_:void 0})}function f(b){return b.personalInfoAttributeType??"none"}function h(b,_){m(b,{personalInfoAttributeType:_==="none"?void 0:_})}function g(b){i.openModal({component:yp,bind:{operationName:b.name,sourceCode:b.sourceCode??"",locale:o.uiLocale.value,onSave:_=>m(b,{sourceCode:_})}})}return(b,_)=>{var E,N;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",rS,[t.createElementVNode("span",lS,t.toDisplayString(t.unref(o).t("em.op.section",{n:((E=a.value.operations)==null?void 0:E.length)??0})),1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:_[0]||(_[0]=y=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",sS,[t.createElementVNode("table",cS,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",dS,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),_[2]||(_[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",uS,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,mS),t.createVNode(mp,{modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=y=>l.value=y),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",fS,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",pS,t.toDisplayString(t.unref(o).t("em.op.body")),1),_[3]||(_[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,y=>(t.openBlock(),t.createElementBlock("tr",{key:y.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSTextInput),{name:`ow-name-${y.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":y.name,"onUpdate:modelValue":k=>m(y,{name:k})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":y.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":k=>k&&m(y,{visibility:k})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Qt,{name:`ow-desc-${y.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":y.description,"onUpdate:modelValue":k=>p(y,k)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":f(y),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":k=>k&&h(y,k)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t(y.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:k=>g(y)},null,8,["caption","onClick"])]),t.createElementVNode("td",hS,[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:k=>t.unref(o).removeOperation(a.value.modelId,y.modelId)},null,8,["onClick"])])]))),128)),(N=a.value.operations)!=null&&N.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",yS,[t.createElementVNode("td",gS,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,aS)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),_S={class:"em-detail__tabs"},kS=["onClick"],ES={key:0,class:"em-detail__lock"},NS=["disabled"],wS={key:0,class:"em-detail__narrow"},IS=Qe(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=oe.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",_S,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,kS)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",ES,[t.createVNode(Ve,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",wS,[t.createVNode(ip,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(EC,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(tS,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(bS,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,NS)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function hr(e,n,o){e.openModal({component:IS,bind:{controller:t.markRaw(n),entityId:o}})}function xn(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>Kd(e,r))}function tn(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of wu(l,r))i.push($a(a,s.indexRef,{columns:s.columns}))}return i}function yr(e,n,o,i){var c;const a=[];a.push(...xn(n,o.remove,i));for(const d of o.update)a.push(qt(n,d.attributeId,d.patch));for(const d of o.add)a.push(Yt(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const p=l.filter(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,h)=>f.order-h.order)[0];p&&a.push(Wt(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function ei(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Ui(e,n,o){const i=[];for(const[a,r]of sl(e,n,Pe))i.push(...yr(e,a,r,o));for(const a of Iu(e,n,Pe))i.push(qt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function vS(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=wl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return vu(e,n,r).map(l=>qt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function gp(e,n,o){return Cu(e,n,o).map(i=>qt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function CS(e,n,o){const i=new Set(o.remove);return ei(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 gr(e,n,o){const i=[];for(const{entityId:a,plan:r}of od(e,n,Pe))i.push(...yr(e,a,r,o));return i}function bp(e,n,o=new Set){var r,l;if(!hn(n))return[];const i=[];for(const s of e.attributes){if(o.has(s.modelId))continue;const c={};s.dbAttrs.length>0&&(c.dbAttrs=[]),s.notNull&&(c.notNull=!1),Object.keys(c).length>0&&i.push(qt(e.modelId,s.modelId,c))}const a={};return(r=e.table)!=null&&r.physicalName&&(a.table=null),(l=e.indexes)!=null&&l.length&&(a.indexes=[]),e.schema&&(a.schema=null),e.jpaAttrs&&(a.jpaAttrs=null),Object.keys(a).length>0&&i.push(Ml(e.modelId,a)),i}function _p(e){return gn(e).map(n=>({...n.col,modelId:Pe()}))}function SS(e,n){var u;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=jt(o.attributes),p=new Set(o.attributes.map(h=>h.name));let f="id";for(let h=2;p.has(f);h++)f=`id${h}`;a={modelId:Pe(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Pe(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(Yt(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(_=>_.modelId===p.embedded.associationRef);if(!f)continue;const h=f.end1.entityRef===m.modelId,g=h?f.end1:f.end2,b=h?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.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 p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=pi(l,n,Pe);for(const m of r){const p=s.add.find(f=>{var h;return((h=f.derivedFrom)==null?void 0:h.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...xn(m.ownerId,[m.dispId],c)),i.push(Aa(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...yr(l,n,s,c));const d=CS(l,n,s);return i.push(...Ui(d,n,c)),i.push(...tn(e,c)),i}function xS(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(N=>N.modelId===c);if(!d||d.attributes.some(N=>{var y;return((y=N.embedded)==null?void 0:y.associationRef)===r.modelId}))continue;const u=Pe(),m=jt(d.attributes),p=new Set(d.attributes.map(N=>N.name)),f=a(o.name);let h=f;for(let N=2;p.has(h);N++)h=`${f}${N}`;const g=o.attributes.filter(N=>!N.identifier&&!N.derivedFrom).flatMap(N=>N.dbAttrs).map(N=>({...N,modelId:Pe()})),b={modelId:u,name:h,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Yt(c,b));const _=l?"end2":"end1",E=l?"end1":"end2";i.push(Aa(r.modelId,{identifying:!1,[_]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function kp(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[Fd(n,o),...i.map(u=>Fo(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(ou(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(Ei(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function RS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Pe(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},p={...n.logical,associations:[...n.logical.associations,m]},f=pi(p,s,Pe),h=f.add[0];h&&(m.end2.attributeRef=h.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(h==null?void 0:h.modelId)??d},b=Ra(m,g),_=yr(p,s,f,[]);return i(_.length?rt("관계 추가",[b,..._]):b),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(S=>S.modelId===l),d=n.logical.entities.find(S=>S.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Pe(),m=Pe(),p=Pe(),f=jt(c.attributes),h=_p(d),g=S=>S&&S.charAt(0).toLowerCase()+S.slice(1),b=new Set(c.attributes.map(S=>S.name)),_=g(d.name);let E=_;for(let S=2;b.has(E);S++)E=`${_}${S}`;const N={modelId:m,name:E,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:h,embedded:{associationRef:u,embeddableRef:s}},y={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},k={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(rt("임베드 추가",[Yt(l,N),Ra(y,k)])),u},setEmbedCardinality(l,s){var _;if(r(l))return;const c=n.logical.associations.find(E=>E.modelId===l);if(!c)return;let d,u;for(const E of n.logical.entities){const N=E.attributes.find(y=>{var k;return((k=y.embedded)==null?void 0:k.associationRef)===l&&y.attrType==="EMBED_OWN"});if(N){d=E.modelId,u=N;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const h=E=>E==="ZERO_OR_MORE_INSTANCES"||E==="ONE_OR_MORE_INSTANCES",g=h(f.multiplicity),b=h(s);if(g===b){i(Wt(l,p,{multiplicity:s}));return}if(b)i(rt("임베드 컬렉션 전환",[qt(d,u.modelId,{dbAttrs:[]}),Wt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((_=f.jpa)==null?void 0:_.collectionType)??"LIST"}})]));else{const E=n.logical.entities.find(N=>N.modelId===m);if(!E)return;i(rt("임베드 단일 전환",[qt(d,u.modelId,{dbAttrs:_p(E)}),Wt(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=Zd(l);if(!s){i(c);return}for(const f of n.logical.entities){const h=f.attributes.find(g=>{var b;return((b=g.embedded)==null?void 0:b.associationRef)===l});if(h){const g=[];i(rt("임베드 삭제",[c,...xn(f.modelId,[h.modelId],g),...tn(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=gr(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),h=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");h&&p.push(...xn(f.modelId,[h.modelId],m))}p.push(...tn(n.logical,m)),i(p.length?rt("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(h=>h.modelId===l),d=Aa(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(h=>h.modelId===l?{...h,identifying:s}:h)},p=[],f=gr(m,[u],p);f.push(...tn(n.logical,p)),i(f.length?rt("식별 관계 변경",[d,...f]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=ca(d.end2.multiplicity),h=d.end1.navFieldNameHint||ua(m.name,f),g=to(h,new Set(u.attributes.map(N=>N.name))),b=Pe(),_=jt(u.attributes),E={modelId:b,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:_,dbAttrs:[]};i(rt("inverse nav 추가",[Yt(d.end1.entityRef,E),Wt(l,"end1",{...c,attributeRef:b,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,h=u.attributes.find(E=>E.modelId===f&&E.attrType==="RELATION_REF"),g=Wt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(h==null?void 0:h.name)??d.end1.navFieldNameHint}),b=[],_=h?xn(d.end1.entityRef,[f],b):[];i(h?rt("inverse nav 제거",[..._,g,...tn(n.logical,b)]):g);return}}}i(Wt(l,s,c))}}}function AS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=qt(u,m,p),h=ei(n.logical,u,_=>_.map(E=>E.modelId===m?{...E,...p}:E)),g=[],b=Ui(h,u,g);b.push(...tn(n.logical,g)),i(b.length?rt("속성 수정",[f,...b]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(E=>E.type===m),f=n.logical.entities.find(E=>E.modelId===u);if(!p||!f)return null;const h=jt(f.attributes),g=Pe(),b=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),_={modelId:g,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:h,dbAttrs:b};return i(Yt(u,_)),g},addSerializedTypeAttribute(u,m){if(!o.value||a(u))return null;const p=n.logical.entities.find(_=>_.modelId===u),f=n.logical.entities.find(_=>_.modelId===m);if(!p||!f||!hn(f.stereotype)||!f.name)return null;const h=f.name.charAt(0).toLowerCase()+f.name.slice(1),g=to(h,new Set(p.attributes.map(_=>_.name))),b=Pe();return i(Yt(u,{modelId:b,name:g,type:f.name,attrType:"NORMAL",identifier:!1,notNull:!1,order:jt(p.attributes),dbAttrs:[{modelId:Pe(),physicalName:g,dataType:"CLOB"}]})),b},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(k=>k.modelId===u),f=p?jt(p.attributes):0,h=m.modelId??Pe(),g=m.name??`field${f}`,b={modelId:h,name:g,type:m.type??Wr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??(p&&hn(p.stereotype)?[]:[{modelId:Pe(),physicalName:g,dataType:"VARCHAR"}]),...m},_=Yt(u,b),E=ei(n.logical,u,k=>[...k,b]),N=[],y=Ui(E,u,N);return y.push(...tn(n.logical,N)),i(y.length?rt("속성 추가",[_,...y]):_),h},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),p=m?jt(m.attributes):0,f=Pe();return i(Yt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?eo:Wr})},setEmbedColumns(u,m,p){var E,N;if(a(u))return;const f=qt(u,m,{dbAttrs:p}),h=(E=n.logical.entities.find(y=>y.modelId===u))==null?void 0:E.attributes.find(y=>y.modelId===m),g=(N=h==null?void 0:h.embedded)==null?void 0:N.associationRef,b=g?n.logical.associations.find(y=>y.modelId===g):void 0,_=[];b&&g&&(b.end1.legacyEmbedRaw&&_.push(Wt(g,"end1",{legacyEmbedRaw:void 0})),b.end2.legacyEmbedRaw&&_.push(Wt(g,"end2",{legacyEmbedRaw:void 0}))),i(_.length?rt("임베드 컬럼 수정",[f,..._]):f)},removeAttribute(u,m){if(a(u))return;if(Lo(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=xn(u,[m],p),h=ei(n.logical,u,_=>_.filter(E=>E.modelId!==m)),g=[...Ui(h,u,p),...tn(n.logical,p),...gp(n.logical,u,[m])],b=[...f,...g];i(b.length===1?b[0]:rt("속성 삭제",b))},removeAttributes(u,m){var E;if(!m.length||a(u))return;const p=m.filter(N=>!Lo(n.logical,u,N));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],h=xn(u,p,f),g=new Set(p),b=ei(n.logical,u,N=>N.filter(y=>!g.has(y.modelId))),_=[...h,...Ui(b,u,f),...tn(n.logical,f),...gp(n.logical,u,p)];i(_.length===1?_[0]:rt("속성 삭제",_)),((E=c.value)==null?void 0:E.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(Ca(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(Ca(u,m[0],p)):i(rt("속성 색상",m.map(f=>Ca(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=Bl(u,m,p),h=vS(n.logical,u,m,p);i(h.length?rt("속성 재정렬",[f,...h]):f)}}}function $S(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Pe(),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=Pe();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Pe()}for(const a of n.indexes??[]){a.modelId=Pe();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Pe();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const TS=220;function MS(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||TS));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 Vs=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function VS(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(b=>n.logical.entities.some(_=>_.modelId===b));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(_=>_.modelId===d.entityId);if(!g)return;const b=[...g.attributes].sort((_,E)=>_.order-E.order).filter(_=>d.ids.includes(_.modelId));if(!b.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:b}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),p=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let h;if(p){const{entityRef:g,geo:b,locked:_,...E}=p;Object.keys(E).length&&(h=E)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,layoutExtras:h}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const f=a.value;if(!f)return[];const h=n.logical.entities.find(y=>y.modelId===f);if(!h)return[];const g=new Set(h.attributes.map(y=>y.name)),b=new Set(h.attributes.flatMap(y=>y.dbAttrs.map(k=>k.physicalName))),_=jt(h.attributes),E=[],N=c.attributes.map((y,k)=>{const S=JSON.parse(JSON.stringify(y));S.modelId=Pe();for(const A of S.dbAttrs)A.modelId=Pe();g.has(S.name)&&(S.name=to(`${S.name}_copy`,g)),g.add(S.name);for(const A of S.dbAttrs)A.physicalName&&b.has(A.physicalName)&&(A.physicalName=to(`${A.physicalName}_copy`,b)),A.physicalName&&b.add(A.physicalName);return S.order=_+k,E.push(S.modelId),Yt(f,S)});return l(N.length===1?N[0]:rt("속성 붙여넣기",N)),i.value={kind:"attribute",entityId:f,ids:E,anchor:E[E.length-1]},[]}const{clone:d,idMap:u}=$S(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},h=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=Na(f.attributeStyles,h)),f.operationStyles&&(f.operationStyles=Na(f.operationStyles,h)),p=f}return l(va(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Id(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?MS(n.layout,m.layout):p.offset,h=new Map(m.layout.entityLayouts.map(N=>[N.entityRef,N])),g=new Map(m.layout.associationLayouts.map(N=>[N.associationRef,N])),b=new Map(m.layout.groupLayouts.map(N=>[N.groupRef,N])),_=[];let E=80;for(const N of m.logical.entities){const y=h.get(N.modelId),k=y?{location:Vs(y.geo.location,f),size:{...y.geo.size}}:{location:{x:E+=40,y:80},size:{width:220,height:140}};let S;if(y){const{entityRef:A,geo:V,locked:T,...D}=y;S=D}_.push(va(N,k,S))}for(const N of m.logical.associations){const y=g.get(N.modelId),k=y?{...y,waypoints:y.waypoints.map(S=>Vs(S,f))}:{associationRef:N.modelId,waypoints:[]};_.push(Ra(N,k))}for(const N of m.logical.groups){const y=b.get(N.modelId),k=y?{location:Vs(y.geo.location,f),size:{...y.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let S;if(y){const{groupRef:A,geo:V,locked:T,memberNoteRefs:D,...C}=y;S=C}_.push(Sa(N,k,S))}return l(rt("다이어그램 가져오기",_)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(N=>N.modelId)}};return s}function BS(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l,t:s,emitGateNotice:c}=e;return{addEntity(d="NewEntity",u={x:80,y:80}){if(!o.value)return null;const m=Pe(),p={modelId:m,name:d,stereotype:"JPA_ENTITY",table:{physicalName:d.toLowerCase()},attributes:[{modelId:Pe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Pe(),physicalName:"id",dataType:"BIGINT"}]}]};return i(va(p,{location:{...u},size:{width:220,height:140}})),m},renameEntity(d,u){a(d)||i(Md(d,u))},updateEntity(d,u){if(a(d))return;const m=Ml(d,u),p=n.logical.entities.find(E=>E.modelId===d),f=p==null?void 0:p.stereotype,h=u.stereotype,g=!!h&&!!p&&!!f&&_t(h)&&!_t(f),b=!!h&&!!p&&!!f&&!_t(h)&&_t(f);if(!!h&&!!p&&!!f&&h!==f&&_t(h)&&_t(f)&&p){const E=n.logical.entities.filter(y=>y.attributes.some(k=>{var S;return((S=k.embedded)==null?void 0:S.embeddableRef)===d}));if(E.length>0){c(s("em.entity.valueTypeSwitchEmbedded",{name:p.name,owners:E.length}));return}const N=bp(p,h);i(N.length?rt("직렬화 타입 변환",[m,...N]):m);return}if(h==="SERIALIZED_TYPE"&&p){const E=n.logical.associations.filter(N=>N.end1.entityRef===d||N.end2.entityRef===d);if(E.length>0){c(s("em.entity.serializedTypeHasRelations",{name:p.name,count:E.length}));return}}if(g&&p&&h){const E=p.attributes.filter(T=>T.identifier&&!T.derivedFrom).map(T=>qt(d,T.modelId,{identifier:!1})),N=ei({...n.logical,entities:n.logical.entities.map(T=>T.modelId===d?{...T,stereotype:h}:T)},d,T=>T.map(D=>D.identifier&&!D.derivedFrom?{...D,identifier:!1}:D)),y=[],k=gr(N,[d],y);k.push(...tn(n.logical,y));const S=h==="JPA_EMBEDDABLE"?xS(n.logical,d):[],A=bp(p,h,new Set(y.filter(T=>T.entityId===d).map(T=>T.attributeId))),V=[m,...E,...k,...S,...A];i(V.length>1?rt(h==="SERIALIZED_TYPE"?"직렬화 타입 변환":"임베더블 변환",V):m);return}if(b){const E=SS(n.logical,d),N=[m,...E];i(N.length>1?rt("엔터티 전환",N):m);return}i(m)},moveEntity(d,u){a(d)||i(Fo(d,u))},resizeEntity(d,u){a(d)||i(Vd(d,u))},removeEntity(d){if(a(d))return;const u=Td(d);if(!n.logical.entities.find(E=>E.modelId===d)){i(u);return}const p=n.logical.associations.filter(E=>E.end1.entityRef===d||E.end2.entityRef===d),f=new Set(p.map(E=>E.modelId)),h=[],g=[];for(const E of n.logical.entities)if(E.modelId!==d)for(const N of E.attributes)N.embedded&&f.has(N.embedded.associationRef)&&h.push(...xn(E.modelId,[N.modelId],g));for(const E of p){if(E.end1.entityRef===d||!E.end1.attributeRef)continue;const N=n.logical.entities.find(k=>k.modelId===E.end1.entityRef),y=N==null?void 0:N.attributes.find(k=>k.modelId===E.end1.attributeRef&&k.attrType==="RELATION_REF");y&&h.push(...xn(N.modelId,[y.modelId],g))}const b={...n.logical,entities:n.logical.entities.filter(E=>E.modelId!==d),associations:n.logical.associations.filter(E=>!f.has(E.modelId))},_=new Set(p.filter(E=>E.end1.entityRef===d&&E.end2.entityRef!==d).map(E=>E.end2.entityRef));h.push(...gr(b,[..._],g)),h.push(...tn(n.logical,g.filter(E=>E.entityId!==d))),i(h.length?rt("엔티티 삭제",[u,...h]):u)},setEntitySwatch(d,u){i(Bd(d,u))},setEntityCollapsed(d,u){i(Dd(d,u))},setEntityLocked(d,u){i(Od(d,u))},isEntityLocked(d){return r(d)},isAssociationLocked(d){return l(d)},collapseAll(){i(Vl(!0))},expandAll(){i(Vl(!1))}}}function DS(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(_=>n.layout.entityLayouts.find(E=>E.entityRef===_)).filter(_=>!!_);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,h=-1/0;for(const _ of u){const E=_.geo.size.width||220,N=_.geo.size.height||140;m=Math.min(m,_.geo.location.x),p=Math.min(p,_.geo.location.y),f=Math.max(f,_.geo.location.x+E),h=Math.max(h,_.geo.location.y+N)}const g=40,b=28;return{location:{x:m-g,y:p-g-b},size:{width:f-m+g*2,height:h-p+g*2+b}}}return{dragGroup(d,u,m){l(d)||i(rt("그룹 이동",kp(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Ud(d,u))},setGroupSwatch(d,u){i(Hd(d,u))},setGroupLocked(d,u){i(jd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(Ld(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const h of n.logical.groups)for(const g of d)h.memberEntityRefs.includes(g)&&m.push(xa(h.modelId,g));const p=Pe(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(Sa(f,c(d))),i(rt("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Pe();return i(Sa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(Pd(d))},dropEntity(d,u,m){var h;if(r(d))return;const p=((h=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:h.modelId)??null,f=[Fo(d,u)];p!==m&&(p&&f.push(xa(p,d)),m&&f.push(zd(m,d))),i(rt("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(xa(u.modelId,d))},dropNote(d,u,m){var h;const p=((h=n.layout.groupLayouts.find(g=>{var b;return(b=g.memberNoteRefs)==null?void 0:b.includes(d)}))==null?void 0:h.groupRef)??null,f=[Ei(d,u)];p!==m&&(p&&f.push(mu(p,d)),m&&f.push(uu(m,d))),i(rt("이동",f))}}}function OS(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(g,b){if(d(),!o.value||!e.opTransport)return;const _=new ku({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:E=>{i.value=!1,a.value=E},onError:e.onOpError});_.seed((b==null?void 0:b.revSeed)??{}),c=_.attach(g),s=_}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function h(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let b;try{b=await l(g)}catch(_){return{ok:!1,reason:_ instanceof Error?_.message:String(_)}}return b.ok&&p.value++,b}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:f,restoreToSeq:h,reloadRequest:p}}function LS(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Pe();return o(ru({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(lu(i))},moveNote(i,a){o(Ei(i,a))},resizeNote(i,a){o(su(i,a))},setNoteMemo(i,a){o(cu(i,a))},setNoteSwatch(i,a){o(du(i,a))},addNoteConnection(i,a){o(fu(i,a))},removeNoteConnection(i,a){o(pu(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(hu(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(yu(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(gu(i,a,r))},clearNoteConnectionWaypoints(i,a){o(bu(i,a))}}}function PS(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const y=p.ids.includes(u),k=y?p.ids.filter(A=>A!==u):[...p.ids,u];if(!k.length){o.value=null;return}const S=y&&p.anchor===u?k[k.length-1]:y?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:k,anchor:S};return}const h=n.logical.entities.find(y=>y.modelId===d),g=[...(h==null?void 0:h.attributes)??[]].sort((y,k)=>y.order-k.order).map(y=>y.modelId),b=g.indexOf(p.anchor),_=g.indexOf(u);if(b<0||_<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[E,N]=b<=_?[b,_]:[_,b];o.value={kind:"attribute",entityId:d,ids:g.slice(E,N+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(g=>g.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const h=m.attributes[f].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[h],anchor:h},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(y=>y.modelId===u.entityId);if(!m)return!1;const p=m.attributes,f=new Set(u.ids),h=p.map((y,k)=>f.has(y.modelId)?k:-1).filter(y=>y>=0);if(!h.length)return!1;const g=Math.min(...h),b=p.filter(y=>!f.has(y.modelId)),_=p.slice(0,g).filter(y=>!f.has(y.modelId)).length;let E;if(d<0){if(_<=0)return!0;E=_-1}else{if(b.length-_<=0)return!0;E=_+1}if(r(u.entityId))return!0;const N=p.filter(y=>f.has(y.modelId)).map(y=>y.modelId);return a(Bl(u.entityId,N,E)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(E=>E.modelId)),f=new Set(n.logical.groups.map(E=>E.modelId)),h=new Set(n.layout.notes.map(E=>E.modelId)),g=new Set;for(const E of d){if(!f.has(E))continue;const N=n.logical.groups.find(y=>y.modelId===E);for(const y of(N==null?void 0:N.memberEntityRefs)??[])g.add(y)}const b=[],_=[];for(const E of d)if(f.has(E)){if(s(E))continue;const N=n.layout.groupLayouts.find(A=>A.groupRef===E);if(!N)continue;const y=n.logical.groups.find(A=>A.modelId===E),k=((y==null?void 0:y.memberEntityRefs)??[]).map(A=>{var T;const V=((T=n.layout.entityLayouts.find(D=>D.entityRef===A))==null?void 0:T.geo.location)??{x:0,y:0};return{id:A,location:{x:V.x+u,y:V.y+m}}}),S={x:N.geo.location.x+u,y:N.geo.location.y+m};b.push(rt("그룹 이동",kp(n,E,S,k))),_.push("g:"+E)}else if(p.has(E)){if(g.has(E)||l(E))continue;const N=n.layout.entityLayouts.find(y=>y.entityRef===E);if(!N)continue;b.push(Fo(E,{x:N.geo.location.x+u,y:N.geo.location.y+m})),_.push("e:"+E)}else if(h.has(E)){const N=n.layout.notes.find(y=>y.modelId===E);if(!N)continue;b.push(Ei(E,{x:N.geo.location.x+u,y:N.geo.location.y+m})),_.push("n:"+E)}return b.length?(a(rt("이동",b,"nudge:"+_.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const Gn=Symbol("editorController");function Ep(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function zS(e=Ep(),n={}){var Se,Ge,et;const o=t.reactive(e);let i=new Tl(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"),u=t.ref(n.uiLocale??"ko"),m=(te,de)=>en(u.value,te,de),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),h=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),b=t.ref(!1),_=t.ref(!1),E=t.ref(!1),N=t.ref(0),y=t.ref(null);let k=0;const S=te=>{if(n.onNotice){n.onNotice(te);return}y.value={text:te,id:++k}},A=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),V=t.ref(((Ge=n.meta)==null?void 0:Ge.opWriteEnabled)??!1),T=t.ref(((et=n.meta)==null?void 0:et.referenceOnly)??!1),D=t.computed(()=>A.value>=2&&V.value),C=t.ref(!(A.value>=2&&V.value===!1)),R=t.ref("LOGICAL_PHYSICAL"),$=t.ref("straight"),w=t.ref(!0),I=t.ref(!0),v=t.ref(null),B=t.computed(()=>{var te;return((te=v.value)==null?void 0:te.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),M=t.computed(()=>{var te;return((te=v.value)==null?void 0:te.kind)==="attribute"?v.value.ids:[]}),x=t.computed(()=>{var te,de;return((te=v.value)==null?void 0:te.kind)==="entity"?v.value.id:((de=v.value)==null?void 0:de.kind)==="attribute"?v.value.entityId:null}),P=t.ref(null),Y=t.ref(null),se=t.ref(null),he=t.ref(null),ie=OS({state:o,opMode:D,editable:C,opConflict:se,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function fe(){i.onChange(()=>{b.value=i.canUndo,_.value=i.canRedo,E.value=i.isDirty,N.value++})}fe(),ie.setupOpAdapter(i,n.meta);const pe=t.computed(()=>mc(o.logical,o.layout)),ge=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:h.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Te=()=>Zr(o.logical,T.value),He=n.validationDebounceMs??250;let De,Z=()=>{};if(He>0){const te=t.shallowRef(ga(Te(),ge.value));let de;Z=()=>{de!==void 0&&(clearTimeout(de),de=void 0),te.value=ga(Te(),ge.value)},t.watch([N,ge,T],()=>{de!==void 0&&clearTimeout(de),de=setTimeout(Z,He)},{flush:"sync"}),De=t.computed(()=>te.value)}else De=t.computed(()=>ga(Te(),ge.value));const re=t.computed(()=>{const te=new Map;for(const de of De.value){if(!de.targetRef)continue;const Le=te.get(de.targetRef);Le?Le.push(de):te.set(de.targetRef,[de])}return te}),ue=1500,z=new Map,L=te=>{const de=Date.now();de-(z.get(te)??0)<ue||(z.set(te,de),S(te))},F=te=>{if(!he.value){if(!C.value){L(m("em.notice.readOnly"));return}try{i.execute(te)}catch(de){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${te.label}):`,de),C.value=!1,he.value={label:te.label}}}},X=te=>o.layout.entityLayouts.some(de=>de.entityRef===te&&!!de.locked),ee=te=>o.layout.groupLayouts.some(de=>de.groupRef===te&&!!de.locked),ke=te=>{const de=o.logical.associations.find(Le=>Le.modelId===te);return!!de&&(X(de.end1.entityRef)||X(de.end2.entityRef))},ye=te=>X(te)?(L(m("em.notice.entityLocked")),!0):!1,Ne=te=>ee(te)?(L(m("em.notice.groupLocked")),!0):!1,we=te=>ke(te)?(L(m("em.notice.assocLocked")),!0):!1,G=VS({state:o,clipboard:Y,selection:v,inspectedEntityId:x,editable:C,run:F}),q=PS({state:o,selection:v,focusRequest:P,run:F,gateEntityLocked:ye,isEntityLockedFn:X,isGroupLockedFn:ee}),W=BS({state:o,editable:C,run:F,gateEntityLocked:ye,isEntityLockedFn:X,isAssocLockedFn:ke,t:m,emitGateNotice:L}),Ce=AS({state:o,editable:C,run:F,gateEntityLocked:ye,embeddableCatalog:a,t:m,emitGateNotice:L,selection:v}),$e=DS({state:o,editable:C,run:F,selection:v,gateEntityLocked:ye,gateGroupLocked:Ne,isGroupLockedFn:ee}),ze=LS({editable:C,run:F}),Fe=RS({state:o,editable:C,run:F,gateEntityLocked:ye,gateAssocLocked:we});return{state:o,resolved:pe,issues:De,issuesByRef:re,flagEntitiesWithoutRelations:g,canUndo:b,canRedo:_,dirty:E,revision:N,notice:y,editable:C,schemaVersion:A,opWriteEnabled:V,opMode:D,opConflict:se,commandFailure:he,historyTransport:ie.historyTransport,historyAvailable:ie.historyAvailable,restoreTransport:ie.restoreTransport,restoreAvailable:ie.restoreAvailable,restoreToSeq:ie.restoreToSeq,reloadRequest:ie.reloadRequest,displayMode:R,routingMode:$,showGrid:w,showMinimap:I,selection:v,selectedAttr:B,selectedAttrIds:M,inspectedEntityId:x,focusRequest:P,clipboard:Y,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:T,uiLocale:u,t:m,selectableDataTypes:f,setEditable(te){C.value=te&&D.value},setEmbeddableCatalog(te){a.value=te},setGroupCodeCatalog(te){r.value=te},setPredefinedCustomTypeCatalog(te){l.value=te},setSuperClassCatalog(te){s.value=te},selectAttribute:q.selectAttribute,moveAttributeFocus:q.moveAttributeFocus,nudgeSelectedAttributes:q.nudgeSelectedAttributes,nudgeNodes:q.nudgeNodes,requestFocus:q.requestFocus,deleteSelection(){if(!C.value)return!1;const te=v.value;if(!te)return!1;if(te.kind==="attribute"){if(ye(te.entityId))return!1;const de=te.ids;if(!de.length)return!1;de.length===1?Ce.removeAttribute(te.entityId,de[0]):Ce.removeAttributes(te.entityId,de)}else if(te.kind==="entity"){if(ye(te.id))return!1;W.removeEntity(te.id)}else if(te.kind==="note")ze.removeNote(te.id);else if(te.kind==="group"){if(Ne(te.id))return!1;$e.removeGroup(te.id)}else Fe.removeAssociation(te.id);return v.value=null,!0},undo:()=>{C.value&&i.undo()},redo:()=>{C.value&&i.redo()},markSaved:()=>{C.value&&(ie.flush(),i.markSavePoint())},loadDiagram(te,de){ie.teardownOpAdapter(),o.logical=te.logical,o.layout=te.layout,i=new Tl(o),fe(),A.value=(de==null?void 0:de.schemaVersion)??1,V.value=(de==null?void 0:de.opWriteEnabled)??!1,T.value=(de==null?void 0:de.referenceOnly)??!1,C.value=!(A.value>=2&&V.value===!1),se.value=null,he.value=null,v.value=null,b.value=i.canUndo,_.value=i.canRedo,E.value=i.isDirty,ie.setupOpAdapter(i,de),Z()},flush:ie.flush,whenOpsSettled:ie.whenOpsSettled,addEntity:W.addEntity,renameEntity:W.renameEntity,updateEntity:W.updateEntity,moveEntity:W.moveEntity,resizeEntity:W.resizeEntity,removeEntity:W.removeEntity,setEntitySwatch:W.setEntitySwatch,setEntityCollapsed:W.setEntityCollapsed,setEntityLocked:W.setEntityLocked,isEntityLocked:W.isEntityLocked,isAssociationLocked:W.isAssociationLocked,collapseAll:W.collapseAll,expandAll:W.expandAll,setAttributeSwatch:Ce.setAttributeSwatch,dragGroup:$e.dragGroup,resizeGroup:$e.resizeGroup,setGroupSwatch:$e.setGroupSwatch,setGroupLocked:$e.setGroupLocked,isGroupLocked:$e.isGroupLocked,updateGroup:$e.updateGroup,createGroup:$e.createGroup,addEmptyGroup:$e.addEmptyGroup,removeGroup:$e.removeGroup,dropEntity:$e.dropEntity,ungroupEntity:$e.ungroupEntity,dropNote:$e.dropNote,addPredefinedEmbed:Ce.addPredefinedEmbed,addSerializedTypeAttribute:Ce.addSerializedTypeAttribute,addAttribute:Ce.addAttribute,addDivider:Ce.addDivider,updateAttribute:Ce.updateAttribute,setAttributeGroupCode:Ce.setAttributeGroupCode,setEmbedColumns:Ce.setEmbedColumns,removeAttribute:Ce.removeAttribute,removeAttributes:Ce.removeAttributes,setAttributeSwatches:Ce.setAttributeSwatches,reorderAttributes:Ce.reorderAttributes,addIndex(te,de){ye(te)||F(Qd(te,de))},updateIndex(te,de,Le){ye(te)||F($a(te,de,Le))},removeIndex(te,de){ye(te)||F(eu(te,de))},addOperation(te,de={}){if(!C.value||ye(te))return null;const Le=o.logical.entities.find(st=>st.modelId===te),dt=Le!=null&&Le.operations?jt(Le.operations):0,Xe=de.modelId??Pe(),yt={modelId:Xe,name:de.name??`method${dt}`,visibility:de.visibility??"PACKAGE",order:dt,...de};return F(Yd(te,yt)),Xe},updateOperation(te,de,Le){ye(te)||F(qd(te,de,Le))},removeOperation(te,de){ye(te)||F(Wd(te,de))},reorderOperations(te,de,Le){!de.length||ye(te)||F(Jd(te,de,Le))},setOperationSwatch(te,de,Le){F(Xd(te,de,Le))},addAssociation:Fe.addAssociation,addEmbedAssociation:Fe.addEmbedAssociation,setEmbedCardinality:Fe.setEmbedCardinality,removeAssociation:Fe.removeAssociation,setAssociationIdentifying:Fe.setAssociationIdentifying,updateAssociationEnd:Fe.updateAssociationEnd,hasQuickFix(te){if(!C.value)return!1;const de=ml(te,o.logical);return de?de.kind==="setEndCascades"?!ke(de.assocRef):!X(de.entityRef):!1},applyQuickFix(te){if(!C.value)return!1;const de=ml(te,o.logical);if(!de)return!1;if(de.kind==="setIndexColumns")return ye(de.entityRef)?!1:(F($a(de.entityRef,de.indexRef,{columns:de.columns})),!0);if(we(de.assocRef))return!1;const Le=o.logical.associations.find(dt=>dt.modelId===de.assocRef);return Le?(F(Wt(de.assocRef,de.which,{jpa:{...Le[de.which].jpa,cascadeTypes:de.cascades}})),!0):!1},moveWaypoint(te,de,Le){F(tu(te,de,Le))},addWaypoint(te,de,Le){F(au(te,de,Le))},removeWaypoint(te,de){F(nu(te,de))},clearWaypoints(te){F(iu(te))},addNote:ze.addNote,removeNote:ze.removeNote,moveNote:ze.moveNote,resizeNote:ze.resizeNote,setNoteMemo:ze.setNoteMemo,setNoteSwatch:ze.setNoteSwatch,addNoteConnection:ze.addNoteConnection,removeNoteConnection:ze.removeNoteConnection,moveNoteConnectionWaypoint:ze.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:ze.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:ze.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:ze.clearNoteConnectionWaypoints,autoLayout(){const te=fc(o.logical,o.layout);te.length&&F(rt("자동 배치",te.map(de=>Fo(de.id,de.location))))},copy:G.copy,paste:G.paste,importEntities:G.importEntities}}const br=Symbol("groupHover"),Np=Symbol("groupDrag"),vo=Symbol("relationHighlight"),wp=Symbol("diffOverlay"),Ip=Symbol("nodeInternals"),vp=Symbol("columnResolution");function FS(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function Cp(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!FS(e[o],n[o]))return!1;return!0}function Sp(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!Cp(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function US(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function HS(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!US(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!Sp(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Cp(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!jS(e.classRows,n.classRows)}function jS(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!Sp(i.attr,a.attr))return!1}return!0}function KS(){let e;return(n,o)=>e=GS(n,o,e)}function GS(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const p=()=>m??(m=$o(Dn(s,i)));for(const E of s.attributes){if(ia(E)){const S=E.dbAttrs[0];if(!(S!=null&&S.physicalName&&(S!=null&&S.dataType))){const A=Zn(E,s,i,e.associations);A&&c.set(E.modelId,{...E,dbAttrs:[{...S,physicalName:(S==null?void 0:S.physicalName)||A.physicalName,dataType:(S==null?void 0:S.dataType)||A.dataType,length:(S==null?void 0:S.length)??A.length,scale:(S==null?void 0:S.scale)??A.scale},...E.dbAttrs.slice(1)]})}}if(E.identifier&&E.attrType==="RELATION_OWN"){const S=Lo(e,s.modelId,E.modelId);if(S&&ka(E,S)){const A=c.get(E.modelId)??E,V=E.derivedIdFieldName||yl({...E,derivedIdFieldName:void 0},S,l());V&&c.set(E.modelId,{...A,derivedIdFieldName:V})}}const N=aa(E,e.associations);if(N&&u.set(E.modelId,N),yn(E)){d.set(E.modelId,E.dbAttrs.map((S,A)=>{const V=Zn(E,s,i,e.associations,A);return V?{...S,physicalName:S.physicalName||V.physicalName,dataType:S.dataType||V.dataType,length:S.length??V.length,scale:S.scale??V.scale}:S}));continue}if(!E.attrType.startsWith("EMBED")||E.dbAttrs.length===0)continue;if(E.attrType!=="EMBED_PREDEF"){const S=p();d.set(E.modelId,E.dbAttrs.map((A,V)=>{const T=Qn(A,S);return T?{...A,physicalName:T.physicalName}:bn(E,A,V,s,e)}));continue}const y=n==null?void 0:n.find(S=>S.type===E.type);if(!y)continue;const k=p();d.set(E.modelId,E.dbAttrs.map((S,A)=>{const V=y.fields[A],T=Qn(S,k);return T?{...S,physicalName:T.physicalName,logicalName:S.logicalName??(V==null?void 0:V.logicalName),dataType:S.dataType||(V==null?void 0:V.dataType)||""}:V?{...S,physicalName:S.physicalName||V.physicalName,logicalName:S.logicalName??V.logicalName,dataType:S.dataType||V.dataType,length:S.length??V.length}:S}))}const f=new Map,h=new Map;for(const E of s.attributes){const N=d.get(E.modelId);if(N)for(let y=0;y<N.length;y++){const k=`${E.attrType}\0${E.type??""}\0${y}`,S={attrId:E.modelId,slot:y,name:N[y].physicalName??""},A=h.get(k);A?A.push(S):h.set(k,[S])}}for(const E of h.values()){if(E.length<2)continue;const N=new Map;for(const y of E)N.set(y.name,(N.get(y.name)??0)+1);for(const y of E){if((N.get(y.name)??0)<2)continue;const k=f.get(y.attrId);k?k.add(y.slot):f.set(y.attrId,new Set([y.slot]))}}const g=gl(s,e).fields.map(E=>{var N;return{attr:E.attr,synthetic:E.synthetic,sourceAttrId:E.sourceAttr.modelId,targetName:(N=E.target)==null?void 0:N.name,collection:E.collection}}),b={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:g},_=o==null?void 0:o.get(s.modelId);a.set(s.modelId,_&&HS(b,_)?_:b)}return a}const xp=Symbol("embedSlotCollapse"),Rp=(e,n)=>`${e}:${n}`,Ap="all:",$p="one:",Tp="fk:",Mp=e=>`${Ap}${e}`,YS=(e,n)=>`${$p}${e}:${n}`,qS=(e,n)=>`${Tp}${e}:${n}`,WS=e=>e.startsWith(Tp)||!e.startsWith(Ap)&&!e.startsWith($p),JS=["title"],XS={key:0,class:"em-sel","aria-hidden":"true"},ZS=["title","aria-expanded","disabled"],QS={class:"em-entity__stereotype"},ex={key:1,class:"em-entity__name"},tx=["title","aria-expanded"],nx={"aria-hidden":"true"},ox=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],ix=["onPointerdown"],ax={key:1,class:"em-entity__divider-label"},rx=["title"],lx={class:"em-key-slot"},sx={class:"em-key-slot"},cx=["title","aria-expanded","onClick"],dx=["title","onClick"],ux=["title","aria-expanded","onClick"],mx={key:2,class:"em-entity__type"},fx=["onClick"],px={class:"em-entity__attrname"},hx={class:"em-entity__type"},yx={key:1,class:"em-entity__embed-summary"},gx=["title"],bx=["data-op"],_x=["onPointerdown"],kx={class:"em-entity__op-vis","aria-hidden":"true"},Ex=["title"],Nx={key:4,class:"em-entity__footer"},Vp=Qe(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=(j,K)=>o?o.t(j,K):en("ko",j,K),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=oe.useModal();function l(){o&&hr(r,o,n.id)}const s=t.inject(br,null),c=t.inject(vo,null),d=t.inject(wp,null),u=t.computed(()=>{var j;return((j=d==null?void 0:d.marks.value)==null?void 0:j.get(n.id))??null}),m=t.inject(vp,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(xp,void 0),h=t.inject(Ip,null);t.onUpdated(()=>h==null?void 0:h.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function b(){s&&(s.value=n.data.groupRef??null)}function _(){c==null||c.setEntityHover(n.id)}function E(){c==null||c.setEntityHover(null)}const N=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),y=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!N.value),k=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}),S=t.computed(()=>!!n.selected&&!k.value),A=t.computed(()=>{var j;return o&&((j=o.selectedAttr.value)==null?void 0:j.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),V=t.computed(()=>A.value.size>0);function T(j,K){const ve=K.shiftKey?"range":K.metaKey||K.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,B(j),ve)}const D=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!k.value),C=t.computed(()=>n.data.entity),R=t.computed(()=>$y(C.value,o==null?void 0:o.referenceOnlyDocument.value)),$=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>{var j;if($.value==="CLASS"){const K=(j=p.value)==null?void 0:j.classRows;if(K)return K.map(ve=>ve.attr)}return[...C.value.attributes].sort((K,ve)=>K.order-ve.order)}),I=t.computed(()=>{var K;const j=$.value==="CLASS"?(K=p.value)==null?void 0:K.classRows:void 0;return new Set((j??[]).filter(ve=>ve.synthetic).map(ve=>ve.attr.modelId))});function v(j){return I.value.has(j.modelId)}function B(j){return P.value.get(j.modelId)??j.modelId}function M(j){return A.value.has(B(j))}function x(j){var K;return!!((K=u.value)!=null&&K.changedAttributeIds.has(B(j)))}const P=t.computed(()=>{var K;const j=new Map;if($.value!=="CLASS")return j;for(const ve of((K=p.value)==null?void 0:K.classRows)??[])ve.synthetic&&j.set(ve.attr.modelId,ve.sourceAttrId);return j}),Y=t.computed(()=>{var ve;const j=new Map,K=$.value==="CLASS";for(const Re of((ve=p.value)==null?void 0:ve.classRows)??[])!K&&!yn(Re.attr)||(Re.targetName||Re.collection)&&j.set(Re.attr.modelId,{targetName:Re.targetName,collection:Re.collection});return j}),se=t.computed(()=>n.data.collapsed??!1),he=t.computed(()=>n.data.locked??!1),ie=t.computed(()=>g.value&&!he.value);function fe(){g.value&&(o==null||o.setEntityCollapsed(n.id,!se.value))}const pe=t.computed(()=>$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL"),ge=t.computed(()=>{var ve;const j=$.value==="PHYSICAL"||$.value==="LOGICAL_PHYSICAL",K={};for(const Re of w.value){const me=Re.attrType.startsWith("RELATION")&&Re.dbAttrs.length>0,Ue=hn(((ve=C.value)==null?void 0:ve.stereotype)??"UNDEFINED");K[Re.modelId]={pk:Re.identifier,fk:me&&j,required:!Ue&&Re.notNull&&!Re.identifier}}return K});function Te(j){if(!j)return"";const K=[];return j.pk&&j.fk?K.push(i("em.node.keyPfk")):j.pk?K.push(i("em.node.keyPk")):j.fk&&K.push(i("em.node.keyFk")),j.required&&K.push(i("em.node.required")),K.join(" · ")}const He=t.computed(()=>{const j=Rs($t(n.data.style)),K={};return j&&(K["--em-header-bg"]=j.bar,K["--em-header-fg"]=j.barOn),K});function De(j){var K,ve;return(ve=Rs($t((K=n.data.attributeStyles)==null?void 0:K[j.modelId])))==null?void 0:ve.text}const Z=t.computed(()=>[...C.value.operations??[]].sort((j,K)=>j.order-K.order)),re=t.computed(()=>$.value==="CLASS"&&Z.value.length>0),ue={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function z(j){return j?ue[j]:"~"}function L(j){var K,ve;return(ve=Rs($t((K=n.data.operationStyles)==null?void 0:K[j.modelId])))==null?void 0:ve.text}function F(j,K,ve){switch($.value){case"CLASS":return[{text:j}];case"PHYSICAL":return[{text:ve||j}];case"LOGICAL":return[K?{text:K}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const Re=K?{text:K}:{text:i("em.node.logicalMissing"),missing:!0};return ve?[Re,{text:` · ${ve}`}]:[Re]}}}function X(j){var K;return((K=p.value)==null?void 0:K.effectiveAttrs.get(j.modelId))??j}function ee(j){var ve,Re,me;if(we(j))return[{text:j.name}];const K=X(j);return F(ke(j),(Re=(ve=K.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:Re[a.value],((me=K.dbAttrs[0])==null?void 0:me.physicalName)??"")}function ke(j){return $.value==="CLASS"?j.name:X(j).derivedIdFieldName||j.name}function ye(j){return j.attrType.startsWith("EMBED")&&j.dbAttrs.length>0}const Ne=yn;function we(j){return ye(j)||Ne(j)}function G(j){return Ne(j)?qS(n.id,j.modelId):YS(n.id,j.modelId)}function q(j){return j.attrType==="DIVIDER"}function W(j){var K;return((K=p.value)==null?void 0:K.embedCols.get(j.modelId))??j.dbAttrs}function Ce(j){var K;return(K=p.value)==null?void 0:K.redundantSlots.get(j.modelId)}const $e=t.computed(()=>(f==null?void 0:f.isCollapsed(Mp(n.id)))??!1),ze=t.computed(()=>$e.value&&pe.value?w.value.reduce((j,K)=>we(K)?j+W(K).length:j,0):0),Fe=t.computed(()=>w.value.some(j=>we(j)));function ae(j){const K=Ce(j);return!K||K.size===0?!1:f?f.isCollapsed(Rp(n.id,j.modelId)):!1}function Se(j){var K;return ae(j)?((K=Ce(j))==null?void 0:K.size)??0:0}function Ge(j){return f?f.isCollapsed(G(j)):!1}function et(j){var K;return!pe.value||$e.value?null:Ge(j)?"attr":(((K=Ce(j))==null?void 0:K.size)??0)>0?"slot":null}function te(j){return!$e.value&&we(j)}function de(j){return Ge(j)?W(j).length:0}function Le(j){if($e.value||Ge(j))return[];const K=W(j);if(!ae(j))return K;const ve=Ce(j);return K.filter((Re,me)=>!ve.has(me))}function dt(j){f==null||f.toggle(Rp(n.id,j.modelId))}function Xe(j){f==null||f.toggle(G(j))}function yt(){f==null||f.toggle(Mp(n.id))}function st(j){var K;return F(j.physicalName,(K=j.logicalName)==null?void 0:K[a.value],j.physicalName)}function ft(j){var Ue;const K=Y.value.get(j.modelId),ve=(K==null?void 0:K.collection)??((Ue=p.value)==null?void 0:Ue.collectionTypes.get(j.modelId)),Re=o?di(j,Mo(o.state.logical),C.value,o.state.logical):void 0,me=(Re==null?void 0:Re.kind)==="resolved"?Re.entity:void 0;return Jr($.value,X(j),ve,K==null?void 0:K.targetName,me)}const nt=t.computed(()=>{const j={};for(const K of w.value)j[K.modelId]=ft(K);return j}),J=t.computed(()=>{var j,K,ve;return F(C.value.name,(K=(j=C.value.table)==null?void 0:j.logicalName)==null?void 0:K[a.value],((ve=C.value.table)==null?void 0:ve.physicalName)??"")}),ce=t.ref(!1),Ae=t.ref(""),Ee=t.ref(null);async function H(){var j,K;ie.value&&(Ae.value=C.value.name,ce.value=!0,await t.nextTick(),(j=Ee.value)==null||j.focus(),(K=Ee.value)==null||K.select())}function It(){if(!ce.value)return;ce.value=!1;const j=Ae.value.trim();j&&j!==C.value.name&&(o==null||o.renameEntity(n.id,j))}function Rt(){o==null||o.addAttribute(n.id)}function ot(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:We,findNode:Ze}=tt(),Q=t.ref(null),Mt=t.computed(()=>{const j=Q.value??n.data.size;return j?{width:`${j.width}px`,minHeight:`${j.height}px`}:void 0});let Vt=null;function Mn(j){var Re,me,Ue;if(!ie.value)return;j.stopPropagation();const K=(Re=Ze(n.id))==null?void 0:Re.dimensions,ve=We({x:j.clientX,y:j.clientY});Vt={fx:ve.x,fy:ve.y,w:(K==null?void 0:K.width)??((me=n.data.size)==null?void 0:me.width)??200,h:(K==null?void 0:K.height)??((Ue=n.data.size)==null?void 0:Ue.height)??120},j.target.setPointerCapture(j.pointerId)}function an(j){if(!Vt)return;const K=We({x:j.clientX,y:j.clientY});Q.value={width:Math.max(40,Vt.w+(K.x-Vt.fx)),height:Math.max(40,Vt.h+(K.y-Vt.fy))}}function _e(j){var K,ve,Re;if(Vt&&Q.value&&o){const me=(K=Ze(n.id))==null?void 0:K.dimensions;o.resizeEntity(n.id,{width:Math.round((me==null?void 0:me.width)??Q.value.width),height:Math.round((me==null?void 0:me.height)??Q.value.height)})}Vt=null,Q.value=null,(Re=(ve=j.target).releasePointerCapture)==null||Re.call(ve,j.pointerId)}const mt=t.ref(null),vt=t.ref(null);function O(j,K){if(!ie.value)return;K.stopPropagation(),K.preventDefault();const ve=A.value,Re=ve.has(j.modelId)?new Set(ve):new Set([j.modelId]);vt.value={ids:Re,dropIndex:-1,lineY:0},K.target.setPointerCapture(K.pointerId)}function U(j){if(!vt.value||!mt.value)return;const K=Array.from(mt.value.querySelectorAll(".em-entity__row"));if(!K.length)return;let ve=K.length;for(let Ue=0;Ue<K.length;Ue++){const Ye=K[Ue].getBoundingClientRect();if(j.clientY<Ye.top+Ye.height/2){ve=Ue;break}}const Re=K[K.length-1],me=ve<K.length?K[ve].offsetTop:Re.offsetTop+Re.offsetHeight;vt.value={...vt.value,dropIndex:ve,lineY:me}}function le(){const j=vt.value;if(vt.value=null,!j||j.dropIndex<0)return;const K=w.value,ve=K.filter(pt=>j.ids.has(pt.modelId)).map(pt=>pt.modelId),Re=K.filter((pt,Pt)=>j.ids.has(pt.modelId)&&Pt<j.dropIndex).length,me=j.dropIndex-Re,Ue=K.filter(pt=>!j.ids.has(pt.modelId)).map(pt=>pt.modelId);[...Ue.slice(0,me),...ve,...Ue.slice(me)].join(",")!==K.map(pt=>pt.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,ve,me))}function ne(){vt.value=null}const xe=t.ref(null),Be=t.ref(null);function qe(j,K){ie.value&&(K.stopPropagation(),K.preventDefault(),Be.value={id:j.modelId,dropIndex:-1,lineY:0},K.target.setPointerCapture(K.pointerId))}function je(j){if(!Be.value||!xe.value)return;const K=Array.from(xe.value.querySelectorAll(".em-entity__op-row"));if(!K.length)return;let ve=K.length;for(let Ue=0;Ue<K.length;Ue++){const Ye=K[Ue].getBoundingClientRect();if(j.clientY<Ye.top+Ye.height/2){ve=Ue;break}}const Re=K[K.length-1],me=ve<K.length?K[ve].offsetTop:Re.offsetTop+Re.offsetHeight;Be.value={...Be.value,dropIndex:ve,lineY:me}}function Ie(){const j=Be.value;if(Be.value=null,!j||j.dropIndex<0)return;const ve=Z.value.findIndex(me=>me.modelId===j.id);if(ve<0)return;const Re=j.dropIndex-(ve<j.dropIndex?1:0);Re!==ve&&(o==null||o.reorderOperations(n.id,[j.id],Re))}function Je(){Be.value=null}return(j,K)=>{var ve,Re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":N.value,"is-related":y.value,"is-dimmed":D.value,"is-selected":k.value,"is-multi-selected":S.value,"has-focused-attr":V.value,"is-locked":he.value,"is-reference-only":R.value,"is-diff-added":((ve=u.value)==null?void 0:ve.verb)==="added","is-diff-modified":((Re=u.value)==null?void 0:Re.verb)==="modified"}]),tabindex:"-1",title:R.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Mt.value),onPointerdown:b,onMouseenter:_,onMouseleave:E,onDblclick:l},[k.value?(t.openBlock(),t.createElementBlock("div",XS,[...K[11]||(K[11]=[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(He.value),onDblclick:t.withModifiers(H,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(se.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!se.value,disabled:!g.value,onClick:t.withModifiers(fe,["stop"]),onPointerdown:K[0]||(K[0]=t.withModifiers(()=>{},["stop"])),onDblclick:K[1]||(K[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(se.value?"▸":"▾"),41,ZS),t.createElementVNode("span",QS,"«"+t.toDisplayString(t.unref(li)(C.value.stereotype))+"»",1),ce.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:Ee,"onUpdate:modelValue":K[2]||(K[2]=me=>Ae.value=me),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(It,["enter"]),K[3]||(K[3]=t.withKeys(me=>ce.value=!1,["esc"]))],onBlur:It,onPointerdown:K[4]||(K[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Ae.value]]):(t.openBlock(),t.createElementBlock("span",ex,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.value,(me,Ue)=>(t.openBlock(),t.createElementBlock("span",{key:Ue,class:t.normalizeClass({"em-entity__missing":me.missing})},t.toDisplayString(me.text),3))),128))])),!se.value&&pe.value&&Fe.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:$e.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!$e.value,onClick:t.withModifiers(yt,["stop"]),onPointerdown:K[5]||(K[5]=t.withModifiers(()=>{},["stop"])),onDblclick:K[6]||(K[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",nx,t.toDisplayString($e.value?"▸":"▾"),1)],40,tx)):t.createCommentVNode("",!0),he.value?(t.openBlock(),t.createBlock(Ve,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),se.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:mt,class:"em-entity__attrs"},[vt.value&&vt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${vt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,me=>{var Ue,Ye,pt,Pt,ta;return t.openBlock(),t.createElementBlock(t.Fragment,{key:me.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":M(me),"is-dragging":(Ue=vt.value)==null?void 0:Ue.ids.has(me.modelId),"is-embed":we(me),"is-divider":q(me),"has-embed-badge":!!et(me),nodrag:q(me)&&ie.value,"is-diff-changed":x(me),"is-synthetic":v(me)}]),"data-attr":me.modelId,title:v(me)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(gt=>T(me,gt),["stop"]),onPointerdown:gt=>q(me)?O(me,gt):void 0,onPointermove:gt=>q(me)?U(gt):void 0,onPointerup:gt=>q(me)?le():void 0,onPointercancel:gt=>q(me)?ne():void 0},[ie.value&&!q(me)&&!v(me)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:gt=>O(me,gt),onPointermove:U,onPointerup:le,onPointercancel:ne,onClick:K[7]||(K[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,ix)):t.createCommentVNode("",!0),q(me)?(t.openBlock(),t.createElementBlock("span",ax,t.toDisplayString(me.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(ko),{id:`l:${me.modelId}`,type:"target",position:t.unref(Oe).Left,class:"em-handle",title:ie.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Te(ge.value[me.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",lx,[(Ye=ge.value[me.modelId])!=null&&Ye.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(pt=ge.value[me.modelId])!=null&&pt.required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",sx,[pe.value&&te(me)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:Ge(me)?i("em.node.embedAttrShow",{count:de(me)}):i("em.node.embedAttrHide"),"aria-expanded":!Ge(me),onClick:t.withModifiers(gt=>Xe(me),["stop"]),onPointerdown:K[8]||(K[8]=t.withModifiers(()=>{},["stop"])),onDblclick:K[9]||(K[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(Ge(me)?"▸":"▾"),41,cx)):we(me)?(t.openBlock(),t.createBlock(Ve,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(Pt=ge.value[me.modelId])!=null&&Pt.fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,rx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:De(me)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ee(me),(gt,Vn)=>(t.openBlock(),t.createElementBlock("span",{key:Vn,class:t.normalizeClass({"em-entity__missing":gt.missing})},t.toDisplayString(gt.text),3))),128))],4),et(me)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:de(me)}),onClick:t.withModifiers(gt=>Xe(me),["stop"])},"+"+t.toDisplayString(de(me)),9,dx)):et(me)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:ae(me)?i("em.node.embedRepeatedShow",{count:((ta=Ce(me))==null?void 0:ta.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!ae(me),onClick:t.withModifiers(gt=>dt(me),["stop"])},t.toDisplayString(ae(me)?`+${Se(me)}`:"−"),9,ux)):t.createCommentVNode("",!0),nt.value[me.modelId]?(t.openBlock(),t.createElementBlock("span",mx,t.toDisplayString(nt.value[me.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(ko),{id:`r:${me.modelId}`,type:"source",position:t.unref(Oe).Right,class:"em-handle",title:ie.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,ox),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(we(me)&&pe.value?Le(me):[],gt=>(t.openBlock(),t.createElementBlock("li",{key:`${me.modelId}:${gt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":M(me)}]),onClick:t.withModifiers(Vn=>T(me,Vn),["stop"])},[K[12]||(K[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",px,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(st(gt),(Vn,Fr)=>(t.openBlock(),t.createElementBlock("span",{key:Fr,class:t.normalizeClass({"em-entity__missing":Vn.missing})},t.toDisplayString(Vn.text),3))),128))]),t.createElementVNode("span",hx,t.toDisplayString(gt.dataType),1)],10,fx))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",yx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(yt,["stop"])},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ze.value})),1)],8,gx)])):t.createCommentVNode("",!0)],512)),!se.value&&re.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:xe,class:"em-entity__ops"},[Be.value&&Be.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${Be.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.value,me=>{var Ue,Ye;return t.openBlock(),t.createElementBlock("li",{key:me.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ue=Be.value)==null?void 0:Ue.id)===me.modelId,"is-diff-changed":!!((Ye=u.value)!=null&&Ye.changedOperationIds.has(me.modelId))}]),"data-op":me.modelId},[ie.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:pt=>qe(me,pt),onPointermove:je,onPointerup:Ie,onPointercancel:Je,onClick:K[10]||(K[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,_x)):t.createCommentVNode("",!0),t.createElementVNode("span",kx,t.toDisplayString(z(me.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:L(me)})},t.toDisplayString(me.name)+"()",5)],10,bx)}),128))],512)):Z.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:Z.value.length})},[t.createVNode(Ve,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:Z.value.length})),1)],8,Ex)):t.createCommentVNode("",!0),ie.value?(t.openBlock(),t.createElementBlock("footer",Nx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Rt},t.toDisplayString(i("em.node.addAttr")),1),K[13]||(K[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:ot},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),ie.value&&!ce.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:Mn,onPointermove:an,onPointerup:_e},null,32)):t.createCommentVNode("",!0)],46,JS)}}}),[["__scopeId","data-v-2bcc3efa"]]),wx={key:0,class:"em-sel","aria-hidden":"true"},Ix={class:"em-group__label"},vx={class:"em-group__name"},Cx={key:0,class:"em-group__pkg"},Sx={key:1,class:"em-group__flag"},Bp=Qe(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(()=>$t(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(Gn,null),s=(C,R)=>l?l.t(C,R):en("ko",C,R),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var C;return!!n.id&&((C=l==null?void 0:l.selection.value)==null?void 0:C.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(br,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(vo,null);function h(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const b=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),_=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:N}=tt();let y=null,k=null;function S(C){var w;if(!n.id||!c.value)return;C.stopPropagation();const R=((w=N(n.id))==null?void 0:w.dimensions)??{width:400,height:300},$=E({x:C.clientX,y:C.clientY});y={fx:$.x,fy:$.y,w:R.width,h:R.height},C.target.setPointerCapture(C.pointerId)}function A(C){if(!y||!n.id)return;const R=E({x:C.clientX,y:C.clientY});k={width:Math.max(160,y.w+(R.x-y.fx)),height:Math.max(120,y.h+(R.y-y.fy))};const $=N(n.id);$&&($.style={width:`${k.width}px`,height:`${k.height}px`})}function V(C){var R,$;y&&k&&n.id&&l&&l.resizeGroup(n.id,k),y=null,k=null,($=(R=C.target).releasePointerCapture)==null||$.call(R,C.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),D=t.computed(()=>{const C=o.value.name;return(C==null?void 0:C[T.value])||(C==null?void 0:C.ko)||(C==null?void 0:C.en)||(C==null?void 0:C.ja)||(C==null?void 0:C.zh)||o.value.packageName||s("em.group.fallback")});return(C,R)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":b.value,"is-dimmed":_.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:h,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",wx,[...R[0]||(R[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",Ix,[t.createElementVNode("span",vx,t.toDisplayString(D.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Cx,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Sx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ve,{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:S,onPointermove:A,onPointerup:V},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),xx={key:0,class:"em-sel","aria-hidden":"true"},Rx={key:2,class:"em-note__text"},Dp=Qe(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=t.inject(br,null),a=t.inject(vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>$t(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 u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const p=t.computed(()=>{var w;return((w=a==null?void 0:a.source.value)==null?void 0:w.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),h=t.computed(()=>{var w;return((w=o==null?void 0:o.selection.value)==null?void 0:w.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!h.value),b=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!h.value),_=[{id:"n-top",pos:Oe.Top},{id:"n-right",pos:Oe.Right},{id:"n-bottom",pos:Oe.Bottom},{id:"n-left",pos:Oe.Left}],E=t.ref(!1),N=t.ref(""),y=t.ref(null);async function k(){var w;l.value&&(N.value=r.value.memo,E.value=!0,await t.nextTick(),(w=y.value)==null||w.focus())}function S(){E.value&&(E.value=!1,N.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,N.value)))}const{screenToFlowCoordinate:A,findNode:V}=tt();let T=null,D=null;function C(w){var B;if(!l.value)return;w.stopPropagation();const I=((B=V(n.id))==null?void 0:B.dimensions)??r.value.geo.size,v=A({x:w.clientX,y:w.clientY});T={fx:v.x,fy:v.y,w:I.width,h:I.height},w.target.setPointerCapture(w.pointerId)}function R(w){if(!T)return;const I=A({x:w.clientX,y:w.clientY});D={width:Math.max(140,T.w+(I.x-T.fx)),height:Math.max(60,T.h+(I.y-T.fy))};const v=V(n.id);v&&(v.style={width:`${D.width}px`,height:`${D.height}px`})}function $(w){var I,v;T&&D&&o&&o.resizeNote(n.id,D),T=null,D=null,(v=(I=w.target).releasePointerCapture)==null||v.call(I,w.pointerId)}return(w,I)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":b.value,"is-selected":h.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:k,onPointerdown:d,onMouseenter:u,onMouseleave:m},[h.value?(t.openBlock(),t.createElementBlock("div",xx,[...I[4]||(I[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:y,"onUpdate:modelValue":I[0]||(I[0]=v=>N.value=v),class:"em-note__edit nodrag",onBlur:S,onKeydown:I[1]||(I[1]=t.withKeys(v=>E.value=!1,["esc"])),onPointerdown:I[2]||(I[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,N.value]]):(t.openBlock(),t.createElementBlock("div",Rx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(_,v=>t.createVNode(t.unref(ko),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:I[3]||(I[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:C,onPointermove:R,onPointerup:$},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function _r(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 ti=.5;function Op(e,n,o,i,a,r){const l=_r(n),s=_r(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 p=e;const f=(b,_)=>{(Math.abs(b.x-p.x)>=ti||Math.abs(b.y-p.y)>=ti)&&(m.push({a:p,b,seg:_}),p=b)};f(c,0);let h=l.x!==0,g=c;for(let b=1;b<u.length;b++){const _=u[b],E=b<=o.length?b-1:o.length,N=Math.abs(_.x-g.x)<ti,y=Math.abs(_.y-g.y)<ti;N&&y||(N?(f(_,E),h=!1):y?(f(_,E),h=!0):h?(f({x:g.x,y:_.y},E),f(_,E),h=!0):(f({x:_.x,y:g.y},E),f(_,E),h=!1),g=_)}return f(i,o.length),m}function Bs(e,n,o,i,a,r=20){const l=Op(e,n,o,i,a,r);let s=`M ${Tt(e.x)},${Tt(e.y)}`;for(const c of l)s+=` L ${Tt(c.b.x)},${Tt(c.b.y)}`;return s}const Ax=14;function Lp(e,n,o,i,a,r=20){return Op(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=Ax).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function Tt(e){return Math.round(e*100)/100}const $x=36;function Tx(e,n,o=$x){const i=Math.max(e.x,n.x)+o;return`M ${Tt(e.x)},${Tt(e.y)} L ${Tt(i)},${Tt(e.y)} L ${Tt(i)},${Tt(n.y)} L ${Tt(n.x)},${Tt(n.y)}`}function Ds(e,n,o){const i=[e,...n,o];let a=`M ${Tt(i[0].x)},${Tt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${Tt(i[r].x)},${Tt(i[r].y)}`;return a}function Mx(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Pp(e,n){const o=Mx(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<ti&&Math.abs(l)<ti)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 zp(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 Fp(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 Vx=20,Bx=22,Dx=7,Ox=22,Up=31,Hp=7,Lx=20,jp=11,Kp=11,Px=Up+Hp;function zx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Fx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function kr(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 Gp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Er(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Yp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Gp(e,n);return[Er(o,a,r-Math.PI/2),Er(o,a,r+Math.PI/2)]}function qp(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 Wp(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=kr(e,n,Vx),[d,u]=Yp(e,n,c,Bx);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}),zx(o.multiplicity)){const m=kr(e,n,Up);r.push({cx:m.x,cy:m.y,r:Hp})}if(Fx(o.multiplicity)){const m=kr(e,n,Dx),[p,f]=Yp(e,n,m,Ox);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.y}),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=kr(e,n,Lx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Gp(e,n),m=Er(d,jp/2,u-Math.PI/2),p=Er(d,jp/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=qp(s,c,Kp,!0),u=qp(s,c,Kp,!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 Jp=200,Xp=120,Os=24;function Zp(e){var a,r;if(!e)return{x:0,y:0,width:Jp,height:Xp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Jp,i=((r=e.dimensions)==null?void 0:r.height)||Xp;return{x:n.x,y:n.y,width:o,height:i}}function Qp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ls(e){const n=t.computed(()=>Zp(e.sourceNode())),o=t.computed(()=>Zp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,h;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((h=e.targetRowY)==null?void 0:h.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<Os){const g=(m+p)/2;m=g-Os/2,p=g+Os/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Qp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Qp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?zp(n.value,d,r.value.x):Pp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?zp(o.value,d,l.value.x):Pp(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 Ps=Symbol("waypointController"),Ux=["d"],Hx=["d"],jx=["d"],Kx=["x1","y1","x2","y2"],Gx=["cx","cy","r"],Yx=["x","y"],qx=["x","y"],Wx=["cx","cy","onDblclick"],Jx=["x","y","onPointerdown","onDblclick"],eh=Qe(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(Ps),a=t.inject(Gn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Np,null),s=t.inject(vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var Z;return((Z=a==null?void 0:a.selection.value)==null?void 0:Z.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const Z=l==null?void 0:l.value;if(!Z||!a)return null;const re=a.resolved.value.entities,ue=L=>{var F;return(F=re.find(X=>X.entity.modelId===L))==null?void 0:F.groupRef},z=n.data.association;return ue(z.end1.entityRef)===Z.groupId&&ue(z.end2.entityRef)===Z.groupId?{dx:Z.dx,dy:Z.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),h=t.ref({x:0,y:0}),g=t.computed(()=>{const Z=m.value;return p.value.map((re,ue)=>ue===f.value?h.value:Z?{x:re.x+Z.dx,y:re.y+Z.dy}:re)}),b=t.computed(()=>{var Z;return!!((Z=n.sourceNode.data)!=null&&Z.collapsed)}),_=t.computed(()=>{var Z;return!!((Z=n.targetNode.data)!=null&&Z.collapsed)}),{source:E,target:N,sourceSide:y,targetSide:k,isSelf:S}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!b.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!_.value?n.targetY:void 0}),A=Px+4,V=t.computed(()=>S.value?Tx(E.value,N.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Bs(E.value,y.value,g.value,N.value,k.value,A):Ds(E.value,g.value,N.value)),T=t.computed(()=>S.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Lp(E.value,y.value,g.value,N.value,k.value,A):Fp(E.value,g.value,N.value).map((Z,re)=>({point:Z,segIndex:re}))),D=t.computed(()=>S.value||!r.value?[]:g.value),C=da;function R(Z,re){f.value=Z,h.value={...p.value[Z]},re.target.setPointerCapture(re.pointerId),re.stopPropagation()}function $(Z){if(f.value<0)return;const re=o({x:Z.clientX,y:Z.clientY});h.value={x:re.x,y:re.y}}function w(Z){var re,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...h.value}),f.value=-1,(ue=(re=Z.target).releasePointerCapture)==null||ue.call(re,Z.pointerId)}function I(Z,re){re.stopPropagation(),i==null||i.removePoint(n.id,Z)}function v(Z,re){if(!i)return;const ue=o({x:re.clientX,y:re.clientY});i.insertPoint(n.id,Z,{x:ue.x,y:ue.y})}const B=t.computed(()=>C(n.data.association.end1.multiplicity)),M=t.computed(()=>C(n.data.association.end2.multiplicity)),x=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),P=t.computed(()=>x.value==="class"),Y=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const Z=_r(y.value);return{x:E.value.x+Z.x*10,y:E.value.y+Z.y*10}}return g.value[0]??N.value}),se=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const re=_r(k.value);return{x:N.value.x+re.x*10,y:N.value.y+re.y*10}}const Z=g.value;return Z[Z.length-1]??E.value}),he=t.computed(()=>{const Z=n.data.association;return{multiplicity:Z.end1.multiplicity,navigable:Z.end1.navigable,composition:Z.end1.composition,otherNavigable:Z.end2.navigable}}),ie=t.computed(()=>{const Z=n.data.association;return{multiplicity:Z.end2.multiplicity,navigable:Z.end2.navigable,composition:Z.end2.composition,otherNavigable:Z.end1.navigable}}),fe=t.computed(()=>Wp(E.value,Y.value,he.value,x.value)),pe=t.computed(()=>Wp(N.value,se.value,ie.value,x.value)),ge=t.computed(()=>[...fe.value.lines,...pe.value.lines]),Te=t.computed(()=>[...fe.value.circles,...pe.value.circles]),He=t.computed(()=>[...fe.value.polygons,...pe.value.polygons].map(Z=>`M${Z.points.map(re=>`${re.x},${re.y}`).join(" L")} Z`)),De=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(Z,re)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:V.value,fill:"none",class:"em-edge__hit"},null,8,Ux),t.createElementVNode("path",{d:V.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,Hx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(He.value,(ue,z)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${z}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",De.value])},null,10,jx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,(ue,z)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${z}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",De.value])},null,10,Kx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Te.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${z}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",De.value])},null,10,Gx))),128)),P.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":u.value}])},t.toDisplayString(B.value),11,Yx),t.createElementVNode("text",{x:t.unref(N).x-8,y:t.unref(N).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,qx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(ue,z)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${z}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>v(ue.segIndex,L),["stop"])},null,42,Wx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,(ue,z)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${z}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>R(z,L),onPointermove:$,onPointerup:w,onDblclick:L=>I(z,L)},null,42,Jx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var Rn=(e=>(e.Lines="lines",e.Dots="dots",e))(Rn||{});const th=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]}`})},nh=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};Rn.Lines+"",Rn.Dots+"";const Xx={[Rn.Dots]:"#81818a",[Rn.Lines]:"#eee"},Zx=["id","x","y","width","height","patternTransform"],Qx={key:2,height:"100",width:"100"},eR=["fill"],tR=["x","y","fill"],nR={name:"Background",compatConfig:{MODE:3}},oR=t.defineComponent({...nR,props:{id:{},variant:{default:()=>Rn.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}=tt(),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],u=e.size*l,[m,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Xx[e.variant||Rn.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(Rn).Lines?(t.openBlock(),t.createBlock(t.unref(th),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(Rn).Dots?(t.openBlock(),t.createBlock(t.unref(nh),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",Qx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,eR)])):t.createCommentVNode("",!0)])],8,Zx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,tR),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),iR={name:"ControlButton",compatConfig:{MODE:3}},aR=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},rR={type:"button",class:"vue-flow__controls-button"};function lR(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",rR,[t.renderSlot(e.$slots,"default")])}const Co=aR(iR,[["render",lR]]),sR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},cR=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function dR(e,n){return t.openBlock(),t.createElementBlock("svg",sR,cR)}const uR={render:dR},mR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fR=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function pR(e,n){return t.openBlock(),t.createElementBlock("svg",mR,fR)}const hR={render:pR},yR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},gR=[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 bR(e,n){return t.openBlock(),t.createElementBlock("svg",yR,gR)}const _R={render:bR},kR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ER=[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 NR(e,n){return t.openBlock(),t.createElementBlock("svg",kR,ER)}const wR={render:NR},IR={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},vR=[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 CR(e,n){return t.openBlock(),t.createElementBlock("svg",IR,vR)}const SR={render:CR},xR={name:"Controls",compatConfig:{MODE:3}},RR=t.defineComponent({...xR,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>tf.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:u,maxZoom:m}=tt(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),h=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function b(){s(),n("zoomOut")}function _(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(N,y)=>(t.openBlock(),t.createBlock(t.unref(ep),{class:"vue-flow__controls",position:N.position},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"top"),N.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(N.$slots,"control-zoom-in",{},()=>[t.createVNode(Co,{class:"vue-flow__controls-zoomin",disabled:h.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(uR))))])]),_:3},8,["disabled"])]),t.renderSlot(N.$slots,"control-zoom-out",{},()=>[t.createVNode(Co,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(hR))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),N.showFitView?t.renderSlot(N.$slots,"control-fit-view",{key:1},()=>[t.createVNode(Co,{class:"vue-flow__controls-fitview",onClick:_},{default:t.withCtx(()=>[t.renderSlot(N.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_R))))])]),_:3})]):t.createCommentVNode("",!0),N.showInteractive?t.renderSlot(N.$slots,"control-interactive",{key:2},()=>[N.showInteractive?(t.openBlock(),t.createBlock(Co,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(N.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(SR))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(N.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(wR))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(N.$slots,"default")]),_:3},8,["position"]))}});var AR={value:()=>{}};function zs(){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 Nr(o)}function Nr(e){this._=e}function $R(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}})}Nr.prototype=zs.prototype={constructor:Nr,on:function(e,n){var o=this._,i=$R(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=TR(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]=oh(o[a],e.name,n);else if(n==null)for(a in o)o[a]=oh(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 Nr(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 TR(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function oh(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=AR,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Fs="http://www.w3.org/1999/xhtml";const ih={svg:"http://www.w3.org/2000/svg",xhtml:Fs,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),ih.hasOwnProperty(n)?{space:ih[n],local:e}:e}function MR(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Fs&&n.documentElement.namespaceURI===Fs?n.createElement(e):n.createElementNS(o,e)}}function VR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ah(e){var n=wr(e);return(n.local?VR:MR)(n)}function BR(){}function Us(e){return e==null?BR:function(){return this.querySelector(e)}}function DR(e){typeof e!="function"&&(e=Us(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,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 Ht(i,this._parents)}function OR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function LR(){return[]}function rh(e){return e==null?LR:function(){return this.querySelectorAll(e)}}function PR(e){return function(){return OR(e.apply(this,arguments))}}function zR(e){typeof e=="function"?e=PR(e):e=rh(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 Ht(i,a)}function lh(e){return function(){return this.matches(e)}}function sh(e){return function(n){return n.matches(e)}}var FR=Array.prototype.find;function UR(e){return function(){return FR.call(this.children,e)}}function HR(){return this.firstElementChild}function jR(e){return this.select(e==null?HR:UR(typeof e=="function"?e:sh(e)))}var KR=Array.prototype.filter;function GR(){return Array.from(this.children)}function YR(e){return function(){return KR.call(this.children,e)}}function qR(e){return this.selectAll(e==null?GR:YR(typeof e=="function"?e:sh(e)))}function WR(e){typeof e!="function"&&(e=lh(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 Ht(i,this._parents)}function ch(e){return new Array(e.length)}function JR(){return new Ht(this._enter||this._groups.map(ch),this._parents)}function Ir(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}Ir.prototype={constructor:Ir,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 XR(e){return function(){return e}}function ZR(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 Ir(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function QR(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new Ir(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function eA(e){return e.__data__}function tA(e,n){if(!arguments.length)return Array.from(this,eA);var o=n?QR:ZR,i=this._parents,a=this._groups;typeof e!="function"&&(e=XR(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],p=m.length,f=nA(e.call(u,u&&u.__data__,d,i)),h=f.length,g=s[d]=new Array(h),b=l[d]=new Array(h),_=c[d]=new Array(p);o(u,m,g,b,_,f,n);for(var E=0,N=0,y,k;E<h;++E)if(y=g[E]){for(E>=N&&(N=E+1);!(k=b[N])&&++N<h;);y._next=k||null}}return l=new Ht(l,i),l._enter=s,l._exit=c,l}function nA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function oA(){return new Ht(this._exit||this._groups.map(ch),this._parents)}function iA(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 aA(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],u=i[c],m=d.length,p=s[c]=new Array(m),f,h=0;h<m;++h)(f=d[h]||u[h])&&(p[h]=f);for(;c<a;++c)s[c]=o[c];return new Ht(s,this._parents)}function rA(){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 lA(e){e||(e=sA);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!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,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Ht(a,this._parents).order()}function sA(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function cA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dA(){return Array.from(this)}function uA(){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 mA(){let e=0;for(const n of this)++e;return e}function fA(){return!this.node()}function pA(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 hA(e){return function(){this.removeAttribute(e)}}function yA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gA(e,n){return function(){this.setAttribute(e,n)}}function bA(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function _A(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function kA(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 EA(e,n){var o=wr(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?yA:hA:typeof n=="function"?o.local?kA:_A:o.local?bA:gA)(o,n))}function dh(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function NA(e){return function(){this.style.removeProperty(e)}}function wA(e,n,o){return function(){this.style.setProperty(e,n,o)}}function IA(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function vA(e,n,o){return arguments.length>1?this.each((n==null?NA:typeof n=="function"?IA:wA)(e,n,o??"")):ni(this.node(),e)}function ni(e,n){return e.style.getPropertyValue(n)||dh(e).getComputedStyle(e,null).getPropertyValue(n)}function CA(e){return function(){delete this[e]}}function SA(e,n){return function(){this[e]=n}}function xA(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function RA(e,n){return arguments.length>1?this.each((n==null?CA:typeof n=="function"?xA:SA)(e,n)):this.node()[e]}function uh(e){return e.trim().split(/^|\s+/)}function Hs(e){return e.classList||new mh(e)}function mh(e){this._node=e,this._names=uh(e.getAttribute("class")||"")}mh.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 fh(e,n){for(var o=Hs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function ph(e,n){for(var o=Hs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function AA(e){return function(){fh(this,e)}}function $A(e){return function(){ph(this,e)}}function TA(e,n){return function(){(n.apply(this,arguments)?fh:ph)(this,e)}}function MA(e,n){var o=uh(e+"");if(arguments.length<2){for(var i=Hs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?TA:n?AA:$A)(o,n))}function VA(){this.textContent=""}function BA(e){return function(){this.textContent=e}}function DA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function OA(e){return arguments.length?this.each(e==null?VA:(typeof e=="function"?DA:BA)(e)):this.node().textContent}function LA(){this.innerHTML=""}function PA(e){return function(){this.innerHTML=e}}function zA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function FA(e){return arguments.length?this.each(e==null?LA:(typeof e=="function"?zA:PA)(e)):this.node().innerHTML}function UA(){this.nextSibling&&this.parentNode.appendChild(this)}function HA(){return this.each(UA)}function jA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function KA(){return this.each(jA)}function GA(e){var n=typeof e=="function"?e:ah(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function YA(){return null}function qA(e,n){var o=typeof e=="function"?e:ah(e),i=n==null?YA:typeof n=="function"?n:Us(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function WA(){var e=this.parentNode;e&&e.removeChild(this)}function JA(){return this.each(WA)}function XA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function ZA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function QA(e){return this.select(e?ZA:XA)}function e$(e){return arguments.length?this.property("__data__",e):this.node().__data__}function t$(e){return function(n){e.call(this,n,this.__data__)}}function n$(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 o$(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 i$(e,n,o){return function(){var i=this.__on,a,r=t$(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 a$(e,n,o){var i=n$(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=n?i$:o$,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function hh(e,n,o){var i=dh(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 r$(e,n){return function(){return hh(this,e,n)}}function l$(e,n){return function(){return hh(this,e,n.apply(this,arguments))}}function s$(e,n){return this.each((typeof n=="function"?l$:r$)(e,n))}function*c$(){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 yh=[null];function Ht(e,n){this._groups=e,this._parents=n}function Hi(){return new Ht([[document.documentElement]],yh)}function d$(){return this}Ht.prototype=Hi.prototype={constructor:Ht,select:DR,selectAll:zR,selectChild:jR,selectChildren:qR,filter:WR,data:tA,enter:JR,exit:oA,join:iA,merge:aA,selection:d$,order:rA,sort:lA,call:cA,nodes:dA,node:uA,size:mA,empty:fA,each:pA,attr:EA,style:vA,property:RA,classed:MA,text:OA,html:FA,raise:HA,lower:KA,append:GA,insert:qA,remove:JA,clone:QA,datum:e$,on:a$,dispatch:s$,[Symbol.iterator]:c$};function Yn(e){return typeof e=="string"?new Ht([[document.querySelector(e)]],[document.documentElement]):new Ht([[e]],yh)}function u$(e){let n;for(;n=e.sourceEvent;)e=n;return e}function qn(e,n){if(e=u$(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 js={capture:!0,passive:!1};function Ks(e){e.preventDefault(),e.stopImmediatePropagation()}function m$(e){var n=e.document.documentElement,o=Yn(e).on("dragstart.drag",Ks,js);"onselectstart"in n?o.on("selectstart.drag",Ks,js):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function f$(e,n){var o=e.document.documentElement,i=Yn(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ks,js),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 Gs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function gh(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ji(){}var Ki=.7,vr=1/Ki,oi="\\s*([+-]?\\d+)\\s*",Gi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",p$=/^#([0-9a-f]{3,8})$/,h$=new RegExp(`^rgb\\(${oi},${oi},${oi}\\)$`),y$=new RegExp(`^rgb\\(${fn},${fn},${fn}\\)$`),g$=new RegExp(`^rgba\\(${oi},${oi},${oi},${Gi}\\)$`),b$=new RegExp(`^rgba\\(${fn},${fn},${fn},${Gi}\\)$`),_$=new RegExp(`^hsl\\(${Gi},${fn},${fn}\\)$`),k$=new RegExp(`^hsla\\(${Gi},${fn},${fn},${Gi}\\)$`),bh={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};Gs(ji,Yi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_h,formatHex:_h,formatHex8:E$,formatHsl:N$,formatRgb:kh,toString:kh});function _h(){return this.rgb().formatHex()}function E$(){return this.rgb().formatHex8()}function N$(){return vh(this).formatHsl()}function kh(){return this.rgb().formatRgb()}function Yi(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=p$.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Eh(n):o===3?new Lt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?Cr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?Cr(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=h$.exec(e))?new Lt(n[1],n[2],n[3],1):(n=y$.exec(e))?new Lt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=g$.exec(e))?Cr(n[1],n[2],n[3],n[4]):(n=b$.exec(e))?Cr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=_$.exec(e))?Ih(n[1],n[2]/100,n[3]/100,1):(n=k$.exec(e))?Ih(n[1],n[2]/100,n[3]/100,n[4]):bh.hasOwnProperty(e)?Eh(bh[e]):e==="transparent"?new Lt(NaN,NaN,NaN,0):null}function Eh(e){return new Lt(e>>16&255,e>>8&255,e&255,1)}function Cr(e,n,o,i){return i<=0&&(e=n=o=NaN),new Lt(e,n,o,i)}function w$(e){return e instanceof ji||(e=Yi(e)),e?(e=e.rgb(),new Lt(e.r,e.g,e.b,e.opacity)):new Lt}function Ys(e,n,o,i){return arguments.length===1?w$(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Gs(Lt,Ys,gh(ji,{brighter(e){return e=e==null?vr:Math.pow(vr,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lt(So(this.r),So(this.g),So(this.b),Sr(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:Nh,formatHex:Nh,formatHex8:I$,formatRgb:wh,toString:wh}));function Nh(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function I$(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function wh(){const e=Sr(this.opacity);return`${e===1?"rgb(":"rgba("}${So(this.r)}, ${So(this.g)}, ${So(this.b)}${e===1?")":`, ${e})`}`}function Sr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function So(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=So(e),(e<16?"0":"")+e.toString(16)}function Ih(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new nn(e,n,o,i)}function vh(e){if(e instanceof nn)return new nn(e.h,e.s,e.l,e.opacity);if(e instanceof ji||(e=Yi(e)),!e)return new nn;if(e instanceof nn)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 nn(l,s,c,e.opacity)}function v$(e,n,o,i){return arguments.length===1?vh(e):new nn(e,n,o,i??1)}function nn(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Gs(nn,v$,gh(ji,{brighter(e){return e=e==null?vr:Math.pow(vr,e),new nn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new nn(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 Lt(qs(e>=240?e-240:e+120,a,i),qs(e,a,i),qs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new nn(Ch(this.h),xr(this.s),xr(this.l),Sr(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=Sr(this.opacity);return`${e===1?"hsl(":"hsla("}${Ch(this.h)}, ${xr(this.s)*100}%, ${xr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ch(e){return e=(e||0)%360,e<0?e+360:e}function xr(e){return Math.max(0,Math.min(1,e||0))}function qs(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 Sh=e=>()=>e;function C$(e,n){return function(o){return e+o*n}}function S$(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 x$(e){return(e=+e)==1?xh:function(n,o){return o-n?S$(n,o,e):Sh(isNaN(n)?o:n)}}function xh(e,n){var o=n-e;return o?C$(e,o):Sh(isNaN(e)?n:e)}const Rh=(function e(n){var o=x$(n);function i(a,r){var l=o((a=Ys(a)).r,(r=Ys(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=xh(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 Wn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var Ws=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Js=new RegExp(Ws.source,"g");function R$(e){return function(){return e}}function A$(e){return function(n){return e(n)+""}}function $$(e,n){var o=Ws.lastIndex=Js.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ws.exec(e))&&(a=Js.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:Wn(i,a)})),o=Js.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?A$(c[0].x):R$(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Ah=180/Math.PI,Xs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $h(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)*Ah,skewX:Math.atan(c)*Ah,scaleX:l,scaleY:s}}var Rr;function T$(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Xs:$h(n.a,n.b,n.c,n.d,n.e,n.f)}function M$(e){return e==null||(Rr||(Rr=document.createElementNS("http://www.w3.org/2000/svg","g")),Rr.setAttribute("transform",e),!(e=Rr.transform.baseVal.consolidate()))?Xs:(e=e.matrix,$h(e.a,e.b,e.c,e.d,e.e,e.f))}function Th(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push("translate(",null,n,null,o);h.push({i:g-4,x:Wn(d,m)},{i:g-2,x:Wn(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Wn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Wn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,h){if(d!==m||u!==p){var g=f.push(a(f)+"scale(",null,",",null,")");h.push({i:g-4,x:Wn(d,m)},{i:g-2,x:Wn(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var h=-1,g=p.length,b;++h<g;)m[(b=p[h]).i]=b.x(f);return m.join("")}}}var V$=Th(T$,"px, ","px)","deg)"),B$=Th(M$,", ",")",")"),D$=1e-12;function Mh(e){return((e=Math.exp(e))+1/e)/2}function O$(e){return((e=Math.exp(e))-1/e)/2}function L$(e){return((e=Math.exp(2*e))-1)/(e+1)}const P$=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],p=l[2],f=u-s,h=m-c,g=f*f+h*h,b,_;if(g<D$)_=Math.log(p/d)/n,b=function(A){return[s+A*f,c+A*h,d*Math.exp(n*A*_)]};else{var E=Math.sqrt(g),N=(p*p-d*d+i*g)/(2*d*o*E),y=(p*p-d*d-i*g)/(2*p*o*E),k=Math.log(Math.sqrt(N*N+1)-N),S=Math.log(Math.sqrt(y*y+1)-y);_=(S-k)/n,b=function(A){var V=A*_,T=Mh(k),D=d/(o*E)*(T*L$(n*V+k)-O$(k));return[s+D*f,c+D*h,d*T/Mh(n*V+k)]}}return b.duration=_*1e3*n/Math.SQRT2,b}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 ii=0,qi=0,Wi=0,Vh=1e3,Ar,Ji,$r=0,Ro=0,Tr=0,Xi=typeof performance=="object"&&performance.now?performance:Date,Bh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zs(){return Ro||(Bh(z$),Ro=Xi.now()+Tr)}function z$(){Ro=0}function Mr(){this._call=this._time=this._next=null}Mr.prototype=Dh.prototype={constructor:Mr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Zs():+o)+(n==null?0:+n),!this._next&&Ji!==this&&(Ji?Ji._next=this:Ar=this,Ji=this),this._call=e,this._time=o,Qs()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qs())}};function Dh(e,n,o){var i=new Mr;return i.restart(e,n,o),i}function F$(){Zs(),++ii;for(var e=Ar,n;e;)(n=Ro-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ii}function Oh(){Ro=($r=Xi.now())+Tr,ii=qi=0;try{F$()}finally{ii=0,H$(),Ro=0}}function U$(){var e=Xi.now(),n=e-$r;n>Vh&&(Tr-=n,$r=e)}function H$(){for(var e,n=Ar,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:Ar=o);Ji=e,Qs(i)}function Qs(e){if(!ii){qi&&(qi=clearTimeout(qi));var n=e-Ro;n>24?(e<1/0&&(qi=setTimeout(Oh,e-Xi.now()-Tr)),Wi&&(Wi=clearInterval(Wi))):(Wi||($r=Xi.now(),Wi=setInterval(U$,Vh)),ii=1,Bh(Oh))}}function Lh(e,n,o){var i=new Mr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var j$=zs("start","end","cancel","interrupt"),K$=[],Ph=0,zh=1,ec=2,Vr=3,Fh=4,tc=5,Br=6;function Dr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;G$(e,o,{name:n,index:i,group:a,on:j$,tween:K$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ph})}function nc(e,n){var o=on(e,n);if(o.state>Ph)throw new Error("too late; already scheduled");return o}function pn(e,n){var o=on(e,n);if(o.state>Vr)throw new Error("too late; already running");return o}function on(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function G$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Dh(r,0,o.time);function r(d){o.state=zh,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==zh)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Vr)return Lh(l);f.state===Fh?(f.state=Br,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Br,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Lh(function(){o.state===Vr&&(o.state=Fh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ec,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ec){for(o.state=Vr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=tc,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===tc&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Br,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Or(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>ec&&i.state<tc,i.state=Br,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function Y$(e){return this.each(function(){Or(this,e)})}function q$(e,n){var o,i;return function(){var a=pn(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 W$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=pn(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 J$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=on(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?q$:W$)(o,e,n))}function oc(e,n,o){var i=e._id;return e.each(function(){var a=pn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return on(a,i).value[n]}}function Uh(e,n){var o;return(typeof n=="number"?Wn:n instanceof Yi?Rh:(o=Yi(n))?(n=o,Rh):$$)(e,n)}function X$(e){return function(){this.removeAttribute(e)}}function Z$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q$(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 eT(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 tT(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 nT(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 oT(e,n){var o=wr(e),i=o==="transform"?B$:Uh;return this.attrTween(e,typeof n=="function"?(o.local?nT:tT)(o,i,oc(this,"attr."+e,n)):n==null?(o.local?Z$:X$)(o):(o.local?eT:Q$)(o,i,n))}function iT(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function aT(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function rT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&aT(e,r)),o}return a._value=n,a}function lT(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&iT(e,r)),o}return a._value=n,a}function sT(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=wr(e);return this.tween(o,(i.local?rT:lT)(i,n))}function cT(e,n){return function(){nc(this,e).delay=+n.apply(this,arguments)}}function dT(e,n){return n=+n,function(){nc(this,e).delay=n}}function uT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?cT:dT)(n,e)):on(this.node(),n).delay}function mT(e,n){return function(){pn(this,e).duration=+n.apply(this,arguments)}}function fT(e,n){return n=+n,function(){pn(this,e).duration=n}}function pT(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?mT:fT)(n,e)):on(this.node(),n).duration}function hT(e,n){if(typeof n!="function")throw new Error;return function(){pn(this,e).ease=n}}function yT(e){var n=this._id;return arguments.length?this.each(hT(n,e)):on(this.node(),n).ease}function gT(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;pn(this,e).ease=o}}function bT(e){if(typeof e!="function")throw new Error;return this.each(gT(this._id,e))}function _T(e){typeof e!="function"&&(e=lh(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 An(i,this._parents,this._name,this._id)}function kT(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],u=c.length,m=l[s]=new Array(u),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new An(l,this._parents,this._name,this._id)}function ET(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 NT(e,n,o){var i,a,r=ET(n)?nc:pn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function wT(e,n){var o=this._id;return arguments.length<2?on(this.node(),o).on.on(e):this.each(NT(o,e,n))}function IT(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function vT(){return this.on("end.remove",IT(this._id))}function CT(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Us(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Dr(d[p],n,o,p,d,on(u,o)));return new An(r,this._parents,n,o)}function ST(e){var n=this._name,o=this._id;typeof e!="function"&&(e=rh(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 p=e.call(u,u.__data__,m,c),f,h=on(u,o),g=0,b=p.length;g<b;++g)(f=p[g])&&Dr(f,n,o,g,p,h);r.push(p),l.push(u)}return new An(r,l,n,o)}var xT=Hi.prototype.constructor;function RT(){return new xT(this._groups,this._parents)}function AT(e,n){var o,i,a;return function(){var r=ni(this,e),l=(this.style.removeProperty(e),ni(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Hh(e){return function(){this.style.removeProperty(e)}}function $T(e,n,o){var i,a=o+"",r;return function(){var l=ni(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function TT(e,n,o){var i,a,r;return function(){var l=ni(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),ni(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function MT(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=pn(this,e),d=c.on,u=c.value[r]==null?s||(s=Hh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function VT(e,n,o){var i=(e+="")=="transform"?V$:Uh;return n==null?this.styleTween(e,AT(e,i)).on("end.style."+e,Hh(e)):typeof n=="function"?this.styleTween(e,TT(e,i,oc(this,"style."+e,n))).each(MT(this._id,e)):this.styleTween(e,$T(e,i,n),o).on("end.style."+e,null)}function BT(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function DT(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&BT(e,l,o)),i}return r._value=n,r}function OT(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,DT(e,n,o??""))}function LT(e){return function(){this.textContent=e}}function PT(e){return function(){var n=e(this);this.textContent=n??""}}function zT(e){return this.tween("text",typeof e=="function"?PT(oc(this,"text",e)):LT(e==null?"":e+""))}function FT(e){return function(n){this.textContent=e.call(this,n)}}function UT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&FT(a)),n}return i._value=e,i}function HT(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,UT(e))}function jT(){for(var e=this._name,n=this._id,o=jh(),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=on(c,n);Dr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new An(i,this._parents,e,o)}function KT(){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=pn(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var GT=0;function An(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function jh(){return++GT}var $n=Hi.prototype;An.prototype={constructor:An,select:CT,selectAll:ST,selectChild:$n.selectChild,selectChildren:$n.selectChildren,filter:_T,merge:kT,selection:RT,transition:jT,call:$n.call,nodes:$n.nodes,node:$n.node,size:$n.size,empty:$n.empty,each:$n.each,on:wT,attr:oT,attrTween:sT,style:VT,styleTween:OT,text:zT,textTween:HT,remove:vT,tween:J$,delay:uT,duration:pT,ease:yT,easeVarying:bT,end:KT,[Symbol.iterator]:$n[Symbol.iterator]};function YT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qT={time:null,delay:0,duration:250,ease:YT};function WT(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 JT(e){var n,o;e instanceof An?(n=e._id,e=e._name):(n=jh(),(o=qT).time=Zs(),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])&&Dr(c,e,n,d,l,o||WT(c,n));return new An(i,this._parents,e,n)}Hi.prototype.interrupt=Y$,Hi.prototype.transition=JT;const Lr=e=>()=>e;function XT(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 Tn(e,n,o){this.k=e,this.x=n,this.y=o}Tn.prototype={constructor:Tn,scale:function(e){return e===1?this:new Tn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Tn(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 ic=new Tn(1,0,0);Tn.prototype;function ac(e){e.stopImmediatePropagation()}function Zi(e){e.preventDefault(),e.stopImmediatePropagation()}function ZT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QT(){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 Kh(){return this.__zoom||ic}function eM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tM(){return navigator.maxTouchPoints||"ontouchstart"in this}function nM(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 oM(){var e=ZT,n=QT,o=nM,i=eM,a=tM,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=P$,d=zs("start","zoom","end"),u,m,p,f=500,h=150,g=0,b=10;function _(w){w.property("__zoom",Kh).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(a).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(w,I,v,B){var M=w.selection?w.selection():w;M.property("__zoom",Kh),w!==M?k(w,I,v,B):M.interrupt().each(function(){S(this,arguments).event(B).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},_.scaleBy=function(w,I,v,B){_.scaleTo(w,function(){var M=this.__zoom.k,x=typeof I=="function"?I.apply(this,arguments):I;return M*x},v,B)},_.scaleTo=function(w,I,v,B){_.transform(w,function(){var M=n.apply(this,arguments),x=this.__zoom,P=v==null?y(M):typeof v=="function"?v.apply(this,arguments):v,Y=x.invert(P),se=typeof I=="function"?I.apply(this,arguments):I;return o(N(E(x,se),P,Y),M,l)},v,B)},_.translateBy=function(w,I,v,B){_.transform(w,function(){return o(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,B)},_.translateTo=function(w,I,v,B,M){_.transform(w,function(){var x=n.apply(this,arguments),P=this.__zoom,Y=B==null?y(x):typeof B=="function"?B.apply(this,arguments):B;return o(ic.translate(Y[0],Y[1]).scale(P.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),x,l)},B,M)};function E(w,I){return I=Math.max(r[0],Math.min(r[1],I)),I===w.k?w:new Tn(I,w.x,w.y)}function N(w,I,v){var B=I[0]-v[0]*w.k,M=I[1]-v[1]*w.k;return B===w.x&&M===w.y?w:new Tn(w.k,B,M)}function y(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function k(w,I,v,B){w.on("start.zoom",function(){S(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(B).end()}).tween("zoom",function(){var M=this,x=arguments,P=S(M,x).event(B),Y=n.apply(M,x),se=v==null?y(Y):typeof v=="function"?v.apply(M,x):v,he=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),ie=M.__zoom,fe=typeof I=="function"?I.apply(M,x):I,pe=c(ie.invert(se).concat(he/ie.k),fe.invert(se).concat(he/fe.k));return function(ge){if(ge===1)ge=fe;else{var Te=pe(ge),He=he/Te[2];ge=new Tn(He,se[0]-Te[0]*He,se[1]-Te[1]*He)}P.zoom(null,ge)}})}function S(w,I,v){return!v&&w.__zooming||new A(w,I)}function A(w,I){this.that=w,this.args=I,this.active=0,this.sourceEvent=null,this.extent=n.apply(w,I),this.taps=0}A.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,I){return this.mouse&&w!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var I=Yn(this.that).datum();d.call(w,this.that,new XT(w,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:d}),I)}};function V(w,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(w),B=this.__zoom,M=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),x=qn(w);if(v.wheel)(v.mouse[0][0]!==x[0]||v.mouse[0][1]!==x[1])&&(v.mouse[1]=B.invert(v.mouse[0]=x)),clearTimeout(v.wheel);else{if(B.k===M)return;v.mouse=[x,B.invert(x)],Or(this),v.start()}Zi(w),v.wheel=setTimeout(P,h),v.zoom("mouse",o(N(E(B,M),v.mouse[0],v.mouse[1]),v.extent,l));function P(){v.wheel=null,v.end()}}function T(w,...I){if(p||!e.apply(this,arguments))return;var v=w.currentTarget,B=S(this,I,!0).event(w),M=Yn(w.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",he,!0),x=qn(w,v),P=w.clientX,Y=w.clientY;m$(w.view),ac(w),B.mouse=[x,this.__zoom.invert(x)],Or(this),B.start();function se(ie){if(Zi(ie),!B.moved){var fe=ie.clientX-P,pe=ie.clientY-Y;B.moved=fe*fe+pe*pe>g}B.event(ie).zoom("mouse",o(N(B.that.__zoom,B.mouse[0]=qn(ie,v),B.mouse[1]),B.extent,l))}function he(ie){M.on("mousemove.zoom mouseup.zoom",null),f$(ie.view,B.moved),Zi(ie),B.event(ie).end()}}function D(w,...I){if(e.apply(this,arguments)){var v=this.__zoom,B=qn(w.changedTouches?w.changedTouches[0]:w,this),M=v.invert(B),x=v.k*(w.shiftKey?.5:2),P=o(N(E(v,x),B,M),n.apply(this,I),l);Zi(w),s>0?Yn(this).transition().duration(s).call(k,P,B,w):Yn(this).call(_.transform,P,B,w)}}function C(w,...I){if(e.apply(this,arguments)){var v=w.touches,B=v.length,M=S(this,I,w.changedTouches.length===B).event(w),x,P,Y,se;for(ac(w),P=0;P<B;++P)Y=v[P],se=qn(Y,this),se=[se,this.__zoom.invert(se),Y.identifier],M.touch0?!M.touch1&&M.touch0[2]!==se[2]&&(M.touch1=se,M.taps=0):(M.touch0=se,x=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),x&&(M.taps<2&&(m=se[0],u=setTimeout(function(){u=null},f)),Or(this),M.start())}}function R(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P,Y,se;for(Zi(w),x=0;x<M;++x)P=B[x],Y=qn(P,this),v.touch0&&v.touch0[2]===P.identifier?v.touch0[0]=Y:v.touch1&&v.touch1[2]===P.identifier&&(v.touch1[0]=Y);if(P=v.that.__zoom,v.touch1){var he=v.touch0[0],ie=v.touch0[1],fe=v.touch1[0],pe=v.touch1[1],ge=(ge=fe[0]-he[0])*ge+(ge=fe[1]-he[1])*ge,Te=(Te=pe[0]-ie[0])*Te+(Te=pe[1]-ie[1])*Te;P=E(P,Math.sqrt(ge/Te)),Y=[(he[0]+fe[0])/2,(he[1]+fe[1])/2],se=[(ie[0]+pe[0])/2,(ie[1]+pe[1])/2]}else if(v.touch0)Y=v.touch0[0],se=v.touch0[1];else return;v.zoom("touch",o(N(P,Y,se),v.extent,l))}}function $(w,...I){if(this.__zooming){var v=S(this,I).event(w),B=w.changedTouches,M=B.length,x,P;for(ac(w),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),x=0;x<M;++x)P=B[x],v.touch0&&v.touch0[2]===P.identifier?delete v.touch0:v.touch1&&v.touch1[2]===P.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(P=qn(P,this),Math.hypot(m[0]-P[0],m[1]-P[1])<b)){var Y=Yn(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(w){return arguments.length?(i=typeof w=="function"?w:Lr(+w),_):i},_.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Lr(!!w),_):e},_.touchable=function(w){return arguments.length?(a=typeof w=="function"?w:Lr(!!w),_):a},_.extent=function(w){return arguments.length?(n=typeof w=="function"?w:Lr([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),_):n},_.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],_):[r[0],r[1]]},_.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(w){return arguments.length?(o=w,_):o},_.duration=function(w){return arguments.length?(s=+w,_):s},_.interpolate=function(w){return arguments.length?(c=w,_):c},_.on=function(){var w=d.on.apply(d,arguments);return w===d?_:w},_.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,_):Math.sqrt(g)},_.tapDistance=function(w){return arguments.length?(b=+w,_):b},_}const Gh=Symbol("MiniMapSlots"),iM=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],aM={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},rM=t.defineComponent({...aM,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(Gh),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,p)=>!m.hidden&&m.dimensions.width!==0&&m.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,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.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,iM))],64)):t.createCommentVNode("",!0)}}),lM=["width","height","viewBox","aria-labelledby"],sM=["id"],cM=["d","fill","stroke","stroke-width"],dM={name:"MiniMap",compatConfig:{MODE:3}},uM=t.defineComponent({...dM,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:u,emits:m,d3Selection:p,d3Zoom:f,getNodesInitialized:h}=tt(),g=t.ref();t.provide(Gh,o);const b=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),_=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",N=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),y=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),k=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),S=t.computed(()=>hs(h.value.filter(M=>!M.hidden))),A=t.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})),V=t.computed(()=>h.value&&h.value.length?pN(S.value,A.value):A.value),T=t.computed(()=>{const M=V.value.width/b.value,x=V.value.height/_.value;return Math.max(M,x)}),D=t.computed(()=>{const M=T.value*b.value,x=T.value*_.value,P=e.offsetScale*T.value;return{offset:P,x:V.value.x-(M-V.value.width)/2-P,y:V.value.y-(x-V.value.height)/2-P,width:M+P*2,height:x+P*2}}),C=t.computed(()=>!D.value.x||!D.value.y?"":`
|
|
53
53
|
M${D.value.x-D.value.offset},${D.value.y-D.value.offset}
|
|
54
54
|
h${D.value.width+D.value.offset*2}
|
|
55
55
|
v${D.value.height+D.value.offset*2}
|
|
@@ -62,5 +62,5 @@ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will
|
|
|
62
62
|
h${-(A.value.width-2*e.maskBorderRadius)}
|
|
63
63
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
64
64
|
v${-(A.value.height-2*e.maskBorderRadius)}
|
|
65
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(g.value){const x=Yn(g.value),P=he=>{if(he.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const ie=he.sourceEvent.ctrlKey&&zi()?10:1,fe=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*e.zoomStep,pe=c.value.zoom*2**(fe*ie);f.value.scaleTo(p.value,pe)},Y=he=>{if(he.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const ie=T.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),fe={x:c.value.x-he.sourceEvent.movementX*ie,y:c.value.y-he.sourceEvent.movementY*ie},pe=[[0,0],[u.value.width,u.value.height]],ge=ic.translate(fe.x,fe.y).scale(c.value.zoom),Te=f.value.constrain()(ge,pe,d.value);f.value.transform(p.value,Te)},se=oM().wheelDelta(he=>ys(he)*(e.zoomStep/10)).on("zoom",e.pannable?Y:()=>{}).on("zoom.wheel",e.zoomable?P:()=>{});x.call(se),M(()=>{x.on("zoom",null)})}},{flush:"post"});function R(M){const[x,P]=qn(M);n("click",{event:M,position:{x,y:P}})}function $(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeClick(P),n("nodeClick",P)}function w(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeDoubleClick(P),n("nodeDblclick",P)}function I(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseEnter(P),n("nodeMouseenter",P)}function v(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseMove(P),n("nodeMousemove",P)}function B(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseLeave(P),n("nodeMouseleave",P)}return(M,x)=>(t.openBlock(),t.createBlock(t.unref(ep),{position:M.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:M.pannable,zoomable:M.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:b.value,height:_.value,viewBox:[D.value.x,D.value.y,D.value.width,D.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:R},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,sM)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),P=>(t.openBlock(),t.createBlock(rM,{id:P.id,key:P.id,f:"",position:P.computedPosition,dimensions:P.dimensions,selected:P.selected,dragging:P.dragging,style:t.normalizeStyle(P.style),class:t.normalizeClass(E.value(P)),color:N.value(P),"border-radius":M.nodeBorderRadius,"stroke-color":y.value(P),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(k),type:P.type,hidden:P.hidden,onClick:Y=>$(Y,P),onDblclick:Y=>w(Y,P),onMouseenter:Y=>I(Y,P),onMousemove:Y=>v(Y,P),onMouseleave:Y=>B(Y,P)},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:C.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,cM)],8,lM))]),_:1},8,["position","class"]))}}),mM=["d"],fM=["cx","cy","onDblclick"],pM=["x","y","onPointerdown","onDblclick"],hM=Qe(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(Ps),a=t.inject(Gn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(vo,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),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((V,T)=>T===d.value?u.value:V)),{source:p,target:f,sourceSide:h,targetSide:g}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),b=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Bs(p.value,h.value,m.value,f.value,g.value):Ds(p.value,m.value,f.value)),_=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Lp(p.value,h.value,m.value,f.value,g.value):Fp(p.value,m.value,f.value).map((V,T)=>({point:V,segIndex:T})):[]),k=t.computed(()=>r.value?m.value:[]);function N(V,T){d.value=V,u.value={...c.value[V]},T.target.setPointerCapture(T.pointerId),T.stopPropagation()}function y(V){if(d.value<0)return;const T=o({x:V.clientX,y:V.clientY});u.value={x:T.x,y:T.y}}function E(V){var T,D;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(D=(T=V.target).releasePointerCapture)==null||D.call(T,V.pointerId)}function S(V,T){T.stopPropagation(),i==null||i.removePoint(n.id,V)}function A(V,T){if(!i)return;const D=o({x:T.clientX,y:T.clientY});i.insertPoint(n.id,V,{x:D.x,y:D.y})}return(V,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,mM),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(D,C)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${C}`,cx:D.point.x,cy:D.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(R=>A(D.segIndex,R),["stop"])},null,42,fM))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,(D,C)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${C}`,x:D.x-5,y:D.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:R=>N(C,R),onPointermove:y,onPointerup:E,onDblclick:R=>S(C,R)},null,42,pM))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),yM=["d"],gM=Qe(t.defineComponent({inheritAttrs:!1,__name:"SerializedTypeEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=t.inject(vo,null),a=t.computed(()=>!!i&&i.active.value&&(!i.relatedEntityIds.value.has(n.data.consumerRef)||!i.relatedEntityIds.value.has(n.data.typeRef))),{source:r,target:l,sourceSide:s,targetSide:c}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>[]}),d=t.computed(()=>(o==null?void 0:o.routingMode.value)==="orthogonal"?Bs(r.value,s.value,[],l.value,c.value):Ds(r.value,[],l.value));return(u,m)=>(t.openBlock(),t.createElementBlock("path",{d:d.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"2 5","stroke-linecap":"round",class:t.normalizeClass(["em-serialized-edge__path",{"is-dimmed":a.value}])},null,10,yM))}}),[["__scopeId","data-v-67430658"]]),bM=["data-theme"],_M={key:0,class:"em-ctx__sep",role:"separator"},kM=["aria-label"],EM={class:"em-ctx__swatches-label","aria-hidden":"true"},NM={class:"em-ctx__chips",role:"none"},wM=["aria-checked","aria-label","title","onClick"],IM=["aria-checked","aria-label","title","onClick"],vM=["disabled","onClick"],CM={class:"em-ctx__icon"},SM={class:"em-ctx__caption"},xM=Qe(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(N,y)=>en(o.locale??"ko",N,y),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(N,y){var A,V;r.value=y,l.value=(A=N.target)!=null&&A.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=N.clientX,c.y=N.clientY,a.value=!0,window.addEventListener("keydown",b),window.addEventListener("resize",p),await t.nextTick();const E=s.value;if(!E)return;const S=E.getBoundingClientRect();c.x+S.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-S.width)),c.y+S.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-S.height)),(V=f()[0])==null||V.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",b),window.removeEventListener("resize",p);const N=d;d=null,N!=null&&N.isConnected&&N.focus()}function f(){const N=s.value;if(!N)return[];const y=[];for(const E of Array.from(N.children))if(E.classList.contains("em-ctx__item"))E.disabled||y.push(E);else if(E.classList.contains("em-ctx__swatches")){const S=Array.from(E.querySelectorAll(".em-ctx__chip"));S.length&&y.push(S.find(A=>A===document.activeElement)??S[0])}return y}function h(N){var A;const y=f();if(!y.length)return;const E=y.indexOf(document.activeElement),S=E<0?N>0?0:y.length-1:(E+N+y.length)%y.length;(A=y[S])==null||A.focus()}function g(N){var A,V;const y=(A=document.activeElement)==null?void 0:A.closest(".em-ctx__swatches");if(!y)return!1;const E=Array.from(y.querySelectorAll(".em-ctx__chip")),S=E.indexOf(document.activeElement);return S<0?!1:((V=E[(S+N+E.length)%E.length])==null||V.focus(),!0)}function b(N){var y,E;switch(N.key){case"Escape":N.stopPropagation(),p();return;case"ArrowDown":N.preventDefault(),h(1);return;case"ArrowUp":N.preventDefault(),h(-1);return;case"ArrowRight":g(1)&&N.preventDefault();return;case"ArrowLeft":g(-1)&&N.preventDefault();return;case"Home":N.preventDefault(),(y=f()[0])==null||y.focus();return;case"End":{N.preventDefault();const S=f();(E=S[S.length-1])==null||E.focus();return}case"Tab":N.preventDefault(),h(N.shiftKey?-1:1)}}function _(N){N.disabled||(N.handler(),p())}function k(N,y){N.onPick(y),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(N,y)=>(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:p,onContextmenu:t.withModifiers(p,["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:y[0]||(y[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(E,S)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S},[E.type==="separator"?(t.openBlock(),t.createElementBlock("div",_M)):E.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":E.caption},[t.createElementVNode("span",EM,t.toDisplayString(E.caption),1),t.createElementVNode("div",NM,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":E.current===null}]),role:"menuitemradio","aria-checked":E.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:A=>k(E,null)},null,10,wM),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":E.current===A}]),style:t.normalizeStyle({background:t.unref(Qo)(A)}),role:"menuitemradio","aria-checked":E.current===A,"aria-label":i(t.unref(wo)(A)),title:i(t.unref(wo)(A)),onClick:V=>k(E,A)},null,14,IM))),128))])],8,kM)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":E.danger,"is-disabled":E.disabled}]),disabled:E.disabled,role:"menuitem",onClick:A=>_(E)},[t.createElementVNode("span",CM,[E.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:E.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",SM,t.toDisplayString(E.caption),1)],10,vM))],64))),128))],36)],8,bM)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function rc(e,n){return`serialized:${e}:${n}`}function Yh(e){const n=Mo(e);if(n.size===0)return[];const o=new Map;for(const i of e.entities)for(const a of i.attributes){if(a.attrType!=="NORMAL")continue;const r=di(a,n,i,e);if(r.kind!=="resolved")continue;const l=r.entity;if(l.modelId===i.modelId)continue;const s=rc(i.modelId,l.modelId),c=o.get(s);c?c.usageCount++:o.set(s,{consumerRef:i.modelId,typeRef:l.modelId,usageCount:1})}return[...o.values()]}function qh(e,n){return n?`${e}:${n}`:e}function Wh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(qh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function RM(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=qh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function Jh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(Wh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=Wh(e.storageKey,s)),t.watch(o,s=>RM(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const lc=[".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 ai(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function AM(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function $M(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 h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=n(h.left,h.top+h.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,p=0;const f=()=>{const h=d.trim();if(h){const g=n(m,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return f(),c}function Pr(e,n){const o=[];for(const i of e.querySelectorAll("*"))AM(i)&&(i.closest(lc)||ai(i)&&o.push(...$M(i,n)));return o}function Qi(e){return Math.round(e*100)/100}function TM(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(lc)||!ai(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="${Qi(r.x)}" y="${Qi(r.y)}" width="${Qi(l.x-r.x)}" height="${Qi(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 MM(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!ai(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=>Qi(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 Xh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(lc)||!ai(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 ea(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 sc(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 VM(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!ai(h))continue;const g=h.firstElementChild;if(g)if(f.type==="group"){const b=ea(g,o);sc(s,b),i.push({...b,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...ea(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Pr(g,o)})}else if(f.type==="note"){const b={...ea(g,o),texts:Pr(g,o),lines:Xh(g,g,o)};sc(s,b),r.push(b)}else{const b=ea(g,o);sc(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const k=g.querySelector(".em-entity__header");if(k){const N=ea(k,o);a.push({x:b.x,y:b.y,w:b.w,h:N.y+N.h-b.y,fill:N.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Pr(g,o),lines:Xh(g,g,o),icons:TM(g,o)}),a.push({...b,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!ai(h))continue;const g=h.getAttribute("d");if(!g)continue;const b=getComputedStyle(h),_=b.strokeDasharray,k=MM(f);l.push({d:g,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:Pr(f,o),markers:k.length?k:void 0})}const c=n.closest(".em-canvas")??n,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 cc(e){return Zc(VM(e))}function Zh(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 Qh(e,n="diagram.svg"){const o=cc(e);Zh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function BM(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 ey(e,n="diagram.png",o=2){const i=cc(e),{w:a,h:r}=BM(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,p)=>{s.onload=()=>m(),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 u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");Zh(u,n)}finally{URL.revokeObjectURL(l)}}const DM={class:"em-shortcuts"},OM={class:"em-shortcuts__list"},LM={class:"em-shortcuts__title"},PM={class:"em-shortcuts__keys"},zM={class:"em-shortcuts__kbd"},FM={key:0,class:"em-shortcuts__plus"},UM={class:"em-shortcuts__desc"},HM={class:"em-shortcuts__actions"},ty=Qe(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(s,c)=>en(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.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{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(oe.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",DM,[t.createElementVNode("div",OM,[(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",LM,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",PM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",zM,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",FM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",UM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",HM,[t.createVNode(t.unref(oe.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-38f2450f"]]);function ri(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function jM(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 KM=["aria-label"],GM=["aria-activedescendant","aria-label","placeholder"],YM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},qM=["aria-label"],WM={class:"em-cmdk__section","aria-hidden":"true"},JM=["id","aria-selected","onMouseenter","onClick"],XM={class:"em-cmdk__label"},ZM={key:0,class:"em-cmdk__tag"},QM={key:1,class:"em-cmdk__sub"},e2=["aria-label"],t2={class:"em-cmdk__section","aria-hidden":"true"},n2=["id","aria-selected","aria-disabled","onMouseenter","onClick"],o2={class:"em-cmdk__label"},i2={key:1,class:"em-cmdk__empty"},a2=Qe(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 E=c.value,S=a.state.logical.entities.map(V=>{var T,D,C,R,$,w;return{type:"goto",kind:"entity",id:V.modelId,label:((D=(T=V.table)==null?void 0:T.logicalName)==null?void 0:D[E])||V.name,sub:(C=V.table)==null?void 0:C.physicalName,match:ri(V.name,($=(R=V.table)==null?void 0:R.logicalName)==null?void 0:$[E],(w=V.table)==null?void 0:w.physicalName)??""}}),A=a.state.logical.groups.map(V=>{var T,D,C,R;return{type:"goto",kind:"group",id:V.modelId,label:((T=V.name)==null?void 0:T[E])||((D=V.name)==null?void 0:D.ko)||V.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:ri((C=V.name)==null?void 0:C[E],(R=V.name)==null?void 0:R.ko,V.packageName)??""}});return[...S,...A]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const E=[];a.editable.value&&(E.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),E.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),E.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),E.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),E.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),E.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),E.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),E.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const S of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])E.push({type:"action",id:`dm-${S}`,label:a.t(u[S]),run:()=>a.displayMode.value=S});return E});function p(E,S){return E.label.toLowerCase().includes(S)}const f=t.computed(()=>{const E=r.value.trim().toLowerCase();return E?d.value.filter(S=>S.match.includes(E)):d.value}),h=t.computed(()=>{const E=r.value.trim().toLowerCase();return E?m.value.filter(S=>p(S,E)):m.value}),g=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function b(E){return g.value.indexOf(E)}const _=E=>`em-cmdk-opt-${E}`,k=t.computed(()=>g.value[l.value]?_(l.value):void 0);t.watch(l,async()=>{var S;await t.nextTick();const E=k.value;E&&((S=document.getElementById(E))==null||S.scrollIntoView({block:"nearest"}))});function N(E){if(E.type==="goto")a.selection.value={kind:E.kind,id:E.id},a.requestFocus(E.id);else{if(E.disabled)return;E.run()}i("close")}function y(E){if(E.key==="Escape"){i("close"),E.preventDefault();return}if(E.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),E.preventDefault();return}if(E.key==="ArrowUp"){l.value=Math.max(l.value-1,0),E.preventDefault();return}if(E.key==="Enter"){const S=g.value[l.value];S&&N(S),E.preventDefault();return}E.key==="Tab"&&E.preventDefault()}return t.nextTick(()=>{var E;return(E=s.value)==null?void 0:E.focus()}),(E,S)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:S[1]||(S[1]=t.withModifiers(A=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":S[0]||(S[0]=A=>r.value=A),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":k.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:y},null,40,GM),[[t.vModelText,r.value]]),t.createElementVNode("div",YM,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",WM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(b(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":b(A)===l.value}]),role:"option","aria-selected":b(A)===l.value,onMouseenter:V=>l.value=b(A),onClick:V=>N(A)},[t.createElementVNode("span",XM,t.toDisplayString(A.label),1),A.tag?(t.openBlock(),t.createElementBlock("span",ZM,t.toDisplayString(A.tag),1)):A.sub?(t.openBlock(),t.createElementBlock("span",QM,t.toDisplayString(A.sub),1)):t.createCommentVNode("",!0)],42,JM))),128))],8,qM)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",t2,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(b(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":b(A)===l.value,"is-disabled":A.disabled}]),role:"option","aria-selected":b(A)===l.value,"aria-disabled":A.disabled||void 0,onMouseenter:V=>l.value=b(A),onClick:V=>N(A)},[t.createElementVNode("span",o2,t.toDisplayString(A.label),1)],42,n2))),128))],8,e2)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",i2,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,KM)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function r2(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const l2={key:0,class:"em-canvas__empty","aria-hidden":"true"},s2={class:"em-canvas__empty-title"},c2=["innerHTML"],d2=["innerHTML"],u2=["innerHTML"],m2={key:1,class:"em-canvas__empty-title"},f2={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},p2={class:"em-conflict-banner__body"},h2={class:"em-conflict-banner__title"},y2={class:"em-conflict-banner__detail"},g2={key:0,class:"em-toast",role:"status","aria-live":"polite"},dc="nc:",ny=Qe(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=oe.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(O){l.value=O,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,O=>{O&&c(O.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const O=r2(i.opConflict.value);return O?{title:i.t(O.titleKey),detail:i.t(O.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(O){p.x=O.clientX,p.y=O.clientY}const h=t.ref(null);t.provide(br,h);const g=t.ref(null);t.provide(Np,g);const b=t.ref(null),_=t.computed(()=>{const O=b.value,U=new Set;if(!O)return U;if(O.kind==="entity")U.add(O.id);else if(O.kind==="group"){const le=i.resolved.value.groups.find(ne=>ne.group.modelId===O.id);for(const ne of(le==null?void 0:le.group.memberEntityRefs)??[])U.add(ne)}return U}),k=t.computed(()=>{const O=b.value,U=new Set(_.value),le=new Set,ne=new Set;if(!O)return{related:U,edges:le,notes:ne};if(O.kind==="note"){ne.add(O.id);for(const Be of i.resolved.value.noteConnections)Be.noteRef===O.id&&U.add(Be.targetRef);return{related:U,edges:le,notes:ne}}const xe=_.value;if(!xe.size)return{related:U,edges:le,notes:ne};for(const Be of i.resolved.value.associations){const{end1:qe,end2:je}=Be.association;(xe.has(qe.entityRef)||xe.has(je.entityRef))&&(le.add(Be.association.modelId),U.add(qe.entityRef),U.add(je.entityRef))}for(const Be of i.resolved.value.noteConnections)U.has(Be.targetRef)&&ne.add(Be.noteRef);return{related:U,edges:le,notes:ne}});t.provide(vo,{source:b,active:t.computed(()=>b.value!==null),primaryEntityIds:_,relatedEntityIds:t.computed(()=>k.value.related),relatedEdgeIds:t.computed(()=>k.value.edges),relatedNoteIds:t.computed(()=>k.value.notes),hoverGroupId:t.computed(()=>{var O;return((O=b.value)==null?void 0:O.kind)==="group"?b.value.id:null}),setEntityHover:O=>{g.value||m.value||(b.value=O?{kind:"entity",id:O}:null)},setGroupHover:O=>{g.value||m.value||(b.value=O?{kind:"group",id:O}:null)},setNoteHover:O=>{g.value||m.value||(b.value=O?{kind:"note",id:O}:null)}}),t.provide(Gn,i);const N=KS(),y=t.computed(()=>N(i.state.logical,i.embeddableCatalog.value));t.provide(vp,y);const E=Jh({expandableKeys:()=>[],defaultCollapsed:WS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(xp,{isCollapsed:E.isCollapsed,toggle:E.toggle}),t.provide(wp,{marks:t.toRef(o,"diffMarks")});function S(O,U){return`${dc}${O}:${U}`}function A(O){if(!O.startsWith(dc))return null;const[U,le]=O.slice(dc.length).split(":");return U&&le?{noteRef:U,targetRef:le}:null}t.provide(Ps,{points:O=>{var le,ne;const U=A(O);return U?((le=i.resolved.value.noteConnections.find(xe=>xe.noteRef===U.noteRef&&xe.targetRef===U.targetRef))==null?void 0:le.waypoints)??[]:((ne=i.resolved.value.associations.find(xe=>xe.association.modelId===O))==null?void 0:ne.waypoints)??[]},movePoint:(O,U,le)=>{const ne=A(O);ne?i.moveNoteConnectionWaypoint(ne.noteRef,ne.targetRef,U,le):i.moveWaypoint(O,U,le)},insertPoint:(O,U,le)=>{const ne=A(O);ne?i.addNoteConnectionWaypoint(ne.noteRef,ne.targetRef,U,le):i.addWaypoint(O,U,le)},removePoint:(O,U)=>{const le=A(O);le?i.removeNoteConnectionWaypoint(le.noteRef,le.targetRef,U):i.removeWaypoint(O,U)}});const V=tt(),{nodes:T,edges:D,findNode:C,findEdge:R,addNodes:$,addEdges:w,removeNodes:I,removeEdges:v,fitView:B,setCenter:M,getViewport:x,screenToFlowCoordinate:P,getSelectedNodes:Y,updateNodeInternals:se}=V,he=t.ref(!1);async function ie(O){he.value=!0,await t.nextTick(),await new Promise(U=>requestAnimationFrame(()=>U(null)));try{return await O()}finally{he.value=!1}}async function fe(){try{await ie(()=>Qh(V))}catch(O){console.error("[entity-modeler] SVG export failed",O),c(i.t("em.canvas.exportFailed"))}}async function pe(){try{await ie(()=>ey(V))}catch(O){console.error("[entity-modeler] PNG export failed",O),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:fe,exportPng:pe,fitView:B});const ge=t.computed(()=>i.resolved.value.entities.length===0);function Te(){const O=x(),{width:U,height:le}=V.dimensions.value;return{x:(U/2-O.x)/O.zoom,y:(le/2-O.y)/O.zoom}}function He(){const O=Te();i.addEntity("NewEntity",{x:O.x,y:O.y})}function De(){const O=Te();i.addNote("메모",{x:O.x,y:O.y})}function Z(O){for(const U of i.resolved.value.groups){const{location:le,size:ne}=U.geo;if(O.x>=le.x&&O.x<=le.x+ne.width&&O.y>=le.y&&O.y<=le.y+ne.height)return U.group.modelId}return null}function re(O,U){return O.x===U.x&&O.y===U.y}function ue(O,U){return(O==null?void 0:O.width)===(U==null?void 0:U.width)&&(O==null?void 0:O.height)===(U==null?void 0:U.height)}function z(O,U){return O.entity===U.entity&&O.displayMode===U.displayMode&&O.collapsed===U.collapsed&&O.locked===U.locked&&O.groupRef===U.groupRef&&ue(O.size,U.size)&&O.style===U.style&&O.attributeStyles===U.attributeStyles&&O.operationStyles===U.operationStyles}function L(O,U){const le=Object.keys(O);if(le.length!==Object.keys(U).length)return!1;for(const ne of le)if(ne==="geo"){const xe=O.geo,Be=U.geo;if(!re(xe.location,Be.location)||!ue(xe.size,Be.size))return!1}else if(O[ne]!==U[ne])return!1;return!0}function F(){const O=i.resolved.value,U=new Map(O.groups.map(Ie=>[Ie.group.modelId,Ie.geo])),le=new Set(O.groups.map(Ie=>Ie.group.modelId)),ne=new Set([...le,...O.entities.map(Ie=>Ie.entity.modelId),...O.notes.map(Ie=>Ie.note.modelId)]);for(const Ie of[...T.value])ne.has(Ie.id)||I([Ie.id]);for(const Ie of O.groups){const Je=Ie.group.modelId,j={width:`${Ie.geo.size.width}px`,height:`${Ie.geo.size.height}px`},K={group:Ie.group,style:Ie.style,locked:Ie.locked},ve=Ie.locked?!1:void 0,Re=C(Je);if(Re){re(Re.position,Ie.geo.location)||(Re.position={...Ie.geo.location});const me=Re.data;(me.group!==K.group||me.style!==K.style||me.locked!==K.locked)&&(Re.data=K);const Ue=Re.style;((Ue==null?void 0:Ue.width)!==j.width||(Ue==null?void 0:Ue.height)!==j.height)&&(Re.style=j),Re.draggable!==ve&&(Re.draggable=ve)}else $([{id:Je,type:"group",position:{...Ie.geo.location},draggable:ve,style:j,data:K}])}for(const Ie of O.entities){const Je=Ie.entity.modelId,j=Ie.groupRef&&le.has(Ie.groupRef)?Ie.groupRef:void 0,K={entity:Ie.entity,displayMode:i.displayMode.value,collapsed:Ie.collapsed,locked:Ie.locked,groupRef:j,size:Ie.geo.size,style:Ie.style,attributeStyles:Ie.attributeStyles,operationStyles:Ie.operationStyles},ve=Ie.locked?!1:void 0,Re=Ie.locked?!1:void 0,me=j?U.get(j):void 0,Ue=me?{x:Ie.geo.location.x-me.location.x,y:Ie.geo.location.y-me.location.y}:{...Ie.geo.location},Ye=C(Je);Ye?(re(Ye.position,Ue)||(Ye.position=Ue),z(Ye.data,K)||(Ye.data=K),Ye.parentNode!==j&&(Ye.parentNode=j),Ye.draggable!==ve&&(Ye.draggable=ve),Ye.connectable!==Re&&(Ye.connectable=Re)):$([{id:Je,type:"entity",position:Ue,parentNode:j,draggable:ve,connectable:Re,data:K}])}for(const Ie of O.notes){const Je=Ie.note,j=Je.modelId,K=Ie.groupRef&&le.has(Ie.groupRef)?Ie.groupRef:void 0,ve={note:Je,groupRef:K},Re={width:`${Je.geo.size.width}px`,height:`${Je.geo.size.height}px`},me=K?U.get(K):void 0,Ue=me?{x:Je.geo.location.x-me.location.x,y:Je.geo.location.y-me.location.y}:{...Je.geo.location},Ye=C(j);if(Ye){re(Ye.position,Ue)||(Ye.position=Ue);const pt=Ye.data;(pt.groupRef!==K||!L(pt.note,Je))&&(Ye.data=ve);const Pt=Ye.style;((Pt==null?void 0:Pt.width)!==Re.width||(Pt==null?void 0:Pt.height)!==Re.height)&&(Ye.style=Re),Ye.parentNode!==K&&(Ye.parentNode=K)}else $([{id:j,type:"note",position:Ue,parentNode:K,style:Re,data:ve}])}const xe=new Map(O.associations.map(Ie=>[Ie.association.modelId,Ie])),Be=new Set(O.noteConnections.map(Ie=>S(Ie.noteRef,Ie.targetRef))),qe=Yh(i.state.logical).filter(Ie=>C(Ie.consumerRef)&&C(Ie.typeRef)),je=new Set(qe.map(Ie=>rc(Ie.consumerRef,Ie.typeRef)));for(const Ie of[...D.value])!xe.has(Ie.id)&&!Be.has(Ie.id)&&!je.has(Ie.id)&&v([Ie.id]);for(const[Ie,Je]of xe){const j={id:Ie,type:"association",source:Je.association.end1.entityRef,target:Je.association.end2.entityRef,sourceHandle:Je.sourceColumnRef?`r:${Je.sourceColumnRef}`:void 0,targetHandle:Je.targetColumnRef?`l:${Je.targetColumnRef}`:void 0,data:{association:Je.association,sourceColumnRef:Je.sourceColumnRef,targetColumnRef:Je.targetColumnRef}},K=R(Ie);if(K){const ve=K.data;(ve.association!==j.data.association||ve.sourceColumnRef!==j.data.sourceColumnRef||ve.targetColumnRef!==j.data.targetColumnRef)&&(K.data=j.data),K.sourceHandle!==j.sourceHandle&&(K.sourceHandle=j.sourceHandle),K.targetHandle!==j.targetHandle&&(K.targetHandle=j.targetHandle)}else w([j])}for(const Ie of O.noteConnections){const Je=S(Ie.noteRef,Ie.targetRef),j={noteRef:Ie.noteRef,targetRef:Ie.targetRef};R(Je)||w([{id:Je,type:"note-connection",source:Ie.noteRef,target:Ie.targetRef,data:j}])}for(const Ie of qe){const Je=rc(Ie.consumerRef,Ie.typeRef),j={consumerRef:Ie.consumerRef,typeRef:Ie.typeRef,usageCount:Ie.usageCount},K=R(Je);K?K.data.usageCount!==j.usageCount&&(K.data=j):w([{id:Je,type:"serialized-type",source:Ie.consumerRef,target:Ie.typeRef,data:j}])}}const X=new Set;let ee=!1,ke=!1;const ye=new Map;function Ne(O){const U=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(O)}"]`);if(!U)return null;let le=`${U.offsetHeight}`;for(const ne of U.querySelectorAll(".em-entity__row"))le+=`|${ne.dataset.attr}:${ne.offsetTop}`;return le}function we(){ke=!1;const O=ee;ee=!1;const U=[...X];if(X.clear(),O){se();for(const ne of T.value){const xe=Ne(ne.id);xe!==null&&ye.set(ne.id,xe)}return}const le=[];for(const ne of U){const xe=Ne(ne);if(xe===null){ye.delete(ne);continue}ye.get(ne)!==xe&&(ye.set(ne,xe),le.push(ne))}le.length&&se(le)}function G(O){if(O)for(const U of O)X.add(U);else ee=!0;ke||(ke=!0,t.nextTick(()=>requestAnimationFrame(we)))}t.provide(Ip,{mark:O=>G([O])});function q(){const O=Y.value.map(le=>le.id);if(O.length)return O;const U=i.selection.value;return U&&(U.kind==="entity"||U.kind==="note"||U.kind==="group")?[U.id]:[]}function W(){return Y.value.filter(O=>O.type==="entity").map(O=>O.id)}function Ce(){return Y.value.filter(O=>O.type==="group").map(O=>O.id)}function $e(O){var U;return[...((U=i.state.logical.groups.find(le=>le.modelId===O))==null?void 0:U.memberEntityRefs)??[]]}function ze(){const O=Ce().flatMap($e);return[...new Set([...W(),...O])]}function Fe(){return Ce().length>0||W().length>1}function ae(){Fe()?i.copy(ze()):i.copy()}async function Se(O){if(!O.length)return;await t.nextTick();const U=Y.value;U.length&&V.removeSelectedNodes(U);const le=O.map(ne=>C(ne)).filter(ne=>!!ne);le.length&&V.addSelectedNodes(le)}function Ge(O){if(Fe()&&W().includes(O)){const U=ze();return{caption:i.t("em.ctx.copyN",{n:U.length}),icon:"copy",handler:()=>i.copy(U)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:O},i.copy()}}}function et(O){var xe;const U=O.target;if(U&&(U.tagName==="INPUT"||U.tagName==="TEXTAREA"||U.isContentEditable))return;if(O.key==="?"){a.openModal({component:ty,bind:{locale:i.uiLocale.value}}),O.preventDefault();return}if((O.metaKey||O.ctrlKey)&&O.key.toLowerCase()==="k"){r.value=!0,O.preventDefault();return}if(!i.editable.value){(O.metaKey||O.ctrlKey)&&O.key.toLowerCase()==="c"&&(ae(),O.preventDefault());return}if(O.key==="Delete"||O.key==="Backspace"){i.deleteSelection()&&O.preventDefault();return}if(O.key==="ArrowUp"||O.key==="ArrowDown"||O.key==="ArrowLeft"||O.key==="ArrowRight"){if(((xe=i.selection.value)==null?void 0:xe.kind)==="attribute"){if(O.key==="ArrowUp"||O.key==="ArrowDown"){const Ie=O.key==="ArrowDown"?1:-1;(O.altKey?i.nudgeSelectedAttributes(Ie):i.moveAttributeFocus(Ie))&&O.preventDefault()}return}const Be=O.shiftKey?10:1,qe=O.key==="ArrowLeft"?-Be:O.key==="ArrowRight"?Be:0,je=O.key==="ArrowUp"?-Be:O.key==="ArrowDown"?Be:0;i.nudgeNodes(q(),qe,je)&&O.preventDefault();return}if(!(O.metaKey||O.ctrlKey))return;const ne=O.key.toLowerCase();ne==="c"?(ae(),O.preventDefault()):ne==="v"?(Se(i.paste()),O.preventDefault()):ne==="z"&&(O.shiftKey?i.redo():i.undo(),O.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),B(),G(),window.addEventListener("keydown",et),window.addEventListener("pointerup",te),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",et),window.removeEventListener("pointerup",te),window.removeEventListener("pointermove",f)});function te(){h.value=null}function de(){m.value=!0,b.value=null}function Le(){var ne;m.value=!1;const O=(ne=document.elementFromPoint(p.x,p.y))==null?void 0:ne.closest(".vue-flow__node"),U=O==null?void 0:O.dataset.id;if(!U){b.value=null;return}const le=O.classList.contains("vue-flow__node-group")?"group":O.classList.contains("vue-flow__node-note")?"note":"entity";b.value={kind:le,id:U}}const dt=t.computed(()=>Yh(i.state.logical).map(O=>`${O.consumerRef}>${O.typeRef}:${O.usageCount}`).sort().join("|"));t.watch([()=>i.resolved.value,()=>i.displayMode.value,()=>dt.value],F),t.watch(()=>i.resolved.value,O=>{const U=b.value;if(!U)return;(U.kind==="entity"?O.entities.some(ne=>ne.entity.modelId===U.id):U.kind==="group"?O.groups.some(ne=>ne.group.modelId===U.id):O.notes.some(ne=>ne.note.modelId===U.id))||(b.value=null)});function Xe(O){const U=O.computedPosition??O.position,le=O.dimensions??{width:0,height:0};return{x:U.x+le.width/2,y:U.y+le.height/2}}function yt(O){const U=O.node;if(U){if(b.value=null,U.type==="group"){const le=i.resolved.value.groups.find(ne=>ne.group.modelId===U.id);g.value=le?{groupId:U.id,dx:U.position.x-le.geo.location.x,dy:U.position.y-le.geo.location.y}:null,h.value=null;return}if(U.type!=="entity"&&U.type!=="note"){h.value=null;return}h.value=Z(Xe(U))}}function st(O){var ne;h.value=null,g.value=null;const U=(ne=O.nodes)!=null&&ne.length?O.nodes:[O.node],le=U.filter(xe=>(xe==null?void 0:xe.type)==="group");if(le.length){for(const xe of le){if(!xe)continue;const Be=i.resolved.value.entities.filter(qe=>qe.groupRef===xe.id).map(qe=>{const je=C(qe.entity.modelId),Ie=(je==null?void 0:je.computedPosition)??(je==null?void 0:je.position)??{x:0,y:0};return{id:qe.entity.modelId,location:{x:Ie.x,y:Ie.y}}});i.dragGroup(xe.id,{x:xe.position.x,y:xe.position.y},Be)}return}for(const xe of U){if(!xe||xe.type==="group")continue;const Be=xe.computedPosition??xe.position,qe=xe.dimensions??{width:0,height:0},je={x:Be.x+qe.width/2,y:Be.y+qe.height/2};xe.type==="note"?i.dropNote(xe.id,{x:Be.x,y:Be.y},Z(je)):i.dropEntity(xe.id,{x:Be.x,y:Be.y},Z(je))}}function ft(O){var j,K,ve,Re,me;if(!i.editable.value||!O.source||!O.target)return;const U=((j=C(O.source))==null?void 0:j.type)==="note",le=((K=C(O.target))==null?void 0:K.type)==="note";if(U||le){if(U&&le)return;const Ue=U?O.source:O.target,Ye=U?O.target:O.source;((ve=C(Ye))==null?void 0:ve.type)==="entity"&&i.addNoteConnection(Ue,Ye);return}const ne=Ue=>{var Ye;return(Ye=i.state.logical.entities.find(pt=>pt.modelId===Ue))==null?void 0:Ye.stereotype},xe=ne(O.source)==="JPA_EMBEDDABLE",Be=ne(O.target)==="JPA_EMBEDDABLE";if(xe||Be){if(xe&&Be)return;const Ue=xe?O.source:O.target,Ye=xe?O.target:O.source;i.addEmbedAssociation(Ye,Ue);return}const qe=ne(O.source)==="SERIALIZED_TYPE",je=ne(O.target)==="SERIALIZED_TYPE";if(qe||je){const Ue=je?O.target:O.source,Ye=je?O.source:O.target;Ue!==Ye&&i.addSerializedTypeAttribute(Ye,Ue);return}const Ie=(Re=O.sourceHandle)!=null&&Re.startsWith("r:")?O.sourceHandle.slice(2):void 0,Je=(me=O.targetHandle)!=null&&me.startsWith("l:")?O.targetHandle.slice(2):void 0;i.addAssociation(O.source,O.target,Ie,Je)}const nt=t.ref(null);function J(O,U){var ne;const le=i.state.layout.entityLayouts.find(xe=>xe.entityRef===O);return $t((ne=le==null?void 0:le.attributeStyles)==null?void 0:ne[U])}function ce(O,U){var ne;const le=i.state.layout.entityLayouts.find(xe=>xe.entityRef===O);return $t((ne=le==null?void 0:le.operationStyles)==null?void 0:ne[U])}function Ae(O){var U;return $t((U=i.state.layout.groupLayouts.find(le=>le.groupRef===O))==null?void 0:U.style)}function Ee(O){var U;return $t((U=i.state.layout.notes.find(le=>le.modelId===O))==null?void 0:U.style)}function H(O){var xe,Be;if(O.preventDefault(),!i.editable.value)return;const U=()=>P({x:O.clientX,y:O.clientY}),le=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const qe=U();i.addEntity("NewEntity",{x:qe.x,y:qe.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const qe=U();i.addNote("메모",{x:qe.x,y:qe.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const qe=U();i.addEmptyGroup({x:qe.x,y:qe.y})}}],ne=(xe=i.clipboard.value)==null?void 0:xe.kind;(ne==="entity"||ne==="entities")&&le.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Se(i.paste())}),i.resolved.value.entities.length>0&&le.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()}),(Be=nt.value)==null||Be.open(O,le)}function It({event:O,node:U}){var Ie,Je,j,K,ve,Re,me,Ue,Ye,pt,Pt,ta,gt,Vn,Fr,ly,sy,cy,dy;const le=O;if(le.preventDefault(),!i.editable.value){if(U.type==="group"||U.type==="note")return;const it=(Je=(Ie=le.target)==null?void 0:Ie.closest("[data-attr]"))==null?void 0:Je.dataset.attr;if(it){const bt=i.selection.value;(bt==null?void 0:bt.kind)==="attribute"&&bt.entityId===U.id&&bt.ids.includes(it)||i.selectAttribute(U.id,it);const Bn=((j=i.selection.value)==null?void 0:j.kind)==="attribute"&&i.selection.value.entityId===U.id?[...i.selection.value.ids]:[it];(K=nt.value)==null||K.open(le,[{caption:Bn.length>1?i.t("em.ctx.copyN",{n:Bn.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ve=nt.value)==null||ve.open(le,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>hr(a,i,U.id)},Ge(U.id)]);return}if(U.type==="group"){const it=i.isGroupLocked(U.id),bt=[];it||bt.push({type:"swatches",caption:i.t("em.common.color"),current:Ae(U.id),onPick:Bn=>i.setGroupSwatch(U.id,Bn)},{type:"separator"});const Ct=Fe()&&Ce().includes(U.id)?ze():$e(U.id);Ct.length&&bt.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(Ct)}),bt.push({caption:it?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:it?"unlock":"lock",handler:()=>i.setGroupLocked(U.id,!it)}),it||bt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(U.id)}),(Re=nt.value)==null||Re.open(le,bt);return}if(U.type==="note"){(me=nt.value)==null||me.open(le,[{type:"swatches",caption:i.t("em.common.color"),current:Ee(U.id),onPick:it=>i.setNoteSwatch(U.id,it)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(U.id)}]);return}const ne=(Ye=(Ue=le.target)==null?void 0:Ue.closest("[data-attr]"))==null?void 0:Ye.dataset.attr;if(ne){const it=i.selection.value;(it==null?void 0:it.kind)==="attribute"&&it.entityId===U.id&&it.ids.includes(ne)||i.selectAttribute(U.id,ne);const Ct=((pt=i.selection.value)==null?void 0:pt.kind)==="attribute"&&i.selection.value.entityId===U.id?[...i.selection.value.ids]:[ne];if(i.isEntityLocked(U.id)){(Pt=nt.value)==null||Pt.open(le,[{caption:Ct.length>1?i.t("em.ctx.copyN",{n:Ct.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Bn=Ct.length>1,uc=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(U.id)},{type:"swatches",caption:Bn?i.t("em.ctx.colorN",{n:Ct.length}):i.t("em.common.color"),current:Bn?null:J(U.id,ne),onPick:MO=>i.setAttributeSwatches(U.id,Ct,MO)},{type:"separator"},{caption:Bn?i.t("em.ctx.copyN",{n:Ct.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],na=i.clipboard.value;(na==null?void 0:na.kind)==="attribute"&&uc.push({caption:na.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:na.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:U.id},i.paste()}}),uc.push({type:"separator"},{caption:Bn?i.t("em.ctx.deleteAttrN",{n:Ct.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(U.id,Ct)}),(ta=nt.value)==null||ta.open(le,uc);return}const xe=(Vn=(gt=le.target)==null?void 0:gt.closest("[data-op]"))==null?void 0:Vn.dataset.op;if(xe){if(i.isEntityLocked(U.id))return;(Fr=nt.value)==null||Fr.open(le,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(U.id)},{type:"swatches",caption:i.t("em.common.color"),current:ce(U.id,xe),onPick:it=>i.setOperationSwatch(U.id,xe,it)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(U.id,xe)}]);return}const Be=i.resolved.value.entities.find(it=>it.entity.modelId===U.id),qe=!!(Be!=null&&Be.locked),je=[{caption:qe?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>hr(a,i,U.id)}];if(!qe){je.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(U.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(U.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const bt=Y.value.filter(Ct=>Ct.type==="entity").map(Ct=>Ct.id);i.createGroup(bt.includes(U.id)&&bt.length?bt:[U.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(U.id,U.id)});const it=i.embeddableCatalog.value;if(it.length){je.push({type:"separator"});for(const bt of it){const Ct=((ly=bt.label)==null?void 0:ly[i.userLanguage.value])??((sy=bt.label)==null?void 0:sy.ko)??((cy=bt.label)==null?void 0:cy.en)??bt.type;je.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:Ct}),icon:"link",handler:()=>i.addPredefinedEmbed(U.id,bt.type)})}}}if(je.push({type:"separator"}),je.push({caption:Be!=null&&Be.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Be!=null&&Be.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(U.id,!(Be!=null&&Be.collapsed))}),Be!=null&&Be.groupRef&&!qe&&je.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(U.id)}),je.push({caption:qe?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:qe?"unlock":"lock",handler:()=>i.setEntityLocked(U.id,!qe)}),je.push(Ge(U.id)),!qe){const it=i.clipboard.value;(it==null?void 0:it.kind)==="attribute"&&je.push({caption:it.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:it.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:U.id},i.paste()}}),je.push({type:"separator"}),je.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(U.id)})}(dy=nt.value)==null||dy.open(le,je)}function Rt({event:O,edge:U}){var Be,qe;const le=O;if(le.preventDefault(),!i.editable.value)return;const ne=A(U.id);if(ne){(Be=nt.value)==null||Be.open(le,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ne.noteRef,ne.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ne.noteRef,ne.targetRef)}]);return}const xe=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(U.id)}];i.isAssociationLocked(U.id)||xe.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(U.id)}),(qe=nt.value)==null||qe.open(le,xe)}function ot(O){return O==="group"?"group":O==="note"?"note":"entity"}function We({node:O}){if(Y.value.length>1){i.selection.value=null;return}i.selection.value={kind:ot(O.type),id:O.id}}function Ze({nodes:O}){O.length>1&&(i.selection.value=null)}function Q({edge:O}){const U=A(O.id);i.selection.value=U?{kind:"note",id:U.noteRef}:{kind:"association",id:O.id}}function Mt(O){const U=i.selection.value;return!!U&&U.kind!=="attribute"&&U.id===O.id}function Vt(O){var U,le;return Mt(O)?O.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":O.type==="note"?"var(--em-note-soft)":O.type==="group"?np($t((U=O.data)==null?void 0:U.style),!0)??"var(--em-mm-group)":np($t((le=O.data)==null?void 0:le.style))??"var(--em-mm-entity)"}function Mn(O){return Mt(O)?"var(--em-selection)":O.type==="note"?"var(--em-note-accent)":O.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function an(O,U){M(O,U,{zoom:x().zoom,duration:350})}t.watch(()=>i.focusRequest.value,O=>{if(!O)return;const U=C(O.id);if(!U)return;const le=U.computedPosition??U.position,ne=U.dimensions??{width:0,height:0};an(le.x+ne.width/2,le.y+ne.height/2)});function _e({position:O}){an(O.x,O.y)}function mt({node:O}){i.selection.value={kind:ot(O.type),id:O.id};const U=O.computedPosition??O.position,le=O.dimensions??{width:0,height:0};an(U.x+le.width/2,U.y+le.height/2)}function vt({node:O}){B({nodes:[O.id],duration:350,maxZoom:1.2,padding:.6})}return(O,U)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(lI),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!he.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(Sn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:de,onMoveEnd:Le,onConnect:ft,onConnectStart:U[1]||(U[1]=le=>u.value=!0),onConnectEnd:U[2]||(U[2]=le=>u.value=!1),onNodeDrag:yt,onNodeDragStop:st,onNodeClick:We,onEdgeClick:Q,onSelectionChange:Ze,onPaneClick:U[3]||(U[3]=le=>t.unref(i).selection.value=null),onPaneContextMenu:H,onNodeContextMenu:It,onEdgeContextMenu:Rt},{"node-group":t.withCtx(le=>[t.createVNode(Bp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"node-entity":t.withCtx(le=>[t.createVNode(Vp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"node-note":t.withCtx(le=>[t.createVNode(Dp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-association":t.withCtx(le=>[t.createVNode(eh,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-note-connection":t.withCtx(le=>[t.createVNode(hM,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-serialized-type":t.withCtx(le=>[t.createVNode(gM,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(oR),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(RR),{"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(Co),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:He},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Co),{title:t.unref(i).t("em.ctx.addNote"),onClick:De},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Co),{title:t.unref(i).t("em.palette.autoLayout"),onClick:U[0]||(U[0]=le=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(uM),{key:1,pannable:"",width:224,height:160,"node-color":Vt,"node-stroke-color":Mn,"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:_e,onNodeClick:mt,onNodeDblclick:vt})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ge.value?(t.openBlock(),t.createElementBlock("div",l2,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",s2,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,c2),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,d2),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,u2)],64)):(t.openBlock(),t.createElementBlock("p",m2,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(a2,{key:1,controller:t.unref(i),onClose:U[4]||(U[4]=le=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",f2,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",p2,[t.createElementVNode("strong",h2,t.toDisplayString(d.value.title),1),t.createElementVNode("span",y2,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(xM,{ref_key:"menuRef",ref:nt,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",g2,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-284ee242"]]),b2={class:"em-explorer em-scroll-overlay"},_2={class:"em-explorer__search"},k2=["placeholder","aria-label"],E2=["aria-label","title"],N2={key:0,class:"em-explorer__empty"},w2=["aria-label"],I2=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],v2=["onClick"],C2=["title"],S2={class:"em-key-slot"},x2={class:"em-key-slot"},R2={class:"em-explorer__label"},A2={key:2,class:"em-explorer__sr"},oy=Qe(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=oe.useModal(),r=t.computed(()=>{var He,De;const $=i.resolved.value,w=i.displayMode.value,I=i.userLanguage.value,v=Z=>{var re,ue,z;return ra(w,Z.name,(ue=(re=Z.table)==null?void 0:re.logicalName)==null?void 0:ue[I],(z=Z.table)==null?void 0:z.physicalName,i.t("em.node.logicalMissing"))},B=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",M=Z=>{const re=Z.attrType.startsWith("RELATION")&&Z.dbAttrs.length>0;return{icon:Z.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:Z.identifier,fk:re&&B}}},x=Z=>Z.attrType.startsWith("EMBED")&&Z.dbAttrs.length>0,P=Z=>x(Z)||yn(Z),Y=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",se=(Z,re)=>{if(yn(Z)){const z=i.state.logical.entities,L=z.find(F=>F.modelId===re);return Z.dbAttrs.map((F,X)=>{const ee=Zn(Z,L,z,i.state.logical.associations,X);return ee?{...F,physicalName:F.physicalName||ee.physicalName,logicalName:F.logicalName??ee.logicalName,dataType:F.dataType||ee.dataType}:F})}if(Z.attrType!=="EMBED_PREDEF")return Z.dbAttrs;const ue=i.embeddableCatalog.value.find(z=>z.type===Z.type);return ue?Z.dbAttrs.map((z,L)=>{const F=ue.fields[L];return F?{...z,physicalName:z.physicalName||F.physicalName,logicalName:z.logicalName??F.logicalName,dataType:z.dataType||F.dataType,length:z.length??F.length}:z}):Z.dbAttrs},he=(Z,re)=>{const ue=di(Z,Mo(i.state.logical),re,i.state.logical);return ue.kind==="resolved"?ue.entity:void 0},ie=(Z,re,ue)=>{var X,ee,ke,ye,Ne,we,G,q,W;const z={entityId:re,attrId:Z.modelId};if(P(Z)){const Ce=Jr(w,Z,ue==null?void 0:ue.collection,ue==null?void 0:ue.targetName,he(Z));return{key:`attr:${Z.modelId}`,label:Z.name+(Ce?` : ${Ce}`:""),icon:"table",attrRef:z,focusId:re,matchText:ri(Z.name,(ee=(X=Z.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:ee[I],(ke=Z.dbAttrs[0])==null?void 0:ke.physicalName),children:Y?se(Z,re).map($e=>{var ze,Fe;return{key:`attr:${Z.modelId}:col:${$e.modelId}`,label:ra(w,$e.physicalName,(ze=$e.logicalName)==null?void 0:ze[I],$e.physicalName,i.t("em.node.logicalMissing"))+($e.dataType?` : ${$e.dataType}`:""),icon:"field",attrRef:z,focusId:re,matchText:ri($e.physicalName,(Fe=$e.logicalName)==null?void 0:Fe[I]),children:[]}}):[]}}const L=(ue==null?void 0:ue.collection)??aa(Z,i.state.logical.associations),F=Jr(w,Z,L,ue==null?void 0:ue.targetName,he(Z));return{key:`attr:${Z.modelId}`,label:ra(w,Z.name,(Ne=(ye=Z.dbAttrs[0])==null?void 0:ye.logicalName)==null?void 0:Ne[I],(we=Z.dbAttrs[0])==null?void 0:we.physicalName,i.t("em.node.logicalMissing"))+(F?` : ${F}`:""),...M(Z),attrRef:z,focusId:re,matchText:ri(Z.name,(q=(G=Z.dbAttrs[0])==null?void 0:G.logicalName)==null?void 0:q[I],(W=Z.dbAttrs[0])==null?void 0:W.physicalName),children:[]}},fe=Z=>{var ee,ke,ye;const re=Z.entity,ue=w==="CLASS",L=ue||re.attributes.some(yn)?gl(re,i.state.logical):void 0,F=ue&&L?L.fields.map(Ne=>Ne.attr):[...re.attributes].sort((Ne,we)=>Ne.order-we.order),X=new Map(((L==null?void 0:L.fields)??[]).filter(Ne=>(ue||yn(Ne.attr))&&(Ne.target||Ne.collection)).map(Ne=>{var we;return[Ne.attr.modelId,{targetName:(we=Ne.target)==null?void 0:we.name,collection:Ne.collection}]}));return{key:`entity:${re.modelId}`,label:v(re),icon:"table",selectKind:"entity",selectId:re.modelId,focusId:re.modelId,matchText:ri(re.name,(ke=(ee=re.table)==null?void 0:ee.logicalName)==null?void 0:ke[I],(ye=re.table)==null?void 0:ye.physicalName),children:F.map(Ne=>ie(Ne,re.modelId,X.get(Ne.modelId)))}},pe=new Map,ge=[];for(const Z of $.entities)if(Z.groupRef){const re=pe.get(Z.groupRef)??[];re.push(Z),pe.set(Z.groupRef,re)}else ge.push(Z);const Te=[];for(const Z of $.groups){const re=Z.group;Te.push({key:`group:${re.modelId}`,label:((He=re.name)==null?void 0:He[I])||((De=re.name)==null?void 0:De.ko)||re.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:re.modelId,children:(pe.get(re.modelId)??[]).map(fe)})}for(const Z of ge)Te.push(fe(Z));if($.associations.length){const Z=new Map($.entities.map(re=>[re.entity.modelId,v(re.entity)]));Te.push({key:"section:associations",label:i.t("em.explorer.associations",{n:$.associations.length}),icon:"arrow-lr",children:$.associations.map(re=>{const ue=re.association,z=Z.get(ue.end1.entityRef)??ue.end1.entityRef,L=Z.get(ue.end2.entityRef)??ue.end2.entityRef;return{key:`assoc:${ue.modelId}`,label:`${z} — ${L}`,icon:"arrow-lr",selectKind:"association",selectId:ue.modelId,children:[]}})})}return $.notes.length&&Te.push({key:"section:notes",label:i.t("em.explorer.notes",{n:$.notes.length}),icon:"note",children:$.notes.map(({note:Z})=>{var re;return{key:`note:${Z.modelId}`,label:((re=Z.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:re.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:Z.modelId,focusId:Z.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:Te}});function l($){return $?$.pk&&$.fk?i.t("em.node.keyPfk"):$.pk?i.t("em.node.keyPk"):$.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const $=[],w=I=>{if(I.children.length){I.key!=="root"&&$.push(I.key);for(const v of I.children)w(v)}};return w(r.value),$}),c=$=>$.startsWith("entity:")||$==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Jh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),g=t.computed(()=>f.value.trim().length>0),b=t.computed(()=>{const $=[];if(g.value){const I=jM(r.value,f.value.trim().toLowerCase()),v=(B,M,x,P,Y)=>{if(!I.has(B.key))return;$.push({node:B,depth:M,parentKey:x,posinset:P,setsize:Y});const se=B.children.filter(he=>I.has(he.key));se.forEach((he,ie)=>v(he,M+1,B.key,ie+1,se.length))};return v(r.value,0,null,1,1),$}const w=(I,v,B,M,x)=>{$.push({node:I,depth:v,parentKey:B,posinset:M,setsize:x}),d(I.key)||I.children.forEach((P,Y)=>w(P,v+1,I.key,Y+1,I.children.length))};return w(r.value,0,null,1,1),$}),_=t.ref(null),k=t.ref(null),N=t.computed(()=>{var w;const $=b.value;return k.value&&$.some(I=>I.node.key===k.value)?k.value:((w=$[0])==null?void 0:w.node.key)??null}),y=$=>!g.value&&d($);async function E($){var w,I;$&&(k.value=$,await t.nextTick(),(I=(w=_.value)==null?void 0:w.querySelector(`[data-key="${$}"]`))==null||I.focus())}function S($,w){var B,M,x,P,Y;const I=b.value,v=I.findIndex(se=>se.node.key===w.node.key);switch($.key){case"ArrowDown":$.preventDefault(),E((B=I[v+1])==null?void 0:B.node.key);return;case"ArrowUp":$.preventDefault(),E((M=I[v-1])==null?void 0:M.node.key);return;case"Home":$.preventDefault(),E((x=I[0])==null?void 0:x.node.key);return;case"End":$.preventDefault(),E((P=I[I.length-1])==null?void 0:P.node.key);return;case"ArrowRight":if($.preventDefault(),!w.node.children.length)return;y(w.node.key)?u(w.node.key):E((Y=I[v+1])==null?void 0:Y.node.key);return;case"ArrowLeft":$.preventDefault(),w.node.children.length&&!y(w.node.key)?u(w.node.key):E(w.parentKey);return;case"Enter":case" ":$.preventDefault(),C(w.node,$);return;case"F2":$.preventDefault(),R(w.node)}}const A=t.computed(()=>g.value&&b.value.length<=1);function V($){var v;if($.key!=="/"||$.metaKey||$.ctrlKey||$.altKey||$.shiftKey)return;const w=$.target,I=w==null?void 0:w.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||w!=null&&w.isContentEditable||($.preventDefault(),(v=h.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",V)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",V)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function T($){const w=i.selection.value;return $.attrRef?(w==null?void 0:w.kind)==="attribute"&&w.entityId===$.attrRef.entityId&&w.ids.includes($.attrRef.attrId):!!w&&w.kind!=="attribute"&&!!$.selectId&&$.selectKind===w.kind&&$.selectId===w.id}function D($){const w=i.selection.value;return $.selectKind==="entity"&&(w==null?void 0:w.kind)==="attribute"&&w.entityId===$.selectId}function C($,w){if($.attrRef){const I=w.shiftKey?"range":w.metaKey||w.ctrlKey?"toggle":"replace";i.selectAttribute($.attrRef.entityId,$.attrRef.attrId,I)}else $.selectKind&&$.selectId&&(i.selection.value={kind:$.selectKind,id:$.selectId});$.focusId&&i.requestFocus($.focusId)}function R($){$.selectKind==="entity"&&$.selectId&&hr(a,i,$.selectId)}return($,w)=>(t.openBlock(),t.createElementBlock("section",b2,[t.createElementVNode("div",_2,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":w[0]||(w[0]=I=>f.value=I),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:w[1]||(w[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,k2),[[t.vModelText,f.value]]),f.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:w[2]||(w[2]=I=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,E2)):t.createCommentVNode("",!0)]),A.value?(t.openBlock(),t.createElementBlock("p",N2,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:_,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":T(I.node),"is-focus-parent":D(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!y(I.node.key):void 0,"aria-selected":T(I.node),tabindex:I.node.key===N.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:v=>C(I.node,v),onDblclick:v=>R(I.node),onFocus:v=>k.value=I.node.key,onKeydown:v=>S(v,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!y(I.node.key)}]),onClick:t.withModifiers(v=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,v2),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",S2,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",x2,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,C2)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",R2,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",A2,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,I2))),128))],8,w2)]))}}),[["__scopeId","data-v-9124d45b"]]),$2={class:"em-text-export"},T2=["id","aria-selected","tabindex","onClick"],M2=["aria-labelledby"],V2={class:"em-text-export__actions"},B2=Qe(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(m,p)=>en(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),oe.showNotification(i("em.export.copied"),"info")}catch{oe.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",$2,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:g=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,T2))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,M2),t.createElementVNode("div",V2,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),D2={class:"em-text-import"},O2=["aria-label"],L2=["aria-checked","tabindex","onClick"],P2=["placeholder"],z2={class:"em-text-import__status"},F2={class:"em-text-import__ok"},U2={key:0,class:"em-text-import__warn"},H2={key:1,class:"em-text-import__err"},j2={key:2,class:"em-text-import__err"},K2={key:3,class:"em-text-import__err"},G2={class:"em-text-import__actions"},Y2=Qe(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(g,b)=>en(n.locale??"ko",g,b),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"}],s=t.ref(null);async function c(g){var _,k;const b=l[(g+l.length)%l.length];b&&(r.value=b.key,await t.nextTick(),(k=(_=s.value)==null?void 0:_.querySelectorAll('[role="radio"]')[l.indexOf(b)])==null||k.focus())}function d(g){c(l.findIndex(b=>b.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const b=m.value;if(!b)return{status:"unknown"};try{let _,k=[];return b==="json"?_=Jc(g):b==="mermaid"?_=Uc(g):(_=Gc(g),k=nl(g).warnings),_.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:_,warnings:k}}catch(_){return{status:"error",message:_ instanceof Error?_.message:String(_)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const g=p.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,b)=>(t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",D2,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,_=>t.createElementVNode("button",{key:_.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":_.key===r.value}]),"aria-checked":_.key===r.value,tabindex:_.key===r.value?0:-1,onClick:k=>r.value=_.key,onKeydown:[b[0]||(b[0]=t.withKeys(t.withModifiers(k=>d(-1),["prevent"]),["left"])),b[1]||(b[1]=t.withKeys(t.withModifiers(k=>d(1),["prevent"]),["right"])),b[2]||(b[2]=t.withKeys(t.withModifiers(k=>c(0),["prevent"]),["home"])),b[3]||(b[3]=t.withKeys(t.withModifiers(k=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(_.labelKey)),43,L2)),64))],8,O2),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":b[4]||(b[4]=_=>a.value=_),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,P2),[[t.vModelText,a.value]]),t.createElementVNode("div",z2,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",F2,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",U2," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",H2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",j2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",K2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",G2,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:b[5]||(b[5]=_=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),q2={class:"em-toolbar"},W2=["title"],J2={class:"em-toolbar__mode"},iy=Qe(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,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=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=Zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:B2,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Mc(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Qr(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Qr(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:Yc(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:Wc(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:Y2,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:ty,bind:{locale:i.uiLocale.value}})}return(h,g)=>(t.openBlock(),t.createElementBlock("div",q2,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,W2)):t.createCommentVNode("",!0),t.createVNode(t.unref(oe.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:g[0]||(g[0]=b=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(oe.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:g[1]||(g[1]=b=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",J2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(oe.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=b=>s.value=b),items:l,"value-provider":b=>b.v,"label-provider":b=>t.unref(i).t(b.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(oe.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(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(oe.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:g[3]||(g[3]=b=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(oe.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:g[4]||(g[4]=b=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(oe.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(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=b=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=b=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(oe.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:g[7]||(g[7]=b=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),X2=["title"],Z2=["title"],Q2=["disabled","aria-pressed"],eV=["disabled","aria-pressed"],tV=Qe(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=>en(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(Ve,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,X2)):(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(Ve,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,Q2),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(Ve,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,eV)],10,Z2))}}),[["__scopeId","data-v-2b5162b7"]]),nV=["disabled"],oV={class:"em-panel__sub"},iV={class:"em-nav"},aV={key:0,class:"em-nav__divider","aria-hidden":"true"},rV={key:1},lV=["onClick","onKeydown"],sV={class:"em-nav__name"},cV=["title"],dV={key:0,class:"em-panel__note"},uV=["data-attr-block"],mV={key:0,class:"em-embed-col__label"},fV={class:"em-attr__row"},pV=["title"],hV={key:1,class:"em-attr__row"},yV={key:2,class:"em-embed-cols"},gV={class:"em-embed-col"},bV={class:"em-embed-col__label"},_V={class:"em-attr__row"},kV={class:"em-attr__navhint"},EV={key:3,class:"em-attr__navhint"},NV={key:4,class:"em-attr__navhint"},wV={key:0,class:"em-attr__navhint"},IV={class:"em-attr__row"},vV={class:"em-attr__row"},CV=["title"],SV={class:"em-attr__flags"},xV={class:"em-attr__pii"},RV={class:"em-attr__pii"},AV={key:1,class:"em-attr__pii"},$V={key:2,class:"em-attr__pii em-attr__codetop"},TV={class:"em-multilang"},MV={key:6,class:"em-embed-cols"},VV={key:0,class:"em-attr__navhint"},BV={class:"em-embed-col__label"},DV={class:"em-attr__row"},OV=["title"],LV=["title"],PV=["title"],zV={class:"em-attr__row"},FV={key:0,class:"em-embed-upd"},UV={key:1,class:"em-attr__navhint"},HV={class:"em-embed-upd"},jV={class:"em-embed-upd"},KV={class:"em-attr__flags"},GV={class:"em-multilang"},YV={class:"em-swatch__row em-attr__swatch"},qV=["title","onClick"],WV=["title","onClick"],JV={key:0,class:"em-attr__swatch-hint"},XV=Qe(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttr:u,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:k,isManagedFk:N,setNaturalId:y,setIdentifier:E,setTransient:S,dbLocked:A,fkDerived:V,fkOriginPhysical:T,typeValueOf:D,typeLabelOf:C,setAttrType:R,setAttrCustomType:$,setDb:w,scaleApplicable:I,scaleHint:v,setDbLogical:B,setAttrDescription:M,attrPiiValue:x,setAttrPii:P,predefinedCustomTypeCatalog:Y,serializedTypeNames:se,embeddableCatalog:he,predefinedLabel:ie,groupCodeCatalog:fe,attrGroupCodes:pe,attrCodeItems:ge,codeValueOf:Te,codeLabelOf:He,setAttrGroupCode:De,setAttrCode:Z,setAttrDefaultValue:re,hasColumnSlots:ue,isMultiColFk:z,setDbAt:L,setDbLogicalAt:F,colSlotMeta:X,fixedDataType:ee,fixedLength:ke,fixedScale:ye,slotFixedHint:Ne,updatableItems:we,updatableLabel:G,updatableValue:q,setUpdatableAt:W,setUpdatable:Ce,insertableItems:$e,insertableLabel:ze,insertableValue:Fe,setInsertableAt:ae,setInsertable:Se,sharedItems:Ge,sharedLabel:et,sharedValue:te,setSharedAt:de,isShared:Le,sharedPhysical:dt}=rp(o,()=>n.entityId),Xe=t.computed(()=>i.value?o.state.layout.entityLayouts.find(We=>We.entityRef===i.value.modelId)??null:null),yt=t.computed(()=>{var We;return((We=i.value)==null?void 0:We.attributes.filter(Ze=>Ze.attrType!=="DIVIDER"))??[]}),st=t.computed(()=>{var We;return((We=i.value)==null?void 0:We.attributes)??[]}),ft=t.computed(()=>yt.value.filter(We=>l.value.has(We.modelId)));function nt(We){return{pk:We.identifier,fk:We.attrType.startsWith("RELATION")&&We.dbAttrs.length>0,required:We.notNull&&!We.identifier}}function J(We){const Ze=nt(We),Q=[Ze.pk&&"PK",Ze.fk&&"FK",Ze.required&&"NOT NULL"].filter(Boolean);return Q.length?Q.join(" · "):void 0}function ce(We,Ze){i.value&&o.selectAttribute(i.value.modelId,We.modelId,Ze.shiftKey?"range":Ze.metaKey||Ze.ctrlKey?"toggle":"replace")}function Ae(We){var Ze,Q;return $t((Q=(Ze=Xe.value)==null?void 0:Ze.attributeStyles)==null?void 0:Q[We.modelId])}function Ee(We){return l.value.size>1&&l.value.has(We.modelId)}function H(We,Ze){if(!i.value)return;const Q=Ee(We)?o.selectedAttrIds.value:[We.modelId];o.setAttributeSwatches(i.value.modelId,Q,Ze)}const It=t.ref(void 0);function Rt(We){if(!We||!i.value)return;const Ze=o.addPredefinedEmbed(i.value.modelId,We);Ze&&o.selectAttribute(i.value.modelId,Ze),It.value=void 0}function ot(){if(!i.value)return;const We=o.addAttribute(i.value.modelId);We&&o.selectAttribute(i.value.modelId,We)}return(We,Ze)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",oV,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:yt.value.length}))+" ",1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ot},null,8,["caption"]),t.unref(he).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":It.value,items:t.unref(he),"value-provider":Q=>Q.type,"label-provider":t.unref(ie),"onUpdate:modelValue":Rt},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",iV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(st.value,Q=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Q.modelId},[Q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",aV,[...Ze[0]||(Ze[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",rV,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(l).has(Q.modelId)}]),role:"button",tabindex:"0",onClick:Mt=>ce(Q,Mt),onKeydown:[t.withKeys(t.withModifiers(Mt=>ce(Q,Mt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Mt=>ce(Q,Mt),["prevent"]),["space"])]},[t.createElementVNode("span",sV,t.toDisplayString(Q.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:J(Q)},[nt(Q).pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):nt(Q).required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),nt(Q).fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,cV)],42,lV)]))],64))),128))]),yt.value.length&&!ft.value.length?(t.openBlock(),t.createElementBlock("p",dV,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ft.value,Q=>{var Mt,Vt,Mn,an,_e,mt,vt,O,U,le;return t.openBlock(),t.createElementBlock("div",{key:Q.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(l).has(Q.modelId)}]),"data-attr-block":Q.modelId},[t.unref(m)(Q)?(t.openBlock(),t.createElementBlock("span",mV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",fV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-name-${Q.modelId}`,width:"100%",disabled:t.unref(_)(Q),title:t.unref(_)(Q)?t.unref(k)(Q):t.unref(m)(Q)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(f)(Q),"model-value":t.unref(p)(Q),"onUpdate:modelValue":ne=>t.unref(h)(Q,ne)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{name:`attr-type-${Q.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Q.attrType.startsWith("EMBED")||!!Q.groupCode||Q.attrType==="RELATION_REF"||t.unref(V)(Q),items:t.unref(Sc)(Q.type,t.unref(Y),t.unref(se)),"value-provider":t.unref(D),"label-provider":t.unref(C),"model-value":Q.type,"onUpdate:modelValue":ne=>t.unref(R)(Q,ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(N)(Q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Q.modelId)},null,8,["onClick"])],8,pV)]),Q.type===t.unref(_n)&&!t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("div",hV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-customtype-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Q.customType??"","onUpdate:modelValue":ne=>t.unref($)(Q,ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(m)(Q)?(t.openBlock(),t.createElementBlock("div",yV,[t.createElementVNode("div",gV,[t.createElementVNode("span",bV,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",_V,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-assocname-${Q.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(g)(Q),"onUpdate:modelValue":ne=>t.unref(b)(Q,ne)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",kV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Q.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",EV,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.createCommentVNode("",!0),t.unref(r)?(t.openBlock(),t.createElementBlock("p",NV,t.toDisplayString(t.unref(o).t("em.attr.serializedNoColumnNote")),1)):t.unref(ue)(Q)?(t.openBlock(),t.createElementBlock("div",MV,[t.unref(z)(Q)?(t.openBlock(),t.createElementBlock("p",VV,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.dbAttrs,(ne,xe)=>{var Be,qe,je,Ie,Je,j,K,ve;return t.openBlock(),t.createElementBlock("div",{key:ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",BV,t.toDisplayString(((Be=t.unref(X)(Q,xe))==null?void 0:Be.name)??((qe=t.unref(X)(Q,xe))==null?void 0:qe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:xe+1})),1),t.createElementVNode("div",DV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`embed-col-${ne.modelId}`,width:"100%",disabled:t.unref(Le)(ne),placeholder:((je=t.unref(X)(Q,xe))==null?void 0:je.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Le)(ne)?t.unref(dt)(ne):ne.physicalName,"onUpdate:modelValue":Re=>t.unref(L)(Q,xe,{physicalName:Re})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSTextInput),{name:`embed-dtype-${ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ee)(Q,xe)},null,8,["name","model-value"])],8,OV),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`embed-len-${ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ke)(Q,xe)},null,8,["name","model-value"])],8,LV),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`embed-scale-${ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ye)(Q,xe)},null,8,["name","model-value"])],8,PV)]),t.createVNode(Io,{controller:t.unref(o),"ref-id":ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",zV,[t.createVNode(Qt,{class:"grow",name:`embed-logical-${ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Je=(Ie=t.unref(X)(Q,xe))==null?void 0:Ie.logicalName)==null?void 0:Je[t.unref(o).userLanguage.value])??((K=(j=t.unref(X)(Q,xe))==null?void 0:j.logicalName)==null?void 0:K.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ne.logicalName,"onUpdate:modelValue":Re=>t.unref(F)(Q,xe,Re)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ve=t.unref(X)(Q,xe))!=null&&ve.shareable?(t.openBlock(),t.createElementBlock("label",FV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(oe.BSSelect),{width:"110px","model-value":t.unref(te)(ne),items:t.unref(Ge)(),"value-provider":t.unref(d),"label-provider":t.unref(et),"onUpdate:modelValue":Re=>Re&&t.unref(de)(Q,xe,Re)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Le)(ne)?(t.openBlock(),t.createElementBlock("p",UV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",HV,[Ze[3]||(Ze[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(ne),"model-value":t.unref(Le)(ne)?"false":t.unref(Fe)(ne),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":Re=>Re&&t.unref(ae)(Q,xe,Re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",jV,[Ze[4]||(Ze[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(ne),"model-value":t.unref(Le)(ne)?"false":t.unref(q)(ne),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":Re=>Re&&t.unref(W)(Q,xe,Re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(z)(Q)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",KV,[t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:"","onUpdate:modelValue":ne=>t.unref(E)(Q,ne)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:"","onUpdate:modelValue":ne=>t.unref(u)(Q,{notNull:ne})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",GV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ne=>t.unref(M)(Q,ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("p",wV,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",IV,[t.createVNode(Qt,{class:"grow",name:`attr-logical-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Mt=Q.dbAttrs[0])==null?void 0:Mt.logicalName,"onUpdate:modelValue":ne=>t.unref(B)(Q,ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",vV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-col-${Q.modelId}`,width:"100%",placeholder:t.unref(T)(Q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(A)(Q),"model-value":((Vt=Q.dbAttrs[0])==null?void 0:Vt.physicalName)??"","onUpdate:modelValue":ne=>t.unref(w)(Q,{physicalName:ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{name:`attr-dtype-${Q.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(A)(Q)||t.unref(V)(Q),items:t.unref(wc)(((Mn=Q.dbAttrs[0])==null?void 0:Mn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(Yr),"model-value":((an=Q.dbAttrs[0])==null?void 0:an.dataType)??"","onUpdate:modelValue":ne=>ne&&t.unref(w)(Q,{dataType:ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSNumberInput),{name:`attr-len-${Q.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(A)(Q)||t.unref(V)(Q),"model-value":(_e=Q.dbAttrs[0])==null?void 0:_e.length,"onUpdate:modelValue":ne=>t.unref(w)(Q,{length:ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(v)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`attr-scale-${Q.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(A)(Q)||t.unref(V)(Q)||!t.unref(I)(Q),"model-value":(mt=Q.dbAttrs[0])==null?void 0:mt.scale,"onUpdate:modelValue":ne=>t.unref(w)(Q,{scale:ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,CV)]),t.createVNode(Io,{controller:t.unref(o),"ref-id":(vt=Q.dbAttrs[0])==null?void 0:vt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",SV,[t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:t.unref(a)||t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(E)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(u)(Q,{notNull:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-uq-${Q.modelId}`,label:"Unique","model-value":!!((O=Q.dbAttrs[0])!=null&&O.unique),disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(w)(Q,{unique:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-ai-${Q.modelId}`,label:"Auto Increment","model-value":!!((U=Q.dbAttrs[0])!=null&&U.autoIncrement),disabled:t.unref(A)(Q)||t.unref(V)(Q)||!Q.identifier,"onUpdate:modelValue":ne=>t.unref(w)(Q,{autoIncrement:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-tr-${Q.modelId}`,label:"@Transient","model-value":!!Q.transient,disabled:Q.identifier||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(S)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nid-${Q.modelId}`,label:"@NaturalId","model-value":!!Q.naturalId,disabled:Q.identifier||t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(y)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Q.modelId}`,label:"mutable","model-value":!!Q.naturalIdMutable,disabled:t.unref(A)(Q)||!Q.naturalId,"onUpdate:modelValue":ne=>t.unref(u)(Q,{naturalIdMutable:ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-mv-${Q.modelId}`,label:"Multi-Value (Set)","model-value":!!((le=Q.dbAttrs[0])!=null&&le.multiValue),disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(w)(Q,{multiValue:ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",xV,[Ze[1]||(Ze[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"100%",disabled:t.unref(A)(Q),"model-value":t.unref(Fe)(Q.dbAttrs[0]),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":ne=>ne&&t.unref(Se)(Q,ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",RV,[Ze[2]||(Ze[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"100%",disabled:t.unref(A)(Q),"model-value":t.unref(q)(Q.dbAttrs[0]),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":ne=>ne&&t.unref(Ce)(Q,ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(V)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",AV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":t.unref(x)(Q),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":ne=>ne&&t.unref(P)(Q,ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(fe).length&&!t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("label",$V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(up,{"model-value":Q.groupCode,items:t.unref(fe),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ne=>t.unref(De)(Q,ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(V)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(fe).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(pe)(Q).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"100%","model-value":Q.defaultValue??"none",items:t.unref(ge)(Q),"value-provider":t.unref(Te),"label-provider":t.unref(He),"onUpdate:modelValue":ne=>ne&&t.unref(Z)(Q,ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`attr-default-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Q.defaultValue??"","onUpdate:modelValue":ne=>t.unref(re)(Q,ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",TV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ne=>t.unref(M)(Q,ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",YV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ae(Q)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:ne=>H(Q,null)},"∅",10,qV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),ne=>(t.openBlock(),t.createElementBlock("button",{key:ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ae(Q)===ne}]),style:t.normalizeStyle({background:t.unref(Qo)(ne)}),title:t.unref(o).t(t.unref(wo)(ne)),onClick:xe=>H(Q,ne)},null,14,WV))),128)),Ee(Q)?(t.openBlock(),t.createElementBlock("span",JV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(l).size})),1)):t.createCommentVNode("",!0)])],10,uV)}),128))],8,nV)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0ece25e9"]]),ZV=["disabled"],QV={class:"em-panel__sub-label"},eB={class:"em-attr__row"},tB={class:"em-field em-idx-params"},nB=["value","placeholder","onChange"],oB=Qe(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(E=>E.modelId===o.entityId)??null),l=t.computed(()=>r.value?si(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var E;return Jn(((E=r.value)==null?void 0:E.attributes)??[])}),c=E=>s.value.canon(E),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>[...hp(d.value).map(E=>({value:E.ref,label:E.label})),...l.value.map(E=>({value:E.modelId,label:a.t("em.index.inherited",{field:E.field})}))]);function m(E,S){var D;const A=new Set(E.columns.filter((C,R)=>R!==S).map(C=>c(C.columnRef))),V=u.value.filter(C=>!A.has(c(C.value))),T=(D=E.columns[S])==null?void 0:D.columnRef;return T&&!V.some(C=>C.value===T)&&V.push({value:T,label:p(T)}),V}function p(E){return Ms(E,d.value)}function f(E){const S=new Set(E.columns.map(A=>c(A.columnRef)));return u.value.filter(A=>!S.has(c(A.value)))}function h(){var S;if(!r.value)return;const E=u.value[0];a.addIndex(r.value.modelId,{modelId:Pe(),name:`idx_${(((S=r.value.indexes)==null?void 0:S.length)??0)+1}`,unique:!1,columns:E?[{columnRef:E.value,descending:!1}]:[]})}function g(E,S){r.value&&a.updateIndex(r.value.modelId,E,S)}function b(E){const S=f(E)[0];S&&g(E.modelId,{columns:[...E.columns,{columnRef:S.value,descending:!1}]})}function _(E,S,A){g(E.modelId,{columns:E.columns.map((V,T)=>T===S?{...V,columnRef:A}:V)})}function k(E,S,A){g(E.modelId,{columns:E.columns.map((V,T)=>T===S?{...V,descending:A}:V)})}function N(E,S){g(E.modelId,{columns:E.columns.filter((A,V)=>V!==S)})}function y(E,S){g(E.modelId,{parameters:S.trim()===""?void 0:S})}return(E,S)=>{var A;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:S[0]||(S[0]=V=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",QV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((A=r.value.indexes)==null?void 0:A.length)??0})),1)]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],V=>(t.openBlock(),t.createElementBlock("div",{key:V.modelId,class:"em-attr"},[t.createElementVNode("div",eB,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`idx-name-${V.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":T=>g(V.modelId,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idx-uq-${V.modelId}`,class:"em-check",label:"UQ","model-value":V.unique,"onUpdate:modelValue":T=>g(V.modelId,{unique:T})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeIndex(r.value.modelId,V.modelId)},null,8,["onClick"])]),t.createVNode(Io,{controller:t.unref(a),"ref-id":V.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.columns,(T,D)=>(t.openBlock(),t.createElementBlock("div",{key:D,class:"em-attr__row"},[t.createVNode(t.unref(oe.BSSelect),{class:"grow","model-value":T.columnRef,items:m(V,D),"value-provider":C=>C.value,"label-provider":C=>C.label,"onUpdate:modelValue":C=>C&&_(V,D,C)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idx-${V.modelId}-desc-${D}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":C=>k(V,D,C)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:"−",onClick:C=>N(V,D)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(V).length,onClick:T=>b(V)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",tB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:V.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:T=>y(V,T.target.value)},null,40,nB)])]))),128)):t.createCommentVNode("",!0)],8,ZV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),iB=["disabled"],aB={class:"em-panel__sub-label"},rB={class:"em-attr__row"},lB={class:"em-attr__row"},sB={class:"em-multilang"},cB={class:"em-attr__pii"},dB={class:"em-swatch__row em-attr__swatch"},uB=["title","onClick"],mB=["title","onClick"],fB=Qe(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=oe.useModal(),l=t.computed(()=>a.state.logical.entities.find(N=>N.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(N=>N.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(N){return N==="none"?a.t("em.common.noneParen"):N}const m=N=>N;function p(N,y){l.value&&a.updateOperation(l.value.modelId,N.modelId,y)}function f(N,y){p(N,{description:Object.keys(y).length?y:void 0})}function h(N){return N.personalInfoAttributeType??"none"}function g(N,y){p(N,{personalInfoAttributeType:y==="none"?void 0:y})}function b(N){var y,E;return $t((E=(y=s.value)==null?void 0:y.operationStyles)==null?void 0:E[N.modelId])}function _(N,y){l.value&&a.setOperationSwatch(l.value.modelId,N.modelId,y)}function k(N){r.openModal({component:yp,bind:{operationName:N.name,sourceCode:N.sourceCode??"",locale:a.uiLocale.value,onSave:y=>p(N,{sourceCode:y})}})}return(N,y)=>{var E;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:y[1]||(y[1]=S=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",aB,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((E=l.value.operations)==null?void 0:E.length)??0})),1)]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:y[0]||(y[0]=t.withModifiers(S=>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??[],S=>(t.openBlock(),t.createElementBlock("div",{key:S.modelId,class:"em-attr"},[t.createElementVNode("div",rB,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":S.name,"onUpdate:modelValue":A=>p(S,{name:A})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":A=>A&&p(S,{visibility:A})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(a).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),t.createElementVNode("div",lB,[t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t(S.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:A=>k(S)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",sB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`op-desc-${S.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":A=>f(S,A)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",cB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":h(S),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":A=>A&&g(S,A)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",dB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(S)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:A=>_(S,null)},"∅",10,uB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":b(S)===A}]),style:t.normalizeStyle({background:t.unref(Qo)(A)}),title:t.unref(a).t(t.unref(wo)(A)),onClick:V=>_(S,A)},null,14,mB))),128))])]))),128)):t.createCommentVNode("",!0)],8,iB)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),pB=["title"],hB={class:"em-panel__head"},yB={class:"em-panel__head-row"},gB=["title"],bB={class:"em-panel__context"},_B={key:0,class:"em-panel__lock"},kB=["disabled"],EB={key:0,class:"em-attr__navhint"},NB={key:0,class:"em-panel__note"},wB={key:1,class:"em-panel__note"},IB={key:2,class:"em-jpa"},vB={class:"em-field"},CB={class:"em-field"},SB={class:"em-field"},xB={key:0,class:"em-field"},RB={class:"em-panel__note"},AB={class:"em-panel__sub"},$B={class:"em-field"},TB={class:"em-field"},MB={class:"em-jpa"},VB={key:0,class:"em-panel__note"},BB={key:1,class:"em-panel__note"},DB={class:"em-jpa"},OB={class:"em-field"},LB={key:0,class:"em-panel__note"},PB={class:"em-field"},zB={class:"em-multilang"},FB={class:"em-field"},UB=["value"],HB={class:"em-field"},jB={class:"em-swatch"},KB={class:"em-swatch__row"},GB=["title"],YB=["title","onClick"],qB={class:"em-panel__note"},WB={class:"em-field"},JB=["value"],XB={class:"em-swatch"},ZB={class:"em-swatch__row"},QB=["title"],eD=["title","onClick"],ay=Qe(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var G;return(G=r.value)==null?void 0:G.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const G=c.value;return G?l.state.logical.entities.find(q=>q.modelId===G)??null:null}),u=t.computed(()=>{const G=s.value;if((G==null?void 0:G.kind)==="association")return l.isAssociationLocked(G.id);const q=c.value;return!!q&&l.isEntityLocked(q)}),m=t.computed(()=>{var G;return((G=l.selectedAttr.value)==null?void 0:G.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function g(G){return h.value[G]??f.value}function b(G){h.value={...h.value,[G]:!g(G)}}const _=t.computed(()=>{var W;const G=d.value;if(!G)return l.t("em.entity.fallback");const q=(W=G.table)==null?void 0:W.physicalName;return q?`${G.name} (${q})`:G.name}),k=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="association"?l.state.logical.associations.find(q=>q.modelId===G.id)??null:null}),N=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="group"?l.state.logical.groups.find(q=>q.modelId===G.id)??null:null}),y=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="note"?l.state.layout.notes.find(q=>q.modelId===G.id)??null:null}),E=t.computed(()=>{var q,W;const G=(q=N.value)==null?void 0:q.name;return(G==null?void 0:G[l.userLanguage.value])||(G==null?void 0:G.ko)||(G==null?void 0:G.en)||(G==null?void 0:G.ja)||(G==null?void 0:G.zh)||((W=N.value)==null?void 0:W.packageName)||l.t("em.group.fallback")}),S=t.computed(()=>{if(d.value){const G=p.value.size;if(G>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:G});if(m.value){const q=d.value.attributes.find(W=>W.modelId===m.value);return(q==null?void 0:q.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(q==null?void 0:q.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(k.value){const G=q=>{var W;return((W=l.state.logical.entities.find(Ce=>Ce.modelId===q))==null?void 0:W.name)??q};return l.t("em.inspector.ctxAssoc",{a:G(k.value.end1.entityRef),b:G(k.value.end2.entityRef)})}return N.value?l.t("em.inspector.ctxGroup",{name:E.value}):y.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),A=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],V=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],T={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},D=G=>{const q=T[G];return q?l.t(q):G},C=G=>{var q;return((q=l.state.logical.entities.find(W=>W.modelId===G))==null?void 0:q.name)??G},R=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],$=["LIST","SET"],w=["inherit","LAZY","EAGER"],I=G=>G;function v(G){return G==="inherit"?l.t("em.common.inherit"):G}const B=t.computed(()=>!!k.value&&k.value.end1.entityRef===k.value.end2.entityRef);function M(G,q){k.value&&l.updateAssociationEnd(k.value.modelId,G,q)}function x(G){return Z.value?G:G==="end1"?"end2":"end1"}function P(G){var $e;const q=($e=k.value)==null?void 0:$e[G];if(!(q!=null&&q.attributeRef))return;const W=l.state.logical.entities.find(ze=>ze.modelId===q.entityRef),Ce=W==null?void 0:W.attributes.find(ze=>ze.modelId===q.attributeRef);return Ce&&(Ce.attrType==="RELATION_OWN"||Ce.attrType==="RELATION_REF")?Ce.name:void 0}function Y(G,q){var Ce;const W=(Ce=k.value)==null?void 0:Ce[G];W!=null&&W.attributeRef&&l.updateAttribute(W.entityRef,W.attributeRef,{name:q})}function se(G){var ze;const q=P(G);if(q!==void 0)return q;const W=(ze=k.value)==null?void 0:ze[G];if(W!=null&&W.navFieldNameHint)return W.navFieldNameHint;const Ce=G==="end1"?"end2":"end1",$e=l.state.logical.entities.find(Fe=>{var ae;return Fe.modelId===((ae=k.value)==null?void 0:ae[Ce].entityRef)});return $e?ua($e.name,ca(k.value[Ce].multiplicity)):""}function he(G){return!!Z.value||P(G)!==void 0}function ie(G){k.value&&!B.value&&l.setAssociationIdentifying(k.value.modelId,G)}function fe(G){var q,W,Ce;return!!((Ce=(W=(q=k.value)==null?void 0:q[G].jpa)==null?void 0:W.cascadeTypes)!=null&&Ce.includes("ALL"))}function pe(G,q,W){var ze,Fe;const Ce=(ze=k.value)==null?void 0:ze[G];if(q==="ALL"&&W){M(G,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:["ALL"]}});return}const $e=new Set(((Fe=Ce==null?void 0:Ce.jpa)==null?void 0:Fe.cascadeTypes)??[]);W?$e.add(q):$e.delete(q),M(G,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:[...$e]}})}function ge(G,q){var Ce;const W=(Ce=k.value)==null?void 0:Ce[G];M(G,{jpa:{...W==null?void 0:W.jpa,...q}})}function Te(G){var q,W;return((W=(q=k.value)==null?void 0:q[G].jpa)==null?void 0:W.fetchType)??"inherit"}function He(G,q){ge(G,{fetchType:q==="inherit"?void 0:q})}function De(G){var W;const q=(W=k.value)==null?void 0:W[G==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const Z=t.computed(()=>{const G=k.value;if(!G)return null;for(const q of l.state.logical.entities){const W=q.attributes.find(Fe=>{var ae;return((ae=Fe.embedded)==null?void 0:ae.associationRef)===G.modelId&&Fe.attrType==="EMBED_OWN"});if(!W)continue;const Ce=G.end2.entityRef===W.embedded.embeddableRef?"end2":"end1",$e=G[Ce].multiplicity,ze=G[Ce].jpa;return{which:Ce,cardinality:$e,isCollection:$e==="ZERO_OR_MORE_INSTANCES"||$e==="ONE_OR_MORE_INSTANCES",collectionType:(ze==null?void 0:ze.collectionType)??"LIST",collectionTable:(ze==null?void 0:ze.collectionTable)??"",orderColumn:(ze==null?void 0:ze.orderColumn)??""}}return null});function re(G){k.value&&l.setEmbedCardinality(k.value.modelId,G)}function ue(G){const q=Z.value;q&&ge(q.which,G==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function z(G){const q=Z.value;q&&ge(q.which,{collectionTable:G.trim()||void 0})}function L(G){const q=Z.value;q&&ge(q.which,{orderColumn:G.trim()||void 0})}function F(G){N.value&&l.updateGroup(N.value.modelId,G)}function X(G,q){var W;F({name:{...(W=N.value)==null?void 0:W.name,[G]:q}})}const ee=t.computed(()=>{var G;return N.value?$t((G=l.state.layout.groupLayouts.find(q=>q.groupRef===N.value.modelId))==null?void 0:G.style):null});function ke(G){N.value&&l.setGroupSwatch(N.value.modelId,G)}function ye(G){y.value&&l.setNoteMemo(y.value.modelId,G)}const Ne=t.computed(()=>{var G;return $t((G=y.value)==null?void 0:G.style)});function we(G){y.value&&l.setNoteSwatch(y.value.modelId,G)}return(G,q)=>(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(l).t("em.panel.resizeWidth"),onPointerdown:q[0]||(q[0]=(...W)=>e.startResize&&e.startResize(...W))},null,42,pB),t.createElementVNode("header",hB,[t.createElementVNode("div",yB,[q[14]||(q[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:q[1]||(q[1]=W=>a("collapse"))},[t.createVNode(Ve,{name:"panel-right-close",size:16})],8,gB)]),t.createElementVNode("p",bB,t.toDisplayString(S.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",_B,[t.createVNode(Ve,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:q[2]||(q[2]=W=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(ip,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:_.value,onToggle:q[3]||(q[3]=W=>b("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(XV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.unref(hn)(d.value.stereotype)?(t.openBlock(),t.createElementBlock("p",EB,t.toDisplayString(t.unref(l).t("em.entity.noIndexNote")),1)):(t.openBlock(),t.createBlock(oB,{key:1,controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:q[4]||(q[4]=W=>b("index"))},null,8,["controller","entity-id","collapsed"])),t.createVNode(fB,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:q[5]||(q[5]=W=>b("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(oe.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!k.value.identifying,disabled:B.value||!!Z.value,"onUpdate:modelValue":ie},null,8,["label","model-value","disabled"]),B.value?(t.openBlock(),t.createElementBlock("p",NB,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):Z.value?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),Z.value?(t.openBlock(),t.createElementBlock("fieldset",IB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",vB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":Z.value.cardinality,items:V,"value-provider":I,"label-provider":D,"onUpdate:modelValue":q[6]||(q[6]=W=>W&&re(W))},null,8,["model-value"])]),Z.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",CB,[q[15]||(q[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(oe.BSSelect),{"model-value":Z.value.collectionType,items:$,"value-provider":I,"label-provider":I,"onUpdate:modelValue":q[7]||(q[7]=W=>W&&ue(W))},null,8,["model-value"])]),t.createElementVNode("label",SB,[q[16]||(q[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":Z.value.collectionTable,"onUpdate:modelValue":z},null,8,["placeholder","model-value"])]),Z.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",xB,[q[17]||(q[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":Z.value.orderColumn,"onUpdate:modelValue":L},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",RB,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],W=>{var Ce,$e,ze;return t.withDirectives(t.createElementVNode("div",{key:W,class:"em-end"},[t.createElementVNode("h4",AB,t.toDisplayString(W)+" → "+t.toDisplayString(C(k.value[W].entityRef)),1),Z.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",$B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":k.value[W].multiplicity,items:A,"value-provider":I,"label-provider":t.unref(da),"onUpdate:modelValue":Fe=>M(W,{multiplicity:Fe})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-navigable`,class:"em-check",label:"navigable",title:x(W)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:x(W)==="end2","model-value":x(W)==="end2"?!0:k.value[x(W)].navigable,"onUpdate:modelValue":Fe=>M(x(W),{navigable:Fe})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",TB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(oe.BSTextInput),{name:`${x(W)}-navname`,width:"100%",disabled:!he(x(W)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":se(x(W)),"onUpdate:modelValue":Fe=>Y(x(W),Fe)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-composition`,class:"em-check",label:"composition","model-value":k.value[x(W)].composition,"onUpdate:modelValue":Fe=>M(x(W),{composition:Fe})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",MB,[q[18]||(q[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(R,Fe=>{var ae,Se;return t.createVNode(t.unref(oe.BSCheckbox),{key:Fe,name:`${x(W)}-cascade-${Fe}`,class:"em-check",label:Fe,"model-value":!!((Se=(ae=k.value[x(W)].jpa)==null?void 0:ae.cascadeTypes)!=null&&Se.includes(Fe)),disabled:!he(x(W))||Fe!=="ALL"&&fe(x(W)),"onUpdate:modelValue":Ge=>pe(x(W),Fe,Ge)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),he(x(W))?fe(x(W))?(t.openBlock(),t.createElementBlock("p",BB,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",VB,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",DB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",OB,[q[19]||(q[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(oe.BSSelect),{disabled:!he(x(W)),"model-value":Te(x(W)),items:w,"value-provider":I,"label-provider":v,"onUpdate:modelValue":Fe=>Fe&&He(x(W),Fe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ce=k.value[x(W)].jpa)!=null&&Ce.orphanRemoval),disabled:!he(x(W))||De(W),"onUpdate:modelValue":Fe=>ge(x(W),{orphanRemoval:Fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),De(W)&&(($e=k.value[x(W)].jpa)!=null&&$e.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",LB,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",PB,[q[20]||(q[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:`${x(W)}-orderby`,width:"100%",disabled:!he(x(W)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=k.value[x(W)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Fe=>ge(x(W),{orderBy:Fe.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!Z.value||W===Z.value.which]])}),64))],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",zB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,W=>{var Ce;return t.openBlock(),t.createElementBlock("label",{key:W,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(W),1),t.createVNode(t.unref(oe.BSTextInput),{name:`grp-name-${W}`,width:"100%","model-value":((Ce=N.value.name)==null?void 0:Ce[W])??"","onUpdate:modelValue":$e=>X(W,$e)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",FB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.value.description??"",rows:"3",onChange:q[8]||(q[8]=W=>F({description:W.target.value}))},null,40,UB)]),t.createElementVNode("label",HB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"grp-package",width:"100%","model-value":N.value.packageName??"","onUpdate:modelValue":q[9]||(q[9]=W=>F({packageName:W}))},null,8,["model-value"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":N.value.excludeDDLGeneration,"onUpdate:modelValue":q[10]||(q[10]=W=>F({excludeDDLGeneration:W}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",jB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",KB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ee.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[11]||(q[11]=W=>ke(null))},"∅",10,GB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),W=>(t.openBlock(),t.createElementBlock("button",{key:W,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ee.value===W}]),style:t.normalizeStyle({background:t.unref(Qo)(W)}),title:t.unref(l).t(t.unref(wo)(W)),onClick:Ce=>ke(W)},null,14,YB))),128))])]),t.createElementVNode("p",qB,t.toDisplayString(t.unref(l).t("em.group.members",{n:N.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",WB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:y.value.memo,rows:"6",onChange:q[12]||(q[12]=W=>ye(W.target.value))},null,40,JB)]),t.createElementVNode("fieldset",XB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",ZB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ne.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[13]||(q[13]=W=>we(null))},"∅",10,QB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),W=>(t.openBlock(),t.createElementBlock("button",{key:W,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ne.value===W}]),style:t.normalizeStyle({background:t.unref(Qo)(W)}),title:t.unref(l).t(t.unref(wo)(W)),onClick:Ce=>we(W)},null,14,eD))),128))])])],64)):t.createCommentVNode("",!0)],8,kB)],4))}}),[["__scopeId","data-v-d79a8574"]]),tD=["title"],nD={class:"em-validation__title"},oD=["title","onClick"],iD={key:0,class:"em-validation__body"},aD={class:"em-validation__opt"},rD={key:0,class:"em-validation__empty"},lD={key:1,class:"em-validation__empty"},sD={key:2,class:"em-validation__list"},cD=["onClick"],dD={class:"em-validation__item-msg"},uD={key:0,class:"em-validation__item-entity"},mD=["title","onClick"],fD=["title"],pD=Qe(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 g=new Map;for(const b of o.state.logical.entities)g.set(b.modelId,b.name);return g});function r(g){const b=EI(g);if(!b)return null;const _=a.value.get(b);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 g={error:0,warning:0,info:0};for(const b of i.value)g[b.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,b)=>l[g.severity].order-l[b.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:op(o.t,g),category:_I(o.t,g.ruleId)}))),m=t.ref(!1);function p(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,b)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:b[1]||(b[1]=_=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ve,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",nD,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,tD),t.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[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:m.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:k=>f(_)},[t.createVNode(Ve,{name:l[_].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[_]),1)],10,oD)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",iD,[t.createElementVNode("label",aD,[t.createVNode(t.unref(oe.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>t.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",rD,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",lD,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",sD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:_,entityName:k,message:N,category:y},E)=>(t.openBlock(),t.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${E}`,class:t.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:S=>h(_)},[t.createVNode(Ve,{name:l[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",dD,[k?(t.openBlock(),t.createElementBlock("span",uD,t.toDisplayString(k),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(N),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(S=>t.unref(o).applyQuickFix(_),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,mD)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},t.toDisplayString(y),9,fD)],10,cD))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),hD={class:"em-history"},yD={class:"em-history__head"},gD={class:"em-history__title"},bD={class:"em-history__head-actions"},_D=["title","disabled"],kD=["title"],ED={class:"em-history__filters"},ND={class:"em-history__filter"},wD={class:"em-history__filters em-history__filters--period"},ID={class:"em-history__filter-label"},vD=["title","aria-label","max"],CD=["title","aria-label","min"],SD=["title"],xD={key:0,class:"em-history__diffbar"},RD={class:"em-history__diffbar-range"},AD={class:"em-history__diffbar-count"},$D={class:"em-history__body"},TD={key:0,class:"em-history__empty"},MD={key:1,class:"em-history__diff-list"},VD=["onClick"],BD={class:"em-history__action-head"},DD={class:"em-history__action-name"},OD={key:0,class:"em-history__fields"},LD={class:"em-history__fname"},PD={key:0,class:"em-history__old"},zD={class:"em-history__val"},FD={key:1,class:"em-history__empty"},UD={key:2,class:"em-history__empty is-error"},HD={key:3,class:"em-history__empty"},jD={key:4,class:"em-history__list"},KD=["onClick"],GD={class:"em-history__summary"},YD={class:"em-history__seq"},qD={class:"em-history__gmeta"},WD={class:"em-history__who"},JD={key:0,class:"em-history__time"},XD={key:1,class:"em-history__restored-from"},ZD=["onClick"],QD={key:0,class:"em-history__detail"},eO={class:"em-history__action-head"},tO={class:"em-history__action-name"},nO={key:0,class:"em-history__fields"},oO={class:"em-history__fname"},iO={key:0,class:"em-history__old"},aO={class:"em-history__val"},rO={class:"em-history__preview"},lO=["disabled"],sO={key:0,class:"em-history__diff-list is-preview"},cO={class:"em-history__action-head"},dO={class:"em-history__action-name"},uO={key:0,class:"em-history__fields"},mO={class:"em-history__fname"},fO={key:0,class:"em-history__old"},pO={class:"em-history__val"},hO={class:"em-history__confirm-row"},yO={class:"em-history__confirm-msg"},gO=["disabled","onClick"],bO=["disabled"],_O=["onClick"],zr=50,kO=Qe(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),d=t.computed(()=>r.value.reduce((ae,Se)=>Se.seq>ae?Se.seq:ae,-1/0));async function u(ae){if(a.historyTransport){l.value=!0,s.value=null;try{const Se=!(ae!=null&&ae.full)&&r.value.length>0&&Number.isFinite(d.value),Ge=await a.historyTransport(Se?d.value:void 0);if(!Se)r.value=Ge;else if(Ge.length){const et=new Set(r.value.map(de=>de.seq)),te=Ge.filter(de=>!et.has(de.seq));te.length&&(r.value=[...r.value,...te])}c.value=!0}catch(Se){s.value=Se instanceof Error?Se.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,ae=>{ae?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(ae=>[ae.modelId,ae]))),b=t.computed(()=>new Map(a.state.logical.associations.map(ae=>[ae.modelId,ae]))),_=t.computed(()=>{const ae=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Se=>{var Ge,et;return[Se.modelId,Se.packageName||((Ge=Se.name)==null?void 0:Ge[ae])||((et=Se.name)==null?void 0:et.ko)||Se.modelId]}))});function k(ae){var te,de,Le,dt,Xe,yt,st;const Se=b.value.get(ae);if(!Se)return a.t("em.history.assocFallback");if((te=Se.description)!=null&&te.trim())return Se.description.trim();const Ge=(dt=(Le=g.value.get((de=Se.end1)==null?void 0:de.entityRef))==null?void 0:Le.name)==null?void 0:dt.trim(),et=(st=(yt=g.value.get((Xe=Se.end2)==null?void 0:Xe.entityRef))==null?void 0:yt.name)==null?void 0:st.trim();return Ge&&et?`${Ge}→${et}`:a.t("em.history.assocFallback")}function N(ae){var Se,Ge,et,te;if(ae.kind==="entity")return((Ge=(Se=g.value.get(ae.ref))==null?void 0:Se.name)==null?void 0:Ge.trim())||a.t("em.attr.nameless");if(ae.kind==="attribute"||ae.kind==="operation"||ae.kind==="index"){const de=ae.entityRef?g.value.get(ae.entityRef):void 0,dt=((ae.kind==="attribute"?de==null?void 0:de.attributes:ae.kind==="operation"?de==null?void 0:de.operations:de==null?void 0:de.indexes)??[]).find(yt=>yt.modelId===ae.ref),Xe=(et=de==null?void 0:de.name)==null?void 0:et.trim();return`${Xe?Xe+".":""}${((te=dt==null?void 0:dt.name)==null?void 0:te.trim())||ae.ref}`}return ae.kind==="association"?k(ae.ref):ae.kind==="associationEnd"?`${k(ae.ref)}(${ae.end})`:ae.kind==="group"?a.t("em.history.groupSubject",{name:_.value.get(ae.ref)??ae.ref}):ae.ref}const y={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"},S=t.ref("all"),A=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],V=t.computed({get:()=>S.value,set:ae=>{ae&&(S.value=ae)}}),T=t.computed(()=>Al(r.value)),D=t.computed(()=>T.value.length?T.value[0].seq:null),C=t.computed(()=>S.value==="all"?T.value:T.value.filter(ae=>(ae.kind??"edit")===S.value)),R=t.ref(zr),$=t.ref(""),w=t.ref(""),I=t.computed(()=>!!$.value||!!w.value);function v(){$.value="",w.value=""}const B=t.computed(()=>{const ae=$.value?new Date(`${$.value}T00:00:00`).getTime():null,Se=w.value?new Date(`${w.value}T23:59:59.999`).getTime():null;return ae==null&&Se==null?C.value:C.value.filter(Ge=>{if(Ge.ts==null)return!1;const et=new Date(Ge.ts).getTime();return!(isNaN(et)||ae!=null&&et<ae||Se!=null&&et>Se)})}),M=t.computed(()=>B.value.slice(0,R.value)),x=t.computed(()=>Math.max(0,B.value.length-R.value));function P(){R.value+=zr}t.watch([S,$,w],()=>{R.value=zr}),t.watch(()=>o.open,ae=>{ae&&(R.value=zr,v())});function Y(ae){return ae===void 0?"—":ae===null?a.t("em.history.emptyValue"):typeof ae=="object"?JSON.stringify(ae):String(ae)}function se(ae){const Se=N(ae.subject);if(ae.verb==="add")return a.t("em.history.summaryAdd",{name:Se});if(ae.verb==="remove")return a.t("em.history.summaryRemove",{name:Se});if(ae.fields.length===1){const Ge=ae.fields[0];return`${Se}.${Ge.field} ${Ge.oldValue!==void 0?Y(Ge.oldValue)+"→":""}${Y(Ge.value)}`}return a.t("em.history.summaryFields",{name:Se,n:ae.fields.length})}function he(ae){return ae.actions.length===0?a.t("em.history.noChange"):ae.actions.length===1?se(ae.actions[0]):a.t("em.history.summaryMore",{summary:se(ae.actions[0]),n:ae.actions.length-1})}const ie=t.ref(new Set);function fe(ae){const Se=new Set(ie.value);Se.has(ae)?Se.delete(ae):Se.add(ae),ie.value=Se}function pe(ae){if(ae==null)return"";const Se=new Date(ae);return isNaN(Se.getTime())?String(ae):Se.toLocaleString()}function ge(ae){const Se=ae.author,Ge=ae.origin;return Se&&Ge?`${Se}(${Ge})`:Se||(Ge?`(${Ge})`:"—")}const Te=t.computed(()=>p.value==null?null:$l(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Te.value?Ad(Te.value):null,ae=>i("diffChange",ae));function He(ae){p.value=ae,f.value=null,q.value=null}function De(){p.value=null,f.value=null}const Z=t.computed(()=>T.value.map(ae=>ae.seq)),re=t.computed(()=>D.value??1/0),ue=t.computed(()=>f.value??re.value),z=t.computed(()=>f.value??re.value),L=t.computed(()=>Z.value.filter(ae=>ae<ue.value).map(ae=>({v:ae}))),F=t.computed(()=>Z.value.filter(ae=>p.value!=null&&ae>p.value).map(ae=>({v:ae})));function X(ae){ae!=null&&(p.value=ae,f.value!=null&&f.value<=ae&&(f.value=null))}function ee(ae){ae!=null&&(f.value=ae>=re.value?null:ae)}function ke(ae){return ae>=re.value?a.t("em.history.diff.current"):`#${ae}`}function ye(ae){return ae.kind==="entity"?g.value.has(ae.ref)?ae.ref:null:(ae.kind==="attribute"||ae.kind==="operation"||ae.kind==="index")&&ae.entityRef?g.value.has(ae.entityRef)?ae.entityRef:null:ae.kind==="group"&&_.value.has(ae.ref)?ae.ref:null}function Ne(ae){const Se=ye(ae);Se&&a.requestFocus(Se)}const we={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},G={added:"add",modified:"update",removed:"remove"},q=t.ref(null),W=t.ref(!1),Ce=t.computed(()=>q.value==null?null:$l(r.value,{fromSeq:q.value})),$e=t.ref(!1);function ze(ae){q.value=ae,$e.value=!1}async function Fe(ae){W.value=!0;try{const Se=await a.restoreToSeq(ae);Se.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Se.reason??a.t("em.history.unknown")})}finally{W.value=!1,q.value=null}}return(ae,Se)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Ge,et;return[t.withDirectives(t.createElementVNode("section",hD,[t.createElementVNode("header",yD,[t.createElementVNode("div",gD,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",bD,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Se[0]||(Se[0]=te=>u({full:!0}))},[t.createVNode(Ve,{name:"redo",size:15})],8,_D),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Se[1]||(Se[1]=te=>i("close"))},[t.createVNode(Ve,{name:"panel-close",size:15})],8,kD)])]),t.createElementVNode("div",ED,[t.createElementVNode("label",ND,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(oe.BSSelect),{modelValue:V.value,"onUpdate:modelValue":Se[2]||(Se[2]=te=>V.value=te),items:A,"value-provider":te=>te.v,"label-provider":te=>t.unref(a).t(te.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",wD,[t.createElementVNode("span",ID,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:w.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=te=>$.value=te)},null,8,vD),[[t.vModelText,$.value]]),Se[9]||(Se[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:$.value||void 0,"onUpdate:modelValue":Se[4]||(Se[4]=te=>w.value=te)},null,8,CD),[[t.vModelText,w.value]]),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ve,{name:"x",size:12})],8,SD)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",xD,[t.createElementVNode("div",RD,[t.createVNode(t.unref(oe.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:L.value,"value-provider":te=>te.v,"label-provider":te=>`#${te.v}`,"onUpdate:modelValue":Se[5]||(Se[5]=te=>X(te??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ve,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(oe.BSSelect),{class:"em-history__range-sel","model-value":z.value,items:F.value,"value-provider":te=>te.v,"label-provider":te=>ke(te.v),"onUpdate:modelValue":Se[6]||(Se[6]=te=>ee(te??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",AD,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Ge=Te.value)==null?void 0:Ge.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:De},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",$D,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(et=Te.value)!=null&&et.entries.length?(t.openBlock(),t.createElementBlock("ul",MD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Te.value.entries,(te,de)=>(t.openBlock(),t.createElementBlock("li",{key:de,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!ye(te.subject)}]),onClick:Le=>Ne(te.subject)},[t.createElementVNode("div",BD,[t.createVNode(Ve,{name:y[te.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",DD,t.toDisplayString(N(te.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[te.verb]}`])},t.toDisplayString(t.unref(a).t(we[te.verb])),3)]),te.fields.length?(t.openBlock(),t.createElementBlock("ul",OD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.fields,(Le,dt)=>(t.openBlock(),t.createElementBlock("li",{key:dt,class:"em-history__field"},[t.createElementVNode("span",LD,t.toDisplayString(Le.field),1),Le.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",PD,t.toDisplayString(Y(Le.oldValue)),1)):t.createCommentVNode("",!0),Le.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",zD,t.toDisplayString(Y(Le.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,VD))),128))])):(t.openBlock(),t.createElementBlock("p",TD,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",FD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",UD,t.toDisplayString(s.value),1)):B.value.length===0?(t.openBlock(),t.createElementBlock("p",HD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",jD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.value,te=>{var de,Le,dt;return t.openBlock(),t.createElementBlock("li",{key:te.seq,class:t.normalizeClass(["em-history__group",[`is-${te.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Xe=>fe(te.seq)},[t.createVNode(Ve,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ie.value.has(te.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${te.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(te.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",GD,t.toDisplayString(he(te)),1),t.createElementVNode("span",YD,"#"+t.toDisplayString(te.seq),1)],8,KD),t.createElementVNode("div",qD,[t.createElementVNode("span",WD,t.toDisplayString(ge(te)),1),te.ts?(t.openBlock(),t.createElementBlock("span",JD,t.toDisplayString(pe(te.ts)),1)):t.createCommentVNode("",!0),te.kind==="restore"&&te.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",XD,"← #"+t.toDisplayString(te.restoredFromSeq),1)):t.createCommentVNode("",!0),te.seq!==D.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Xe=>He(te.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,ZD)):t.createCommentVNode("",!0)]),ie.value.has(te.seq)?(t.openBlock(),t.createElementBlock("div",QD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.actions,(Xe,yt)=>(t.openBlock(),t.createElementBlock("div",{key:yt,class:"em-history__action"},[t.createElementVNode("div",eO,[t.createVNode(Ve,{name:y[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",tO,t.toDisplayString(N(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Xe.verb}`])},t.toDisplayString(t.unref(a).t(E[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",nO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,ft)=>(t.openBlock(),t.createElementBlock("li",{key:ft,class:"em-history__field"},[t.createElementVNode("span",oO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",iO,t.toDisplayString(Y(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",aO,t.toDisplayString(Y(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&te.seq!==D.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":q.value===te.seq}])},[q.value===te.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",rO,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((de=Ce.value)!=null&&de.entries.length),onClick:Se[7]||(Se[7]=Xe=>$e.value=!$e.value)},[t.createVNode(Ve,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":$e.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Le=Ce.value)!=null&&Le.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:Ce.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,lO),$e.value&&((dt=Ce.value)!=null&&dt.entries.length)?(t.openBlock(),t.createElementBlock("ul",sO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce.value.entries,(Xe,yt)=>(t.openBlock(),t.createElementBlock("li",{key:yt,class:"em-history__diff-entry"},[t.createElementVNode("div",cO,[t.createVNode(Ve,{name:y[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",dO,t.toDisplayString(N(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[Xe.verb]}`])},t.toDisplayString(t.unref(a).t(we[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",uO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,ft)=>(t.openBlock(),t.createElementBlock("li",{key:ft,class:"em-history__field"},[t.createElementVNode("span",mO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",fO,t.toDisplayString(Y(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",pO,t.toDisplayString(Y(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",hO,[t.createElementVNode("span",yO,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:Xe=>Fe(te.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,gO),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:Se[8]||(Se[8]=Xe=>q.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,bO)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Xe=>ze(te.seq)},[t.createVNode(Ve,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,_O))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&x.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:P},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:x.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function EO(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 ry(e){const n=t.ref(EO(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 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)),n.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(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const NO={class:"em-modeler"},wO={class:"em-modeler__body"},IO={class:"em-drawer__inner"},vO={class:"em-drawer__head"},CO={class:"em-drawer__actions"},SO=["title"],xO=["title"],RO=["title"],AO=["title"],$O=["title"],TO=Qe(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(y){t.nextTick(()=>{const E=y();E&&("focusCollapse"in E?E.focusCollapse():E.focus())})}function c(y){n.value=y,s(()=>y?i.value:a.value)}function d(y){o.value=y,s(()=>y?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=ry({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:b,startResize:_}=ry({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),k=t.ref(null),N=t.ref(null);return(y,E)=>{var S,A,V;return t.openBlock(),t.createElementBlock("div",NO,[t.createVNode(iy,{controller:e.controller,"history-open":u.value,onExportSvg:E[0]||(E[0]=T=>{var D;return(D=k.value)==null?void 0:D.exportSvg()}),onExportPng:E[1]||(E[1]=T=>{var D;return(D=k.value)==null?void 0:D.exportPng()}),onToggleHistory:E[2]||(E[2]=T=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",wO,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",IO,[t.createElementVNode("header",vO,[E[11]||(E[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",CO,[(S=N.value)!=null&&S.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((A=N.value)!=null&&A.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:E[3]||(E[3]=T=>{var D;return(D=N.value)==null?void 0:D.toggleAll()})},[t.createVNode(Ve,{name:(V=N.value)!=null&&V.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,SO)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:E[4]||(E[4]=T=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,xO)])]),t.createVNode(oy,{ref_key:"explorer",ref:N,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:E[5]||(E[5]=(...T)=>t.unref(h)&&t.unref(h)(...T))},null,42,RO),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:E[6]||(E[6]=T=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,AO),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(ny,{ref_key:"canvas",ref:k,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ay,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(b),"start-resize":t.unref(_),onCollapse:E[7]||(E[7]=T=>d(!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",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:E[8]||(E[8]=T=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,$O),[[t.vShow,!o.value]])]),_:1}),t.createVNode(kO,{controller:e.controller,open:u.value,onClose:E[9]||(E[9]=T=>u.value=!1),onDiffChange:E[10]||(E[10]=T=>m.value=T)},null,8,["controller","open"])]),t.createVNode(pD,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=x_,be.AssociationEdge=eh,be.CUSTOM_TYPE_VALUE=_n,be.CommandStack=Tl,be.DEFAULT_JAVA_TYPE=Wr,be.DIAGRAM_JSON_FORMAT=il,be.DIAGRAM_JSON_VERSION=al,be.DiagramCanvas=ny,be.DiagramExplorer=oy,be.EDITOR=Gn,be.EditModeToggle=tV,be.EditorToolbar=iy,be.EntityModeler=TO,be.EntityNode=Vp,be.GROUP_CODE_ENUM_VALUE=eo,be.GroupNode=Bp,be.INHERITED_REF_PREFIX=oa,be.InvalidDiagramJsonError=oo,be.JAVA_TYPES=ui,be.LIB_VERSION=ib,be.NoteNode=Dp,be.OpSyncAdapter=ku,be.PHYSICAL_NAME_MAX_LENGTH=hi,be.PropertyPanel=ay,be.RevCache=_u,be.SELECTABLE_JAVA_TYPES=Cc,be.SYMBOLIC_OP_KINDS=Eu,be.SYMBOLIC_OP_SCHEMA=Ku,be.UI_LOCALES=ZI,be.applyDocumentReferenceOnly=Zr,be.buildAgentBatch=R_,be.buildDiagramSvg=cc,be.buildDiffMarks=Ad,be.collectSharedColumns=Dn,be.commands=Rb,be.computeAutoLayout=fc,be.createEditorController=zS,be.dedupeModelIds=nb,be.defaultMermaidDialect=Vy,be.defaultSqlDialect=tg,be.diagramToJson=Wc,be.displayLabel=ra,be.emptyState=Ep,be.entityModelToDdl=Yc,be.entityModelToMermaid=Qr,be.entityModelToText=Mc,be.exportDiagramPng=ey,be.exportDiagramSvg=Qh,be.fromPersisted=tm,be.isGeneratable=dd,be.isInheritedColumnRef=Xn,be.isValueTypeStereotype=_t,be.javaTypeLabel=mi,be.makeInheritedColumnRef=yc,be.mergeDiagram=Id,be.mermaidErToImportSource=Uc,be.migrateLegacyMoney=tb,be.multiplicityLabel=da,be.newId=Pe,be.packEntityBoxes=Ur,be.parseDiagramJson=Jc,be.parseInheritedColumnRef=Hr,be.parseMermaidEr=Fc,be.parseSqlDdl=nl,be.planHealBackfillOps=ck,be.projectActionLog=Al,be.projectEntityAudit=xd,be.projectFieldAudit=Ln,be.projectInheritedColumns=si,be.projectSeqDiff=$l,be.renderDiagramSvg=Zc,be.resolveColumnPhysicalName=ci,be.resolveDiagram=mc,be.resolveEffectiveColumn=bn,be.resolveQuickFix=ml,be.resolveSharedColumn=Qn,be.resolveSymbolicOps=s_,be.restoreDeepEqual=ro,be.scaffoldEntityJava=Ag,be.sharedColumnScopeEntities=Gr,be.sqlDdlToImportSource=Gc,be.stereotypeLabel=li,be.synthesizeRestoreOps=hb,be.toPersisted=rk,be.toPersistedV2=lk,be.translate=en,be.uiMessagesEn=lp,be.uiMessagesJa=sp,be.uiMessagesKo=cp,be.validateModel=ga,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(g.value){const x=Yn(g.value),P=he=>{if(he.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const ie=he.sourceEvent.ctrlKey&&zi()?10:1,fe=-he.sourceEvent.deltaY*(he.sourceEvent.deltaMode===1?.05:he.sourceEvent.deltaMode?1:.002)*e.zoomStep,pe=c.value.zoom*2**(fe*ie);f.value.scaleTo(p.value,pe)},Y=he=>{if(he.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const ie=T.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),fe={x:c.value.x-he.sourceEvent.movementX*ie,y:c.value.y-he.sourceEvent.movementY*ie},pe=[[0,0],[u.value.width,u.value.height]],ge=ic.translate(fe.x,fe.y).scale(c.value.zoom),Te=f.value.constrain()(ge,pe,d.value);f.value.transform(p.value,Te)},se=oM().wheelDelta(he=>ys(he)*(e.zoomStep/10)).on("zoom",e.pannable?Y:()=>{}).on("zoom.wheel",e.zoomable?P:()=>{});x.call(se),M(()=>{x.on("zoom",null)})}},{flush:"post"});function R(M){const[x,P]=qn(M);n("click",{event:M,position:{x,y:P}})}function $(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeClick(P),n("nodeClick",P)}function w(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeDoubleClick(P),n("nodeDblclick",P)}function I(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseEnter(P),n("nodeMouseenter",P)}function v(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseMove(P),n("nodeMousemove",P)}function B(M,x){const P={event:M,node:x,connectedEdges:_o([x],s.value)};m.miniMapNodeMouseLeave(P),n("nodeMouseleave",P)}return(M,x)=>(t.openBlock(),t.createBlock(t.unref(ep),{position:M.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:M.pannable,zoomable:M.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:b.value,height:_.value,viewBox:[D.value.x,D.value.y,D.value.width,D.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:R},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,sM)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(h),P=>(t.openBlock(),t.createBlock(rM,{id:P.id,key:P.id,f:"",position:P.computedPosition,dimensions:P.dimensions,selected:P.selected,dragging:P.dragging,style:t.normalizeStyle(P.style),class:t.normalizeClass(k.value(P)),color:N.value(P),"border-radius":M.nodeBorderRadius,"stroke-color":y.value(P),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(E),type:P.type,hidden:P.hidden,onClick:Y=>$(Y,P),onDblclick:Y=>w(Y,P),onMouseenter:Y=>I(Y,P),onMousemove:Y=>v(Y,P),onMouseleave:Y=>B(Y,P)},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:C.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,cM)],8,lM))]),_:1},8,["position","class"]))}}),mM=["d"],fM=["cx","cy","onDblclick"],pM=["x","y","onPointerdown","onDblclick"],hM=Qe(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=tt(),i=t.inject(Ps),a=t.inject(Gn,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(vo,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),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((V,T)=>T===d.value?u.value:V)),{source:p,target:f,sourceSide:h,targetSide:g}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),b=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Bs(p.value,h.value,m.value,f.value,g.value):Ds(p.value,m.value,f.value)),_=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Lp(p.value,h.value,m.value,f.value,g.value):Fp(p.value,m.value,f.value).map((V,T)=>({point:V,segIndex:T})):[]),E=t.computed(()=>r.value?m.value:[]);function N(V,T){d.value=V,u.value={...c.value[V]},T.target.setPointerCapture(T.pointerId),T.stopPropagation()}function y(V){if(d.value<0)return;const T=o({x:V.clientX,y:V.clientY});u.value={x:T.x,y:T.y}}function k(V){var T,D;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(D=(T=V.target).releasePointerCapture)==null||D.call(T,V.pointerId)}function S(V,T){T.stopPropagation(),i==null||i.removePoint(n.id,V)}function A(V,T){if(!i)return;const D=o({x:T.clientX,y:T.clientY});i.insertPoint(n.id,V,{x:D.x,y:D.y})}return(V,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:b.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,mM),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(D,C)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${C}`,cx:D.point.x,cy:D.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(R=>A(D.segIndex,R),["stop"])},null,42,fM))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(D,C)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${C}`,x:D.x-5,y:D.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:R=>N(C,R),onPointermove:y,onPointerup:k,onDblclick:R=>S(C,R)},null,42,pM))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),yM=["d"],gM=Qe(t.defineComponent({inheritAttrs:!1,__name:"SerializedTypeEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,o=t.inject(Gn,null),i=t.inject(vo,null),a=t.computed(()=>!!i&&i.active.value&&(!i.relatedEntityIds.value.has(n.data.consumerRef)||!i.relatedEntityIds.value.has(n.data.typeRef))),{source:r,target:l,sourceSide:s,targetSide:c}=Ls({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>[]}),d=t.computed(()=>(o==null?void 0:o.routingMode.value)==="orthogonal"?Bs(r.value,s.value,[],l.value,c.value):Ds(r.value,[],l.value));return(u,m)=>(t.openBlock(),t.createElementBlock("path",{d:d.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"2 5","stroke-linecap":"round",class:t.normalizeClass(["em-serialized-edge__path",{"is-dimmed":a.value}])},null,10,yM))}}),[["__scopeId","data-v-67430658"]]),bM=["data-theme"],_M={key:0,class:"em-ctx__sep",role:"separator"},kM=["aria-label"],EM={class:"em-ctx__swatches-label","aria-hidden":"true"},NM={class:"em-ctx__chips",role:"none"},wM=["aria-checked","aria-label","title","onClick"],IM=["aria-checked","aria-label","title","onClick"],vM=["disabled","onClick"],CM={class:"em-ctx__icon"},SM={class:"em-ctx__caption"},xM=Qe(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(N,y)=>en(o.locale??"ko",N,y),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(N,y){var A,V;r.value=y,l.value=(A=N.target)!=null&&A.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=N.clientX,c.y=N.clientY,a.value=!0,window.addEventListener("keydown",b),window.addEventListener("resize",p),await t.nextTick();const k=s.value;if(!k)return;const S=k.getBoundingClientRect();c.x+S.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-S.width)),c.y+S.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-S.height)),(V=f()[0])==null||V.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",b),window.removeEventListener("resize",p);const N=d;d=null,N!=null&&N.isConnected&&N.focus()}function f(){const N=s.value;if(!N)return[];const y=[];for(const k of Array.from(N.children))if(k.classList.contains("em-ctx__item"))k.disabled||y.push(k);else if(k.classList.contains("em-ctx__swatches")){const S=Array.from(k.querySelectorAll(".em-ctx__chip"));S.length&&y.push(S.find(A=>A===document.activeElement)??S[0])}return y}function h(N){var A;const y=f();if(!y.length)return;const k=y.indexOf(document.activeElement),S=k<0?N>0?0:y.length-1:(k+N+y.length)%y.length;(A=y[S])==null||A.focus()}function g(N){var A,V;const y=(A=document.activeElement)==null?void 0:A.closest(".em-ctx__swatches");if(!y)return!1;const k=Array.from(y.querySelectorAll(".em-ctx__chip")),S=k.indexOf(document.activeElement);return S<0?!1:((V=k[(S+N+k.length)%k.length])==null||V.focus(),!0)}function b(N){var y,k;switch(N.key){case"Escape":N.stopPropagation(),p();return;case"ArrowDown":N.preventDefault(),h(1);return;case"ArrowUp":N.preventDefault(),h(-1);return;case"ArrowRight":g(1)&&N.preventDefault();return;case"ArrowLeft":g(-1)&&N.preventDefault();return;case"Home":N.preventDefault(),(y=f()[0])==null||y.focus();return;case"End":{N.preventDefault();const S=f();(k=S[S.length-1])==null||k.focus();return}case"Tab":N.preventDefault(),h(N.shiftKey?-1:1)}}function _(N){N.disabled||(N.handler(),p())}function E(N,y){N.onPick(y),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(N,y)=>(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:p,onContextmenu:t.withModifiers(p,["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:y[0]||(y[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(k,S)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S},[k.type==="separator"?(t.openBlock(),t.createElementBlock("div",_M)):k.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":k.caption},[t.createElementVNode("span",EM,t.toDisplayString(k.caption),1),t.createElementVNode("div",NM,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":k.current===null}]),role:"menuitemradio","aria-checked":k.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:A=>E(k,null)},null,10,wM),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":k.current===A}]),style:t.normalizeStyle({background:t.unref(Qo)(A)}),role:"menuitemradio","aria-checked":k.current===A,"aria-label":i(t.unref(wo)(A)),title:i(t.unref(wo)(A)),onClick:V=>E(k,A)},null,14,IM))),128))])],8,kM)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":k.danger,"is-disabled":k.disabled}]),disabled:k.disabled,role:"menuitem",onClick:A=>_(k)},[t.createElementVNode("span",CM,[k.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:k.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",SM,t.toDisplayString(k.caption),1)],10,vM))],64))),128))],36)],8,bM)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function rc(e,n){return`serialized:${e}:${n}`}function Yh(e){const n=Mo(e);if(n.size===0)return[];const o=new Map;for(const i of e.entities)for(const a of i.attributes){if(a.attrType!=="NORMAL")continue;const r=di(a,n,i,e);if(r.kind!=="resolved")continue;const l=r.entity;if(l.modelId===i.modelId)continue;const s=rc(i.modelId,l.modelId),c=o.get(s);c?c.usageCount++:o.set(s,{consumerRef:i.modelId,typeRef:l.modelId,usageCount:1})}return[...o.values()]}function qh(e,n){return n?`${e}:${n}`:e}function Wh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(qh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function RM(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=qh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function Jh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(Wh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=Wh(e.storageKey,s)),t.watch(o,s=>RM(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const lc=[".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 ai(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function AM(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function $M(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 h=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(h.width===0&&h.height===0)return[];const g=n(h.left,h.top+h.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,p=0;const f=()=>{const h=d.trim();if(h){const g=n(m,(u+p)/2);c.push({...i,x:g.x,y:g.y,text:h})}d=""};for(let h=0;h<s.length;h++){a.setStart(r,h),a.setEnd(r,h+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,p=g.bottom,d=s[h]):(d+=s[h],p=Math.max(p,g.bottom))}return f(),c}function Pr(e,n){const o=[];for(const i of e.querySelectorAll("*"))AM(i)&&(i.closest(lc)||ai(i)&&o.push(...$M(i,n)));return o}function Qi(e){return Math.round(e*100)/100}function TM(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(lc)||!ai(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="${Qi(r.x)}" y="${Qi(r.y)}" width="${Qi(l.x-r.x)}" height="${Qi(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 MM(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!ai(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=>Qi(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 Xh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(lc)||!ai(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 ea(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 sc(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 VM(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,h)=>e.screenToFlowCoordinate({x:f,y:h}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const h=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!h||!ai(h))continue;const g=h.firstElementChild;if(g)if(f.type==="group"){const b=ea(g,o);sc(s,b),i.push({...b,texts:[]});const _=g.querySelector(".em-group__label");_&&i.push({...ea(_,o),stroke:"none",texts:[]}),i.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Pr(g,o)})}else if(f.type==="note"){const b={...ea(g,o),texts:Pr(g,o),lines:Xh(g,g,o)};sc(s,b),r.push(b)}else{const b=ea(g,o);sc(s,b);const _=b.radius??{tl:0,tr:0};a.push({...b,stroke:"none",texts:[]});const E=g.querySelector(".em-entity__header");if(E){const N=ea(E,o);a.push({x:b.x,y:b.y,w:b.w,h:N.y+N.h-b.y,fill:N.fill,stroke:"none",radius:{tl:_.tl,tr:_.tr,br:0,bl:0},texts:[]})}a.push({...b,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:Pr(g,o),lines:Xh(g,g,o),icons:TM(g,o)}),a.push({...b,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const h=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!h||!ai(h))continue;const g=h.getAttribute("d");if(!g)continue;const b=getComputedStyle(h),_=b.strokeDasharray,E=MM(f);l.push({d:g,stroke:b.stroke,strokeWidth:parseFloat(b.strokeWidth)||1.5,strokeDasharray:_&&_!=="none"?_:void 0,labels:Pr(f,o),markers:E.length?E:void 0})}const c=n.closest(".em-canvas")??n,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 cc(e){return Zc(VM(e))}function Zh(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 Qh(e,n="diagram.svg"){const o=cc(e);Zh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function BM(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 ey(e,n="diagram.png",o=2){const i=cc(e),{w:a,h:r}=BM(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,p)=>{s.onload=()=>m(),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 u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");Zh(u,n)}finally{URL.revokeObjectURL(l)}}const DM={class:"em-shortcuts"},OM={class:"em-shortcuts__list"},LM={class:"em-shortcuts__title"},PM={class:"em-shortcuts__keys"},zM={class:"em-shortcuts__kbd"},FM={key:0,class:"em-shortcuts__plus"},UM={class:"em-shortcuts__desc"},HM={class:"em-shortcuts__actions"},ty=Qe(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(s,c)=>en(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.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{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(oe.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",DM,[t.createElementVNode("div",OM,[(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",LM,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",PM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",zM,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",FM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",UM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",HM,[t.createVNode(t.unref(oe.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-38f2450f"]]);function ri(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function jM(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 KM=["aria-label"],GM=["aria-activedescendant","aria-label","placeholder"],YM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},qM=["aria-label"],WM={class:"em-cmdk__section","aria-hidden":"true"},JM=["id","aria-selected","onMouseenter","onClick"],XM={class:"em-cmdk__label"},ZM={key:0,class:"em-cmdk__tag"},QM={key:1,class:"em-cmdk__sub"},e2=["aria-label"],t2={class:"em-cmdk__section","aria-hidden":"true"},n2=["id","aria-selected","aria-disabled","onMouseenter","onClick"],o2={class:"em-cmdk__label"},i2={key:1,class:"em-cmdk__empty"},a2=Qe(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 k=c.value,S=a.state.logical.entities.map(V=>{var T,D,C,R,$,w;return{type:"goto",kind:"entity",id:V.modelId,label:((D=(T=V.table)==null?void 0:T.logicalName)==null?void 0:D[k])||V.name,sub:(C=V.table)==null?void 0:C.physicalName,match:ri(V.name,($=(R=V.table)==null?void 0:R.logicalName)==null?void 0:$[k],(w=V.table)==null?void 0:w.physicalName)??""}}),A=a.state.logical.groups.map(V=>{var T,D,C,R;return{type:"goto",kind:"group",id:V.modelId,label:((T=V.name)==null?void 0:T[k])||((D=V.name)==null?void 0:D.ko)||V.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:ri((C=V.name)==null?void 0:C[k],(R=V.name)==null?void 0:R.ko,V.packageName)??""}});return[...S,...A]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const k=[];a.editable.value&&(k.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),k.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),k.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),k.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),k.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),k.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),k.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),k.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const S of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])k.push({type:"action",id:`dm-${S}`,label:a.t(u[S]),run:()=>a.displayMode.value=S});return k});function p(k,S){return k.label.toLowerCase().includes(S)}const f=t.computed(()=>{const k=r.value.trim().toLowerCase();return k?d.value.filter(S=>S.match.includes(k)):d.value}),h=t.computed(()=>{const k=r.value.trim().toLowerCase();return k?m.value.filter(S=>p(S,k)):m.value}),g=t.computed(()=>[...f.value,...h.value]);t.watch([f,h],()=>{l.value=0});function b(k){return g.value.indexOf(k)}const _=k=>`em-cmdk-opt-${k}`,E=t.computed(()=>g.value[l.value]?_(l.value):void 0);t.watch(l,async()=>{var S;await t.nextTick();const k=E.value;k&&((S=document.getElementById(k))==null||S.scrollIntoView({block:"nearest"}))});function N(k){if(k.type==="goto")a.selection.value={kind:k.kind,id:k.id},a.requestFocus(k.id);else{if(k.disabled)return;k.run()}i("close")}function y(k){if(k.key==="Escape"){i("close"),k.preventDefault();return}if(k.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),k.preventDefault();return}if(k.key==="ArrowUp"){l.value=Math.max(l.value-1,0),k.preventDefault();return}if(k.key==="Enter"){const S=g.value[l.value];S&&N(S),k.preventDefault();return}k.key==="Tab"&&k.preventDefault()}return t.nextTick(()=>{var k;return(k=s.value)==null?void 0:k.focus()}),(k,S)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:S[1]||(S[1]=t.withModifiers(A=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":S[0]||(S[0]=A=>r.value=A),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":E.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:y},null,40,GM),[[t.vModelText,r.value]]),t.createElementVNode("div",YM,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",WM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(b(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":b(A)===l.value}]),role:"option","aria-selected":b(A)===l.value,onMouseenter:V=>l.value=b(A),onClick:V=>N(A)},[t.createElementVNode("span",XM,t.toDisplayString(A.label),1),A.tag?(t.openBlock(),t.createElementBlock("span",ZM,t.toDisplayString(A.tag),1)):A.sub?(t.openBlock(),t.createElementBlock("span",QM,t.toDisplayString(A.sub),1)):t.createCommentVNode("",!0)],42,JM))),128))],8,qM)):t.createCommentVNode("",!0),h.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",t2,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,A=>(t.openBlock(),t.createElementBlock("button",{id:_(b(A)),key:A.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":b(A)===l.value,"is-disabled":A.disabled}]),role:"option","aria-selected":b(A)===l.value,"aria-disabled":A.disabled||void 0,onMouseenter:V=>l.value=b(A),onClick:V=>N(A)},[t.createElementVNode("span",o2,t.toDisplayString(A.label),1)],42,n2))),128))],8,e2)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",i2,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,KM)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function r2(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const l2={key:0,class:"em-canvas__empty","aria-hidden":"true"},s2={class:"em-canvas__empty-title"},c2=["innerHTML"],d2=["innerHTML"],u2=["innerHTML"],m2={key:1,class:"em-canvas__empty-title"},f2={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},p2={class:"em-conflict-banner__body"},h2={class:"em-conflict-banner__title"},y2={class:"em-conflict-banner__detail"},g2={key:0,class:"em-toast",role:"status","aria-live":"polite"},dc="nc:",ny=Qe(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=oe.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(O){l.value=O,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,O=>{O&&c(O.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const O=r2(i.opConflict.value);return O?{title:i.t(O.titleKey),detail:i.t(O.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(O){p.x=O.clientX,p.y=O.clientY}const h=t.ref(null);t.provide(br,h);const g=t.ref(null);t.provide(Np,g);const b=t.ref(null),_=t.computed(()=>{const O=b.value,U=new Set;if(!O)return U;if(O.kind==="entity")U.add(O.id);else if(O.kind==="group"){const le=i.resolved.value.groups.find(ne=>ne.group.modelId===O.id);for(const ne of(le==null?void 0:le.group.memberEntityRefs)??[])U.add(ne)}return U}),E=t.computed(()=>{const O=b.value,U=new Set(_.value),le=new Set,ne=new Set;if(!O)return{related:U,edges:le,notes:ne};if(O.kind==="note"){ne.add(O.id);for(const Be of i.resolved.value.noteConnections)Be.noteRef===O.id&&U.add(Be.targetRef);return{related:U,edges:le,notes:ne}}const xe=_.value;if(!xe.size)return{related:U,edges:le,notes:ne};for(const Be of i.resolved.value.associations){const{end1:qe,end2:je}=Be.association;(xe.has(qe.entityRef)||xe.has(je.entityRef))&&(le.add(Be.association.modelId),U.add(qe.entityRef),U.add(je.entityRef))}for(const Be of i.resolved.value.noteConnections)U.has(Be.targetRef)&&ne.add(Be.noteRef);return{related:U,edges:le,notes:ne}});t.provide(vo,{source:b,active:t.computed(()=>b.value!==null),primaryEntityIds:_,relatedEntityIds:t.computed(()=>E.value.related),relatedEdgeIds:t.computed(()=>E.value.edges),relatedNoteIds:t.computed(()=>E.value.notes),hoverGroupId:t.computed(()=>{var O;return((O=b.value)==null?void 0:O.kind)==="group"?b.value.id:null}),setEntityHover:O=>{g.value||m.value||(b.value=O?{kind:"entity",id:O}:null)},setGroupHover:O=>{g.value||m.value||(b.value=O?{kind:"group",id:O}:null)},setNoteHover:O=>{g.value||m.value||(b.value=O?{kind:"note",id:O}:null)}}),t.provide(Gn,i);const N=KS(),y=t.computed(()=>N(i.state.logical,i.embeddableCatalog.value));t.provide(vp,y);const k=Jh({expandableKeys:()=>[],defaultCollapsed:WS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(xp,{isCollapsed:k.isCollapsed,toggle:k.toggle}),t.provide(wp,{marks:t.toRef(o,"diffMarks")});function S(O,U){return`${dc}${O}:${U}`}function A(O){if(!O.startsWith(dc))return null;const[U,le]=O.slice(dc.length).split(":");return U&&le?{noteRef:U,targetRef:le}:null}t.provide(Ps,{points:O=>{var le,ne;const U=A(O);return U?((le=i.resolved.value.noteConnections.find(xe=>xe.noteRef===U.noteRef&&xe.targetRef===U.targetRef))==null?void 0:le.waypoints)??[]:((ne=i.resolved.value.associations.find(xe=>xe.association.modelId===O))==null?void 0:ne.waypoints)??[]},movePoint:(O,U,le)=>{const ne=A(O);ne?i.moveNoteConnectionWaypoint(ne.noteRef,ne.targetRef,U,le):i.moveWaypoint(O,U,le)},insertPoint:(O,U,le)=>{const ne=A(O);ne?i.addNoteConnectionWaypoint(ne.noteRef,ne.targetRef,U,le):i.addWaypoint(O,U,le)},removePoint:(O,U)=>{const le=A(O);le?i.removeNoteConnectionWaypoint(le.noteRef,le.targetRef,U):i.removeWaypoint(O,U)}});const V=tt(),{nodes:T,edges:D,findNode:C,findEdge:R,addNodes:$,addEdges:w,removeNodes:I,removeEdges:v,fitView:B,setCenter:M,getViewport:x,screenToFlowCoordinate:P,getSelectedNodes:Y,updateNodeInternals:se}=V,he=t.ref(!1);async function ie(O){he.value=!0,await t.nextTick(),await new Promise(U=>requestAnimationFrame(()=>U(null)));try{return await O()}finally{he.value=!1}}async function fe(){try{await ie(()=>Qh(V))}catch(O){console.error("[entity-modeler] SVG export failed",O),c(i.t("em.canvas.exportFailed"))}}async function pe(){try{await ie(()=>ey(V))}catch(O){console.error("[entity-modeler] PNG export failed",O),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:fe,exportPng:pe,fitView:B});const ge=t.computed(()=>i.resolved.value.entities.length===0);function Te(){const O=x(),{width:U,height:le}=V.dimensions.value;return{x:(U/2-O.x)/O.zoom,y:(le/2-O.y)/O.zoom}}function He(){const O=Te();i.addEntity("NewEntity",{x:O.x,y:O.y})}function De(){const O=Te();i.addNote("메모",{x:O.x,y:O.y})}function Z(O){for(const U of i.resolved.value.groups){const{location:le,size:ne}=U.geo;if(O.x>=le.x&&O.x<=le.x+ne.width&&O.y>=le.y&&O.y<=le.y+ne.height)return U.group.modelId}return null}function re(O,U){return O.x===U.x&&O.y===U.y}function ue(O,U){return(O==null?void 0:O.width)===(U==null?void 0:U.width)&&(O==null?void 0:O.height)===(U==null?void 0:U.height)}function z(O,U){return O.entity===U.entity&&O.displayMode===U.displayMode&&O.collapsed===U.collapsed&&O.locked===U.locked&&O.groupRef===U.groupRef&&ue(O.size,U.size)&&O.style===U.style&&O.attributeStyles===U.attributeStyles&&O.operationStyles===U.operationStyles}function L(O,U){const le=Object.keys(O);if(le.length!==Object.keys(U).length)return!1;for(const ne of le)if(ne==="geo"){const xe=O.geo,Be=U.geo;if(!re(xe.location,Be.location)||!ue(xe.size,Be.size))return!1}else if(O[ne]!==U[ne])return!1;return!0}function F(){const O=i.resolved.value,U=new Map(O.groups.map(Ie=>[Ie.group.modelId,Ie.geo])),le=new Set(O.groups.map(Ie=>Ie.group.modelId)),ne=new Set([...le,...O.entities.map(Ie=>Ie.entity.modelId),...O.notes.map(Ie=>Ie.note.modelId)]);for(const Ie of[...T.value])ne.has(Ie.id)||I([Ie.id]);for(const Ie of O.groups){const Je=Ie.group.modelId,j={width:`${Ie.geo.size.width}px`,height:`${Ie.geo.size.height}px`},K={group:Ie.group,style:Ie.style,locked:Ie.locked},ve=Ie.locked?!1:void 0,Re=C(Je);if(Re){re(Re.position,Ie.geo.location)||(Re.position={...Ie.geo.location});const me=Re.data;(me.group!==K.group||me.style!==K.style||me.locked!==K.locked)&&(Re.data=K);const Ue=Re.style;((Ue==null?void 0:Ue.width)!==j.width||(Ue==null?void 0:Ue.height)!==j.height)&&(Re.style=j),Re.draggable!==ve&&(Re.draggable=ve)}else $([{id:Je,type:"group",position:{...Ie.geo.location},draggable:ve,style:j,data:K}])}for(const Ie of O.entities){const Je=Ie.entity.modelId,j=Ie.groupRef&&le.has(Ie.groupRef)?Ie.groupRef:void 0,K={entity:Ie.entity,displayMode:i.displayMode.value,collapsed:Ie.collapsed,locked:Ie.locked,groupRef:j,size:Ie.geo.size,style:Ie.style,attributeStyles:Ie.attributeStyles,operationStyles:Ie.operationStyles},ve=Ie.locked?!1:void 0,Re=Ie.locked?!1:void 0,me=j?U.get(j):void 0,Ue=me?{x:Ie.geo.location.x-me.location.x,y:Ie.geo.location.y-me.location.y}:{...Ie.geo.location},Ye=C(Je);Ye?(re(Ye.position,Ue)||(Ye.position=Ue),z(Ye.data,K)||(Ye.data=K),Ye.parentNode!==j&&(Ye.parentNode=j),Ye.draggable!==ve&&(Ye.draggable=ve),Ye.connectable!==Re&&(Ye.connectable=Re)):$([{id:Je,type:"entity",position:Ue,parentNode:j,draggable:ve,connectable:Re,data:K}])}for(const Ie of O.notes){const Je=Ie.note,j=Je.modelId,K=Ie.groupRef&&le.has(Ie.groupRef)?Ie.groupRef:void 0,ve={note:Je,groupRef:K},Re={width:`${Je.geo.size.width}px`,height:`${Je.geo.size.height}px`},me=K?U.get(K):void 0,Ue=me?{x:Je.geo.location.x-me.location.x,y:Je.geo.location.y-me.location.y}:{...Je.geo.location},Ye=C(j);if(Ye){re(Ye.position,Ue)||(Ye.position=Ue);const pt=Ye.data;(pt.groupRef!==K||!L(pt.note,Je))&&(Ye.data=ve);const Pt=Ye.style;((Pt==null?void 0:Pt.width)!==Re.width||(Pt==null?void 0:Pt.height)!==Re.height)&&(Ye.style=Re),Ye.parentNode!==K&&(Ye.parentNode=K)}else $([{id:j,type:"note",position:Ue,parentNode:K,style:Re,data:ve}])}const xe=new Map(O.associations.map(Ie=>[Ie.association.modelId,Ie])),Be=new Set(O.noteConnections.map(Ie=>S(Ie.noteRef,Ie.targetRef))),qe=Yh(i.state.logical).filter(Ie=>C(Ie.consumerRef)&&C(Ie.typeRef)),je=new Set(qe.map(Ie=>rc(Ie.consumerRef,Ie.typeRef)));for(const Ie of[...D.value])!xe.has(Ie.id)&&!Be.has(Ie.id)&&!je.has(Ie.id)&&v([Ie.id]);for(const[Ie,Je]of xe){const j={id:Ie,type:"association",source:Je.association.end1.entityRef,target:Je.association.end2.entityRef,sourceHandle:Je.sourceColumnRef?`r:${Je.sourceColumnRef}`:void 0,targetHandle:Je.targetColumnRef?`l:${Je.targetColumnRef}`:void 0,data:{association:Je.association,sourceColumnRef:Je.sourceColumnRef,targetColumnRef:Je.targetColumnRef}},K=R(Ie);if(K){const ve=K.data;(ve.association!==j.data.association||ve.sourceColumnRef!==j.data.sourceColumnRef||ve.targetColumnRef!==j.data.targetColumnRef)&&(K.data=j.data),K.sourceHandle!==j.sourceHandle&&(K.sourceHandle=j.sourceHandle),K.targetHandle!==j.targetHandle&&(K.targetHandle=j.targetHandle)}else w([j])}for(const Ie of O.noteConnections){const Je=S(Ie.noteRef,Ie.targetRef),j={noteRef:Ie.noteRef,targetRef:Ie.targetRef};R(Je)||w([{id:Je,type:"note-connection",source:Ie.noteRef,target:Ie.targetRef,data:j}])}for(const Ie of qe){const Je=rc(Ie.consumerRef,Ie.typeRef),j={consumerRef:Ie.consumerRef,typeRef:Ie.typeRef,usageCount:Ie.usageCount},K=R(Je);K?K.data.usageCount!==j.usageCount&&(K.data=j):w([{id:Je,type:"serialized-type",source:Ie.consumerRef,target:Ie.typeRef,data:j}])}}const X=new Set;let ee=!1,ke=!1;const ye=new Map;function Ne(O){const U=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(O)}"]`);if(!U)return null;let le=`${U.offsetHeight}`;for(const ne of U.querySelectorAll(".em-entity__row"))le+=`|${ne.dataset.attr}:${ne.offsetTop}`;return le}function we(){ke=!1;const O=ee;ee=!1;const U=[...X];if(X.clear(),O){se();for(const ne of T.value){const xe=Ne(ne.id);xe!==null&&ye.set(ne.id,xe)}return}const le=[];for(const ne of U){const xe=Ne(ne);if(xe===null){ye.delete(ne);continue}ye.get(ne)!==xe&&(ye.set(ne,xe),le.push(ne))}le.length&&se(le)}function G(O){if(O)for(const U of O)X.add(U);else ee=!0;ke||(ke=!0,t.nextTick(()=>requestAnimationFrame(we)))}t.provide(Ip,{mark:O=>G([O])});function q(){const O=Y.value.map(le=>le.id);if(O.length)return O;const U=i.selection.value;return U&&(U.kind==="entity"||U.kind==="note"||U.kind==="group")?[U.id]:[]}function W(){return Y.value.filter(O=>O.type==="entity").map(O=>O.id)}function Ce(){return Y.value.filter(O=>O.type==="group").map(O=>O.id)}function $e(O){var U;return[...((U=i.state.logical.groups.find(le=>le.modelId===O))==null?void 0:U.memberEntityRefs)??[]]}function ze(){const O=Ce().flatMap($e);return[...new Set([...W(),...O])]}function Fe(){return Ce().length>0||W().length>1}function ae(){Fe()?i.copy(ze()):i.copy()}async function Se(O){if(!O.length)return;await t.nextTick();const U=Y.value;U.length&&V.removeSelectedNodes(U);const le=O.map(ne=>C(ne)).filter(ne=>!!ne);le.length&&V.addSelectedNodes(le)}function Ge(O){if(Fe()&&W().includes(O)){const U=ze();return{caption:i.t("em.ctx.copyN",{n:U.length}),icon:"copy",handler:()=>i.copy(U)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:O},i.copy()}}}function et(O){var xe;const U=O.target;if(U&&(U.tagName==="INPUT"||U.tagName==="TEXTAREA"||U.isContentEditable))return;if(O.key==="?"){a.openModal({component:ty,bind:{locale:i.uiLocale.value}}),O.preventDefault();return}if((O.metaKey||O.ctrlKey)&&O.key.toLowerCase()==="k"){r.value=!0,O.preventDefault();return}if(!i.editable.value){(O.metaKey||O.ctrlKey)&&O.key.toLowerCase()==="c"&&(ae(),O.preventDefault());return}if(O.key==="Delete"||O.key==="Backspace"){i.deleteSelection()&&O.preventDefault();return}if(O.key==="ArrowUp"||O.key==="ArrowDown"||O.key==="ArrowLeft"||O.key==="ArrowRight"){if(((xe=i.selection.value)==null?void 0:xe.kind)==="attribute"){if(O.key==="ArrowUp"||O.key==="ArrowDown"){const Ie=O.key==="ArrowDown"?1:-1;(O.altKey?i.nudgeSelectedAttributes(Ie):i.moveAttributeFocus(Ie))&&O.preventDefault()}return}const Be=O.shiftKey?10:1,qe=O.key==="ArrowLeft"?-Be:O.key==="ArrowRight"?Be:0,je=O.key==="ArrowUp"?-Be:O.key==="ArrowDown"?Be:0;i.nudgeNodes(q(),qe,je)&&O.preventDefault();return}if(!(O.metaKey||O.ctrlKey))return;const ne=O.key.toLowerCase();ne==="c"?(ae(),O.preventDefault()):ne==="v"?(Se(i.paste()),O.preventDefault()):ne==="z"&&(O.shiftKey?i.redo():i.undo(),O.preventDefault())}t.onMounted(async()=>{F(),await t.nextTick(),B(),G(),window.addEventListener("keydown",et),window.addEventListener("pointerup",te),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",et),window.removeEventListener("pointerup",te),window.removeEventListener("pointermove",f)});function te(){h.value=null}function de(){m.value=!0,b.value=null}function Le(){var ne;m.value=!1;const O=(ne=document.elementFromPoint(p.x,p.y))==null?void 0:ne.closest(".vue-flow__node"),U=O==null?void 0:O.dataset.id;if(!U){b.value=null;return}const le=O.classList.contains("vue-flow__node-group")?"group":O.classList.contains("vue-flow__node-note")?"note":"entity";b.value={kind:le,id:U}}const dt=t.computed(()=>Yh(i.state.logical).map(O=>`${O.consumerRef}>${O.typeRef}:${O.usageCount}`).sort().join("|"));t.watch([()=>i.resolved.value,()=>i.displayMode.value,()=>dt.value],F),t.watch(()=>i.resolved.value,O=>{const U=b.value;if(!U)return;(U.kind==="entity"?O.entities.some(ne=>ne.entity.modelId===U.id):U.kind==="group"?O.groups.some(ne=>ne.group.modelId===U.id):O.notes.some(ne=>ne.note.modelId===U.id))||(b.value=null)});function Xe(O){const U=O.computedPosition??O.position,le=O.dimensions??{width:0,height:0};return{x:U.x+le.width/2,y:U.y+le.height/2}}function yt(O){const U=O.node;if(U){if(b.value=null,U.type==="group"){const le=i.resolved.value.groups.find(ne=>ne.group.modelId===U.id);g.value=le?{groupId:U.id,dx:U.position.x-le.geo.location.x,dy:U.position.y-le.geo.location.y}:null,h.value=null;return}if(U.type!=="entity"&&U.type!=="note"){h.value=null;return}h.value=Z(Xe(U))}}function st(O){var ne;h.value=null,g.value=null;const U=(ne=O.nodes)!=null&&ne.length?O.nodes:[O.node],le=U.filter(xe=>(xe==null?void 0:xe.type)==="group");if(le.length){for(const xe of le){if(!xe)continue;const Be=i.resolved.value.entities.filter(qe=>qe.groupRef===xe.id).map(qe=>{const je=C(qe.entity.modelId),Ie=(je==null?void 0:je.computedPosition)??(je==null?void 0:je.position)??{x:0,y:0};return{id:qe.entity.modelId,location:{x:Ie.x,y:Ie.y}}});i.dragGroup(xe.id,{x:xe.position.x,y:xe.position.y},Be)}return}for(const xe of U){if(!xe||xe.type==="group")continue;const Be=xe.computedPosition??xe.position,qe=xe.dimensions??{width:0,height:0},je={x:Be.x+qe.width/2,y:Be.y+qe.height/2};xe.type==="note"?i.dropNote(xe.id,{x:Be.x,y:Be.y},Z(je)):i.dropEntity(xe.id,{x:Be.x,y:Be.y},Z(je))}}function ft(O){var j,K,ve,Re,me;if(!i.editable.value||!O.source||!O.target)return;const U=((j=C(O.source))==null?void 0:j.type)==="note",le=((K=C(O.target))==null?void 0:K.type)==="note";if(U||le){if(U&&le)return;const Ue=U?O.source:O.target,Ye=U?O.target:O.source;((ve=C(Ye))==null?void 0:ve.type)==="entity"&&i.addNoteConnection(Ue,Ye);return}const ne=Ue=>{var Ye;return(Ye=i.state.logical.entities.find(pt=>pt.modelId===Ue))==null?void 0:Ye.stereotype},xe=ne(O.source)==="JPA_EMBEDDABLE",Be=ne(O.target)==="JPA_EMBEDDABLE";if(xe||Be){if(xe&&Be)return;const Ue=xe?O.source:O.target,Ye=xe?O.target:O.source;i.addEmbedAssociation(Ye,Ue);return}const qe=ne(O.source)==="SERIALIZED_TYPE",je=ne(O.target)==="SERIALIZED_TYPE";if(qe||je){const Ue=je?O.target:O.source,Ye=je?O.source:O.target;Ue!==Ye&&i.addSerializedTypeAttribute(Ye,Ue);return}const Ie=(Re=O.sourceHandle)!=null&&Re.startsWith("r:")?O.sourceHandle.slice(2):void 0,Je=(me=O.targetHandle)!=null&&me.startsWith("l:")?O.targetHandle.slice(2):void 0;i.addAssociation(O.source,O.target,Ie,Je)}const nt=t.ref(null);function J(O,U){var ne;const le=i.state.layout.entityLayouts.find(xe=>xe.entityRef===O);return $t((ne=le==null?void 0:le.attributeStyles)==null?void 0:ne[U])}function ce(O,U){var ne;const le=i.state.layout.entityLayouts.find(xe=>xe.entityRef===O);return $t((ne=le==null?void 0:le.operationStyles)==null?void 0:ne[U])}function Ae(O){var U;return $t((U=i.state.layout.groupLayouts.find(le=>le.groupRef===O))==null?void 0:U.style)}function Ee(O){var U;return $t((U=i.state.layout.notes.find(le=>le.modelId===O))==null?void 0:U.style)}function H(O){var xe,Be;if(O.preventDefault(),!i.editable.value)return;const U=()=>P({x:O.clientX,y:O.clientY}),le=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const qe=U();i.addEntity("NewEntity",{x:qe.x,y:qe.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const qe=U();i.addNote("메모",{x:qe.x,y:qe.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const qe=U();i.addEmptyGroup({x:qe.x,y:qe.y})}}],ne=(xe=i.clipboard.value)==null?void 0:xe.kind;(ne==="entity"||ne==="entities")&&le.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Se(i.paste())}),i.resolved.value.entities.length>0&&le.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()}),(Be=nt.value)==null||Be.open(O,le)}function It({event:O,node:U}){var Ie,Je,j,K,ve,Re,me,Ue,Ye,pt,Pt,ta,gt,Vn,Fr,ly,sy,cy,dy;const le=O;if(le.preventDefault(),!i.editable.value){if(U.type==="group"||U.type==="note")return;const at=(Je=(Ie=le.target)==null?void 0:Ie.closest("[data-attr]"))==null?void 0:Je.dataset.attr;if(at){const bt=i.selection.value;(bt==null?void 0:bt.kind)==="attribute"&&bt.entityId===U.id&&bt.ids.includes(at)||i.selectAttribute(U.id,at);const Bn=((j=i.selection.value)==null?void 0:j.kind)==="attribute"&&i.selection.value.entityId===U.id?[...i.selection.value.ids]:[at];(K=nt.value)==null||K.open(le,[{caption:Bn.length>1?i.t("em.ctx.copyN",{n:Bn.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ve=nt.value)==null||ve.open(le,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>hr(a,i,U.id)},Ge(U.id)]);return}if(U.type==="group"){const at=i.isGroupLocked(U.id),bt=[];at||bt.push({type:"swatches",caption:i.t("em.common.color"),current:Ae(U.id),onPick:Bn=>i.setGroupSwatch(U.id,Bn)},{type:"separator"});const Ct=Fe()&&Ce().includes(U.id)?ze():$e(U.id);Ct.length&&bt.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(Ct)}),bt.push({caption:at?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:at?"unlock":"lock",handler:()=>i.setGroupLocked(U.id,!at)}),at||bt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(U.id)}),(Re=nt.value)==null||Re.open(le,bt);return}if(U.type==="note"){(me=nt.value)==null||me.open(le,[{type:"swatches",caption:i.t("em.common.color"),current:Ee(U.id),onPick:at=>i.setNoteSwatch(U.id,at)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(U.id)}]);return}const ne=(Ye=(Ue=le.target)==null?void 0:Ue.closest("[data-attr]"))==null?void 0:Ye.dataset.attr;if(ne){const at=i.selection.value;(at==null?void 0:at.kind)==="attribute"&&at.entityId===U.id&&at.ids.includes(ne)||i.selectAttribute(U.id,ne);const Ct=((pt=i.selection.value)==null?void 0:pt.kind)==="attribute"&&i.selection.value.entityId===U.id?[...i.selection.value.ids]:[ne];if(i.isEntityLocked(U.id)){(Pt=nt.value)==null||Pt.open(le,[{caption:Ct.length>1?i.t("em.ctx.copyN",{n:Ct.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const Bn=Ct.length>1,uc=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(U.id)},{type:"swatches",caption:Bn?i.t("em.ctx.colorN",{n:Ct.length}):i.t("em.common.color"),current:Bn?null:J(U.id,ne),onPick:MO=>i.setAttributeSwatches(U.id,Ct,MO)},{type:"separator"},{caption:Bn?i.t("em.ctx.copyN",{n:Ct.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],na=i.clipboard.value;(na==null?void 0:na.kind)==="attribute"&&uc.push({caption:na.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:na.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:U.id},i.paste()}}),uc.push({type:"separator"},{caption:Bn?i.t("em.ctx.deleteAttrN",{n:Ct.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(U.id,Ct)}),(ta=nt.value)==null||ta.open(le,uc);return}const xe=(Vn=(gt=le.target)==null?void 0:gt.closest("[data-op]"))==null?void 0:Vn.dataset.op;if(xe){if(i.isEntityLocked(U.id))return;(Fr=nt.value)==null||Fr.open(le,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(U.id)},{type:"swatches",caption:i.t("em.common.color"),current:ce(U.id,xe),onPick:at=>i.setOperationSwatch(U.id,xe,at)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(U.id,xe)}]);return}const Be=i.resolved.value.entities.find(at=>at.entity.modelId===U.id),qe=!!(Be!=null&&Be.locked),je=[{caption:qe?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>hr(a,i,U.id)}];if(!qe){je.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(U.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(U.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const bt=Y.value.filter(Ct=>Ct.type==="entity").map(Ct=>Ct.id);i.createGroup(bt.includes(U.id)&&bt.length?bt:[U.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(U.id,U.id)});const at=i.embeddableCatalog.value;if(at.length){je.push({type:"separator"});for(const bt of at){const Ct=((ly=bt.label)==null?void 0:ly[i.userLanguage.value])??((sy=bt.label)==null?void 0:sy.ko)??((cy=bt.label)==null?void 0:cy.en)??bt.type;je.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:Ct}),icon:"link",handler:()=>i.addPredefinedEmbed(U.id,bt.type)})}}}if(je.push({type:"separator"}),je.push({caption:Be!=null&&Be.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Be!=null&&Be.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(U.id,!(Be!=null&&Be.collapsed))}),Be!=null&&Be.groupRef&&!qe&&je.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(U.id)}),je.push({caption:qe?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:qe?"unlock":"lock",handler:()=>i.setEntityLocked(U.id,!qe)}),je.push(Ge(U.id)),!qe){const at=i.clipboard.value;(at==null?void 0:at.kind)==="attribute"&&je.push({caption:at.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:at.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:U.id},i.paste()}}),je.push({type:"separator"}),je.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(U.id)})}(dy=nt.value)==null||dy.open(le,je)}function Rt({event:O,edge:U}){var Be,qe;const le=O;if(le.preventDefault(),!i.editable.value)return;const ne=A(U.id);if(ne){(Be=nt.value)==null||Be.open(le,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(ne.noteRef,ne.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(ne.noteRef,ne.targetRef)}]);return}const xe=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(U.id)}];i.isAssociationLocked(U.id)||xe.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(U.id)}),(qe=nt.value)==null||qe.open(le,xe)}function ot(O){return O==="group"?"group":O==="note"?"note":"entity"}function We({node:O}){if(Y.value.length>1){i.selection.value=null;return}i.selection.value={kind:ot(O.type),id:O.id}}function Ze({nodes:O}){O.length>1&&(i.selection.value=null)}function Q({edge:O}){const U=A(O.id);i.selection.value=U?{kind:"note",id:U.noteRef}:{kind:"association",id:O.id}}function Mt(O){const U=i.selection.value;return!!U&&U.kind!=="attribute"&&U.id===O.id}function Vt(O){var U,le;return Mt(O)?O.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":O.type==="note"?"var(--em-note-soft)":O.type==="group"?np($t((U=O.data)==null?void 0:U.style),!0)??"var(--em-mm-group)":np($t((le=O.data)==null?void 0:le.style))??"var(--em-mm-entity)"}function Mn(O){return Mt(O)?"var(--em-selection)":O.type==="note"?"var(--em-note-accent)":O.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function an(O,U){M(O,U,{zoom:x().zoom,duration:350})}t.watch(()=>i.focusRequest.value,O=>{if(!O)return;const U=C(O.id);if(!U)return;const le=U.computedPosition??U.position,ne=U.dimensions??{width:0,height:0};an(le.x+ne.width/2,le.y+ne.height/2)});function _e({position:O}){an(O.x,O.y)}function mt({node:O}){i.selection.value={kind:ot(O.type),id:O.id};const U=O.computedPosition??O.position,le=O.dimensions??{width:0,height:0};an(U.x+le.width/2,U.y+le.height/2)}function vt({node:O}){B({nodes:[O.id],duration:350,maxZoom:1.2,padding:.6})}return(O,U)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(lI),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!he.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(Sn).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:de,onMoveEnd:Le,onConnect:ft,onConnectStart:U[1]||(U[1]=le=>u.value=!0),onConnectEnd:U[2]||(U[2]=le=>u.value=!1),onNodeDrag:yt,onNodeDragStop:st,onNodeClick:We,onEdgeClick:Q,onSelectionChange:Ze,onPaneClick:U[3]||(U[3]=le=>t.unref(i).selection.value=null),onPaneContextMenu:H,onNodeContextMenu:It,onEdgeContextMenu:Rt},{"node-group":t.withCtx(le=>[t.createVNode(Bp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"node-entity":t.withCtx(le=>[t.createVNode(Vp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"node-note":t.withCtx(le=>[t.createVNode(Dp,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-association":t.withCtx(le=>[t.createVNode(eh,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-note-connection":t.withCtx(le=>[t.createVNode(hM,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),"edge-serialized-type":t.withCtx(le=>[t.createVNode(gM,t.normalizeProps(t.guardReactiveProps(le)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(oR),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(RR),{"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(Co),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:He},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Co),{title:t.unref(i).t("em.ctx.addNote"),onClick:De},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(Co),{title:t.unref(i).t("em.palette.autoLayout"),onClick:U[0]||(U[0]=le=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(uM),{key:1,pannable:"",width:224,height:160,"node-color":Vt,"node-stroke-color":Mn,"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:_e,onNodeClick:mt,onNodeDblclick:vt})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ge.value?(t.openBlock(),t.createElementBlock("div",l2,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",s2,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,c2),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,d2),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,u2)],64)):(t.openBlock(),t.createElementBlock("p",m2,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(a2,{key:1,controller:t.unref(i),onClose:U[4]||(U[4]=le=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",f2,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",p2,[t.createElementVNode("strong",h2,t.toDisplayString(d.value.title),1),t.createElementVNode("span",y2,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(xM,{ref_key:"menuRef",ref:nt,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",g2,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-284ee242"]]),b2={class:"em-explorer em-scroll-overlay"},_2={class:"em-explorer__search"},k2=["placeholder","aria-label"],E2=["aria-label","title"],N2={key:0,class:"em-explorer__empty"},w2=["aria-label"],I2=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],v2=["onClick"],C2=["title"],S2={class:"em-key-slot"},x2={class:"em-key-slot"},R2={class:"em-explorer__label"},A2={key:2,class:"em-explorer__sr"},oy=Qe(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=oe.useModal(),r=t.computed(()=>{var He,De;const $=i.resolved.value,w=i.displayMode.value,I=i.userLanguage.value,v=Z=>{var re,ue,z;return ra(w,Z.name,(ue=(re=Z.table)==null?void 0:re.logicalName)==null?void 0:ue[I],(z=Z.table)==null?void 0:z.physicalName,i.t("em.node.logicalMissing"))},B=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",M=Z=>{const re=Z.attrType.startsWith("RELATION")&&Z.dbAttrs.length>0;return{icon:Z.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:Z.identifier,fk:re&&B}}},x=Z=>Z.attrType.startsWith("EMBED")&&Z.dbAttrs.length>0,P=Z=>x(Z)||yn(Z),Y=w==="PHYSICAL"||w==="LOGICAL_PHYSICAL",se=(Z,re)=>{if(yn(Z)){const z=i.state.logical.entities,L=z.find(F=>F.modelId===re);return Z.dbAttrs.map((F,X)=>{const ee=Zn(Z,L,z,i.state.logical.associations,X);return ee?{...F,physicalName:F.physicalName||ee.physicalName,logicalName:F.logicalName??ee.logicalName,dataType:F.dataType||ee.dataType}:F})}if(Z.attrType!=="EMBED_PREDEF")return Z.dbAttrs;const ue=i.embeddableCatalog.value.find(z=>z.type===Z.type);return ue?Z.dbAttrs.map((z,L)=>{const F=ue.fields[L];return F?{...z,physicalName:z.physicalName||F.physicalName,logicalName:z.logicalName??F.logicalName,dataType:z.dataType||F.dataType,length:z.length??F.length}:z}):Z.dbAttrs},he=(Z,re)=>{const ue=di(Z,Mo(i.state.logical),re,i.state.logical);return ue.kind==="resolved"?ue.entity:void 0},ie=(Z,re,ue)=>{var X,ee,ke,ye,Ne,we,G,q,W;const z={entityId:re,attrId:Z.modelId};if(P(Z)){const Ce=Jr(w,Z,ue==null?void 0:ue.collection,ue==null?void 0:ue.targetName,he(Z));return{key:`attr:${Z.modelId}`,label:Z.name+(Ce?` : ${Ce}`:""),icon:"table",attrRef:z,focusId:re,matchText:ri(Z.name,(ee=(X=Z.dbAttrs[0])==null?void 0:X.logicalName)==null?void 0:ee[I],(ke=Z.dbAttrs[0])==null?void 0:ke.physicalName),children:Y?se(Z,re).map($e=>{var ze,Fe;return{key:`attr:${Z.modelId}:col:${$e.modelId}`,label:ra(w,$e.physicalName,(ze=$e.logicalName)==null?void 0:ze[I],$e.physicalName,i.t("em.node.logicalMissing"))+($e.dataType?` : ${$e.dataType}`:""),icon:"field",attrRef:z,focusId:re,matchText:ri($e.physicalName,(Fe=$e.logicalName)==null?void 0:Fe[I]),children:[]}}):[]}}const L=(ue==null?void 0:ue.collection)??aa(Z,i.state.logical.associations),F=Jr(w,Z,L,ue==null?void 0:ue.targetName,he(Z));return{key:`attr:${Z.modelId}`,label:ra(w,Z.name,(Ne=(ye=Z.dbAttrs[0])==null?void 0:ye.logicalName)==null?void 0:Ne[I],(we=Z.dbAttrs[0])==null?void 0:we.physicalName,i.t("em.node.logicalMissing"))+(F?` : ${F}`:""),...M(Z),attrRef:z,focusId:re,matchText:ri(Z.name,(q=(G=Z.dbAttrs[0])==null?void 0:G.logicalName)==null?void 0:q[I],(W=Z.dbAttrs[0])==null?void 0:W.physicalName),children:[]}},fe=Z=>{var ee,ke,ye;const re=Z.entity,ue=w==="CLASS",L=ue||re.attributes.some(yn)?gl(re,i.state.logical):void 0,F=ue&&L?L.fields.map(Ne=>Ne.attr):[...re.attributes].sort((Ne,we)=>Ne.order-we.order),X=new Map(((L==null?void 0:L.fields)??[]).filter(Ne=>(ue||yn(Ne.attr))&&(Ne.target||Ne.collection)).map(Ne=>{var we;return[Ne.attr.modelId,{targetName:(we=Ne.target)==null?void 0:we.name,collection:Ne.collection}]}));return{key:`entity:${re.modelId}`,label:v(re),icon:"table",selectKind:"entity",selectId:re.modelId,focusId:re.modelId,matchText:ri(re.name,(ke=(ee=re.table)==null?void 0:ee.logicalName)==null?void 0:ke[I],(ye=re.table)==null?void 0:ye.physicalName),children:F.map(Ne=>ie(Ne,re.modelId,X.get(Ne.modelId)))}},pe=new Map,ge=[];for(const Z of $.entities)if(Z.groupRef){const re=pe.get(Z.groupRef)??[];re.push(Z),pe.set(Z.groupRef,re)}else ge.push(Z);const Te=[];for(const Z of $.groups){const re=Z.group;Te.push({key:`group:${re.modelId}`,label:((He=re.name)==null?void 0:He[I])||((De=re.name)==null?void 0:De.ko)||re.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:re.modelId,children:(pe.get(re.modelId)??[]).map(fe)})}for(const Z of ge)Te.push(fe(Z));if($.associations.length){const Z=new Map($.entities.map(re=>[re.entity.modelId,v(re.entity)]));Te.push({key:"section:associations",label:i.t("em.explorer.associations",{n:$.associations.length}),icon:"arrow-lr",children:$.associations.map(re=>{const ue=re.association,z=Z.get(ue.end1.entityRef)??ue.end1.entityRef,L=Z.get(ue.end2.entityRef)??ue.end2.entityRef;return{key:`assoc:${ue.modelId}`,label:`${z} — ${L}`,icon:"arrow-lr",selectKind:"association",selectId:ue.modelId,children:[]}})})}return $.notes.length&&Te.push({key:"section:notes",label:i.t("em.explorer.notes",{n:$.notes.length}),icon:"note",children:$.notes.map(({note:Z})=>{var re;return{key:`note:${Z.modelId}`,label:((re=Z.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:re.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:Z.modelId,focusId:Z.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:Te}});function l($){return $?$.pk&&$.fk?i.t("em.node.keyPfk"):$.pk?i.t("em.node.keyPk"):$.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const $=[],w=I=>{if(I.children.length){I.key!=="root"&&$.push(I.key);for(const v of I.children)w(v)}};return w(r.value),$}),c=$=>$.startsWith("entity:")||$==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Jh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),h=t.ref(null),g=t.computed(()=>f.value.trim().length>0),b=t.computed(()=>{const $=[];if(g.value){const I=jM(r.value,f.value.trim().toLowerCase()),v=(B,M,x,P,Y)=>{if(!I.has(B.key))return;$.push({node:B,depth:M,parentKey:x,posinset:P,setsize:Y});const se=B.children.filter(he=>I.has(he.key));se.forEach((he,ie)=>v(he,M+1,B.key,ie+1,se.length))};return v(r.value,0,null,1,1),$}const w=(I,v,B,M,x)=>{$.push({node:I,depth:v,parentKey:B,posinset:M,setsize:x}),d(I.key)||I.children.forEach((P,Y)=>w(P,v+1,I.key,Y+1,I.children.length))};return w(r.value,0,null,1,1),$}),_=t.ref(null),E=t.ref(null),N=t.computed(()=>{var w;const $=b.value;return E.value&&$.some(I=>I.node.key===E.value)?E.value:((w=$[0])==null?void 0:w.node.key)??null}),y=$=>!g.value&&d($);async function k($){var w,I;$&&(E.value=$,await t.nextTick(),(I=(w=_.value)==null?void 0:w.querySelector(`[data-key="${$}"]`))==null||I.focus())}function S($,w){var B,M,x,P,Y;const I=b.value,v=I.findIndex(se=>se.node.key===w.node.key);switch($.key){case"ArrowDown":$.preventDefault(),k((B=I[v+1])==null?void 0:B.node.key);return;case"ArrowUp":$.preventDefault(),k((M=I[v-1])==null?void 0:M.node.key);return;case"Home":$.preventDefault(),k((x=I[0])==null?void 0:x.node.key);return;case"End":$.preventDefault(),k((P=I[I.length-1])==null?void 0:P.node.key);return;case"ArrowRight":if($.preventDefault(),!w.node.children.length)return;y(w.node.key)?u(w.node.key):k((Y=I[v+1])==null?void 0:Y.node.key);return;case"ArrowLeft":$.preventDefault(),w.node.children.length&&!y(w.node.key)?u(w.node.key):k(w.parentKey);return;case"Enter":case" ":$.preventDefault(),C(w.node,$);return;case"F2":$.preventDefault(),R(w.node)}}const A=t.computed(()=>g.value&&b.value.length<=1);function V($){var v;if($.key!=="/"||$.metaKey||$.ctrlKey||$.altKey||$.shiftKey)return;const w=$.target,I=w==null?void 0:w.tagName;I==="INPUT"||I==="TEXTAREA"||I==="SELECT"||w!=null&&w.isContentEditable||($.preventDefault(),(v=h.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",V)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",V)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function T($){const w=i.selection.value;return $.attrRef?(w==null?void 0:w.kind)==="attribute"&&w.entityId===$.attrRef.entityId&&w.ids.includes($.attrRef.attrId):!!w&&w.kind!=="attribute"&&!!$.selectId&&$.selectKind===w.kind&&$.selectId===w.id}function D($){const w=i.selection.value;return $.selectKind==="entity"&&(w==null?void 0:w.kind)==="attribute"&&w.entityId===$.selectId}function C($,w){if($.attrRef){const I=w.shiftKey?"range":w.metaKey||w.ctrlKey?"toggle":"replace";i.selectAttribute($.attrRef.entityId,$.attrRef.attrId,I)}else $.selectKind&&$.selectId&&(i.selection.value={kind:$.selectKind,id:$.selectId});$.focusId&&i.requestFocus($.focusId)}function R($){$.selectKind==="entity"&&$.selectId&&hr(a,i,$.selectId)}return($,w)=>(t.openBlock(),t.createElementBlock("section",b2,[t.createElementVNode("div",_2,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":w[0]||(w[0]=I=>f.value=I),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:w[1]||(w[1]=t.withKeys(I=>f.value="",["esc"]))},null,40,k2),[[t.vModelText,f.value]]),f.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:w[2]||(w[2]=I=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,E2)):t.createCommentVNode("",!0)]),A.value?(t.openBlock(),t.createElementBlock("p",N2,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:_,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("div",{key:I.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":T(I.node),"is-focus-parent":D(I.node),"is-selectable":!!I.node.selectKind||!!I.node.attrRef||!!I.node.focusId}]),"data-key":I.node.key,role:"treeitem","aria-level":I.depth+1,"aria-posinset":I.posinset,"aria-setsize":I.setsize,"aria-expanded":I.node.children.length?!y(I.node.key):void 0,"aria-selected":T(I.node),tabindex:I.node.key===N.value?0:-1,style:t.normalizeStyle({paddingLeft:4+I.depth*14+"px"}),onClick:v=>C(I.node,v),onDblclick:v=>R(I.node),onFocus:v=>E.value=I.node.key,onKeydown:v=>S(v,I)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!I.node.children.length,"is-open":!y(I.node.key)}]),onClick:t.withModifiers(v=>I.node.children.length&&t.unref(u)(I.node.key),["stop"])},[I.node.children.length?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,v2),I.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(I.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",S2,[I.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):I.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:I.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",x2,[I.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,C2)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:I.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",R2,t.toDisplayString(I.node.label),1),l(I.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",A2,t.toDisplayString(l(I.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,I2))),128))],8,w2)]))}}),[["__scopeId","data-v-9124d45b"]]),$2={class:"em-text-export"},T2=["id","aria-selected","tabindex","onClick"],M2=["aria-labelledby"],V2={class:"em-text-export__actions"},B2=Qe(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(m,p)=>en(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),oe.showNotification(i("em.export.copied"),"info")}catch{oe.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const h=document.createElement("a");h.href=f,h.download=m.filename,document.body.appendChild(h),h.click(),h.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",$2,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,h)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${h}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":h===a.value}]),"aria-selected":h===a.value,"aria-controls":"em-text-export-panel",tabindex:h===a.value?0:-1,onClick:g=>a.value=h,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,T2))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,M2),t.createElementVNode("div",V2,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),D2={class:"em-text-import"},O2=["aria-label"],L2=["aria-checked","tabindex","onClick"],P2=["placeholder"],z2={class:"em-text-import__status"},F2={class:"em-text-import__ok"},U2={key:0,class:"em-text-import__warn"},H2={key:1,class:"em-text-import__err"},j2={key:2,class:"em-text-import__err"},K2={key:3,class:"em-text-import__err"},G2={class:"em-text-import__actions"},Y2=Qe(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=oe.useModalHandle(),i=(g,b)=>en(n.locale??"ko",g,b),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"}],s=t.ref(null);async function c(g){var _,E;const b=l[(g+l.length)%l.length];b&&(r.value=b.key,await t.nextTick(),(E=(_=s.value)==null?void 0:_.querySelectorAll('[role="radio"]')[l.indexOf(b)])==null||E.focus())}function d(g){c(l.findIndex(b=>b.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const b=m.value;if(!b)return{status:"unknown"};try{let _,E=[];return b==="json"?_=Jc(g):b==="mermaid"?_=Uc(g):(_=Gc(g),E=nl(g).warnings),_.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:_,warnings:E}}catch(_){return{status:"error",message:_ instanceof Error?_.message:String(_)}}}),f=t.computed(()=>p.value.status==="ok");function h(){const g=p.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,b)=>(t.openBlock(),t.createBlock(t.unref(oe.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",D2,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,_=>t.createElementVNode("button",{key:_.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":_.key===r.value}]),"aria-checked":_.key===r.value,tabindex:_.key===r.value?0:-1,onClick:E=>r.value=_.key,onKeydown:[b[0]||(b[0]=t.withKeys(t.withModifiers(E=>d(-1),["prevent"]),["left"])),b[1]||(b[1]=t.withKeys(t.withModifiers(E=>d(1),["prevent"]),["right"])),b[2]||(b[2]=t.withKeys(t.withModifiers(E=>c(0),["prevent"]),["home"])),b[3]||(b[3]=t.withKeys(t.withModifiers(E=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(_.labelKey)),43,L2)),64))],8,O2),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":b[4]||(b[4]=_=>a.value=_),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,P2),[[t.vModelText,a.value]]),t.createElementVNode("div",z2,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",F2,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",U2," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",H2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",j2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",K2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",G2,[t.createVNode(t.unref(oe.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:h},null,8,["caption","disabled"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:i("em.common.close"),onClick:b[5]||(b[5]=_=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),q2={class:"em-toolbar"},W2=["title"],J2={class:"em-toolbar__mode"},iy=Qe(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,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=t.computed({get:()=>i.displayMode.value,set:h=>i.displayMode.value=h});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const h=i.resolved.value.entities;return h.length>0&&h.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const h=Zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:B2,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Mc(h,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Qr(h,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Qr(h,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:Yc(h,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:Wc(h,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:Y2,bind:{locale:i.uiLocale.value,onImport:h=>{i.importEntities(h,h.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:ty,bind:{locale:i.uiLocale.value}})}return(h,g)=>(t.openBlock(),t.createElementBlock("div",q2,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,W2)):t.createCommentVNode("",!0),t.createVNode(t.unref(oe.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:g[0]||(g[0]=b=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(oe.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:g[1]||(g[1]=b=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",J2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(oe.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=b=>s.value=b),items:l,"value-provider":b=>b.v,"label-provider":b=>t.unref(i).t(b.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(oe.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(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(oe.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:g[3]||(g[3]=b=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(oe.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:g[4]||(g[4]=b=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(oe.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(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=b=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=b=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(oe.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:g[7]||(g[7]=b=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),X2=["title"],Z2=["title"],Q2=["disabled","aria-pressed"],eV=["disabled","aria-pressed"],tV=Qe(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=>en(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(Ve,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,X2)):(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(Ve,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,Q2),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(Ve,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,eV)],10,Z2))}}),[["__scopeId","data-v-2b5162b7"]]),nV=["disabled"],oV={class:"em-panel__sub"},iV={class:"em-nav"},aV={key:0,class:"em-nav__divider","aria-hidden":"true"},rV={key:1},lV=["onClick","onKeydown"],sV={class:"em-nav__name"},cV=["title"],dV={key:0,class:"em-panel__note"},uV=["data-attr-block"],mV={key:0,class:"em-embed-col__label"},fV={class:"em-attr__row"},pV=["title"],hV={key:1,class:"em-attr__row"},yV={key:2,class:"em-embed-cols"},gV={class:"em-embed-col"},bV={class:"em-embed-col__label"},_V={class:"em-attr__row"},kV={class:"em-attr__navhint"},EV={key:3,class:"em-attr__navhint"},NV={key:4,class:"em-attr__navhint"},wV={key:0,class:"em-attr__navhint"},IV={class:"em-attr__row"},vV={class:"em-attr__row"},CV=["title"],SV={class:"em-attr__flags"},xV={class:"em-attr__pii"},RV={class:"em-attr__pii"},AV={key:1,class:"em-attr__pii"},$V={key:2,class:"em-attr__pii em-attr__codetop"},TV={class:"em-multilang"},MV={key:6,class:"em-embed-cols"},VV={key:0,class:"em-attr__navhint"},BV={class:"em-embed-col__label"},DV={class:"em-attr__row"},OV=["title"],LV=["title"],PV=["title"],zV={class:"em-attr__row"},FV={key:0,class:"em-embed-upd"},UV={key:1,class:"em-attr__navhint"},HV={class:"em-embed-upd"},jV={class:"em-embed-upd"},KV={class:"em-attr__flags"},GV={class:"em-multilang"},YV={class:"em-swatch__row em-attr__swatch"},qV=["title","onClick"],WV=["title","onClick"],JV={key:0,class:"em-attr__swatch-hint"},XV=Qe(t.defineComponent({__name:"EntityColumnsSection",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isValueType:a,isColumnless:r,focusedAttrIds:l,personalInfoItems:s,piiLabel:c,idn:d,setAttr:u,isDerivedIdRow:m,rowName:p,rowNamePlaceholder:f,setRowName:h,assocFieldName:g,setAssocFieldName:b,nameLocked:_,nameLockedHint:E,isManagedFk:N,setNaturalId:y,setIdentifier:k,setTransient:S,dbLocked:A,fkDerived:V,fkOriginPhysical:T,typeValueOf:D,typeLabelOf:C,setAttrType:R,setAttrCustomType:$,setDb:w,scaleApplicable:I,scaleHint:v,setDbLogical:B,setAttrDescription:M,attrPiiValue:x,setAttrPii:P,predefinedCustomTypeCatalog:Y,serializedTypeNames:se,embeddableCatalog:he,predefinedLabel:ie,groupCodeCatalog:fe,attrGroupCodes:pe,attrCodeItems:ge,codeValueOf:Te,codeLabelOf:He,setAttrGroupCode:De,setAttrCode:Z,setAttrDefaultValue:re,hasColumnSlots:ue,isMultiColFk:z,setDbAt:L,setDbLogicalAt:F,colSlotMeta:X,fixedDataType:ee,fixedLength:ke,fixedScale:ye,slotFixedHint:Ne,updatableItems:we,updatableLabel:G,updatableValue:q,setUpdatableAt:W,setUpdatable:Ce,insertableItems:$e,insertableLabel:ze,insertableValue:Fe,setInsertableAt:ae,setInsertable:Se,sharedItems:Ge,sharedLabel:et,sharedValue:te,setSharedAt:de,isShared:Le,sharedPhysical:dt}=rp(o,()=>n.entityId),Xe=t.computed(()=>i.value?o.state.layout.entityLayouts.find(We=>We.entityRef===i.value.modelId)??null:null),yt=t.computed(()=>{var We;return((We=i.value)==null?void 0:We.attributes.filter(Ze=>Ze.attrType!=="DIVIDER"))??[]}),st=t.computed(()=>{var We;return((We=i.value)==null?void 0:We.attributes)??[]}),ft=t.computed(()=>yt.value.filter(We=>l.value.has(We.modelId)));function nt(We){return{pk:We.identifier,fk:We.attrType.startsWith("RELATION")&&We.dbAttrs.length>0,required:We.notNull&&!We.identifier}}function J(We){const Ze=nt(We),Q=[Ze.pk&&"PK",Ze.fk&&"FK",Ze.required&&"NOT NULL"].filter(Boolean);return Q.length?Q.join(" · "):void 0}function ce(We,Ze){i.value&&o.selectAttribute(i.value.modelId,We.modelId,Ze.shiftKey?"range":Ze.metaKey||Ze.ctrlKey?"toggle":"replace")}function Ae(We){var Ze,Q;return $t((Q=(Ze=Xe.value)==null?void 0:Ze.attributeStyles)==null?void 0:Q[We.modelId])}function Ee(We){return l.value.size>1&&l.value.has(We.modelId)}function H(We,Ze){if(!i.value)return;const Q=Ee(We)?o.selectedAttrIds.value:[We.modelId];o.setAttributeSwatches(i.value.modelId,Q,Ze)}const It=t.ref(void 0);function Rt(We){if(!We||!i.value)return;const Ze=o.addPredefinedEmbed(i.value.modelId,We);Ze&&o.selectAttribute(i.value.modelId,Ze),It.value=void 0}function ot(){if(!i.value)return;const We=o.addAttribute(i.value.modelId);We&&o.selectAttribute(i.value.modelId,We)}return(We,Ze)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",oV,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:yt.value.length}))+" ",1),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ot},null,8,["caption"]),t.unref(he).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":It.value,items:t.unref(he),"value-provider":Q=>Q.type,"label-provider":t.unref(ie),"onUpdate:modelValue":Rt},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",iV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(st.value,Q=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Q.modelId},[Q.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",aV,[...Ze[0]||(Ze[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",rV,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(l).has(Q.modelId)}]),role:"button",tabindex:"0",onClick:Mt=>ce(Q,Mt),onKeydown:[t.withKeys(t.withModifiers(Mt=>ce(Q,Mt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Mt=>ce(Q,Mt),["prevent"]),["space"])]},[t.createElementVNode("span",sV,t.toDisplayString(Q.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:J(Q)},[nt(Q).pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):nt(Q).required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),nt(Q).fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,cV)],42,lV)]))],64))),128))]),yt.value.length&&!ft.value.length?(t.openBlock(),t.createElementBlock("p",dV,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ft.value,Q=>{var Mt,Vt,Mn,an,_e,mt,vt,O,U,le;return t.openBlock(),t.createElementBlock("div",{key:Q.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(l).has(Q.modelId)}]),"data-attr-block":Q.modelId},[t.unref(m)(Q)?(t.openBlock(),t.createElementBlock("span",mV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",fV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-name-${Q.modelId}`,width:"100%",disabled:t.unref(_)(Q),title:t.unref(_)(Q)?t.unref(E)(Q):t.unref(m)(Q)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(f)(Q),"model-value":t.unref(p)(Q),"onUpdate:modelValue":ne=>t.unref(h)(Q,ne)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{name:`attr-type-${Q.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Q.attrType.startsWith("EMBED")||!!Q.groupCode||Q.attrType==="RELATION_REF"||t.unref(V)(Q),items:t.unref(Sc)(Q.type,t.unref(Y),t.unref(se)),"value-provider":t.unref(D),"label-provider":t.unref(C),"model-value":Q.type,"onUpdate:modelValue":ne=>t.unref(R)(Q,ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(N)(Q)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Q.modelId)},null,8,["onClick"])],8,pV)]),Q.type===t.unref(_n)&&!t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("div",hV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-customtype-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Q.customType??"","onUpdate:modelValue":ne=>t.unref($)(Q,ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(m)(Q)?(t.openBlock(),t.createElementBlock("div",yV,[t.createElementVNode("div",gV,[t.createElementVNode("span",bV,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",_V,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-assocname-${Q.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(g)(Q),"onUpdate:modelValue":ne=>t.unref(b)(Q,ne)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",kV,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Q.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",EV,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.createCommentVNode("",!0),t.unref(r)?(t.openBlock(),t.createElementBlock("p",NV,t.toDisplayString(t.unref(o).t("em.attr.serializedNoColumnNote")),1)):t.unref(ue)(Q)?(t.openBlock(),t.createElementBlock("div",MV,[t.unref(z)(Q)?(t.openBlock(),t.createElementBlock("p",VV,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Q.dbAttrs,(ne,xe)=>{var Be,qe,je,Ie,Je,j,K,ve;return t.openBlock(),t.createElementBlock("div",{key:ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",BV,t.toDisplayString(((Be=t.unref(X)(Q,xe))==null?void 0:Be.name)??((qe=t.unref(X)(Q,xe))==null?void 0:qe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:xe+1})),1),t.createElementVNode("div",DV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`embed-col-${ne.modelId}`,width:"100%",disabled:t.unref(Le)(ne),placeholder:((je=t.unref(X)(Q,xe))==null?void 0:je.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(Le)(ne)?t.unref(dt)(ne):ne.physicalName,"onUpdate:modelValue":Re=>t.unref(L)(Q,xe,{physicalName:Re})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSTextInput),{name:`embed-dtype-${ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ee)(Q,xe)},null,8,["name","model-value"])],8,OV),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`embed-len-${ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ke)(Q,xe)},null,8,["name","model-value"])],8,LV),t.createElementVNode("span",{title:t.unref(Ne)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`embed-scale-${ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ye)(Q,xe)},null,8,["name","model-value"])],8,PV)]),t.createVNode(Io,{controller:t.unref(o),"ref-id":ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",zV,[t.createVNode(Qt,{class:"grow",name:`embed-logical-${ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Je=(Ie=t.unref(X)(Q,xe))==null?void 0:Ie.logicalName)==null?void 0:Je[t.unref(o).userLanguage.value])??((K=(j=t.unref(X)(Q,xe))==null?void 0:j.logicalName)==null?void 0:K.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ne.logicalName,"onUpdate:modelValue":Re=>t.unref(F)(Q,xe,Re)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(ve=t.unref(X)(Q,xe))!=null&&ve.shareable?(t.openBlock(),t.createElementBlock("label",FV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(oe.BSSelect),{width:"110px","model-value":t.unref(te)(ne),items:t.unref(Ge)(),"value-provider":t.unref(d),"label-provider":t.unref(et),"onUpdate:modelValue":Re=>Re&&t.unref(de)(Q,xe,Re)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(Le)(ne)?(t.openBlock(),t.createElementBlock("p",UV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",HV,[Ze[3]||(Ze[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(ne),"model-value":t.unref(Le)(ne)?"false":t.unref(Fe)(ne),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":Re=>Re&&t.unref(ae)(Q,xe,Re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",jV,[Ze[4]||(Ze[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"110px",disabled:t.unref(Le)(ne),"model-value":t.unref(Le)(ne)?"false":t.unref(q)(ne),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":Re=>Re&&t.unref(W)(Q,xe,Re)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(z)(Q)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",KV,[t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:"","onUpdate:modelValue":ne=>t.unref(k)(Q,ne)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:"","onUpdate:modelValue":ne=>t.unref(u)(Q,{notNull:ne})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",GV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ne=>t.unref(M)(Q,ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("p",wV,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",IV,[t.createVNode(Qt,{class:"grow",name:`attr-logical-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Mt=Q.dbAttrs[0])==null?void 0:Mt.logicalName,"onUpdate:modelValue":ne=>t.unref(B)(Q,ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",vV,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`attr-col-${Q.modelId}`,width:"100%",placeholder:t.unref(T)(Q)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(A)(Q),"model-value":((Vt=Q.dbAttrs[0])==null?void 0:Vt.physicalName)??"","onUpdate:modelValue":ne=>t.unref(w)(Q,{physicalName:ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{name:`attr-dtype-${Q.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(A)(Q)||t.unref(V)(Q),items:t.unref(wc)(((Mn=Q.dbAttrs[0])==null?void 0:Mn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(d),"label-provider":t.unref(Yr),"model-value":((an=Q.dbAttrs[0])==null?void 0:an.dataType)??"","onUpdate:modelValue":ne=>ne&&t.unref(w)(Q,{dataType:ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSNumberInput),{name:`attr-len-${Q.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(A)(Q)||t.unref(V)(Q),"model-value":(_e=Q.dbAttrs[0])==null?void 0:_e.length,"onUpdate:modelValue":ne=>t.unref(w)(Q,{length:ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(v)(Q)},[t.createVNode(t.unref(oe.BSNumberInput),{name:`attr-scale-${Q.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(A)(Q)||t.unref(V)(Q)||!t.unref(I)(Q),"model-value":(mt=Q.dbAttrs[0])==null?void 0:mt.scale,"onUpdate:modelValue":ne=>t.unref(w)(Q,{scale:ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,CV)]),t.createVNode(Io,{controller:t.unref(o),"ref-id":(vt=Q.dbAttrs[0])==null?void 0:vt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",SV,[t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-pk-${Q.modelId}`,label:"Primary Key","model-value":Q.identifier,disabled:t.unref(a)||t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(k)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nn-${Q.modelId}`,label:"Not Null","model-value":Q.notNull,disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(u)(Q,{notNull:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-uq-${Q.modelId}`,label:"Unique","model-value":!!((O=Q.dbAttrs[0])!=null&&O.unique),disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(w)(Q,{unique:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-ai-${Q.modelId}`,label:"Auto Increment","model-value":!!((U=Q.dbAttrs[0])!=null&&U.autoIncrement),disabled:t.unref(A)(Q)||t.unref(V)(Q)||!Q.identifier,"onUpdate:modelValue":ne=>t.unref(w)(Q,{autoIncrement:ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-tr-${Q.modelId}`,label:"@Transient","model-value":!!Q.transient,disabled:Q.identifier||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(S)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-nid-${Q.modelId}`,label:"@NaturalId","model-value":!!Q.naturalId,disabled:Q.identifier||t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(y)(Q,ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Q.modelId}`,label:"mutable","model-value":!!Q.naturalIdMutable,disabled:t.unref(A)(Q)||!Q.naturalId,"onUpdate:modelValue":ne=>t.unref(u)(Q,{naturalIdMutable:ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`attr-mv-${Q.modelId}`,label:"Multi-Value (Set)","model-value":!!((le=Q.dbAttrs[0])!=null&&le.multiValue),disabled:t.unref(A)(Q)||t.unref(V)(Q),"onUpdate:modelValue":ne=>t.unref(w)(Q,{multiValue:ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",xV,[Ze[1]||(Ze[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"100%",disabled:t.unref(A)(Q),"model-value":t.unref(Fe)(Q.dbAttrs[0]),items:t.unref($e),"value-provider":t.unref(d),"label-provider":t.unref(ze),"onUpdate:modelValue":ne=>ne&&t.unref(Se)(Q,ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",RV,[Ze[2]||(Ze[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(oe.BSSelect),{width:"100%",disabled:t.unref(A)(Q),"model-value":t.unref(q)(Q.dbAttrs[0]),items:t.unref(we),"value-provider":t.unref(d),"label-provider":t.unref(G),"onUpdate:modelValue":ne=>ne&&t.unref(Ce)(Q,ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(V)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",AV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":t.unref(x)(Q),items:t.unref(s),"value-provider":t.unref(d),"label-provider":t.unref(c),"onUpdate:modelValue":ne=>ne&&t.unref(P)(Q,ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(fe).length&&!t.unref(V)(Q)?(t.openBlock(),t.createElementBlock("label",$V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(up,{"model-value":Q.groupCode,items:t.unref(fe),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ne=>t.unref(De)(Q,ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(V)(Q)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(fe).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(pe)(Q).length?(t.openBlock(),t.createBlock(t.unref(oe.BSSelect),{key:0,width:"100%","model-value":Q.defaultValue??"none",items:t.unref(ge)(Q),"value-provider":t.unref(Te),"label-provider":t.unref(He),"onUpdate:modelValue":ne=>ne&&t.unref(Z)(Q,ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(oe.BSTextInput),{key:1,name:`attr-default-${Q.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Q.defaultValue??"","onUpdate:modelValue":ne=>t.unref(re)(Q,ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",TV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`attr-desc-${Q.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Q.description,"onUpdate:modelValue":ne=>t.unref(M)(Q,ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",YV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ae(Q)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:ne=>H(Q,null)},"∅",10,qV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),ne=>(t.openBlock(),t.createElementBlock("button",{key:ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ae(Q)===ne}]),style:t.normalizeStyle({background:t.unref(Qo)(ne)}),title:t.unref(o).t(t.unref(wo)(ne)),onClick:xe=>H(Q,ne)},null,14,WV))),128)),Ee(Q)?(t.openBlock(),t.createElementBlock("span",JV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(l).size})),1)):t.createCommentVNode("",!0)])],10,uV)}),128))],8,nV)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0ece25e9"]]),ZV=["disabled"],QV={class:"em-panel__sub-label"},eB={class:"em-attr__row"},tB={class:"em-field em-idx-params"},nB=["value","placeholder","onChange"],oB=Qe(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(k=>k.modelId===o.entityId)??null),l=t.computed(()=>r.value?si(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var k;return Jn(((k=r.value)==null?void 0:k.attributes)??[])}),c=k=>s.value.canon(k),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>[...hp(d.value).map(k=>({value:k.ref,label:k.label})),...l.value.map(k=>({value:k.modelId,label:a.t("em.index.inherited",{field:k.field})}))]);function m(k,S){var D;const A=new Set(k.columns.filter((C,R)=>R!==S).map(C=>c(C.columnRef))),V=u.value.filter(C=>!A.has(c(C.value))),T=(D=k.columns[S])==null?void 0:D.columnRef;return T&&!V.some(C=>C.value===T)&&V.push({value:T,label:p(T)}),V}function p(k){return Ms(k,d.value)}function f(k){const S=new Set(k.columns.map(A=>c(A.columnRef)));return u.value.filter(A=>!S.has(c(A.value)))}function h(){var S;if(!r.value)return;const k=u.value[0];a.addIndex(r.value.modelId,{modelId:Pe(),name:`idx_${(((S=r.value.indexes)==null?void 0:S.length)??0)+1}`,unique:!1,columns:k?[{columnRef:k.value,descending:!1}]:[]})}function g(k,S){r.value&&a.updateIndex(r.value.modelId,k,S)}function b(k){const S=f(k)[0];S&&g(k.modelId,{columns:[...k.columns,{columnRef:S.value,descending:!1}]})}function _(k,S,A){g(k.modelId,{columns:k.columns.map((V,T)=>T===S?{...V,columnRef:A}:V)})}function E(k,S,A){g(k.modelId,{columns:k.columns.map((V,T)=>T===S?{...V,descending:A}:V)})}function N(k,S){g(k.modelId,{columns:k.columns.filter((A,V)=>V!==S)})}function y(k,S){g(k.modelId,{parameters:S.trim()===""?void 0:S})}return(k,S)=>{var A;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:S[0]||(S[0]=V=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",QV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((A=r.value.indexes)==null?void 0:A.length)??0})),1)]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(h,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],V=>(t.openBlock(),t.createElementBlock("div",{key:V.modelId,class:"em-attr"},[t.createElementVNode("div",eB,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`idx-name-${V.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":T=>g(V.modelId,{name:T})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idx-uq-${V.modelId}`,class:"em-check",label:"UQ","model-value":V.unique,"onUpdate:modelValue":T=>g(V.modelId,{unique:T})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:T=>t.unref(a).removeIndex(r.value.modelId,V.modelId)},null,8,["onClick"])]),t.createVNode(Io,{controller:t.unref(a),"ref-id":V.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.columns,(T,D)=>(t.openBlock(),t.createElementBlock("div",{key:D,class:"em-attr__row"},[t.createVNode(t.unref(oe.BSSelect),{class:"grow","model-value":T.columnRef,items:m(V,D),"value-provider":C=>C.value,"label-provider":C=>C.label,"onUpdate:modelValue":C=>C&&_(V,D,C)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSCheckbox),{name:`idx-${V.modelId}-desc-${D}`,class:"em-check",label:"DESC","model-value":T.descending,"onUpdate:modelValue":C=>E(V,D,C)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:"−",onClick:C=>N(V,D)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(V).length,onClick:T=>b(V)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",tB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:V.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:T=>y(V,T.target.value)},null,40,nB)])]))),128)):t.createCommentVNode("",!0)],8,ZV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-ee0032b1"]]),iB=["disabled"],aB={class:"em-panel__sub-label"},rB={class:"em-attr__row"},lB={class:"em-attr__row"},sB={class:"em-multilang"},cB={class:"em-attr__pii"},dB={class:"em-swatch__row em-attr__swatch"},uB=["title","onClick"],mB=["title","onClick"],fB=Qe(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=oe.useModal(),l=t.computed(()=>a.state.logical.entities.find(N=>N.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(N=>N.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(N){return N==="none"?a.t("em.common.noneParen"):N}const m=N=>N;function p(N,y){l.value&&a.updateOperation(l.value.modelId,N.modelId,y)}function f(N,y){p(N,{description:Object.keys(y).length?y:void 0})}function h(N){return N.personalInfoAttributeType??"none"}function g(N,y){p(N,{personalInfoAttributeType:y==="none"?void 0:y})}function b(N){var y,k;return $t((k=(y=s.value)==null?void 0:y.operationStyles)==null?void 0:k[N.modelId])}function _(N,y){l.value&&a.setOperationSwatch(l.value.modelId,N.modelId,y)}function E(N){r.openModal({component:yp,bind:{operationName:N.name,sourceCode:N.sourceCode??"",locale:a.uiLocale.value,onSave:y=>p(N,{sourceCode:y})}})}return(N,y)=>{var k;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:y[1]||(y[1]=S=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",aB,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{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:((k=l.value.operations)==null?void 0:k.length)??0})),1)]),t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:y[0]||(y[0]=t.withModifiers(S=>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??[],S=>(t.openBlock(),t.createElementBlock("div",{key:S.modelId,class:"em-attr"},[t.createElementVNode("div",rB,[t.createVNode(t.unref(oe.BSTextInput),{class:"grow",name:`op-name-${S.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":S.name,"onUpdate:modelValue":A=>p(S,{name:A})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSSelect),{width:"96px","model-value":S.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":A=>A&&p(S,{visibility:A})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(oe.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:A=>t.unref(a).removeOperation(l.value.modelId,S.modelId)},null,8,["onClick"])]),t.createElementVNode("div",lB,[t.createVNode(t.unref(oe.BSButton),{variant:"text",caption:t.unref(a).t(S.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:A=>E(S)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",sB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Qt,{multiline:"",name:`op-desc-${S.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":S.description,"onUpdate:modelValue":A=>f(S,A)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",cB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(oe.BSSelect),{width:"100%","model-value":h(S),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":A=>A&&g(S,A)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",dB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":b(S)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:A=>_(S,null)},"∅",10,uB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":b(S)===A}]),style:t.normalizeStyle({background:t.unref(Qo)(A)}),title:t.unref(a).t(t.unref(wo)(A)),onClick:V=>_(S,A)},null,14,mB))),128))])]))),128)):t.createCommentVNode("",!0)],8,iB)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),pB=["title"],hB={class:"em-panel__head"},yB={class:"em-panel__head-row"},gB=["title"],bB={class:"em-panel__context"},_B={key:0,class:"em-panel__lock"},kB=["disabled"],EB={key:0,class:"em-attr__navhint"},NB={key:0,class:"em-panel__note"},wB={key:1,class:"em-panel__note"},IB={key:2,class:"em-jpa"},vB={class:"em-field"},CB={class:"em-field"},SB={class:"em-field"},xB={key:0,class:"em-field"},RB={class:"em-panel__note"},AB={class:"em-panel__sub"},$B={class:"em-field"},TB={class:"em-field"},MB={class:"em-jpa"},VB={key:0,class:"em-panel__note"},BB={key:1,class:"em-panel__note"},DB={class:"em-jpa"},OB={class:"em-field"},LB={key:0,class:"em-panel__note"},PB={class:"em-field"},zB={class:"em-multilang"},FB={class:"em-field"},UB=["value"],HB={class:"em-field"},jB={class:"em-swatch"},KB={class:"em-swatch__row"},GB=["title"],YB=["title","onClick"],qB={class:"em-panel__note"},WB={class:"em-field"},JB=["value"],XB={class:"em-swatch"},ZB={class:"em-swatch__row"},QB=["title"],eD=["title","onClick"],ay=Qe(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var G;return(G=r.value)==null?void 0:G.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const G=c.value;return G?l.state.logical.entities.find(q=>q.modelId===G)??null:null}),u=t.computed(()=>{const G=s.value;if((G==null?void 0:G.kind)==="association")return l.isAssociationLocked(G.id);const q=c.value;return!!q&&l.isEntityLocked(q)}),m=t.computed(()=>{var G;return((G=l.selectedAttr.value)==null?void 0:G.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),h=t.ref({});t.watch(f,()=>{h.value={}});function g(G){return h.value[G]??f.value}function b(G){h.value={...h.value,[G]:!g(G)}}const _=t.computed(()=>{var W;const G=d.value;if(!G)return l.t("em.entity.fallback");const q=(W=G.table)==null?void 0:W.physicalName;return q?`${G.name} (${q})`:G.name}),E=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="association"?l.state.logical.associations.find(q=>q.modelId===G.id)??null:null}),N=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="group"?l.state.logical.groups.find(q=>q.modelId===G.id)??null:null}),y=t.computed(()=>{const G=s.value;return(G==null?void 0:G.kind)==="note"?l.state.layout.notes.find(q=>q.modelId===G.id)??null:null}),k=t.computed(()=>{var q,W;const G=(q=N.value)==null?void 0:q.name;return(G==null?void 0:G[l.userLanguage.value])||(G==null?void 0:G.ko)||(G==null?void 0:G.en)||(G==null?void 0:G.ja)||(G==null?void 0:G.zh)||((W=N.value)==null?void 0:W.packageName)||l.t("em.group.fallback")}),S=t.computed(()=>{if(d.value){const G=p.value.size;if(G>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:G});if(m.value){const q=d.value.attributes.find(W=>W.modelId===m.value);return(q==null?void 0:q.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(q==null?void 0:q.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(E.value){const G=q=>{var W;return((W=l.state.logical.entities.find(Ce=>Ce.modelId===q))==null?void 0:W.name)??q};return l.t("em.inspector.ctxAssoc",{a:G(E.value.end1.entityRef),b:G(E.value.end2.entityRef)})}return N.value?l.t("em.inspector.ctxGroup",{name:k.value}):y.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),A=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],V=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],T={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},D=G=>{const q=T[G];return q?l.t(q):G},C=G=>{var q;return((q=l.state.logical.entities.find(W=>W.modelId===G))==null?void 0:q.name)??G},R=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],$=["LIST","SET"],w=["inherit","LAZY","EAGER"],I=G=>G;function v(G){return G==="inherit"?l.t("em.common.inherit"):G}const B=t.computed(()=>!!E.value&&E.value.end1.entityRef===E.value.end2.entityRef);function M(G,q){E.value&&l.updateAssociationEnd(E.value.modelId,G,q)}function x(G){return Z.value?G:G==="end1"?"end2":"end1"}function P(G){var $e;const q=($e=E.value)==null?void 0:$e[G];if(!(q!=null&&q.attributeRef))return;const W=l.state.logical.entities.find(ze=>ze.modelId===q.entityRef),Ce=W==null?void 0:W.attributes.find(ze=>ze.modelId===q.attributeRef);return Ce&&(Ce.attrType==="RELATION_OWN"||Ce.attrType==="RELATION_REF")?Ce.name:void 0}function Y(G,q){var Ce;const W=(Ce=E.value)==null?void 0:Ce[G];W!=null&&W.attributeRef&&l.updateAttribute(W.entityRef,W.attributeRef,{name:q})}function se(G){var ze;const q=P(G);if(q!==void 0)return q;const W=(ze=E.value)==null?void 0:ze[G];if(W!=null&&W.navFieldNameHint)return W.navFieldNameHint;const Ce=G==="end1"?"end2":"end1",$e=l.state.logical.entities.find(Fe=>{var ae;return Fe.modelId===((ae=E.value)==null?void 0:ae[Ce].entityRef)});return $e?ua($e.name,ca(E.value[Ce].multiplicity)):""}function he(G){return!!Z.value||P(G)!==void 0}function ie(G){E.value&&!B.value&&l.setAssociationIdentifying(E.value.modelId,G)}function fe(G){var q,W,Ce;return!!((Ce=(W=(q=E.value)==null?void 0:q[G].jpa)==null?void 0:W.cascadeTypes)!=null&&Ce.includes("ALL"))}function pe(G,q,W){var ze,Fe;const Ce=(ze=E.value)==null?void 0:ze[G];if(q==="ALL"&&W){M(G,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:["ALL"]}});return}const $e=new Set(((Fe=Ce==null?void 0:Ce.jpa)==null?void 0:Fe.cascadeTypes)??[]);W?$e.add(q):$e.delete(q),M(G,{jpa:{...Ce==null?void 0:Ce.jpa,cascadeTypes:[...$e]}})}function ge(G,q){var Ce;const W=(Ce=E.value)==null?void 0:Ce[G];M(G,{jpa:{...W==null?void 0:W.jpa,...q}})}function Te(G){var q,W;return((W=(q=E.value)==null?void 0:q[G].jpa)==null?void 0:W.fetchType)??"inherit"}function He(G,q){ge(G,{fetchType:q==="inherit"?void 0:q})}function De(G){var W;const q=(W=E.value)==null?void 0:W[G==="end1"?"end2":"end1"];return(q==null?void 0:q.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(q==null?void 0:q.multiplicity)==="ONE_OR_MORE_INSTANCES"}const Z=t.computed(()=>{const G=E.value;if(!G)return null;for(const q of l.state.logical.entities){const W=q.attributes.find(Fe=>{var ae;return((ae=Fe.embedded)==null?void 0:ae.associationRef)===G.modelId&&Fe.attrType==="EMBED_OWN"});if(!W)continue;const Ce=G.end2.entityRef===W.embedded.embeddableRef?"end2":"end1",$e=G[Ce].multiplicity,ze=G[Ce].jpa;return{which:Ce,cardinality:$e,isCollection:$e==="ZERO_OR_MORE_INSTANCES"||$e==="ONE_OR_MORE_INSTANCES",collectionType:(ze==null?void 0:ze.collectionType)??"LIST",collectionTable:(ze==null?void 0:ze.collectionTable)??"",orderColumn:(ze==null?void 0:ze.orderColumn)??""}}return null});function re(G){E.value&&l.setEmbedCardinality(E.value.modelId,G)}function ue(G){const q=Z.value;q&&ge(q.which,G==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function z(G){const q=Z.value;q&&ge(q.which,{collectionTable:G.trim()||void 0})}function L(G){const q=Z.value;q&&ge(q.which,{orderColumn:G.trim()||void 0})}function F(G){N.value&&l.updateGroup(N.value.modelId,G)}function X(G,q){var W;F({name:{...(W=N.value)==null?void 0:W.name,[G]:q}})}const ee=t.computed(()=>{var G;return N.value?$t((G=l.state.layout.groupLayouts.find(q=>q.groupRef===N.value.modelId))==null?void 0:G.style):null});function ke(G){N.value&&l.setGroupSwatch(N.value.modelId,G)}function ye(G){y.value&&l.setNoteMemo(y.value.modelId,G)}const Ne=t.computed(()=>{var G;return $t((G=y.value)==null?void 0:G.style)});function we(G){y.value&&l.setNoteSwatch(y.value.modelId,G)}return(G,q)=>(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(l).t("em.panel.resizeWidth"),onPointerdown:q[0]||(q[0]=(...W)=>e.startResize&&e.startResize(...W))},null,42,pB),t.createElementVNode("header",hB,[t.createElementVNode("div",yB,[q[14]||(q[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:q[1]||(q[1]=W=>a("collapse"))},[t.createVNode(Ve,{name:"panel-right-close",size:16})],8,gB)]),t.createElementVNode("p",bB,t.toDisplayString(S.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",_B,[t.createVNode(Ve,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:q[2]||(q[2]=W=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(ip,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:_.value,onToggle:q[3]||(q[3]=W=>b("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(XV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.unref(hn)(d.value.stereotype)?(t.openBlock(),t.createElementBlock("p",EB,t.toDisplayString(t.unref(l).t("em.entity.noIndexNote")),1)):(t.openBlock(),t.createBlock(oB,{key:1,controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:q[4]||(q[4]=W=>b("index"))},null,8,["controller","entity-id","collapsed"])),t.createVNode(fB,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:q[5]||(q[5]=W=>b("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(oe.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!E.value.identifying,disabled:B.value||!!Z.value,"onUpdate:modelValue":ie},null,8,["label","model-value","disabled"]),B.value?(t.openBlock(),t.createElementBlock("p",NB,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):Z.value?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),Z.value?(t.openBlock(),t.createElementBlock("fieldset",IB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",vB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":Z.value.cardinality,items:V,"value-provider":I,"label-provider":D,"onUpdate:modelValue":q[6]||(q[6]=W=>W&&re(W))},null,8,["model-value"])]),Z.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",CB,[q[15]||(q[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(oe.BSSelect),{"model-value":Z.value.collectionType,items:$,"value-provider":I,"label-provider":I,"onUpdate:modelValue":q[7]||(q[7]=W=>W&&ue(W))},null,8,["model-value"])]),t.createElementVNode("label",SB,[q[16]||(q[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":Z.value.collectionTable,"onUpdate:modelValue":z},null,8,["placeholder","model-value"])]),Z.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",xB,[q[17]||(q[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":Z.value.orderColumn,"onUpdate:modelValue":L},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",RB,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],W=>{var Ce,$e,ze;return t.withDirectives(t.createElementVNode("div",{key:W,class:"em-end"},[t.createElementVNode("h4",AB,t.toDisplayString(W)+" → "+t.toDisplayString(C(E.value[W].entityRef)),1),Z.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",$B,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(oe.BSSelect),{"model-value":E.value[W].multiplicity,items:A,"value-provider":I,"label-provider":t.unref(da),"onUpdate:modelValue":Fe=>M(W,{multiplicity:Fe})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-navigable`,class:"em-check",label:"navigable",title:x(W)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:x(W)==="end2","model-value":x(W)==="end2"?!0:E.value[x(W)].navigable,"onUpdate:modelValue":Fe=>M(x(W),{navigable:Fe})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",TB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(oe.BSTextInput),{name:`${x(W)}-navname`,width:"100%",disabled:!he(x(W)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":se(x(W)),"onUpdate:modelValue":Fe=>Y(x(W),Fe)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-composition`,class:"em-check",label:"composition","model-value":E.value[x(W)].composition,"onUpdate:modelValue":Fe=>M(x(W),{composition:Fe})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",MB,[q[18]||(q[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(R,Fe=>{var ae,Se;return t.createVNode(t.unref(oe.BSCheckbox),{key:Fe,name:`${x(W)}-cascade-${Fe}`,class:"em-check",label:Fe,"model-value":!!((Se=(ae=E.value[x(W)].jpa)==null?void 0:ae.cascadeTypes)!=null&&Se.includes(Fe)),disabled:!he(x(W))||Fe!=="ALL"&&fe(x(W)),"onUpdate:modelValue":Ge=>pe(x(W),Fe,Ge)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),he(x(W))?fe(x(W))?(t.openBlock(),t.createElementBlock("p",BB,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",VB,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",DB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",OB,[q[19]||(q[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(oe.BSSelect),{disabled:!he(x(W)),"model-value":Te(x(W)),items:w,"value-provider":I,"label-provider":v,"onUpdate:modelValue":Fe=>Fe&&He(x(W),Fe)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:`${x(W)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ce=E.value[x(W)].jpa)!=null&&Ce.orphanRemoval),disabled:!he(x(W))||De(W),"onUpdate:modelValue":Fe=>ge(x(W),{orphanRemoval:Fe})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),De(W)&&(($e=E.value[x(W)].jpa)!=null&&$e.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",LB,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",PB,[q[20]||(q[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(oe.BSTextInput),{name:`${x(W)}-orderby`,width:"100%",disabled:!he(x(W)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=E.value[x(W)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Fe=>ge(x(W),{orderBy:Fe.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!Z.value||W===Z.value.which]])}),64))],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",zB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,W=>{var Ce;return t.openBlock(),t.createElementBlock("label",{key:W,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(W),1),t.createVNode(t.unref(oe.BSTextInput),{name:`grp-name-${W}`,width:"100%","model-value":((Ce=N.value.name)==null?void 0:Ce[W])??"","onUpdate:modelValue":$e=>X(W,$e)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",FB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.value.description??"",rows:"3",onChange:q[8]||(q[8]=W=>F({description:W.target.value}))},null,40,UB)]),t.createElementVNode("label",HB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(oe.BSTextInput),{name:"grp-package",width:"100%","model-value":N.value.packageName??"","onUpdate:modelValue":q[9]||(q[9]=W=>F({packageName:W}))},null,8,["model-value"])]),t.createVNode(t.unref(oe.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":N.value.excludeDDLGeneration,"onUpdate:modelValue":q[10]||(q[10]=W=>F({excludeDDLGeneration:W}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",jB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",KB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ee.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[11]||(q[11]=W=>ke(null))},"∅",10,GB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),W=>(t.openBlock(),t.createElementBlock("button",{key:W,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ee.value===W}]),style:t.normalizeStyle({background:t.unref(Qo)(W)}),title:t.unref(l).t(t.unref(wo)(W)),onClick:Ce=>ke(W)},null,14,YB))),128))])]),t.createElementVNode("p",qB,t.toDisplayString(t.unref(l).t("em.group.members",{n:N.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",WB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:y.value.memo,rows:"6",onChange:q[12]||(q[12]=W=>ye(W.target.value))},null,40,JB)]),t.createElementVNode("fieldset",XB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",ZB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ne.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:q[13]||(q[13]=W=>we(null))},"∅",10,QB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(No),W=>(t.openBlock(),t.createElementBlock("button",{key:W,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ne.value===W}]),style:t.normalizeStyle({background:t.unref(Qo)(W)}),title:t.unref(l).t(t.unref(wo)(W)),onClick:Ce=>we(W)},null,14,eD))),128))])])],64)):t.createCommentVNode("",!0)],8,kB)],4))}}),[["__scopeId","data-v-d79a8574"]]),tD=["title"],nD={class:"em-validation__title"},oD=["title","onClick"],iD={key:0,class:"em-validation__body"},aD={class:"em-validation__opt"},rD={key:0,class:"em-validation__empty"},lD={key:1,class:"em-validation__empty"},sD={key:2,class:"em-validation__list"},cD=["onClick"],dD={class:"em-validation__item-msg"},uD={key:0,class:"em-validation__item-entity"},mD=["title","onClick"],fD=["title"],pD=Qe(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 g=new Map;for(const b of o.state.logical.entities)g.set(b.modelId,b.name);return g});function r(g){const b=EI(g);if(!b)return null;const _=a.value.get(b);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 g={error:0,warning:0,info:0};for(const b of i.value)g[b.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,b)=>l[g.severity].order-l[b.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:op(o.t,g),category:_I(o.t,g.ruleId)}))),m=t.ref(!1);function p(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}p(g)}function h(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,b)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:b[1]||(b[1]=_=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ve,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",nD,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,tD),t.createElementVNode("div",{class:"em-validation__counts",onClick:b[0]||(b[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:m.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=>f(_)},[t.createVNode(Ve,{name:l[_].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[_]),1)],10,oD)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",iD,[t.createElementVNode("label",aD,[t.createVNode(t.unref(oe.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":b[2]||(b[2]=_=>t.unref(o).flagEntitiesWithoutRelations.value=_)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",rD,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",lD,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",sD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:_,entityName:E,message:N,category:y},k)=>(t.openBlock(),t.createElementBlock("li",{key:`${_.ruleId}:${_.targetRef??"model"}:${k}`,class:t.normalizeClass(["em-validation__item",[`is-${_.severity}`,{"is-clickable":!!_.targetRef}]]),onClick:S=>h(_)},[t.createVNode(Ve,{name:l[_.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",dD,[E?(t.openBlock(),t.createElementBlock("span",uD,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(N),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(S=>t.unref(o).applyQuickFix(_),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,mD)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:_.ruleId},t.toDisplayString(y),9,fD)],10,cD))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),hD={class:"em-history"},yD={class:"em-history__head"},gD={class:"em-history__title"},bD={class:"em-history__head-actions"},_D=["title","disabled"],kD=["title"],ED={class:"em-history__filters"},ND={class:"em-history__filter"},wD={class:"em-history__filters em-history__filters--period"},ID={class:"em-history__filter-label"},vD=["title","aria-label","max"],CD=["title","aria-label","min"],SD=["title"],xD={key:0,class:"em-history__diffbar"},RD={class:"em-history__diffbar-range"},AD={class:"em-history__diffbar-count"},$D={class:"em-history__body"},TD={key:0,class:"em-history__empty"},MD={key:1,class:"em-history__diff-list"},VD=["onClick"],BD={class:"em-history__action-head"},DD={class:"em-history__action-name"},OD={key:0,class:"em-history__fields"},LD={class:"em-history__fname"},PD={key:0,class:"em-history__old"},zD={class:"em-history__val"},FD={key:1,class:"em-history__empty"},UD={key:2,class:"em-history__empty is-error"},HD={key:3,class:"em-history__empty"},jD={key:4,class:"em-history__list"},KD=["onClick"],GD={class:"em-history__summary"},YD={class:"em-history__seq"},qD={class:"em-history__gmeta"},WD={class:"em-history__who"},JD={key:0,class:"em-history__time"},XD={key:1,class:"em-history__restored-from"},ZD=["onClick"],QD={key:0,class:"em-history__detail"},eO={class:"em-history__action-head"},tO={class:"em-history__action-name"},nO={key:0,class:"em-history__fields"},oO={class:"em-history__fname"},iO={key:0,class:"em-history__old"},aO={class:"em-history__val"},rO={class:"em-history__preview"},lO=["disabled"],sO={key:0,class:"em-history__diff-list is-preview"},cO={class:"em-history__action-head"},dO={class:"em-history__action-name"},uO={key:0,class:"em-history__fields"},mO={class:"em-history__fname"},fO={key:0,class:"em-history__old"},pO={class:"em-history__val"},hO={class:"em-history__confirm-row"},yO={class:"em-history__confirm-msg"},gO=["disabled","onClick"],bO=["disabled"],_O=["onClick"],zr=50,kO=Qe(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),d=t.computed(()=>r.value.reduce((ae,Se)=>Se.seq>ae?Se.seq:ae,-1/0));async function u(ae){if(a.historyTransport){l.value=!0,s.value=null;try{const Se=!(ae!=null&&ae.full)&&r.value.length>0&&Number.isFinite(d.value),Ge=await a.historyTransport(Se?d.value:void 0);if(!Se)r.value=Ge;else if(Ge.length){const et=new Set(r.value.map(de=>de.seq)),te=Ge.filter(de=>!et.has(de.seq));te.length&&(r.value=[...r.value,...te])}c.value=!0}catch(Se){s.value=Se instanceof Error?Se.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,ae=>{ae?m():(p.value=null,f.value=null)},{immediate:!0});let h=null;t.watch(()=>a.revision.value,()=>{o.open&&(h&&clearTimeout(h),h=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(ae=>[ae.modelId,ae]))),b=t.computed(()=>new Map(a.state.logical.associations.map(ae=>[ae.modelId,ae]))),_=t.computed(()=>{const ae=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Se=>{var Ge,et;return[Se.modelId,Se.packageName||((Ge=Se.name)==null?void 0:Ge[ae])||((et=Se.name)==null?void 0:et.ko)||Se.modelId]}))});function E(ae){var te,de,Le,dt,Xe,yt,st;const Se=b.value.get(ae);if(!Se)return a.t("em.history.assocFallback");if((te=Se.description)!=null&&te.trim())return Se.description.trim();const Ge=(dt=(Le=g.value.get((de=Se.end1)==null?void 0:de.entityRef))==null?void 0:Le.name)==null?void 0:dt.trim(),et=(st=(yt=g.value.get((Xe=Se.end2)==null?void 0:Xe.entityRef))==null?void 0:yt.name)==null?void 0:st.trim();return Ge&&et?`${Ge}→${et}`:a.t("em.history.assocFallback")}function N(ae){var Se,Ge,et,te;if(ae.kind==="entity")return((Ge=(Se=g.value.get(ae.ref))==null?void 0:Se.name)==null?void 0:Ge.trim())||a.t("em.attr.nameless");if(ae.kind==="attribute"||ae.kind==="operation"||ae.kind==="index"){const de=ae.entityRef?g.value.get(ae.entityRef):void 0,dt=((ae.kind==="attribute"?de==null?void 0:de.attributes:ae.kind==="operation"?de==null?void 0:de.operations:de==null?void 0:de.indexes)??[]).find(yt=>yt.modelId===ae.ref),Xe=(et=de==null?void 0:de.name)==null?void 0:et.trim();return`${Xe?Xe+".":""}${((te=dt==null?void 0:dt.name)==null?void 0:te.trim())||ae.ref}`}return ae.kind==="association"?E(ae.ref):ae.kind==="associationEnd"?`${E(ae.ref)}(${ae.end})`:ae.kind==="group"?a.t("em.history.groupSubject",{name:_.value.get(ae.ref)??ae.ref}):ae.ref}const y={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},k={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},S=t.ref("all"),A=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],V=t.computed({get:()=>S.value,set:ae=>{ae&&(S.value=ae)}}),T=t.computed(()=>Al(r.value)),D=t.computed(()=>T.value.length?T.value[0].seq:null),C=t.computed(()=>S.value==="all"?T.value:T.value.filter(ae=>(ae.kind??"edit")===S.value)),R=t.ref(zr),$=t.ref(""),w=t.ref(""),I=t.computed(()=>!!$.value||!!w.value);function v(){$.value="",w.value=""}const B=t.computed(()=>{const ae=$.value?new Date(`${$.value}T00:00:00`).getTime():null,Se=w.value?new Date(`${w.value}T23:59:59.999`).getTime():null;return ae==null&&Se==null?C.value:C.value.filter(Ge=>{if(Ge.ts==null)return!1;const et=new Date(Ge.ts).getTime();return!(isNaN(et)||ae!=null&&et<ae||Se!=null&&et>Se)})}),M=t.computed(()=>B.value.slice(0,R.value)),x=t.computed(()=>Math.max(0,B.value.length-R.value));function P(){R.value+=zr}t.watch([S,$,w],()=>{R.value=zr}),t.watch(()=>o.open,ae=>{ae&&(R.value=zr,v())});function Y(ae){return ae===void 0?"—":ae===null?a.t("em.history.emptyValue"):typeof ae=="object"?JSON.stringify(ae):String(ae)}function se(ae){const Se=N(ae.subject);if(ae.verb==="add")return a.t("em.history.summaryAdd",{name:Se});if(ae.verb==="remove")return a.t("em.history.summaryRemove",{name:Se});if(ae.fields.length===1){const Ge=ae.fields[0];return`${Se}.${Ge.field} ${Ge.oldValue!==void 0?Y(Ge.oldValue)+"→":""}${Y(Ge.value)}`}return a.t("em.history.summaryFields",{name:Se,n:ae.fields.length})}function he(ae){return ae.actions.length===0?a.t("em.history.noChange"):ae.actions.length===1?se(ae.actions[0]):a.t("em.history.summaryMore",{summary:se(ae.actions[0]),n:ae.actions.length-1})}const ie=t.ref(new Set);function fe(ae){const Se=new Set(ie.value);Se.has(ae)?Se.delete(ae):Se.add(ae),ie.value=Se}function pe(ae){if(ae==null)return"";const Se=new Date(ae);return isNaN(Se.getTime())?String(ae):Se.toLocaleString()}function ge(ae){const Se=ae.author,Ge=ae.origin;return Se&&Ge?`${Se}(${Ge})`:Se||(Ge?`(${Ge})`:"—")}const Te=t.computed(()=>p.value==null?null:$l(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Te.value?Ad(Te.value):null,ae=>i("diffChange",ae));function He(ae){p.value=ae,f.value=null,q.value=null}function De(){p.value=null,f.value=null}const Z=t.computed(()=>T.value.map(ae=>ae.seq)),re=t.computed(()=>D.value??1/0),ue=t.computed(()=>f.value??re.value),z=t.computed(()=>f.value??re.value),L=t.computed(()=>Z.value.filter(ae=>ae<ue.value).map(ae=>({v:ae}))),F=t.computed(()=>Z.value.filter(ae=>p.value!=null&&ae>p.value).map(ae=>({v:ae})));function X(ae){ae!=null&&(p.value=ae,f.value!=null&&f.value<=ae&&(f.value=null))}function ee(ae){ae!=null&&(f.value=ae>=re.value?null:ae)}function ke(ae){return ae>=re.value?a.t("em.history.diff.current"):`#${ae}`}function ye(ae){return ae.kind==="entity"?g.value.has(ae.ref)?ae.ref:null:(ae.kind==="attribute"||ae.kind==="operation"||ae.kind==="index")&&ae.entityRef?g.value.has(ae.entityRef)?ae.entityRef:null:ae.kind==="group"&&_.value.has(ae.ref)?ae.ref:null}function Ne(ae){const Se=ye(ae);Se&&a.requestFocus(Se)}const we={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},G={added:"add",modified:"update",removed:"remove"},q=t.ref(null),W=t.ref(!1),Ce=t.computed(()=>q.value==null?null:$l(r.value,{fromSeq:q.value})),$e=t.ref(!1);function ze(ae){q.value=ae,$e.value=!1}async function Fe(ae){W.value=!0;try{const Se=await a.restoreToSeq(ae);Se.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Se.reason??a.t("em.history.unknown")})}finally{W.value=!1,q.value=null}}return(ae,Se)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Ge,et;return[t.withDirectives(t.createElementVNode("section",hD,[t.createElementVNode("header",yD,[t.createElementVNode("div",gD,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",bD,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Se[0]||(Se[0]=te=>u({full:!0}))},[t.createVNode(Ve,{name:"redo",size:15})],8,_D),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Se[1]||(Se[1]=te=>i("close"))},[t.createVNode(Ve,{name:"panel-close",size:15})],8,kD)])]),t.createElementVNode("div",ED,[t.createElementVNode("label",ND,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(oe.BSSelect),{modelValue:V.value,"onUpdate:modelValue":Se[2]||(Se[2]=te=>V.value=te),items:A,"value-provider":te=>te.v,"label-provider":te=>t.unref(a).t(te.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",wD,[t.createElementVNode("span",ID,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:w.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=te=>$.value=te)},null,8,vD),[[t.vModelText,$.value]]),Se[9]||(Se[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:$.value||void 0,"onUpdate:modelValue":Se[4]||(Se[4]=te=>w.value=te)},null,8,CD),[[t.vModelText,w.value]]),I.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ve,{name:"x",size:12})],8,SD)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",xD,[t.createElementVNode("div",RD,[t.createVNode(t.unref(oe.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:L.value,"value-provider":te=>te.v,"label-provider":te=>`#${te.v}`,"onUpdate:modelValue":Se[5]||(Se[5]=te=>X(te??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ve,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(oe.BSSelect),{class:"em-history__range-sel","model-value":z.value,items:F.value,"value-provider":te=>te.v,"label-provider":te=>ke(te.v),"onUpdate:modelValue":Se[6]||(Se[6]=te=>ee(te??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",AD,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Ge=Te.value)==null?void 0:Ge.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:De},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",$D,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(et=Te.value)!=null&&et.entries.length?(t.openBlock(),t.createElementBlock("ul",MD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Te.value.entries,(te,de)=>(t.openBlock(),t.createElementBlock("li",{key:de,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!ye(te.subject)}]),onClick:Le=>Ne(te.subject)},[t.createElementVNode("div",BD,[t.createVNode(Ve,{name:y[te.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",DD,t.toDisplayString(N(te.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[te.verb]}`])},t.toDisplayString(t.unref(a).t(we[te.verb])),3)]),te.fields.length?(t.openBlock(),t.createElementBlock("ul",OD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.fields,(Le,dt)=>(t.openBlock(),t.createElementBlock("li",{key:dt,class:"em-history__field"},[t.createElementVNode("span",LD,t.toDisplayString(Le.field),1),Le.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",PD,t.toDisplayString(Y(Le.oldValue)),1)):t.createCommentVNode("",!0),Le.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",zD,t.toDisplayString(Y(Le.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,VD))),128))])):(t.openBlock(),t.createElementBlock("p",TD,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",FD,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",UD,t.toDisplayString(s.value),1)):B.value.length===0?(t.openBlock(),t.createElementBlock("p",HD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",jD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.value,te=>{var de,Le,dt;return t.openBlock(),t.createElementBlock("li",{key:te.seq,class:t.normalizeClass(["em-history__group",[`is-${te.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Xe=>fe(te.seq)},[t.createVNode(Ve,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ie.value.has(te.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${te.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(te.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",GD,t.toDisplayString(he(te)),1),t.createElementVNode("span",YD,"#"+t.toDisplayString(te.seq),1)],8,KD),t.createElementVNode("div",qD,[t.createElementVNode("span",WD,t.toDisplayString(ge(te)),1),te.ts?(t.openBlock(),t.createElementBlock("span",JD,t.toDisplayString(pe(te.ts)),1)):t.createCommentVNode("",!0),te.kind==="restore"&&te.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",XD,"← #"+t.toDisplayString(te.restoredFromSeq),1)):t.createCommentVNode("",!0),te.seq!==D.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Xe=>He(te.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,ZD)):t.createCommentVNode("",!0)]),ie.value.has(te.seq)?(t.openBlock(),t.createElementBlock("div",QD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.actions,(Xe,yt)=>(t.openBlock(),t.createElementBlock("div",{key:yt,class:"em-history__action"},[t.createElementVNode("div",eO,[t.createVNode(Ve,{name:y[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",tO,t.toDisplayString(N(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Xe.verb}`])},t.toDisplayString(t.unref(a).t(k[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",nO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,ft)=>(t.openBlock(),t.createElementBlock("li",{key:ft,class:"em-history__field"},[t.createElementVNode("span",oO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",iO,t.toDisplayString(Y(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",aO,t.toDisplayString(Y(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&te.seq!==D.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":q.value===te.seq}])},[q.value===te.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",rO,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((de=Ce.value)!=null&&de.entries.length),onClick:Se[7]||(Se[7]=Xe=>$e.value=!$e.value)},[t.createVNode(Ve,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":$e.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Le=Ce.value)!=null&&Le.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:Ce.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,lO),$e.value&&((dt=Ce.value)!=null&&dt.entries.length)?(t.openBlock(),t.createElementBlock("ul",sO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce.value.entries,(Xe,yt)=>(t.openBlock(),t.createElementBlock("li",{key:yt,class:"em-history__diff-entry"},[t.createElementVNode("div",cO,[t.createVNode(Ve,{name:y[Xe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",dO,t.toDisplayString(N(Xe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${G[Xe.verb]}`])},t.toDisplayString(t.unref(a).t(we[Xe.verb])),3)]),Xe.fields.length?(t.openBlock(),t.createElementBlock("ul",uO,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Xe.fields,(st,ft)=>(t.openBlock(),t.createElementBlock("li",{key:ft,class:"em-history__field"},[t.createElementVNode("span",mO,t.toDisplayString(st.field),1),st.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",fO,t.toDisplayString(Y(st.oldValue)),1)):t.createCommentVNode("",!0),st.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",pO,t.toDisplayString(Y(st.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",hO,[t.createElementVNode("span",yO,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:W.value,onClick:Xe=>Fe(te.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,gO),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:W.value,onClick:Se[8]||(Se[8]=Xe=>q.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,bO)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Xe=>ze(te.seq)},[t.createVNode(Ve,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,_O))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&x.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:P},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:x.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function EO(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 ry(e){const n=t.ref(EO(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 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)),n.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(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const NO={class:"em-modeler"},wO={class:"em-modeler__body"},IO={class:"em-drawer__inner"},vO={class:"em-drawer__head"},CO={class:"em-drawer__actions"},SO=["title"],xO=["title"],RO=["title"],AO=["title"],$O=["title"],TO=Qe(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(y){t.nextTick(()=>{const k=y();k&&("focusCollapse"in k?k.focusCollapse():k.focus())})}function c(y){n.value=y,s(()=>y?i.value:a.value)}function d(y){o.value=y,s(()=>y?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:h}=ry({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:b,startResize:_}=ry({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),E=t.ref(null),N=t.ref(null);return(y,k)=>{var S,A,V;return t.openBlock(),t.createElementBlock("div",NO,[t.createVNode(iy,{controller:e.controller,"history-open":u.value,onExportSvg:k[0]||(k[0]=T=>{var D;return(D=E.value)==null?void 0:D.exportSvg()}),onExportPng:k[1]||(k[1]=T=>{var D;return(D=E.value)==null?void 0:D.exportPng()}),onToggleHistory:k[2]||(k[2]=T=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",wO,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",IO,[t.createElementVNode("header",vO,[k[11]||(k[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",CO,[(S=N.value)!=null&&S.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((A=N.value)!=null&&A.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:k[3]||(k[3]=T=>{var D;return(D=N.value)==null?void 0:D.toggleAll()})},[t.createVNode(Ve,{name:(V=N.value)!=null&&V.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,SO)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:k[4]||(k[4]=T=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,xO)])]),t.createVNode(oy,{ref_key:"explorer",ref:N,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:k[5]||(k[5]=(...T)=>t.unref(h)&&t.unref(h)(...T))},null,42,RO),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:k[6]||(k[6]=T=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,AO),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(ny,{ref_key:"canvas",ref:E,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(ay,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(b),"start-resize":t.unref(_),onCollapse:k[7]||(k[7]=T=>d(!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",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:k[8]||(k[8]=T=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,$O),[[t.vShow,!o.value]])]),_:1}),t.createVNode(kO,{controller:e.controller,open:u.value,onClose:k[9]||(k[9]=T=>u.value=!1),onDiffChange:k[10]||(k[10]=T=>m.value=T)},null,8,["controller","open"])]),t.createVNode(pD,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=x_,be.AssociationEdge=eh,be.CUSTOM_TYPE_VALUE=_n,be.CommandStack=Tl,be.DEFAULT_JAVA_TYPE=Wr,be.DIAGRAM_JSON_FORMAT=il,be.DIAGRAM_JSON_VERSION=al,be.DiagramCanvas=ny,be.DiagramExplorer=oy,be.EDITOR=Gn,be.EditModeToggle=tV,be.EditorToolbar=iy,be.EntityModeler=TO,be.EntityNode=Vp,be.GROUP_CODE_ENUM_VALUE=eo,be.GroupNode=Bp,be.INHERITED_REF_PREFIX=oa,be.InvalidDiagramJsonError=oo,be.JAVA_TYPES=ui,be.LIB_VERSION=ib,be.NoteNode=Dp,be.OpSyncAdapter=ku,be.PHYSICAL_NAME_MAX_LENGTH=hi,be.PropertyPanel=ay,be.RevCache=_u,be.SELECTABLE_JAVA_TYPES=Cc,be.SYMBOLIC_OP_KINDS=Eu,be.SYMBOLIC_OP_SCHEMA=Ku,be.UI_LOCALES=ZI,be.applyDocumentReferenceOnly=Zr,be.buildAgentBatch=R_,be.buildDiagramSvg=cc,be.buildDiffMarks=Ad,be.collectSharedColumns=Dn,be.commands=Rb,be.computeAutoLayout=fc,be.createEditorController=zS,be.dedupeModelIds=nb,be.defaultMermaidDialect=Vy,be.defaultSqlDialect=tg,be.diagramToJson=Wc,be.displayLabel=ra,be.emptyState=Ep,be.entityModelToDdl=Yc,be.entityModelToMermaid=Qr,be.entityModelToText=Mc,be.exportDiagramPng=ey,be.exportDiagramSvg=Qh,be.fromPersisted=tm,be.isGeneratable=dd,be.isInheritedColumnRef=Xn,be.isValueTypeStereotype=_t,be.javaTypeLabel=mi,be.makeInheritedColumnRef=yc,be.mergeDiagram=Id,be.mermaidErToImportSource=Uc,be.migrateLegacyMoney=tb,be.multiplicityLabel=da,be.newId=Pe,be.packEntityBoxes=Ur,be.parseDiagramJson=Jc,be.parseInheritedColumnRef=Hr,be.parseMermaidEr=Fc,be.parseSqlDdl=nl,be.planHealBackfillOps=ck,be.projectActionLog=Al,be.projectEntityAudit=xd,be.projectFieldAudit=Ln,be.projectInheritedColumns=si,be.projectSeqDiff=$l,be.renderDiagramSvg=Zc,be.resolveColumnPhysicalName=ci,be.resolveDiagram=mc,be.resolveEffectiveColumn=bn,be.resolveQuickFix=ml,be.resolveSharedColumn=Qn,be.resolveSymbolicOps=s_,be.restoreDeepEqual=ro,be.scaffoldEntityJava=Ag,be.sharedColumnScopeEntities=Gr,be.sqlDdlToImportSource=Gc,be.stereotypeLabel=li,be.synthesizeRestoreOps=hb,be.toPersisted=rk,be.toPersistedV2=lk,be.translate=en,be.uiMessagesEn=lp,be.uiMessagesJa=sp,be.uiMessagesKo=cp,be.validateModel=ga,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|