dev-process-kit 0.3.0-beta.0 → 0.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/boards.js +1 -1
  2. package/dist/chunks/{shared-CtoQ05tb.js → shared-BX1EnRfr.js} +1 -1
  3. package/dist/chunks/{shared-DbgUhOLb.js → shared-C-M2Nfmu.js} +1 -1
  4. package/dist/chunks/{shared-Dj_D4ypT.js → shared-Cas88qVh.js} +1 -1
  5. package/dist/chunks/{shared-jVZVFFNq.js → shared-Cejw83eH.js} +1 -1
  6. package/dist/chunks/{shared-B0QTGEwR.js → shared-CfVpKPRY.js} +1 -1
  7. package/dist/chunks/{shared-DXoggfKr.js → shared-CnPCm4bJ.js} +1 -1
  8. package/dist/chunks/{shared-xpAS9Ri4.js → shared-D1iBuYZV.js} +5 -5
  9. package/dist/chunks/{shared-BR7trWLo.js → shared-D7VtCoY6.js} +1 -1
  10. package/dist/chunks/{shared-DW3QUBTw.js → shared-DHVDag3x.js} +1 -1
  11. package/dist/chunks/{shared-BQqlFaPv.js → shared-DdpMqkAH.js} +3 -3
  12. package/dist/chunks/shared-EYOAbLSo.js +1 -0
  13. package/dist/chunks/{shared-C6hVLci2.js → shared-a9QCZpxj.js} +1 -1
  14. package/dist/chunks/{shared-DuB4veji.js → shared-df9XN7ns.js} +1 -1
  15. package/dist/chunks/{shared-bW1cft1H.js → shared-dnY35u9q.js} +1 -1
  16. package/dist/chunks/{shared-BpfuvyBP.js → shared-e9ia12Uz.js} +1 -1
  17. package/dist/chunks/{shared-C1rWkW_W.js → shared-qk9TB_UM.js} +1 -1
  18. package/dist/components.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/views/delegation-poker.js +1 -1
  21. package/dist/views/plain.js +1 -1
  22. package/dist/views/prototype.js +1 -1
  23. package/dist/views/slides.js +1 -1
  24. package/dist/views/task-board.js +1 -1
  25. package/dist/views/usm.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/shared-ztEUikTm.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a4 as ja,S as Xi,a5 as le,a6 as Va,a7 as Qa,a8 as Oe,a9 as A,aa as F,ab as ce,ac as x,ad as pe,ae as Za,af as Ja,X as ed,j as Gi,ag as Ki,ah as re,ai as $,aj as U,ak as Wi,al as ji,am as td,an as nd,D as id,ao as od,U as sd,ap as An,aq as rd,ar as Vi,as as y,C as ad,at as dd,au as he,av as z,aw as T,ax as E,ay as M,az as H,aA as Xe,aB as mt,aC as On,aD as ld,aE as Qi,aF as Zi,aG as cd,aH as Te,aI as Ji,B as eo,aJ as pd,G as to,H as Dn,I as qt,aK as hd,aL as G,aM as te,aN as Qe,p as N,t as Se,aO as ue,aP as Nn,aQ as gt,aR as ud,N as Pt,e as zn,P as B,aS as Ft,aT as md,l as fe,aU as qn,aV as gd,aW as fd,aX as no,aY as bd,aZ as io,a_ as Bt,a$ as Me,b0 as xd,b1 as yd,b2 as kd}from"./shared-BQqlFaPv.js";import{Q as vd,A as wd,H as $d,R as Ed,S as Td,T as be,U as Ie,V as oo,W as Sd,X as xe,Y as Md,Z as Pn,_ as so,$ as Id}from"./shared-bW1cft1H.js";import{o as Cd}from"./shared-TrlnHjrJ.js";import{E as Ld,t as Ce,u as Rd,v as Ge,B as Ut,w as Ht,x as _d}from"./shared-DuB4veji.js";import{a as Ad,c as Od}from"./shared-C1rWkW_W.js";import{o as Yt}from"./shared-ztEUikTm.js";const Dd=[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2"}]],Nd=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]],zd=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}]],qd=[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1"}]],Pd=[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M5 17A12 12 0 0 1 17 5"}]];function Fd(t,e){let n=0;for(let i=0;i<t.length;i++)n+=e(t[i],i);return n}function ro(t){if(t.length===0)return NaN;const e=t.slice().sort((i,o)=>i-o),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const ao={},lo=t=>{const e={kind:"board",name:t.name,label:t.label,addable:!1,parseBase:()=>ao,emptyBase:()=>ao,actions:{},apply:()=>null,hasTarget:()=>!1,describe:o=>({title:o.type,targetLabel:Xi(o.target),tone:"meta"}),serialize:o=>`${o.type} ${Xi(o.target)} ${JSON.stringify(o.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],i=new Map((t.elementActionResults?.()??[]).map(o=>[o.id,o]));return ja(e,n,i)},ft={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},bt=t=>{const e=[...t].sort((i,o)=>i-o);if(e.length===0)return 0;const n=Math.floor(e.length/2);return e.length%2===1?e[n]??0:((e[n-1]??0)+(e[n]??0))/2},Fn=(t,e)=>{const n=new Map;for(const r of t)n.set(r.id,[]);for(const r of e)n.get(r.from)?.push(r);const i=new Map,o=new Set,s=r=>{i.set(r,"open");for(const a of n.get(r)??[]){const d=i.get(a.to)??"new";d==="open"?o.add(a.id):d==="new"&&s(a.to)}i.set(r,"done")};for(const r of t)(i.get(r.id)??"new")==="new"&&s(r.id);return{reversed:o,forward:e.filter(r=>!o.has(r.id))}},co=(t,e)=>{const n=new Map,i=new Map;for(const a of t)n.set(a.id,[]),i.set(a.id,[]);for(const a of e)i.get(a.from)?.push(a),n.get(a.to)?.push(a);const o=new Map(t.map(a=>[a.id,0])),s=new Map(t.map(a=>[a.id,(n.get(a.id)??[]).length])),r=t.filter(a=>(s.get(a.id)??0)===0).map(a=>a.id);for(const a of r)for(const d of i.get(a)??[]){const l=o.get(d.to)??0;o.set(d.to,Math.max(l,(o.get(a)??0)+1));const c=(s.get(d.to)??0)-1;s.set(d.to,c),c===0&&r.push(d.to)}return o},po=(t,e,n,i)=>{const o=[...t.keys()].sort((s,r)=>s-r);for(let s=0;s<i;s++){const r=s%2===0;for(const a of r?o:[...o].reverse()){const d=t.get(a)??[],l=new Map(d.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=d.map(p=>{const u=(e.get(p)??[]).filter(m=>(n.get(m)??a)===a+(r?-1:1)).map(c).filter(m=>m!==null);return{id:p,want:u.length>0?bt(u):l.get(p)??0}});h.sort((p,u)=>p.want-u.want||(l.get(p.id)??0)-(l.get(u.id)??0)),t.set(a,h.map(p=>p.id))}}},ho=(t,e,n,i)=>{const o=t.map((r,a)=>({id:r,want:n.get(r)??a*100,index:a}));o.sort((r,a)=>r.want-a.want||r.index-a.index);let s=0;for(const r of o){const a=e.get(r.id);a&&(a.y=s,s+=a.spec.height+i)}return{height:Math.max(0,s-i)}},Bd=(t,e,n,i,o)=>{const s=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of s)r.set(l,ho(t.get(l)??[],e,new Map,o.nodeSpacing).height);const a=Math.max(0,...r.values());for(const l of s){const c=(a-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const d=(l,c)=>{const h=(n.get(l)??[]).filter(p=>i.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?bt(h):null};for(let l=0;l<o.coordinatePasses;l++){const c=l%2===0;for(const h of c?s:[...s].reverse()){const p=t.get(h)??[],u=new Map;for(const b of p){const k=d(b,h+(c?-1:1)),v=e.get(b);v!==void 0&&u.set(b,k===null?v.y+v.spec.height/2:k)}const m=p.map(b=>e.get(b)?.y??0);ho(p,e,u,o.nodeSpacing);const f=p.map(b=>e.get(b)?.y??0),g=bt(m)-bt(f);for(const b of p){const k=e.get(b);k&&(k.y+=g)}}}},uo=(t,e,n,i,o,s,r)=>{for(const a of o){const d=t.filter(h=>i.get(h)===a);if(d.length===0)continue;const l=d.map((h,p)=>({id:h,want:n.get(h)??p,index:p})).sort((h,p)=>h.want-p.want||h.index-p.index);let c=s.get(a)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},Ud=(t,e,n,i,o)=>{let s=0;for(const r of t.values()){const a=r.filter(l=>n.get(l)===i);if(a.length===0)continue;const d=a.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+o*(a.length-1);d>s&&(s=d)}return s},Hd=(t,e,n,i,o,s,r)=>{const a=new Map(t.map(S=>[S.id,S.group??S.id])),d=new Set(t.flatMap(S=>S.group===void 0?[]:[S.group])),l=t.some(S=>S.superGroup!==void 0),c=new Map;for(const S of t){const w=a.get(S.id)??S.id;S.superGroup!==void 0&&!c.has(w)&&c.set(w,S.superGroup)}const h=S=>c.get(S)??S,p=[...e.keys()].sort((S,w)=>S-w),u=S=>{const w=o.get(S)??0,L=(e.get(w)??[]).length,O=s.get(S)??0;return L<=1?0:O/(L-1)},m=[...new Set(a.values())],f=S=>{const w=t.filter(L=>(a.get(L.id)??L.id)===S).map(L=>L.id);return w.length===0?0:w.reduce((L,O)=>L+u(O),0)/w.length},g=[...new Set(m.map(h))],b=S=>{const w=t.filter(L=>h(a.get(L.id)??L.id)===S).map(L=>L.id);return w.length===0?0:w.reduce((L,O)=>L+u(O),0)/w.length},v=g.sort((S,w)=>b(S)-b(w)).flatMap(S=>m.filter(w=>h(w)===S).sort((w,L)=>f(w)-f(L))),_=new Map(v.map(S=>[S,Ud(e,n,a,S,r.nodeSpacing)])),I=new Map;let R=0;for(const[S,w]of v.entries()){I.set(w,R),R+=_.get(w)??0;const L=v[S+1];if(L!==void 0){const O=l&&h(w)!==h(L);R+=O?r.superGroupSpacing:d.has(w)||d.has(L)?r.groupSpacing:r.nodeSpacing}}for(const S of p){const w=e.get(S)??[];uo(w,n,new Map(w.map(L=>[L,s.get(L)??0])),a,v,I,r.nodeSpacing)}const C=(S,w)=>{const L=(i.get(S)??[]).filter(O=>o.get(O)===w).flatMap(O=>{const P=n.get(O);return P?[P.y+P.spec.height/2]:[]});return L.length>0?bt(L):null};for(let S=0;S<r.coordinatePasses;S++){const w=S%2===0;for(const L of w?p:[...p].reverse()){const O=e.get(L)??[],P=new Map;for(const X of O){const V=C(X,L+(w?-1:1)),q=n.get(X);q!==void 0&&P.set(X,V===null?q.y+q.spec.height/2:V)}uo(O,n,P,a,v,I,r.nodeSpacing)}}},mo=(t,e,n)=>{const i=e===void 0?void 0:t.spec.ports?.[e];return i?{x:t.x+i.x,y:t.y+i.y}:n==="out"?{x:t.x+t.spec.width,y:t.y+t.spec.height/2}:{x:t.x,y:t.y+t.spec.height/2}},Xt=(t,e,n)=>{let i=0;const o=[];for(const s of t){const r=n.byId.get(s.from),a=n.byId.get(s.to);if(!r||!a)continue;const d=mo(r,s.fromPort,"out"),l=mo(a,s.toPort,"in");if(s.from===s.to){const m=r.x+r.spec.width,f=r.y+r.spec.height,g=Math.max(n.padding/2,f+18);o.push({id:s.id,points:[d,{x:m+20,y:d.y},{x:m+20,y:g},{x:r.x-20,y:g},{x:r.x-20,y:l.y},l]});continue}if(!e.has(s.id)&&(r.layer<a.layer||r.layer===a.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){o.push({id:s.id,points:[d,l]});continue}const f=r.layer<a.layer?Math.max(d.x+14,a.x-Math.max(12,n.layerSpacing/2)):(d.x+l.x)/2;o.push({id:s.id,points:[d,{x:f,y:d.y},{x:f,y:l.y},l]});continue}const c=s.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:d,h=s.toPort===void 0?{x:a.x+a.spec.width/2,y:a.y+a.spec.height}:l,p=Math.max(c.y,h.y)+18+i*14;i+=1;const u=[d,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((m,f,g)=>f===0||m.x!==g[f-1]?.x||m.y!==g[f-1]?.y);o.push({id:s.id,points:u})}return o},Bn=(t,e,n)=>{const i=e.flatMap(p=>[...p.points]),o=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...i.map(p=>p.x)],s=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...i.map(p=>p.y)],r=Math.min(0,...o),a=Math.min(0,...s),d=Math.max(0,...o),l=Math.max(0,...s),c=n-r,h=n-a;return{width:d-r+n*2,height:l-a+n*2,nodes:t.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+h,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(u=>({x:u.x+c,y:u.y+h}))}))}},Gt=(t,e)=>{const n=new Map(t.map(i=>[i.id,[]]));for(const i of e)i.from!==i.to&&(n.get(i.from)?.push(i.to),n.get(i.to)?.push(i.from));return n},go=(t,e,n,i)=>t.map(o=>({spec:o,layer:e.get(o.id)??0,order:n.get(o.id)??0,...i(o)})),fo=(t,e)=>{const n=new Map;for(const i of t){const o=e.get(i.id)??0,s=n.get(o);s?s.push(i.id):n.set(o,[i.id])}return n},bo=(t,e,n={})=>{if(t.some(f=>f.superGroup!==void 0))return nl(t,e,n);const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(f=>f.id)),s=e.filter(f=>o.has(f.from)&&o.has(f.to)),{forward:r,reversed:a}=Fn(t,s),d=co(t,r),l=fo(t,d);po(l,Gt(t,s),d,i.sweeps);const c=new Map;for(const f of l.values())f.forEach((g,b)=>c.set(g,b));const h=go(t,d,c,()=>({x:0,y:0})),p=new Map(h.map(f=>[f.spec.id,f]));t.some(f=>f.group!==void 0||f.superGroup!==void 0)?Hd(t,l,p,Gt(t,s),d,c,i):Bd(l,p,Gt(t,s),d,i);const u=[...l.keys()].sort((f,g)=>f-g);let m=0;for(const f of u){const g=Math.max(...(l.get(f)??[]).map(b=>p.get(b)?.spec.width??0));for(const b of l.get(f)??[]){const k=p.get(b);k&&(k.x=m)}m+=g+i.layerSpacing}return Bn(h,Xt(s,a,{byId:p,layerSpacing:i.layerSpacing,padding:i.padding}),i.padding)},Ze=12,xo=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),yo=(t,e)=>{const n=xo(t),i=xo(e),o=i.x-n.x,s=i.y-n.y;return Math.abs(o)>=Math.abs(s)?o>=0?"right":"left":s>=0?"bottom":"top"},ko=(t,e,n)=>Math.min(n,Math.max(e,t)),vo=(t,e,n)=>{const i=ko(n.y-t.y,Ze,Math.max(Ze,t.height-Ze)),o=t.height<=0?.5:i/t.height,s=t.x+ko(o*t.width,Ze,Math.max(Ze,t.width-Ze));switch(e){case"left":return{x:t.x,y:t.y+i};case"right":return{x:t.x+t.width,y:t.y+i};case"top":return{x:s,y:t.y};case"bottom":return{x:s,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+i}}},Yd=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const i=t.map(c=>({id:c.id,width:c.width,height:c.height})),o=new Set(i.map(c=>c.id)),s=e.filter(c=>o.has(c.from)&&o.has(c.to)&&c.from!==c.to),{forward:r}=Fn(i,s),a=co(i,r),d=fo(i,a);return po(d,Gt(i,s),a,n),[...d.keys()].sort((c,h)=>c-h).flatMap(c=>d.get(c)??[])},Xd=(t,e,n,i)=>{let o=0;for(let s=e;s<n;s++)o+=t[s].width;return o+i*Math.max(0,n-e-1)},Un=(t,e,n)=>{const i=t.length,o=Math.max(1,Math.min(n,i)),s=Number.POSITIVE_INFINITY,r=Array.from({length:i+1},()=>Array.from({length:o+1},()=>s)),a=Array.from({length:i+1},()=>Array.from({length:o+1},()=>0));r[0][0]=0;for(let u=1;u<=o;u++)for(let m=u;m<=i;m++)for(let f=u-1;f<m;f++){const g=r[f][u-1];if(g===s)continue;const b=Math.max(g,Xd(t,f,m,e));b<r[m][u]&&(r[m][u]=b,a[m][u]=f)}const d=[];let l=i;for(let u=o;u>0;u--){const m=a[l][u];d.unshift(t.slice(m,l)),l=m}const c=new Map;let h=0,p=0;for(const u of d){let m=0;const f=Math.max(...u.map(g=>g.height));for(const g of u)c.set(g.id,{x:m,y:h}),m+=g.width+e;p=Math.max(p,m-e),h+=f+e}return{positions:c,width:p,height:Math.max(0,h-e)}},Ke=1e-6,Kt=(t,e)=>Math.abs(t.x-e.x)<Ke&&Math.abs(t.y-e.y)<Ke,Wt=(t,e,n)=>{const i=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(i)<Ke?0:i>0?1:-1},jt=(t,e,n)=>Math.min(t.x,n.x)-Ke<=e.x&&e.x<=Math.max(t.x,n.x)+Ke&&Math.min(t.y,n.y)-Ke<=e.y&&e.y<=Math.max(t.y,n.y)+Ke,wo=(t,e)=>{const[n,i]=t,[o,s]=e;if(Kt(n,o)||Kt(n,s)||Kt(i,o)||Kt(i,s))return!1;const r=Wt(n,i,o),a=Wt(n,i,s),d=Wt(o,s,n),l=Wt(o,s,i);return r!==a&&d!==l||r===0&&jt(n,o,i)||a===0&&jt(n,s,i)||d===0&&jt(o,n,s)?!0:l===0&&jt(o,i,s)},$o=(t,e)=>{const n=t.x+t.width/2,i=t.y+t.height/2,o=e.x+e.width/2,s=e.y+e.height/2,r=o-n,a=s-i;return Math.abs(r)>=Math.abs(a)?{x:r>=0?t.x+t.width:t.x,y:i}:{x:n,y:a>=0?t.y+t.height:t.y}},Gd=(t,e,n)=>{const i=r=>{const a=t.positions.get(r),d=e.get(r);return!a||!d?null:{id:r,x:a.x,y:a.y,width:d.width,height:d.height}},o=[];let s=0;for(const r of n){if(r.from===r.to)continue;const a=i(r.from),d=i(r.to);if(!a||!d)continue;const l=$o(a,d),c=$o(d,a);if(l.x===c.x||l.y===c.y){const m=[l,c];s+=o.filter(f=>wo(m,f)).length,o.push(m);continue}const h=[[[l,{x:c.x,y:l.y}],[{x:c.x,y:l.y},c]],[[l,{x:l.x,y:c.y}],[{x:l.x,y:c.y},c]]];let p=h[0],u=Number.POSITIVE_INFINITY;for(const m of h){const f=m.reduce((g,b)=>g+o.filter(k=>wo(b,k)).length,0);f<u&&(u=f,p=m)}s+=u,o.push(...p)}return s},Kd=(t,e,n)=>{const i=s=>{const r=t.positions.get(s),a=e.get(s);return!r||!a?null:{x:r.x+a.width/2,y:r.y+a.height/2}};let o=0;for(const s of n){if(s.from===s.to)continue;const r=i(s.from),a=i(s.to);r&&a&&(o+=Math.hypot(r.x-a.x,r.y-a.y))}return o},Eo=(t,e)=>{const n=t[0].x===t[1].x,i=e[0].x===e[1].x;if(n===i)return!1;const[o,s,r,a]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],d=o.x,l=r.y;return d>Math.min(r.x,a.x)&&d<Math.max(r.x,a.x)&&l>Math.min(o.y,s.y)&&l<Math.max(o.y,s.y)},To=(t,e,n,i)=>{const o=n===void 0?void 0:t.ports?.[n];return o!==void 0?{x:e.x+o.x,y:e.y+o.y}:i==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},Wd=(t,e,n)=>{const i=new Map(t.map(r=>[r.id,r])),o=[];let s=0;for(const r of e){if(r.from===r.to)continue;const a=i.get(r.from),d=i.get(r.to),l=n.get(r.from),c=n.get(r.to);if(a===void 0||d===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:a.width,height:a.height},p={x:c.x,y:c.y,width:d.width,height:d.height},u=vo(h,yo(h,p),To(a,l,r.fromPort,"out")),m=vo(p,yo(p,h),To(d,c,r.toPort,"in")),f=v=>v.slice(1).map((_,I)=>[v[I],_]);if(u.x===m.x||u.y===m.y){const v=[u,m];s+=o.filter(_=>Eo(v,_)).length,o.push(v);continue}const g=[[u,{x:m.x,y:u.y},m],[u,{x:u.x,y:m.y},m]];let b=g[0],k=Number.POSITIVE_INFINITY;for(const v of g){const _=f(v).reduce((I,R)=>I+o.filter(C=>Eo(R,C)).length,0);_<k&&(b=v,k=_)}s+=k,o.push(...f(b))}return s},Vt={crossings:1e4,edgeLength:1,aspectDeviation:50},So=50,jd=Vt.aspectDeviation,Hn=(t,e,n,i,o)=>{const s=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/i));return Gd(t,e,n)*Vt.crossings+Kd(t,e,n)*Vt.edgeLength+s*o},Vd=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const i=Array.from({length:n}).fill(0);let o=0;for(;o<n;)if(i[o]<o){const s=o%2===0?0:i[o],r=e[s];e[s]=e[o],e[o]=r,yield[...e],i[o]=i[o]+1,o=0}else i[o]=0,o++},Qd=7,Zd=400,Jd=1e-6,Yn=(t,e,n,i,o=ft.sweeps,s=0,r=Vt.aspectDeviation,a=Zd)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const I=t[0];return{positions:new Map([[I.id,{x:0,y:0}]]),width:I.width,height:I.height}}const d=new Map(t.map(I=>[I.id,{width:I.width,height:I.height}])),l=e.filter(I=>d.has(I.from)&&d.has(I.to)&&I.from!==I.to),c=I=>{const R=I.map(P=>({id:P,...d.get(P)}));let C=Un(R,n,1),S=Number.POSITIVE_INFINITY,w=1;const L=s>0?Math.min(s,R.length):1,O=s>0?L:R.length;for(let P=L;P<=O;P++){const X=Un(R,n,P);if(X.width<=0||X.height<=0)continue;const V=Hn(X,d,l,i,r);V<S&&(S=V,C=X,w=P)}return{packed:C,cost:S,rowCount:w}},h=(I,R)=>Un(I.map(C=>({id:C,...d.get(C)})),n,R),p=t.map(I=>I.id);if(p.length<=Qd){let I=c(p);for(const R of Vd(p)){const C=c(R);C.cost<I.cost&&(I=C)}return I.packed}const u=s>0?Math.min(a,50):a;let m=Yd(t,l,o);const f=c(m),g=s>0?Math.min(s,m.length):f.rowCount;let b=s>0?h(m,g):f.packed,k=s>0?Hn(b,d,l,i,r):f.cost,v=0,_=!0;for(;_&&v<u;){_=!1;for(let I=0;I<m.length-1&&v<u;I++){v++;const R=[...m],C=R[I];R[I]=R[I+1],R[I+1]=C;const S=h(R,g);if(S.width<=0||S.height<=0)continue;const w=Hn(S,d,l,i,r);w<k-Jd&&(k=w,b=S,m=R,_=!0)}}return b},el=(t,e,n,i,o)=>{if(n<=0&&i<=0||t.positions.size<=1)return t;const s=new Map;for(const[p,u]of t.positions){const m=s.get(u.y);m?m.push(p):s.set(u.y,[p])}const a=[...s.keys()].sort((p,u)=>p-u).map(p=>[...s.get(p)??[]].sort((u,m)=>(t.positions.get(u)?.x??0)-(t.positions.get(m)?.x??0))),d=new Map;let l=0,c=0,h=0;return a.forEach((p,u)=>{const m=a[u-1];if(m!==void 0){const g=p.some(o)||m.some(o);h+=g?n:0}let f=0;p.forEach((g,b)=>{const k=p[b-1];k!==void 0&&(f+=o(k)||o(g)?i:0);const v=t.positions.get(g),_=e.get(g);if(!v||!_)return;const I={x:v.x+f,y:v.y+h};d.set(g,I),l=Math.max(l,I.x+_.width),c=Math.max(c,I.y+_.height)})}),{positions:d,width:l,height:c}},Mo=1.3,tl=1.45,nl=(t,e,n={})=>{const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(w=>w.id)),s=e.filter(w=>o.has(w.from)&&o.has(w.to)),r=w=>w.group??`__loose:${w.id}`,a=w=>w.superGroup??`__top:${w.id}`,d=new Map(t.map(w=>[w.id,r(w)])),l=new Map(t.map(w=>[w.id,a(w)])),c=new Map;for(const w of t){const L=r(w),O=c.get(L);O?O.push(w):c.set(L,[w])}const h=new Map;for(const[w,L]of c){const O=L[0];if(L.length===1&&O!==void 0){h.set(w,{size:{width:O.width,height:O.height},relative:new Map([[O.id,{x:0,y:0}]])});continue}const P=new Set(L.map(q=>q.id)),X=s.filter(q=>P.has(q.from)&&P.has(q.to)),V=Yn(L.map(q=>({id:q.id,width:q.width,height:q.height})),X,i.nodeSpacing,Mo,i.sweeps,0,So);h.set(w,{size:{width:V.width,height:V.height},relative:V.positions})}const p=new Map;for(const[w,L]of c){const O=L[0];O!==void 0&&p.set(w,a(O))}const u=new Map;for(const[w,L]of p){const O=u.get(L);O?O.push(w):u.set(L,[w])}const m=new Map;for(const[w,L]of u){const O=L[0];if(L.length===1&&O!==void 0){const q=h.get(O);q&&m.set(w,{size:q.size,relative:new Map([[O,{x:0,y:0}]])});continue}const P=new Map(L.flatMap(q=>h.has(q)?[[q,h.get(q).size]]:[])),X=s.flatMap(q=>{const oe=d.get(q.from),ee=d.get(q.to);return oe===void 0||ee===void 0||oe===ee?[]:!L.includes(oe)||!L.includes(ee)?[]:[{id:q.id,from:oe,to:ee}]}),V=Yn(L.flatMap(q=>P.has(q)?[{id:q,...P.get(q)}]:[]),X,i.groupSpacing,Mo,i.sweeps,0,So);m.set(w,{size:{width:V.width,height:V.height},relative:V.positions})}const f=new Map([...m].map(([w,L])=>[w,L.size])),g=[...m.keys()],b=new Set(t.flatMap(w=>w.superGroup===void 0?[]:[w.superGroup])),k=w=>{const L=new Map;for(const[O,P]of u){const X=w.get(O)??{x:0,y:0},V=m.get(O);for(const q of P){const oe=V?.relative.get(q)??{x:0,y:0},ee=h.get(q);if(ee)for(const[j,Z]of ee.relative)L.set(j,{x:X.x+oe.x+Z.x,y:X.y+oe.y+Z.y})}}return L};let v=new Map;if(g.length<=1)for(const w of g)v.set(w,{x:0,y:0});else{const w=s.flatMap(j=>{const Z=l.get(j.from),de=l.get(j.to);return Z===void 0||de===void 0||Z===de?[]:[{id:j.id,from:Z,to:de}]}),L=j=>Yn(g.map(Z=>({id:Z,...f.get(Z)})),w,i.superGroupSpacing,tl,i.sweeps,j,jd),O=L(i.superGroupRowCount),P=i.superGroupRowCount>0?[]:[1,2,3,4].filter(j=>j<=g.length),X=[O,...P.map(j=>L(j))],V=j=>{const Z=el(j,f,i.superGroupRowGap,i.superGroupColumnGap,Y=>b.has(Y)),de=Wd(t,s,k(Z.positions)),D=Math.min(1180/Math.max(1,Z.width),900/Math.max(1,Z.height),1);return{offsets:Z.positions,crossings:de,fit:D}},q=X.map(V),oe=q[0];let ee=oe;for(const j of q.slice(1))j.crossings>oe.crossings*.8||j.fit<oe.fit*.9||(j.crossings<ee.crossings||j.crossings===ee.crossings&&j.fit>ee.fit)&&(ee=j);v=new Map(ee.offsets)}const _=k(v),I=Fn(t,s).reversed,R=t.map((w,L)=>{const O=_.get(w.id)??{x:0,y:0};return{spec:w,layer:0,order:L,x:O.x,y:O.y}}),C=new Map(R.map(w=>[w.spec.id,w])),S=Xt(s,I,{byId:C,layerSpacing:i.layerSpacing,padding:i.padding});return Bn(R,S,i.padding)},il=(t,e,n,i,o={})=>{if(e.size===0)return t;const s={...ft,...o},r=new Map(n.map(g=>[g.id,g])),a=t.nodes.map(g=>{const b=e.get(g.id);return b===void 0?g:{...g,x:b.x,y:b.y}}),d=new Map(a.map(g=>[g.id,{spec:r.get(g.id)??{id:g.id,width:g.width,height:g.height},layer:g.layer,order:g.order,x:g.x,y:g.y}])),l=new Set(a.map(g=>g.id)),c=i.filter(g=>l.has(g.from)&&l.has(g.to)),h=Xt(c,new Set,{byId:d,layerSpacing:s.layerSpacing,padding:s.padding}),p=[...a.map(g=>g.x+g.width),...h.flatMap(g=>g.points.map(b=>b.x))],u=[...a.map(g=>g.y+g.height),...h.flatMap(g=>g.points.map(b=>b.y))],m=Math.max(t.width,Math.max(0,...p)+s.padding),f=Math.max(t.height,Math.max(0,...u)+s.padding);return{width:m,height:f,nodes:a,routes:h}},Io=(t,e,n={})=>{const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(d=>d.id)),s=e.filter(d=>o.has(d.from)&&o.has(d.to)),r=go(t,new Map,new Map,d=>d.position??{x:0,y:0}),a=new Map(r.map(d=>[d.spec.id,d]));return Bn(r,Xt(s,new Set,{byId:a,layerSpacing:i.layerSpacing,padding:i.padding}),i.padding)},Co={kind:"idle"},ol=t=>({kind:"node",...t,moved:!1,preview:null}),sl=t=>({kind:"group",...t,moved:!1,preview:null}),rl=(t,e,n,i)=>{if(t.kind==="idle")return t;const o=e.screenX-t.origin.screenX,s=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(o,s)<=i)return t;const r=o/n,a=s/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+a)};return{...t,moved:!0,preview:l}}const d=new Map;for(const[l,c]of t.starts)d.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+a)});return{...t,moved:!0,preview:d}},Lo=le({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:t=>`Comment on ${t}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the data.",nodes:"elements",edges:"relations",change:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:t=>`${t}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`}}),Ro={v:1,overrides:[]},Xn="dpk-layout-change",al=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,_o=(t,e,n)=>({...t,overrides:[...t.overrides.filter(i=>!al(i,e)),{...e,position:n}]}),dl=(t,e)=>e.reduce((n,i)=>_o(n,i,i.position),t),ll=(t,e,n)=>new Map(t.overrides.filter(i=>i.board===e&&i.diagram===n).map(i=>[i.node,i.position])),cl=(t,e,n)=>t.overrides.some(i=>i.board===e&&i.diagram===n),pl=(t,e,n)=>{const i=t.overrides.filter(o=>!(o.board===e&&o.diagram===n));return i.length===t.overrides.length?t:{...t,overrides:i}},hl=(t,e,n,i)=>{const o=t.overrides.filter(s=>!(s.board===e&&s.diagram===n)||i.has(s.node));return o.length===t.overrides.length?t:{...t,overrides:o}},ul=A({x:pe(),y:pe()}),ml=A({board:x(),diagram:x(),node:x(),position:ul}),gl=A({v:ce(1),overrides:F(ml)}),Ao=t=>{const e=Oe(gl,t);return e.success?e.output:null},fl=t=>`dev-process-kit:layout-positions:${t}`,bl=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return fl(t)},xl=()=>Qa(Ao),yl=()=>Va(Ao),kl=t=>t.closest(Za)?.getAttribute(Ja)??"";class vl{#n;#o;#e=null;#t="";#i=Ro;#a=()=>this.#l();constructor(e,n){this.#n=e,this.#o=n,e.addController(this)}hostConnected(){this.#e=this.#o.persist===!1?yl():xl(),this.#t=bl(),this.#i=this.#e.read(this.#t)??Ro,window.addEventListener(Xn,this.#a)}hostDisconnected(){window.removeEventListener(Xn,this.#a)}get#r(){return kl(this.#o.host())}get#s(){return this.#o.diagram()}overrides(){return ll(this.#i,this.#r,this.#s)}hasOverrides(){return cl(this.#i,this.#r,this.#s)}commit(e,n){this.#i=_o(this.#i,{board:this.#r,diagram:this.#s,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([i,o])=>({board:this.#r,diagram:this.#s,node:i,position:o}));this.#i=dl(this.#i,n),this.#d()}prune(e){const n=hl(this.#i,this.#r,this.#s,e);n!==this.#i&&(this.#i=n,this.#d())}reset(){const e=pl(this.#i,this.#r,this.#s);e!==this.#i&&(this.#i=e,this.#d())}#d(){this.#e?.write(this.#t,this.#i),this.#n.requestUpdate(),window.dispatchEvent(new CustomEvent(Xn))}#l(){this.#i=this.#e?.read(this.#t)??this.#i,this.#n.requestUpdate()}}const wl=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,Je=[ed,Gi,Ki,re`
1
+ import{a4 as ja,S as Xi,a5 as le,a6 as Va,a7 as Qa,a8 as Oe,a9 as A,aa as F,ab as ce,ac as x,ad as pe,ae as Za,af as Ja,X as ed,j as Gi,ag as Ki,ah as re,ai as $,aj as U,ak as Wi,al as ji,am as td,an as nd,D as id,ao as od,U as sd,ap as An,aq as rd,ar as Vi,as as y,C as ad,at as dd,au as he,av as z,aw as T,ax as E,ay as M,az as H,aA as Xe,aB as mt,aC as On,aD as ld,aE as Qi,aF as Zi,aG as cd,aH as Te,aI as Ji,B as eo,aJ as pd,G as to,H as Dn,I as qt,aK as hd,aL as G,aM as te,aN as Qe,p as N,t as Se,aO as ue,aP as Nn,aQ as gt,aR as ud,N as Pt,e as zn,P as B,aS as Ft,aT as md,l as fe,aU as qn,aV as gd,aW as fd,aX as no,aY as bd,aZ as io,a_ as Bt,a$ as Me,b0 as xd,b1 as yd,b2 as kd}from"./shared-DdpMqkAH.js";import{Q as vd,A as wd,H as $d,R as Ed,S as Td,T as be,U as Ie,V as oo,W as Sd,X as xe,Y as Md,Z as Pn,_ as so,$ as Id}from"./shared-dnY35u9q.js";import{o as Cd}from"./shared-TrlnHjrJ.js";import{E as Ld,t as Ce,u as Rd,v as Ge,B as Ut,w as Ht,x as _d}from"./shared-df9XN7ns.js";import{a as Ad,c as Od}from"./shared-qk9TB_UM.js";import{o as Yt}from"./shared-EYOAbLSo.js";const Dd=[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2"}]],Nd=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]],zd=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}]],qd=[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1"}]],Pd=[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M5 17A12 12 0 0 1 17 5"}]];function Fd(t,e){let n=0;for(let i=0;i<t.length;i++)n+=e(t[i],i);return n}function ro(t){if(t.length===0)return NaN;const e=t.slice().sort((i,o)=>i-o),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const ao={},lo=t=>{const e={kind:"board",name:t.name,label:t.label,addable:t.addable??!1,parseBase:()=>ao,emptyBase:()=>ao,actions:{},apply:()=>null,hasTarget:()=>!1,describe:o=>({title:o.type,targetLabel:Xi(o.target),tone:"meta"}),serialize:o=>`${o.type} ${Xi(o.target)} ${JSON.stringify(o.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],i=new Map((t.elementActionResults?.()??[]).map(o=>[o.id,o]));return ja(e,n,i)},ft={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},bt=t=>{const e=[...t].sort((i,o)=>i-o);if(e.length===0)return 0;const n=Math.floor(e.length/2);return e.length%2===1?e[n]??0:((e[n-1]??0)+(e[n]??0))/2},Fn=(t,e)=>{const n=new Map;for(const r of t)n.set(r.id,[]);for(const r of e)n.get(r.from)?.push(r);const i=new Map,o=new Set,s=r=>{i.set(r,"open");for(const a of n.get(r)??[]){const d=i.get(a.to)??"new";d==="open"?o.add(a.id):d==="new"&&s(a.to)}i.set(r,"done")};for(const r of t)(i.get(r.id)??"new")==="new"&&s(r.id);return{reversed:o,forward:e.filter(r=>!o.has(r.id))}},co=(t,e)=>{const n=new Map,i=new Map;for(const a of t)n.set(a.id,[]),i.set(a.id,[]);for(const a of e)i.get(a.from)?.push(a),n.get(a.to)?.push(a);const o=new Map(t.map(a=>[a.id,0])),s=new Map(t.map(a=>[a.id,(n.get(a.id)??[]).length])),r=t.filter(a=>(s.get(a.id)??0)===0).map(a=>a.id);for(const a of r)for(const d of i.get(a)??[]){const l=o.get(d.to)??0;o.set(d.to,Math.max(l,(o.get(a)??0)+1));const c=(s.get(d.to)??0)-1;s.set(d.to,c),c===0&&r.push(d.to)}return o},po=(t,e,n,i)=>{const o=[...t.keys()].sort((s,r)=>s-r);for(let s=0;s<i;s++){const r=s%2===0;for(const a of r?o:[...o].reverse()){const d=t.get(a)??[],l=new Map(d.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=d.map(p=>{const u=(e.get(p)??[]).filter(m=>(n.get(m)??a)===a+(r?-1:1)).map(c).filter(m=>m!==null);return{id:p,want:u.length>0?bt(u):l.get(p)??0}});h.sort((p,u)=>p.want-u.want||(l.get(p.id)??0)-(l.get(u.id)??0)),t.set(a,h.map(p=>p.id))}}},ho=(t,e,n,i)=>{const o=t.map((r,a)=>({id:r,want:n.get(r)??a*100,index:a}));o.sort((r,a)=>r.want-a.want||r.index-a.index);let s=0;for(const r of o){const a=e.get(r.id);a&&(a.y=s,s+=a.spec.height+i)}return{height:Math.max(0,s-i)}},Bd=(t,e,n,i,o)=>{const s=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of s)r.set(l,ho(t.get(l)??[],e,new Map,o.nodeSpacing).height);const a=Math.max(0,...r.values());for(const l of s){const c=(a-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const d=(l,c)=>{const h=(n.get(l)??[]).filter(p=>i.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?bt(h):null};for(let l=0;l<o.coordinatePasses;l++){const c=l%2===0;for(const h of c?s:[...s].reverse()){const p=t.get(h)??[],u=new Map;for(const b of p){const k=d(b,h+(c?-1:1)),v=e.get(b);v!==void 0&&u.set(b,k===null?v.y+v.spec.height/2:k)}const m=p.map(b=>e.get(b)?.y??0);ho(p,e,u,o.nodeSpacing);const f=p.map(b=>e.get(b)?.y??0),g=bt(m)-bt(f);for(const b of p){const k=e.get(b);k&&(k.y+=g)}}}},uo=(t,e,n,i,o,s,r)=>{for(const a of o){const d=t.filter(h=>i.get(h)===a);if(d.length===0)continue;const l=d.map((h,p)=>({id:h,want:n.get(h)??p,index:p})).sort((h,p)=>h.want-p.want||h.index-p.index);let c=s.get(a)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},Ud=(t,e,n,i,o)=>{let s=0;for(const r of t.values()){const a=r.filter(l=>n.get(l)===i);if(a.length===0)continue;const d=a.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+o*(a.length-1);d>s&&(s=d)}return s},Hd=(t,e,n,i,o,s,r)=>{const a=new Map(t.map(S=>[S.id,S.group??S.id])),d=new Set(t.flatMap(S=>S.group===void 0?[]:[S.group])),l=t.some(S=>S.superGroup!==void 0),c=new Map;for(const S of t){const w=a.get(S.id)??S.id;S.superGroup!==void 0&&!c.has(w)&&c.set(w,S.superGroup)}const h=S=>c.get(S)??S,p=[...e.keys()].sort((S,w)=>S-w),u=S=>{const w=o.get(S)??0,L=(e.get(w)??[]).length,O=s.get(S)??0;return L<=1?0:O/(L-1)},m=[...new Set(a.values())],f=S=>{const w=t.filter(L=>(a.get(L.id)??L.id)===S).map(L=>L.id);return w.length===0?0:w.reduce((L,O)=>L+u(O),0)/w.length},g=[...new Set(m.map(h))],b=S=>{const w=t.filter(L=>h(a.get(L.id)??L.id)===S).map(L=>L.id);return w.length===0?0:w.reduce((L,O)=>L+u(O),0)/w.length},v=g.sort((S,w)=>b(S)-b(w)).flatMap(S=>m.filter(w=>h(w)===S).sort((w,L)=>f(w)-f(L))),_=new Map(v.map(S=>[S,Ud(e,n,a,S,r.nodeSpacing)])),I=new Map;let R=0;for(const[S,w]of v.entries()){I.set(w,R),R+=_.get(w)??0;const L=v[S+1];if(L!==void 0){const O=l&&h(w)!==h(L);R+=O?r.superGroupSpacing:d.has(w)||d.has(L)?r.groupSpacing:r.nodeSpacing}}for(const S of p){const w=e.get(S)??[];uo(w,n,new Map(w.map(L=>[L,s.get(L)??0])),a,v,I,r.nodeSpacing)}const C=(S,w)=>{const L=(i.get(S)??[]).filter(O=>o.get(O)===w).flatMap(O=>{const P=n.get(O);return P?[P.y+P.spec.height/2]:[]});return L.length>0?bt(L):null};for(let S=0;S<r.coordinatePasses;S++){const w=S%2===0;for(const L of w?p:[...p].reverse()){const O=e.get(L)??[],P=new Map;for(const X of O){const V=C(X,L+(w?-1:1)),q=n.get(X);q!==void 0&&P.set(X,V===null?q.y+q.spec.height/2:V)}uo(O,n,P,a,v,I,r.nodeSpacing)}}},mo=(t,e,n)=>{const i=e===void 0?void 0:t.spec.ports?.[e];return i?{x:t.x+i.x,y:t.y+i.y}:n==="out"?{x:t.x+t.spec.width,y:t.y+t.spec.height/2}:{x:t.x,y:t.y+t.spec.height/2}},Xt=(t,e,n)=>{let i=0;const o=[];for(const s of t){const r=n.byId.get(s.from),a=n.byId.get(s.to);if(!r||!a)continue;const d=mo(r,s.fromPort,"out"),l=mo(a,s.toPort,"in");if(s.from===s.to){const m=r.x+r.spec.width,f=r.y+r.spec.height,g=Math.max(n.padding/2,f+18);o.push({id:s.id,points:[d,{x:m+20,y:d.y},{x:m+20,y:g},{x:r.x-20,y:g},{x:r.x-20,y:l.y},l]});continue}if(!e.has(s.id)&&(r.layer<a.layer||r.layer===a.layer&&l.x>d.x+12)){if(Math.abs(d.y-l.y)<.5){o.push({id:s.id,points:[d,l]});continue}const f=r.layer<a.layer?Math.max(d.x+14,a.x-Math.max(12,n.layerSpacing/2)):(d.x+l.x)/2;o.push({id:s.id,points:[d,{x:f,y:d.y},{x:f,y:l.y},l]});continue}const c=s.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:d,h=s.toPort===void 0?{x:a.x+a.spec.width/2,y:a.y+a.spec.height}:l,p=Math.max(c.y,h.y)+18+i*14;i+=1;const u=[d,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((m,f,g)=>f===0||m.x!==g[f-1]?.x||m.y!==g[f-1]?.y);o.push({id:s.id,points:u})}return o},Bn=(t,e,n)=>{const i=e.flatMap(p=>[...p.points]),o=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...i.map(p=>p.x)],s=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...i.map(p=>p.y)],r=Math.min(0,...o),a=Math.min(0,...s),d=Math.max(0,...o),l=Math.max(0,...s),c=n-r,h=n-a;return{width:d-r+n*2,height:l-a+n*2,nodes:t.map(p=>({id:p.spec.id,x:p.x+c,y:p.y+h,width:p.spec.width,height:p.spec.height,layer:p.layer,order:p.order})),routes:e.map(p=>({id:p.id,points:p.points.map(u=>({x:u.x+c,y:u.y+h}))}))}},Gt=(t,e)=>{const n=new Map(t.map(i=>[i.id,[]]));for(const i of e)i.from!==i.to&&(n.get(i.from)?.push(i.to),n.get(i.to)?.push(i.from));return n},go=(t,e,n,i)=>t.map(o=>({spec:o,layer:e.get(o.id)??0,order:n.get(o.id)??0,...i(o)})),fo=(t,e)=>{const n=new Map;for(const i of t){const o=e.get(i.id)??0,s=n.get(o);s?s.push(i.id):n.set(o,[i.id])}return n},bo=(t,e,n={})=>{if(t.some(f=>f.superGroup!==void 0))return nl(t,e,n);const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(f=>f.id)),s=e.filter(f=>o.has(f.from)&&o.has(f.to)),{forward:r,reversed:a}=Fn(t,s),d=co(t,r),l=fo(t,d);po(l,Gt(t,s),d,i.sweeps);const c=new Map;for(const f of l.values())f.forEach((g,b)=>c.set(g,b));const h=go(t,d,c,()=>({x:0,y:0})),p=new Map(h.map(f=>[f.spec.id,f]));t.some(f=>f.group!==void 0||f.superGroup!==void 0)?Hd(t,l,p,Gt(t,s),d,c,i):Bd(l,p,Gt(t,s),d,i);const u=[...l.keys()].sort((f,g)=>f-g);let m=0;for(const f of u){const g=Math.max(...(l.get(f)??[]).map(b=>p.get(b)?.spec.width??0));for(const b of l.get(f)??[]){const k=p.get(b);k&&(k.x=m)}m+=g+i.layerSpacing}return Bn(h,Xt(s,a,{byId:p,layerSpacing:i.layerSpacing,padding:i.padding}),i.padding)},Ze=12,xo=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),yo=(t,e)=>{const n=xo(t),i=xo(e),o=i.x-n.x,s=i.y-n.y;return Math.abs(o)>=Math.abs(s)?o>=0?"right":"left":s>=0?"bottom":"top"},ko=(t,e,n)=>Math.min(n,Math.max(e,t)),vo=(t,e,n)=>{const i=ko(n.y-t.y,Ze,Math.max(Ze,t.height-Ze)),o=t.height<=0?.5:i/t.height,s=t.x+ko(o*t.width,Ze,Math.max(Ze,t.width-Ze));switch(e){case"left":return{x:t.x,y:t.y+i};case"right":return{x:t.x+t.width,y:t.y+i};case"top":return{x:s,y:t.y};case"bottom":return{x:s,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+i}}},Yd=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const i=t.map(c=>({id:c.id,width:c.width,height:c.height})),o=new Set(i.map(c=>c.id)),s=e.filter(c=>o.has(c.from)&&o.has(c.to)&&c.from!==c.to),{forward:r}=Fn(i,s),a=co(i,r),d=fo(i,a);return po(d,Gt(i,s),a,n),[...d.keys()].sort((c,h)=>c-h).flatMap(c=>d.get(c)??[])},Xd=(t,e,n,i)=>{let o=0;for(let s=e;s<n;s++)o+=t[s].width;return o+i*Math.max(0,n-e-1)},Un=(t,e,n)=>{const i=t.length,o=Math.max(1,Math.min(n,i)),s=Number.POSITIVE_INFINITY,r=Array.from({length:i+1},()=>Array.from({length:o+1},()=>s)),a=Array.from({length:i+1},()=>Array.from({length:o+1},()=>0));r[0][0]=0;for(let u=1;u<=o;u++)for(let m=u;m<=i;m++)for(let f=u-1;f<m;f++){const g=r[f][u-1];if(g===s)continue;const b=Math.max(g,Xd(t,f,m,e));b<r[m][u]&&(r[m][u]=b,a[m][u]=f)}const d=[];let l=i;for(let u=o;u>0;u--){const m=a[l][u];d.unshift(t.slice(m,l)),l=m}const c=new Map;let h=0,p=0;for(const u of d){let m=0;const f=Math.max(...u.map(g=>g.height));for(const g of u)c.set(g.id,{x:m,y:h}),m+=g.width+e;p=Math.max(p,m-e),h+=f+e}return{positions:c,width:p,height:Math.max(0,h-e)}},Ke=1e-6,Kt=(t,e)=>Math.abs(t.x-e.x)<Ke&&Math.abs(t.y-e.y)<Ke,Wt=(t,e,n)=>{const i=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(i)<Ke?0:i>0?1:-1},jt=(t,e,n)=>Math.min(t.x,n.x)-Ke<=e.x&&e.x<=Math.max(t.x,n.x)+Ke&&Math.min(t.y,n.y)-Ke<=e.y&&e.y<=Math.max(t.y,n.y)+Ke,wo=(t,e)=>{const[n,i]=t,[o,s]=e;if(Kt(n,o)||Kt(n,s)||Kt(i,o)||Kt(i,s))return!1;const r=Wt(n,i,o),a=Wt(n,i,s),d=Wt(o,s,n),l=Wt(o,s,i);return r!==a&&d!==l||r===0&&jt(n,o,i)||a===0&&jt(n,s,i)||d===0&&jt(o,n,s)?!0:l===0&&jt(o,i,s)},$o=(t,e)=>{const n=t.x+t.width/2,i=t.y+t.height/2,o=e.x+e.width/2,s=e.y+e.height/2,r=o-n,a=s-i;return Math.abs(r)>=Math.abs(a)?{x:r>=0?t.x+t.width:t.x,y:i}:{x:n,y:a>=0?t.y+t.height:t.y}},Gd=(t,e,n)=>{const i=r=>{const a=t.positions.get(r),d=e.get(r);return!a||!d?null:{id:r,x:a.x,y:a.y,width:d.width,height:d.height}},o=[];let s=0;for(const r of n){if(r.from===r.to)continue;const a=i(r.from),d=i(r.to);if(!a||!d)continue;const l=$o(a,d),c=$o(d,a);if(l.x===c.x||l.y===c.y){const m=[l,c];s+=o.filter(f=>wo(m,f)).length,o.push(m);continue}const h=[[[l,{x:c.x,y:l.y}],[{x:c.x,y:l.y},c]],[[l,{x:l.x,y:c.y}],[{x:l.x,y:c.y},c]]];let p=h[0],u=Number.POSITIVE_INFINITY;for(const m of h){const f=m.reduce((g,b)=>g+o.filter(k=>wo(b,k)).length,0);f<u&&(u=f,p=m)}s+=u,o.push(...p)}return s},Kd=(t,e,n)=>{const i=s=>{const r=t.positions.get(s),a=e.get(s);return!r||!a?null:{x:r.x+a.width/2,y:r.y+a.height/2}};let o=0;for(const s of n){if(s.from===s.to)continue;const r=i(s.from),a=i(s.to);r&&a&&(o+=Math.hypot(r.x-a.x,r.y-a.y))}return o},Eo=(t,e)=>{const n=t[0].x===t[1].x,i=e[0].x===e[1].x;if(n===i)return!1;const[o,s,r,a]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],d=o.x,l=r.y;return d>Math.min(r.x,a.x)&&d<Math.max(r.x,a.x)&&l>Math.min(o.y,s.y)&&l<Math.max(o.y,s.y)},To=(t,e,n,i)=>{const o=n===void 0?void 0:t.ports?.[n];return o!==void 0?{x:e.x+o.x,y:e.y+o.y}:i==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},Wd=(t,e,n)=>{const i=new Map(t.map(r=>[r.id,r])),o=[];let s=0;for(const r of e){if(r.from===r.to)continue;const a=i.get(r.from),d=i.get(r.to),l=n.get(r.from),c=n.get(r.to);if(a===void 0||d===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:a.width,height:a.height},p={x:c.x,y:c.y,width:d.width,height:d.height},u=vo(h,yo(h,p),To(a,l,r.fromPort,"out")),m=vo(p,yo(p,h),To(d,c,r.toPort,"in")),f=v=>v.slice(1).map((_,I)=>[v[I],_]);if(u.x===m.x||u.y===m.y){const v=[u,m];s+=o.filter(_=>Eo(v,_)).length,o.push(v);continue}const g=[[u,{x:m.x,y:u.y},m],[u,{x:u.x,y:m.y},m]];let b=g[0],k=Number.POSITIVE_INFINITY;for(const v of g){const _=f(v).reduce((I,R)=>I+o.filter(C=>Eo(R,C)).length,0);_<k&&(b=v,k=_)}s+=k,o.push(...f(b))}return s},Vt={crossings:1e4,edgeLength:1,aspectDeviation:50},So=50,jd=Vt.aspectDeviation,Hn=(t,e,n,i,o)=>{const s=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/i));return Gd(t,e,n)*Vt.crossings+Kd(t,e,n)*Vt.edgeLength+s*o},Vd=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const i=Array.from({length:n}).fill(0);let o=0;for(;o<n;)if(i[o]<o){const s=o%2===0?0:i[o],r=e[s];e[s]=e[o],e[o]=r,yield[...e],i[o]=i[o]+1,o=0}else i[o]=0,o++},Qd=7,Zd=400,Jd=1e-6,Yn=(t,e,n,i,o=ft.sweeps,s=0,r=Vt.aspectDeviation,a=Zd)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const I=t[0];return{positions:new Map([[I.id,{x:0,y:0}]]),width:I.width,height:I.height}}const d=new Map(t.map(I=>[I.id,{width:I.width,height:I.height}])),l=e.filter(I=>d.has(I.from)&&d.has(I.to)&&I.from!==I.to),c=I=>{const R=I.map(P=>({id:P,...d.get(P)}));let C=Un(R,n,1),S=Number.POSITIVE_INFINITY,w=1;const L=s>0?Math.min(s,R.length):1,O=s>0?L:R.length;for(let P=L;P<=O;P++){const X=Un(R,n,P);if(X.width<=0||X.height<=0)continue;const V=Hn(X,d,l,i,r);V<S&&(S=V,C=X,w=P)}return{packed:C,cost:S,rowCount:w}},h=(I,R)=>Un(I.map(C=>({id:C,...d.get(C)})),n,R),p=t.map(I=>I.id);if(p.length<=Qd){let I=c(p);for(const R of Vd(p)){const C=c(R);C.cost<I.cost&&(I=C)}return I.packed}const u=s>0?Math.min(a,50):a;let m=Yd(t,l,o);const f=c(m),g=s>0?Math.min(s,m.length):f.rowCount;let b=s>0?h(m,g):f.packed,k=s>0?Hn(b,d,l,i,r):f.cost,v=0,_=!0;for(;_&&v<u;){_=!1;for(let I=0;I<m.length-1&&v<u;I++){v++;const R=[...m],C=R[I];R[I]=R[I+1],R[I+1]=C;const S=h(R,g);if(S.width<=0||S.height<=0)continue;const w=Hn(S,d,l,i,r);w<k-Jd&&(k=w,b=S,m=R,_=!0)}}return b},el=(t,e,n,i,o)=>{if(n<=0&&i<=0||t.positions.size<=1)return t;const s=new Map;for(const[p,u]of t.positions){const m=s.get(u.y);m?m.push(p):s.set(u.y,[p])}const a=[...s.keys()].sort((p,u)=>p-u).map(p=>[...s.get(p)??[]].sort((u,m)=>(t.positions.get(u)?.x??0)-(t.positions.get(m)?.x??0))),d=new Map;let l=0,c=0,h=0;return a.forEach((p,u)=>{const m=a[u-1];if(m!==void 0){const g=p.some(o)||m.some(o);h+=g?n:0}let f=0;p.forEach((g,b)=>{const k=p[b-1];k!==void 0&&(f+=o(k)||o(g)?i:0);const v=t.positions.get(g),_=e.get(g);if(!v||!_)return;const I={x:v.x+f,y:v.y+h};d.set(g,I),l=Math.max(l,I.x+_.width),c=Math.max(c,I.y+_.height)})}),{positions:d,width:l,height:c}},Mo=1.3,tl=1.45,nl=(t,e,n={})=>{const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(w=>w.id)),s=e.filter(w=>o.has(w.from)&&o.has(w.to)),r=w=>w.group??`__loose:${w.id}`,a=w=>w.superGroup??`__top:${w.id}`,d=new Map(t.map(w=>[w.id,r(w)])),l=new Map(t.map(w=>[w.id,a(w)])),c=new Map;for(const w of t){const L=r(w),O=c.get(L);O?O.push(w):c.set(L,[w])}const h=new Map;for(const[w,L]of c){const O=L[0];if(L.length===1&&O!==void 0){h.set(w,{size:{width:O.width,height:O.height},relative:new Map([[O.id,{x:0,y:0}]])});continue}const P=new Set(L.map(q=>q.id)),X=s.filter(q=>P.has(q.from)&&P.has(q.to)),V=Yn(L.map(q=>({id:q.id,width:q.width,height:q.height})),X,i.nodeSpacing,Mo,i.sweeps,0,So);h.set(w,{size:{width:V.width,height:V.height},relative:V.positions})}const p=new Map;for(const[w,L]of c){const O=L[0];O!==void 0&&p.set(w,a(O))}const u=new Map;for(const[w,L]of p){const O=u.get(L);O?O.push(w):u.set(L,[w])}const m=new Map;for(const[w,L]of u){const O=L[0];if(L.length===1&&O!==void 0){const q=h.get(O);q&&m.set(w,{size:q.size,relative:new Map([[O,{x:0,y:0}]])});continue}const P=new Map(L.flatMap(q=>h.has(q)?[[q,h.get(q).size]]:[])),X=s.flatMap(q=>{const oe=d.get(q.from),ee=d.get(q.to);return oe===void 0||ee===void 0||oe===ee?[]:!L.includes(oe)||!L.includes(ee)?[]:[{id:q.id,from:oe,to:ee}]}),V=Yn(L.flatMap(q=>P.has(q)?[{id:q,...P.get(q)}]:[]),X,i.groupSpacing,Mo,i.sweeps,0,So);m.set(w,{size:{width:V.width,height:V.height},relative:V.positions})}const f=new Map([...m].map(([w,L])=>[w,L.size])),g=[...m.keys()],b=new Set(t.flatMap(w=>w.superGroup===void 0?[]:[w.superGroup])),k=w=>{const L=new Map;for(const[O,P]of u){const X=w.get(O)??{x:0,y:0},V=m.get(O);for(const q of P){const oe=V?.relative.get(q)??{x:0,y:0},ee=h.get(q);if(ee)for(const[j,Z]of ee.relative)L.set(j,{x:X.x+oe.x+Z.x,y:X.y+oe.y+Z.y})}}return L};let v=new Map;if(g.length<=1)for(const w of g)v.set(w,{x:0,y:0});else{const w=s.flatMap(j=>{const Z=l.get(j.from),de=l.get(j.to);return Z===void 0||de===void 0||Z===de?[]:[{id:j.id,from:Z,to:de}]}),L=j=>Yn(g.map(Z=>({id:Z,...f.get(Z)})),w,i.superGroupSpacing,tl,i.sweeps,j,jd),O=L(i.superGroupRowCount),P=i.superGroupRowCount>0?[]:[1,2,3,4].filter(j=>j<=g.length),X=[O,...P.map(j=>L(j))],V=j=>{const Z=el(j,f,i.superGroupRowGap,i.superGroupColumnGap,Y=>b.has(Y)),de=Wd(t,s,k(Z.positions)),D=Math.min(1180/Math.max(1,Z.width),900/Math.max(1,Z.height),1);return{offsets:Z.positions,crossings:de,fit:D}},q=X.map(V),oe=q[0];let ee=oe;for(const j of q.slice(1))j.crossings>oe.crossings*.8||j.fit<oe.fit*.9||(j.crossings<ee.crossings||j.crossings===ee.crossings&&j.fit>ee.fit)&&(ee=j);v=new Map(ee.offsets)}const _=k(v),I=Fn(t,s).reversed,R=t.map((w,L)=>{const O=_.get(w.id)??{x:0,y:0};return{spec:w,layer:0,order:L,x:O.x,y:O.y}}),C=new Map(R.map(w=>[w.spec.id,w])),S=Xt(s,I,{byId:C,layerSpacing:i.layerSpacing,padding:i.padding});return Bn(R,S,i.padding)},il=(t,e,n,i,o={})=>{if(e.size===0)return t;const s={...ft,...o},r=new Map(n.map(g=>[g.id,g])),a=t.nodes.map(g=>{const b=e.get(g.id);return b===void 0?g:{...g,x:b.x,y:b.y}}),d=new Map(a.map(g=>[g.id,{spec:r.get(g.id)??{id:g.id,width:g.width,height:g.height},layer:g.layer,order:g.order,x:g.x,y:g.y}])),l=new Set(a.map(g=>g.id)),c=i.filter(g=>l.has(g.from)&&l.has(g.to)),h=Xt(c,new Set,{byId:d,layerSpacing:s.layerSpacing,padding:s.padding}),p=[...a.map(g=>g.x+g.width),...h.flatMap(g=>g.points.map(b=>b.x))],u=[...a.map(g=>g.y+g.height),...h.flatMap(g=>g.points.map(b=>b.y))],m=Math.max(t.width,Math.max(0,...p)+s.padding),f=Math.max(t.height,Math.max(0,...u)+s.padding);return{width:m,height:f,nodes:a,routes:h}},Io=(t,e,n={})=>{const i={...ft,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const o=new Set(t.map(d=>d.id)),s=e.filter(d=>o.has(d.from)&&o.has(d.to)),r=go(t,new Map,new Map,d=>d.position??{x:0,y:0}),a=new Map(r.map(d=>[d.spec.id,d]));return Bn(r,Xt(s,new Set,{byId:a,layerSpacing:i.layerSpacing,padding:i.padding}),i.padding)},Co={kind:"idle"},ol=t=>({kind:"node",...t,moved:!1,preview:null}),sl=t=>({kind:"group",...t,moved:!1,preview:null}),rl=(t,e,n,i)=>{if(t.kind==="idle")return t;const o=e.screenX-t.origin.screenX,s=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(o,s)<=i)return t;const r=o/n,a=s/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+a)};return{...t,moved:!0,preview:l}}const d=new Map;for(const[l,c]of t.starts)d.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+a)});return{...t,moved:!0,preview:d}},Lo=le({en:{tagFilter:"Filter by tag",tagMatch:"Tag matching",clearTags:"Clear",zoomOut:"Zoom out",fit:"Fit to view",zoomIn:"Zoom in",sendFailed:"Could not send. Please try again.",commentOn:t=>`Comment on ${t}`,noMatches:"No matching elements.",maximize:"Maximize",restore:"Restore size",canvas:"Diagram. Arrow keys pan, plus and minus zoom, 0 fits the view.",dataError:"Could not load the data.",nodes:"elements",edges:"relations",change:(t,e)=>`\u201C${t}\u201D \u2192 \u201C${e}\u201D`},ja:{tagFilter:"\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F",tagMatch:"\u30BF\u30B0\u306E\u4E00\u81F4\u6761\u4EF6",clearTags:"\u89E3\u9664",zoomOut:"\u7E2E\u5C0F",fit:"\u5168\u4F53\u3092\u8868\u793A",zoomIn:"\u62E1\u5927",sendFailed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",commentOn:t=>`${t}\u306B\u30B3\u30E1\u30F3\u30C8`,noMatches:"\u8A72\u5F53\u3059\u308B\u8981\u7D20\u306F\u3042\u308A\u307E\u305B\u3093\u3002",maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",canvas:"\u56F3\u3002\u77E2\u5370\u30AD\u30FC\u3067\u30D1\u30F3\u3001\u30D7\u30E9\u30B9\u30FB\u30DE\u30A4\u30CA\u30B9\u3067\u30BA\u30FC\u30E0\u30010\u3067\u5168\u4F53\u8868\u793A\u3002",dataError:"\u30C7\u30FC\u30BF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",nodes:"\u8981\u7D20",edges:"\u95A2\u9023",change:(t,e)=>`\u300C${t}\u300D\u2192\u300C${e}\u300D`}}),Ro={v:1,overrides:[]},Xn="dpk-layout-change",al=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,_o=(t,e,n)=>({...t,overrides:[...t.overrides.filter(i=>!al(i,e)),{...e,position:n}]}),dl=(t,e)=>e.reduce((n,i)=>_o(n,i,i.position),t),ll=(t,e,n)=>new Map(t.overrides.filter(i=>i.board===e&&i.diagram===n).map(i=>[i.node,i.position])),cl=(t,e,n)=>t.overrides.some(i=>i.board===e&&i.diagram===n),pl=(t,e,n)=>{const i=t.overrides.filter(o=>!(o.board===e&&o.diagram===n));return i.length===t.overrides.length?t:{...t,overrides:i}},hl=(t,e,n,i)=>{const o=t.overrides.filter(s=>!(s.board===e&&s.diagram===n)||i.has(s.node));return o.length===t.overrides.length?t:{...t,overrides:o}},ul=A({x:pe(),y:pe()}),ml=A({board:x(),diagram:x(),node:x(),position:ul}),gl=A({v:ce(1),overrides:F(ml)}),Ao=t=>{const e=Oe(gl,t);return e.success?e.output:null},fl=t=>`dev-process-kit:layout-positions:${t}`,bl=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return fl(t)},xl=()=>Qa(Ao),yl=()=>Va(Ao),kl=t=>t.closest(Za)?.getAttribute(Ja)??"";class vl{#n;#o;#e=null;#t="";#i=Ro;#a=()=>this.#l();constructor(e,n){this.#n=e,this.#o=n,e.addController(this)}hostConnected(){this.#e=this.#o.persist===!1?yl():xl(),this.#t=bl(),this.#i=this.#e.read(this.#t)??Ro,window.addEventListener(Xn,this.#a)}hostDisconnected(){window.removeEventListener(Xn,this.#a)}get#r(){return kl(this.#o.host())}get#s(){return this.#o.diagram()}overrides(){return ll(this.#i,this.#r,this.#s)}hasOverrides(){return cl(this.#i,this.#r,this.#s)}commit(e,n){this.#i=_o(this.#i,{board:this.#r,diagram:this.#s,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([i,o])=>({board:this.#r,diagram:this.#s,node:i,position:o}));this.#i=dl(this.#i,n),this.#d()}prune(e){const n=hl(this.#i,this.#r,this.#s,e);n!==this.#i&&(this.#i=n,this.#d())}reset(){const e=pl(this.#i,this.#r,this.#s);e!==this.#i&&(this.#i=e,this.#d())}#d(){this.#e?.write(this.#t,this.#i),this.#n.requestUpdate(),window.dispatchEvent(new CustomEvent(Xn))}#l(){this.#i=this.#e?.read(this.#t)??this.#i,this.#n.requestUpdate()}}const wl=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,Je=[ed,Gi,Ki,re`
2
2
  :host {
3
3
  display: block;
4
4
  container-type: inline-size;
@@ -368,7 +368,7 @@ import{a4 as ja,S as Xi,a5 as le,a6 as Va,a7 as Qa,a8 as Oe,a9 as A,aa as F,ab a
368
368
  </marker>
369
369
  `)}
370
370
  </defs>
371
- `,Do={fromAttribute:t=>t==="board"?"board":"embedded",toAttribute:t=>t},Gn=t=>typeof t=="object"&&t!==null;class et extends Wi{static{this.styles=Je}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String},variant:{type:String,reflect:!0,converter:Do}}}#n=null;#o=null;#e=[];#t=[];#i=null;#a=Ld;#r=null;#s=null;#d="";#l=new vd(this);#p=new ji(this,()=>{this.#d=""});#u=null;#h=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null,this.variant=Do.fromAttribute(this.getAttribute("variant"))}connectedCallback(){wd(),$d(),super.connectedCallback(),this.#d="",this.requestUpdate(),this.#s=Cd(this,e=>this.parseData(e),e=>{e.ok?this.#y(e.value):this.#$(e.error)}),this.board!==null&&this.#g()}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#y(this.data)}updated(){this.#c(),this.#l.sync(this.renderRoot.querySelector(".comment-pop"))}#c(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#d&&(this.#d=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}get commentTargets(){if(!this.id||this.#i!==null)return[];const e=`${this.subject??this.heading??this.defaultHeading()} \xB7 ${this.id}`;return this.commentItems().map(n=>({...n,group:e}))}commentItems(){return[]}#m(){return this.id!==""?this.id:this.board??this.tagName.toLowerCase()}commentRef(e,...n){return`element:${[this.#m(),e,...n].map(i=>encodeURIComponent(i)).join("/")}`}get elementActions(){return this.#e}set elementActions(e){this.#e=e,this.#w()}get elementActionResults(){return this.#t}get board(){return td(this)}boardName(){const e=this.tagName.toLowerCase();return e.startsWith("dpk-board-")?e.slice(10):e}boardLabel(){return this.heading??this.defaultHeading()}get definition(){return lo({name:this.boardName(),label:this.boardLabel(),commentTargets:()=>this.commentTargets,elementActionResults:()=>this.elementActionResults})}get controller(){return this.#g()}get api(){return this.#h??=nd(this.#x(),this),this.#h}#g(){if(this.#u)return this.#u;const e=this.board!==null,n=lo({name:this.boardName(),label:this.boardLabel()}),i=new id(e?{definition:n,base:{},storage:null}:{definition:n,base:{}});return this.#u=i,e&&(this.dataset.template=n.name),i.subscribe(()=>this.#f()),this.#f(),i}#f(){const e=this.#u;if(!e)return;const n=this.#m();this.elementActions=od(e.actions,n),e.setComponentSnapshot({targets:this.commentTargets,providers:[{id:n,results:this.elementActionResults}]})}#x(){const e=()=>this.#g(),n={definition:this.definition,controller:e,derivation:()=>e().derivation,ready:Promise.resolve(),navigation:()=>({}),issues:()=>e().lastIssues,dispatch:i=>this.#v(i),dispatchBatch:i=>this.#k(i),subscribe:i=>e().subscribe(()=>i(dd(n))),editComment:(i,o)=>e().editComment(i,o),removeAction:i=>e().removeAction(i),clearActions:()=>e().clearActions(),navigate:()=>{},hashFor:()=>"",requestComment:()=>{}};return n}#M(e){const i=this.#g().descriptorFor(e.type)?.targetType??"element",o=sd(e.target,i),s=this.board;if(s===null)return{...e,target:o};const r=An(this)?.pageNames()??new Set;return{...e,target:rd(o,s,r)}}#v(e){const n=this.board!==null?An(this):null;return n===null?this.#g().dispatch(e):n.dispatch(this.#M(e))}#k(e){const n=this.board!==null?An(this):null;return n===null?this.#g().dispatchBatch(e):n.dispatchBatch(e.map(i=>this.#M(i)))}reduceElementActions(e,n){return{data:e,results:n.map(i=>({id:i.id,title:i.type,stale:"unsupported-action-type"}))}}dispatchElementAction(e,n,i){const o=this.commentRef(...n);if(this.board!==null)return this.#v({type:e,target:o,payload:i}).ok;const s=new CustomEvent("dpk-element-action",{detail:{type:e,target:o,payload:i},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(s),s.defaultPrevented}get selection(){return this.#r}select(e){this.#L(e)}get tagFilter(){return this.#a}set tagFilter(e){this.#a=e,this.requestUpdate()}get dataError(){return this.#i}closeComposer(){this.#l.close()}get locale(){return this.#p.locale}get chromeMessages(){return Lo(this.#p.locale)}renderSelection(){return this.#l.render({locale:this.#p.locale,errorMessage:this.chromeMessages.sendFailed,submit:(e,n)=>this.#T(e,n)})}getContextMenuItems(e){const n=Ed(e.target,this.commentTargets,Vi(this.locale),(i,o)=>this.#C(i,o));return n===null?null:[n]}#C(e,n){const i=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(e)}"]`);i!==null&&this.#l.open(e,i,n)}questionsOf(e){const n=e.questions?.trim();return n===void 0||n===""?$:n}statsText(){return""}tagItems(){return[]}isEmpty(){return!1}shellClass(){return""}get frameControls(){return this.board===null}defaultHeading(){return""}defaultSubject(){return""}emptyMessage(){return this.chromeMessages.noMatches}renderToolbarActions(){return $}items(){return this.#o??this.emptyData()}authoredItems(){return this.#n??this.emptyData()}renderToolbarActionsSlot(){return y`<div slot="actions" class="diagram-toolbar-actions">
371
+ `,Do={fromAttribute:t=>t==="board"?"board":"embedded",toAttribute:t=>t},Gn=t=>typeof t=="object"&&t!==null;class et extends Wi{static{this.styles=Je}static{this.properties={data:{attribute:!1},id:{type:String,reflect:!0},heading:{type:String},subject:{type:String},variant:{type:String,reflect:!0,converter:Do}}}#n=null;#o=null;#e=[];#t=[];#i=null;#a=Ld;#r=null;#s=null;#d="";#l=new vd(this);#p=new ji(this,()=>{this.#d=""});#u=null;#h=null;constructor(){super(),this.id=this.getAttribute("id")??"",this.data=null,this.heading=null,this.subject=null,this.variant=Do.fromAttribute(this.getAttribute("variant"))}connectedCallback(){wd(),$d(),super.connectedCallback(),this.#d="",this.requestUpdate(),this.#s=Cd(this,e=>this.parseData(e),e=>{e.ok?this.#y(e.value):this.#$(e.error)}),this.board!==null&&this.#g()}disconnectedCallback(){super.disconnectedCallback(),this.#s?.(),this.#s=null}willUpdate(e){e.has("data")&&this.data!==null&&this.#y(this.data)}updated(){this.#c(),this.#l.sync(this.renderRoot.querySelector(".comment-pop"))}#c(){const e=JSON.stringify([this.commentTargets,this.#t]);e!==this.#d&&(this.#d=e,this.dispatchEvent(new CustomEvent("dpk-comment-targets-change",{bubbles:!0,composed:!0})))}get commentTargets(){if(!this.id||this.#i!==null)return[];const e=`${this.subject??this.heading??this.defaultHeading()} \xB7 ${this.id}`;return this.commentItems().map(n=>({...n,group:e}))}commentItems(){return[]}#m(){return this.id!==""?this.id:this.board??this.tagName.toLowerCase()}commentRef(e,...n){return`element:${[this.#m(),e,...n].map(i=>encodeURIComponent(i)).join("/")}`}get elementActions(){return this.#e}set elementActions(e){this.#e=e,this.#w()}get elementActionResults(){return this.#t}get board(){return td(this)}boardName(){const e=this.tagName.toLowerCase();return e.startsWith("dpk-board-")?e.slice(10):e}boardLabel(){return this.heading??this.defaultHeading()}boardAddable(){return!1}get definition(){return lo({name:this.boardName(),label:this.boardLabel(),addable:this.boardAddable(),commentTargets:()=>this.commentTargets,elementActionResults:()=>this.elementActionResults})}get controller(){return this.#g()}get api(){return this.#h??=nd(this.#x(),this),this.#h}#g(){if(this.#u)return this.#u;const e=this.board!==null,n=lo({name:this.boardName(),label:this.boardLabel(),addable:this.boardAddable()}),i=new id(e?{definition:n,base:{},storage:null}:{definition:n,base:{}});return this.#u=i,e&&(this.dataset.template=n.name),i.subscribe(()=>this.#f()),this.#f(),i}#f(){const e=this.#u;if(!e)return;const n=this.#m();this.elementActions=od(e.actions,n),e.setComponentSnapshot({targets:this.commentTargets,providers:[{id:n,results:this.elementActionResults}]})}#x(){const e=()=>this.#g(),n={definition:this.definition,controller:e,derivation:()=>e().derivation,ready:Promise.resolve(),navigation:()=>({}),issues:()=>e().lastIssues,dispatch:i=>this.#v(i),dispatchBatch:i=>this.#k(i),subscribe:i=>e().subscribe(()=>i(dd(n))),editComment:(i,o)=>e().editComment(i,o),removeAction:i=>e().removeAction(i),clearActions:()=>e().clearActions(),navigate:()=>{},hashFor:()=>"",requestComment:()=>{}};return n}#M(e){const i=this.#g().descriptorFor(e.type)?.targetType??"element",o=sd(e.target,i),s=this.board;if(s===null)return{...e,target:o};const r=An(this)?.pageNames()??new Set;return{...e,target:rd(o,s,r)}}#v(e){const n=this.board!==null?An(this):null;return n===null?this.#g().dispatch(e):n.dispatch(this.#M(e))}#k(e){const n=this.board!==null?An(this):null;return n===null?this.#g().dispatchBatch(e):n.dispatchBatch(e.map(i=>this.#M(i)))}reduceElementActions(e,n){return{data:e,results:n.map(i=>({id:i.id,title:i.type,stale:"unsupported-action-type"}))}}dispatchElementAction(e,n,i){const o=this.commentRef(...n);if(this.board!==null)return this.#v({type:e,target:o,payload:i}).ok;const s=new CustomEvent("dpk-element-action",{detail:{type:e,target:o,payload:i},bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(s),s.defaultPrevented}get selection(){return this.#r}select(e){this.#L(e)}get tagFilter(){return this.#a}set tagFilter(e){this.#a=e,this.requestUpdate()}get dataError(){return this.#i}closeComposer(){this.#l.close()}get locale(){return this.#p.locale}get chromeMessages(){return Lo(this.#p.locale)}renderSelection(){return this.#l.render({locale:this.#p.locale,errorMessage:this.chromeMessages.sendFailed,submit:(e,n)=>this.#T(e,n)})}getContextMenuItems(e){const n=Ed(e.target,this.commentTargets,Vi(this.locale),(i,o)=>this.#C(i,o));return n===null?null:[n]}#C(e,n){const i=this.renderRoot.querySelector(`[data-dpk-target="${CSS.escape(e)}"]`);i!==null&&this.#l.open(e,i,n)}questionsOf(e){const n=e.questions?.trim();return n===void 0||n===""?$:n}statsText(){return""}tagItems(){return[]}isEmpty(){return!1}shellClass(){return""}get frameControls(){return this.board===null}defaultHeading(){return""}defaultSubject(){return""}emptyMessage(){return this.chromeMessages.noMatches}renderToolbarActions(){return $}items(){return this.#o??this.emptyData()}authoredItems(){return this.#n??this.emptyData()}renderToolbarActionsSlot(){return y`<div slot="actions" class="diagram-toolbar-actions">
372
372
  ${this.renderToolbarActions()}
373
373
  <span class="diagram-stats">${this.statsText()}</span>
374
374
  </div>`}renderTagFilterRow(e=$){return y`<div slot="toolbar" class="diagram-toolbar-rows">
@@ -3946,7 +3946,7 @@ ${i.renameContextHint}`}
3946
3946
  background: color-mix(in srgb, var(--dpk-paper-raised) 94%, transparent);
3947
3947
  box-shadow: var(--dpk-shadow-xs);
3948
3948
  }
3949
- `,Xu={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},Gu={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"},Ku="example-mapping";class Ir extends et{static{this.styles=[Je,Yu]}#n=new _d(this);#o=null;#e=Ti;parseData(e){return lu(e)}emptyData(){return cu()}reduceElementActions(e,n){return Ru(Fe(this.locale),e,n)}defaultHeading(){return Fe(this.locale).heading}shellClass(){return"example-mapping"}emptyMessage(){return Fe(this.locale).noStoriesTitle}commentItems(){const e=this.items();return[...e.stories.map(n=>({value:this.commentRef("story",n.id),label:n.name})),...e.rules.map(n=>({value:this.commentRef("rule",n.id),label:n.name})),...e.examples.map(n=>({value:this.commentRef("example",n.id),label:n.name})),...e.questions.map(n=>({value:this.commentRef("question",n.id),label:n.name}))]}hasSelection(e){return fr(this.items(),e.id)?.kind===e.kind}isEmpty(){return this.items().stories.length===0}refreshContent(){const e=this.authoredItems();e!==this.#o&&(this.#o=e,this.#e=Ti)}render(){this.prepareRender();const e=Fe(this.locale),n=this.chromeMessages,i=this.subject??this.defaultSubject();return y`
3949
+ `,Xu={story:"SET_STORY_NAME",rule:"SET_RULE_NAME",example:"SET_EXAMPLE_NAME",question:"SET_QUESTION_NAME"},Gu={story:"DELETE_STORY",rule:"DELETE_RULE",example:"DELETE_EXAMPLE",question:"DELETE_QUESTION"},Ku="example-mapping";class Ir extends et{boardAddable(){return!0}static{this.styles=[Je,Yu]}#n=new _d(this);#o=null;#e=Ti;parseData(e){return lu(e)}emptyData(){return cu()}reduceElementActions(e,n){return Ru(Fe(this.locale),e,n)}defaultHeading(){return Fe(this.locale).heading}shellClass(){return"example-mapping"}emptyMessage(){return Fe(this.locale).noStoriesTitle}commentItems(){const e=this.items();return[...e.stories.map(n=>({value:this.commentRef("story",n.id),label:n.name})),...e.rules.map(n=>({value:this.commentRef("rule",n.id),label:n.name})),...e.examples.map(n=>({value:this.commentRef("example",n.id),label:n.name})),...e.questions.map(n=>({value:this.commentRef("question",n.id),label:n.name}))]}hasSelection(e){return fr(this.items(),e.id)?.kind===e.kind}isEmpty(){return this.items().stories.length===0}refreshContent(){const e=this.authoredItems();e!==this.#o&&(this.#o=e,this.#e=Ti)}render(){this.prepareRender();const e=Fe(this.locale),n=this.chromeMessages,i=this.subject??this.defaultSubject();return y`
3950
3950
  <dpk-dialog-panel
3951
3951
  class=${this.shellClass()}
3952
3952
  ?maximizable=${this.frameControls}
@@ -4243,7 +4243,7 @@ ${i.renameContextHint}`}
4243
4243
  color: var(--dpk-ink-soft);
4244
4244
  font-size: 12px;
4245
4245
  }
4246
- `;class Or extends et{static{this.styles=[Je,Od,dm]}#n=null;#o=null;#e=null;#t=null;#i=null;parseData(e){return Ju(e)}emptyData(){return Zu()}reduceElementActions(e,n){return am(Mt(this.locale),e,n)}defaultHeading(){return Mt(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return Mt(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(n=>({value:this.commentRef("column",n.id),label:n.label})),...It(e).map(n=>({value:this.commentRef("card",n.id),label:n.title}))]}hasSelection(e){const n=this.items();return e.kind==="column"?n.columns.some(i=>i.id===e.id):yn(n,e.id)!==void 0}tagItems(){return It(this.items()).map(e=>e.tags)}statsText(){const e=Mt(this.locale),n=It(this.items()).length,i=It(this.#r()).length;return i===n?`${n} ${e.cards}`:`${i} / ${n} ${e.cards}`}isEmpty(){return this.items().columns.length===0}refreshContent(){const e=this.authoredItems();e!==this.#n&&(this.#n=e,this.#o=null,this.#e=null)}render(){this.prepareRender();const e=this.chromeMessages,n=this.subject??this.defaultSubject();return y`
4246
+ `;class Or extends et{boardAddable(){return!0}static{this.styles=[Je,Od,dm]}#n=null;#o=null;#e=null;#t=null;#i=null;parseData(e){return Ju(e)}emptyData(){return Zu()}reduceElementActions(e,n){return am(Mt(this.locale),e,n)}defaultHeading(){return Mt(this.locale).heading}shellClass(){return"kanban"}emptyMessage(){return Mt(this.locale).empty}commentItems(){const e=this.items();return[...e.columns.map(n=>({value:this.commentRef("column",n.id),label:n.label})),...It(e).map(n=>({value:this.commentRef("card",n.id),label:n.title}))]}hasSelection(e){const n=this.items();return e.kind==="column"?n.columns.some(i=>i.id===e.id):yn(n,e.id)!==void 0}tagItems(){return It(this.items()).map(e=>e.tags)}statsText(){const e=Mt(this.locale),n=It(this.items()).length,i=It(this.#r()).length;return i===n?`${n} ${e.cards}`:`${i} / ${n} ${e.cards}`}isEmpty(){return this.items().columns.length===0}refreshContent(){const e=this.authoredItems();e!==this.#n&&(this.#n=e,this.#o=null,this.#e=null)}render(){this.prepareRender();const e=this.chromeMessages,n=this.subject??this.defaultSubject();return y`
4247
4247
  <dpk-dialog-panel
4248
4248
  class=${this.shellClass()}
4249
4249
  ?maximizable=${this.frameControls}
@@ -6191,7 +6191,7 @@ ${i.renameContextHint}`}
6191
6191
  outline: 2px solid var(--dpk-blue);
6192
6192
  outline-offset: 1px;
6193
6193
  }
6194
- `,_f=10,Ha=8,Ya=72,Af=t=>t!==void 0,Of="whiteboard";class Xa extends et{constructor(){super(...arguments),this.mode=Ae,this.viewport=Ng,this.gesture=void 0,this.panReady=!1,this.arrangeMenu=!1,this.selectedIds=[],this.#n=!1,this.#o=!1,this.#r={on:"other"},this.#s=!1,this.#d=!1,this.#p=[],this.#u=0}static{this.styles=[Je,Rf]}#n;#o;#e;#t;#i;#a;#r;#s;#d;#l;#p;#u;parseData(e){return rg(e)}emptyData(){return ag()}reduceElementActions(e,n){return rf(Ot(this.locale),e,n)}defaultHeading(){return Ot(this.locale).heading}shellClass(){return"whiteboard"}commentItems(){const e=this.items(),n=Ot(this.locale);return[{value:this.commentRef("page",Of),label:n.wholeBoard},...e.items.map(i=>({value:this.commentRef("item",i.id),label:Ca(n,i)})),...e.connectors.map(i=>({value:this.commentRef("connector",i.id),label:La(n,e,i)}))]}hasSelection(e){const n=this.items();return e.kind==="item"?W(n,e.id)!==void 0:ge(n,e.id)!==void 0}render(){this.prepareRender();const e=Ot(this.locale),n=this.chromeMessages,i=this.subject??this.defaultSubject(),o=wa(this.items(),this.gesture),s=ka(this.gesture),r=s!==void 0&&this.gesture!==void 0?va(this.items(),this.gesture):this.selectedIds;return y`
6194
+ `,_f=10,Ha=8,Ya=72,Af=t=>t!==void 0,Of="whiteboard";class Xa extends et{constructor(){super(...arguments),this.mode=Ae,this.viewport=Ng,this.gesture=void 0,this.panReady=!1,this.arrangeMenu=!1,this.selectedIds=[],this.#n=!1,this.#o=!1,this.#r={on:"other"},this.#s=!1,this.#d=!1,this.#p=[],this.#u=0}boardAddable(){return!0}static{this.styles=[Je,Rf]}#n;#o;#e;#t;#i;#a;#r;#s;#d;#l;#p;#u;parseData(e){return rg(e)}emptyData(){return ag()}reduceElementActions(e,n){return rf(Ot(this.locale),e,n)}defaultHeading(){return Ot(this.locale).heading}shellClass(){return"whiteboard"}commentItems(){const e=this.items(),n=Ot(this.locale);return[{value:this.commentRef("page",Of),label:n.wholeBoard},...e.items.map(i=>({value:this.commentRef("item",i.id),label:Ca(n,i)})),...e.connectors.map(i=>({value:this.commentRef("connector",i.id),label:La(n,e,i)}))]}hasSelection(e){const n=this.items();return e.kind==="item"?W(n,e.id)!==void 0:ge(n,e.id)!==void 0}render(){this.prepareRender();const e=Ot(this.locale),n=this.chromeMessages,i=this.subject??this.defaultSubject(),o=wa(this.items(),this.gesture),s=ka(this.gesture),r=s!==void 0&&this.gesture!==void 0?va(this.items(),this.gesture):this.selectedIds;return y`
6195
6195
  <dpk-dialog-panel
6196
6196
  class=${this.shellClass()}
6197
6197
  flush