dev-process-kit 0.4.2 → 0.4.3
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/boards.js +1 -1
- package/dist/chunks/{shared-D1ZujbZA.js → shared-0HXwrPVn.js} +54 -54
- package/dist/chunks/{shared-DPD_cXES.js → shared-B2F5LY6f.js} +13 -13
- package/dist/chunks/{shared-CsLKVrK7.js → shared-B7MDu9J_.js} +1 -1
- package/dist/chunks/{shared-DErYmK9C.js → shared-BSEt0fN6.js} +1 -1
- package/dist/chunks/{shared-CHQBlCl0.js → shared-BugVP_yn.js} +2 -2
- package/dist/chunks/shared-C1sWnXGY.js +1 -0
- package/dist/chunks/{shared-HkbNG84_.js → shared-C2_qMOyi.js} +1 -1
- package/dist/chunks/{shared-4JaCIu01.js → shared-CeNV36-9.js} +134 -28
- package/dist/chunks/{shared-JOvfFoxb.js → shared-CjWMknuE.js} +1 -1
- package/dist/chunks/{shared-D0_BoWj3.js → shared-CxTKp5CX.js} +18 -18
- package/dist/chunks/{shared-C-ujfGnT.js → shared-CyOyXHQO.js} +1 -1
- package/dist/chunks/{shared-D80rPPNF.js → shared-D3Xm9wF8.js} +3 -3
- package/dist/chunks/shared-DCnxYUIB.js +3 -0
- package/dist/chunks/{shared-_0Ev6y6i.js → shared-DE09J93T.js} +494 -226
- package/dist/chunks/{shared-CMWEqwI3.js → shared-DJCdfkg-.js} +1 -1
- package/dist/chunks/{shared-KHA87RsJ.js → shared-Dxf3BUk6.js} +1049 -217
- package/dist/chunks/{shared-SjAP9bK0.js → shared-qLSu7C5m.js} +10 -10
- package/dist/chunks/{shared-D2fmf6zb.js → shared-tq8QsPTt.js} +2 -2
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sync.js +1 -1
- package/dist/views/delegation-poker.js +1 -1
- package/dist/views/plain.js +1 -1
- package/dist/views/prototype.js +1 -1
- package/dist/views/slides.js +1 -1
- package/dist/views/task-board.js +1 -1
- package/dist/views/usm.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/shared-CJZKj_HI.js +0 -3
- package/dist/chunks/shared-lVXxL9i3.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Z as Cc,L as Po,_ as Me,$ as Ic,a0 as Lc,a1 as Ac,a2 as _c,O as Rc,i as wi,a3 as $i,a4 as ve,a5 as A,a6 as oe,a7 as Ei,a8 as Mi,a9 as Oc,aa as Dc,ab as Nc,n as zc,D as Pc,ac as qc,N as Fc,ad as qo,ae as Bc,af as Ti,ag as E,C as Uc,ah as Hc,ai as Si,aj as Ci,ak as Yc,al as Be,am as Ii,x as Li,an as Gc,z as Ai,A as Fo,B as _n,ao as Xc,ap as _t,aq as Rt,u as Bo,ar as nn,as as Wc,at as Rn,au as Kc,k as Re,av as _i,t as Uo,aw as Vc,ax as Ri,ay as Ue,az as jc,aA as Qc,aB as Zc}from"./shared-_0Ev6y6i.js";import{U as Jc,B as ep,J as tp,V as np,W as op,X as He,Y as Ye,Z as Oi,_ as sp,$ as Oe,a0 as ip,a1 as Ho,a2 as Di,a3 as rp}from"./shared-KHA87RsJ.js";import{o as ap}from"./shared-D4PPk0Dk.js";import{s as be,o as Y,h as K,l as Te,j as w,n as $e,m as Se,q as W,k as R,v as _,w as O,x as te,y as De,g as on,z as Yo,A as dp,B as se,C as ue,d as X,e as Ge,D as Ce,p as On,b as Go,f as j,E as Dn,F as Ni,G as lp,u as zi,H as Nn}from"./shared-CJZKj_HI.js";import{E as cp,t as Xe,u as pp,v as nt,B as zn,w as Pn,x as hp}from"./shared-DErYmK9C.js";import{a as up,c as mp}from"./shared-D0_BoWj3.js";import{o as qn}from"./shared-lVXxL9i3.js";import{h as Pi,l as fp,d as Xo,a as qi}from"./shared-D80rPPNF.js";const gp=[["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"}]],bp=[["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"}]],xp=[["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"}]],yp=[["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"}]],kp=[["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 vp(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}function Fi(t){if(t.length===0)return NaN;const e=t.slice().sort((o,s)=>o-s),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const Bi={},Ui=t=>{const e={kind:"board",name:t.name,label:t.label,addable:t.addable??!1,parseBase:()=>Bi,emptyBase:()=>Bi,actions:{},apply:()=>null,hasTarget:()=>!1,describe:s=>({title:s.type,targetLabel:Po(s.target),tone:"meta"}),serialize:s=>`${s.type} ${Po(s.target)} ${JSON.stringify(s.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],o=new Map((t.elementActionResults?.()??[]).map(s=>[s.id,s]));return Cc(e,n,o)},sn={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},rn=t=>{const e=[...t].sort((o,s)=>o-s);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},Wo=(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 o=new Map,s=new Set,i=r=>{o.set(r,"open");for(const d of n.get(r)??[]){const a=o.get(d.to)??"new";a==="open"?s.add(d.id):a==="new"&&i(d.to)}o.set(r,"done")};for(const r of t)(o.get(r.id)??"new")==="new"&&i(r.id);return{reversed:s,forward:e.filter(r=>!s.has(r.id))}},Hi=(t,e)=>{const n=new Map,o=new Map;for(const d of t)n.set(d.id,[]),o.set(d.id,[]);for(const d of e)o.get(d.from)?.push(d),n.get(d.to)?.push(d);const s=new Map(t.map(d=>[d.id,0])),i=new Map(t.map(d=>[d.id,(n.get(d.id)??[]).length])),r=t.filter(d=>(i.get(d.id)??0)===0).map(d=>d.id);for(const d of r)for(const a of o.get(d)??[]){const l=s.get(a.to)??0;s.set(a.to,Math.max(l,(s.get(d)??0)+1));const c=(i.get(a.to)??0)-1;i.set(a.to,c),c===0&&r.push(a.to)}return s},Yi=(t,e,n,o)=>{const s=[...t.keys()].sort((i,r)=>i-r);for(let i=0;i<o;i++){const r=i%2===0;for(const d of r?s:[...s].reverse()){const a=t.get(d)??[],l=new Map(a.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=a.map(p=>{const u=(e.get(p)??[]).filter(m=>(n.get(m)??d)===d+(r?-1:1)).map(c).filter(m=>m!==null);return{id:p,want:u.length>0?rn(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(d,h.map(p=>p.id))}}},Gi=(t,e,n,o)=>{const s=t.map((r,d)=>({id:r,want:n.get(r)??d*100,index:d}));s.sort((r,d)=>r.want-d.want||r.index-d.index);let i=0;for(const r of s){const d=e.get(r.id);d&&(d.y=i,i+=d.spec.height+o)}return{height:Math.max(0,i-o)}},wp=(t,e,n,o,s)=>{const i=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of i)r.set(l,Gi(t.get(l)??[],e,new Map,s.nodeSpacing).height);const d=Math.max(0,...r.values());for(const l of i){const c=(d-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const a=(l,c)=>{const h=(n.get(l)??[]).filter(p=>o.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?rn(h):null};for(let l=0;l<s.coordinatePasses;l++){const c=l%2===0;for(const h of c?i:[...i].reverse()){const p=t.get(h)??[],u=new Map;for(const b of p){const k=a(b,h+(c?-1:1)),x=e.get(b);x!==void 0&&u.set(b,k===null?x.y+x.spec.height/2:k)}const m=p.map(b=>e.get(b)?.y??0);Gi(p,e,u,s.nodeSpacing);const g=p.map(b=>e.get(b)?.y??0),f=rn(m)-rn(g);for(const b of p){const k=e.get(b);k&&(k.y+=f)}}}},Xi=(t,e,n,o,s,i,r)=>{for(const d of s){const a=t.filter(h=>o.get(h)===d);if(a.length===0)continue;const l=a.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=i.get(d)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},$p=(t,e,n,o,s)=>{let i=0;for(const r of t.values()){const d=r.filter(l=>n.get(l)===o);if(d.length===0)continue;const a=d.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+s*(d.length-1);a>i&&(i=a)}return i},Ep=(t,e,n,o,s,i,r)=>{const d=new Map(t.map(S=>[S.id,S.group??S.id])),a=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 v=d.get(S.id)??S.id;S.superGroup!==void 0&&!c.has(v)&&c.set(v,S.superGroup)}const h=S=>c.get(S)??S,p=[...e.keys()].sort((S,v)=>S-v),u=S=>{const v=s.get(S)??0,M=(e.get(v)??[]).length,L=i.get(S)??0;return M<=1?0:L/(M-1)},m=[...new Set(d.values())],g=S=>{const v=t.filter(M=>(d.get(M.id)??M.id)===S).map(M=>M.id);return v.length===0?0:v.reduce((M,L)=>M+u(L),0)/v.length},f=[...new Set(m.map(h))],b=S=>{const v=t.filter(M=>h(d.get(M.id)??M.id)===S).map(M=>M.id);return v.length===0?0:v.reduce((M,L)=>M+u(L),0)/v.length},x=f.sort((S,v)=>b(S)-b(v)).flatMap(S=>m.filter(v=>h(v)===S).sort((v,M)=>g(v)-g(M))),I=new Map(x.map(S=>[S,$p(e,n,d,S,r.nodeSpacing)])),y=new Map;let C=0;for(const[S,v]of x.entries()){y.set(v,C),C+=I.get(v)??0;const M=x[S+1];if(M!==void 0){const L=l&&h(v)!==h(M);C+=L?r.superGroupSpacing:a.has(v)||a.has(M)?r.groupSpacing:r.nodeSpacing}}for(const S of p){const v=e.get(S)??[];Xi(v,n,new Map(v.map(M=>[M,i.get(M)??0])),d,x,y,r.nodeSpacing)}const T=(S,v)=>{const M=(o.get(S)??[]).filter(L=>s.get(L)===v).flatMap(L=>{const P=n.get(L);return P?[P.y+P.spec.height/2]:[]});return M.length>0?rn(M):null};for(let S=0;S<r.coordinatePasses;S++){const v=S%2===0;for(const M of v?p:[...p].reverse()){const L=e.get(M)??[],P=new Map;for(const B of L){const U=T(B,M+(v?-1:1)),$=n.get(B);$!==void 0&&P.set(B,U===null?$.y+$.spec.height/2:U)}Xi(L,n,P,d,x,y,r.nodeSpacing)}}},Wi=(t,e,n)=>{const o=e===void 0?void 0:t.spec.ports?.[e];return o?{x:t.x+o.x,y:t.y+o.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}},Fn=(t,e,n)=>{let o=0;const s=[];for(const i of t){const r=n.byId.get(i.from),d=n.byId.get(i.to);if(!r||!d)continue;const a=Wi(r,i.fromPort,"out"),l=Wi(d,i.toPort,"in");if(i.from===i.to){const m=r.x+r.spec.width,g=r.y+r.spec.height,f=Math.max(n.padding/2,g+18);s.push({id:i.id,points:[a,{x:m+20,y:a.y},{x:m+20,y:f},{x:r.x-20,y:f},{x:r.x-20,y:l.y},l]});continue}if(!e.has(i.id)&&(r.layer<d.layer||r.layer===d.layer&&l.x>a.x+12)){if(Math.abs(a.y-l.y)<.5){s.push({id:i.id,points:[a,l]});continue}const g=r.layer<d.layer?Math.max(a.x+14,d.x-Math.max(12,n.layerSpacing/2)):(a.x+l.x)/2;s.push({id:i.id,points:[a,{x:g,y:a.y},{x:g,y:l.y},l]});continue}const c=i.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:a,h=i.toPort===void 0?{x:d.x+d.spec.width/2,y:d.y+d.spec.height}:l,p=Math.max(c.y,h.y)+18+o*14;o+=1;const u=[a,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((m,g,f)=>g===0||m.x!==f[g-1]?.x||m.y!==f[g-1]?.y);s.push({id:i.id,points:u})}return s},Ko=(t,e,n)=>{const o=e.flatMap(p=>[...p.points]),s=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...o.map(p=>p.x)],i=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...o.map(p=>p.y)],r=Math.min(0,...s),d=Math.min(0,...i),a=Math.max(0,...s),l=Math.max(0,...i),c=n-r,h=n-d;return{width:a-r+n*2,height:l-d+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}))}))}},Bn=(t,e)=>{const n=new Map(t.map(o=>[o.id,[]]));for(const o of e)o.from!==o.to&&(n.get(o.from)?.push(o.to),n.get(o.to)?.push(o.from));return n},Ki=(t,e,n,o)=>t.map(s=>({spec:s,layer:e.get(s.id)??0,order:n.get(s.id)??0,...o(s)})),Vi=(t,e)=>{const n=new Map;for(const o of t){const s=e.get(o.id)??0,i=n.get(s);i?i.push(o.id):n.set(s,[o.id])}return n},ji=(t,e,n={})=>{if(t.some(g=>g.superGroup!==void 0))return zp(t,e,n);const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(g=>g.id)),i=e.filter(g=>s.has(g.from)&&s.has(g.to)),{forward:r,reversed:d}=Wo(t,i),a=Hi(t,r),l=Vi(t,a);Yi(l,Bn(t,i),a,o.sweeps);const c=new Map;for(const g of l.values())g.forEach((f,b)=>c.set(f,b));const h=Ki(t,a,c,()=>({x:0,y:0})),p=new Map(h.map(g=>[g.spec.id,g]));t.some(g=>g.group!==void 0||g.superGroup!==void 0)?Ep(t,l,p,Bn(t,i),a,c,o):wp(l,p,Bn(t,i),a,o);const u=[...l.keys()].sort((g,f)=>g-f);let m=0;for(const g of u){const f=Math.max(...(l.get(g)??[]).map(b=>p.get(b)?.spec.width??0));for(const b of l.get(g)??[]){const k=p.get(b);k&&(k.x=m)}m+=f+o.layerSpacing}return Ko(h,Fn(i,d,{byId:p,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Ot=12,Qi=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),Zi=(t,e)=>{const n=Qi(t),o=Qi(e),s=o.x-n.x,i=o.y-n.y;return Math.abs(s)>=Math.abs(i)?s>=0?"right":"left":i>=0?"bottom":"top"},Ji=(t,e,n)=>Math.min(n,Math.max(e,t)),er=(t,e,n)=>{const o=Ji(n.y-t.y,Ot,Math.max(Ot,t.height-Ot)),s=t.height<=0?.5:o/t.height,i=t.x+Ji(s*t.width,Ot,Math.max(Ot,t.width-Ot));switch(e){case"left":return{x:t.x,y:t.y+o};case"right":return{x:t.x+t.width,y:t.y+o};case"top":return{x:i,y:t.y};case"bottom":return{x:i,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+o}}},Mp=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const o=t.map(c=>({id:c.id,width:c.width,height:c.height})),s=new Set(o.map(c=>c.id)),i=e.filter(c=>s.has(c.from)&&s.has(c.to)&&c.from!==c.to),{forward:r}=Wo(o,i),d=Hi(o,r),a=Vi(o,d);return Yi(a,Bn(o,i),d,n),[...a.keys()].sort((c,h)=>c-h).flatMap(c=>a.get(c)??[])},Tp=(t,e,n,o)=>{let s=0;for(let i=e;i<n;i++)s+=t[i].width;return s+o*Math.max(0,n-e-1)},Vo=(t,e,n)=>{const o=t.length,s=Math.max(1,Math.min(n,o)),i=Number.POSITIVE_INFINITY,r=Array.from({length:o+1},()=>Array.from({length:s+1},()=>i)),d=Array.from({length:o+1},()=>Array.from({length:s+1},()=>0));r[0][0]=0;for(let u=1;u<=s;u++)for(let m=u;m<=o;m++)for(let g=u-1;g<m;g++){const f=r[g][u-1];if(f===i)continue;const b=Math.max(f,Tp(t,g,m,e));b<r[m][u]&&(r[m][u]=b,d[m][u]=g)}const a=[];let l=o;for(let u=s;u>0;u--){const m=d[l][u];a.unshift(t.slice(m,l)),l=m}const c=new Map;let h=0,p=0;for(const u of a){let m=0;const g=Math.max(...u.map(f=>f.height));for(const f of u)c.set(f.id,{x:m,y:h}),m+=f.width+e;p=Math.max(p,m-e),h+=g+e}return{positions:c,width:p,height:Math.max(0,h-e)}},yt=1e-6,Un=(t,e)=>Math.abs(t.x-e.x)<yt&&Math.abs(t.y-e.y)<yt,Hn=(t,e,n)=>{const o=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(o)<yt?0:o>0?1:-1},Yn=(t,e,n)=>Math.min(t.x,n.x)-yt<=e.x&&e.x<=Math.max(t.x,n.x)+yt&&Math.min(t.y,n.y)-yt<=e.y&&e.y<=Math.max(t.y,n.y)+yt,tr=(t,e)=>{const[n,o]=t,[s,i]=e;if(Un(n,s)||Un(n,i)||Un(o,s)||Un(o,i))return!1;const r=Hn(n,o,s),d=Hn(n,o,i),a=Hn(s,i,n),l=Hn(s,i,o);return r!==d&&a!==l||r===0&&Yn(n,s,o)||d===0&&Yn(n,i,o)||a===0&&Yn(s,n,i)?!0:l===0&&Yn(s,o,i)},nr=(t,e)=>{const n=t.x+t.width/2,o=t.y+t.height/2,s=e.x+e.width/2,i=e.y+e.height/2,r=s-n,d=i-o;return Math.abs(r)>=Math.abs(d)?{x:r>=0?t.x+t.width:t.x,y:o}:{x:n,y:d>=0?t.y+t.height:t.y}},Sp=(t,e,n)=>{const o=r=>{const d=t.positions.get(r),a=e.get(r);return!d||!a?null:{id:r,x:d.x,y:d.y,width:a.width,height:a.height}},s=[];let i=0;for(const r of n){if(r.from===r.to)continue;const d=o(r.from),a=o(r.to);if(!d||!a)continue;const l=nr(d,a),c=nr(a,d);if(l.x===c.x||l.y===c.y){const m=[l,c];i+=s.filter(g=>tr(m,g)).length,s.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 g=m.reduce((f,b)=>f+s.filter(k=>tr(b,k)).length,0);g<u&&(u=g,p=m)}i+=u,s.push(...p)}return i},Cp=(t,e,n)=>{const o=i=>{const r=t.positions.get(i),d=e.get(i);return!r||!d?null:{x:r.x+d.width/2,y:r.y+d.height/2}};let s=0;for(const i of n){if(i.from===i.to)continue;const r=o(i.from),d=o(i.to);r&&d&&(s+=Math.hypot(r.x-d.x,r.y-d.y))}return s},or=(t,e)=>{const n=t[0].x===t[1].x,o=e[0].x===e[1].x;if(n===o)return!1;const[s,i,r,d]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],a=s.x,l=r.y;return a>Math.min(r.x,d.x)&&a<Math.max(r.x,d.x)&&l>Math.min(s.y,i.y)&&l<Math.max(s.y,i.y)},sr=(t,e,n,o)=>{const s=n===void 0?void 0:t.ports?.[n];return s!==void 0?{x:e.x+s.x,y:e.y+s.y}:o==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},Ip=(t,e,n)=>{const o=new Map(t.map(r=>[r.id,r])),s=[];let i=0;for(const r of e){if(r.from===r.to)continue;const d=o.get(r.from),a=o.get(r.to),l=n.get(r.from),c=n.get(r.to);if(d===void 0||a===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:d.width,height:d.height},p={x:c.x,y:c.y,width:a.width,height:a.height},u=er(h,Zi(h,p),sr(d,l,r.fromPort,"out")),m=er(p,Zi(p,h),sr(a,c,r.toPort,"in")),g=x=>x.slice(1).map((I,y)=>[x[y],I]);if(u.x===m.x||u.y===m.y){const x=[u,m];i+=s.filter(I=>or(x,I)).length,s.push(x);continue}const f=[[u,{x:m.x,y:u.y},m],[u,{x:u.x,y:m.y},m]];let b=f[0],k=Number.POSITIVE_INFINITY;for(const x of f){const I=g(x).reduce((y,C)=>y+s.filter(T=>or(C,T)).length,0);I<k&&(b=x,k=I)}i+=k,s.push(...g(b))}return i},Gn={crossings:1e4,edgeLength:1,aspectDeviation:50},ir=50,Lp=Gn.aspectDeviation,jo=(t,e,n,o,s)=>{const i=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/o));return Sp(t,e,n)*Gn.crossings+Cp(t,e,n)*Gn.edgeLength+i*s},Ap=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const o=Array.from({length:n}).fill(0);let s=0;for(;s<n;)if(o[s]<s){const i=s%2===0?0:o[s],r=e[i];e[i]=e[s],e[s]=r,yield[...e],o[s]=o[s]+1,s=0}else o[s]=0,s++},_p=7,Rp=400,Op=1e-6,Qo=(t,e,n,o,s=sn.sweeps,i=0,r=Gn.aspectDeviation,d=Rp)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const y=t[0];return{positions:new Map([[y.id,{x:0,y:0}]]),width:y.width,height:y.height}}const a=new Map(t.map(y=>[y.id,{width:y.width,height:y.height}])),l=e.filter(y=>a.has(y.from)&&a.has(y.to)&&y.from!==y.to),c=y=>{const C=y.map(P=>({id:P,...a.get(P)}));let T=Vo(C,n,1),S=Number.POSITIVE_INFINITY,v=1;const M=i>0?Math.min(i,C.length):1,L=i>0?M:C.length;for(let P=M;P<=L;P++){const B=Vo(C,n,P);if(B.width<=0||B.height<=0)continue;const U=jo(B,a,l,o,r);U<S&&(S=U,T=B,v=P)}return{packed:T,cost:S,rowCount:v}},h=(y,C)=>Vo(y.map(T=>({id:T,...a.get(T)})),n,C),p=t.map(y=>y.id);if(p.length<=_p){let y=c(p);for(const C of Ap(p)){const T=c(C);T.cost<y.cost&&(y=T)}return y.packed}const u=i>0?Math.min(d,50):d;let m=Mp(t,l,s);const g=c(m),f=i>0?Math.min(i,m.length):g.rowCount;let b=i>0?h(m,f):g.packed,k=i>0?jo(b,a,l,o,r):g.cost,x=0,I=!0;for(;I&&x<u;){I=!1;for(let y=0;y<m.length-1&&x<u;y++){x++;const C=[...m],T=C[y];C[y]=C[y+1],C[y+1]=T;const S=h(C,f);if(S.width<=0||S.height<=0)continue;const v=jo(S,a,l,o,r);v<k-Op&&(k=v,b=S,m=C,I=!0)}}return b},Dp=(t,e,n,o,s)=>{if(n<=0&&o<=0||t.positions.size<=1)return t;const i=new Map;for(const[p,u]of t.positions){const m=i.get(u.y);m?m.push(p):i.set(u.y,[p])}const d=[...i.keys()].sort((p,u)=>p-u).map(p=>[...i.get(p)??[]].sort((u,m)=>(t.positions.get(u)?.x??0)-(t.positions.get(m)?.x??0))),a=new Map;let l=0,c=0,h=0;return d.forEach((p,u)=>{const m=d[u-1];if(m!==void 0){const f=p.some(s)||m.some(s);h+=f?n:0}let g=0;p.forEach((f,b)=>{const k=p[b-1];k!==void 0&&(g+=s(k)||s(f)?o:0);const x=t.positions.get(f),I=e.get(f);if(!x||!I)return;const y={x:x.x+g,y:x.y+h};a.set(f,y),l=Math.max(l,y.x+I.width),c=Math.max(c,y.y+I.height)})}),{positions:a,width:l,height:c}},rr=1.3,Np=1.45,zp=(t,e,n={})=>{const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(v=>v.id)),i=e.filter(v=>s.has(v.from)&&s.has(v.to)),r=v=>v.group??`__loose:${v.id}`,d=v=>v.superGroup??`__top:${v.id}`,a=new Map(t.map(v=>[v.id,r(v)])),l=new Map(t.map(v=>[v.id,d(v)])),c=new Map;for(const v of t){const M=r(v),L=c.get(M);L?L.push(v):c.set(M,[v])}const h=new Map;for(const[v,M]of c){const L=M[0];if(M.length===1&&L!==void 0){h.set(v,{size:{width:L.width,height:L.height},relative:new Map([[L.id,{x:0,y:0}]])});continue}const P=new Set(M.map($=>$.id)),B=i.filter($=>P.has($.from)&&P.has($.to)),U=Qo(M.map($=>({id:$.id,width:$.width,height:$.height})),B,o.nodeSpacing,rr,o.sweeps,0,ir);h.set(v,{size:{width:U.width,height:U.height},relative:U.positions})}const p=new Map;for(const[v,M]of c){const L=M[0];L!==void 0&&p.set(v,d(L))}const u=new Map;for(const[v,M]of p){const L=u.get(M);L?L.push(v):u.set(M,[v])}const m=new Map;for(const[v,M]of u){const L=M[0];if(M.length===1&&L!==void 0){const $=h.get(L);$&&m.set(v,{size:$.size,relative:new Map([[L,{x:0,y:0}]])});continue}const P=new Map(M.flatMap($=>h.has($)?[[$,h.get($).size]]:[])),B=i.flatMap($=>{const N=a.get($.from),z=a.get($.to);return N===void 0||z===void 0||N===z?[]:!M.includes(N)||!M.includes(z)?[]:[{id:$.id,from:N,to:z}]}),U=Qo(M.flatMap($=>P.has($)?[{id:$,...P.get($)}]:[]),B,o.groupSpacing,rr,o.sweeps,0,ir);m.set(v,{size:{width:U.width,height:U.height},relative:U.positions})}const g=new Map([...m].map(([v,M])=>[v,M.size])),f=[...m.keys()],b=new Set(t.flatMap(v=>v.superGroup===void 0?[]:[v.superGroup])),k=v=>{const M=new Map;for(const[L,P]of u){const B=v.get(L)??{x:0,y:0},U=m.get(L);for(const $ of P){const N=U?.relative.get($)??{x:0,y:0},z=h.get($);if(z)for(const[H,D]of z.relative)M.set(H,{x:B.x+N.x+D.x,y:B.y+N.y+D.y})}}return M};let x=new Map;if(f.length<=1)for(const v of f)x.set(v,{x:0,y:0});else{const v=i.flatMap(H=>{const D=l.get(H.from),F=l.get(H.to);return D===void 0||F===void 0||D===F?[]:[{id:H.id,from:D,to:F}]}),M=H=>Qo(f.map(D=>({id:D,...g.get(D)})),v,o.superGroupSpacing,Np,o.sweeps,H,Lp),L=M(o.superGroupRowCount),P=o.superGroupRowCount>0?[]:[1,2,3,4].filter(H=>H<=f.length),B=[L,...P.map(H=>M(H))],U=H=>{const D=Dp(H,g,o.superGroupRowGap,o.superGroupColumnGap,G=>b.has(G)),F=Ip(t,i,k(D.positions)),q=Math.min(1180/Math.max(1,D.width),900/Math.max(1,D.height),1);return{offsets:D.positions,crossings:F,fit:q}},$=B.map(U),N=$[0];let z=N;for(const H of $.slice(1))H.crossings>N.crossings*.8||H.fit<N.fit*.9||(H.crossings<z.crossings||H.crossings===z.crossings&&H.fit>z.fit)&&(z=H);x=new Map(z.offsets)}const I=k(x),y=Wo(t,i).reversed,C=t.map((v,M)=>{const L=I.get(v.id)??{x:0,y:0};return{spec:v,layer:0,order:M,x:L.x,y:L.y}}),T=new Map(C.map(v=>[v.spec.id,v])),S=Fn(i,y,{byId:T,layerSpacing:o.layerSpacing,padding:o.padding});return Ko(C,S,o.padding)},Pp=(t,e,n,o,s={})=>{if(e.size===0)return t;const i={...sn,...s},r=new Map(n.map(f=>[f.id,f])),d=t.nodes.map(f=>{const b=e.get(f.id);return b===void 0?f:{...f,x:b.x,y:b.y}}),a=new Map(d.map(f=>[f.id,{spec:r.get(f.id)??{id:f.id,width:f.width,height:f.height},layer:f.layer,order:f.order,x:f.x,y:f.y}])),l=new Set(d.map(f=>f.id)),c=o.filter(f=>l.has(f.from)&&l.has(f.to)),h=Fn(c,new Set,{byId:a,layerSpacing:i.layerSpacing,padding:i.padding}),p=[...d.map(f=>f.x+f.width),...h.flatMap(f=>f.points.map(b=>b.x))],u=[...d.map(f=>f.y+f.height),...h.flatMap(f=>f.points.map(b=>b.y))],m=Math.max(t.width,Math.max(0,...p)+i.padding),g=Math.max(t.height,Math.max(0,...u)+i.padding);return{width:m,height:g,nodes:d,routes:h}},ar=(t,e,n={})=>{const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(a=>a.id)),i=e.filter(a=>s.has(a.from)&&s.has(a.to)),r=Ki(t,new Map,new Map,a=>a.position??{x:0,y:0}),d=new Map(r.map(a=>[a.spec.id,a]));return Ko(r,Fn(i,new Set,{byId:d,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},dr={kind:"idle"},qp=t=>({kind:"node",...t,moved:!1,preview:null}),Fp=t=>({kind:"group",...t,moved:!1,preview:null}),Bp=(t,e,n,o)=>{if(t.kind==="idle")return t;const s=e.screenX-t.origin.screenX,i=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(s,i)<=o)return t;const r=s/n,d=i/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+d)};return{...t,moved:!0,preview:l}}const a=new Map;for(const[l,c]of t.starts)a.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+d)});return{...t,moved:!0,preview:a}},lr=Me({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`}}),cr={v:1,overrides:[]},Zo="dpk-layout-change",Up=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,pr=(t,e,n)=>({...t,overrides:[...t.overrides.filter(o=>!Up(o,e)),{...e,position:n}]}),Hp=(t,e)=>e.reduce((n,o)=>pr(n,o,o.position),t),Yp=(t,e,n)=>new Map(t.overrides.filter(o=>o.board===e&&o.diagram===n).map(o=>[o.node,o.position])),Gp=(t,e,n)=>t.overrides.some(o=>o.board===e&&o.diagram===n),Xp=(t,e,n)=>{const o=t.overrides.filter(s=>!(s.board===e&&s.diagram===n));return o.length===t.overrides.length?t:{...t,overrides:o}},Wp=(t,e,n,o)=>{const s=t.overrides.filter(i=>!(i.board===e&&i.diagram===n)||o.has(i.node));return s.length===t.overrides.length?t:{...t,overrides:s}},Kp=Y({x:$e(),y:$e()}),Vp=Y({board:w(),diagram:w(),node:w(),position:Kp}),jp=Y({v:Te(1),overrides:K(Vp)}),hr=t=>{const e=be(jp,t);return e.success?e.output:null},Qp=t=>`dev-process-kit:layout-positions:${t}`,Zp=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return Qp(t)},Jp=()=>Lc(hr),eh=()=>Ic(hr),th=t=>t.closest(Ac)?.getAttribute(_c)??"";class nh{#t;#s;#e=null;#n="";#o=cr;#a=()=>this.#c();constructor(e,n){this.#t=e,this.#s=n,e.addController(this)}hostConnected(){this.#e=this.#s.persist===!1?eh():Jp(),this.#n=Zp(),this.#o=this.#e.read(this.#n)??cr,window.addEventListener(Zo,this.#a)}hostDisconnected(){window.removeEventListener(Zo,this.#a)}get#i(){return th(this.#s.host())}get#r(){return this.#s.diagram()}overrides(){return Yp(this.#o,this.#i,this.#r)}hasOverrides(){return Gp(this.#o,this.#i,this.#r)}commit(e,n){this.#o=pr(this.#o,{board:this.#i,diagram:this.#r,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([o,s])=>({board:this.#i,diagram:this.#r,node:o,position:s}));this.#o=Hp(this.#o,n),this.#d()}prune(e){const n=Wp(this.#o,this.#i,this.#r,e);n!==this.#o&&(this.#o=n,this.#d())}reset(){const e=Xp(this.#o,this.#i,this.#r);e!==this.#o&&(this.#o=e,this.#d())}#d(){this.#e?.write(this.#n,this.#o),this.#t.requestUpdate(),window.dispatchEvent(new CustomEvent(Zo))}#c(){this.#o=this.#e?.read(this.#n)??this.#o,this.#t.requestUpdate()}}const oh=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,Dt=[Rc,wi,$i,ve`
|
|
1
|
+
import{Z as Cc,L as Po,_ as Me,$ as Ic,a0 as Lc,a1 as Ac,a2 as _c,O as Rc,i as wi,a3 as $i,a4 as ve,a5 as A,a6 as oe,a7 as Ei,a8 as Mi,a9 as Oc,aa as Dc,ab as Nc,n as zc,D as Pc,ac as qc,N as Fc,ad as qo,ae as Bc,af as Ti,ag as E,C as Uc,ah as Hc,ai as Si,aj as Ci,ak as Yc,al as Be,am as Ii,x as Li,an as Gc,z as Ai,A as Fo,B as _n,ao as Xc,ap as _t,aq as Rt,u as Bo,ar as nn,as as Wc,at as Rn,au as Kc,k as Re,av as _i,t as Uo,aw as Vc,ax as Ri,ay as Ue,az as jc,aA as Qc,aB as Zc}from"./shared-DE09J93T.js";import{X as Jc,C as ep,K as tp,Y as np,Z as op,_ as He,$ as Ye,a0 as Oi,a1 as sp,a2 as Oe,a3 as ip,a4 as Ho,a5 as Di,a6 as rp}from"./shared-Dxf3BUk6.js";import{o as ap}from"./shared-D4PPk0Dk.js";import{s as be,o as Y,h as K,l as Te,j as w,n as $e,m as Se,q as W,k as R,v as _,w as O,x as te,y as De,g as on,z as Yo,A as dp,B as se,C as ue,d as X,e as Ge,D as Ce,p as On,b as Go,f as j,E as Dn,F as Ni,G as lp,u as zi,H as Nn}from"./shared-DCnxYUIB.js";import{E as cp,t as Xe,u as pp,v as nt,B as zn,w as Pn,x as hp}from"./shared-BSEt0fN6.js";import{a as up,c as mp}from"./shared-CxTKp5CX.js";import{o as qn}from"./shared-C1sWnXGY.js";import{h as Pi,l as fp,d as Xo,a as qi}from"./shared-D3Xm9wF8.js";const gp=[["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"}]],bp=[["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"}]],xp=[["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"}]],yp=[["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"}]],kp=[["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 vp(t,e){let n=0;for(let o=0;o<t.length;o++)n+=e(t[o],o);return n}function Fi(t){if(t.length===0)return NaN;const e=t.slice().sort((o,s)=>o-s),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}const Bi={},Ui=t=>{const e={kind:"board",name:t.name,label:t.label,addable:t.addable??!1,parseBase:()=>Bi,emptyBase:()=>Bi,actions:{},apply:()=>null,hasTarget:()=>!1,describe:s=>({title:s.type,targetLabel:Po(s.target),tone:"meta"}),serialize:s=>`${s.type} ${Po(s.target)} ${JSON.stringify(s.payload)}`,resolveNavigation:()=>({}),commentTargets:()=>[],title:()=>t.label},n=t.commentTargets?.()??[],o=new Map((t.elementActionResults?.()??[]).map(s=>[s.id,s]));return Cc(e,n,o)},sn={nodeSpacing:34,layerSpacing:84,padding:28,sweeps:4,coordinatePasses:6,groupSpacing:34,superGroupSpacing:34,superGroupRowGap:0,superGroupColumnGap:0,superGroupRowCount:0},rn=t=>{const e=[...t].sort((o,s)=>o-s);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},Wo=(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 o=new Map,s=new Set,i=r=>{o.set(r,"open");for(const d of n.get(r)??[]){const a=o.get(d.to)??"new";a==="open"?s.add(d.id):a==="new"&&i(d.to)}o.set(r,"done")};for(const r of t)(o.get(r.id)??"new")==="new"&&i(r.id);return{reversed:s,forward:e.filter(r=>!s.has(r.id))}},Hi=(t,e)=>{const n=new Map,o=new Map;for(const d of t)n.set(d.id,[]),o.set(d.id,[]);for(const d of e)o.get(d.from)?.push(d),n.get(d.to)?.push(d);const s=new Map(t.map(d=>[d.id,0])),i=new Map(t.map(d=>[d.id,(n.get(d.id)??[]).length])),r=t.filter(d=>(i.get(d.id)??0)===0).map(d=>d.id);for(const d of r)for(const a of o.get(d)??[]){const l=s.get(a.to)??0;s.set(a.to,Math.max(l,(s.get(d)??0)+1));const c=(i.get(a.to)??0)-1;i.set(a.to,c),c===0&&r.push(a.to)}return s},Yi=(t,e,n,o)=>{const s=[...t.keys()].sort((i,r)=>i-r);for(let i=0;i<o;i++){const r=i%2===0;for(const d of r?s:[...s].reverse()){const a=t.get(d)??[],l=new Map(a.map((p,u)=>[p,u])),c=p=>{const u=l.get(p);return u===void 0?null:u},h=a.map(p=>{const u=(e.get(p)??[]).filter(m=>(n.get(m)??d)===d+(r?-1:1)).map(c).filter(m=>m!==null);return{id:p,want:u.length>0?rn(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(d,h.map(p=>p.id))}}},Gi=(t,e,n,o)=>{const s=t.map((r,d)=>({id:r,want:n.get(r)??d*100,index:d}));s.sort((r,d)=>r.want-d.want||r.index-d.index);let i=0;for(const r of s){const d=e.get(r.id);d&&(d.y=i,i+=d.spec.height+o)}return{height:Math.max(0,i-o)}},wp=(t,e,n,o,s)=>{const i=[...t.keys()].sort((l,c)=>l-c),r=new Map;for(const l of i)r.set(l,Gi(t.get(l)??[],e,new Map,s.nodeSpacing).height);const d=Math.max(0,...r.values());for(const l of i){const c=(d-(r.get(l)??0))/2;for(const h of t.get(l)??[]){const p=e.get(h);p&&(p.y+=c)}}const a=(l,c)=>{const h=(n.get(l)??[]).filter(p=>o.get(p)===c).flatMap(p=>{const u=e.get(p);return u?[u.y+u.spec.height/2]:[]});return h.length>0?rn(h):null};for(let l=0;l<s.coordinatePasses;l++){const c=l%2===0;for(const h of c?i:[...i].reverse()){const p=t.get(h)??[],u=new Map;for(const b of p){const k=a(b,h+(c?-1:1)),x=e.get(b);x!==void 0&&u.set(b,k===null?x.y+x.spec.height/2:k)}const m=p.map(b=>e.get(b)?.y??0);Gi(p,e,u,s.nodeSpacing);const g=p.map(b=>e.get(b)?.y??0),f=rn(m)-rn(g);for(const b of p){const k=e.get(b);k&&(k.y+=f)}}}},Xi=(t,e,n,o,s,i,r)=>{for(const d of s){const a=t.filter(h=>o.get(h)===d);if(a.length===0)continue;const l=a.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=i.get(d)??0;for(const h of l){const p=e.get(h.id);p&&(p.y=c,c+=p.spec.height+r)}}},$p=(t,e,n,o,s)=>{let i=0;for(const r of t.values()){const d=r.filter(l=>n.get(l)===o);if(d.length===0)continue;const a=d.reduce((l,c)=>l+(e.get(c)?.spec.height??0),0)+s*(d.length-1);a>i&&(i=a)}return i},Ep=(t,e,n,o,s,i,r)=>{const d=new Map(t.map(S=>[S.id,S.group??S.id])),a=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 v=d.get(S.id)??S.id;S.superGroup!==void 0&&!c.has(v)&&c.set(v,S.superGroup)}const h=S=>c.get(S)??S,p=[...e.keys()].sort((S,v)=>S-v),u=S=>{const v=s.get(S)??0,M=(e.get(v)??[]).length,L=i.get(S)??0;return M<=1?0:L/(M-1)},m=[...new Set(d.values())],g=S=>{const v=t.filter(M=>(d.get(M.id)??M.id)===S).map(M=>M.id);return v.length===0?0:v.reduce((M,L)=>M+u(L),0)/v.length},f=[...new Set(m.map(h))],b=S=>{const v=t.filter(M=>h(d.get(M.id)??M.id)===S).map(M=>M.id);return v.length===0?0:v.reduce((M,L)=>M+u(L),0)/v.length},x=f.sort((S,v)=>b(S)-b(v)).flatMap(S=>m.filter(v=>h(v)===S).sort((v,M)=>g(v)-g(M))),I=new Map(x.map(S=>[S,$p(e,n,d,S,r.nodeSpacing)])),y=new Map;let C=0;for(const[S,v]of x.entries()){y.set(v,C),C+=I.get(v)??0;const M=x[S+1];if(M!==void 0){const L=l&&h(v)!==h(M);C+=L?r.superGroupSpacing:a.has(v)||a.has(M)?r.groupSpacing:r.nodeSpacing}}for(const S of p){const v=e.get(S)??[];Xi(v,n,new Map(v.map(M=>[M,i.get(M)??0])),d,x,y,r.nodeSpacing)}const T=(S,v)=>{const M=(o.get(S)??[]).filter(L=>s.get(L)===v).flatMap(L=>{const P=n.get(L);return P?[P.y+P.spec.height/2]:[]});return M.length>0?rn(M):null};for(let S=0;S<r.coordinatePasses;S++){const v=S%2===0;for(const M of v?p:[...p].reverse()){const L=e.get(M)??[],P=new Map;for(const B of L){const U=T(B,M+(v?-1:1)),$=n.get(B);$!==void 0&&P.set(B,U===null?$.y+$.spec.height/2:U)}Xi(L,n,P,d,x,y,r.nodeSpacing)}}},Wi=(t,e,n)=>{const o=e===void 0?void 0:t.spec.ports?.[e];return o?{x:t.x+o.x,y:t.y+o.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}},Fn=(t,e,n)=>{let o=0;const s=[];for(const i of t){const r=n.byId.get(i.from),d=n.byId.get(i.to);if(!r||!d)continue;const a=Wi(r,i.fromPort,"out"),l=Wi(d,i.toPort,"in");if(i.from===i.to){const m=r.x+r.spec.width,g=r.y+r.spec.height,f=Math.max(n.padding/2,g+18);s.push({id:i.id,points:[a,{x:m+20,y:a.y},{x:m+20,y:f},{x:r.x-20,y:f},{x:r.x-20,y:l.y},l]});continue}if(!e.has(i.id)&&(r.layer<d.layer||r.layer===d.layer&&l.x>a.x+12)){if(Math.abs(a.y-l.y)<.5){s.push({id:i.id,points:[a,l]});continue}const g=r.layer<d.layer?Math.max(a.x+14,d.x-Math.max(12,n.layerSpacing/2)):(a.x+l.x)/2;s.push({id:i.id,points:[a,{x:g,y:a.y},{x:g,y:l.y},l]});continue}const c=i.fromPort===void 0?{x:r.x+r.spec.width/2,y:r.y+r.spec.height}:a,h=i.toPort===void 0?{x:d.x+d.spec.width/2,y:d.y+d.spec.height}:l,p=Math.max(c.y,h.y)+18+o*14;o+=1;const u=[a,c,{x:c.x,y:p},{x:h.x,y:p},h,l].filter((m,g,f)=>g===0||m.x!==f[g-1]?.x||m.y!==f[g-1]?.y);s.push({id:i.id,points:u})}return s},Ko=(t,e,n)=>{const o=e.flatMap(p=>[...p.points]),s=[...t.map(p=>p.x),...t.map(p=>p.x+p.spec.width),...o.map(p=>p.x)],i=[...t.map(p=>p.y),...t.map(p=>p.y+p.spec.height),...o.map(p=>p.y)],r=Math.min(0,...s),d=Math.min(0,...i),a=Math.max(0,...s),l=Math.max(0,...i),c=n-r,h=n-d;return{width:a-r+n*2,height:l-d+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}))}))}},Bn=(t,e)=>{const n=new Map(t.map(o=>[o.id,[]]));for(const o of e)o.from!==o.to&&(n.get(o.from)?.push(o.to),n.get(o.to)?.push(o.from));return n},Ki=(t,e,n,o)=>t.map(s=>({spec:s,layer:e.get(s.id)??0,order:n.get(s.id)??0,...o(s)})),Vi=(t,e)=>{const n=new Map;for(const o of t){const s=e.get(o.id)??0,i=n.get(s);i?i.push(o.id):n.set(s,[o.id])}return n},ji=(t,e,n={})=>{if(t.some(g=>g.superGroup!==void 0))return zp(t,e,n);const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(g=>g.id)),i=e.filter(g=>s.has(g.from)&&s.has(g.to)),{forward:r,reversed:d}=Wo(t,i),a=Hi(t,r),l=Vi(t,a);Yi(l,Bn(t,i),a,o.sweeps);const c=new Map;for(const g of l.values())g.forEach((f,b)=>c.set(f,b));const h=Ki(t,a,c,()=>({x:0,y:0})),p=new Map(h.map(g=>[g.spec.id,g]));t.some(g=>g.group!==void 0||g.superGroup!==void 0)?Ep(t,l,p,Bn(t,i),a,c,o):wp(l,p,Bn(t,i),a,o);const u=[...l.keys()].sort((g,f)=>g-f);let m=0;for(const g of u){const f=Math.max(...(l.get(g)??[]).map(b=>p.get(b)?.spec.width??0));for(const b of l.get(g)??[]){const k=p.get(b);k&&(k.x=m)}m+=f+o.layerSpacing}return Ko(h,Fn(i,d,{byId:p,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},Ot=12,Qi=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),Zi=(t,e)=>{const n=Qi(t),o=Qi(e),s=o.x-n.x,i=o.y-n.y;return Math.abs(s)>=Math.abs(i)?s>=0?"right":"left":i>=0?"bottom":"top"},Ji=(t,e,n)=>Math.min(n,Math.max(e,t)),er=(t,e,n)=>{const o=Ji(n.y-t.y,Ot,Math.max(Ot,t.height-Ot)),s=t.height<=0?.5:o/t.height,i=t.x+Ji(s*t.width,Ot,Math.max(Ot,t.width-Ot));switch(e){case"left":return{x:t.x,y:t.y+o};case"right":return{x:t.x+t.width,y:t.y+o};case"top":return{x:i,y:t.y};case"bottom":return{x:i,y:t.y+t.height};default:return{x:t.x+t.width,y:t.y+o}}},Mp=(t,e,n)=>{if(t.length<=1)return t.map(c=>c.id);const o=t.map(c=>({id:c.id,width:c.width,height:c.height})),s=new Set(o.map(c=>c.id)),i=e.filter(c=>s.has(c.from)&&s.has(c.to)&&c.from!==c.to),{forward:r}=Wo(o,i),d=Hi(o,r),a=Vi(o,d);return Yi(a,Bn(o,i),d,n),[...a.keys()].sort((c,h)=>c-h).flatMap(c=>a.get(c)??[])},Tp=(t,e,n,o)=>{let s=0;for(let i=e;i<n;i++)s+=t[i].width;return s+o*Math.max(0,n-e-1)},Vo=(t,e,n)=>{const o=t.length,s=Math.max(1,Math.min(n,o)),i=Number.POSITIVE_INFINITY,r=Array.from({length:o+1},()=>Array.from({length:s+1},()=>i)),d=Array.from({length:o+1},()=>Array.from({length:s+1},()=>0));r[0][0]=0;for(let u=1;u<=s;u++)for(let m=u;m<=o;m++)for(let g=u-1;g<m;g++){const f=r[g][u-1];if(f===i)continue;const b=Math.max(f,Tp(t,g,m,e));b<r[m][u]&&(r[m][u]=b,d[m][u]=g)}const a=[];let l=o;for(let u=s;u>0;u--){const m=d[l][u];a.unshift(t.slice(m,l)),l=m}const c=new Map;let h=0,p=0;for(const u of a){let m=0;const g=Math.max(...u.map(f=>f.height));for(const f of u)c.set(f.id,{x:m,y:h}),m+=f.width+e;p=Math.max(p,m-e),h+=g+e}return{positions:c,width:p,height:Math.max(0,h-e)}},yt=1e-6,Un=(t,e)=>Math.abs(t.x-e.x)<yt&&Math.abs(t.y-e.y)<yt,Hn=(t,e,n)=>{const o=(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y);return Math.abs(o)<yt?0:o>0?1:-1},Yn=(t,e,n)=>Math.min(t.x,n.x)-yt<=e.x&&e.x<=Math.max(t.x,n.x)+yt&&Math.min(t.y,n.y)-yt<=e.y&&e.y<=Math.max(t.y,n.y)+yt,tr=(t,e)=>{const[n,o]=t,[s,i]=e;if(Un(n,s)||Un(n,i)||Un(o,s)||Un(o,i))return!1;const r=Hn(n,o,s),d=Hn(n,o,i),a=Hn(s,i,n),l=Hn(s,i,o);return r!==d&&a!==l||r===0&&Yn(n,s,o)||d===0&&Yn(n,i,o)||a===0&&Yn(s,n,i)?!0:l===0&&Yn(s,o,i)},nr=(t,e)=>{const n=t.x+t.width/2,o=t.y+t.height/2,s=e.x+e.width/2,i=e.y+e.height/2,r=s-n,d=i-o;return Math.abs(r)>=Math.abs(d)?{x:r>=0?t.x+t.width:t.x,y:o}:{x:n,y:d>=0?t.y+t.height:t.y}},Sp=(t,e,n)=>{const o=r=>{const d=t.positions.get(r),a=e.get(r);return!d||!a?null:{id:r,x:d.x,y:d.y,width:a.width,height:a.height}},s=[];let i=0;for(const r of n){if(r.from===r.to)continue;const d=o(r.from),a=o(r.to);if(!d||!a)continue;const l=nr(d,a),c=nr(a,d);if(l.x===c.x||l.y===c.y){const m=[l,c];i+=s.filter(g=>tr(m,g)).length,s.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 g=m.reduce((f,b)=>f+s.filter(k=>tr(b,k)).length,0);g<u&&(u=g,p=m)}i+=u,s.push(...p)}return i},Cp=(t,e,n)=>{const o=i=>{const r=t.positions.get(i),d=e.get(i);return!r||!d?null:{x:r.x+d.width/2,y:r.y+d.height/2}};let s=0;for(const i of n){if(i.from===i.to)continue;const r=o(i.from),d=o(i.to);r&&d&&(s+=Math.hypot(r.x-d.x,r.y-d.y))}return s},or=(t,e)=>{const n=t[0].x===t[1].x,o=e[0].x===e[1].x;if(n===o)return!1;const[s,i,r,d]=n?[t[0],t[1],e[0],e[1]]:[e[0],e[1],t[0],t[1]],a=s.x,l=r.y;return a>Math.min(r.x,d.x)&&a<Math.max(r.x,d.x)&&l>Math.min(s.y,i.y)&&l<Math.max(s.y,i.y)},sr=(t,e,n,o)=>{const s=n===void 0?void 0:t.ports?.[n];return s!==void 0?{x:e.x+s.x,y:e.y+s.y}:o==="out"?{x:e.x+t.width,y:e.y+t.height/2}:{x:e.x,y:e.y+t.height/2}},Ip=(t,e,n)=>{const o=new Map(t.map(r=>[r.id,r])),s=[];let i=0;for(const r of e){if(r.from===r.to)continue;const d=o.get(r.from),a=o.get(r.to),l=n.get(r.from),c=n.get(r.to);if(d===void 0||a===void 0||l===void 0||c===void 0)continue;const h={x:l.x,y:l.y,width:d.width,height:d.height},p={x:c.x,y:c.y,width:a.width,height:a.height},u=er(h,Zi(h,p),sr(d,l,r.fromPort,"out")),m=er(p,Zi(p,h),sr(a,c,r.toPort,"in")),g=x=>x.slice(1).map((I,y)=>[x[y],I]);if(u.x===m.x||u.y===m.y){const x=[u,m];i+=s.filter(I=>or(x,I)).length,s.push(x);continue}const f=[[u,{x:m.x,y:u.y},m],[u,{x:u.x,y:m.y},m]];let b=f[0],k=Number.POSITIVE_INFINITY;for(const x of f){const I=g(x).reduce((y,C)=>y+s.filter(T=>or(C,T)).length,0);I<k&&(b=x,k=I)}i+=k,s.push(...g(b))}return i},Gn={crossings:1e4,edgeLength:1,aspectDeviation:50},ir=50,Lp=Gn.aspectDeviation,jo=(t,e,n,o,s)=>{const i=t.width<=0||t.height<=0?0:Math.abs(Math.log(t.width/t.height/o));return Sp(t,e,n)*Gn.crossings+Cp(t,e,n)*Gn.edgeLength+i*s},Ap=function*(t){const e=[...t],n=e.length;if(yield[...e],n<=1)return;const o=Array.from({length:n}).fill(0);let s=0;for(;s<n;)if(o[s]<s){const i=s%2===0?0:o[s],r=e[i];e[i]=e[s],e[s]=r,yield[...e],o[s]=o[s]+1,s=0}else o[s]=0,s++},_p=7,Rp=400,Op=1e-6,Qo=(t,e,n,o,s=sn.sweeps,i=0,r=Gn.aspectDeviation,d=Rp)=>{if(t.length===0)return{positions:new Map,width:0,height:0};if(t.length===1){const y=t[0];return{positions:new Map([[y.id,{x:0,y:0}]]),width:y.width,height:y.height}}const a=new Map(t.map(y=>[y.id,{width:y.width,height:y.height}])),l=e.filter(y=>a.has(y.from)&&a.has(y.to)&&y.from!==y.to),c=y=>{const C=y.map(P=>({id:P,...a.get(P)}));let T=Vo(C,n,1),S=Number.POSITIVE_INFINITY,v=1;const M=i>0?Math.min(i,C.length):1,L=i>0?M:C.length;for(let P=M;P<=L;P++){const B=Vo(C,n,P);if(B.width<=0||B.height<=0)continue;const U=jo(B,a,l,o,r);U<S&&(S=U,T=B,v=P)}return{packed:T,cost:S,rowCount:v}},h=(y,C)=>Vo(y.map(T=>({id:T,...a.get(T)})),n,C),p=t.map(y=>y.id);if(p.length<=_p){let y=c(p);for(const C of Ap(p)){const T=c(C);T.cost<y.cost&&(y=T)}return y.packed}const u=i>0?Math.min(d,50):d;let m=Mp(t,l,s);const g=c(m),f=i>0?Math.min(i,m.length):g.rowCount;let b=i>0?h(m,f):g.packed,k=i>0?jo(b,a,l,o,r):g.cost,x=0,I=!0;for(;I&&x<u;){I=!1;for(let y=0;y<m.length-1&&x<u;y++){x++;const C=[...m],T=C[y];C[y]=C[y+1],C[y+1]=T;const S=h(C,f);if(S.width<=0||S.height<=0)continue;const v=jo(S,a,l,o,r);v<k-Op&&(k=v,b=S,m=C,I=!0)}}return b},Dp=(t,e,n,o,s)=>{if(n<=0&&o<=0||t.positions.size<=1)return t;const i=new Map;for(const[p,u]of t.positions){const m=i.get(u.y);m?m.push(p):i.set(u.y,[p])}const d=[...i.keys()].sort((p,u)=>p-u).map(p=>[...i.get(p)??[]].sort((u,m)=>(t.positions.get(u)?.x??0)-(t.positions.get(m)?.x??0))),a=new Map;let l=0,c=0,h=0;return d.forEach((p,u)=>{const m=d[u-1];if(m!==void 0){const f=p.some(s)||m.some(s);h+=f?n:0}let g=0;p.forEach((f,b)=>{const k=p[b-1];k!==void 0&&(g+=s(k)||s(f)?o:0);const x=t.positions.get(f),I=e.get(f);if(!x||!I)return;const y={x:x.x+g,y:x.y+h};a.set(f,y),l=Math.max(l,y.x+I.width),c=Math.max(c,y.y+I.height)})}),{positions:a,width:l,height:c}},rr=1.3,Np=1.45,zp=(t,e,n={})=>{const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(v=>v.id)),i=e.filter(v=>s.has(v.from)&&s.has(v.to)),r=v=>v.group??`__loose:${v.id}`,d=v=>v.superGroup??`__top:${v.id}`,a=new Map(t.map(v=>[v.id,r(v)])),l=new Map(t.map(v=>[v.id,d(v)])),c=new Map;for(const v of t){const M=r(v),L=c.get(M);L?L.push(v):c.set(M,[v])}const h=new Map;for(const[v,M]of c){const L=M[0];if(M.length===1&&L!==void 0){h.set(v,{size:{width:L.width,height:L.height},relative:new Map([[L.id,{x:0,y:0}]])});continue}const P=new Set(M.map($=>$.id)),B=i.filter($=>P.has($.from)&&P.has($.to)),U=Qo(M.map($=>({id:$.id,width:$.width,height:$.height})),B,o.nodeSpacing,rr,o.sweeps,0,ir);h.set(v,{size:{width:U.width,height:U.height},relative:U.positions})}const p=new Map;for(const[v,M]of c){const L=M[0];L!==void 0&&p.set(v,d(L))}const u=new Map;for(const[v,M]of p){const L=u.get(M);L?L.push(v):u.set(M,[v])}const m=new Map;for(const[v,M]of u){const L=M[0];if(M.length===1&&L!==void 0){const $=h.get(L);$&&m.set(v,{size:$.size,relative:new Map([[L,{x:0,y:0}]])});continue}const P=new Map(M.flatMap($=>h.has($)?[[$,h.get($).size]]:[])),B=i.flatMap($=>{const N=a.get($.from),z=a.get($.to);return N===void 0||z===void 0||N===z?[]:!M.includes(N)||!M.includes(z)?[]:[{id:$.id,from:N,to:z}]}),U=Qo(M.flatMap($=>P.has($)?[{id:$,...P.get($)}]:[]),B,o.groupSpacing,rr,o.sweeps,0,ir);m.set(v,{size:{width:U.width,height:U.height},relative:U.positions})}const g=new Map([...m].map(([v,M])=>[v,M.size])),f=[...m.keys()],b=new Set(t.flatMap(v=>v.superGroup===void 0?[]:[v.superGroup])),k=v=>{const M=new Map;for(const[L,P]of u){const B=v.get(L)??{x:0,y:0},U=m.get(L);for(const $ of P){const N=U?.relative.get($)??{x:0,y:0},z=h.get($);if(z)for(const[H,D]of z.relative)M.set(H,{x:B.x+N.x+D.x,y:B.y+N.y+D.y})}}return M};let x=new Map;if(f.length<=1)for(const v of f)x.set(v,{x:0,y:0});else{const v=i.flatMap(H=>{const D=l.get(H.from),F=l.get(H.to);return D===void 0||F===void 0||D===F?[]:[{id:H.id,from:D,to:F}]}),M=H=>Qo(f.map(D=>({id:D,...g.get(D)})),v,o.superGroupSpacing,Np,o.sweeps,H,Lp),L=M(o.superGroupRowCount),P=o.superGroupRowCount>0?[]:[1,2,3,4].filter(H=>H<=f.length),B=[L,...P.map(H=>M(H))],U=H=>{const D=Dp(H,g,o.superGroupRowGap,o.superGroupColumnGap,G=>b.has(G)),F=Ip(t,i,k(D.positions)),q=Math.min(1180/Math.max(1,D.width),900/Math.max(1,D.height),1);return{offsets:D.positions,crossings:F,fit:q}},$=B.map(U),N=$[0];let z=N;for(const H of $.slice(1))H.crossings>N.crossings*.8||H.fit<N.fit*.9||(H.crossings<z.crossings||H.crossings===z.crossings&&H.fit>z.fit)&&(z=H);x=new Map(z.offsets)}const I=k(x),y=Wo(t,i).reversed,C=t.map((v,M)=>{const L=I.get(v.id)??{x:0,y:0};return{spec:v,layer:0,order:M,x:L.x,y:L.y}}),T=new Map(C.map(v=>[v.spec.id,v])),S=Fn(i,y,{byId:T,layerSpacing:o.layerSpacing,padding:o.padding});return Ko(C,S,o.padding)},Pp=(t,e,n,o,s={})=>{if(e.size===0)return t;const i={...sn,...s},r=new Map(n.map(f=>[f.id,f])),d=t.nodes.map(f=>{const b=e.get(f.id);return b===void 0?f:{...f,x:b.x,y:b.y}}),a=new Map(d.map(f=>[f.id,{spec:r.get(f.id)??{id:f.id,width:f.width,height:f.height},layer:f.layer,order:f.order,x:f.x,y:f.y}])),l=new Set(d.map(f=>f.id)),c=o.filter(f=>l.has(f.from)&&l.has(f.to)),h=Fn(c,new Set,{byId:a,layerSpacing:i.layerSpacing,padding:i.padding}),p=[...d.map(f=>f.x+f.width),...h.flatMap(f=>f.points.map(b=>b.x))],u=[...d.map(f=>f.y+f.height),...h.flatMap(f=>f.points.map(b=>b.y))],m=Math.max(t.width,Math.max(0,...p)+i.padding),g=Math.max(t.height,Math.max(0,...u)+i.padding);return{width:m,height:g,nodes:d,routes:h}},ar=(t,e,n={})=>{const o={...sn,...n};if(t.length===0)return{width:0,height:0,nodes:[],routes:[]};const s=new Set(t.map(a=>a.id)),i=e.filter(a=>s.has(a.from)&&s.has(a.to)),r=Ki(t,new Map,new Map,a=>a.position??{x:0,y:0}),d=new Map(r.map(a=>[a.spec.id,a]));return Ko(r,Fn(i,new Set,{byId:d,layerSpacing:o.layerSpacing,padding:o.padding}),o.padding)},dr={kind:"idle"},qp=t=>({kind:"node",...t,moved:!1,preview:null}),Fp=t=>({kind:"group",...t,moved:!1,preview:null}),Bp=(t,e,n,o)=>{if(t.kind==="idle")return t;const s=e.screenX-t.origin.screenX,i=e.screenY-t.origin.screenY;if(!t.moved&&Math.hypot(s,i)<=o)return t;const r=s/n,d=i/n;if(t.kind==="node"){const l={x:Math.max(0,t.start.x+r),y:Math.max(0,t.start.y+d)};return{...t,moved:!0,preview:l}}const a=new Map;for(const[l,c]of t.starts)a.set(l,{x:Math.max(0,c.x+r),y:Math.max(0,c.y+d)});return{...t,moved:!0,preview:a}},lr=Me({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`}}),cr={v:1,overrides:[]},Zo="dpk-layout-change",Up=(t,e)=>t.board===e.board&&t.diagram===e.diagram&&t.node===e.node,pr=(t,e,n)=>({...t,overrides:[...t.overrides.filter(o=>!Up(o,e)),{...e,position:n}]}),Hp=(t,e)=>e.reduce((n,o)=>pr(n,o,o.position),t),Yp=(t,e,n)=>new Map(t.overrides.filter(o=>o.board===e&&o.diagram===n).map(o=>[o.node,o.position])),Gp=(t,e,n)=>t.overrides.some(o=>o.board===e&&o.diagram===n),Xp=(t,e,n)=>{const o=t.overrides.filter(s=>!(s.board===e&&s.diagram===n));return o.length===t.overrides.length?t:{...t,overrides:o}},Wp=(t,e,n,o)=>{const s=t.overrides.filter(i=>!(i.board===e&&i.diagram===n)||o.has(i.node));return s.length===t.overrides.length?t:{...t,overrides:s}},Kp=Y({x:$e(),y:$e()}),Vp=Y({board:w(),diagram:w(),node:w(),position:Kp}),jp=Y({v:Te(1),overrides:K(Vp)}),hr=t=>{const e=be(jp,t);return e.success?e.output:null},Qp=t=>`dev-process-kit:layout-positions:${t}`,Zp=()=>{const t=typeof location>"u"?"local":`${location.pathname}${location.search}`;return Qp(t)},Jp=()=>Lc(hr),eh=()=>Ic(hr),th=t=>t.closest(Ac)?.getAttribute(_c)??"";class nh{#t;#s;#e=null;#n="";#o=cr;#a=()=>this.#c();constructor(e,n){this.#t=e,this.#s=n,e.addController(this)}hostConnected(){this.#e=this.#s.persist===!1?eh():Jp(),this.#n=Zp(),this.#o=this.#e.read(this.#n)??cr,window.addEventListener(Zo,this.#a)}hostDisconnected(){window.removeEventListener(Zo,this.#a)}get#i(){return th(this.#s.host())}get#r(){return this.#s.diagram()}overrides(){return Yp(this.#o,this.#i,this.#r)}hasOverrides(){return Gp(this.#o,this.#i,this.#r)}commit(e,n){this.#o=pr(this.#o,{board:this.#i,diagram:this.#r,node:e},n),this.#d()}commitMany(e){if(e.size===0)return;const n=[...e].map(([o,s])=>({board:this.#i,diagram:this.#r,node:o,position:s}));this.#o=Hp(this.#o,n),this.#d()}prune(e){const n=Wp(this.#o,this.#i,this.#r,e);n!==this.#o&&(this.#o=n,this.#d())}reset(){const e=Xp(this.#o,this.#i,this.#r);e!==this.#o&&(this.#o=e,this.#d())}#d(){this.#e?.write(this.#n,this.#o),this.#t.requestUpdate(),window.dispatchEvent(new CustomEvent(Zo))}#c(){this.#o=this.#e?.read(this.#n)??this.#o,this.#t.requestUpdate()}}const oh=(t,e,n)=>`${t} ${n.node} \xB7 ${e} ${n.edge}`,Dt=[Rc,wi,$i,ve`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
container-type: inline-size;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag as l,
|
|
1
|
+
import{_ as G,a4 as E,a7 as D,O as I,i as Y,a3 as Et,a8 as V,ai as Dt,a5 as p,ag as l,aO as It,al as b,B as X,aj as At,be as Lt,r as Ot,q as Bt,w as J,u as qt,k as Mt}from"./shared-DE09J93T.js";import{o as Ut}from"./shared-D4PPk0Dk.js";import{m as _t,s as A,q as C,o as L,k as w,J as Q,v as y,w as k,j as g,A as O,h as T,n as Z,T as B,g as Nt,x as tt}from"./shared-DCnxYUIB.js";const zt={active:[],match:"single"},Pt=(s,t)=>t.active.length===0?!0:t.match==="all"?t.active.every(e=>s.includes(e)):t.active.some(e=>s.includes(e)),q=s=>{try{return s.split("/").map(t=>decodeURIComponent(t))}catch{return null}},et="BC:",jt=s=>`${et}${s}`,$={kind:"idle"},M="text/plain",Ht=s=>`${s.type}:${s.id}`,rt=(s,t)=>{const e=(s??"").trim();if(e.length===0)return null;const r=e.indexOf(":");if(r<0)return{type:t,id:e};const a=e.slice(0,r),i=e.slice(r+1);return a.length===0||i.length===0?null:{type:a,id:i}},st=(s,t)=>t<=s.top+s.height/2?"before":"after";class Ft{#e;#r=$;#n;constructor(t){this.#e=t,t.addController(this)}hostDisconnected(){this.reset()}get state(){return this.#r}get item(){return this.#r.kind==="dragging"?this.#r.item:null}isDragging(t,e){const r=this.item;return r!==null&&r.type===t&&r.id===e}isOver(t){return this.#r.kind!=="idle"&&this.#r.over===t}reset(){clearTimeout(this.#n),this.#n=void 0,this.#t($)}source(t){return{dragstart:e=>{e.dataTransfer&&(e.dataTransfer.setData(M,Ht(t)),e.dataTransfer.effectAllowed="move"),clearTimeout(this.#n),this.#n=setTimeout(()=>{this.#n=void 0,this.#t({kind:"dragging",item:t,over:null})},0)},dragend:()=>this.reset()}}target(t){return{dragenter:r=>{this.#i(t.accepts)&&(r.preventDefault(),this.#a(t.key))},dragover:r=>{this.#i(t.accepts)&&(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),this.#a(t.key))},dragleave:()=>{this.isOver(t.key)&&this.#a(null)},drop:r=>{r.preventDefault();const a=rt(r.dataTransfer?.getData(M),t.accepts)??this.item;if(this.#t($),!a||a.type!==t.accepts)return;const i=t.hovered?.(r)??null;t.onDrop({item:{type:t.accepts,id:a.id},hoveredId:i?.id??null,place:i?st(i.element.getBoundingClientRect(),r.clientY):"end",event:r})}}}combine(t,e){const r=()=>{const a=this.item!==null;return e.flatMap(([i,o])=>a||i===t?[o]:[])};return{dragenter:a=>r().forEach(i=>i.dragenter(a)),dragover:a=>r().forEach(i=>i.dragover(a)),dragleave:()=>e.forEach(([,a])=>a.dragleave()),drop:a=>{const i=rt(a.dataTransfer?.getData(M),t)?.type??this.item?.type,o=e.find(([n])=>n===i)?.[1];if(o){o.drop(a);return}a.preventDefault(),this.#t($)}}}#i(t){const e=this.item;return e===null||e.type===t}#a(t){const e=this.#r;if(e.kind==="dragging"){e.over!==t&&this.#t({...e,over:t});return}if(t===null){e.kind==="receiving"&&this.#t($);return}(e.kind==="idle"||e.over!==t)&&this.#t({kind:"receiving",over:t})}#t(t){this.#r!==t&&(this.#r=t,this.#e.requestUpdate())}}const R=(s,t,e,r)=>{const i=s.filter(c=>c!==t).at(-1)??null;if(e===null||r==="end")return i;const o=s.indexOf(t),n=s.indexOf(e);if(n<0)return i;const d=c=>c<=0?null:s.at(c-1)??null;return o>=0?o<n?e:d(n):r==="after"?e:d(n)},at=(s,t)=>new Intl.DateTimeFormat(s,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)),Kt=G({en:{heading:"Comments",commentsOn:s=>`Comments on \u201C${s}\u201D`,commentCountAria:s=>`${s} comment${s===1?"":"s"}`,empty:"No comments yet.",add:"Add comment",cancel:"Cancel",deleteComment:"Delete comment",sendFailed:"Could not save the comment.",commentDate:s=>at("en-US",s)},ja:{heading:"\u30B3\u30E1\u30F3\u30C8",commentsOn:s=>`\u300C${s}\u300D\u306E\u30B3\u30E1\u30F3\u30C8`,commentCountAria:s=>`\u30B3\u30E1\u30F3\u30C8 ${s} \u4EF6`,empty:"\u30B3\u30E1\u30F3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",add:"\u30B3\u30E1\u30F3\u30C8\u3092\u8FFD\u52A0",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",deleteComment:"\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664",sendFailed:"\u30B3\u30E1\u30F3\u30C8\u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentDate:s=>at("ja-JP",s)}}),Wt=E`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as se,m as le,q as v,k as E,h as D,C as A,B as l,j as c,v as L,w as S,d as h,o as f,e as ce,p as pe,b as B,f as $}from"./shared-CJZKj_HI.js";import{ap as ue,_ as ge,L as z,aK as me,a0 as ve,$ as he,a5 as p,u as be,ag as s,al as ke,aq as ye,B as fe,aL as $e,a4 as xe,V as q,aM as we,k as Ee}from"./shared-_0Ev6y6i.js";import{o as De}from"./shared-lVXxL9i3.js";const b=[1,2,3,4,5,6,7],k=se(b,"a delegation level is an integer from 1 to 7"),y=L(c(),S(1)),Ae=v({player:y,level:k,reason:l(c())}),M=v({title:l(c()),parties:l(v({delegator:l(y),delegate:l(y)})),players:E(D(v({id:A,name:y})),[]),decisions:E(D(v({id:A,name:y,description:l(c()),cards:E(D(Ae),[]),agreed:l(k),questions:ue})),[])}),V=e=>{const a=le(M,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},K=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},j=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:h("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:h("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:h("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:ce}),SET_DECISION_NAME:h("SET_DECISION_NAME","decision",f({name:L(c(),S(1))})),DELETE_DECISION:h("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},F=(e,a)=>{const r=pe(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:C(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,Y={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},G={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Le={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},Se={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Ce[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>G[e],levelPhrase:(e,a,r)=>Se[e](a,r),levelLabel:e=>`${e} ${G[e]}`,statusLabel:e=>Te[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,H=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:j(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:b.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:b.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Ne(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},U=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),W={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:U(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:U(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:Ie(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},Q=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(W,a.type)?W[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},X=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:F,hasTarget:re,describe:(r,o,t)=>Q(a,r,o,t),serialize:X,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):he(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
1
|
+
import{x as se,m as le,q as v,k as E,h as D,C as A,B as l,j as c,v as L,w as S,d as h,o as f,e as ce,p as pe,b as B,f as $}from"./shared-DCnxYUIB.js";import{ap as ue,_ as ge,L as z,aW as me,a0 as ve,$ as he,a5 as p,u as be,ag as s,al as ke,aq as ye,B as fe,aX as $e,a4 as xe,V as q,aY as we,k as Ee}from"./shared-DE09J93T.js";import{o as De}from"./shared-C1sWnXGY.js";const b=[1,2,3,4,5,6,7],k=se(b,"a delegation level is an integer from 1 to 7"),y=L(c(),S(1)),Ae=v({player:y,level:k,reason:l(c())}),M=v({title:l(c()),parties:l(v({delegator:l(y),delegate:l(y)})),players:E(D(v({id:A,name:y})),[]),decisions:E(D(v({id:A,name:y,description:l(c()),cards:E(D(Ae),[]),agreed:l(k),questions:ue})),[])}),V=e=>{const a=le(M,e),r=new Set;for(const t of a.players){if(r.has(t.id))throw new Error(`duplicate id "${t.id}" in players`);r.add(t.id)}const o=new Set;for(const t of a.decisions){if(o.has(t.id))throw new Error(`duplicate id "${t.id}" in decisions`);o.add(t.id);const i=new Set;for(const d of t.cards){if(!r.has(d.player))throw new Error(`decision "${t.id}" has a card from unknown player "${d.player}"`);if(i.has(d.player))throw new Error(`player "${d.player}" played more than one card on decision "${t.id}"`);i.add(d.player)}}return a},K=()=>({players:[],decisions:[]}),u=(e,a)=>{if(a!==void 0)return e.decisions.find(r=>r.id===a)},j=(e,a)=>e.players.find(r=>r.id===a),C=e=>[...e.players.map(a=>a.id),...e.decisions.map(a=>a.id)],x="delegation-poker",g={PLAY_CARD:h("PLAY_CARD","decision",v({level:k})),AGREE_LEVEL:h("AGREE_LEVEL","decision",f({level:k})),ADD_DECISION:h("ADD_DECISION","page",f({id:A,name:L(c(),S(1)),description:l(c())}),{dedupeKey:ce}),SET_DECISION_NAME:h("SET_DECISION_NAME","decision",f({name:L(c(),S(1))})),DELETE_DECISION:h("DELETE_DECISION","decision",f({}))},m={playCard:(e,a)=>({type:"PLAY_CARD",target:{type:"decision",id:e},payload:{level:a}}),agreeLevel:(e,a)=>({type:"AGREE_LEVEL",target:{type:"decision",id:e},payload:{level:a}}),addDecision:(e,a)=>({type:"ADD_DECISION",target:{type:"page",id:x},payload:{id:e,name:a}}),setDecisionName:(e,a)=>({type:"SET_DECISION_NAME",target:{type:"decision",id:e},payload:{name:a}}),deleteDecision:e=>({type:"DELETE_DECISION",target:{type:"decision",id:e},payload:{}})},F=(e,a)=>{const r=pe(g,a);if(r===null)return null;const o=r.target.id;switch(r.type){case"PLAY_CARD":return T(e,o,t=>({...t,yours:r.payload.level}));case"AGREE_LEVEL":return T(e,o,t=>({...t,agreed:r.payload.level}));case"ADD_DECISION":{const t=r.payload;return e.decisions.some(i=>i.id===t.id)?e:C(e).includes(t.id)?null:{...e,decisions:[...e.decisions,{id:t.id,name:t.name,...t.description===void 0?{}:{description:t.description},cards:[]}]}}case"SET_DECISION_NAME":return T(e,o,t=>({...t,name:r.payload.name}));case"DELETE_DECISION":return e.decisions.some(t=>t.id===o)?{...e,decisions:e.decisions.filter(t=>t.id!==o)}:null;default:return B(r)}},T=(e,a,r)=>e.decisions.some(o=>o.id===a)?{...e,decisions:e.decisions.map(o=>o.id===a?r(o):o)}:null,Y={1:"Tell",2:"Sell",3:"Consult",4:"Agree",5:"Advise",6:"Inquire",7:"Delegate"},G={1:"\u547D\u4EE4\u3059\u308B",2:"\u8AAC\u5F97\u3059\u308B",3:"\u76F8\u8AC7\u3059\u308B",4:"\u5408\u610F\u3059\u308B",5:"\u52A9\u8A00\u3059\u308B",6:"\u5C0B\u306D\u308B",7:"\u59D4\u4EFB\u3059\u308B"},Le={1:(e,a)=>`${e} decide and tell ${a}`,2:(e,a)=>`${e} decide and convince ${a}`,3:(e,a)=>`${e} decide after hearing ${a}`,4:(e,a)=>`${e} and ${a} decide together`,5:(e,a)=>`${a} decides after ${e} advise`,6:(e,a)=>`${a} decides, then ${e} ask why`,7:(e,a)=>`${a} decides; ${e} need not know`},Se={1:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u4F1D\u3048\u308B`,2:(e,a)=>`${e}\u304C\u6C7A\u3081\u3066\u3001${a}\u306B\u7D0D\u5F97\u3057\u3066\u3082\u3089\u3046`,3:(e,a)=>`${e}\u304C${a}\u306E\u610F\u898B\u3092\u805E\u3044\u3066\u304B\u3089\u6C7A\u3081\u308B`,4:(e,a)=>`${e}\u3068${a}\u304C\u4E00\u7DD2\u306B\u6C7A\u3081\u308B`,5:(e,a)=>`${e}\u304C\u52A9\u8A00\u3057\u3001${a}\u304C\u6C7A\u3081\u308B`,6:(e,a)=>`${a}\u304C\u6C7A\u3081\u3001\u3042\u3068\u3067${e}\u304C\u7406\u7531\u3092\u5C0B\u306D\u308B`,7:(e,a)=>`${a}\u304C\u6C7A\u3081\u308B\u3002${e}\u306F\u77E5\u3089\u306A\u304F\u3066\u3088\u3044`},Ce={"to-play":"Your card",discuss:"Discuss",consensus:"Same card",agreed:"Agreed"},Te={"to-play":"\u30AB\u30FC\u30C9\u5F85\u3061",discuss:"\u8981\u8B70\u8AD6",consensus:"\u4E00\u81F4",agreed:"\u5408\u610F\u6E08\u307F"},_=ge({en:{levelName:e=>Y[e],levelPhrase:(e,a,r)=>Le[e](a,r),levelLabel:e=>`${e} ${Y[e]}`,statusLabel:e=>Ce[e],defaultDelegator:"Leaders",defaultDelegate:"Team",you:"You",progress:(e,a,r)=>`Played ${e}/${r} \xB7 Agreed ${a}/${r}`,partiesLabel:"Who delegates to whom",board:"Delegation board",boardHint:e=>e==="strict"?"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it, and your card cannot be changed afterwards.":"Click a cell to play your card for that decision area. The other cards on a row stay face down until you play on it; you can still change your card afterwards.",modeLabel:e=>e==="strict"?"One card only":"Card can be changed",modeTitle:e=>e==="strict"?"Strict mode: a card, once played, is final":"Lax mode: you may change your card after seeing the others",locked:"Final",confirmTitle:"Your card is final",confirmBody:(e,a)=>`You are playing ${e} on \u201C${a}\u201D. On this board a card cannot be changed once played, even after you see the others.`,confirmSkip:"Don\u2019t ask again",confirmPlay:"Play this card",confirmCancel:"Cancel",decisionColumn:"Decision area",agreeColumn:"Agreed",notAgreed:"Not yet",agreeLabel:e=>`Agreed level for \u201C${e}\u201D`,playAt:(e,a)=>`Play ${e} on \u201C${a}\u201D`,hiddenCards:e=>`${e} face down`,addDecision:"+ Decision area",newDecision:"New decision area",noDecisionsTitle:"No decision areas yet",noDecisionsBody:"List the key decisions whose ownership is unclear. For each one, everyone plays one of seven cards, from 1 (the delegator decides alone) to 7 (fully delegated), and then settles on one level.",firstDecision:"+ First decision area",commentCount:e=>`${e} comments`,decisionNameLabel:"Decision area name",commentButton:"Comment",deleteButton:"Delete",cardPlayedTitle:"Played a card",levelAgreedTitle:"Agreed on a level",decisionAddedTitle:"Added a decision area",decisionRenamedTitle:"Renamed the decision area",decisionDeletedTitle:"Deleted the decision area",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u201C${e}\u201D`,quotedArrowFrom:(e,a)=>`\u201C${e}\u201D \u2192 \u201C${a}\u201D`,added:e=>`+ \u201C${e}\u201D`,deleted:e=>`\u2212 \u201C${e}\u201D`,decisionKind:"Decision area",boardKind:"Board",wholeBoard:"Whole board"},ja:{levelName:e=>G[e],levelPhrase:(e,a,r)=>Se[e](a,r),levelLabel:e=>`${e} ${G[e]}`,statusLabel:e=>Te[e],defaultDelegator:"\u30EA\u30FC\u30C0\u30FC",defaultDelegate:"\u30C1\u30FC\u30E0",you:"\u3042\u306A\u305F",progress:(e,a,r)=>`\u63D0\u51FA ${e}/${r} \xB7 \u5408\u610F ${a}/${r}`,partiesLabel:"\u8AB0\u304C\u8AB0\u306B\u4EFB\u305B\u308B\u304B",board:"\u30C7\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30DC\u30FC\u30C9",boardHint:e=>e==="strict"?"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u3042\u3068\u304B\u3089\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002":"\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u305D\u306E\u5224\u65AD\u9818\u57DF\u306B\u3042\u306A\u305F\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u307E\u3067\u305D\u306E\u884C\u306E\u4ED6\u306E\u30AB\u30FC\u30C9\u306F\u4F0F\u305B\u305F\u307E\u307E\u3067\u3059\u3002\u51FA\u3057\u305F\u3042\u3068\u3082\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",modeLabel:e=>e==="strict"?"\u51FA\u3057\u76F4\u3057\u4E0D\u53EF":"\u51FA\u3057\u76F4\u3057\u53EF",modeTitle:e=>e==="strict"?"strict \u30E2\u30FC\u30C9: \u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u5909\u66F4\u3067\u304D\u307E\u305B\u3093":"lax \u30E2\u30FC\u30C9: \u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u30AB\u30FC\u30C9\u3092\u5909\u66F4\u3067\u304D\u307E\u3059",locked:"\u78BA\u5B9A",confirmTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3059\u3068\u5909\u66F4\u3067\u304D\u307E\u305B\u3093",confirmBody:(e,a)=>`\u300C${a}\u300D\u306B\u300C${e}\u300D\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u307E\u3059\u3002\u3053\u306E\u30DC\u30FC\u30C9\u3067\u306F\u3001\u4E00\u5EA6\u51FA\u3057\u305F\u30AB\u30FC\u30C9\u306F\u4ED6\u306E\u4EBA\u306E\u30AB\u30FC\u30C9\u3092\u898B\u305F\u3042\u3068\u3067\u3082\u5909\u66F4\u3067\u304D\u307E\u305B\u3093\u3002`,confirmSkip:"\u6B21\u56DE\u304B\u3089\u78BA\u8A8D\u3057\u306A\u3044",confirmPlay:"\u3053\u306E\u30AB\u30FC\u30C9\u3092\u51FA\u3059",confirmCancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",decisionColumn:"\u5224\u65AD\u9818\u57DF",agreeColumn:"\u5408\u610F",notAgreed:"\u672A\u5408\u610F",agreeLabel:e=>`\u300C${e}\u300D\u306E\u5408\u610F\u30EC\u30D9\u30EB`,playAt:(e,a)=>`\u300C${a}\u300D\u306B ${e} \u3092\u51FA\u3059`,hiddenCards:e=>`\u4F0F\u305B\u672D ${e} \u679A`,addDecision:"+ \u5224\u65AD\u9818\u57DF",newDecision:"\u65B0\u3057\u3044\u5224\u65AD\u9818\u57DF",noDecisionsTitle:"\u5224\u65AD\u9818\u57DF\u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093",noDecisionsBody:"\u8AB0\u304C\u6C7A\u3081\u308B\u306E\u304B\u304C\u66D6\u6627\u306A\u5224\u65AD\u3092\u4E26\u3079\u307E\u3059\u3002\u5224\u65AD\u3054\u3068\u306B\u5168\u54E1\u304C 1\uFF08\u4EFB\u305B\u308B\u5074\u3060\u3051\u3067\u6C7A\u3081\u308B\uFF09\u301C 7\uFF08\u5B8C\u5168\u306B\u4EFB\u305B\u308B\uFF09\u306E\u30AB\u30FC\u30C9\u3092 1 \u679A\u51FA\u3057\u3001\u8A71\u3057\u5408\u3063\u3066 1 \u3064\u306E\u30EC\u30D9\u30EB\u306B\u5408\u610F\u3057\u307E\u3059\u3002",firstDecision:"+ \u6700\u521D\u306E\u5224\u65AD\u9818\u57DF",commentCount:e=>`\u30B3\u30E1\u30F3\u30C8 ${e} \u4EF6`,decisionNameLabel:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D",commentButton:"\u30B3\u30E1\u30F3\u30C8",deleteButton:"\u524A\u9664",cardPlayedTitle:"\u30AB\u30FC\u30C9\u3092\u51FA\u3057\u305F",levelAgreedTitle:"\u30EC\u30D9\u30EB\u306B\u5408\u610F",decisionAddedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u8FFD\u52A0",decisionRenamedTitle:"\u5224\u65AD\u9818\u57DF\u306E\u540D\u524D\u3092\u5909\u66F4",decisionDeletedTitle:"\u5224\u65AD\u9818\u57DF\u3092\u524A\u9664",arrowTo:e=>`\u2192 ${e}`,arrowFrom:(e,a)=>`${e} \u2192 ${a}`,quotedArrowTo:e=>`\u2192 \u300C${e}\u300D`,quotedArrowFrom:(e,a)=>`\u300C${e}\u300D\u2192\u300C${a}\u300D`,added:e=>`+ \u300C${e}\u300D`,deleted:e=>`\u2212 \u300C${e}\u300D`,decisionKind:"\u5224\u65AD\u9818\u57DF",boardKind:"\u30DC\u30FC\u30C9",wholeBoard:"\u30DC\u30FC\u30C9\u5168\u4F53"}}),P=e=>e==="strict"?"strict":"lax",N=(e,a)=>e==="strict"&&a.yours!==void 0,H=(e,a,r)=>e==="lax"?{kind:"play"}:N(e,a)?{kind:"locked"}:r?{kind:"play"}:{kind:"confirm"},I=(e,a)=>({delegator:a.parties?.delegator??e.defaultDelegator,delegate:a.parties?.delegate??e.defaultDelegate}),J=e=>e.yours!==void 0||e.agreed!==void 0,_e=(e,a,r)=>[...r.yours===void 0?[]:[{label:e.you,kind:"you",level:r.yours}],...r.cards.map(t=>({label:j(a,t.player)?.name??t.player,kind:"player",level:t.level,...t.reason===void 0?{}:{reason:t.reason}}))],Pe=(e,a)=>e.agreed!==void 0?"agreed":e.yours===void 0?"to-play":a.every(r=>r.level===e.yours)?"consensus":"discuss",Ne=(e,a,r,o)=>{const t=_e(e,a,o),i=J(o)?t:[];return{id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},status:Pe(o,t),hidden:J(o)?0:o.cards.length,...o.agreed===void 0?{}:{agreed:o.agreed},locked:N(r,o),...me(o.questions),cells:b.map(d=>({level:d,chips:i.filter(n=>n.level===d).map(({level:n,...w})=>w),yours:o.yours===d,agreed:o.agreed===d}))}},O=(e,a,r)=>{const{delegator:o,delegate:t}=I(e,a);return{levels:b.map(i=>({level:i,name:e.levelName(i),label:e.levelLabel(i),phrase:e.levelPhrase(i,o,t)})),rows:a.decisions.map(i=>Ne(e,a,r,i)),progress:{played:a.decisions.filter(i=>i.yours!==void 0).length,agreed:a.decisions.filter(i=>i.agreed!==void 0).length,total:a.decisions.length}}},W=(e,a,r)=>{const o=r===void 0?"":e.levelLabel(r);return a===void 0?e.arrowTo(o):e.arrowFrom(e.levelLabel(a),o)},Ie=(e,a,r)=>a===void 0?e.quotedArrowTo(r):e.quotedArrowFrom(a,r),U={PLAY_CARD:(e,a,r)=>{const o=$(g.PLAY_CARD,a);return{title:e.cardPlayedTitle,tone:"update",body:W(e,u(r,a.target.id)?.yours,o.level)}},AGREE_LEVEL:(e,a,r)=>({title:e.levelAgreedTitle,tone:"update",body:W(e,u(r,a.target.id)?.agreed,$(g.AGREE_LEVEL,a).level)}),ADD_DECISION:(e,a)=>({title:e.decisionAddedTitle,tone:"create",body:e.added(String($(g.ADD_DECISION,a).name??""))}),SET_DECISION_NAME:(e,a,r)=>({title:e.decisionRenamedTitle,tone:"update",body:Ie(e,u(r,a.target.id)?.name,String($(g.SET_DECISION_NAME,a).name??""))}),DELETE_DECISION:(e,a,r)=>({title:e.decisionDeletedTitle,tone:"delete",body:e.deleted(u(r,a.target.id)?.name??a.target.id)})},X=(e,a,r,o)=>{let t;try{const i=Object.hasOwn(U,a.type)?U[a.type]:void 0;t=i?i(e,a,o??r):{title:a.type,tone:"meta"}}catch{t={title:a.type,tone:"meta"}}return{title:t.title,targetLabel:Z(e,r,a.target),tone:t.tone,...t.body===void 0?{}:{summary:t.body}}},Q=e=>`${e.type} ${z(e.target)} ${JSON.stringify(e.payload)}`,Z=(e,a,r)=>{switch(r.type){case"decision":{const o=u(a,r.id);return o?`${e.decisionKind} \xB7 ${o.name}`:`${e.decisionKind} \xB7 ${r.id} (missing)`}case"page":return`${e.boardKind} \xB7 ${R(a)}`;default:return`${r.type} \xB7 ${r.id}`}},ee=(e,a,r)=>[{value:`page:${x}`,label:e.wholeBoard,group:e.boardKind},...a.decisions.map(o=>({value:z({type:"decision",id:o.id}),label:o.name,group:e.decisionKind}))],R=e=>e.title??"Delegation Poker",ae=(e,a)=>a,re=(e,a)=>{switch(a.type){case"decision":return u(e,a.id)!==void 0;case"page":return a.id===x;default:return!1}},oe=e=>{const a=_(e);return{kind:"view",name:"delegation-poker",label:"Delegation Poker",addable:!1,parseBase:V,emptyBase:K,actions:g,apply:F,hasTarget:re,describe:(r,o,t)=>X(a,r,o,t),serialize:Q,resolveNavigation:ae,commentTargets:(r,o)=>ee(a,r),title:R}},te="dev-process-kit:delegation-poker:skip-strict-confirm",ie=e=>e===!0?!0:null,Oe=e=>{const a=e?ve(ie):he(ie);return{read:()=>a.read(te)===!0,remember:()=>a.write(te,!0)}},Re=(e,a,r,o)=>s`
|
|
2
2
|
<button
|
|
3
3
|
class="dpk-icon-btn"
|
|
4
4
|
type="button"
|
|
@@ -599,4 +599,4 @@ ${i} \u2192 ${d}`}
|
|
|
599
599
|
.empty .dpk-btn {
|
|
600
600
|
justify-self: start;
|
|
601
601
|
}
|
|
602
|
-
`;class de extends q{static{this.styles=[q.styles,Ge]}static{this.properties={mode:{type:String},pending:{state:!0},skipConfirm:{state:!0}}}#a=null;#e=null;#r=new we(this);constructor(){super(),this.mode=null,this.pending=null,this.skipConfirm=!1}connectedCallback(){super.connectedCallback(),this.#a=Oe(this.storage!=="off"&&this.storage!=="memory"),this.skipConfirm=this.#a.read()}definitionFor(a){return oe(a)}renderRegions(a){const r=_(this.locale),o=this.#o(a,r),t={context:a,handlers:o,m:r,mode:P(this.mode),agreeSelects:this.#r},i=a.state.decisions.length===0?ze(t):qe(t);return{header:Be(t),main:s`${i}${Ye(r,this.pending,this.#t(a))}`}}updated(){super.updated();const a=this.#e;if(a!==null){if(this.#e=null,a==="dialog"){this.renderRoot.querySelector('[data-testid="confirm-play-ok"]')?.focus();return}this.renderRoot.querySelector(`[data-decision="${a.decisionId}"] .cell-play[data-level="${a.level}"]`)?.focus()}}#o(a,r){return{play:(o,t)=>{const i=a.state.decisions.find(n=>n.id===o);if(i===void 0)return;const d=H(P(this.mode),i,this.skipConfirm);switch(d.kind){case"play":a.dispatch(m.playCard(o,t));return;case"confirm":this.pending={decisionId:o,decisionName:i.name,level:t,skip:!1},this.#e="dialog";return;case"locked":return;default:B(d)}},agree:(o,t)=>{a.dispatch(m.agreeLevel(o,t))},addDecision:()=>{const o=Ee("decision",C(a.state));a.dispatch(m.addDecision(o,r.newDecision))},rename:(o,t)=>{a.dispatch(m.setDecisionName(o,t))},deleteDecision:o=>{a.dispatch(m.deleteDecision(o))},comment:o=>this.requestComment(o)}}#t(a){const r=o=>{this.pending=null,this.#e={decisionId:o.decisionId,level:o.level}};return{toggleSkip:o=>{this.pending!==null&&(this.pending={...this.pending,skip:o})},confirm:()=>{const o=this.pending;o!==null&&(o.skip&&(this.#a?.remember(),this.skipConfirm=!0),a.dispatch(m.playCard(o.decisionId,o.level)),r(o))},cancel:()=>{this.pending!==null&&r(this.pending)}}}}const ne=()=>{customElements.get("dpk-view-delegation-poker")||customElements.define("dpk-view-delegation-poker",de)},He=Object.freeze(Object.defineProperty({__proto__:null,DELEGATION_LEVELS:b,DELEGATION_POKER_PAGE:x,DpkViewDelegationPoker:de,allDelegationPokerIds:C,applyDelegationPokerAction:F,defineDelegationPokerElement:ne,delegationLevelSchema:k,delegationParties:I,delegationPokerAction:m,delegationPokerActions:g,delegationPokerBaseSchema:M,delegationPokerCommentTargets:ee,delegationPokerDefinitionFor:oe,delegationPokerHasTarget:re,delegationPokerMessages:_,delegationPokerTargetLabel:Z,delegationPokerTitle:R,describeDelegationPokerAction:
|
|
602
|
+
`;class de extends q{static{this.styles=[q.styles,Ge]}static{this.properties={mode:{type:String},pending:{state:!0},skipConfirm:{state:!0}}}#a=null;#e=null;#r=new we(this);constructor(){super(),this.mode=null,this.pending=null,this.skipConfirm=!1}connectedCallback(){super.connectedCallback(),this.#a=Oe(this.storage!=="off"&&this.storage!=="memory"),this.skipConfirm=this.#a.read()}definitionFor(a){return oe(a)}renderRegions(a){const r=_(this.locale),o=this.#o(a,r),t={context:a,handlers:o,m:r,mode:P(this.mode),agreeSelects:this.#r},i=a.state.decisions.length===0?ze(t):qe(t);return{header:Be(t),main:s`${i}${Ye(r,this.pending,this.#t(a))}`}}updated(){super.updated();const a=this.#e;if(a!==null){if(this.#e=null,a==="dialog"){this.renderRoot.querySelector('[data-testid="confirm-play-ok"]')?.focus();return}this.renderRoot.querySelector(`[data-decision="${a.decisionId}"] .cell-play[data-level="${a.level}"]`)?.focus()}}#o(a,r){return{play:(o,t)=>{const i=a.state.decisions.find(n=>n.id===o);if(i===void 0)return;const d=H(P(this.mode),i,this.skipConfirm);switch(d.kind){case"play":a.dispatch(m.playCard(o,t));return;case"confirm":this.pending={decisionId:o,decisionName:i.name,level:t,skip:!1},this.#e="dialog";return;case"locked":return;default:B(d)}},agree:(o,t)=>{a.dispatch(m.agreeLevel(o,t))},addDecision:()=>{const o=Ee("decision",C(a.state));a.dispatch(m.addDecision(o,r.newDecision))},rename:(o,t)=>{a.dispatch(m.setDecisionName(o,t))},deleteDecision:o=>{a.dispatch(m.deleteDecision(o))},comment:o=>this.requestComment(o)}}#t(a){const r=o=>{this.pending=null,this.#e={decisionId:o.decisionId,level:o.level}};return{toggleSkip:o=>{this.pending!==null&&(this.pending={...this.pending,skip:o})},confirm:()=>{const o=this.pending;o!==null&&(o.skip&&(this.#a?.remember(),this.skipConfirm=!0),a.dispatch(m.playCard(o.decisionId,o.level)),r(o))},cancel:()=>{this.pending!==null&&r(this.pending)}}}}const ne=()=>{customElements.get("dpk-view-delegation-poker")||customElements.define("dpk-view-delegation-poker",de)},He=Object.freeze(Object.defineProperty({__proto__:null,DELEGATION_LEVELS:b,DELEGATION_POKER_PAGE:x,DpkViewDelegationPoker:de,allDelegationPokerIds:C,applyDelegationPokerAction:F,defineDelegationPokerElement:ne,delegationLevelSchema:k,delegationParties:I,delegationPokerAction:m,delegationPokerActions:g,delegationPokerBaseSchema:M,delegationPokerCommentTargets:ee,delegationPokerDefinitionFor:oe,delegationPokerHasTarget:re,delegationPokerMessages:_,delegationPokerTargetLabel:Z,delegationPokerTitle:R,describeDelegationPokerAction:X,emptyDelegationPokerBase:K,findDecision:u,findPlayer:j,isLocked:N,parseDelegationPokerBase:V,parsePlayMode:P,playIntent:H,presentBoard:O,resolveDelegationPokerNavigation:ae,serializeDelegationPokerAction:Q},Symbol.toStringTag,{value:"Module"}));export{ne as d,He as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a5 as r}from"./shared-DE09J93T.js";const t=o=>o??r;export{t as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as S,L as T,V as _}from"./shared-
|
|
1
|
+
import{_ as S,L as T,V as _}from"./shared-DE09J93T.js";import{m as j,q as a,k as o,h as k,j as l,C as B,v as E,w as $}from"./shared-DCnxYUIB.js";const r=S({en:{wholePage:"Whole page",sectionGroup:"Section"},ja:{wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",sectionGroup:"\u30BB\u30AF\u30B7\u30E7\u30F3"}}),x=a({id:B,title:E(l(),$(1))}),c=a({title:o(l(),""),sections:o(k(x),[])}),p=t=>{const e=j(c,t),i=new Set;for(const n of e.sections){if(i.has(n.id))throw new Error(`duplicate section id: ${n.id}`);i.add(n.id)}return{title:e.title,sections:e.sections}},d=()=>({title:"",sections:[]}),s=(t,e)=>t.sections.find(i=>i.id===e),m=t=>t.title===""?"Plain":t.title,u=(t,e,i)=>{switch(i.type){case"section":return s(e,i.id)?.title??i.id;case"page":return t.wholePage;default:return i.id}},g=(t,e,i)=>({title:e.type,targetLabel:u(t,i,e.target),tone:"meta"}),f=t=>`${t.type} ${T(t.target)} ${JSON.stringify(t.payload)}`,h=(t,e)=>e.sections.map(i=>({value:`section:${i.id}`,label:i.title,group:t.sectionGroup})),w=(t,e)=>e,y=(t,e)=>{switch(e.type){case"section":return s(t,e.id)!==void 0;case"page":return!0;default:return!1}},P=t=>{const e=r(t);return{kind:"view",name:"plain",label:"Plain",addable:!1,parseBase:p,emptyBase:d,actions:{},apply:()=>null,hasTarget:y,describe:(i,n)=>g(e,i,n),serialize:f,resolveNavigation:w,commentTargets:i=>h(e,i),title:m}};class b extends _{definitionFor(e){return P(e)}renderRegions(e){return{}}}const v=()=>{customElements.get("dpk-view-plain")||customElements.define("dpk-view-plain",b)},L=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPlain:b,definePlainElement:v,describePlainAction:g,emptyPlainBase:d,findSection:s,parsePlainBase:p,plainBaseSchema:c,plainCommentTargets:h,plainDefinitionFor:P,plainHasTarget:y,plainMessages:r,plainTargetLabel:u,plainTitle:m,resolvePlainNavigation:w,serializePlainAction:f},Symbol.toStringTag,{value:"Module"}));export{v as d,L as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b3 as L,b4 as B,a5 as d,b5 as E,_ as M,a4 as v,ag as n,r as D,ay as c,b6 as O,b7 as j,A as $,b8 as K,t as R}from"./shared-DE09J93T.js";import{L as N}from"./shared-CjW1DhGL.js";const H=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]],P=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]],U=L(class extends B{constructor(){super(...arguments),this.key=d}render(e,r){return this.key=e,r}update(e,[r,t]){return r!==this.key&&(E(e),this.key=r),t}}),F=M({en:{comment:"Comment",commentOn:e=>`Comment on ${e}`,submit:"Add",cancel:"Cancel"},ja:{comment:"\u30B3\u30E1\u30F3\u30C8",commentOn:e=>`${e}\u3078\u306E\u30B3\u30E1\u30F3\u30C8`,submit:"\u8FFD\u52A0",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}}),G=(e,r,t={})=>({body:e,notes:r,submission:e.trim()||null,label:t.label??null,error:t.error??null,key:t.key??null,choice:t.choice??null,submitLabel:t.submitLabel??null,placeholder:t.placeholder??null}),S=(e,r,t)=>{const a=()=>{r.submission!==null&&t({kind:"comment",body:r.submission})};return n`<div
|
|
2
2
|
class="comment-pop"
|
|
3
3
|
popover="manual"
|
|
4
4
|
role="dialog"
|
|
@@ -8,7 +8,7 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
8
8
|
>
|
|
9
9
|
${r.label?n`<strong class="comment-target">${r.label}</strong>`:d}
|
|
10
10
|
${r.error?n`<p class="comment-error" role="alert">${r.error}</p>`:d}
|
|
11
|
-
${r.choice?
|
|
11
|
+
${r.choice?m(r.choice,t):d}
|
|
12
12
|
${r.notes.length?n`<ul class="comment-list">
|
|
13
13
|
${r.notes.map(o=>n`<li>${o}</li>`)}
|
|
14
14
|
</ul>`:d}
|
|
@@ -33,7 +33,7 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
33
33
|
${e.cancel}
|
|
34
34
|
</button>
|
|
35
35
|
</div>
|
|
36
|
-
</div>`},
|
|
36
|
+
</div>`},m=(e,r)=>{const t=e.options.find(a=>a.value===e.value)?.hint;return n`<fieldset class="comment-kinds">
|
|
37
37
|
<legend>${e.label}</legend>
|
|
38
38
|
${e.options.map(a=>n`<label class="comment-kind">
|
|
39
39
|
<input
|
|
@@ -46,7 +46,113 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
46
46
|
<span>${a.label}</span>
|
|
47
47
|
</label>`)}
|
|
48
48
|
</fieldset>
|
|
49
|
-
${t===void 0?d:n`<p class="comment-kind-hint">${t}</p>`}`}
|
|
49
|
+
${t===void 0?d:n`<p class="comment-kind-hint">${t}</p>`}`},_=(e,r,t)=>{const a=()=>{r.submission!==null&&t({kind:"comment",body:r.submission})},o=r.submitLabel??e.submit;return n`<form
|
|
50
|
+
class="inline-composer"
|
|
51
|
+
@submit=${s=>{s.preventDefault(),a()}}
|
|
52
|
+
>
|
|
53
|
+
${r.choice?n`<div
|
|
54
|
+
class="inline-composer-kinds"
|
|
55
|
+
@keydown=${s=>{s.key==="Enter"&&s.preventDefault()}}
|
|
56
|
+
>
|
|
57
|
+
${m(r.choice,t)}
|
|
58
|
+
</div>`:d}
|
|
59
|
+
${r.error?n`<p class="comment-error" role="alert">${r.error}</p>`:d}
|
|
60
|
+
<div class="inline-composer-box">
|
|
61
|
+
<textarea
|
|
62
|
+
rows="1"
|
|
63
|
+
aria-label=${r.label??r.placeholder??e.comment}
|
|
64
|
+
placeholder=${r.placeholder??d}
|
|
65
|
+
data-dpk-text-key=${r.key??d}
|
|
66
|
+
.value=${r.body}
|
|
67
|
+
@input=${s=>{s.currentTarget instanceof HTMLTextAreaElement&&t({kind:"input",body:s.currentTarget.value})}}
|
|
68
|
+
@keydown=${s=>{s.isComposing||s.key==="Enter"&&(s.ctrlKey||s.metaKey)&&(s.preventDefault(),a())}}
|
|
69
|
+
></textarea>
|
|
70
|
+
<button
|
|
71
|
+
class="dpk-btn dpk-btn--accent inline-composer-send"
|
|
72
|
+
type="submit"
|
|
73
|
+
aria-label=${o}
|
|
74
|
+
title=${o}
|
|
75
|
+
?disabled=${r.submission===null}
|
|
76
|
+
>
|
|
77
|
+
${D()}
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
</form>`},W=v`
|
|
81
|
+
.inline-composer {
|
|
82
|
+
display: grid;
|
|
83
|
+
gap: 8px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.inline-composer .comment-kinds {
|
|
87
|
+
font-size: var(--dpk-text-2xs);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.inline-composer .comment-error {
|
|
91
|
+
margin: 0;
|
|
92
|
+
color: var(--dpk-danger);
|
|
93
|
+
font-size: var(--dpk-text-2xs);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.inline-composer-box {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: flex-end;
|
|
99
|
+
gap: 6px;
|
|
100
|
+
padding: 4px 4px 4px 10px;
|
|
101
|
+
border: 1px solid var(--dpk-rule-strong);
|
|
102
|
+
border-radius: var(--dpk-radius-md);
|
|
103
|
+
background: var(--dpk-paper-raised);
|
|
104
|
+
box-shadow: inset 0 1px 2px var(--dpk-shade-1);
|
|
105
|
+
transition:
|
|
106
|
+
border-color var(--dpk-dur) var(--dpk-ease),
|
|
107
|
+
box-shadow var(--dpk-dur) var(--dpk-ease);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.inline-composer-box:hover {
|
|
111
|
+
border-color: var(--dpk-rule-hover);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.inline-composer-box:focus-within {
|
|
115
|
+
border-color: var(--dpk-blue);
|
|
116
|
+
box-shadow: var(--dpk-focus);
|
|
117
|
+
transition-duration: var(--dpk-dur-fast);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.inline-composer-box textarea {
|
|
121
|
+
flex: 1;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
min-height: 26px;
|
|
124
|
+
max-height: calc(1.5em * 8 + 8px);
|
|
125
|
+
padding: 4px 0;
|
|
126
|
+
border: 0;
|
|
127
|
+
outline: none;
|
|
128
|
+
background: transparent;
|
|
129
|
+
color: var(--dpk-ink);
|
|
130
|
+
font: inherit;
|
|
131
|
+
font-size: var(--dpk-text-sm);
|
|
132
|
+
line-height: 1.5;
|
|
133
|
+
resize: none;
|
|
134
|
+
field-sizing: content;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.inline-composer-box textarea::placeholder {
|
|
138
|
+
color: var(--dpk-ink-faint);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.inline-composer-send {
|
|
142
|
+
flex: none;
|
|
143
|
+
display: inline-grid;
|
|
144
|
+
place-items: center;
|
|
145
|
+
width: 28px;
|
|
146
|
+
height: 28px;
|
|
147
|
+
padding: 0;
|
|
148
|
+
min-height: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.inline-composer-send svg {
|
|
152
|
+
width: 16px;
|
|
153
|
+
height: 16px;
|
|
154
|
+
}
|
|
155
|
+
`,y=(e,r)=>{const t=e.trim();if(t==="")return null;try{return t.startsWith("/")?new URL(t,r):new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:`https://${t}`)}catch{return null}},X=e=>`${e.origin}${e.pathname.replace(/\/+$/,"")}`,q=(e,r)=>{const t=e.trim();return t.startsWith("/")?y(t,r)?.href??t:/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:`https://${t}`},J=e=>{try{return new URL(e).host||e}catch{return e}},V=c(O),Q=c(j),Y=c(P),Z=c(N),f=c(H),ee=(e,r,t)=>{const a=r.length-1;if(e==="ArrowRight")return r[t===a?0:t+1];if(e==="ArrowLeft")return r[t===0?a:t-1];if(e==="Home")return r[0];if(e==="End")return r[a]},re=e=>{const{view:r,send:t,labels:a}=e,o=s=>i=>{const l=r.tabs[s],k=i.key==="Enter"||i.key===" "?l:ee(i.key,r.tabs,s);k!==void 0&&(i.preventDefault(),t({kind:"activate",id:k.id,focus:!0}))};return n`<div class="browser-tabs">
|
|
50
156
|
<div class="browser-tab-list" role="tablist" aria-label=${a.tabs}>
|
|
51
157
|
${r.tabs.map((s,i)=>n`<div
|
|
52
158
|
class="browser-tab"
|
|
@@ -57,9 +163,9 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
57
163
|
@click=${()=>t({kind:"activate",id:s.id})}
|
|
58
164
|
@keydown=${o(i)}
|
|
59
165
|
>
|
|
60
|
-
<span class="browser-favicon">${
|
|
166
|
+
<span class="browser-favicon">${f()}</span>
|
|
61
167
|
<span class="browser-tab-title">${s.title}</span>
|
|
62
|
-
${
|
|
168
|
+
${T(e,s.id)}
|
|
63
169
|
</div>`)}
|
|
64
170
|
</div>
|
|
65
171
|
<button
|
|
@@ -69,18 +175,18 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
69
175
|
title=${a.newTab}
|
|
70
176
|
@click=${()=>t({kind:"new-tab"})}
|
|
71
177
|
>
|
|
72
|
-
${
|
|
178
|
+
${$()}
|
|
73
179
|
</button>
|
|
74
180
|
${e.extra??d}
|
|
75
|
-
</div>`},
|
|
181
|
+
</div>`},T=(e,r)=>n`<button
|
|
76
182
|
class="browser-tab-close"
|
|
77
183
|
type="button"
|
|
78
184
|
aria-label=${e.labels.closeTab}
|
|
79
185
|
title=${e.labels.closeTab}
|
|
80
186
|
@click=${t=>{t.stopPropagation(),e.send({kind:"close-tab",id:r})}}
|
|
81
187
|
>
|
|
82
|
-
${
|
|
83
|
-
</button>`,
|
|
188
|
+
${R()}
|
|
189
|
+
</button>`,te={back:V,forward:Q,reload:Y},p=(e,r)=>{const{view:t,send:a,labels:o}=e,s=o[r],i={back:!t.canBack,forward:!t.canForward,reload:t.entry?.kind!=="page"}[r];return n`<button
|
|
84
190
|
class=${`browser-nav browser-${r}`}
|
|
85
191
|
type="button"
|
|
86
192
|
aria-label=${s}
|
|
@@ -88,11 +194,11 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
88
194
|
?disabled=${i}
|
|
89
195
|
@click=${()=>a({kind:r})}
|
|
90
196
|
>
|
|
91
|
-
${
|
|
92
|
-
</button>`},
|
|
93
|
-
${o?d:n`${
|
|
197
|
+
${te[r]()}
|
|
198
|
+
</button>`},ae=e=>{const{view:r,send:t,labels:a,phone:o}=e,s=r.profile??a.guest;return n`<div class="browser-toolbar">
|
|
199
|
+
${o?d:n`${p(e,"back")} ${p(e,"forward")} ${p(e,"reload")}`}
|
|
94
200
|
<div class="browser-address-form">
|
|
95
|
-
<span class="browser-lock">${r.entry?.kind==="page"?
|
|
201
|
+
<span class="browser-lock">${r.entry?.kind==="page"?Z():f()}</span>
|
|
96
202
|
<input
|
|
97
203
|
class="browser-address"
|
|
98
204
|
type="text"
|
|
@@ -100,7 +206,7 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
100
206
|
aria-label=${a.address}
|
|
101
207
|
spellcheck="false"
|
|
102
208
|
autocomplete="off"
|
|
103
|
-
.value=${
|
|
209
|
+
.value=${K(r.url)}
|
|
104
210
|
@focus=${i=>{i.currentTarget instanceof HTMLInputElement&&i.currentTarget.select()}}
|
|
105
211
|
@keydown=${i=>{const l=i.currentTarget;if(!(!(l instanceof HTMLInputElement)||i.isComposing)){if(i.key==="Enter"){if(i.preventDefault(),l.value.trim()==="")return;l.blur(),t({kind:"address",input:l.value});return}i.key==="Escape"&&(i.preventDefault(),l.value=r.url,l.blur())}}}
|
|
106
212
|
/>
|
|
@@ -109,9 +215,9 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
109
215
|
<span class="browser-avatar" aria-hidden="true">${Array.from(s)[0]??""}</span>
|
|
110
216
|
${o?d:n`<span class="browser-profile-name">${s}</span>`}
|
|
111
217
|
</span>
|
|
112
|
-
</div>`},
|
|
113
|
-
<div class="browser-progress" aria-hidden="true"></div>`,
|
|
114
|
-
${
|
|
218
|
+
</div>`},oe=e=>n`${e.phone?d:re(e)} ${ae(e)}
|
|
219
|
+
<div class="browser-progress" aria-hidden="true"></div>`,se=e=>{if(!e.phone)return d;const{view:r,send:t,labels:a}=e;return n`<div class="browser-bottom">
|
|
220
|
+
${p(e,"back")} ${p(e,"forward")}
|
|
115
221
|
<button
|
|
116
222
|
class="browser-nav browser-new-tab"
|
|
117
223
|
type="button"
|
|
@@ -119,7 +225,7 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
119
225
|
title=${a.newTab}
|
|
120
226
|
@click=${()=>t({kind:"new-tab"})}
|
|
121
227
|
>
|
|
122
|
-
${
|
|
228
|
+
${$()}
|
|
123
229
|
</button>
|
|
124
230
|
<button
|
|
125
231
|
class="browser-nav browser-tab-count"
|
|
@@ -131,17 +237,17 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
131
237
|
>
|
|
132
238
|
<span class="browser-tab-count-box">${r.tabs.length}</span>
|
|
133
239
|
</button>
|
|
134
|
-
${
|
|
135
|
-
</div>`},
|
|
240
|
+
${p(e,"reload")}
|
|
241
|
+
</div>`},ne=e=>{const{view:r,send:t,labels:a}=e;return n`<div class="browser-switcher" role="dialog" aria-label=${a.tabs}>
|
|
136
242
|
${r.tabs.map(o=>n`<div class="browser-card" aria-current=${o.active?"true":d}>
|
|
137
243
|
<button class="browser-card-open" type="button" @click=${()=>t({kind:"activate",id:o.id})}>
|
|
138
|
-
<span class="browser-favicon">${
|
|
244
|
+
<span class="browser-favicon">${f()}</span>
|
|
139
245
|
<span class="browser-card-title">${o.title}</span>
|
|
140
246
|
<span class="browser-card-url">${o.url}</span>
|
|
141
247
|
</button>
|
|
142
|
-
${
|
|
248
|
+
${T(e,o.id)}
|
|
143
249
|
</div>`)}
|
|
144
|
-
</div>`},
|
|
250
|
+
</div>`},ie=e=>n`<div class="browser-newtab">
|
|
145
251
|
<p class="browser-newtab-label">${e.labels.shortcuts}</p>
|
|
146
252
|
<div class="browser-shortcuts">
|
|
147
253
|
${e.shortcuts.map(r=>n`<a
|
|
@@ -154,12 +260,12 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
154
260
|
<span class="browser-shortcut-url">${r.url}</span>
|
|
155
261
|
</a>`)}
|
|
156
262
|
</div>
|
|
157
|
-
</div>`,
|
|
263
|
+
</div>`,de=(e,r)=>n`<div class="browser-unreachable" role="alert">
|
|
158
264
|
<h3>${e.unreachableTitle}</h3>
|
|
159
265
|
<p>${e.unreachableBody}</p>
|
|
160
266
|
<code>${r}</code>
|
|
161
|
-
</div>`,
|
|
162
|
-
${t?.kind==="unreachable"?
|
|
267
|
+
</div>`,le=(e,r)=>{const t=e.view.entry;return n`${e.phone&&e.switcher?ne(e):d}
|
|
268
|
+
${t?.kind==="unreachable"?de(e.labels,t.url):r===void 0?ie(e):r}`},b=e=>JSON.stringify(Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[t])=>r<t?-1:r>t?1:0)),I=(e,r)=>e?.kind==="page"&&b(e.page)===r,w=e=>`tab-${e}`,pe=e=>({tabs:[{id:w(1),history:[{kind:"page",page:e}],index:0}],activeId:w(1),seen:b(e),nextId:2}),ce={id:"",history:[],index:0},u=e=>e.tabs.find(r=>r.id===e.activeId)??e.tabs[0]??ce,x=e=>{const r=u(e);return r.history[r.index]},be=e=>u(e).index>0,ue=e=>{const r=u(e);return r.index<r.history.length-1},z=(e,r)=>({...e,tabs:e.tabs.map(t=>t.id===e.activeId?r(t):t)}),g=(e,r)=>z(e,t=>({...t,history:[...t.history.slice(0,t.index+1),r],index:t.index+1})),h=e=>{const r=x(e);return r?.kind==="page"?{...e,seen:b(r.page)}:e},A=(e,r)=>{const t=u(e),a=t.index+r;return a<0||a>=t.history.length?e:h(z(e,o=>({...o,index:a})))},C=(e,r,t)=>{const a=w(e.nextId),o=e.tabs.findIndex(s=>s.id===e.activeId)+1;return h({...e,tabs:[...e.tabs.slice(0,o),{id:a,history:[r],index:0},...e.tabs.slice(o)],activeId:t?e.activeId:a,nextId:e.nextId+1})},we=(e,r)=>{const t=e.tabs.findIndex(s=>s.id===r);if(t<0)return e;if(e.tabs.length===1){const s=w(e.nextId);return{...e,tabs:[{id:s,history:[{kind:"new-tab"}],index:0}],activeId:s,nextId:e.nextId+1}}const a=e.tabs.filter(s=>s.id!==r);if(r!==e.activeId)return{...e,tabs:a};const o=a[t]??a[t-1];return h({...e,tabs:a,activeId:o?.id??e.activeId})},xe=(e,r)=>{const t=r===null?null:b(r);if(t===e.seen)return e;const a={...e,seen:t};return r===null||t===null||I(x(e),t)?a:g(a,{kind:"page",page:r})},he=(e,r)=>{const t=b(r);return I(x(e),t)?e.seen===t?e:{...e,seen:t}:g({...e,seen:t},{kind:"page",page:r})},fe=(e,r)=>{switch(r.kind){case"observe":return xe(e,r.page);case"visit":return he(e,r.page);case"back":return A(e,-1);case"forward":return A(e,1);case"open-tab":return C(e,r.entry,r.background);case"new-tab":return C(e,{kind:"new-tab"},!1);case"unreachable":return g(e,{kind:"unreachable",url:r.url});case"activate":return e.tabs.some(t=>t.id===r.id)&&r.id!==e.activeId?h({...e,activeId:r.id}):e;case"close-tab":return we(e,r.id);default:return e}},ge=v`
|
|
163
269
|
/*
|
|
164
270
|
* A tab strip on a darker band, the active tab merged into the toolbar below
|
|
165
271
|
* it, round navigation buttons, a pill address bar and the profile of the
|
|
@@ -683,4 +789,4 @@ import{aT as z,aU as C,a5 as d,aV as L,_ as B,ag as n,ay as p,aW as E,aX as M,A
|
|
|
683
789
|
top: 8px;
|
|
684
790
|
right: 8px;
|
|
685
791
|
}
|
|
686
|
-
`;export{
|
|
792
|
+
`;export{W as a,_ as b,F as c,y as d,X as e,u as f,ue as g,be as h,U as i,J as j,ge as k,x as l,oe as m,le as n,se as o,G as p,fe as q,S as r,pe as s,q as t};
|