dev-process-kit 0.3.0-beta.2 → 0.3.0-beta.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.
Files changed (34) hide show
  1. package/dist/boards.js +1 -1
  2. package/dist/chunks/{shared-C7wOrDIL.js → shared-BLzPmv14.js} +1 -1
  3. package/dist/chunks/{shared-DOKOFdYm.js → shared-BYcLqnFV.js} +3 -3
  4. package/dist/chunks/shared-BYr9ZouD.js +1864 -0
  5. package/dist/chunks/{shared-B-DAJvq3.js → shared-BhUEVKpO.js} +34 -34
  6. package/dist/chunks/{shared-CE8X9qCv.js → shared-Bt5HGgX9.js} +17 -17
  7. package/dist/chunks/{shared-D2qgtKhc.js → shared-BzKZc8e7.js} +1 -1
  8. package/dist/chunks/{shared-BdIN9A6O.js → shared-CJnwvCXE.js} +1 -1
  9. package/dist/chunks/{shared-Dgse8blZ.js → shared-CO-HhC8m.js} +1 -1
  10. package/dist/chunks/shared-CXefnQqJ.js +5222 -0
  11. package/dist/chunks/shared-D4PPk0Dk.js +1 -0
  12. package/dist/chunks/{shared-CPNa9lTa.js → shared-D6X_HEJN.js} +1 -1
  13. package/dist/chunks/shared-D9js0mlL.js +6322 -0
  14. package/dist/chunks/{shared-CPwjSgu0.js → shared-DEco37gW.js} +1 -1
  15. package/dist/chunks/shared-DIHtcDps.js +1 -0
  16. package/dist/chunks/shared-DXPlz1s4.js +767 -0
  17. package/dist/chunks/{shared-BT5Ayp_z.js → shared-NkccEMPc.js} +1 -1
  18. package/dist/chunks/shared-naTB_LaU.js +3662 -0
  19. package/dist/components.js +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/views/delegation-poker.js +1 -1
  22. package/dist/views/plain.js +1 -1
  23. package/dist/views/prototype.js +1 -1
  24. package/dist/views/slides.js +1 -1
  25. package/dist/views/task-board.js +1 -1
  26. package/dist/views/usm.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunks/shared-BTf38OnF.js +0 -1
  29. package/dist/chunks/shared-BXejn2ZQ.js +0 -4928
  30. package/dist/chunks/shared-CpJDPnHA.js +0 -573
  31. package/dist/chunks/shared-DgexE4u1.js +0 -1862
  32. package/dist/chunks/shared-DnJcdL52.js +0 -3586
  33. package/dist/chunks/shared-HdOOfyqP.js +0 -6208
  34. package/dist/chunks/shared-TrlnHjrJ.js +0 -1
@@ -1,1862 +0,0 @@
1
- import{ax as y,bi as Ae,av as D,aM as _,aL as g,ac as u,aw as M,az as ue,bj as zi,aD as Ie,au as Yi,bk as Je,bl as Hi,aa as N,ay as x,b8 as Bi,aB as Wi,p as w,a9 as b,t as oe,aO as se,a8 as qi,N as Fi,e as Gi,a5 as ji,h as Qe,K as _e,S as Y,R as Ki,P as k,as as l,ai as h,bm as Pe,bn as De,aH as Xi,y as Re,aP as et,l as tt,a$ as q,bo as Zi,z as it,bp as nt,G as Ji,I as Qi,b3 as en,b4 as tn,ah as nn,V as ot,ag as on,bq as sn,aE as rn,aF as he,aG as st,C as an,br as dn}from"./shared-BXejn2ZQ.js";import{c as ln,a as pn}from"./shared-BT5Ayp_z.js";import{m as cn}from"./shared-D2qgtKhc.js";import{h as rt,d as at,e as un,f as hn,a as dt,b as lt,i as pt,p as vn,r as fn,k as gn,l as mn,m as yn,g as wn,c as bn,s as kn,n as ct,j as ut,t as xn}from"./shared-DOKOFdYm.js";const En=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]],Sn=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]],$n=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],Tn=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],An=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],In=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"}],["path",{d:"m14 7 3 3"}],["path",{d:"M5 6v4"}],["path",{d:"M19 14v4"}],["path",{d:"M10 2v2"}],["path",{d:"M7 8H3"}],["path",{d:"M21 16h-4"}],["path",{d:"M11 3H9"}]],ht=["browser","native","mail","plain"],vt=["mobile","tablet","desktop","fluid"],J=e=>"screen"in e,_n=D({from:g(u()),to:g(u()),cc:g(u()),subject:g(u()),date:g(u())}),ft={id:_,kind:M(ue(ht),"browser"),viewport:M(ue(vt),"fluid"),label:g(u()),url:g(u()),mail:g(_n)},Ne=y(u(),Ae(e=>e.trim()!=="","a note needs some text")),gt=y(u(),zi()),Pn=D({id:_,selector:y(u(),x(1)),text:g(u()),body:Ne,createdAt:g(gt)}),mt='a preview `mail` envelope needs `"kind": "mail"`',yt=y(D(ft),Ae(e=>e.mail===void 0||e.kind==="mail",mt)),wt=y(D({...ft,notes:g(N(Pn))}),Ae(e=>e.mail===void 0||e.kind==="mail",mt)),bt=D({screen:_,preview:g(_)}),Dn=Ie([bt,D({material:yt})]),Rn=Ie([bt,D({material:wt})]),Nn=D({id:_,name:y(u(),x(1)),description:g(u()),actor:g(y(u(),x(1))),situation:g(y(u(),x(1))),panes:M(N(Rn),[])}),On=D({id:_,name:y(u(),x(1)),description:g(u()),actor:g(y(u(),x(1))),steps:M(N(Nn),[])}),Cn=D({id:_,name:y(u(),x(1)),description:g(u()),actor:g(y(u(),x(1))),stories:M(N(On),[])}),kt=y(u(),x(1)),Mn=D({id:_,label:y(u(),x(1)),description:g(u()),fill:g(Bi(kt,Ie([u(),Wi()]))),click:g(N(kt))}),Ln=D({id:_,title:y(u(),x(1)),description:g(u()),previews:M(N(wt),[]),actions:M(N(Mn),[])}),Un=D({id:_,name:y(u(),x(1)),description:g(u()),actor:g(y(u(),x(1))),screens:M(N(Ln),[])}),xt=D({title:g(u()),baseUrl:g(u()),apps:M(N(Un),[]),activities:M(N(Cn),[])}),Et=e=>e.flatMap(t=>J(t)?[]:[t.material]),Vn=e=>{const t=new Set,i=new Set,n=a=>{for(const d of a){if(t.has(d.id))return`duplicate preview id "${d.id}": preview ids are global, they name a light DOM slot`;t.add(d.id);for(const p of d.notes??[]){if(i.has(p.id))return`duplicate note id "${p.id}": note ids are global`;i.add(p.id)}}return null},o=new Set,s=new Set;for(const a of e.apps){if(o.has(a.id))return`duplicate app id "${a.id}"`;o.add(a.id);for(const d of a.screens){if(s.has(d.id))return`duplicate screen id "${d.id}": screen ids are global`;s.add(d.id);const p=n(d.previews);if(p!==null)return p;const c=new Set;for(const v of d.actions){if(c.has(v.id))return`duplicate action id "${v.id}" on screen "${d.id}"`;c.add(v.id)}}}const r=new Set;for(const a of e.activities){if(r.has(a.id))return`duplicate activity id "${a.id}"`;r.add(a.id);const d=new Set;for(const p of a.stories){if(d.has(p.id))return`duplicate story id "${p.id}" in activity "${a.id}"`;d.add(p.id);const c=new Set;for(const v of p.steps){if(c.has(v.id))return`duplicate step id "${v.id}" in story "${p.id}"`;c.add(v.id);const f=n(Et(v.panes));if(f!==null)return f}}}return null},St=(e,t)=>{const i=new Map;for(const n of t.panes){if(!J(n))continue;const o=e(n.screen);if(o===void 0)return`unknown screen "${n.screen}" on step "${t.id}": declare it under \`apps[].screens\``;if(n.preview!==void 0&&!o.includes(n.preview))return`preview "${n.preview}" on step "${t.id}" is not a rendition of screen "${n.screen}"`;const s=i.get(n.screen)??[];if(s.length>0&&(n.preview===void 0||s.includes(n.preview)||s.includes(void 0)))return`screen "${n.screen}" is shown twice on step "${t.id}": give each pane a different \`preview\``;i.set(n.screen,[...s,n.preview])}return null},zn=e=>{const t=new Map(e.apps.flatMap(i=>i.screens.map(n=>[n.id,n.previews.map(o=>o.id)])));for(const i of e.activities.flatMap(n=>n.stories.flatMap(o=>o.steps))){const n=St(o=>t.get(o),i);if(n!==null)return n}return null},Yn=(e,t)=>St(i=>L(e,i)?.screen.previews.map(n=>n.id),t),O="ui",re=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},Q=e=>{const t=e.indexOf("/");if(t<=0)return;const i=e.slice(0,t);if(!Hi(_,i))return;const n=e.slice(t+1),o=/ "([^"]*)"$/.exec(n),s=(o?n.slice(0,o.index):n).trim();if(s!=="")return o?.[1]===void 0?{previewId:i,selector:s}:{previewId:i,selector:s,text:o[1]}},$t=e=>{const t=Yi(xt,e),i=Vn(t)??zn(t);if(i!==null)throw new Error(i);return t},Tt=()=>({apps:[],activities:[]}),H=e=>e.apps.flatMap(t=>t.screens.map(i=>({app:t,screen:i}))),L=(e,t)=>{if(t!==void 0)return H(e).find(i=>i.screen.id===t)},ve=(e,t)=>t.panes.flatMap(i=>{const n=J(i)?L(e,i.screen):void 0;return n?[n]:[]}),F=e=>Et(e.panes),Hn=(e,t)=>e.panes.some(i=>J(i)&&i.screen===t),U=(e,t)=>{if(t!==void 0)return e.activities.find(i=>i.id===t)},C=(e,t)=>`${e}.${t}`,$=(e,t)=>{if(t===void 0)return;const i=Je(t,2);if(i){const[o,s]=i;if(o===void 0||s===void 0)return;const r=e.activities.find(d=>d.id===o),a=r?.stories.find(d=>d.id===s);return r&&a?{activity:r,story:a}:void 0}if(t.includes("."))return;const n=e.activities.flatMap(o=>o.stories.filter(s=>s.id===t).map(s=>({activity:o,story:s})));return n.length===1?n[0]:void 0},At=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},ae=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,fe=(e,t,i)=>`${e.id}.${t.id}.${i.id}`,S=(e,t)=>{if(t===void 0)return;const i=Je(t,3);if(i){const[o,s,r]=i;if(o===void 0||s===void 0||r===void 0)return;const a=e.activities.find(v=>v.id===o),d=a?.stories.find(v=>v.id===s),p=d?d.steps.findIndex(v=>v.id===r):-1,c=d&&p>=0?d.steps[p]:void 0;return a&&d&&c?{activity:a,story:d,step:c,stepIndex:p}:void 0}if(t.includes("."))return;const n=B(e).filter(o=>o.step.id===t);return n.length===1?n[0]:void 0},E=(e,t)=>{if(t!==void 0){for(const i of H(e)){const n=i.screen.previews.find(o=>o.id===t);if(n)return{owner:{kind:"screen",...i},preview:n}}for(const i of B(e)){const n=F(i.step).find(o=>o.id===t);if(n)return{owner:{kind:"step",...i},preview:n}}}},It=e=>[...H(e).flatMap(t=>t.screen.previews),...B(e).flatMap(t=>F(t.step))],_t=e=>It(e).flatMap(t=>(t.notes??[]).map(i=>i.id)),B=e=>e.activities.flatMap(t=>t.stories.flatMap(i=>i.steps.map((n,o)=>({activity:t,story:i,step:n,stepIndex:o})))),Pt=e=>B(e).map(t=>t.step.id),Oe=y(u(),x(1)),Dt=e=>{const t=qi(b({noteId:Oe}),e.payload);return`${e.type}|${t.success?t.output.noteId:JSON.stringify(e.payload)}`},m={SET_ACTIVITY_NAME:w("SET_ACTIVITY_NAME","activity",b({name:y(u(),x(1))})),SET_ACTIVITY_DESCRIPTION:w("SET_ACTIVITY_DESCRIPTION","activity",b({description:u()})),SET_STORY_NAME:w("SET_STORY_NAME","story",b({name:y(u(),x(1))})),SET_STORY_DESCRIPTION:w("SET_STORY_DESCRIPTION","story",b({description:u()})),SET_STEP_NAME:w("SET_STEP_NAME","step",b({name:y(u(),x(1))})),SET_STEP_DESCRIPTION:w("SET_STEP_DESCRIPTION","step",b({description:u()})),SET_PREVIEW_KIND:w("SET_PREVIEW_KIND","preview",b({kind:ue(ht)})),SET_PREVIEW_VIEWPORT:w("SET_PREVIEW_VIEWPORT","preview",b({viewport:ue(vt)})),SET_PREVIEW_LABEL:w("SET_PREVIEW_LABEL","preview",b({label:u()})),REORDER_ACTIVITY:w("REORDER_ACTIVITY","activity",b({after:se(u())}),{mode:"sequence"}),REORDER_STORY:w("REORDER_STORY","story",b({after:se(u())}),{mode:"sequence"}),REORDER_STEP:w("REORDER_STEP","step",b({after:se(u())}),{mode:"sequence"}),MOVE_STORY:w("MOVE_STORY","story",b({toActivity:y(u(),x(1)),after:se(u())}),{mode:"sequence"}),MOVE_STEP:w("MOVE_STEP","step",b({toStory:y(u(),x(1)),after:se(u())}),{mode:"sequence"}),ADD_ACTIVITY:w("ADD_ACTIVITY","page",b({id:_,name:y(u(),x(1)),description:g(u())}),{dedupeKey:oe}),ADD_STORY:w("ADD_STORY","activity",b({id:_,name:y(u(),x(1)),description:g(u())}),{dedupeKey:oe}),ADD_STEP:w("ADD_STEP","story",b({id:_,name:y(u(),x(1)),description:g(u()),panes:g(N(Dn))}),{dedupeKey:oe}),ADD_PREVIEW:w("ADD_PREVIEW","step",yt,{dedupeKey:oe}),DELETE_ACTIVITY:w("DELETE_ACTIVITY","activity",b({})),DELETE_STORY:w("DELETE_STORY","story",b({})),DELETE_STEP:w("DELETE_STEP","step",b({})),DELETE_PREVIEW:w("DELETE_PREVIEW","preview",b({})),ADD_UI_NOTE:w("ADD_UI_NOTE",O,b({id:_,body:Ne,createdAt:g(gt)}),{dedupeKey:oe}),SET_UI_NOTE_BODY:w("SET_UI_NOTE_BODY",O,b({noteId:Oe,body:Ne}),{dedupeKey:Dt}),DELETE_UI_NOTE:w("DELETE_UI_NOTE",O,b({noteId:Oe}),{dedupeKey:Dt})},W={setActivityName:(e,t)=>({type:"SET_ACTIVITY_NAME",target:{type:"activity",id:e},payload:{name:t}}),setActivityDescription:(e,t)=>({type:"SET_ACTIVITY_DESCRIPTION",target:{type:"activity",id:e},payload:{description:t}}),setStoryName:(e,t)=>({type:"SET_STORY_NAME",target:{type:"story",id:e},payload:{name:t}}),setStoryDescription:(e,t)=>({type:"SET_STORY_DESCRIPTION",target:{type:"story",id:e},payload:{description:t}}),setStepName:(e,t)=>({type:"SET_STEP_NAME",target:{type:"step",id:e},payload:{name:t}}),setStepDescription:(e,t)=>({type:"SET_STEP_DESCRIPTION",target:{type:"step",id:e},payload:{description:t}}),setPreviewViewport:(e,t)=>({type:"SET_PREVIEW_VIEWPORT",target:{type:"preview",id:e},payload:{viewport:t}}),setPreviewKind:(e,t)=>({type:"SET_PREVIEW_KIND",target:{type:"preview",id:e},payload:{kind:t}}),setPreviewLabel:(e,t)=>({type:"SET_PREVIEW_LABEL",target:{type:"preview",id:e},payload:{label:t}}),reorderActivity:(e,t)=>({type:"REORDER_ACTIVITY",target:{type:"activity",id:e},payload:{after:t}}),reorderStory:(e,t)=>({type:"REORDER_STORY",target:{type:"story",id:e},payload:{after:t}}),reorderStep:(e,t)=>({type:"REORDER_STEP",target:{type:"step",id:e},payload:{after:t}}),moveStep:(e,t,i)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:i}}),moveStory:(e,t,i)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:i}}),addActivity:(e,t,i)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...i===void 0?{}:{description:i}}}),addStory:(e,t,i,n)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:i,...n===void 0?{}:{description:n}}}),addStep:(e,t,i,n)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:i,...n===void 0?{}:{panes:n}}}),addPreview:(e,t)=>({type:"ADD_PREVIEW",target:{type:"step",id:e},payload:{...t}}),deleteActivity:e=>({type:"DELETE_ACTIVITY",target:{type:"activity",id:e},payload:{}}),deleteStory:e=>({type:"DELETE_STORY",target:{type:"story",id:e},payload:{}}),deleteStep:e=>({type:"DELETE_STEP",target:{type:"step",id:e},payload:{}}),deletePreview:e=>({type:"DELETE_PREVIEW",target:{type:"preview",id:e},payload:{}}),addUiNote:(e,t,i,n)=>({type:"ADD_UI_NOTE",target:{type:O,id:re(e)},payload:{id:t,body:i,...n===void 0?{}:{createdAt:n}}}),setUiNoteBody:(e,t,i)=>({type:"SET_UI_NOTE_BODY",target:{type:O,id:re(e)},payload:{noteId:t,body:i}}),deleteUiNote:(e,t)=>({type:"DELETE_UI_NOTE",target:{type:O,id:re(e)},payload:{noteId:t}})},Rt=(e,t)=>{const i=Fi(m,t);if(i===null)return null;const n=i.target.id;switch(i.type){case"SET_ACTIVITY_NAME":return G(e,n,o=>({...o,name:i.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return G(e,n,o=>({...o,description:i.payload.description}));case"SET_STORY_NAME":return j(e,n,o=>({...o,name:i.payload.name}));case"SET_STORY_DESCRIPTION":return j(e,n,o=>({...o,description:i.payload.description}));case"SET_STEP_NAME":return ge(e,n,o=>({...o,name:i.payload.name}));case"SET_STEP_DESCRIPTION":return ge(e,n,o=>({...o,description:i.payload.description}));case"SET_PREVIEW_KIND":return ee(e,n,o=>({...o,kind:i.payload.kind}));case"SET_PREVIEW_VIEWPORT":return ee(e,n,o=>({...o,viewport:i.payload.viewport}));case"SET_PREVIEW_LABEL":return ee(e,n,o=>({...o,label:i.payload.label}));case"REORDER_ACTIVITY":{const{after:o}=i.payload,s=de(e.activities,n,o);return s===null?null:{...e,activities:s}}case"REORDER_STORY":{const{after:o}=i.payload,s=$(e,n);if(!s)return null;const r=o===null?null:$(e,o);if(o!==null&&(!r||r.activity!==s.activity))return null;const a=de(s.activity.stories,s.story.id,r?.story.id??null);return a===null?null:G(e,s.activity.id,d=>({...d,stories:a}))}case"REORDER_STEP":{const{after:o}=i.payload,s=S(e,n);if(!s)return null;const r=o===null?null:S(e,o);if(o!==null&&(!r||r.story!==s.story))return null;const a=de(s.story.steps,s.step.id,r?.step.id??null);return a===null?null:j(e,C(s.activity.id,s.story.id),d=>({...d,steps:a}))}case"MOVE_STORY":{const{toActivity:o,after:s}=i.payload,r=$(e,n);if(!r)return null;const a=e.activities.find(v=>v.id===o);if(!a)return null;const d=s===null?null:$(e,s);if(s!==null&&(!d||d.activity!==a))return null;const p=d?.story.id??null;if(r.activity.id===o){const v=de(r.activity.stories,r.story.id,p);return v===null?null:G(e,o,f=>({...f,stories:v}))}if(a.stories.some(v=>v.id===r.story.id))return null;const c=Me(a.stories,r.story,p);return Ce(e,v=>v.id===r.activity.id?{...v,stories:v.stories.filter(f=>f.id!==At(n))}:v.id===o?{...v,stories:c}:v)}case"MOVE_STEP":{const{toStory:o,after:s}=i.payload,r=S(e,n);if(!r)return null;const a=$(e,o);if(!a)return null;const d=s===null?null:S(e,s);if(s!==null&&(!d||d.story!==a.story))return null;const p=d?.step.id??null;if(r.story===a.story){const v=de(r.story.steps,r.step.id,p);return v===null?null:j(e,o,f=>({...f,steps:v}))}if(a.story.steps.some(v=>v.id===r.step.id))return null;const c=Me(a.story.steps,r.step,p);return Ce(e,v=>({...v,stories:v.stories.map(f=>f===r.story?{...f,steps:f.steps.filter(I=>I.id!==At(n))}:f===a.story?{...f,steps:c}:f)}))}case"ADD_ACTIVITY":{const o=i.payload;if(e.activities.some(r=>r.id===o.id))return e;const s={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},stories:[]};return{...e,activities:[...e.activities,s]}}case"ADD_STORY":{const o=i.payload,s=e.activities.find(a=>a.id===n);if(!s)return null;if(s.stories.some(a=>a.id===o.id))return e;const r={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},steps:[]};return G(e,n,a=>({...a,stories:[...a.stories,r]}))}case"ADD_STEP":{const o=i.payload,s=$(e,n)?.story;if(!s)return null;if(s.steps.some(d=>d.id===o.id))return e;const r=o.panes??[],a={id:o.id,name:o.name,...o.description===void 0?{}:{description:o.description},panes:r};return Bn(e,a)?j(e,n,d=>({...d,steps:[...d.steps,a]})):null}case"ADD_PREVIEW":{const o=i.payload,s=S(e,n)?.step;return s?F(s).some(r=>r.id===o.id)?e:E(e,o.id)?null:ge(e,n,r=>({...r,panes:[...r.panes,{material:o}]})):null}case"DELETE_ACTIVITY":{const o=n;return e.activities.some(s=>s.id===o)?{...e,activities:e.activities.filter(s=>s.id!==o)}:null}case"DELETE_STORY":{const o=$(e,n);return o?G(e,o.activity.id,s=>({...s,stories:s.stories.filter(r=>r.id!==o.story.id)})):null}case"DELETE_STEP":{const o=S(e,n);return o?j(e,C(o.activity.id,o.story.id),s=>({...s,steps:s.steps.filter(r=>r.id!==o.step.id)})):null}case"DELETE_PREVIEW":{const o=E(e,n);return o?Nt(e,o.owner,s=>s.filter(r=>r.id!==o.preview.id)):null}case"ADD_UI_NOTE":{const{id:o,body:s,createdAt:r}=i.payload,a=Q(n),d=a===void 0?void 0:E(e,a.previewId);if(a===void 0||d===void 0)return null;if(d.preview.notes?.some(c=>c.id===o&&c.selector===a.selector))return e;if(_t(e).includes(o))return null;const p={id:o,selector:a.selector,...a.text===void 0?{}:{text:a.text},body:s,...r===void 0?{}:{createdAt:r}};return ee(e,d.preview.id,c=>({...c,notes:[...c.notes??[],p]}))}case"SET_UI_NOTE_BODY":{const{noteId:o,body:s}=i.payload,r=Q(n),a=r===void 0?void 0:E(e,r.previewId);return a?.preview.notes?.some(d=>d.id===o)?ee(e,a.preview.id,d=>({...d,notes:(d.notes??[]).map(p=>p.id===o?{...p,body:s}:p)})):null}case"DELETE_UI_NOTE":{const{noteId:o}=i.payload,s=Q(n),r=s===void 0?void 0:E(e,s.previewId);return r?.preview.notes?.some(a=>a.id===o)?ee(e,r.preview.id,a=>{const d=(a.notes??[]).filter(v=>v.id!==o),{notes:p,...c}=a;return d.length===0?c:{...c,notes:d}}):null}default:return Gi(i)}},Ce=(e,t)=>({...e,activities:e.activities.map(t)}),G=(e,t,i)=>{const n=t;return e.activities.some(o=>o.id===n)?Ce(e,o=>o.id===n?i(o):o):null},j=(e,t,i)=>{const n=$(e,t);if(!n)return null;const o=n.story.id;return G(e,n.activity.id,s=>({...s,stories:s.stories.map(r=>r.id===o?i(r):r)}))},ge=(e,t,i)=>{const n=S(e,t);if(!n)return null;const o=n.step.id;return j(e,C(n.activity.id,n.story.id),s=>({...s,steps:s.steps.map(r=>r.id===o?i(r):r)}))},ee=(e,t,i)=>{const n=E(e,t);if(!n)return null;const o=n.preview.id;return Nt(e,n.owner,s=>s.map(r=>r.id===o?i(r):r))},Bn=(e,t)=>{const i=F(t).map(n=>n.id);return Yn(e,t)===null&&new Set(i).size===i.length&&!i.some(n=>E(e,n))},Nt=(e,t,i)=>{if(t.kind==="step")return ge(e,ae(t),o=>{const s=new Map(i([...F(o)]).map(r=>[r.id,r]));return{...o,panes:o.panes.flatMap(r=>{if(J(r))return[r];const a=s.get(r.material.id);return a?[{material:a}]:[]})}});const n=t.screen.id;return{...e,apps:e.apps.map(o=>o.id===t.app.id?{...o,screens:o.screens.map(s=>s.id===n?{...s,previews:i(s.previews)}:s)}:o)}},de=(e,t,i)=>{const n=e.findIndex(r=>r.id===t);if(n<0||i!==null&&!e.some(r=>r.id===i))return null;if(t===i)return[...e];const o=e[n];if(o===void 0)return null;const s=e.filter(r=>r.id!==t);return Me(s,o,i)},Me=(e,t,i)=>{const n=[...e],o=i===null?-1:n.findIndex(s=>s.id===i);return n.splice(o+1,0,t),n},Ot={"iphone-se":"iPhone SE","iphone-16":"iPhone 16","iphone-16-pro-max":"iPhone 16 Pro Max","pixel-7":"Pixel 7","galaxy-s24":"Galaxy S24","ipad-mini":"iPad mini","ipad-air-11":'iPad Air 11"',"ipad-pro-11":'iPad Pro 11"',"ipad-pro-13":'iPad Pro 13"'},Wn={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},qn={"laptop-13":"13 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","laptop-15":"15 \u30A4\u30F3\u30C1 \u30CE\u30FC\u30C8","full-hd":"\u30D5\u30EB HD","monitor-27":"27 \u30A4\u30F3\u30C1 \u30E2\u30CB\u30BF\u30FC",ultrawide:"\u30A6\u30EB\u30C8\u30E9\u30EF\u30A4\u30C9"},me=ji({en:{renameActivity:"Rename Activity",updateActivityDescription:"Update Activity description",renameStory:"Rename UserStory",updateStoryDescription:"Update UserStory description",renameStep:"Rename Step",updateStepDescription:"Update Step description",changePreviewKind:"Change Preview kind",changePreviewViewport:"Change Preview viewport",changePreviewLabel:"Change Preview label",moveStory:"Move UserStory",moveStep:"Move Step",deleteTitle:"Delete",reorderTitle:e=>`Reorder ${e}`,addTitle:e=>`Add ${e}`,toFront:"\u2192 To the front",afterName:e=>`\u2192 Right after "${e}"`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"Screen",openInApp:"Open this screen in the app view",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"There are no Activities yet. Add ",noActivityAfter:" to the base JSON, or ask the agent.",deleteStepAria:"Delete step",addStepButton:"+ Step",stepNameLabel:"Step name",descriptionLabel:"Description",descriptionPlaceholder:"What happens in this Step (click to edit)",newStepName:"New step",viewLabel:"View",viewScenario:"Scenario",viewApp:"App",viewScenarioHint:"Follow one user story step by step",viewAppHint:"Use the UI as one app, whatever the scenario",appScreens:"Screens",appScreensHint:"Pick a screen to start from, then move around through the UI itself.",appSelectLabel:"App",appOutsideBrowser:"Outside the browser",noStepBefore:"There are no Steps yet. A Prototype has the meaning structure ",noStepAfter:" \u2014 one Step is one moment of the story: the screen the user is on and what they have at hand. Add a Step to the base JSON, and its screen will appear here.",noScreens:"This product has no screens yet. Declare its apps and their screens under apps[].screens in the base JSON, and they will appear here.",noPreviewMetadata:"No preview metadata \u2014 ask the agent to add it.",storyWithoutSteps:"This UserStory has no Steps yet, so there is no screen to show. Add one with + Step, or ask the agent to prototype it.",pageActor:e=>`Used by ${e}`,maximize:"Maximize",restore:"Restore size",maximizeHint:"Show the preview alone across the tab \xB7 Esc to restore",situation:"Situation",uiComment:"Comment on UI",uiCommentHint:"Click any part of the preview to comment on it \xB7 Esc to finish",uiCommentPin:(e,t)=>`Comment ${e}: ${t}`,uiCommentAs:"What it is",uiCommentFeedback:"Review comment",uiCommentFeedbackHint:"Sent to the Agent as a message. Gone once it is reflected.",uiCommentNote:"Note",uiCommentNoteHint:"Kept on the element as part of the prototype, shown as a badge in the scenario view.",uiNoteSubmit:"Keep",uiNotes:e=>e===1?"1 note":`${e} notes`,uiNotesOn:e=>`Notes on ${e}`,uiNoteDate:e=>Ct("en-US",e),deleteUiNoteAria:"Delete the note",editUiNoteAria:"Edit the note",editUiNoteLabel:"Note",editUiNoteHint:"Ctrl/Cmd + Enter to save, Esc to close",saveUiNote:"Save",cancelUiNote:"Cancel",closeUiNotes:"Close",addUiNote:"Add a note",editUiNote:"Edit a note",deleteUiNote:"Delete a note",mailFrom:"From",mailTo:"To",mailCc:"Cc",mailDate:"Date",demo:"Demo",demoHint:"Use the app in a browser across the tab, with nothing else on screen \xB7 Esc to finish",exitDemo:"Exit demo",browserBack:"Back",browserForward:"Forward",browserReload:"Reload",browserAddress:"Address",browserTabs:"Tabs",newTab:"New tab",closeTab:"Close tab",browserProfile:e=>`Profile: ${e}`,browserGuest:"Guest",newTabShortcuts:"Pages of this app",unreachableTitle:"This site can\u2019t be reached",unreachableBody:"No page of the prototype has this address.",device:"Device",deviceHint:"The window the app runs in: a page taller than it scrolls inside, as on the device",deviceName:e=>Ot[e]??Wn[e]??e,deviceZoom:e=>`Shown at ${e}% to fit`,actions:"Actions",actionsHint:"Make the screen do something in one go, e.g. fill its form with sample data"},ja:{renameActivity:"Activity \u540D\u3092\u5909\u66F4",updateActivityDescription:"Activity \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStory:"UserStory \u540D\u3092\u5909\u66F4",updateStoryDescription:"UserStory \u306E\u8AAC\u660E\u3092\u66F4\u65B0",renameStep:"Step \u540D\u3092\u5909\u66F4",updateStepDescription:"Step \u306E\u8AAC\u660E\u3092\u66F4\u65B0",changePreviewKind:"Preview \u306E\u7A2E\u5225\u3092\u5909\u66F4",changePreviewViewport:"Preview \u306E\u30D3\u30E5\u30FC\u30DD\u30FC\u30C8\u3092\u5909\u66F4",changePreviewLabel:"Preview \u306E\u30E9\u30D9\u30EB\u3092\u5909\u66F4",moveStory:"UserStory \u3092\u79FB\u52D5",moveStep:"Step \u3092\u79FB\u52D5",deleteTitle:"\u524A\u9664",reorderTitle:e=>`${e} \u306E\u9806\u5E8F\u3092\u5909\u66F4`,addTitle:e=>`${e} \u3092\u8FFD\u52A0`,toFront:"\u2192 \u5148\u982D\u3078",afterName:e=>`\u2192 "${e}" \u306E\u76F4\u5F8C\u3078`,unknownTarget:"(unknown target)",activityGroup:"Activity",storyGroup:"UserStory",stepGroup:"Step",screenGroup:"\u753B\u9762",openInApp:"\u3053\u306E\u753B\u9762\u3092\u30A2\u30D7\u30EA\u30D3\u30E5\u30FC\u3067\u958B\u304F",previewGroup:"Preview",pageGroup:"Page",uiGroup:"UI",targetLabel:(e,t)=>`${e} \xB7 ${t}`,targetMissing:(e,t)=>`${e} \xB7 ${t} (missing)`,noActivityBefore:"Activity \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E ",noActivityAfter:" \u3092\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",deleteStepAria:"\u30B9\u30C6\u30C3\u30D7\u3092\u524A\u9664",addStepButton:"+ Step",stepNameLabel:"Step \u540D",descriptionLabel:"\u8AAC\u660E",descriptionPlaceholder:"\u3053\u306E Step \u3067\u4F55\u304C\u8D77\u304D\u308B\u304B\uFF08\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6\uFF09",newStepName:"\u65B0\u3057\u3044\u30B9\u30C6\u30C3\u30D7",viewLabel:"\u8868\u793A",viewScenario:"\u30B7\u30CA\u30EA\u30AA",viewApp:"\u30A2\u30D7\u30EA",viewScenarioHint:"\u30E6\u30FC\u30B6\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC\u306B\u6CBF\u3063\u3066 Step \u3092\u9806\u306B\u305F\u3069\u308B",viewAppHint:"\u30B7\u30CA\u30EA\u30AA\u306B\u95A2\u4FC2\u306A\u304F\u3001UI \u3092 1 \u3064\u306E\u30A2\u30D7\u30EA\u3068\u3057\u3066\u89E6\u308B",appScreens:"\u753B\u9762",appScreensHint:"\u8D77\u70B9\u306B\u3059\u308B\u753B\u9762\u3092\u9078\u3073\u3001\u3042\u3068\u306F UI \u306E\u30EA\u30F3\u30AF\u3067\u79FB\u52D5\u3057\u307E\u3059\u3002",appSelectLabel:"\u30A2\u30D7\u30EA",appOutsideBrowser:"\u30D6\u30E9\u30A6\u30B6\u4EE5\u5916",noStepBefore:"Step \u304C\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002Prototype \u306F ",noStepAfter:" \u306E\u610F\u5473\u69CB\u9020\u3092\u6301\u3061\u30011 Step = \u30B7\u30CA\u30EA\u30AA\u306E 1 \u5834\u9762\uFF08\u30E6\u30FC\u30B6\u30FC\u304C\u3044\u308B\u753B\u9762\u3068\u3001\u624B\u5143\u306B\u3042\u308B\u3082\u306E\uFF09\u3067\u3059\u3002base JSON \u306B Step \u3092\u8FFD\u52A0\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u305D\u306E\u753B\u9762\u304C\u73FE\u308C\u307E\u3059\u3002",noScreens:"\u3053\u306E\u30D7\u30ED\u30C0\u30AF\u30C8\u306B\u306F\u307E\u3060\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002base JSON \u306E apps[].screens \u306B\u30A2\u30D7\u30EA\u3068\u753B\u9762\u3092\u5BA3\u8A00\u3059\u308B\u3068\u3001\u3053\u3053\u306B\u73FE\u308C\u307E\u3059\u3002",noPreviewMetadata:"preview metadata \u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u8FFD\u52A0\u306F Agent \u306B\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044",storyWithoutSteps:"\u3053\u306E UserStory \u306B\u306F\u307E\u3060 Step \u304C\u306A\u304F\u3001\u898B\u305B\u308B\u753B\u9762\u304C\u3042\u308A\u307E\u305B\u3093\u3002+ Step \u3067\u8FFD\u52A0\u3059\u308B\u304B\u3001Agent \u306B\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u3092\u4F9D\u983C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",pageActor:e=>`\u5229\u7528\u8005: ${e}`,maximize:"\u6700\u5927\u5316",restore:"\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",maximizeHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u3060\u3051\u3092\u30BF\u30D6\u3044\u3063\u3071\u3044\u306B\u8868\u793A \xB7 Esc \u3067\u623B\u308B",situation:"\u72B6\u6CC1",uiComment:"UI \u306B\u30B3\u30E1\u30F3\u30C8",uiCommentHint:"\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30B3\u30E1\u30F3\u30C8 \xB7 Esc \u3067\u7D42\u4E86",uiCommentPin:(e,t)=>`\u30B3\u30E1\u30F3\u30C8 ${e}: ${t}`,uiCommentAs:"\u30B3\u30E1\u30F3\u30C8\u306E\u7A2E\u985E",uiCommentFeedback:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",uiCommentFeedbackHint:"Agent \u3078\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u9001\u4FE1\u3055\u308C\u307E\u3059\u3002\u53CD\u6620\u3055\u308C\u308B\u3068\u6D88\u3048\u307E\u3059\u3002",uiCommentNote:"\u30E1\u30E2",uiCommentNoteHint:"\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306E\u4E00\u90E8\u3068\u3057\u3066\u8981\u7D20\u306B\u6B8B\u308A\u3001\u30B7\u30CA\u30EA\u30AA\u30D3\u30E5\u30FC\u3067\u30D0\u30C3\u30B8\u3068\u3057\u3066\u8868\u793A\u3055\u308C\u307E\u3059\u3002",uiNoteSubmit:"\u6B8B\u3059",uiNotes:e=>`\u30E1\u30E2 ${e} \u4EF6`,uiNotesOn:e=>`${e} \u306E\u30E1\u30E2`,uiNoteDate:e=>Ct("ja-JP",e),deleteUiNoteAria:"\u30E1\u30E2\u3092\u524A\u9664",editUiNoteAria:"\u30E1\u30E2\u3092\u7DE8\u96C6",editUiNoteLabel:"\u30E1\u30E2",editUiNoteHint:"Ctrl/Cmd + Enter \u3067\u4FDD\u5B58\u3001Esc \u3067\u9589\u3058\u308B",saveUiNote:"\u4FDD\u5B58",cancelUiNote:"\u30AD\u30E3\u30F3\u30BB\u30EB",closeUiNotes:"\u9589\u3058\u308B",addUiNote:"\u30E1\u30E2\u3092\u8FFD\u52A0",editUiNote:"\u30E1\u30E2\u3092\u7DE8\u96C6",deleteUiNote:"\u30E1\u30E2\u3092\u524A\u9664",mailFrom:"\u5DEE\u51FA\u4EBA",mailTo:"\u5B9B\u5148",mailCc:"Cc",mailDate:"\u65E5\u6642",demo:"\u30C7\u30E2",demoHint:"\u307B\u304B\u306B\u4F55\u3082\u51FA\u3055\u305A\u3001\u30BF\u30D6\u3044\u3063\u3071\u3044\u306E\u30D6\u30E9\u30A6\u30B6\u3067\u30A2\u30D7\u30EA\u3092\u89E6\u308B \xB7 Esc \u3067\u7D42\u4E86",exitDemo:"\u30C7\u30E2\u3092\u7D42\u4E86",browserBack:"\u623B\u308B",browserForward:"\u9032\u3080",browserReload:"\u518D\u8AAD\u307F\u8FBC\u307F",browserAddress:"\u30A2\u30C9\u30EC\u30B9",browserTabs:"\u30BF\u30D6",newTab:"\u65B0\u3057\u3044\u30BF\u30D6",closeTab:"\u30BF\u30D6\u3092\u9589\u3058\u308B",browserProfile:e=>`\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB: ${e}`,browserGuest:"\u30B2\u30B9\u30C8",newTabShortcuts:"\u3053\u306E\u30A2\u30D7\u30EA\u306E\u30DA\u30FC\u30B8",unreachableTitle:"\u3053\u306E\u30B5\u30A4\u30C8\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093",unreachableBody:"\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306B\u3053\u306E\u30A2\u30C9\u30EC\u30B9\u306E\u30DA\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",device:"\u30C7\u30D0\u30A4\u30B9",deviceHint:"\u30A2\u30D7\u30EA\u3092\u52D5\u304B\u3059\u753B\u9762\u306E\u5927\u304D\u3055\u3002\u53CE\u307E\u3089\u306A\u3044\u30DA\u30FC\u30B8\u306F\u5B9F\u6A5F\u3068\u540C\u3058\u304F\u753B\u9762\u306E\u4E2D\u3067\u30B9\u30AF\u30ED\u30FC\u30EB\u3059\u308B",deviceName:e=>Ot[e]??qn[e]??e,deviceZoom:e=>`\u53CE\u307E\u308B\u3088\u3046 ${e}% \u3067\u8868\u793A`,actions:"\u30A2\u30AF\u30B7\u30E7\u30F3",actionsHint:"\u30D5\u30A9\u30FC\u30E0\u306B\u30B5\u30F3\u30D7\u30EB\u30C7\u30FC\u30BF\u3092\u5165\u308C\u308B\u306A\u3069\u3001\u753B\u9762\u306B\u7528\u610F\u3055\u308C\u305F\u64CD\u4F5C\u3092\u4E00\u5EA6\u306B\u884C\u3046"}}),Ct=(e,t)=>new Intl.DateTimeFormat(e,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)),Fn=["scenario","app"],V="view",le=e=>e[V]==="app"?"app":"scenario",Mt=e=>({[V]:e==="app"?"app":null}),pe=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,Gn=e=>({SET_ACTIVITY_NAME:(t,i)=>({title:e.renameActivity,tone:"update",body:pe(U(i,t.target.id)?.name,k(m.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,i)=>({title:e.updateActivityDescription,tone:"update",body:ye(U(i,t.target.id)?.description,k(m.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,i)=>({title:e.renameStory,tone:"update",body:pe($(i,t.target.id)?.story.name,k(m.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,i)=>({title:e.updateStoryDescription,tone:"update",body:ye($(i,t.target.id)?.story.description,k(m.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,i)=>({title:e.renameStep,tone:"update",body:pe(S(i,t.target.id)?.step.name,k(m.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,i)=>({title:e.updateStepDescription,tone:"update",body:ye(S(i,t.target.id)?.step.description,k(m.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,i)=>({title:e.changePreviewKind,tone:"update",body:pe(E(i,t.target.id)?.preview.kind,k(m.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,i)=>({title:e.changePreviewViewport,tone:"update",body:pe(E(i,t.target.id)?.preview.viewport,k(m.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${k(m.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>Ue(e,e.activityGroup,k(m.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>Ue(e,e.storyGroup,k(m.REORDER_STORY,t).after),REORDER_STEP:t=>Ue(e,e.stepGroup,k(m.REORDER_STEP,t).after),MOVE_STORY:(t,i)=>({title:e.moveStory,tone:"move",body:`\u2192 ${U(i,k(m.MOVE_STORY,t).toActivity)?.name??k(m.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,i)=>({title:e.moveStep,tone:"move",body:`\u2192 ${$(i,k(m.MOVE_STEP,t).toStory)?.story.name??k(m.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>we(e,e.activityGroup,k(m.ADD_ACTIVITY,t).name),ADD_STORY:t=>we(e,e.storyGroup,k(m.ADD_STORY,t).name),ADD_STEP:t=>we(e,e.stepGroup,k(m.ADD_STEP,t).name),ADD_PREVIEW:t=>we(e,e.previewGroup,k(m.ADD_PREVIEW,t).label??k(m.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,i)=>be(e,U(i,t.target.id)?.name),DELETE_STORY:(t,i)=>be(e,$(i,t.target.id)?.story.name),DELETE_STEP:(t,i)=>be(e,S(i,t.target.id)?.step.name),DELETE_PREVIEW:(t,i)=>be(e,E(i,t.target.id)?.preview.label),ADD_UI_NOTE:t=>({title:e.addUiNote,tone:"create",body:`+ "${Le(k(m.ADD_UI_NOTE,t).body)}"`}),SET_UI_NOTE_BODY:(t,i)=>{const{noteId:n,body:o}=k(m.SET_UI_NOTE_BODY,t);return{title:e.editUiNote,tone:"update",body:ye(Yt(i,n)?.body,o)}},DELETE_UI_NOTE:(t,i)=>{const{noteId:n}=k(m.DELETE_UI_NOTE,t),o=Yt(i,n);return{title:e.deleteUiNote,tone:"delete",body:o===void 0?e.unknownTarget:`\u2212 "${Le(o.body)}"`}}}),ye=(e,t)=>{const i=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${i}"`:`"${Le(e)}" \u2192 "${i}"`},Le=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,Ue=(e,t,i)=>({title:e.reorderTitle(t),tone:"move",body:i===null?e.toFront:e.afterName(i)}),we=(e,t,i)=>({title:e.addTitle(t),tone:"create",body:`+ "${i}"`}),be=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),Lt=(e,t,i,n)=>{const o=Gn(e),s=Object.hasOwn(o,t.type)?o[t.type]:void 0,r=s?s(t,n??i):{title:t.type,tone:"meta"};return{title:r.title,targetLabel:Vt(e,i,t.target),tone:r.tone,...r.body===void 0?{}:{summary:r.body}}},Ut=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,Vt=(e,t,i)=>{switch(i.type){case"activity":{const n=U(t,i.id);return n?e.targetLabel(e.activityGroup,n.name):e.targetMissing(e.activityGroup,i.id)}case"story":{const n=$(t,i.id)?.story;return n?e.targetLabel(e.storyGroup,n.name):e.targetMissing(e.storyGroup,i.id)}case"step":{const n=S(t,i.id)?.step;return n?e.targetLabel(e.stepGroup,n.name):e.targetMissing(e.stepGroup,i.id)}case"screen":{const n=L(t,i.id)?.screen;return n?e.targetLabel(e.screenGroup,n.title):e.targetMissing(e.screenGroup,i.id)}case"preview":{const n=E(t,i.id)?.preview;return n?e.targetLabel(e.previewGroup,n.label??n.id):e.targetMissing(e.previewGroup,i.id)}case"page":return e.targetLabel(e.pageGroup,He(t));case O:{const n=Q(i.id),o=n?E(t,n.previewId)?.preview:void 0;return n&&o?e.targetLabel(e.uiGroup,Ve(o,n)):e.targetMissing(e.uiGroup,i.id)}default:return e.targetLabel(i.type,i.id)}},Ve=(e,t)=>{const i=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${i}`},zt=(e,t)=>{const i=[];for(const n of e){if(n.target.type!==O)continue;const o=Q(n.target.id);!o||!t.includes(o.previewId)||i.push({id:n.id,previewId:o.previewId,selector:o.selector,number:i.length+1,body:Qe(n)})}return i},jn=(e,t)=>t.flatMap(i=>{const n=E(e,i)?.preview,o=new Map;for(const s of n?.notes??[])o.set(s.selector,[...o.get(s.selector)??[],s]);return n===void 0?[]:[...o].map(([s,r])=>({previewId:i,selector:s,label:Ve(n,{selector:s,...Kn(r)}),notes:r}))}),Kn=e=>{const t=[...e].reverse().find(i=>i.text!==void 0)?.text;return t===void 0?{}:{text:t}},Yt=(e,t)=>It(e).flatMap(i=>i.notes??[]).find(i=>i.id===t),Ht=(e,t)=>zt(e,t).length,Xn=/^[a-z][a-z0-9+.-]*:/i,Zn=e=>{const t=e.baseUrl?.trim(),i=Ki(e.title??"");return`${(t?t.startsWith("http")?t:`https://${t}`:`https://${i==="item"?"page":i}.example.com`).replace(/\/+$/,"")}/`},ke=(e,t)=>{const i=Zn(e);if(!t.url)return`${i}${t.id}`;if(Xn.test(t.url))return t.url;try{return decodeURI(new URL(t.url,i).href)}catch{return t.url}},Jn=e=>{switch(e.type){case"activity":return{[V]:null,activity:e.id};case"story":return{[V]:null,activity:null,story:e.id};case"step":return{[V]:null,activity:null,story:null,step:e.id};case"screen":return{screen:e.id};default:return null}},Bt=(e,t)=>{const i=e.kind==="screen"?[{type:"screen",id:e.screen.id}]:[{type:"activity",id:e.activity.id},{type:"story",id:C(e.activity.id,e.story.id)},...e.kind==="step"?[{type:"step",id:ae(e)}]:[]];for(const n of t?.panes??[])n.kind==="screen"&&i.push({type:"screen",id:n.screen.screen.id});return[...new Set(i.map(Y))].join(" ")},ze=",",Wt=e=>e.preview?.split(ze)??[],Qn=(e,t)=>e.kind===t.kind&&e.viewport===t.viewport,qt=(e,t,i)=>{const n=t.find(s=>i.includes(s.id));if(n)return n;const o=i.flatMap(s=>E(e,s)?.preview??[]);return t.find(s=>o.some(r=>Qn(s,r)))??t[0]},Ft=(e,t,i,n)=>{const o=t.screen.previews,s=i===void 0?qt(e,o,Wt(n)):o.find(a=>a.id===i);if(!s)return;const r=i===void 0&&o.length>1;return{kind:"screen",screen:t,preview:s,pinned:i!==void 0,tabs:r?o:[]}},Gt=e=>({layout:e.length>1?"side-by-side":"single",panes:e,shown:e.map(t=>t.preview)}),jt=(e,t,i)=>t.panes.flatMap(n=>{if(!J(n))return[{kind:"material",preview:n.material}];const o=L(e,n.screen),s=o&&Ft(e,o,n.preview,i);return s?[s]:[]}),Ye=(e,t,i)=>{if(t.kind==="screen"){const n=Ft(e,t,void 0,i);return Gt(n?[n]:[])}return Gt(jt(e,t.step,i))},eo=(e,t)=>e.panes.flatMap(i=>i.kind!=="screen"||i.tabs.length===0?[]:[i.tabs.some(n=>n.id===t)?t:i.preview.id]).join(ze),Kt=(e,t)=>{const i=new Map;for(const n of t){const o=E(e,n)?.owner;if(o?.kind!=="screen"||o.screen.actions.length===0)continue;const s=i.get(o.screen.id)??{screen:o.screen,previewIds:[]};s.previewIds.push(n),i.set(o.screen.id,s)}return[...i.values()].map(({screen:n,previewIds:o})=>({screen:n,previewIds:o,actions:n.actions}))},to=(e,t)=>[...F(t),...ve(e,t).flatMap(i=>i.screen.previews)],io=["activity","story","step","screen","preview"],no=(e,t,i)=>{switch(t){case"activity":return U(e,i)!==void 0;case"story":return $(e,i)!==void 0||e.activities.some(n=>n.stories.some(o=>o.id===i));case"step":return S(e,i)!==void 0||B(e).some(n=>n.step.id===i);case"screen":return L(e,i)!==void 0;case"preview":return E(e,i)!==void 0;default:return!1}},oo=(e,t)=>{let i;if(t.navigate!==null)i=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const s=t.href?.trim()??"";if(s===""||s==="#"||s.toLowerCase().startsWith("javascript:"))return"no-destination";if(!s.startsWith("#"))return null;i=s}const n=_e(i),o=io.filter(s=>n[s]!==void 0);return o.length===0?t.navigate===null?null:"unknown-target":o.every(s=>no(e,s,n[s]??""))?null:"unknown-target"},so=(e,t)=>{const i=t.mail??{},n=[{label:e.mailFrom,value:i.from},{label:e.mailTo,value:i.to},{label:e.mailCc,value:i.cc},{label:e.mailDate,value:i.date}].flatMap(r=>r.value===void 0||r.value.trim()===""?[]:[{label:r.label,value:r.value}]),o=i.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||i.from?.trim(),s=o?Array.from(o)[0]?.toUpperCase():void 0;return{...i.subject===void 0||i.subject.trim()===""?{}:{subject:i.subject},...o?{sender:o}:{},...s===void 0?{}:{initial:s},rows:n}},Xt=(e,t)=>{const i=[];for(const n of t.activities){i.push({value:Y({type:"activity",id:n.id}),label:n.name,group:e.activityGroup});for(const o of n.stories){i.push({value:Y({type:"story",id:C(n.id,o.id)}),label:`${n.name} \u203A ${o.name}`,group:e.storyGroup});for(const s of o.steps)i.push({value:Y({type:"step",id:fe(n,o,s)}),label:`${o.name} \u203A ${s.name}`,group:e.stepGroup})}}for(const{app:n,screen:o}of H(t))i.push({value:Y({type:"screen",id:o.id}),label:`${n.name} \u203A ${o.title}`,group:e.screenGroup});return i},ro=(e,t,i)=>{const n=te(t,i);if(n?.kind==="screen"){const{screen:o}=n;return{value:Y({type:"screen",id:o.id}),label:o.title,group:e.screenGroup}}return n?.kind!=="step"?null:{value:Y({type:"step",id:ae(n)}),label:n.step.name,group:e.stepGroup}},te=(e,t)=>{if(le(t)==="app"){const s=L(e,t.screen);return s?{kind:"screen",...s}:void 0}const i=S(e,t.step);if(i)return{kind:"step",...i};const n=U(e,t.activity),o=n?.stories.find(s=>s.id===t.story||C(n.id,s.id)===t.story);return n&&o?{kind:"story",activity:n,story:o}:void 0},Zt=(e,t)=>{const i=(d,p)=>p===void 0?{title:d}:{actor:p,title:d};if(t.kind==="screen")return i(t.screen.title,t.app.actor);const{activity:n,story:o,step:s}=t,r=ve(e,s),a=r.length===1?r[0]:void 0;return i(a?.screen.title??s.name,s.actor??o.actor??n.actor??a?.app.actor)},ao=(e,t)=>{const i=t.actor??e.actor;return i===void 0?{title:t.name}:{actor:i,title:t.name}},He=e=>e.title??"UX Prototype",Jt=(e,t)=>(t?e.preview=t:delete e.preview,e),lo=(e,t,i)=>{if(!t)return;const n=jt(e,t,i).flatMap(o=>o.kind==="screen"&&!o.pinned?[o.preview.id]:[]);return n.length===0?void 0:n.join(ze)},Qt=(e,t)=>{const i=()=>{if(t.step===void 0&&t.story===void 0)return;const s=ei(e,{...t,[V]:""}),r=S(e,s.step);return r&&ve(e,r.step)[0]},n=L(e,t.screen)??i()??H(e)[0],o={...t,[V]:"app"};for(const s of["activity","story","step"])delete o[s];return n?o.screen=n.screen.id:delete o.screen,Jt(o,n&&qt(e,n.screen.previews,Wt(t))?.id)},po=(e,t,i)=>{const n=r=>Hn(r.step,t);if(i&&n(i))return i;const o=i?.story.steps??[],s=r=>{const a=o[r];return i&&a?{...i,step:a,stepIndex:r}:void 0};for(let r=(i?.stepIndex??0)+1;r<o.length;r+=1){const a=s(r);if(a&&n(a))return a}for(let r=(i?.stepIndex??0)-1;r>=0;r-=1){const a=s(r);if(a&&n(a))return a}return B(e).find(n)},ei=(e,t)=>{const i=U(e,t.activity),n=t.story,o=i?.stories.find(z=>z.id===n||C(i.id,z.id)===n),s=o&&i?{activity:i,story:o}:$(e,n),r=t.step,d=(s&&r?S(e,`${C(s.activity.id,s.story.id)}.${r}`):void 0)??S(e,r),p=t.screen,c=p===void 0?void 0:po(e,p,d);if(p!==void 0&&!c&&L(e,p))return Qt(e,{...t,[V]:"app"});const v=c??d,f=v?.activity??s?.activity??i??e.activities[0],I=v?.story??(s&&s.activity===f?s.story:void 0)??f?.stories[0],P=v?.step??I?.steps[0],T={...t};return delete T.screen,f?T.activity=f.id:delete T.activity,I&&f?T.story=$(e,I.id)?I.id:C(f.id,I.id):delete T.story,P&&I&&f?T.step=S(e,P.id)?P.id:fe(f,I,P):delete T.step,delete T[V],Jt(T,lo(e,P,t))},co=["activity","story","step","screen"],xe=(e,t)=>le(t)==="app"?Qt(e,t):ei(e,t),uo=(e,t)=>{const i=t.screen.previews.find(s=>s.kind==="browser");if(!i)return;let n;try{n=new URL(ke(e,i),"https://page.example.com")}catch{return}const o=n.pathname.split("/").filter(s=>s!=="").map(s=>{try{return decodeURIComponent(s)}catch{return s}});return{origin:n.origin,segments:o}},ti=()=>({screens:[],children:new Map}),Be=(e,t,i)=>{const[n,...o]=e.children.entries();if(e.screens.length===0&&n&&o.length===0&&i!=="/"){const[s,r]=n;return Be(r,`${t}/${s}`,`${i}/${s}`)}return{segment:t,path:i,screens:e.screens,children:[...e.children.entries()].map(([s,r])=>Be(r,`/${s}`,`${i==="/"?"":i}/${s}`))}},ho=e=>{const t=new Map;for(const[i,n]of e){const o=t.get(n.origin)??ti();t.set(n.origin,o);let s=o;for(const r of n.segments){const a=s.children.get(r)??ti();s.children.set(r,a),s=a}s.screens.push(i)}return[...t.entries()].map(([i,n])=>({origin:i,root:Be(n,"/","/")}))},vo=(e,t)=>{const i=t.screens.map(s=>({app:t,screen:s})),n=[],o=[];for(const s of i){const r=uo(e,s);r?n.push([s,r]):o.push(s)}return{app:t,screens:i,trees:ho(n),others:o}},ii=e=>e.apps.map(t=>vo(e,t)).filter(t=>t.screens.length>0),ni=(e,t)=>t?.kind!=="screen"?e[0]:e.find(i=>i.app.id===t.app.id)??e[0],fo=(e,t)=>{switch(t.type){case"activity":return U(e,t.id)!==void 0;case"story":return $(e,t.id)!==void 0;case"step":return S(e,t.id)!==void 0;case"screen":return L(e,t.id)!==void 0;case"preview":return E(e,t.id)!==void 0;case"page":return!0;case O:{const i=Q(t.id);return i!==void 0&&E(e,i.previewId)!==void 0}default:return!1}},oi=e=>{const t=me(e);return{kind:"view",name:"prototype",label:"UX Prototype",addable:!1,parseBase:$t,emptyBase:Tt,actions:m,apply:Rt,hasTarget:fo,canonicalTarget:(i,n)=>{if(n.type==="step"){const o=S(i,n.id);return o?{...n,id:ae(o)}:n}if(n.type==="story"){const o=$(i,n.id);return o?{...n,id:C(o.activity.id,o.story.id)}:n}if(n.type==="preview"){const o=E(i,n.id);return o?{...n,id:o.preview.id}:n}return n},describe:(i,n,o)=>Lt(t,i,n,o),serialize:Ut,resolveNavigation:xe,navigationHierarchy:co,navigationFor:(i,n)=>Jn(n),commentTargets:(i,n)=>Xt(t,i),currentTarget:(i,n)=>ro(t,i,n),title:He}},go=(e,t)=>{const i=t.flatMap(n=>{const o=Math.max(n.left,e.left)-e.left,s=Math.max(n.top,e.top)-e.top,r=Math.min(n.right,e.right)-e.left-o,a=Math.min(n.bottom,e.bottom)-e.top-s;return r>0&&a>0?[`M${o} ${s}h${r}v${a}h-${r}Z`]:[]});return i.length===0?"none":`path(evenodd, 'M0 0H${e.width}V${e.height}H0Z ${i.join(" ")}')`},Ee="data-dpk-modal",mo=e=>{try{return e.matches(":modal")}catch{return!1}},si=e=>{e.setAttribute(Ee,""),e.open||e.show()},ri=e=>{Object.hasOwn(e,"showModal")||Object.defineProperty(e,"showModal",{configurable:!0,value:()=>si(e)})},ai=(e,t)=>{if(!mo(t))return;const i=n=>{n.target===t&&(n.stopImmediatePropagation(),e.removeEventListener("close",i,!0))};e.addEventListener("close",i,!0),t.close(),si(t)},di=(e,t)=>{try{return Array.from(e.querySelectorAll(t))}catch{return[]}},yo=(e,t)=>{const i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value");i?.set?i.set.call(e,t):e.value=t},wo=e=>e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"),bo=(e,t)=>{if(wo(e)){const n=typeof t=="boolean"?t:e.value===t;return typeof t=="string"&&!n?!1:(e.checked=n,!0)}const i=String(t);return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?(yo(e,i),!0):(e.textContent=i,!1)},ko=(e,t)=>{const i=[];for(const[n,o]of Object.entries(t)){const s=di(e,n);s.length===0&&i.push(n);for(const r of s)bo(r,o)&&(r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})))}return i},xo=(e,t)=>{const i=[];for(const n of t){const[o]=di(e,n);o instanceof HTMLElement?o.click():i.push(n)}return i},Eo='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',li=/^-?[A-Za-z_][\w-]*$/,pi=40,So=(e,t)=>{const i=e.closest(Eo);return i!==null&&i!==t&&t.contains(i)?i:e},Se=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const i=Array.from(t);return i.length>pi?`${i.slice(0,pi).join("")}\u2026`:t},$o=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return Se(t);const i=e.tagName.toLowerCase();return Se(i==="input"||i==="textarea"||i==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":i==="img"?e.getAttribute("alt")??"":e.textContent??"")},To=e=>{const t=e.getAttribute("id");if(t&&li.test(t))return`#${t}`;const i=e.tagName.toLowerCase(),n=Array.from(e.classList).filter(a=>li.test(a)).slice(0,2).map(a=>`.${a}`).join(""),o=e.parentElement,s=o?Array.from(o.children).filter(a=>a.tagName===e.tagName):[],r=s.length>1?`:nth-of-type(${s.indexOf(e)+1})`:"";return`${i}${n}${r}`},Ao=(e,t,i)=>{try{const n=e.querySelectorAll(t);return n.length===1&&n[0]===i}catch{return!1}},Io=(e,t)=>{const i=[];let n=e;for(;n!==null&&n!==t;){const s=To(n);if(i.unshift(s),s.startsWith("#")||Ao(t,i.join(" > "),e))break;n=n.parentElement}const o=$o(e);return{selector:i.length===0?":scope":i.join(" > "),tag:e.tagName.toLowerCase(),...o===void 0?{}:{text:o}}},_o=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},ci=(e,t)=>{const i=xe(e,t),n=te(e,i);if(n?.kind!=="screen")return null;const[o]=Ye(e,n,i).shown;return o?.kind!=="browser"?null:{screen:n.screen.id,preview:o.id}},$e=(e,t)=>{const i=te(e,xe(e,{[V]:"app",...t}));return i?.kind==="screen"?i:void 0},Po=(e,t,i)=>{const n=dt(t,i);if(n===null)return null;const o=lt(n);for(const{screen:s}of H(e))for(const r of s.previews){if(r.kind!=="browser")continue;const a=dt(ke(e,r),i);if(a!==null&&lt(a)===o)return{screen:s.id,preview:r.id}}return null},Do=(e,t,i)=>t===void 0||t.kind==="new-tab"?i.newTab:t.kind==="unreachable"?rt(t.url):$e(e,t.page)?.screen.title??i.newTab,ui=(e,t)=>{if(t===void 0||t.kind==="new-tab")return"";if(t.kind==="unreachable")return t.url;const i=$e(e,t.page)?.screen.previews.find(n=>n.id===t.page.preview);return i===void 0?"":ke(e,i)},hi=e=>{const t=at(e);for(let i=t.index;i>=0;i-=1){const n=t.history[i];if(n?.kind==="page")return n.page}for(const i of e.tabs){const n=i.history[i.index];if(n?.kind==="page")return n.page}},Ro=(e,t)=>t===void 0?void 0:$e(e,t)?.app.actor,vi=(e,t,i,n=null)=>{const o=at(t),s=o.history[o.index],r=Ro(e,hi(t)??n??void 0);return{tabs:t.tabs.map(a=>({id:a.id,title:Do(e,a.history[a.index],i),url:ui(e,a.history[a.index]),active:a.id===o.id})),entry:s,url:ui(e,s),canBack:hn(t),canForward:un(t),...r===void 0?{}:{profile:r}}},No=e=>hi(e)??null,Oo=(e,t)=>{const i=t===null?void 0:$e(e,t),n=ni(ii(e),i),o=[],s=(r,a)=>{for(const{screen:d}of a.screens){const p=d.previews.find(c=>c.kind==="browser");p!==void 0&&o.push({title:d.title,url:`${r}${a.path==="/"?"":a.path}`,page:{screen:d.id,preview:p.id}})}for(const d of a.children)s(r,d)};for(const r of n?.trees??[])s(rt(r.origin),r.root);return o},A=(e,t,i,n)=>({id:t,deviceClass:e,width:i,height:n}),fi=[A("phone","iphone-se",375,667),A("phone","iphone-16",393,852),A("phone","iphone-16-pro-max",440,956),A("phone","pixel-7",412,915),A("phone","galaxy-s24",360,780),A("tablet","ipad-mini",744,1133),A("tablet","ipad-air-11",820,1180),A("tablet","ipad-pro-11",834,1194),A("tablet","ipad-pro-13",1024,1366),A("desktop","laptop-13",1280,800),A("desktop","laptop-15",1440,900),A("desktop","full-hd",1920,1080),A("desktop","monitor-27",2560,1440),A("desktop","ultrawide",3440,1440)],Co={phone:A("phone","iphone-16",393,852),tablet:A("tablet","ipad-pro-11",834,1194),desktop:A("desktop","laptop-13",1280,800)},gi=e=>e==="mobile"?"phone":e==="tablet"?"tablet":"desktop",Mo=e=>e!=="plain",mi=e=>fi.filter(t=>t.deviceClass===e),Lo=(e,t)=>{const i=gi(e),n=t[i];return mi(i).find(o=>o.id===n)??Co[i]},Uo=(e,t)=>{const i=fi.find(n=>n.id===t);return i===void 0||e[i.deviceClass]===t?e:{...e,[i.deviceClass]:t}},Vo=(e,t)=>`${e.deviceName(t.id)} \xB7 ${t.width}\xD7${t.height}`,zo=(e,t)=>{const i=[1,t.width/e.width];t.height!==void 0&&i.push(t.height/e.height);const n=Math.min(...i);return!Number.isFinite(n)||n<=0?1:Math.max(.1,Math.floor(n*100)/100)},yi=(e,t,i)=>{const{state:n,navigation:o}=e,s=te(n,o),r=le(o);return l`
2
- <div class="nav">
3
- ${Bo(e,t,r)}
4
- ${r==="app"?Wo(e,t,s,i.app):s!==void 0&&s.kind!=="screen"?Go(e,t,s,i):l`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`}
5
- </div>
6
- `},Yo={scenario:"viewScenario",app:"viewApp"},Ho={scenario:"viewScenarioHint",app:"viewAppHint"},Bo=(e,t,i)=>l`<nav class="dpk-segmented view-switch" aria-label=${t.viewLabel}>
7
- ${Fn.map(n=>l`<a
8
- class="view-option"
9
- href=${e.hashFor(Mt(n))}
10
- title=${t[Ho[n]]}
11
- aria-current=${n===i?"page":h}
12
- data-view=${n}
13
- >${t[Yo[n]]}</a
14
- >`)}
15
- </nav>`,Wo=(e,t,i,n)=>{const o=i?.kind==="screen"?i:void 0,s=ii(e.state),r=ni(s,i),a={context:e,currentId:o?.screen.id},d=r?.others??[];return l`
16
- ${s.length>1&&r?qo(e,t,s,r,n):h}
17
- ${s.length===1&&r?.app.description?l`<p class="app-description">${r.app.description}</p>`:h}
18
- <div class="steps-head">
19
- <span class="dpk-label">${t.appScreens}</span>
20
- <span class="dpk-label">${r?.screens.length??0}</span>
21
- </div>
22
- <p class="app-hint">${t.appScreensHint}</p>
23
- ${r?.trees.map(p=>l`<section class="app-tree">
24
- <h3 class="app-origin">${Fo(p.origin)}</h3>
25
- <ul class="tree">
26
- ${wi(a,p.root,0)}
27
- </ul>
28
- </section>`)}
29
- ${d.length===0?h:l`<section class="app-group">
30
- ${(r?.trees.length??0)>0?l`<h3 class="app-group-heading">${t.appOutsideBrowser}</h3>`:h}
31
- <ul class="steps app-screens">
32
- ${d.map(p=>{const c=bi(a,p);return l`<li class="step-row" data-current=${String(c)}>
33
- <a class="step-link" href=${xi(e,p)} aria-current=${c?"page":h}>
34
- <span class="step-name">${p.screen.title}</span>
35
- ${Ei(e,p)}
36
- </a>
37
- </li>`})}
38
- </ul>
39
- </section>`}
40
- ${o?.screen.description?l`<div class="detail">
41
- <div class="screen-description dpk-prose">${Pe(De(o.screen.description))}</div>
42
- </div>`:h}
43
- `},qo=(e,t,i,n,o)=>l`<div class="field">
44
- <span class="dpk-label">${t.appSelectLabel}</span>
45
- ${o.render({options:i.map((s,r)=>({value:String(r),label:s.app.name})),value:String(i.indexOf(n)),onChange:s=>{const r=i[Number(s)]?.screens[0];r&&e.navigate(ki(r))},ariaLabel:t.appSelectLabel})}
46
- ${n.app.description?l`<p class="app-description">${n.app.description}</p>`:h}
47
- </div>`,wi=(e,t,i)=>l`<li
48
- class="tree-node"
49
- >
50
- ${t.screens.length===0&&i===0?h:t.screens.length===0?l`<div class="tree-row" data-depth=${String(i)} data-current="false">
51
- <span class="tree-link" title=${t.path}><code class="tree-path">${t.segment}</code></span>
52
- </div>`:t.screens.map(n=>{const o=bi(e,n);return l`<div class="tree-row" data-depth=${String(i)} data-current=${String(o)}>
53
- <a
54
- class="tree-link"
55
- href=${xi(e.context,n)}
56
- title=${t.path}
57
- aria-current=${o?"page":h}
58
- >
59
- <code class="tree-path">${t.segment}</code>
60
- <span class="tree-title">${n.screen.title}</span>
61
- ${Ei(e.context,n)}
62
- </a>
63
- </div>`})}
64
- ${t.children.length>0?l`<ul class="tree">
65
- ${t.children.map(n=>wi(e,n,i+1))}
66
- </ul>`:h}
67
- </li>`,bi=(e,t)=>t.screen.id===e.currentId,ki=e=>({screen:e.screen.id,preview:null}),xi=(e,t)=>e.hashFor(ki(t)),Ei=(e,t)=>{const i=e.commentCount({type:"screen",id:t.screen.id})+Ht(e.comments,t.screen.previews.map(n=>n.id));return i>0?l`<span class="step-note">${i}</span>`:h},Fo=e=>e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""),Go=(e,t,i,n)=>{const{state:o}=e,{activity:s,story:r}=i,a=r.steps,d=i.kind==="step"?i.step:void 0,p=i.kind==="step"?ae(i):void 0;return l`
68
- <div class="field">
69
- <span class="dpk-label">Activity</span>
70
- ${n.activity.render({options:o.activities.map(c=>({value:c.id,label:c.name})),value:s.id,onChange:c=>e.navigate({activity:c,story:null,step:null}),ariaLabel:"Activity"})}
71
- </div>
72
- <div class="field">
73
- <span class="dpk-label">User Story</span>
74
- ${n.story.render({options:s.stories.map(c=>({value:c.id,label:c.name})),value:r.id,onChange:c=>e.navigate({activity:s.id,story:c,step:null}),ariaLabel:"User Story"})}
75
- </div>
76
- <div class="steps-head">
77
- <span class="dpk-label">Step</span>
78
- <span class="dpk-label">${a.length}</span>
79
- </div>
80
- <ol class="steps">
81
- ${Xi(a,c=>fe(s,r,c),(c,v)=>{const f=fe(s,r,c),I=e.commentCount({type:"step",id:f})+Ht(e.comments,to(o,c).map(P=>P.id));return l`
82
- <li class="step-row" data-current=${String(c.id===d?.id)}>
83
- <a class="step-link" href=${e.hashFor({activity:s.id,story:r.id,step:c.id})}>
84
- <span class="step-index">${String(v+1).padStart(2,"0")}</span>
85
- <span class="step-name">${c.name}</span>
86
- ${I>0?l`<span class="step-note">${I}</span>`:h}
87
- </a>
88
- <span class="row-tools">
89
- <button
90
- class="dpk-icon-btn"
91
- type="button"
92
- aria-label=${t.deleteStepAria}
93
- @click=${()=>e.dispatch(W.deleteStep(f))}
94
- >
95
- ${Re()}
96
- </button>
97
- </span>
98
- </li>
99
- `})}
100
- </ol>
101
- <button class="dpk-btn" type="button" @click=${()=>Ko(e,t,C(s.id,r.id))}>
102
- ${t.addStepButton}
103
- </button>
104
- ${d?pt(p,l`<div class="detail">
105
- <div class="detail-row">
106
- <span class="dpk-label">${t.stepNameLabel}</span>
107
- <span class="detail-value">
108
- <dpk-inline-edit
109
- .value=${d.name}
110
- .label=${t.stepNameLabel}
111
- @dpk-commit=${et(c=>e.dispatch(W.setStepName(p??d.id,c)))}
112
- ></dpk-inline-edit>
113
- </span>
114
- </div>
115
- <div class="detail-row">
116
- <span class="dpk-label">${t.descriptionLabel}</span>
117
- <span class="detail-value">
118
- <dpk-inline-edit
119
- multiline
120
- markdown
121
- .value=${d.description??""}
122
- .placeholder=${t.descriptionPlaceholder}
123
- .label=${t.descriptionLabel}
124
- @dpk-commit=${et(c=>e.dispatch(W.setStepDescription(p??d.id,c)))}
125
- ></dpk-inline-edit>
126
- </span>
127
- </div>
128
- ${jo(e,t,d)}
129
- </div>`):h}
130
- `},jo=(e,t,i)=>{const n=ve(e.state,i);return n.length===0?h:l`<div class="detail-row">
131
- <span class="dpk-label">${t.screenGroup}</span>
132
- <span class="detail-value">
133
- ${n.map(({app:o,screen:s})=>l`<div class="step-screen-entry">
134
- <a
135
- class="step-screen"
136
- href=${e.hashFor({...Mt("app"),screen:s.id})}
137
- title=${t.openInApp}
138
- >${o.name} › ${s.title}</a
139
- >
140
- ${s.description?l`<div class="screen-description dpk-prose">
141
- ${Pe(De(s.description))}
142
- </div>`:h}
143
- </div>`)}
144
- </span>
145
- </div>`},Ko=(e,t,i)=>{const n=tt("new-step",Pt(e.state));e.dispatch(W.addStep(i,n,t.newStepName)).ok&&e.navigate({story:i,step:n})},Xo=q(In),Zo=q(Zi),Si=(e,t,i="bar")=>l`<button
146
- class=${i==="demo"?"demo-control actions-toggle":"dpk-btn actions-toggle"}
147
- type="button"
148
- data-role="actions"
149
- aria-haspopup="menu"
150
- aria-expanded=${String(t.open)}
151
- title=${e.actionsHint}
152
- @click=${t.toggle}
153
- >
154
- ${Xo()} ${e.actions} ${Zo()}
155
- </button>`,Jo=e=>{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const i=[...t.querySelectorAll('[role="menuitem"]')],n=i.findIndex(a=>a===e.composedPath()[0]),o=e.key==="ArrowDown"?1:e.key==="ArrowUp"?-1:0,s=e.key==="Home"?0:e.key==="End"?i.length-1:o===0?-1:(n+o+i.length)%i.length,r=i[s];r!==void 0&&(e.preventDefault(),r.focus())},Qo=(e,t)=>{if(!t.open||t.groups.length===0)return h;const i=t.groups.length>1;return l`<div
156
- class="comment-pop actions-menu"
157
- popover="manual"
158
- role="menu"
159
- aria-label=${e.actions}
160
- @keydown=${Jo}
161
- >
162
- ${t.groups.map(n=>l`<div class="actions-group" role="group" aria-label=${n.screen.title}>
163
- ${i?l`<span class="actions-group-title" aria-hidden="true">${n.screen.title}</span>`:h}
164
- ${n.actions.map(o=>l`<button
165
- class="actions-item"
166
- type="button"
167
- role="menuitem"
168
- data-action=${o.id}
169
- @click=${()=>t.run(n.screen.id,o.id)}
170
- >
171
- <span class="actions-label">${o.label}</span>
172
- ${o.description===void 0?h:l`<span class="actions-description">${o.description}</span>`}
173
- </button>`)}
174
- </div>`)}
175
- </div>`},$i=(e,t,i="bar")=>{const n=t.mode.kind!=="off";return l`<button
176
- class=${`${i==="demo"?"demo-control":n?"dpk-btn dpk-btn--accent":"dpk-btn"} ui-comment-toggle`}
177
- type="button"
178
- aria-pressed=${n?"true":"false"}
179
- title=${e.uiCommentHint}
180
- @click=${()=>t.send({kind:"toggle"})}
181
- >
182
- ${it()} ${e.uiComment}
183
- </button>`},es=(e,t)=>t.mode.kind==="off"?h:l`<p class="ui-comment-hint" role="status">${it()} ${e.uiCommentHint}</p>`,ts=(e,t)=>t.mode.kind==="off"?h:l`<div class="ui-layer" aria-hidden="true">
184
- <div class="ui-catcher"></div>
185
- <div class="ui-box ui-hover" hidden></div>
186
- <div class="ui-box ui-picked" hidden></div>
187
- ${t.pins.map(i=>l`<span
188
- class="ui-pin"
189
- hidden
190
- data-preview=${i.previewId}
191
- data-selector=${i.selector}
192
- title=${e.uiCommentPin(i.number,i.body)}
193
- >${i.number}</span
194
- >`)}
195
- </div>`,is=e=>e==="feedback"||e==="note",ns=(e,t)=>{const i=t.mode;if(i.kind!=="composing")return h;const n=vn(i.body,t.notes,{key:`ui:${i.target.previewId}/${i.target.selector}`,...t.targetLabel===void 0?{}:{label:t.targetLabel},choice:{label:e.uiCommentAs,value:i.as,options:[{value:"feedback",label:e.uiCommentFeedback,hint:e.uiCommentFeedbackHint},{value:"note",label:e.uiCommentNote,hint:e.uiCommentNoteHint}]},...i.as==="note"?{submitLabel:e.uiNoteSubmit}:{}});return l`${pt(`${i.target.previewId}/${i.target.selector}`,fn(t.composer,n,o=>{o.kind==="input"?t.send({kind:"input",body:o.body}):o.kind==="comment"?t.submit(o.body):o.kind==="choose"?is(o.value)&&t.send({kind:"choose",as:o.value}):t.send({kind:"dismiss"})}))}`},Ti=(e,t)=>l`<div class="demo-controls">
196
- ${t.actions.groups.length>0?Si(e,t.actions,"demo"):h}
197
- ${$i(e,t.uiComment,"demo")}
198
- <button class="demo-control demo-exit" type="button" title=${e.exitDemo} @click=${t.onExit}>
199
- ${Re()} ${e.exitDemo} <kbd>Esc</kbd>
200
- </button>
201
- </div>`,Ai={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},Ii={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},os={browser:0,native:22,mail:0,plain:0},_i=(e,t,i)=>{const n=`--frame-width:${Ai[t]};--frame-min-height:${Ii[t]}`;if(i?.kind!=="device")return n;const o=os[e];return`${n};--device-width:${i.width+o}px;--device-height:${i.height+o}px;zoom:${i.zoom}`},ss=e=>({back:e.browserBack,forward:e.browserForward,reload:e.browserReload,address:e.browserAddress,tabs:e.browserTabs,newTab:e.newTab,closeTab:e.closeTab,profile:e.browserProfile,guest:e.browserGuest,shortcuts:e.newTabShortcuts,unreachableTitle:e.unreachableTitle,unreachableBody:e.unreachableBody}),rs=(e,t)=>l`<slot name=${`preview:${e.id}`}></slot> ${t?h:l`<div class="frame-placeholder">
202
- <span class="dpk-label">light dom preview</span>
203
- <code>&lt;div slot="preview" data-preview-id="${e.id}"&gt;</code>
204
- </div>`}`,as=(e,t,i)=>{const{preview:n,viewport:o}=i,s={view:i.view,phone:o==="mobile",switcher:i.switcher,shortcuts:i.shortcuts.map(r=>({...r,href:e.hashFor(r.page)})),labels:ss(t),...i.demo===void 0?{}:{extra:Ti(t,i.demo)},send:i.send};return l`<figure
205
- class="frame browser"
206
- data-kind="browser"
207
- data-viewport=${o}
208
- ?data-loading=${i.loading}
209
- ?data-empty=${n!==void 0&&!i.hasContent}
210
- data-window=${i.window.kind}
211
- style=${_i("browser",o,i.window)}
212
- >
213
- ${gn(s)}
214
- <div class="viewport browser-page">
215
- ${mn(s,n===void 0?void 0:rs(n,i.hasContent))}
216
- </div>
217
- ${yn(s)}
218
- </figure>`},ie=e=>`${e.previewId}/${e.selector}`,ds=(e,t)=>t.badges.length===0?h:l`<div class="ui-notes">
219
- ${t.badges.map(i=>{const n=t.open!==null&&ie(t.open)===ie(i);return l`<button
220
- class="ui-note-badge"
221
- type="button"
222
- hidden
223
- data-preview=${i.previewId}
224
- data-selector=${i.selector}
225
- data-key=${ie(i)}
226
- aria-label=${e.uiNotesOn(i.label)}
227
- aria-expanded=${n?"true":"false"}
228
- title=${e.uiNotes(i.notes.length)}
229
- @click=${()=>t.toggle(i)}
230
- >
231
- ${nt()}<span>${i.notes.length}</span>
232
- </button>`})}
233
- </div>`,ls=(e,t)=>{const i=t.open;return i===null?h:l`<div
234
- class="comment-pop ui-notes-pop"
235
- popover="manual"
236
- role="dialog"
237
- aria-label=${e.uiNotesOn(i.label)}
238
- data-key=${ie(i)}
239
- >
240
- <div class="ui-notes-head">
241
- ${nt()}
242
- <strong class="comment-target" title=${i.label}>${i.label}</strong>
243
- <button
244
- class="dpk-icon-btn"
245
- type="button"
246
- data-role="close-notes"
247
- aria-label=${e.closeUiNotes}
248
- @click=${t.close}
249
- >
250
- ${Re()}
251
- </button>
252
- </div>
253
- <ol class="ui-note-list">
254
- ${i.notes.map(n=>t.editing?.noteId===n.id?l`<li data-id=${n.id}>${ps(e,t,t.editing)}</li>`:l`<li data-id=${n.id}>
255
- <div class="ui-note-main">
256
- <p class="ui-note-body">${n.body}</p>
257
- ${n.createdAt===void 0?h:l`<time class="ui-note-time" datetime=${n.createdAt}>${e.uiNoteDate(n.createdAt)}</time>`}
258
- </div>
259
- <button
260
- class="dpk-icon-btn"
261
- type="button"
262
- data-role="edit-note"
263
- aria-label=${e.editUiNoteAria}
264
- title=${e.editUiNoteAria}
265
- @click=${()=>t.edit(n.id,n.body)}
266
- >
267
- ${Ji()}
268
- </button>
269
- <button
270
- class="dpk-icon-btn"
271
- type="button"
272
- data-role="delete-note"
273
- aria-label=${e.deleteUiNoteAria}
274
- @click=${()=>t.remove(i,n.id)}
275
- >
276
- ${Qi()}
277
- </button>
278
- </li>`)}
279
- </ol>
280
- </div>`},ps=(e,t,i)=>l`
281
- <div class="ui-note-editor">
282
- <textarea
283
- class="dpk-textarea"
284
- aria-label=${e.editUiNoteLabel}
285
- title=${e.editUiNoteHint}
286
- .value=${i.body}
287
- @input=${n=>{n.currentTarget instanceof HTMLTextAreaElement&&t.input(n.currentTarget.value)}}
288
- @keydown=${n=>{n.isComposing||(n.key==="Enter"&&(n.metaKey||n.ctrlKey)?(n.preventDefault(),t.save()):n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),t.cancel()))}}
289
- ></textarea>
290
- <div class="ui-note-editor-actions">
291
- <button class="dpk-btn dpk-btn--ghost" type="button" data-dpk-text-discard @click=${t.cancel}>
292
- ${e.cancelUiNote}
293
- </button>
294
- <button
295
- class="dpk-btn dpk-btn--accent"
296
- type="button"
297
- data-role="save-note"
298
- ?disabled=${i.body.trim()===""}
299
- @click=${t.save}
300
- >
301
- ${e.saveUiNote}
302
- </button>
303
- </div>
304
- </div>
305
- `,Pi=(e,t,i)=>{const{state:n,navigation:o}=e,s=te(n,o),r=s===void 0||s.kind==="story"?void 0:s,a=le(o)==="app",d=Ni(n,[]);if(s?.kind==="story"){const{activity:R,story:Te}=s;return l`
306
- <div class="stage">
307
- <section class="stage-story" data-dpk-target=${Bt(s,null)}>
308
- ${Di(t,ao(R,Te))}
309
- ${Te.description?l`<div class="story-description dpk-prose">${Pe(De(Te.description))}</div>`:h}
310
- <p class="stage-empty">${t.storyWithoutSteps}</p>
311
- </section>
312
- ${d}
313
- </div>
314
- `}if(!r)return l`
315
- <div class="stage">
316
- ${a?l`<p class="stage-empty">${t.noScreens}</p>`:l`<p class="stage-empty">
317
- ${t.noStepBefore}<strong>Activity › UserStory › Step</strong>${t.noStepAfter}
318
- </p>`}
319
- ${d}
320
- </div>
321
- `;const p=Ye(n,r,o),{layout:c,panes:v,shown:f}=p,[I]=c==="single"?v:[],P=i.uiComment,T=i.lift,z=T?.mode==="demo",K=i.browser,Fe=K!==null&&K.view.entry?.kind!=="page"?[]:f,[X]=Fe,ce=(X??f[0])?.viewport??"desktop",Ge=z&&K!==null&&ce!=="mobile",je={onExit:i.onToggleDemo,uiComment:P,actions:i.actions},Vi=X??f[0],Ke=K!==null?"browser":Vi?.kind??"browser",Xe=z&&Ke==="browser"&&gi(ce)==="desktop",Z=i.devices,ne=Z===null||Xe||!Mo(Ke)?null:Lo(ce,Z.choice),Ze=ne!==null&&Z!==null?{kind:"device",width:ne.width,height:ne.height,zoom:Z.zoom}:Xe?{kind:"fill"}:null;return l`
322
- ${T===null?h:l`<div class="stage-placeholder" style=${`height:${T.height}px`}></div>`}
323
- <div
324
- class=${T===null?"stage":z?"stage is-demo":"stage is-maximized"}
325
- data-ui-comment=${P.mode.kind}
326
- popover=${T===null?h:"manual"}
327
- @wheel=${T===null?h:{handleEvent:i.onLiftedWheel,passive:!1}}
328
- >
329
- ${z?Ge?h:Ti(t,je):l`<div class="stage-bar">
330
- ${Di(t,Zt(n,r))}
331
- <div class="stage-tools">
332
- ${I?.kind==="screen"&&I.tabs.length>0?Ri(e,p,I):h}
333
- ${ne!==null&&Z!==null?gs(t,ne,Z,i.deviceSelect):h}
334
- ${i.actions.groups.length>0?Si(t,i.actions):h}
335
- ${f.length>0?$i(t,P):h}
336
- ${f.length===0?h:a?ms(t,i.onToggleDemo):ys(t,T!==null,i.onToggleMaximize)}
337
- </div>
338
- </div>`}
339
- ${r.kind==="step"&&r.step.situation!==void 0?vs(t,r.step.situation):h}
340
- ${z?h:es(t,P)}
341
- <div
342
- class="canvas"
343
- data-layout=${c}
344
- data-dpk-target=${Bt(r,p)}
345
- @click=${{handleEvent:i.canvasEvents.click,capture:!0}}
346
- @pointermove=${{handleEvent:i.canvasEvents.pointermove,capture:!0}}
347
- @pointerleave=${i.canvasEvents.pointerleave}
348
- @wheel=${{handleEvent:i.canvasEvents.wheel,passive:!1}}
349
- @scroll=${{handleEvent:i.canvasEvents.scroll,capture:!0}}
350
- >
351
- ${K!==null?as(e,t,{...K,...X===void 0?{}:{preview:X},...Ge?{demo:je}:{},hasContent:X===void 0||i.hasPreviewContent(X.id),viewport:ce,window:Ze??{kind:"fill"}}):c==="side-by-side"?l`<div class="panes">
352
- ${v.map(R=>l`<div class="pane" data-viewport=${R.preview.viewport} data-pane=${R.kind}>
353
- ${fs(e,p,R)}
354
- ${We(e,t,R.preview,i.hasPreviewContent(R.preview.id))}
355
- </div>`)}
356
- </div>`:f.map(R=>We(e,t,R,i.hasPreviewContent(R.id),Ze))}
357
- ${f.length===0?l`<p class="dpk-label">${t.noPreviewMetadata}</p>`:h}
358
- ${ds(t,i.uiNotes)} ${ts(t,P)}
359
- </div>
360
- ${ns(t,P)} ${ls(t,i.uiNotes)} ${Qo(t,i.actions)}
361
- ${Ni(n,Fe.map(R=>R.id))}
362
- </div>
363
- `},cs=q(An),us=q(Sn),hs={phone:q($n),tablet:q(Tn),desktop:q(En)},Di=(e,t)=>l`<div class="page-head">
364
- ${t.actor===void 0?h:l`<span class="page-actor" role="note" aria-label=${e.pageActor(t.actor)} title=${t.actor}>
365
- ${cs()} <span class="page-actor-name">${t.actor}</span>
366
- </span>`}
367
- <h2 class="page-title">${t.title}</h2>
368
- </div>`,vs=(e,t)=>l`<aside class="situation">
369
- <span class="situation-label">${e.situation}</span>
370
- <p class="situation-text">${t}</p>
371
- </aside>`,Ri=(e,t,i)=>l`<div class="dpk-segmented tabs" role="tablist">
372
- ${i.tabs.map(n=>{const o=n.id===i.preview.id;return l`<a
373
- class="tab"
374
- role="tab"
375
- data-current=${String(o)}
376
- aria-selected=${o?"true":"false"}
377
- href=${e.hashFor({preview:eo(t,n.id)})}
378
- >${n.label??n.viewport}</a
379
- >`})}
380
- </div>`,fs=(e,t,i)=>i.kind==="material"?i.preview.label===void 0?h:l`<span class="pane-label" title=${i.preview.label}>${i.preview.label}</span>`:l`<div class="pane-head">
381
- <span class="pane-label" title=${i.screen.screen.title}>${i.screen.screen.title}</span>
382
- ${i.tabs.length>0?Ri(e,t,i):h}
383
- </div>`,gs=(e,t,i,n)=>{const o=Math.round(i.zoom*100);return l`<span class="device-pick" title=${e.deviceHint}>
384
- ${hs[t.deviceClass]()}
385
- ${n.render({options:mi(t.deviceClass).map(s=>({value:s.id,label:Vo(e,s)})),value:t.id,onChange:s=>i.onPick(s),ariaLabel:e.device,className:"device-select"})}
386
- ${o<100?l`<span class="device-zoom" title=${e.deviceZoom(o)}>${o}%</span>`:h}
387
- </span>`},ms=(e,t)=>l`<button class="dpk-btn stage-demo" type="button" title=${e.demoHint} @click=${t}>
388
- ${us()} ${e.demo}
389
- </button>`,ys=(e,t,i)=>l`<button
390
- class="dpk-btn stage-maximize"
391
- type="button"
392
- aria-pressed=${t?"true":"false"}
393
- title=${e.maximizeHint}
394
- @click=${i}
395
- >
396
- ${t?l`${en()} ${e.restore}`:l`${tn()} ${e.maximize}`}
397
- </button>`,We=(e,t,i,n,o=null)=>l`
398
- <figure
399
- class="frame"
400
- data-kind=${i.kind}
401
- data-viewport=${i.viewport}
402
- data-window=${o?.kind??h}
403
- ?data-empty=${!n}
404
- style=${_i(i.kind,i.viewport,o)}
405
- >
406
- ${i.kind==="browser"?l`<div class="dpk-browser-frame-bar">
407
- <span class="dpk-browser-frame-url">${ke(e.state,i)}</span>
408
- </div>`:i.kind==="mail"?ws(so(t,i)):h}
409
- <div class="viewport">
410
- ${i.kind==="native"?bs():h}
411
- <slot name=${`preview:${i.id}`}></slot>
412
- ${n?h:l`<div class="frame-placeholder">
413
- <span class="dpk-label">light dom preview</span>
414
- <code>&lt;div slot="preview" data-preview-id="${i.id}"&gt;</code>
415
- </div>`}
416
- </div>
417
- </figure>
418
- `,ws=e=>l`<header class="dpk-received-mail">
419
- ${e.subject===void 0?h:l`<h3 class="dpk-received-mail-subject">${e.subject}</h3>`}
420
- <div class="dpk-received-mail-envelope">
421
- ${e.initial===void 0?h:l`<span class="dpk-avatar" data-size="lg" aria-hidden="true">${e.initial}</span>`}
422
- <dl class="dpk-received-mail-meta">
423
- ${e.rows.map(t=>l`<div>
424
- <dt>${t.label}</dt>
425
- <dd>${t.value}</dd>
426
- </div>`)}
427
- </dl>
428
- </div>
429
- </header>`,bs=()=>l`<div class="dpk-status-bar"><span>9:41</span></div>`,Ni=(e,t)=>{const n=[...H(e).flatMap(o=>o.screen.previews),...B(e).flatMap(o=>F(o.step))].filter(o=>!t.includes(o.id));return n.length===0?l`${h}`:l`<div class="parked" aria-hidden="true">
430
- ${n.map(o=>l`<slot name=${`preview:${o.id}`}></slot>`)}
431
- </div>`},ks=nn`
432
- :host {
433
- --dpk-prototype-accent: var(--dpk-blue);
434
- }
435
-
436
- /* ---------------------------------------------------------------- sidebar */
437
-
438
- .nav {
439
- display: grid;
440
- /* The sidebar's column, never its content's: a long story name is ellipsized
441
- inside the rich select instead of widening the rail. */
442
- grid-template-columns: minmax(0, 1fr);
443
- gap: 14px;
444
- align-content: start;
445
- min-width: 0;
446
- }
447
-
448
- .nav > * {
449
- min-width: 0;
450
- }
451
-
452
- .field {
453
- display: grid;
454
- grid-template-columns: minmax(0, 1fr);
455
- gap: 5px;
456
- min-width: 0;
457
- }
458
-
459
- .field > * {
460
- min-width: 0;
461
- }
462
-
463
- /* Scenario or app: the segmented atom, stretched across the top of the sidebar. */
464
- .view-switch {
465
- display: flex;
466
- min-width: 0;
467
- }
468
-
469
- .view-switch > * {
470
- min-width: 0;
471
- }
472
-
473
- .view-option {
474
- flex: 1 1 0;
475
- text-align: center;
476
- }
477
-
478
- .app-hint {
479
- margin: -6px 0 0;
480
- font-size: 11.5px;
481
- line-height: 1.55;
482
- color: var(--dpk-ink-faint);
483
- }
484
-
485
- .app-group {
486
- display: grid;
487
- gap: 4px;
488
- }
489
-
490
- .app-group-heading {
491
- margin: 0;
492
- padding-left: 9px;
493
- font-size: 11px;
494
- font-weight: 600;
495
- color: var(--dpk-ink-soft);
496
- }
497
-
498
- .app-description {
499
- margin: 2px 0 0;
500
- font-size: 11.5px;
501
- line-height: 1.5;
502
- color: var(--dpk-ink-faint);
503
- }
504
-
505
- .step-screen {
506
- color: var(--dpk-ink);
507
- font-size: 12.5px;
508
- font-weight: 550;
509
- }
510
-
511
- .screen-description {
512
- font-size: 12.5px;
513
- line-height: 1.6;
514
- color: var(--dpk-ink);
515
- }
516
-
517
- .app-tree {
518
- display: grid;
519
- gap: 4px;
520
- }
521
-
522
- .app-origin {
523
- margin: 0;
524
- padding-left: 9px;
525
- font-family: var(--dpk-mono);
526
- font-size: 10.5px;
527
- font-weight: 500;
528
- color: var(--dpk-ink-faint);
529
- overflow-wrap: anywhere;
530
- }
531
-
532
- .tree {
533
- list-style: none;
534
- margin: 0;
535
- padding: 0;
536
- display: grid;
537
- gap: 2px;
538
- }
539
-
540
- /* A path below another one is indented under it, with a guide line. */
541
- .tree .tree {
542
- margin-left: 14px;
543
- padding-left: 6px;
544
- border-left: 1px solid var(--dpk-rule);
545
- }
546
-
547
- .tree-node {
548
- display: grid;
549
- gap: 2px;
550
- }
551
-
552
- .tree-row {
553
- position: relative;
554
- border-radius: var(--dpk-radius-sm);
555
- transition: background 140ms ease;
556
- }
557
-
558
- .tree-row:has(a):hover {
559
- background: var(--dpk-paper-inset);
560
- }
561
-
562
- .tree-row[data-current='true'] {
563
- background: linear-gradient(
564
- 180deg,
565
- color-mix(in srgb, var(--dpk-prototype-accent) 10%, var(--dpk-paper-raised)),
566
- color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised))
567
- );
568
- box-shadow:
569
- inset 0 0 0 1px color-mix(in srgb, var(--dpk-prototype-accent) 22%, transparent),
570
- var(--dpk-shadow-xs);
571
- }
572
-
573
- .tree-link {
574
- display: flex;
575
- align-items: baseline;
576
- flex-wrap: wrap;
577
- gap: 2px 8px;
578
- padding: 6px 4px 6px 9px;
579
- text-decoration: none;
580
- color: var(--dpk-ink-soft);
581
- font-size: 12.5px;
582
- }
583
-
584
- .tree-path {
585
- font-family: var(--dpk-mono);
586
- font-size: 11.5px;
587
- color: var(--dpk-ink);
588
- overflow-wrap: anywhere;
589
- }
590
-
591
- span.tree-link .tree-path {
592
- color: var(--dpk-ink-faint);
593
- }
594
-
595
- .tree-title {
596
- min-width: 0;
597
- color: var(--dpk-ink-soft);
598
- }
599
-
600
- .tree-row[data-current='true'] .tree-path,
601
- .tree-row[data-current='true'] .tree-title {
602
- color: var(--dpk-ink);
603
- font-weight: 550;
604
- }
605
-
606
- .tree-link .step-note {
607
- align-self: center;
608
- }
609
-
610
- .tree-link:focus-visible {
611
- outline: none;
612
- border-radius: var(--dpk-radius-sm);
613
- box-shadow: var(--dpk-focus);
614
- }
615
-
616
- .steps.app-screens {
617
- max-height: none;
618
- }
619
-
620
- .steps-head {
621
- display: flex;
622
- align-items: baseline;
623
- justify-content: space-between;
624
- padding-bottom: 5px;
625
- border-bottom: 1px solid var(--dpk-rule);
626
- }
627
-
628
- .steps {
629
- list-style: none;
630
- margin: 0;
631
- padding: 0;
632
- display: grid;
633
- /* A row is no wider than the list: a long step name ends in an ellipsis. */
634
- grid-template-columns: minmax(0, 1fr);
635
- gap: 2px;
636
- max-height: 38vh;
637
- overflow: auto;
638
- }
639
-
640
- .step-row {
641
- position: relative;
642
- display: flex;
643
- align-items: center;
644
- gap: 4px;
645
- padding: 0 4px 0 9px;
646
- border-radius: var(--dpk-radius-sm);
647
- transition:
648
- background 140ms ease,
649
- box-shadow 140ms ease;
650
- }
651
-
652
- .step-row:hover {
653
- background: var(--dpk-paper-inset);
654
- }
655
-
656
- .step-row[data-current='true'] {
657
- background: linear-gradient(
658
- 180deg,
659
- color-mix(in srgb, var(--dpk-prototype-accent) 10%, var(--dpk-paper-raised)),
660
- color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised))
661
- );
662
- box-shadow:
663
- inset 0 0 0 1px color-mix(in srgb, var(--dpk-prototype-accent) 22%, transparent),
664
- var(--dpk-shadow-xs);
665
- }
666
-
667
- .step-link {
668
- display: flex;
669
- flex: 1;
670
- min-width: 0;
671
- align-items: center;
672
- gap: 7px;
673
- padding: 7px 0;
674
- text-decoration: none;
675
- color: var(--dpk-ink-soft);
676
- font-size: 12.5px;
677
- font-weight: 460;
678
- }
679
-
680
- .step-row[data-current='true'] .step-link {
681
- color: var(--dpk-ink);
682
- font-weight: 550;
683
- }
684
-
685
- .step-index {
686
- flex: 0 0 auto;
687
- min-width: 17px;
688
- padding: 1px 4px;
689
- border-radius: var(--dpk-radius-xs);
690
- background: var(--dpk-paper-inset);
691
- font-family: var(--dpk-mono);
692
- font-size: 9.5px;
693
- font-variant-numeric: tabular-nums;
694
- text-align: center;
695
- color: var(--dpk-ink-faint);
696
- transition:
697
- background 140ms ease,
698
- color 140ms ease;
699
- }
700
-
701
- .step-row[data-current='true'] .step-index {
702
- background: linear-gradient(180deg, var(--dpk-blue), var(--dpk-blue-strong));
703
- color: #fff;
704
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
705
- }
706
-
707
- .step-name {
708
- min-width: 0;
709
- overflow: hidden;
710
- white-space: nowrap;
711
- text-overflow: ellipsis;
712
- }
713
-
714
- .step-note {
715
- margin-left: auto;
716
- min-width: 16px;
717
- padding: 1px 5px;
718
- border-radius: 999px;
719
- background: var(--dpk-accent);
720
- color: var(--dpk-accent-ink);
721
- font-family: var(--dpk-mono);
722
- font-size: 9px;
723
- font-variant-numeric: tabular-nums;
724
- text-align: center;
725
- }
726
-
727
- .row-tools {
728
- display: flex;
729
- gap: 0;
730
- opacity: 0;
731
- transition: opacity 120ms ease;
732
- }
733
-
734
- .step-row:hover .row-tools,
735
- .step-row[data-current='true'] .row-tools {
736
- opacity: 1;
737
- }
738
-
739
- .detail {
740
- display: grid;
741
- /* As wide as the panel, not as a description's widest table or code line: those scroll. */
742
- grid-template-columns: minmax(0, 1fr);
743
- gap: 12px;
744
- padding: 12px 12px 14px;
745
- border: 1px solid var(--dpk-rule);
746
- border-radius: var(--dpk-radius);
747
- background: var(--dpk-paper-raised);
748
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-sm);
749
- }
750
-
751
- .detail-row {
752
- display: grid;
753
- grid-template-columns: minmax(0, 1fr);
754
- gap: 4px;
755
- }
756
-
757
- .detail-value {
758
- font-size: 12.5px;
759
- color: var(--dpk-ink-soft);
760
- }
761
-
762
- .nav-empty {
763
- font-size: 12px;
764
- line-height: 1.6;
765
- color: var(--dpk-ink-faint);
766
- }
767
-
768
- /* ------------------------------------------------------------------ stage */
769
-
770
- .stage {
771
- display: grid;
772
- /* One column no wider than the main area: a wide row of panes scrolls inside the canvas. */
773
- grid-template-columns: minmax(0, 1fr);
774
- gap: 14px;
775
- width: 100%;
776
- min-width: 0;
777
- }
778
-
779
- /* A tighter top than the shell's leaves the preview more of the main column. */
780
- :host {
781
- --dpk-main-padding: 12px 24px 24px;
782
- }
783
-
784
- .stage-bar {
785
- display: flex;
786
- align-items: center;
787
- justify-content: space-between;
788
- gap: 10px 16px;
789
- min-width: 0;
790
- flex-wrap: wrap;
791
- }
792
-
793
- /*
794
- * The page head and its tools stick to the top of the main column, so they
795
- * stay in reach while a tall preview scrolls under them; the situation and
796
- * the canvas scroll on. The bar spans the column edge to edge (cancelling
797
- * the body's padding) on a frosted ground the content passes beneath. Above
798
- * the UI-comment layer, below the memo, which opens over everything.
799
- */
800
- .stage:not(.is-maximized) > .stage-bar {
801
- position: sticky;
802
- top: 0;
803
- z-index: 5;
804
- margin: -12px -24px 0;
805
- padding: 10px 24px;
806
- border-bottom: 1px solid var(--dpk-rule);
807
- background: color-mix(in srgb, var(--dpk-paper-raised) 92%, transparent);
808
- backdrop-filter: saturate(1.6) blur(14px);
809
- }
810
-
811
- /* ------------------------------------------------------------- page head */
812
-
813
- .page-head {
814
- display: flex;
815
- align-items: center;
816
- gap: 12px;
817
- min-width: 0;
818
- animation: dpk-page-head-in 260ms var(--dpk-ease) backwards;
819
- }
820
-
821
- @keyframes dpk-page-head-in {
822
- from {
823
- opacity: 0;
824
- transform: translateY(4px);
825
- }
826
- }
827
-
828
- .page-actor {
829
- display: inline-flex;
830
- /* A long role name gives way to the title first, down to a recognizable stub. */
831
- flex: 0 1000 auto;
832
- min-width: 72px;
833
- align-items: center;
834
- gap: 6px;
835
- height: 26px;
836
- padding: 0 11px 0 8px;
837
- border-radius: 999px;
838
- background: linear-gradient(
839
- 180deg,
840
- color-mix(in srgb, var(--dpk-blue) 16%, var(--dpk-paper-raised)),
841
- color-mix(in srgb, var(--dpk-blue) 9%, var(--dpk-paper-raised))
842
- );
843
- box-shadow:
844
- var(--dpk-bevel),
845
- inset 0 0 0 1px color-mix(in srgb, var(--dpk-blue) 32%, transparent),
846
- var(--dpk-shadow-xs);
847
- color: var(--dpk-blue);
848
- font-size: 12px;
849
- font-weight: 650;
850
- letter-spacing: 0.01em;
851
- white-space: nowrap;
852
- max-width: 280px;
853
- }
854
-
855
- .page-actor-name {
856
- min-width: 0;
857
- overflow: hidden;
858
- text-overflow: ellipsis;
859
- }
860
-
861
- .page-actor svg {
862
- flex: none;
863
- width: 13px;
864
- height: 13px;
865
- opacity: 0.9;
866
- }
867
-
868
- .page-title {
869
- margin: 0;
870
- min-width: 0;
871
- overflow: hidden;
872
- font-size: 19px;
873
- font-weight: 700;
874
- line-height: 1.3;
875
- letter-spacing: -0.02em;
876
- color: var(--dpk-ink);
877
- text-overflow: ellipsis;
878
- white-space: nowrap;
879
- }
880
-
881
- /* Wraps on a phone rather than pushing the last tools off the screen. */
882
- .stage-tools {
883
- display: flex;
884
- flex-wrap: wrap;
885
- justify-content: flex-end;
886
- align-items: center;
887
- gap: 8px;
888
- min-width: 0;
889
- margin-left: auto;
890
- }
891
-
892
- .stage-maximize svg,
893
- .stage-demo svg {
894
- width: 13px;
895
- height: 13px;
896
- }
897
-
898
- .stage-demo {
899
- display: inline-flex;
900
- align-items: center;
901
- gap: 6px;
902
- }
903
-
904
- .actions-toggle {
905
- display: inline-flex;
906
- align-items: center;
907
- gap: 6px;
908
- }
909
-
910
- .actions-toggle svg {
911
- width: 13px;
912
- height: 13px;
913
- }
914
-
915
- .actions-toggle svg:last-child {
916
- width: 12px;
917
- height: 12px;
918
- margin-left: -2px;
919
- opacity: 0.7;
920
- }
921
-
922
- .actions-toggle[aria-expanded='true'] {
923
- opacity: 1;
924
- color: var(--dpk-ink);
925
- }
926
-
927
- /* A menu of what each screen on stage can do in one go. */
928
- .actions-menu {
929
- gap: 8px;
930
- width: max-content;
931
- min-width: 220px;
932
- max-width: min(320px, calc(100vw - 24px));
933
- padding: 6px;
934
- }
935
-
936
- .actions-group {
937
- display: grid;
938
- gap: 2px;
939
- }
940
-
941
- .actions-group + .actions-group {
942
- padding-top: 6px;
943
- border-top: 1px solid var(--dpk-rule);
944
- }
945
-
946
- .actions-group-title {
947
- padding: 4px 10px 2px;
948
- font-size: 11px;
949
- font-weight: 600;
950
- color: var(--dpk-ink-faint);
951
- }
952
-
953
- .actions-item {
954
- display: grid;
955
- gap: 2px;
956
- width: 100%;
957
- padding: 8px 10px;
958
- border: 0;
959
- border-radius: var(--dpk-radius-sm);
960
- background: transparent;
961
- color: var(--dpk-ink);
962
- font: inherit;
963
- text-align: left;
964
- cursor: pointer;
965
- }
966
-
967
- .actions-item:hover,
968
- .actions-item:focus-visible {
969
- background: var(--dpk-accent-soft);
970
- }
971
-
972
- .actions-item:focus-visible {
973
- outline: none;
974
- box-shadow: var(--dpk-focus);
975
- }
976
-
977
- .actions-label {
978
- font-weight: 600;
979
- }
980
-
981
- .actions-description {
982
- font-size: 11.5px;
983
- line-height: 1.45;
984
- color: var(--dpk-ink-soft);
985
- }
986
-
987
- /* The app view's device: a pill like the rendition tabs, with the zoom it is drawn at. */
988
- .device-pick {
989
- position: relative;
990
- display: inline-flex;
991
- align-items: center;
992
- gap: 6px;
993
- height: 32px;
994
- padding: 0 6px 0 10px;
995
- box-sizing: border-box;
996
- border: 1px solid var(--dpk-rule);
997
- border-radius: 999px;
998
- background: var(--dpk-paper-sunken);
999
- box-shadow: inset 0 1px 2px rgba(20, 28, 44, 0.04);
1000
- color: var(--dpk-ink-soft);
1001
- }
1002
-
1003
- .device-pick:focus-within {
1004
- box-shadow: var(--dpk-focus);
1005
- }
1006
-
1007
- .device-pick svg {
1008
- flex: none;
1009
- width: 14px;
1010
- height: 14px;
1011
- }
1012
-
1013
- .device-select {
1014
- min-width: 0;
1015
- padding: 0 4px 0 0;
1016
- border: 0;
1017
- background: transparent;
1018
- color: var(--dpk-ink);
1019
- font: 600 12px/1 var(--dpk-body);
1020
- }
1021
-
1022
- .device-zoom {
1023
- padding: 3px 7px;
1024
- border-radius: 999px;
1025
- background: var(--dpk-paper-raised);
1026
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
1027
- font: 600 10.5px/1 var(--dpk-mono);
1028
- font-variant-numeric: tabular-nums;
1029
- color: var(--dpk-ink-soft);
1030
- }
1031
-
1032
- .stage-empty {
1033
- max-width: 62ch;
1034
- padding: 16px 18px;
1035
- border: 1px dashed var(--dpk-rule-strong);
1036
- border-radius: var(--dpk-radius-lg);
1037
- background: var(--dpk-paper-sunken);
1038
- font-size: 13px;
1039
- line-height: 1.7;
1040
- color: var(--dpk-ink-soft);
1041
- }
1042
-
1043
- /* A story that has no steps yet: its heading, what it is for, and why no frame. */
1044
- .stage-story {
1045
- display: grid;
1046
- gap: 12px;
1047
- justify-items: start;
1048
- }
1049
-
1050
- .story-description {
1051
- max-width: 62ch;
1052
- margin: 0;
1053
- font-size: 14px;
1054
- line-height: 1.7;
1055
- color: var(--dpk-ink);
1056
- }
1057
-
1058
- /* -------------------------------------------------------------- situation */
1059
-
1060
- /*
1061
- * What is going on around the previews: a stage direction, read before them.
1062
- * The band spans the stage at any width (a maximized stage too); only the
1063
- * text keeps a readable line length.
1064
- */
1065
- .situation {
1066
- display: flex;
1067
- align-items: baseline;
1068
- gap: 10px;
1069
- margin: -4px 0 -2px;
1070
- padding: 8px 14px 8px 10px;
1071
- border: 1px solid color-mix(in srgb, var(--dpk-prototype-accent) 16%, var(--dpk-rule));
1072
- border-radius: var(--dpk-radius);
1073
- background: color-mix(in srgb, var(--dpk-prototype-accent) 5%, var(--dpk-paper-raised));
1074
- box-shadow: var(--dpk-bevel);
1075
- }
1076
-
1077
- .situation-label {
1078
- flex: none;
1079
- padding: 2px 8px;
1080
- border-radius: 999px;
1081
- background: color-mix(in srgb, var(--dpk-prototype-accent) 13%, transparent);
1082
- font-size: 10.5px;
1083
- font-weight: 650;
1084
- letter-spacing: 0.06em;
1085
- color: var(--dpk-prototype-accent);
1086
- }
1087
-
1088
- .situation-text {
1089
- max-width: 90ch;
1090
- margin: 0;
1091
- min-width: 0;
1092
- font-size: 13px;
1093
- line-height: 1.65;
1094
- color: var(--dpk-ink);
1095
- white-space: pre-line;
1096
- overflow-wrap: anywhere;
1097
- }
1098
-
1099
- /* ----------------------------------------------------------------- canvas */
1100
-
1101
- /*
1102
- * The work surface the frame sits on: a quiet dot lattice that reads as a
1103
- * canvas rather than empty page background, giving the frame somewhere to
1104
- * cast its shadow.
1105
- */
1106
- .canvas {
1107
- display: flex;
1108
- justify-content: center;
1109
- padding: 30px;
1110
- border: 1px solid var(--dpk-rule);
1111
- border-radius: var(--dpk-radius-xl);
1112
- background: var(--dpk-dots), var(--dpk-paper-sunken);
1113
- box-shadow: inset 0 1px 3px var(--dpk-shade-1);
1114
- }
1115
-
1116
- /* ---------------------------------------------------------- comment on UI */
1117
-
1118
- .ui-comment-toggle svg,
1119
- .ui-comment-hint svg {
1120
- width: 14px;
1121
- height: 14px;
1122
- }
1123
-
1124
- .ui-comment-toggle {
1125
- display: inline-flex;
1126
- align-items: center;
1127
- gap: 6px;
1128
- }
1129
-
1130
- .ui-comment-hint {
1131
- display: flex;
1132
- align-items: center;
1133
- gap: 8px;
1134
- margin: -4px 0 -2px;
1135
- padding: 7px 12px;
1136
- border-radius: var(--dpk-radius);
1137
- background: var(--dpk-accent-soft);
1138
- color: var(--dpk-accent-strong, var(--dpk-accent));
1139
- font-size: 12.5px;
1140
- font-weight: 550;
1141
- }
1142
-
1143
- .canvas {
1144
- position: relative;
1145
- }
1146
-
1147
- .stage:not([data-ui-comment='off']) .canvas ::slotted(*) {
1148
- cursor: crosshair;
1149
- }
1150
-
1151
- /* Sized to the canvas's scroll area by the element; the boxes and pins show through. */
1152
- .ui-catcher {
1153
- position: absolute;
1154
- top: 0;
1155
- left: 0;
1156
- z-index: 4;
1157
- cursor: crosshair;
1158
- }
1159
-
1160
- /* Positioned against the canvas by the element, which measures the author's markup. */
1161
- .ui-layer {
1162
- display: contents;
1163
- }
1164
-
1165
- .ui-box {
1166
- position: absolute;
1167
- z-index: 2;
1168
- box-sizing: border-box;
1169
- border-radius: 4px;
1170
- pointer-events: none;
1171
- }
1172
-
1173
- .ui-hover {
1174
- outline: 2px solid var(--dpk-accent);
1175
- outline-offset: 1px;
1176
- background: color-mix(in srgb, var(--dpk-accent) 8%, transparent);
1177
- }
1178
-
1179
- .ui-picked {
1180
- outline: 2px solid var(--dpk-accent);
1181
- outline-offset: 2px;
1182
- background: color-mix(in srgb, var(--dpk-accent) 14%, transparent);
1183
- box-shadow: 0 0 0 6px color-mix(in srgb, var(--dpk-accent) 18%, transparent);
1184
- }
1185
-
1186
- .ui-pin {
1187
- position: absolute;
1188
- z-index: 3;
1189
- display: grid;
1190
- place-items: center;
1191
- min-width: 20px;
1192
- height: 20px;
1193
- padding: 0 5px;
1194
- box-sizing: border-box;
1195
- transform: translate(-50%, -50%);
1196
- border: 2px solid var(--dpk-paper-raised);
1197
- border-radius: 999px 999px 999px 2px;
1198
- background: var(--dpk-accent);
1199
- color: var(--dpk-accent-ink);
1200
- box-shadow: var(--dpk-shadow-sm);
1201
- font-family: var(--dpk-mono);
1202
- font-size: 10px;
1203
- font-weight: 700;
1204
- pointer-events: none;
1205
- }
1206
-
1207
- .ui-box[hidden],
1208
- .ui-pin[hidden] {
1209
- display: none;
1210
- }
1211
-
1212
- /* ---------------------------------------------------------- notes on the UI */
1213
-
1214
- /* Positioned against the canvas by the element, like the pins; blue, so a note never reads as feedback. */
1215
- .ui-notes {
1216
- display: contents;
1217
- }
1218
-
1219
- .ui-note-badge {
1220
- position: absolute;
1221
- z-index: 3;
1222
- display: inline-flex;
1223
- align-items: center;
1224
- gap: 3px;
1225
- height: 20px;
1226
- padding: 0 6px 0 5px;
1227
- box-sizing: border-box;
1228
- transform: translate(-50%, -50%);
1229
- border: 2px solid var(--dpk-paper-raised);
1230
- border-radius: 999px;
1231
- background: var(--dpk-blue);
1232
- color: #fff;
1233
- box-shadow: var(--dpk-shadow-sm);
1234
- font-family: var(--dpk-mono);
1235
- font-size: 10px;
1236
- font-weight: 700;
1237
- line-height: 1;
1238
- cursor: pointer;
1239
- }
1240
-
1241
- .ui-note-badge svg {
1242
- width: 11px;
1243
- height: 11px;
1244
- }
1245
-
1246
- .ui-note-badge:hover,
1247
- .ui-note-badge[aria-expanded='true'] {
1248
- background: var(--dpk-blue-strong);
1249
- }
1250
-
1251
- .ui-note-badge:focus-visible {
1252
- outline: 2px solid var(--dpk-focus);
1253
- outline-offset: 1px;
1254
- }
1255
-
1256
- .ui-note-badge[hidden] {
1257
- display: none;
1258
- }
1259
-
1260
- .ui-notes-head {
1261
- display: flex;
1262
- align-items: center;
1263
- gap: 6px;
1264
- }
1265
-
1266
- /* The badge's icon and blue: the list reads as the badge opened. */
1267
- .ui-notes-head > svg {
1268
- flex: none;
1269
- width: 14px;
1270
- height: 14px;
1271
- color: var(--dpk-blue);
1272
- }
1273
-
1274
- .ui-notes-head .comment-target {
1275
- flex: 1 1 auto;
1276
- min-width: 0;
1277
- overflow: hidden;
1278
- text-overflow: ellipsis;
1279
- white-space: nowrap;
1280
- }
1281
-
1282
- .ui-note-list {
1283
- display: grid;
1284
- gap: 6px;
1285
- max-height: 240px;
1286
- margin: 0;
1287
- padding: 0;
1288
- overflow: auto;
1289
- list-style: none;
1290
- }
1291
-
1292
- .ui-note-list li {
1293
- display: flex;
1294
- align-items: flex-start;
1295
- gap: 4px;
1296
- padding: 8px 4px 8px 10px;
1297
- border-radius: var(--dpk-radius-sm);
1298
- background: var(--dpk-paper-sunken);
1299
- }
1300
-
1301
- .ui-note-main {
1302
- display: grid;
1303
- flex: 1 1 auto;
1304
- gap: 2px;
1305
- min-width: 0;
1306
- }
1307
-
1308
- .ui-note-body {
1309
- margin: 0;
1310
- color: var(--dpk-ink);
1311
- font-size: 12.5px;
1312
- line-height: 1.6;
1313
- white-space: pre-wrap;
1314
- overflow-wrap: anywhere;
1315
- }
1316
-
1317
- .ui-note-time {
1318
- color: var(--dpk-ink-faint);
1319
- font-family: var(--dpk-mono);
1320
- font-size: 10.5px;
1321
- }
1322
-
1323
- /* Rewrite and delete sit together at the end of the row. */
1324
- .ui-note-list li .dpk-icon-btn + .dpk-icon-btn {
1325
- margin-left: -4px;
1326
- }
1327
-
1328
- .ui-note-list li:has(.ui-note-editor) {
1329
- padding: 6px;
1330
- }
1331
-
1332
- .ui-note-editor {
1333
- display: grid;
1334
- flex: 1 1 auto;
1335
- gap: 6px;
1336
- min-width: 0;
1337
- }
1338
-
1339
- .ui-note-editor textarea {
1340
- min-height: 72px;
1341
- background: var(--dpk-paper-raised);
1342
- font-size: 12.5px;
1343
- }
1344
-
1345
- .ui-note-editor-actions {
1346
- display: flex;
1347
- justify-content: flex-end;
1348
- gap: 6px;
1349
- }
1350
-
1351
- /*
1352
- * Side by side: what the user sees together, in one row. A fixed viewport
1353
- * keeps its width as long as the row allows it, a fluid one takes the rest;
1354
- * a row wider than the canvas scrolls sideways instead of squeezing a device.
1355
- */
1356
- .panes {
1357
- display: flex;
1358
- align-items: flex-start;
1359
- justify-content: safe center;
1360
- gap: 28px;
1361
- width: 100%;
1362
- min-width: 0;
1363
- overflow-x: auto;
1364
- padding-bottom: 4px;
1365
- }
1366
-
1367
- /*
1368
- * A row wider than the stage fades out at the edge it scrolls toward, so the
1369
- * panes past it read as a scroll away rather than cut off. The scroll timeline
1370
- * is inactive while the row fits, which leaves it unmasked.
1371
- */
1372
- @supports (animation-timeline: scroll()) {
1373
- .panes {
1374
- animation: panes-edge linear both;
1375
- animation-timeline: scroll(self inline);
1376
- }
1377
-
1378
- @keyframes panes-edge {
1379
- 0% {
1380
- mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
1381
- }
1382
- 2%,
1383
- 98% {
1384
- mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
1385
- }
1386
- 100% {
1387
- mask-image: linear-gradient(90deg, transparent, #000 40px);
1388
- }
1389
- }
1390
- }
1391
-
1392
- /* A device shrinks at most to a width its layout still reads at, then the row scrolls. */
1393
- .pane {
1394
- display: grid;
1395
- /* The pane's width is the device's: a long label never widens it. */
1396
- grid-template-columns: minmax(0, 1fr);
1397
- gap: 8px;
1398
- flex: 0 1 var(--pane-width);
1399
- min-width: min(var(--pane-width), 720px);
1400
- }
1401
-
1402
- .pane[data-viewport='mobile'] {
1403
- --pane-width: 390px;
1404
- }
1405
-
1406
- .pane[data-viewport='tablet'] {
1407
- --pane-width: 834px;
1408
- }
1409
-
1410
- .pane[data-viewport='desktop'] {
1411
- --pane-width: 1180px;
1412
- }
1413
-
1414
- .pane[data-viewport='fluid'] {
1415
- flex: 1 1 0;
1416
- min-width: 240px;
1417
- }
1418
-
1419
- .pane .frame {
1420
- width: 100%;
1421
- }
1422
-
1423
- .pane-head {
1424
- display: flex;
1425
- flex-wrap: wrap;
1426
- align-items: center;
1427
- justify-content: space-between;
1428
- gap: 8px;
1429
- }
1430
-
1431
- .pane-head .tabs {
1432
- padding: 2px;
1433
- }
1434
-
1435
- .pane-head .tab {
1436
- padding: 3px 11px;
1437
- font-size: 11.5px;
1438
- }
1439
-
1440
- /* One line over the pane; hovering names the whole label. */
1441
- .pane-label {
1442
- justify-self: start;
1443
- min-width: 0;
1444
- max-width: 100%;
1445
- overflow: hidden;
1446
- text-overflow: ellipsis;
1447
- white-space: nowrap;
1448
- padding: 2px 9px;
1449
- border-radius: 999px;
1450
- background: var(--dpk-paper-raised);
1451
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-xs);
1452
- font-size: 11.5px;
1453
- font-weight: 600;
1454
- color: var(--dpk-ink-soft);
1455
- }
1456
-
1457
- /*
1458
- * Maximized: the stage covers the tab — the page head, the tabs and the canvas
1459
- * alone. It is also a manual popover in the top layer, so the UA popover box
1460
- * (fit-content, margin, border, padding, colors) is reset here. The canvas
1461
- * scrolls instead of the page, and a browser preview is at least as tall as
1462
- * the tab allows; a phone keeps its device shape. Whatever sits above the
1463
- * canvas (the situation, the comment-on-UI hint) keeps its own height, and the
1464
- * canvas takes the rest.
1465
- */
1466
- .stage.is-maximized {
1467
- position: fixed;
1468
- inset: 0;
1469
- z-index: 2147483000;
1470
- display: flex;
1471
- flex-direction: column;
1472
- width: auto;
1473
- height: auto;
1474
- max-width: none;
1475
- max-height: none;
1476
- margin: 0;
1477
- padding: 16px 20px 20px;
1478
- border: 0;
1479
- color: var(--dpk-ink);
1480
- background: var(--dpk-paper);
1481
- overflow: hidden;
1482
- }
1483
-
1484
- .stage.is-maximized > * {
1485
- flex: none;
1486
- }
1487
-
1488
- .canvas:has(> .frame[data-window='device']) {
1489
- align-items: flex-start;
1490
- /* A device wider than the stage is drawn smaller to fit it, so it never widens the page. */
1491
- min-width: 0;
1492
- contain: inline-size;
1493
- }
1494
-
1495
- .stage.is-maximized > .canvas {
1496
- flex: 1 1 0;
1497
- min-height: 0;
1498
- align-items: flex-start;
1499
- overflow: auto;
1500
- overscroll-behavior: contain;
1501
- }
1502
-
1503
- .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) {
1504
- display: flex;
1505
- flex-direction: column;
1506
- min-height: 100%;
1507
- }
1508
-
1509
- .stage.is-maximized .frame:not([data-kind='native'], [data-kind='plain']) .viewport {
1510
- flex: 1 0 auto;
1511
- }
1512
-
1513
- /*
1514
- * Demo: the app view's browser alone across the tab, as if the reader were
1515
- * using the app — no title, no tools, no canvas around it. The browser fills
1516
- * the tab and its page scrolls inside the viewport; a phone stays phone wide.
1517
- */
1518
- .stage.is-demo {
1519
- position: fixed;
1520
- inset: 0;
1521
- z-index: 2147483000;
1522
- display: flex;
1523
- flex-direction: column;
1524
- width: auto;
1525
- height: auto;
1526
- max-width: none;
1527
- max-height: none;
1528
- margin: 0;
1529
- padding: 0;
1530
- border: 0;
1531
- color: var(--dpk-ink);
1532
- background: var(--dpk-paper-sunken);
1533
- overflow: hidden;
1534
- }
1535
-
1536
- .stage.is-demo > .canvas {
1537
- flex: 1 1 0;
1538
- min-height: 0;
1539
- padding: 0;
1540
- border: 0;
1541
- border-radius: 0;
1542
- background: var(--dpk-dots), var(--dpk-paper-sunken);
1543
- box-shadow: none;
1544
- overflow: auto;
1545
- overscroll-behavior: contain;
1546
- }
1547
-
1548
- .stage.is-demo .frame[data-window='fill'] {
1549
- width: 100%;
1550
- height: 100%;
1551
- border: 0;
1552
- border-radius: 0;
1553
- box-shadow: none;
1554
- }
1555
-
1556
- /* A device keeps its size, in the middle of the tab (the element leaves 24px around it). */
1557
- .stage.is-demo > .canvas > .frame[data-window='device'] {
1558
- margin: auto;
1559
- }
1560
-
1561
- .stage.is-demo > .canvas > .frame:not([data-window]) {
1562
- margin: 24px auto;
1563
- }
1564
-
1565
- /*
1566
- * The demo's controls (commenting on the UI, the way out). Over a phone or a
1567
- * frame outside the browser, they float at the top right.
1568
- */
1569
- .demo-controls {
1570
- position: absolute;
1571
- top: 12px;
1572
- right: 16px;
1573
- z-index: 3;
1574
- display: flex;
1575
- align-items: center;
1576
- gap: 6px;
1577
- }
1578
-
1579
- .demo-control {
1580
- display: inline-flex;
1581
- align-items: center;
1582
- gap: 6px;
1583
- height: 30px;
1584
- padding: 0 10px;
1585
- border: 1px solid var(--dpk-rule-strong);
1586
- border-radius: 999px;
1587
- background: color-mix(in srgb, var(--dpk-paper-raised) 82%, transparent);
1588
- backdrop-filter: blur(10px);
1589
- box-shadow: var(--dpk-shadow);
1590
- color: var(--dpk-ink-soft);
1591
- font: 600 12px/1 var(--dpk-body);
1592
- cursor: pointer;
1593
- opacity: 0.55;
1594
- transition:
1595
- opacity 160ms var(--dpk-ease),
1596
- color 160ms var(--dpk-ease);
1597
- }
1598
-
1599
- .demo-exit {
1600
- padding-right: 8px;
1601
- }
1602
-
1603
- .demo-control:hover,
1604
- .demo-control:focus-visible {
1605
- opacity: 1;
1606
- color: var(--dpk-ink);
1607
- }
1608
-
1609
- .demo-control:focus-visible {
1610
- outline: none;
1611
- box-shadow: var(--dpk-focus), var(--dpk-shadow);
1612
- }
1613
-
1614
- /* Commenting stays in sight: a click on the app now picks an element instead of using it. */
1615
- .demo-control[aria-pressed='true'] {
1616
- opacity: 1;
1617
- border-color: var(--dpk-accent-strong);
1618
- background: var(--dpk-accent);
1619
- color: var(--dpk-accent-ink);
1620
- }
1621
-
1622
- .demo-control svg {
1623
- width: 12px;
1624
- height: 12px;
1625
- }
1626
-
1627
- /* A desktop browser has them at the free end of the tab strip, like window controls. */
1628
- .browser-tabs .demo-controls {
1629
- position: static;
1630
- flex: none;
1631
- align-self: center;
1632
- margin: 0 0 3px auto;
1633
- }
1634
-
1635
- .browser-tabs .demo-control {
1636
- height: 26px;
1637
- }
1638
-
1639
- .browser-tabs .demo-control:not([aria-pressed='true']) {
1640
- opacity: 0.85;
1641
- }
1642
-
1643
- .demo-exit kbd {
1644
- padding: 2px 5px;
1645
- border: 1px solid var(--dpk-rule-strong);
1646
- border-radius: var(--dpk-radius-xs);
1647
- background: var(--dpk-paper-sunken);
1648
- font: 600 10px/1 var(--dpk-mono);
1649
- }
1650
-
1651
- /* ------------------------------------------------------------------ frame */
1652
-
1653
- .frame {
1654
- width: min(var(--frame-width), 100%);
1655
- max-width: 100%;
1656
- margin: 0;
1657
- border: 1px solid var(--dpk-rule);
1658
- border-radius: var(--dpk-radius-lg);
1659
- background: var(--dpk-paper-raised);
1660
- box-shadow: var(--dpk-bevel), var(--dpk-shadow-lg);
1661
- overflow: hidden;
1662
- /* However high the mock stacks its own layers, they stay under what the stage draws over the frame. */
1663
- isolation: isolate;
1664
- transition: box-shadow 200ms var(--dpk-ease);
1665
- }
1666
-
1667
- /*
1668
- * Native previews are recognised by their device shape: a slim bezel, a status
1669
- * bar with a punch-hole camera, and a home indicator. No address bar.
1670
- */
1671
- .frame[data-kind='native'] {
1672
- padding: 10px;
1673
- border-color: #22262e;
1674
- border-radius: 28px;
1675
- background: linear-gradient(160deg, #2e3440, #1a1d24);
1676
- box-shadow:
1677
- var(--dpk-shadow-lg),
1678
- inset 0 1px 0 rgba(255, 255, 255, 0.06);
1679
- }
1680
-
1681
- .frame[data-kind='native'] .viewport {
1682
- overflow: hidden;
1683
- border-radius: 18px;
1684
- }
1685
-
1686
- /* A phone is portrait: derive the screen height from its width (~1:2.05)
1687
- instead of reusing the browser preview heights. */
1688
- .frame[data-kind='native'][data-viewport='mobile'] .viewport {
1689
- min-height: calc((var(--frame-width, 390px) - 16px) * 2.05);
1690
- }
1691
-
1692
- /*
1693
- * A plain preview is not a screen: no chrome, no bezel, no frame of its own.
1694
- * The light DOM draws the whole object (a memo, a FAX, a paper form) and the
1695
- * canvas is its desk, so it is as tall as its content.
1696
- */
1697
- .frame[data-kind='plain'] {
1698
- border: none;
1699
- border-radius: 0;
1700
- background: transparent;
1701
- box-shadow: none;
1702
- overflow: visible;
1703
- }
1704
-
1705
- .frame[data-kind='plain'] .viewport {
1706
- min-height: 0;
1707
- background: transparent;
1708
- }
1709
-
1710
- .frame[data-kind='plain'][data-empty] .viewport {
1711
- min-height: 180px;
1712
- }
1713
-
1714
- /* Home indicator. */
1715
- .frame[data-kind='native'] .viewport::after {
1716
- content: '';
1717
- position: absolute;
1718
- bottom: 8px;
1719
- left: 50%;
1720
- width: 88px;
1721
- height: 4px;
1722
- transform: translateX(-50%);
1723
- border-radius: 999px;
1724
- background: rgba(138, 146, 160, 0.55);
1725
- }
1726
-
1727
- /*
1728
- * The preview is never scrolled on its own: it shows everything it contains and
1729
- * the page scrolls as a whole. The flex column keeps a short mock filling
1730
- * the frame's minimum height without pinning a maximum.
1731
- */
1732
- .viewport {
1733
- position: relative;
1734
- contain: layout;
1735
- display: flex;
1736
- flex-direction: column;
1737
- width: 100%;
1738
- min-height: var(--frame-min-height, 480px);
1739
- /* A preview is the product's screen, not the kit's chrome: it stays light in a dark theme. */
1740
- color-scheme: light;
1741
- background: #fff;
1742
- /* …and so does its ink: the kit's dark-theme text color would be invisible on it. */
1743
- color: #1f2430;
1744
- }
1745
-
1746
- /*
1747
- * The author's wrapper becomes the frame's filling layer: a one-cell grid makes
1748
- * its height definite, so a mock that asks for height:100% fills the frame
1749
- * instead of collapsing to its content.
1750
- */
1751
- /*
1752
- * The author's wrapper is a stretch row: a mock fills a short frame and grows
1753
- * the frame when its own content is taller. Stretching (rather than a
1754
- * percentage height) is what makes the fill reliable.
1755
- */
1756
- /* Only the viewport carries the minimum height; the wrapper grows to fill it. */
1757
- .viewport ::slotted(*) {
1758
- display: grid;
1759
- flex: 1 0 auto;
1760
- min-width: 0;
1761
- }
1762
-
1763
- /*
1764
- * The app view is a simulation: a screen runs in a window of a fixed size (a
1765
- * device's screen, or the whole demo) and what does not fit scrolls inside
1766
- * the author's wrapper, the way the real page scrolls under the device's own
1767
- * chrome — the status bar, the address bar and a phone browser's bottom bar
1768
- * stay where they are. The viewport contains layout, so a mock's
1769
- * fixed position element (a tab bar, a modal) stays on the device screen.
1770
- */
1771
- .frame[data-window] {
1772
- display: flex;
1773
- flex: none;
1774
- flex-direction: column;
1775
- box-sizing: border-box;
1776
- max-width: none;
1777
- }
1778
-
1779
- .frame[data-window='device'] {
1780
- width: var(--device-width);
1781
- height: var(--device-height);
1782
- }
1783
-
1784
- .frame[data-kind][data-window] .viewport {
1785
- flex: 1 1 0;
1786
- min-height: 0;
1787
- overflow: hidden;
1788
- }
1789
-
1790
- .frame[data-window] .viewport ::slotted(*) {
1791
- flex: 1 1 0;
1792
- min-height: 0;
1793
- overflow: auto;
1794
- overscroll-behavior: contain;
1795
- }
1796
-
1797
- .frame-placeholder {
1798
- position: absolute;
1799
- inset: 12px;
1800
- display: grid;
1801
- align-content: center;
1802
- justify-items: center;
1803
- gap: 8px;
1804
- padding: 12px;
1805
- text-align: center;
1806
- color: var(--dpk-ink-faint);
1807
- border: 1px dashed var(--dpk-rule-strong);
1808
- border-radius: var(--dpk-radius);
1809
- background: var(--dpk-dots), var(--dpk-paper-sunken);
1810
- }
1811
-
1812
- .frame-placeholder code {
1813
- padding: 3px 7px;
1814
- border: 1px solid var(--dpk-rule);
1815
- border-radius: var(--dpk-radius-xs);
1816
- background: var(--dpk-paper-raised);
1817
- font-family: var(--dpk-mono);
1818
- font-size: 10px;
1819
- }
1820
-
1821
- .parked {
1822
- display: none;
1823
- }
1824
- `,xs=`
1825
- /*
1826
- * The wrapper is a stretch grid (see \`.viewport ::slotted(*)\`): one child
1827
- * fills the frame, but several would share the extra height as gaps between
1828
- * them, so they stack from the top instead (a \`<style>\` or \`<script>\` beside
1829
- * the one child draws nothing and does not count). A shadow tree cannot see a
1830
- * slotted element's children, hence the document rule; \`:where\` lets the
1831
- * author's own \`align-content\` win.
1832
- */
1833
- :where(
1834
- dpk-view-prototype
1835
- > [data-preview-id]:has(> :not(style, script, template, link) ~ :not(style, script, template, link))
1836
- ) {
1837
- align-content: start;
1838
- }
1839
-
1840
- dpk-view-prototype > [data-preview-id]:has(dialog[${Ee}][open]) {
1841
- position: relative;
1842
- }
1843
-
1844
- dpk-view-prototype > [data-preview-id]:has(dialog[${Ee}][open])::after {
1845
- content: '';
1846
- position: absolute;
1847
- inset: 0;
1848
- z-index: 1;
1849
- background: color-mix(in srgb, var(--dpk-ink, #111827) 38%, transparent);
1850
- }
1851
-
1852
- dpk-view-prototype > [data-preview-id] dialog[${Ee}][open] {
1853
- position: absolute;
1854
- inset: 0;
1855
- z-index: 2;
1856
- max-width: calc(100% - 32px);
1857
- max-height: calc(100% - 32px);
1858
- margin: auto;
1859
- }
1860
- `,qe={kind:"off"},Es=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking",as:"feedback"}:qe;case"exit":return qe;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:"",as:e.as};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"choose":return e.kind==="off"||e.as===t.as?e:{...e,as:t.as};case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking",as:e.as};default:return e}},Ss={width:300,height:300},$s=360,Ts={width:280,height:360},As={width:300,height:320},Oi=(e,t)=>({previewId:e.previewId,selector:t.selector,...t.text===void 0?{}:{text:t.text}}),Ci=".comment-pop:not(.ui-notes-pop)",Mi="dpk-view-prototype-document-styles",Is=24,_s=()=>{if(document.getElementById(Mi)!==null)return;const e=Object.assign(document.createElement("style"),{id:Mi,textContent:xs});document.head.append(e)},Ps=(e,t,i)=>{const n=getComputedStyle(e),o=/auto|scroll/.test(n.overflowX)&&e.scrollWidth>e.clientWidth,s=/auto|scroll/.test(n.overflowY)&&e.scrollHeight>e.clientHeight,r=t<0?e.scrollLeft>0:t>0&&e.scrollLeft+e.clientWidth<e.scrollWidth-1,a=i<0?e.scrollTop>0:i>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1;return o&&r||s&&a},Ds=e=>{if(e.assignedSlot!==null)return e.assignedSlot;if(e.parentElement!==null)return e.parentElement;const t=e.getRootNode();return t instanceof ShadowRoot?t.host:null};class Li extends ot{static{this.styles=[ot.styles,on,sn,ln,pn,cn,wn,ks]}#e=qe;#b=!1;#l=null;#s=[];#k=new rn(this);#K={app:new he(this),activity:new he(this),story:new he(this)};#X=new he(this);#O=!1;#i=null;#o=null;#C=!1;#h=!1;#x=!1;#r=null;#E=null;#S={};#$=1;#v=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{this.#q(),this.#y()});#p=null;#c=null;#f=null;#T=!1;#n=null;#A=null;#g=null;#t=null;#m=null;#M=typeof MutationObserver>"u"?null:new MutationObserver(()=>this.#ce());#d=null;constructor(){super(),new st(this,{open:()=>this.#f!==null,closesOn:t=>!t.some(i=>i instanceof Element&&this.#Q(i)),ownsEscape:()=>!0,dismiss:()=>this.#I(!0)}),new st(this,{open:()=>this.#n!==null,closesOn:t=>!t.some(i=>i instanceof Element&&(i.classList.contains("ui-notes-pop")||i.classList.contains("ui-note-badge"))),ownsEscape:()=>!0,dismiss:()=>this.#_(!0)})}definitionFor(t){return oi(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#H),window.addEventListener("resize",this.#D),this.addEventListener("toggle",this.#F,!0),this.addEventListener("click",this.#w,!0),this.addEventListener("auxclick",this.#w,!0),this.#M?.observe(this,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),_s()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#H),window.removeEventListener("resize",this.#D),this.removeEventListener("toggle",this.#F,!0),this.removeEventListener("click",this.#w,!0),this.removeEventListener("auxclick",this.#w,!0),this.#v?.disconnect(),this.#p=null,this.#M?.disconnect(),this.#d!==null&&cancelAnimationFrame(this.#d),this.#d=null,this.#j()}renderRegions(t){const i=me(this.locale),n=te(t.state,t.navigation),o=le(t.navigation)==="app";this.#i!==null&&this.#i.mode==="demo"!==o&&this.#G();const s=o?this.#ye(t,i):null;return this.#C=s!==null,this.#s=n!==void 0&&n.kind!=="story"&&(s===null||s.view.entry?.kind==="page")?Ye(t.state,n,t.navigation).shown.map(r=>r.id):[],this.#r!==null&&this.#r.page!==this.#s.join(" ")&&this.#j(),{sidebar:yi(t,i,this.#K),main:Pi(t,i,{deviceSelect:this.#X,hasPreviewContent:r=>this.#Se(r),lift:this.#i,onToggleMaximize:()=>this.#N(this.#i===null?"maximized":null),onToggleDemo:()=>this.#N(this.#i===null?"demo":null),onLiftedWheel:this.#me,browser:s===null?null:{...s,loading:this.#r!==null},devices:o?{choice:this.#S,zoom:this.#$,onPick:r=>{this.#S=Uo(this.#S,r),this.requestUpdate()}}:null,uiComment:this.#ie(t),uiNotes:this.#oe(t,o),actions:this.#Z(t),canvasEvents:{click:this.#ae,pointermove:this.#de,pointerleave:this.#le,wheel:this.#pe,scroll:this.#D}})}}updated(){super.updated(),this.#fe(),this.#he(),this.#ue(),this.#q();const t=this.#e;if(t.kind==="composing"&&!this.#s.includes(t.target.previewId)){this.#u({kind:"dismiss"});return}this.#ge(),this.#ee(),this.#x&&(this.#x=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#y(),this.#se();const i=t.kind==="composing"&&!this.#b;if(this.#b=t.kind==="composing",t.kind!=="composing"||this.#l===null)return;const n=this.renderRoot.querySelector(Ci);n&&(this.#k.open(n,this.#l,Ss,{placement:"right-start"}),i&&n.querySelector("textarea")?.focus({preventScroll:!0}))}#Z(t){const i=Kt(t.state,this.#s),n=i.map(s=>s.screen.id).join(" "),o=i.length>0&&this.#c===n;return{groups:i,open:o,toggle:()=>o?this.#I(!1):this.#J(n),run:(s,r)=>this.#te(s,r)}}#J(t){this.#c=t,this.requestUpdate()}#I(t){this.#c!==null&&(this.#c=null,this.#T=t,this.requestUpdate())}#Q(t){return t.classList.contains("actions-menu")||t.getAttribute("data-role")==="actions"}#ee(){const t=this.renderRoot.querySelector(".actions-menu"),i=this.renderRoot.querySelector('[data-role="actions"]');if(t===null){this.#f=null,this.#T&&i?.focus({preventScroll:!0}),this.#T=!1;return}t===this.#f||i===null||(this.#f=t,this.#k.open(t,i,Ts),t.querySelector('[role="menuitem"]')?.focus({preventScroll:!0}))}#te(t,i){this.#I(!0);const n=Kt(this.derivation.state,this.#s).find(d=>d.screen.id===t),o=n?.actions.find(d=>d.id===i);if(n===void 0||o===void 0)return;const r=this.#P().filter(d=>n.previewIds.includes(d.getAttribute("data-preview-id")??"")).map(d=>{const p=[...ko(d,o.fill??{}),...xo(d,o.click??[])];return d.dispatchEvent(new CustomEvent("dpk-action",{bubbles:!0,detail:{id:o.id,screen:n.screen.id}})),p}),a=(r[0]??[]).filter(d=>r.every(p=>p.includes(d)));a.length!==0&&console.warn(`[dev-process-kit] <dpk-view-prototype>: action "${o.id}" of screen "${n.screen.id}" found nothing on screen for: ${a.join(", ")}`)}#ie(t){const i=this.#e,n=i.kind==="composing"?i.target:void 0,o=n?E(t.state,n.previewId)?.preview:void 0,s=n?re(n):void 0,r=i.kind==="composing"&&i.as==="note"?(o?.notes??[]).filter(a=>a.selector===n?.selector).map(a=>a.body):t.comments.filter(a=>a.target.type===O&&a.target.id===s).map(a=>Qe(a));return{mode:i,pins:i.kind==="off"?[]:zt(t.comments,this.#s),...n&&o?{targetLabel:Ve(o,n)}:{},notes:r,composer:bn(this.locale),send:a=>this.#u(a),submit:a=>this.#ne(t.state,a)}}#u(t){const i=Es(this.#e,t);i!==this.#e&&(this.#e=i,i.kind!=="composing"&&(this.#l=null),i.kind!=="off"&&(this.#n=null),this.requestUpdate())}#ne(t,i){const n=this.#e;if(n.kind!=="composing")return;(n.as==="note"?this.dispatch(W.addUiNote(n.target,tt("note",_t(t)),i,new Date().toISOString())):this.dispatch({type:an,target:{type:O,id:re(n.target)},payload:{body:i}})).ok&&this.#u({kind:"submitted"})}#oe(t,i){const n=i?[]:jn(t.state,this.#s),o=this.#e.kind==="off"&&this.#n!==null?n.find(r=>ie(r)===this.#n)??null:null;o===null&&(this.#n=null);const s=this.#t;return s!==null&&!o?.notes.some(r=>r.id===s.noteId)&&(this.#t=null),{badges:n,open:o,toggle:r=>{const a=ie(r);this.#n===a?this.#_(!1):(this.#n=a,this.#t=null,this.requestUpdate())},close:()=>this.#_(!0),remove:(r,a)=>{const d=r.notes.find(p=>p.id===a);d!==void 0&&this.dispatch(W.deleteUiNote(Oi(r,d),a))},editing:this.#t,edit:(r,a)=>{this.#t={noteId:r,body:a},this.#m={noteId:r,part:"editor"},this.requestUpdate()},input:r=>{this.#t!==null&&(this.#t={...this.#t,body:r}),this.requestUpdate()},save:()=>{const r=this.#t,a=o?.notes.find(p=>p.id===r?.noteId),d=r?.body.trim()??"";o===null||r===null||a===void 0||d===""||(d!==a.body&&this.dispatch(W.setUiNoteBody(Oi(o,a),a.id,d)),this.#L())},cancel:()=>this.#L()}}#L(){this.#t!==null&&(this.#m={noteId:this.#t.noteId,part:"edit"},this.#t=null,this.requestUpdate())}#_(t){this.#n!==null&&(this.#g=t?this.#n:null,this.#n=null,this.requestUpdate())}#se(){const t=this.renderRoot.querySelector(".ui-notes-pop");if(t===null){this.#A=null,this.#g!==null&&this.#U(this.#g)?.focus({preventScroll:!0}),this.#g=null;return}const i=this.#U(t.dataset.key??""),n=this.#m;this.#m=null,n!==null&&t.querySelector(`li[data-id="${CSS.escape(n.noteId)}"]`)?.querySelector(n.part==="editor"?"textarea":'[data-role="edit-note"]')?.focus({preventScroll:!0}),!(t===this.#A||i===null)&&(this.#A=t,this.#k.open(t,i,As,{placement:"bottom-start"}),t.querySelector('[data-role="close-notes"]')?.focus({preventScroll:!0}))}#U(t){return Array.from(this.renderRoot.querySelectorAll(".ui-note-badge")).find(i=>i.dataset.key===t)??null}#V(t){const i=t.composedPath(),n=i[0];if(n instanceof Element&&n.classList.contains("ui-catcher"))return this.#re(t.clientX,t.clientY);const o=i.find(s=>s instanceof Element&&s.parentElement===this&&s.hasAttribute("data-preview-id"));return!o||!(n instanceof Element)||!o.contains(n)?null:this.#Y(n,o)}#re(t,i){const n=this.#z(t,i);return n===null?null:this.#Y(n.element,n.wrapper)}#z(t,i){if(typeof document.elementsFromPoint!="function")return null;const n=this.#P();for(const o of document.elementsFromPoint(t,i)){const s=n.find(r=>r.contains(o));if(s!==void 0)return{element:o,wrapper:s}}return null}#Y(t,i){const n=i.getAttribute("data-preview-id");if(!n)return null;const o=So(t,i),s=Io(o,i);return{element:o,target:{previewId:n,selector:s.selector,...s.text===void 0?{}:{text:s.text}}}}#P(){return Array.from(this.children).filter(t=>{const i=t.getAttribute("data-preview-id");return i!==null&&this.#s.includes(i)})}#ae=t=>{if(this.#e.kind==="off")return;const i=this.#V(t);i&&(t.preventDefault(),t.stopPropagation(),this.#l=i.element,this.#u({kind:"pick",target:i.target}))};#de=t=>{if(this.#e.kind==="off")return;const i=this.#V(t);this.#R(".ui-hover",i?.element??null)};#le=()=>{this.#R(".ui-hover",null)};#pe=t=>{const i=t.composedPath()[0];if(!(i instanceof Element)||!i.classList.contains("ui-catcher"))return;const n=this.renderRoot.querySelector(".canvas");let o=this.#z(t.clientX,t.clientY)?.element??null;for(;o!==null&&o!==n;){if(Ps(o,t.deltaX,t.deltaY)){t.preventDefault(),o.scrollBy({left:t.deltaX,top:t.deltaY});return}o=Ds(o)}};#H=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#u({kind:"exit"}):this.#N(null))};#D=()=>{this.#y()};#ce(){this.#d!==null||typeof requestAnimationFrame!="function"||(this.#d=requestAnimationFrame(()=>{this.#d=null,this.#y()}))}#y(){const t=this.renderRoot.querySelector(".canvas");if(t&&this.#B(t,".ui-note-badge","left"),this.#e.kind==="off"||(this.#R(".ui-picked",this.#l),!t))return;const i=this.renderRoot.querySelector(".ui-catcher");if(i){i.style.width=`${t.scrollWidth}px`,i.style.height=`${t.scrollHeight}px`;const n=[...this.renderRoot.querySelectorAll(".demo-controls")].map(o=>o.getBoundingClientRect());i.style.clipPath=go(i.getBoundingClientRect(),n)}this.#B(t,".ui-pin","right")}#B(t,i,n){for(const o of this.renderRoot.querySelectorAll(i)){const s=this.#ve(o.dataset.preview??""),a=(s?_o(s,o.dataset.selector??""):null)?.getBoundingClientRect();if(!a||a.width===0&&a.height===0){o.hidden=!0;continue}const d=this.#W(t);o.hidden=!1,o.style.left=`${a[n]-d.left}px`,o.style.top=`${a.top-d.top}px`}}#R(t,i){const n=this.renderRoot.querySelector(t),o=this.renderRoot.querySelector(".canvas");if(!n||!o)return;const s=i?.getBoundingClientRect();if(!s){n.hidden=!0;return}const r=this.#W(o);n.hidden=!1,n.style.left=`${s.left-r.left}px`,n.style.top=`${s.top-r.top}px`,n.style.width=`${s.width}px`,n.style.height=`${s.height}px`}#W(t){const i=t.getBoundingClientRect();return{left:i.left+t.clientLeft-t.scrollLeft,top:i.top+t.clientTop-t.scrollTop}}#ue(){const t=this.renderRoot.querySelector(".canvas");t===this.#p||this.#v===null||(this.#p!==null&&this.#v.unobserve(this.#p),this.#p=t,t!==null&&this.#v.observe(t))}#q(){const t=this.renderRoot.querySelector('.frame[data-window="device"]'),i=t?.closest(".canvas");if(!t||!(i instanceof HTMLElement))return;const n=getComputedStyle(t),o={width:parseFloat(n.getPropertyValue("--device-width")),height:parseFloat(n.getPropertyValue("--device-height"))},s=getComputedStyle(i),r=i.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight),a=this.#i?.mode==="demo",d=a?Is*2:0,p=zo(o,{width:r-d,...a?{height:i.clientHeight-d}:{}});p!==this.#$&&(this.#$=p,this.requestUpdate())}#he(){for(const t of this.querySelectorAll(":scope > [data-preview-id]"))for(const i of t.querySelectorAll("dialog"))ri(i),ai(this,i)}#F=t=>{const i=t.target;!(i instanceof HTMLDialogElement)||!i.open||Array.from(this.children).some(n=>n.hasAttribute("data-preview-id")&&n.contains(i))&&(ri(i),ai(this,i))};#ve(t){return Array.from(this.children).find(i=>i.getAttribute("data-preview-id")===t)}#fe(){if(this.#O||this.renderRoot.querySelector(".stage")===null)return;this.#O=!0;const t=this.derivation.state,i=[];for(const n of Array.from(this.children)){const o=n.getAttribute("data-preview-id");if(o!==null)for(const s of n.querySelectorAll("a, [data-dpk-navigate]")){const r=oo(t,{href:s.getAttribute("href"),navigate:s.getAttribute("data-dpk-navigate")});if(r===null)continue;const a=(s.textContent??"").replace(/\s+/g," ").trim().slice(0,40),d=s.getAttribute("data-dpk-navigate")??s.getAttribute("href")??"(no href)";i.push(` ${o}: <${s.tagName.toLowerCase()}> "${a}" \u2192 ${d} (${r})`)}}i.length!==0&&console.warn(`[dev-process-kit] <dpk-view-prototype>: ${i.length} link(s) in the previews lead nowhere. Point each at the screen it opens (data-dpk-navigate="screen=\u2026"); a link that only moves the scenario on can name a step (data-dpk-navigate="step=\u2026") or a user story (data-dpk-navigate="story=\u2026"):
1861
- `+i.join(`
1862
- `))}#N(t){if(t===(this.#i?.mode??null))return;const i=this.renderRoot.querySelector(".stage"),n=this.#i?.height??i?.offsetHeight??0;this.#G(),t!==null&&(this.#i={mode:t,height:n}),this.#c=null,this.#n=null,t!==null&&this.#e.kind==="composing"&&(dn(this.renderRoot.querySelector(Ci)),this.#b=!1),this.requestUpdate()}#G(){this.#i=null,this.#E=null}#ge(){const t=this.renderRoot.querySelector(".stage");if(!(this.#i===null||!t||typeof t.showPopover!="function")&&t!==this.#E){this.#E=t;try{t.showPopover()}catch{}}}#me=t=>{const i=this.renderRoot.querySelector(".canvas");(i===null||!t.composedPath().includes(i))&&t.preventDefault()};#ye(t,i){const n=ci(t.state,t.navigation);this.#o=this.#o===null?n===null?null:kn(n):ct(this.#o,{kind:"observe",page:n});const o=this.#o;if(o===null)return null;const s=ut(o),r=s?.kind!=="page"&&o.seen!==null;if(n===null&&!r)return null;const a=No(o)??n;return{view:vi(t.state,o,i,a),shortcuts:s?.kind==="new-tab"?Oo(t.state,a):[],switcher:this.#h,send:d=>this.#be(d)}}#a(t){if(this.#o===null)return;const i=ct(this.#o,t);if(i===this.#o)return;this.#o=i;const n=ut(i);n?.kind==="page"&&this.#we(n.page),this.requestUpdate()}#we(t){this.navigate({screen:t.screen??null,preview:t.preview??null})}#be(t){switch(t.kind){case"reload":this.#xe();return;case"address":this.#ke(t.input);return;case"back":case"forward":case"new-tab":this.#h=!1,this.#a({kind:t.kind});return;case"switcher":this.#h=t.open,this.requestUpdate();return;case"activate":this.#h=!1,this.#x=t.focus===!0,this.#a({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#a({kind:t.kind,id:t.id});return;case"visit":this.#a({kind:"visit",page:t.page});return;default:return}}#ke(t){const i=this.#o;if(i===null)return;const n=this.derivation.state,o=vi(n,i,me(this.locale)).url||"https://page.example.com/",s=Po(n,t,o);if(s!==null){this.#a({kind:"visit",page:s});return}this.#a({kind:"unreachable",url:xn(t,o)})}#xe(){if(this.#r!==null)return;const t=setTimeout(()=>{this.#r=null;for(const i of this.#P()){for(const n of i.querySelectorAll("form"))n.reset();for(const n of i.querySelectorAll("dialog"))n.close();i.scrollTop=0,i.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser .viewport")?.scrollTo?.({top:0}),this.requestUpdate()},$s);this.#r={page:this.#s.join(" "),timer:t},this.requestUpdate()}#j(){this.#r!==null&&(clearTimeout(this.#r.timer),this.#r=null)}#w=t=>{if(!this.#C||this.#e.kind!=="off"||this.#o===null||t.type==="auxclick"&&t.button!==1)return;const i=this.#Ee(t);if(i===null)return;const n=t.metaKey||t.ctrlKey||t.button===1;if(!i.blank&&!n)return;t.preventDefault(),t.stopPropagation();const o=ci(this.derivation.state,_e(this.hashFor(i.patch)));if(o===null){n||this.navigate(i.patch);return}this.#a({kind:"open-tab",entry:{kind:"page",page:o},background:n})};#Ee(t){const i=t.composedPath();if(!i.some(o=>o instanceof Element&&o.parentElement===this&&o.hasAttribute("data-preview-id")))return null;for(const o of i){if(!(o instanceof Element)||o===this)break;const s=o.getAttribute("data-dpk-navigate"),r=o instanceof HTMLAnchorElement?o.getAttribute("href"):null,a=s??(r?.startsWith("#")?r:null);if(a===null)continue;const d=s!==null&&!s.includes("=")?`step=${s}`:a;return{patch:{..._e(d)},blank:o.getAttribute("target")==="_blank"}}return null}#Se(t){return Array.from(this.querySelectorAll("[data-preview-id]")).some(i=>i.getAttribute("data-preview-id")===t)}}const Ui=()=>{customElements.get("dpk-view-prototype")||customElements.define("dpk-view-prototype",Li)},Rs=Object.freeze(Object.defineProperty({__proto__:null,DpkViewPrototype:Li,VIEWPORT_MIN_HEIGHT:Ii,VIEWPORT_WIDTH:Ai,allScreens:H,allStepIds:Pt,applyPrototypeAction:Rt,definePrototypeElement:Ui,describePrototypeAction:Lt,emptyPrototypeBase:Tt,findActivity:U,findPreview:E,findScreen:L,findStep:S,findStory:$,flattenSteps:B,parsePrototypeBase:$t,prototypeAction:W,prototypeActions:m,prototypeBaseSchema:xt,prototypeCommentTargets:Xt,prototypeDefinitionFor:oi,prototypeMessages:me,prototypePageHeading:Zt,prototypeTargetLabel:Vt,prototypeTitle:He,renderFrame:We,renderNav:yi,renderStage:Pi,resolvePrototypeNavigation:xe,serializePrototypeAction:Ut},Symbol.toStringTag,{value:"Module"}));export{Ui as d,Rs as i};