dev-process-kit 0.0.12 → 0.0.13

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 (33) hide show
  1. package/dist/chunks/{shared-DBJaP5gF.js → shared-0MFKKPnB.js} +144 -92
  2. package/dist/chunks/{shared-DUq2-pM9.js → shared-B2YRwZ0P.js} +99 -60
  3. package/dist/chunks/{shared-y3FwoRgh.js → shared-B4Mwapvi.js} +88 -62
  4. package/dist/chunks/shared-BDUe3aT-.js +1 -0
  5. package/dist/chunks/{shared-BwaDMwUS.js → shared-C1KQ5iU8.js} +55 -32
  6. package/dist/chunks/{shared-BvuW5NtY.js → shared-CQG0dnvb.js} +15 -5
  7. package/dist/chunks/{shared-BC5MlWBY.js → shared-CSC14I4g.js} +248 -87
  8. package/dist/chunks/{shared-D7CMQLaX.js → shared-Cd8A5TjZ.js} +140 -35
  9. package/dist/chunks/{shared-CcrRNZCH.js → shared-CirHYajF.js} +1 -1
  10. package/dist/chunks/shared-D4K7KsfJ.js +1 -0
  11. package/dist/chunks/{shared-DYe0OZr-.js → shared-D7poXZ0z.js} +15 -7
  12. package/dist/chunks/shared-DO0pUSjw.js +571 -0
  13. package/dist/chunks/shared-DdefS1nG.js +1 -0
  14. package/dist/chunks/{shared-C__W71Hw.js → shared-DjmQsa0n.js} +1 -1
  15. package/dist/chunks/{shared-CLnfjHCQ.js → shared-DklLt1Sc.js} +1 -1
  16. package/dist/chunks/{shared-DkkBQzIf.js → shared-DrMSORn-.js} +31 -8
  17. package/dist/chunks/shared-DxAiavwJ.js +1102 -0
  18. package/dist/components.js +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/templates/delegation-poker.js +1 -1
  21. package/dist/templates/event-storming.js +1 -1
  22. package/dist/templates/example-mapping.js +1 -1
  23. package/dist/templates/grill.js +1 -1
  24. package/dist/templates/plain.js +1 -1
  25. package/dist/templates/prototype.js +1 -1
  26. package/dist/templates/slides.js +1 -1
  27. package/dist/templates/task-board.js +1 -1
  28. package/dist/templates/usm.js +1 -1
  29. package/dist/templates/whiteboard.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunks/shared-CoDXb-Yj.js +0 -556
  32. package/dist/chunks/shared-DhwK_dh_.js +0 -1093
  33. package/dist/chunks/shared-xrCdgpNS.js +0 -1
@@ -1,10 +1,10 @@
1
- import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as Sr,aL as Ze,aM as Tr,af as V,aj as E,ar as Ir,p as w,at as m,v as ce,ay as te,P as Ar,e as Pr,a0 as _r,h as Qe,N as Ae,V as Y,U as Rr,R as y,a4 as d,a3 as c,aN as Pe,aO as _e,aE as Re,a5 as Dr,z as ue,aD as et,l as Or,aP as O,aQ as Cr,aR as Lr,J as tt,aS as Mr,A as rt,ab as Nr,aa as zr,a2 as Vr,T as it,a1 as Yr,aT as Ur,C as Wr}from"./shared-BC5MlWBY.js";import{p as Br,r as Hr,c as Gr}from"./shared-CcrRNZCH.js";import{P as Fr,c as qr}from"./shared-aDPp8Vry.js";import{i as nt}from"./shared-C__W71Hw.js";const jr=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]],Kr=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]],Xr=[["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"}]],Jr=[["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"}]],Zr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]],Qr=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],ei=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],ti=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],ot=["browser","native","mail","plain"],st=["mobile","tablet","desktop","fluid"],K=e=>"screen"in e,ri=D({from:f(u()),to:f(u()),cc:f(u()),subject:f(u()),date:f(u())}),ii={id:_,kind:N(le(ot),"browser"),viewport:N(le(st),"fluid"),label:f(u()),url:f(u()),mail:f(ri)},De=x(D(ii),Er(e=>e.mail===void 0||e.kind==="mail",'a preview `mail` envelope needs `"kind": "mail"`')),at=Ir([D({screen:_,preview:f(_)}),D({material:De})]),ni=D({id:_,name:x(u(),E(1)),description:f(u()),actor:f(x(u(),E(1))),situation:f(x(u(),E(1))),panes:N(V(at),[])}),oi=D({id:_,name:x(u(),E(1)),description:f(u()),actor:f(x(u(),E(1))),steps:N(V(ni),[])}),si=D({id:_,name:x(u(),E(1)),description:f(u()),actor:f(x(u(),E(1))),stories:N(V(oi),[])}),ai=D({id:_,title:x(u(),E(1)),description:f(u()),previews:N(V(De),[])}),di=D({id:_,name:x(u(),E(1)),description:f(u()),actor:f(x(u(),E(1))),screens:N(V(ai),[])}),dt=D({title:f(u()),baseUrl:f(u()),apps:N(V(di),[]),activities:N(V(si),[])}),pt=e=>e.flatMap(t=>K(t)?[]:[t.material]),pi=e=>{const t=new Set,r=s=>{for(const a of s){if(t.has(a.id))return`duplicate preview id "${a.id}": preview ids are global, they name a light DOM slot`;t.add(a.id)}return null},i=new Set,n=new Set;for(const s of e.apps){if(i.has(s.id))return`duplicate app id "${s.id}"`;i.add(s.id);for(const a of s.screens){if(n.has(a.id))return`duplicate screen id "${a.id}": screen ids are global`;n.add(a.id);const p=r(a.previews);if(p!==null)return p}}const o=new Set;for(const s of e.activities){if(o.has(s.id))return`duplicate activity id "${s.id}"`;o.add(s.id);const a=new Set;for(const p of s.stories){if(a.has(p.id))return`duplicate story id "${p.id}" in activity "${s.id}"`;a.add(p.id);const l=new Set;for(const b of p.steps){if(l.has(b.id))return`duplicate step id "${b.id}" in story "${p.id}"`;l.add(b.id);const h=r(pt(b.panes));if(h!==null)return h}}}return null},lt=(e,t)=>{const r=new Map;for(const i of t.panes){if(!K(i))continue;const n=e(i.screen);if(n===void 0)return`unknown screen "${i.screen}" on step "${t.id}": declare it under \`apps[].screens\``;if(i.preview!==void 0&&!n.includes(i.preview))return`preview "${i.preview}" on step "${t.id}" is not a rendition of screen "${i.screen}"`;const o=r.get(i.screen)??[];if(o.length>0&&(i.preview===void 0||o.includes(i.preview)||o.includes(void 0)))return`screen "${i.screen}" is shown twice on step "${t.id}": give each pane a different \`preview\``;r.set(i.screen,[...o,i.preview])}return null},li=e=>{const t=new Map(e.apps.flatMap(r=>r.screens.map(i=>[i.id,i.previews.map(n=>n.id)])));for(const r of e.activities.flatMap(i=>i.stories.flatMap(n=>n.steps))){const i=lt(n=>t.get(n),r);if(i!==null)return i}return null},ci=(e,t)=>lt(r=>C(e,r)?.screen.previews.map(i=>i.id),t),re="ui",ct=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},Oe=e=>{const t=e.indexOf("/");if(t<=0)return;const r=e.slice(0,t);if(!Tr(_,r))return;const i=e.slice(t+1),n=/ "([^"]*)"$/.exec(i),o=(n?i.slice(0,n.index):i).trim();if(o!=="")return n?.[1]===void 0?{previewId:r,selector:o}:{previewId:r,selector:o,text:n[1]}},ut=e=>{const t=Sr(dt,e),r=pi(t)??li(t);if(r!==null)throw new Error(r);return t},ht=()=>({apps:[],activities:[]}),U=e=>e.apps.flatMap(t=>t.screens.map(r=>({app:t,screen:r}))),C=(e,t)=>{if(t!==void 0)return U(e).find(r=>r.screen.id===t)},he=(e,t)=>t.panes.flatMap(r=>{const i=K(r)?C(e,r.screen):void 0;return i?[i]:[]}),X=e=>pt(e.panes),ui=(e,t)=>e.panes.some(r=>K(r)&&r.screen===t),L=(e,t)=>{if(t!==void 0)return e.activities.find(r=>r.id===t)},M=(e,t)=>`${e}.${t}`,$=(e,t)=>{if(t===void 0)return;const r=Ze(t,2);if(r){const[n,o]=r;if(n===void 0||o===void 0)return;const s=e.activities.find(p=>p.id===n),a=s?.stories.find(p=>p.id===o);return s&&a?{activity:s,story:a}:void 0}if(t.includes("."))return;const i=e.activities.flatMap(n=>n.stories.filter(o=>o.id===t).map(o=>({activity:n,story:o})));return i.length===1?i[0]:void 0},vt=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},ve=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,fe=(e,t,r)=>`${e.id}.${t.id}.${r.id}`,k=(e,t)=>{if(t===void 0)return;const r=Ze(t,3);if(r){const[n,o,s]=r;if(n===void 0||o===void 0||s===void 0)return;const a=e.activities.find(h=>h.id===n),p=a?.stories.find(h=>h.id===o),l=p?p.steps.findIndex(h=>h.id===s):-1,b=p&&l>=0?p.steps[l]:void 0;return a&&p&&b?{activity:a,story:p,step:b,stepIndex:l}:void 0}if(t.includes("."))return;const i=W(e).filter(n=>n.step.id===t);return i.length===1?i[0]:void 0},I=(e,t)=>{if(t!==void 0){for(const r of U(e)){const i=r.screen.previews.find(n=>n.id===t);if(i)return{owner:{kind:"screen",...r},preview:i}}for(const r of W(e)){const i=X(r.step).find(n=>n.id===t);if(i)return{owner:{kind:"step",...r},preview:i}}}},W=e=>e.activities.flatMap(t=>t.stories.flatMap(r=>r.steps.map((i,n)=>({activity:t,story:r,step:i,stepIndex:n})))),ft=e=>W(e).map(t=>t.step.id),g={SET_ACTIVITY_NAME:w("SET_ACTIVITY_NAME","activity",m({name:x(u(),E(1))})),SET_ACTIVITY_DESCRIPTION:w("SET_ACTIVITY_DESCRIPTION","activity",m({description:u()})),SET_STORY_NAME:w("SET_STORY_NAME","story",m({name:x(u(),E(1))})),SET_STORY_DESCRIPTION:w("SET_STORY_DESCRIPTION","story",m({description:u()})),SET_STEP_NAME:w("SET_STEP_NAME","step",m({name:x(u(),E(1))})),SET_STEP_DESCRIPTION:w("SET_STEP_DESCRIPTION","step",m({description:u()})),SET_PREVIEW_KIND:w("SET_PREVIEW_KIND","preview",m({kind:le(ot)})),SET_PREVIEW_VIEWPORT:w("SET_PREVIEW_VIEWPORT","preview",m({viewport:le(st)})),SET_PREVIEW_LABEL:w("SET_PREVIEW_LABEL","preview",m({label:u()})),REORDER_ACTIVITY:w("REORDER_ACTIVITY","activity",m({after:te(u())}),{mode:"sequence"}),REORDER_STORY:w("REORDER_STORY","story",m({after:te(u())}),{mode:"sequence"}),REORDER_STEP:w("REORDER_STEP","step",m({after:te(u())}),{mode:"sequence"}),MOVE_STORY:w("MOVE_STORY","story",m({toActivity:x(u(),E(1)),after:te(u())}),{mode:"sequence"}),MOVE_STEP:w("MOVE_STEP","step",m({toStory:x(u(),E(1)),after:te(u())}),{mode:"sequence"}),ADD_ACTIVITY:w("ADD_ACTIVITY","page",m({id:_,name:x(u(),E(1)),description:f(u())}),{dedupeKey:ce}),ADD_STORY:w("ADD_STORY","activity",m({id:_,name:x(u(),E(1)),description:f(u())}),{dedupeKey:ce}),ADD_STEP:w("ADD_STEP","story",m({id:_,name:x(u(),E(1)),description:f(u()),panes:f(V(at))}),{dedupeKey:ce}),ADD_PREVIEW:w("ADD_PREVIEW","step",De,{dedupeKey:ce}),DELETE_ACTIVITY:w("DELETE_ACTIVITY","activity",m({})),DELETE_STORY:w("DELETE_STORY","story",m({})),DELETE_STEP:w("DELETE_STEP","step",m({})),DELETE_PREVIEW:w("DELETE_PREVIEW","preview",m({}))},ie={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,r)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:r}}),moveStory:(e,t,r)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:r}}),addActivity:(e,t,r)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...r===void 0?{}:{description:r}}}),addStory:(e,t,r,i)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:r,...i===void 0?{}:{description:i}}}),addStep:(e,t,r,i)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:r,...i===void 0?{}:{panes:i}}}),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:{}})},gt=(e,t)=>{const r=Ar(g,t);if(r===null)return null;const i=r.target.id;switch(r.type){case"SET_ACTIVITY_NAME":return B(e,i,n=>({...n,name:r.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return B(e,i,n=>({...n,description:r.payload.description}));case"SET_STORY_NAME":return H(e,i,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return H(e,i,n=>({...n,description:r.payload.description}));case"SET_STEP_NAME":return ge(e,i,n=>({...n,name:r.payload.name}));case"SET_STEP_DESCRIPTION":return ge(e,i,n=>({...n,description:r.payload.description}));case"SET_PREVIEW_KIND":return Le(e,i,n=>({...n,kind:r.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Le(e,i,n=>({...n,viewport:r.payload.viewport}));case"SET_PREVIEW_LABEL":return Le(e,i,n=>({...n,label:r.payload.label}));case"REORDER_ACTIVITY":{const{after:n}=r.payload,o=ne(e.activities,i,n);return o===null?null:{...e,activities:o}}case"REORDER_STORY":{const{after:n}=r.payload,o=$(e,i);if(!o)return null;const s=n===null?null:$(e,n);if(n!==null&&(!s||s.activity!==o.activity))return null;const a=ne(o.activity.stories,o.story.id,s?.story.id??null);return a===null?null:B(e,o.activity.id,p=>({...p,stories:a}))}case"REORDER_STEP":{const{after:n}=r.payload,o=k(e,i);if(!o)return null;const s=n===null?null:k(e,n);if(n!==null&&(!s||s.story!==o.story))return null;const a=ne(o.story.steps,o.step.id,s?.step.id??null);return a===null?null:H(e,M(o.activity.id,o.story.id),p=>({...p,steps:a}))}case"MOVE_STORY":{const{toActivity:n,after:o}=r.payload,s=$(e,i);if(!s)return null;const a=e.activities.find(h=>h.id===n);if(!a)return null;const p=o===null?null:$(e,o);if(o!==null&&(!p||p.activity!==a))return null;const l=p?.story.id??null;if(s.activity.id===n){const h=ne(s.activity.stories,s.story.id,l);return h===null?null:B(e,n,v=>({...v,stories:h}))}if(a.stories.some(h=>h.id===s.story.id))return null;const b=Me(a.stories,s.story,l);return Ce(e,h=>h.id===s.activity.id?{...h,stories:h.stories.filter(v=>v.id!==vt(i))}:h.id===n?{...h,stories:b}:h)}case"MOVE_STEP":{const{toStory:n,after:o}=r.payload,s=k(e,i);if(!s)return null;const a=$(e,n);if(!a)return null;const p=o===null?null:k(e,o);if(o!==null&&(!p||p.story!==a.story))return null;const l=p?.step.id??null;if(s.story===a.story){const h=ne(s.story.steps,s.step.id,l);return h===null?null:H(e,n,v=>({...v,steps:h}))}if(a.story.steps.some(h=>h.id===s.step.id))return null;const b=Me(a.story.steps,s.step,l);return Ce(e,h=>({...h,stories:h.stories.map(v=>v===s.story?{...v,steps:v.steps.filter(A=>A.id!==vt(i))}:v===a.story?{...v,steps:b}:v)}))}case"ADD_ACTIVITY":{const n=r.payload;if(e.activities.some(s=>s.id===n.id))return e;const o={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},stories:[]};return{...e,activities:[...e.activities,o]}}case"ADD_STORY":{const n=r.payload,o=e.activities.find(a=>a.id===i);if(!o)return null;if(o.stories.some(a=>a.id===n.id))return e;const s={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},steps:[]};return B(e,i,a=>({...a,stories:[...a.stories,s]}))}case"ADD_STEP":{const n=r.payload,o=$(e,i)?.story;if(!o)return null;if(o.steps.some(p=>p.id===n.id))return e;const s=n.panes??[],a={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},panes:s};return hi(e,a)?H(e,i,p=>({...p,steps:[...p.steps,a]})):null}case"ADD_PREVIEW":{const n=r.payload,o=k(e,i)?.step;return o?X(o).some(s=>s.id===n.id)?e:I(e,n.id)?null:ge(e,i,s=>({...s,panes:[...s.panes,{material:n}]})):null}case"DELETE_ACTIVITY":{const n=i;return e.activities.some(o=>o.id===n)?{...e,activities:e.activities.filter(o=>o.id!==n)}:null}case"DELETE_STORY":{const n=$(e,i);return n?B(e,n.activity.id,o=>({...o,stories:o.stories.filter(s=>s.id!==n.story.id)})):null}case"DELETE_STEP":{const n=k(e,i);return n?H(e,M(n.activity.id,n.story.id),o=>({...o,steps:o.steps.filter(s=>s.id!==n.step.id)})):null}case"DELETE_PREVIEW":{const n=I(e,i);return n?bt(e,n.owner,o=>o.filter(s=>s.id!==n.preview.id)):null}default:return Pr(r)}},Ce=(e,t)=>({...e,activities:e.activities.map(t)}),B=(e,t,r)=>{const i=t;return e.activities.some(n=>n.id===i)?Ce(e,n=>n.id===i?r(n):n):null},H=(e,t,r)=>{const i=$(e,t);if(!i)return null;const n=i.story.id;return B(e,i.activity.id,o=>({...o,stories:o.stories.map(s=>s.id===n?r(s):s)}))},ge=(e,t,r)=>{const i=k(e,t);if(!i)return null;const n=i.step.id;return H(e,M(i.activity.id,i.story.id),o=>({...o,steps:o.steps.map(s=>s.id===n?r(s):s)}))},Le=(e,t,r)=>{const i=I(e,t);if(!i)return null;const n=i.preview.id;return bt(e,i.owner,o=>o.map(s=>s.id===n?r(s):s))},hi=(e,t)=>{const r=X(t).map(i=>i.id);return ci(e,t)===null&&new Set(r).size===r.length&&!r.some(i=>I(e,i))},bt=(e,t,r)=>{if(t.kind==="step")return ge(e,ve(t),n=>{const o=new Map(r([...X(n)]).map(s=>[s.id,s]));return{...n,panes:n.panes.flatMap(s=>{if(K(s))return[s];const a=o.get(s.material.id);return a?[{material:a}]:[]})}});const i=t.screen.id;return{...e,apps:e.apps.map(n=>n.id===t.app.id?{...n,screens:n.screens.map(o=>o.id===i?{...o,previews:r(o.previews)}:o)}:n)}},ne=(e,t,r)=>{const i=e.findIndex(s=>s.id===t);if(i<0||r!==null&&!e.some(s=>s.id===r))return null;if(t===r)return[...e];const n=e[i];if(n===void 0)return null;const o=e.filter(s=>s.id!==t);return Me(o,n,r)},Me=(e,t,r)=>{const i=[...e],n=r===null?-1:i.findIndex(o=>o.id===r);return i.splice(n+1,0,t),i},wt={"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"'},vi={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},fi={"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"},be=_r({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}`,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=>wt[e]??vi[e]??e,deviceZoom:e=>`Shown at ${e}% to fit`},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}`,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=>wt[e]??fi[e]??e,deviceZoom:e=>`\u53CE\u307E\u308B\u3088\u3046 ${e}% \u3067\u8868\u793A`}}),gi=["scenario","app"],G="view",oe=e=>e[G]==="app"?"app":"scenario",mt=e=>({[G]:e==="app"?"app":null}),se=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,bi=e=>({SET_ACTIVITY_NAME:(t,r)=>({title:e.renameActivity,tone:"update",body:se(L(r,t.target.id)?.name,y(g.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,r)=>({title:e.updateActivityDescription,tone:"update",body:Ne(L(r,t.target.id)?.description,y(g.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,r)=>({title:e.renameStory,tone:"update",body:se($(r,t.target.id)?.story.name,y(g.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,r)=>({title:e.updateStoryDescription,tone:"update",body:Ne($(r,t.target.id)?.story.description,y(g.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,r)=>({title:e.renameStep,tone:"update",body:se(k(r,t.target.id)?.step.name,y(g.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,r)=>({title:e.updateStepDescription,tone:"update",body:Ne(k(r,t.target.id)?.step.description,y(g.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,r)=>({title:e.changePreviewKind,tone:"update",body:se(I(r,t.target.id)?.preview.kind,y(g.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,r)=>({title:e.changePreviewViewport,tone:"update",body:se(I(r,t.target.id)?.preview.viewport,y(g.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${y(g.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>ze(e,e.activityGroup,y(g.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>ze(e,e.storyGroup,y(g.REORDER_STORY,t).after),REORDER_STEP:t=>ze(e,e.stepGroup,y(g.REORDER_STEP,t).after),MOVE_STORY:(t,r)=>({title:e.moveStory,tone:"move",body:`\u2192 ${L(r,y(g.MOVE_STORY,t).toActivity)?.name??y(g.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,r)=>({title:e.moveStep,tone:"move",body:`\u2192 ${$(r,y(g.MOVE_STEP,t).toStory)?.story.name??y(g.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>we(e,e.activityGroup,y(g.ADD_ACTIVITY,t).name),ADD_STORY:t=>we(e,e.storyGroup,y(g.ADD_STORY,t).name),ADD_STEP:t=>we(e,e.stepGroup,y(g.ADD_STEP,t).name),ADD_PREVIEW:t=>we(e,e.previewGroup,y(g.ADD_PREVIEW,t).label??y(g.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,r)=>me(e,L(r,t.target.id)?.name),DELETE_STORY:(t,r)=>me(e,$(r,t.target.id)?.story.name),DELETE_STEP:(t,r)=>me(e,k(r,t.target.id)?.step.name),DELETE_PREVIEW:(t,r)=>me(e,I(r,t.target.id)?.preview.label)}),Ne=(e,t)=>{const r=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${r}"`:`"${wi(e)}" \u2192 "${r}"`},wi=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,ze=(e,t,r)=>({title:e.reorderTitle(t),tone:"move",body:r===null?e.toFront:e.afterName(r)}),we=(e,t,r)=>({title:e.addTitle(t),tone:"create",body:`+ "${r}"`}),me=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),yt=(e,t,r,i)=>{const n=bi(e),o=Object.hasOwn(n,t.type)?n[t.type]:void 0,s=o?o(t,i??r):{title:t.type,tone:"meta"};return{title:s.title,targetLabel:xt(e,r,t.target),tone:s.tone,...s.body===void 0?{}:{summary:s.body}}},kt=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,xt=(e,t,r)=>{switch(r.type){case"activity":{const i=L(t,r.id);return i?e.targetLabel(e.activityGroup,i.name):e.targetMissing(e.activityGroup,r.id)}case"story":{const i=$(t,r.id)?.story;return i?e.targetLabel(e.storyGroup,i.name):e.targetMissing(e.storyGroup,r.id)}case"step":{const i=k(t,r.id)?.step;return i?e.targetLabel(e.stepGroup,i.name):e.targetMissing(e.stepGroup,r.id)}case"screen":{const i=C(t,r.id)?.screen;return i?e.targetLabel(e.screenGroup,i.title):e.targetMissing(e.screenGroup,r.id)}case"preview":{const i=I(t,r.id)?.preview;return i?e.targetLabel(e.previewGroup,i.label??i.id):e.targetMissing(e.previewGroup,r.id)}case"page":return e.targetLabel(e.pageGroup,Ue(t));case re:{const i=Oe(r.id),n=i?I(t,i.previewId)?.preview:void 0;return i&&n?e.targetLabel(e.uiGroup,$t(n,i)):e.targetMissing(e.uiGroup,r.id)}default:return e.targetLabel(r.type,r.id)}},$t=(e,t)=>{const r=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${r}`},Et=(e,t)=>{const r=[];for(const i of e){if(i.target.type!==re)continue;const n=Oe(i.target.id);!n||!t.includes(n.previewId)||r.push({id:i.id,previewId:n.previewId,selector:n.selector,number:r.length+1,body:Qe(i)})}return r},St=(e,t)=>Et(e,t).length,mi=/^[a-z][a-z0-9+.-]*:/i,yi=e=>{const t=e.baseUrl?.trim(),r=Rr(e.title??"");return`${(t?t.startsWith("http")?t:`https://${t}`:`https://${r==="item"?"page":r}.example.com`).replace(/\/+$/,"")}/`},ye=(e,t)=>{const r=yi(e);if(!t.url)return`${r}${t.id}`;if(mi.test(t.url))return t.url;try{return decodeURI(new URL(t.url,r).href)}catch{return t.url}},Ve=",",Tt=e=>e.preview?.split(Ve)??[],ki=(e,t)=>e.kind===t.kind&&e.viewport===t.viewport,It=(e,t,r)=>{const i=t.find(o=>r.includes(o.id));if(i)return i;const n=r.flatMap(o=>I(e,o)?.preview??[]);return t.find(o=>n.some(s=>ki(o,s)))??t[0]},At=(e,t,r,i)=>{const n=t.screen.previews,o=r===void 0?It(e,n,Tt(i)):n.find(a=>a.id===r);if(!o)return;const s=r===void 0&&n.length>1;return{kind:"screen",screen:t,preview:o,pinned:r!==void 0,tabs:s?n:[]}},Pt=e=>({layout:e.length>1?"side-by-side":"single",panes:e,shown:e.map(t=>t.preview)}),_t=(e,t,r)=>t.panes.flatMap(i=>{if(!K(i))return[{kind:"material",preview:i.material}];const n=C(e,i.screen),o=n&&At(e,n,i.preview,r);return o?[o]:[]}),Ye=(e,t,r)=>{if(t.kind==="screen"){const i=At(e,t,void 0,r);return Pt(i?[i]:[])}return Pt(_t(e,t.step,r))},xi=(e,t)=>e.panes.flatMap(r=>r.kind!=="screen"||r.tabs.length===0?[]:[r.tabs.some(i=>i.id===t)?t:r.preview.id]).join(Ve),$i=(e,t)=>[...X(t),...he(e,t).flatMap(r=>r.screen.previews)],Ei=["activity","story","step","screen","preview"],Si=(e,t,r)=>{switch(t){case"activity":return L(e,r)!==void 0;case"story":return $(e,r)!==void 0||e.activities.some(i=>i.stories.some(n=>n.id===r));case"step":return k(e,r)!==void 0||W(e).some(i=>i.step.id===r);case"screen":return C(e,r)!==void 0;case"preview":return I(e,r)!==void 0;default:return!1}},Ti=(e,t)=>{let r;if(t.navigate!==null)r=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const o=t.href?.trim()??"";if(o===""||o==="#"||o.toLowerCase().startsWith("javascript:"))return"no-destination";if(!o.startsWith("#"))return null;r=o}const i=Ae(r),n=Ei.filter(o=>i[o]!==void 0);return n.length===0?t.navigate===null?null:"unknown-target":n.every(o=>Si(e,o,i[o]??""))?null:"unknown-target"},Ii=(e,t)=>{const r=t.mail??{},i=[{label:e.mailFrom,value:r.from},{label:e.mailTo,value:r.to},{label:e.mailCc,value:r.cc},{label:e.mailDate,value:r.date}].flatMap(s=>s.value===void 0||s.value.trim()===""?[]:[{label:s.label,value:s.value}]),n=r.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||r.from?.trim(),o=n?Array.from(n)[0]?.toUpperCase():void 0;return{...r.subject===void 0||r.subject.trim()===""?{}:{subject:r.subject},...n?{sender:n}:{},...o===void 0?{}:{initial:o},rows:i}},Rt=(e,t)=>{const r=[];for(const i of t.activities){r.push({value:Y({type:"activity",id:i.id}),label:i.name,group:e.activityGroup});for(const n of i.stories){r.push({value:Y({type:"story",id:M(i.id,n.id)}),label:`${i.name} \u203A ${n.name}`,group:e.storyGroup});for(const o of n.steps)r.push({value:Y({type:"step",id:fe(i,n,o)}),label:`${n.name} \u203A ${o.name}`,group:e.stepGroup})}}for(const{app:i,screen:n}of U(t))r.push({value:Y({type:"screen",id:n.id}),label:`${i.name} \u203A ${n.title}`,group:e.screenGroup});return r},Ai=(e,t,r)=>{const i=J(t,r);if(i?.kind==="screen"){const{screen:n}=i;return{value:Y({type:"screen",id:n.id}),label:n.title,group:e.screenGroup}}return i?.kind!=="step"?null:{value:Y({type:"step",id:ve(i)}),label:i.step.name,group:e.stepGroup}},J=(e,t)=>{if(oe(t)==="app"){const o=C(e,t.screen);return o?{kind:"screen",...o}:void 0}const r=k(e,t.step);if(r)return{kind:"step",...r};const i=L(e,t.activity),n=i?.stories.find(o=>o.id===t.story||M(i.id,o.id)===t.story);return i&&n?{kind:"story",activity:i,story:n}:void 0},Dt=(e,t)=>{const r=(p,l)=>l===void 0?{title:p}:{actor:l,title:p};if(t.kind==="screen")return r(t.screen.title,t.app.actor);const{activity:i,story:n,step:o}=t,s=he(e,o),a=s.length===1?s[0]:void 0;return r(a?.screen.title??o.name,o.actor??n.actor??i.actor??a?.app.actor)},Pi=(e,t)=>{const r=t.actor??e.actor;return r===void 0?{title:t.name}:{actor:r,title:t.name}},Ue=e=>e.title??"UX Prototype",Ot=(e,t)=>(t?e.preview=t:delete e.preview,e),_i=(e,t,r)=>{if(!t)return;const i=_t(e,t,r).flatMap(n=>n.kind==="screen"&&!n.pinned?[n.preview.id]:[]);return i.length===0?void 0:i.join(Ve)},Ct=(e,t)=>{const r=()=>{if(t.step===void 0&&t.story===void 0)return;const o=Lt(e,{...t,[G]:""}),s=k(e,o.step);return s&&he(e,s.step)[0]},i=C(e,t.screen)??r()??U(e)[0],n={...t,[G]:"app"};for(const o of["activity","story","step"])delete n[o];return i?n.screen=i.screen.id:delete n.screen,Ot(n,i&&It(e,i.screen.previews,Tt(t))?.id)},Ri=(e,t,r)=>{const i=s=>ui(s.step,t);if(r&&i(r))return r;const n=r?.story.steps??[],o=s=>{const a=n[s];return r&&a?{...r,step:a,stepIndex:s}:void 0};for(let s=(r?.stepIndex??0)+1;s<n.length;s+=1){const a=o(s);if(a&&i(a))return a}for(let s=(r?.stepIndex??0)-1;s>=0;s-=1){const a=o(s);if(a&&i(a))return a}return W(e).find(i)},Lt=(e,t)=>{const r=L(e,t.activity),i=t.story,n=r?.stories.find(z=>z.id===i||M(r.id,z.id)===i),o=n&&r?{activity:r,story:n}:$(e,i),s=t.step,p=(o&&s?k(e,`${M(o.activity.id,o.story.id)}.${s}`):void 0)??k(e,s),l=t.screen,b=l===void 0?void 0:Ri(e,l,p);if(l!==void 0&&!b&&C(e,l))return Ct(e,{...t,[G]:"app"});const h=b??p,v=h?.activity??o?.activity??r??e.activities[0],A=h?.story??(o&&o.activity===v?o.story:void 0)??v?.stories[0],R=h?.step??A?.steps[0],S={...t};return delete S.screen,v?S.activity=v.id:delete S.activity,A&&v?S.story=$(e,A.id)?A.id:M(v.id,A.id):delete S.story,R&&A&&v?S.step=k(e,R.id)?R.id:fe(v,A,R):delete S.step,delete S[G],Ot(S,_i(e,R,t))},Di=["activity","story","step","screen"],ke=(e,t)=>oe(t)==="app"?Ct(e,t):Lt(e,t),Oi=(e,t)=>{const r=t.screen.previews.find(o=>o.kind==="browser");if(!r)return;let i;try{i=new URL(ye(e,r),"https://page.example.com")}catch{return}const n=i.pathname.split("/").filter(o=>o!=="").map(o=>{try{return decodeURIComponent(o)}catch{return o}});return{origin:i.origin,segments:n}},Mt=()=>({screens:[],children:new Map}),We=(e,t,r)=>{const[i,...n]=e.children.entries();if(e.screens.length===0&&i&&n.length===0&&r!=="/"){const[o,s]=i;return We(s,`${t}/${o}`,`${r}/${o}`)}return{segment:t,path:r,screens:e.screens,children:[...e.children.entries()].map(([o,s])=>We(s,`/${o}`,`${r==="/"?"":r}/${o}`))}},Ci=e=>{const t=new Map;for(const[r,i]of e){const n=t.get(i.origin)??Mt();t.set(i.origin,n);let o=n;for(const s of i.segments){const a=o.children.get(s)??Mt();o.children.set(s,a),o=a}o.screens.push(r)}return[...t.entries()].map(([r,i])=>({origin:r,root:We(i,"/","/")}))},Li=(e,t)=>{const r=t.screens.map(o=>({app:t,screen:o})),i=[],n=[];for(const o of r){const s=Oi(e,o);s?i.push([o,s]):n.push(o)}return{app:t,screens:r,trees:Ci(i),others:n}},Nt=e=>e.apps.map(t=>Li(e,t)).filter(t=>t.screens.length>0),zt=(e,t)=>t?.kind!=="screen"?e[0]:e.find(r=>r.app.id===t.app.id)??e[0],Mi=(e,t)=>{switch(t.type){case"activity":return L(e,t.id)!==void 0;case"story":return $(e,t.id)!==void 0;case"step":return k(e,t.id)!==void 0;case"screen":return C(e,t.id)!==void 0;case"preview":return I(e,t.id)!==void 0;case"page":return!0;case re:{const r=Oe(t.id);return r!==void 0&&I(e,r.previewId)!==void 0}default:return!1}},Vt=e=>{const t=be(e);return{name:"prototype",label:"UX Prototype",parseBase:ut,emptyBase:ht,actions:g,apply:gt,hasTarget:Mi,canonicalTarget:(r,i)=>{if(i.type==="step"){const n=k(r,i.id);return n?{...i,id:ve(n)}:i}if(i.type==="story"){const n=$(r,i.id);return n?{...i,id:M(n.activity.id,n.story.id)}:i}if(i.type==="preview"){const n=I(r,i.id);return n?{...i,id:n.preview.id}:i}return i},describe:(r,i,n)=>yt(t,r,i,n),serialize:kt,resolveNavigation:ke,navigationHierarchy:Di,commentTargets:(r,i)=>Rt(t,r),currentTarget:(r,i)=>Ai(t,r,i),title:Ue}},xe="data-dpk-modal",Ni=e=>{try{return e.matches(":modal")}catch{return!1}},Yt=e=>{e.setAttribute(xe,""),e.open||e.show()},Ut=e=>{Object.hasOwn(e,"showModal")||Object.defineProperty(e,"showModal",{configurable:!0,value:()=>Yt(e)})},Wt=(e,t)=>{if(!Ni(t))return;const r=i=>{i.target===t&&(i.stopImmediatePropagation(),e.removeEventListener("close",r,!0))};e.addEventListener("close",r,!0),t.close(),Yt(t)},zi='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',Bt=/^-?[A-Za-z_][\w-]*$/,Ht=40,Vi=(e,t)=>{const r=e.closest(zi);return r!==null&&r!==t&&t.contains(r)?r:e},$e=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const r=Array.from(t);return r.length>Ht?`${r.slice(0,Ht).join("")}\u2026`:t},Yi=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return $e(t);const r=e.tagName.toLowerCase();return $e(r==="input"||r==="textarea"||r==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":r==="img"?e.getAttribute("alt")??"":e.textContent??"")},Ui=e=>{const t=e.getAttribute("id");if(t&&Bt.test(t))return`#${t}`;const r=e.tagName.toLowerCase(),i=Array.from(e.classList).filter(a=>Bt.test(a)).slice(0,2).map(a=>`.${a}`).join(""),n=e.parentElement,o=n?Array.from(n.children).filter(a=>a.tagName===e.tagName):[],s=o.length>1?`:nth-of-type(${o.indexOf(e)+1})`:"";return`${r}${i}${s}`},Wi=(e,t,r)=>{try{const i=e.querySelectorAll(t);return i.length===1&&i[0]===r}catch{return!1}},Bi=(e,t)=>{const r=[];let i=e;for(;i!==null&&i!==t;){const o=Ui(i);if(r.unshift(o),o.startsWith("#")||Wi(t,r.join(" > "),e))break;i=i.parentElement}const n=Yi(e);return{selector:r.length===0?":scope":r.join(" > "),tag:e.tagName.toLowerCase(),...n===void 0?{}:{text:n}}},Hi=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},Gi=["screen","preview"],ae=e=>JSON.stringify(Gi.map(t=>e[t]??null)),Gt=(e,t)=>e?.kind==="page"&&ae(e.page)===t,Ee=e=>`tab-${e}`,Fi=e=>({tabs:[{id:Ee(1),history:[{kind:"page",page:e}],index:0}],activeId:Ee(1),seen:ae(e),nextId:2}),qi={id:"",history:[],index:0},Z=e=>e.tabs.find(t=>t.id===e.activeId)??e.tabs[0]??qi,de=e=>{const t=Z(e);return t.history[t.index]},ji=e=>Z(e).index>0,Ki=e=>{const t=Z(e);return t.index<t.history.length-1},Ft=(e,t)=>({...e,tabs:e.tabs.map(r=>r.id===e.activeId?t(r):r)}),Be=(e,t)=>Ft(e,r=>({...r,history:[...r.history.slice(0,r.index+1),t],index:r.index+1})),Se=e=>{const t=de(e);return t?.kind==="page"?{...e,seen:ae(t.page)}:e},qt=(e,t)=>{const r=Z(e),i=r.index+t;return i<0||i>=r.history.length?e:Se(Ft(e,n=>({...n,index:i})))},jt=(e,t,r)=>{const i=Ee(e.nextId),n=e.tabs.findIndex(o=>o.id===e.activeId)+1;return Se({...e,tabs:[...e.tabs.slice(0,n),{id:i,history:[t],index:0},...e.tabs.slice(n)],activeId:r?e.activeId:i,nextId:e.nextId+1})},Xi=(e,t)=>{const r=e.tabs.findIndex(o=>o.id===t);if(r<0)return e;if(e.tabs.length===1){const o=Ee(e.nextId);return{...e,tabs:[{id:o,history:[{kind:"new-tab"}],index:0}],activeId:o,nextId:e.nextId+1}}const i=e.tabs.filter(o=>o.id!==t);if(t!==e.activeId)return{...e,tabs:i};const n=i[r]??i[r-1];return Se({...e,tabs:i,activeId:n?.id??e.activeId})},Ji=(e,t)=>{const r=t===null?null:ae(t);if(r===e.seen)return e;const i={...e,seen:r};return t===null||r===null||Gt(de(e),r)?i:Be(i,{kind:"page",page:t})},Zi=(e,t)=>{const r=ae(t);return Gt(de(e),r)?e.seen===r?e:{...e,seen:r}:Be({...e,seen:r},{kind:"page",page:t})},Kt=(e,t)=>{switch(t.kind){case"observe":return Ji(e,t.page);case"visit":return Zi(e,t.page);case"back":return qt(e,-1);case"forward":return qt(e,1);case"open-tab":return jt(e,t.entry,t.background);case"new-tab":return jt(e,{kind:"new-tab"},!1);case"unreachable":return Be(e,{kind:"unreachable",url:t.url});case"activate":return e.tabs.some(r=>r.id===t.id)&&t.id!==e.activeId?Se({...e,activeId:t.id}):e;case"close-tab":return Xi(e,t.id);default:return e}},Xt=(e,t)=>{const r=ke(e,t),i=J(e,r);if(i?.kind!=="screen")return null;const[n]=Ye(e,i,r).shown;return n?.kind!=="browser"?null:{screen:i.screen.id,preview:n.id}},Te=(e,t)=>{const r=J(e,ke(e,{[G]:"app",...t}));return r?.kind==="screen"?r:void 0},Jt=(e,t)=>{const r=e.trim();if(r==="")return null;try{return r.startsWith("/")?new URL(r,t):new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(r)?r:`https://${r}`)}catch{return null}},Zt=e=>`${e.origin}${e.pathname.replace(/\/+$/,"")}`,Qi=(e,t,r)=>{const i=Jt(t,r);if(i===null)return null;const n=Zt(i);for(const{screen:o}of U(e))for(const s of o.previews){if(s.kind!=="browser")continue;const a=Jt(ye(e,s),r);if(a!==null&&Zt(a)===n)return{screen:o.id,preview:s.id}}return null},Qt=e=>{try{return new URL(e).host||e}catch{return e}},en=(e,t,r)=>t===void 0||t.kind==="new-tab"?r.newTab:t.kind==="unreachable"?Qt(t.url):Te(e,t.page)?.screen.title??r.newTab,er=(e,t)=>{if(t===void 0||t.kind==="new-tab")return"";if(t.kind==="unreachable")return t.url;const r=Te(e,t.page)?.screen.previews.find(i=>i.id===t.page.preview);return r===void 0?"":ye(e,r)},tr=e=>{const t=Z(e);for(let r=t.index;r>=0;r-=1){const i=t.history[r];if(i?.kind==="page")return i.page}for(const r of e.tabs){const i=r.history[r.index];if(i?.kind==="page")return i.page}},tn=(e,t)=>t===void 0?void 0:Te(e,t)?.app.actor,rr=(e,t,r,i=null)=>{const n=Z(t),o=n.history[n.index],s=tn(e,tr(t)??i??void 0);return{tabs:t.tabs.map(a=>({id:a.id,title:en(e,a.history[a.index],r),url:er(e,a.history[a.index]),active:a.id===n.id})),entry:o,url:er(e,o),canBack:ji(t),canForward:Ki(t),...s===void 0?{}:{profile:s}}},rn=e=>tr(e)??null,nn=(e,t)=>{const r=t===null?void 0:Te(e,t),i=zt(Nt(e),r),n=[],o=(s,a)=>{for(const{screen:p}of a.screens){const l=p.previews.find(b=>b.kind==="browser");l!==void 0&&n.push({title:p.title,url:`${s}${a.path==="/"?"":a.path}`,page:{screen:p.id,preview:l.id}})}for(const p of a.children)o(s,p)};for(const s of i?.trees??[])o(Qt(s.origin),s.root);return n},T=(e,t,r,i)=>({id:t,deviceClass:e,width:r,height:i}),ir=[T("phone","iphone-se",375,667),T("phone","iphone-16",393,852),T("phone","iphone-16-pro-max",440,956),T("phone","pixel-7",412,915),T("phone","galaxy-s24",360,780),T("tablet","ipad-mini",744,1133),T("tablet","ipad-air-11",820,1180),T("tablet","ipad-pro-11",834,1194),T("tablet","ipad-pro-13",1024,1366),T("desktop","laptop-13",1280,800),T("desktop","laptop-15",1440,900),T("desktop","full-hd",1920,1080),T("desktop","monitor-27",2560,1440),T("desktop","ultrawide",3440,1440)],on={phone:T("phone","iphone-16",393,852),tablet:T("tablet","ipad-pro-11",834,1194),desktop:T("desktop","laptop-13",1280,800)},nr=e=>e==="mobile"?"phone":e==="tablet"?"tablet":"desktop",sn=e=>e!=="plain",or=e=>ir.filter(t=>t.deviceClass===e),an=(e,t)=>{const r=nr(e),i=t[r];return or(r).find(n=>n.id===i)??on[r]},dn=(e,t)=>{const r=ir.find(i=>i.id===t);return r===void 0||e[r.deviceClass]===t?e:{...e,[r.deviceClass]:t}},pn=(e,t)=>`${e.deviceName(t.id)} \xB7 ${t.width}\xD7${t.height}`,ln=(e,t)=>{const r=[1,t.width/e.width];t.height!==void 0&&r.push(t.height/e.height);const i=Math.min(...r);return!Number.isFinite(i)||i<=0?1:Math.max(.1,Math.floor(i*100)/100)},sr=(e,t)=>{const{state:r,navigation:i}=e,n=J(r,i),o=oe(i);return d`
1
+ import{ai as x,aK as Er,ad as D,az as _,aA as g,ag as u,ae as N,ah as le,ac as Sr,aL as Ze,aM as Tr,af as V,aj as E,ar as Ar,p as w,at as m,v as ce,ay as te,P as Ir,e as Pr,a0 as _r,h as Qe,N as Ie,V as Y,U as Rr,R as y,a4 as d,a3 as c,aN as Pe,aO as _e,aE as Re,a5 as Dr,z as ue,aD as et,l as Or,aP as O,aQ as Cr,aR as Lr,J as tt,aS as Mr,A as rt,ab as Nr,aa as zr,a2 as Vr,T as it,a1 as Yr,aT as Ur,C as Wr}from"./shared-CSC14I4g.js";import{p as Br,r as Hr,c as Gr}from"./shared-CirHYajF.js";import{P as Fr,c as jr}from"./shared-aDPp8Vry.js";import{i as nt}from"./shared-DjmQsa0n.js";const qr=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]],Kr=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]],Xr=[["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"}]],Jr=[["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"}]],Zr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]],Qr=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]],ei=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18"}]],ti=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]],ot=["browser","native","mail","plain"],st=["mobile","tablet","desktop","fluid"],K=e=>"screen"in e,ri=D({from:g(u()),to:g(u()),cc:g(u()),subject:g(u()),date:g(u())}),ii={id:_,kind:N(le(ot),"browser"),viewport:N(le(st),"fluid"),label:g(u()),url:g(u()),mail:g(ri)},De=x(D(ii),Er(e=>e.mail===void 0||e.kind==="mail",'a preview `mail` envelope needs `"kind": "mail"`')),at=Ar([D({screen:_,preview:g(_)}),D({material:De})]),ni=D({id:_,name:x(u(),E(1)),description:g(u()),actor:g(x(u(),E(1))),situation:g(x(u(),E(1))),panes:N(V(at),[])}),oi=D({id:_,name:x(u(),E(1)),description:g(u()),actor:g(x(u(),E(1))),steps:N(V(ni),[])}),si=D({id:_,name:x(u(),E(1)),description:g(u()),actor:g(x(u(),E(1))),stories:N(V(oi),[])}),ai=D({id:_,title:x(u(),E(1)),description:g(u()),previews:N(V(De),[])}),di=D({id:_,name:x(u(),E(1)),description:g(u()),actor:g(x(u(),E(1))),screens:N(V(ai),[])}),dt=D({title:g(u()),baseUrl:g(u()),apps:N(V(di),[]),activities:N(V(si),[])}),pt=e=>e.flatMap(t=>K(t)?[]:[t.material]),pi=e=>{const t=new Set,r=s=>{for(const a of s){if(t.has(a.id))return`duplicate preview id "${a.id}": preview ids are global, they name a light DOM slot`;t.add(a.id)}return null},i=new Set,n=new Set;for(const s of e.apps){if(i.has(s.id))return`duplicate app id "${s.id}"`;i.add(s.id);for(const a of s.screens){if(n.has(a.id))return`duplicate screen id "${a.id}": screen ids are global`;n.add(a.id);const p=r(a.previews);if(p!==null)return p}}const o=new Set;for(const s of e.activities){if(o.has(s.id))return`duplicate activity id "${s.id}"`;o.add(s.id);const a=new Set;for(const p of s.stories){if(a.has(p.id))return`duplicate story id "${p.id}" in activity "${s.id}"`;a.add(p.id);const l=new Set;for(const b of p.steps){if(l.has(b.id))return`duplicate step id "${b.id}" in story "${p.id}"`;l.add(b.id);const h=r(pt(b.panes));if(h!==null)return h}}}return null},lt=(e,t)=>{const r=new Map;for(const i of t.panes){if(!K(i))continue;const n=e(i.screen);if(n===void 0)return`unknown screen "${i.screen}" on step "${t.id}": declare it under \`apps[].screens\``;if(i.preview!==void 0&&!n.includes(i.preview))return`preview "${i.preview}" on step "${t.id}" is not a rendition of screen "${i.screen}"`;const o=r.get(i.screen)??[];if(o.length>0&&(i.preview===void 0||o.includes(i.preview)||o.includes(void 0)))return`screen "${i.screen}" is shown twice on step "${t.id}": give each pane a different \`preview\``;r.set(i.screen,[...o,i.preview])}return null},li=e=>{const t=new Map(e.apps.flatMap(r=>r.screens.map(i=>[i.id,i.previews.map(n=>n.id)])));for(const r of e.activities.flatMap(i=>i.stories.flatMap(n=>n.steps))){const i=lt(n=>t.get(n),r);if(i!==null)return i}return null},ci=(e,t)=>lt(r=>C(e,r)?.screen.previews.map(i=>i.id),t),re="ui",ct=e=>{const t=e.text?.replaceAll('"',"'");return`${e.previewId}/${e.selector}${t===void 0?"":` "${t}"`}`},Oe=e=>{const t=e.indexOf("/");if(t<=0)return;const r=e.slice(0,t);if(!Tr(_,r))return;const i=e.slice(t+1),n=/ "([^"]*)"$/.exec(i),o=(n?i.slice(0,n.index):i).trim();if(o!=="")return n?.[1]===void 0?{previewId:r,selector:o}:{previewId:r,selector:o,text:n[1]}},ut=e=>{const t=Sr(dt,e),r=pi(t)??li(t);if(r!==null)throw new Error(r);return t},ht=()=>({apps:[],activities:[]}),U=e=>e.apps.flatMap(t=>t.screens.map(r=>({app:t,screen:r}))),C=(e,t)=>{if(t!==void 0)return U(e).find(r=>r.screen.id===t)},he=(e,t)=>t.panes.flatMap(r=>{const i=K(r)?C(e,r.screen):void 0;return i?[i]:[]}),X=e=>pt(e.panes),ui=(e,t)=>e.panes.some(r=>K(r)&&r.screen===t),L=(e,t)=>{if(t!==void 0)return e.activities.find(r=>r.id===t)},M=(e,t)=>`${e}.${t}`,$=(e,t)=>{if(t===void 0)return;const r=Ze(t,2);if(r){const[n,o]=r;if(n===void 0||o===void 0)return;const s=e.activities.find(p=>p.id===n),a=s?.stories.find(p=>p.id===o);return s&&a?{activity:s,story:a}:void 0}if(t.includes("."))return;const i=e.activities.flatMap(n=>n.stories.filter(o=>o.id===t).map(o=>({activity:n,story:o})));return i.length===1?i[0]:void 0},vt=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1):e},ve=e=>`${e.activity.id}.${e.story.id}.${e.step.id}`,ge=(e,t,r)=>`${e.id}.${t.id}.${r.id}`,k=(e,t)=>{if(t===void 0)return;const r=Ze(t,3);if(r){const[n,o,s]=r;if(n===void 0||o===void 0||s===void 0)return;const a=e.activities.find(h=>h.id===n),p=a?.stories.find(h=>h.id===o),l=p?p.steps.findIndex(h=>h.id===s):-1,b=p&&l>=0?p.steps[l]:void 0;return a&&p&&b?{activity:a,story:p,step:b,stepIndex:l}:void 0}if(t.includes("."))return;const i=W(e).filter(n=>n.step.id===t);return i.length===1?i[0]:void 0},A=(e,t)=>{if(t!==void 0){for(const r of U(e)){const i=r.screen.previews.find(n=>n.id===t);if(i)return{owner:{kind:"screen",...r},preview:i}}for(const r of W(e)){const i=X(r.step).find(n=>n.id===t);if(i)return{owner:{kind:"step",...r},preview:i}}}},W=e=>e.activities.flatMap(t=>t.stories.flatMap(r=>r.steps.map((i,n)=>({activity:t,story:r,step:i,stepIndex:n})))),gt=e=>W(e).map(t=>t.step.id),f={SET_ACTIVITY_NAME:w("SET_ACTIVITY_NAME","activity",m({name:x(u(),E(1))})),SET_ACTIVITY_DESCRIPTION:w("SET_ACTIVITY_DESCRIPTION","activity",m({description:u()})),SET_STORY_NAME:w("SET_STORY_NAME","story",m({name:x(u(),E(1))})),SET_STORY_DESCRIPTION:w("SET_STORY_DESCRIPTION","story",m({description:u()})),SET_STEP_NAME:w("SET_STEP_NAME","step",m({name:x(u(),E(1))})),SET_STEP_DESCRIPTION:w("SET_STEP_DESCRIPTION","step",m({description:u()})),SET_PREVIEW_KIND:w("SET_PREVIEW_KIND","preview",m({kind:le(ot)})),SET_PREVIEW_VIEWPORT:w("SET_PREVIEW_VIEWPORT","preview",m({viewport:le(st)})),SET_PREVIEW_LABEL:w("SET_PREVIEW_LABEL","preview",m({label:u()})),REORDER_ACTIVITY:w("REORDER_ACTIVITY","activity",m({after:te(u())}),{mode:"sequence"}),REORDER_STORY:w("REORDER_STORY","story",m({after:te(u())}),{mode:"sequence"}),REORDER_STEP:w("REORDER_STEP","step",m({after:te(u())}),{mode:"sequence"}),MOVE_STORY:w("MOVE_STORY","story",m({toActivity:x(u(),E(1)),after:te(u())}),{mode:"sequence"}),MOVE_STEP:w("MOVE_STEP","step",m({toStory:x(u(),E(1)),after:te(u())}),{mode:"sequence"}),ADD_ACTIVITY:w("ADD_ACTIVITY","page",m({id:_,name:x(u(),E(1)),description:g(u())}),{dedupeKey:ce}),ADD_STORY:w("ADD_STORY","activity",m({id:_,name:x(u(),E(1)),description:g(u())}),{dedupeKey:ce}),ADD_STEP:w("ADD_STEP","story",m({id:_,name:x(u(),E(1)),description:g(u()),panes:g(V(at))}),{dedupeKey:ce}),ADD_PREVIEW:w("ADD_PREVIEW","step",De,{dedupeKey:ce}),DELETE_ACTIVITY:w("DELETE_ACTIVITY","activity",m({})),DELETE_STORY:w("DELETE_STORY","story",m({})),DELETE_STEP:w("DELETE_STEP","step",m({})),DELETE_PREVIEW:w("DELETE_PREVIEW","preview",m({}))},ie={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,r)=>({type:"MOVE_STEP",target:{type:"step",id:e},payload:{toStory:t,after:r}}),moveStory:(e,t,r)=>({type:"MOVE_STORY",target:{type:"story",id:e},payload:{toActivity:t,after:r}}),addActivity:(e,t,r)=>({type:"ADD_ACTIVITY",target:{type:"page",id:"prototype"},payload:{id:e,name:t,...r===void 0?{}:{description:r}}}),addStory:(e,t,r,i)=>({type:"ADD_STORY",target:{type:"activity",id:e},payload:{id:t,name:r,...i===void 0?{}:{description:i}}}),addStep:(e,t,r,i)=>({type:"ADD_STEP",target:{type:"story",id:e},payload:{id:t,name:r,...i===void 0?{}:{panes:i}}}),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:{}})},ft=(e,t)=>{const r=Ir(f,t);if(r===null)return null;const i=r.target.id;switch(r.type){case"SET_ACTIVITY_NAME":return B(e,i,n=>({...n,name:r.payload.name}));case"SET_ACTIVITY_DESCRIPTION":return B(e,i,n=>({...n,description:r.payload.description}));case"SET_STORY_NAME":return H(e,i,n=>({...n,name:r.payload.name}));case"SET_STORY_DESCRIPTION":return H(e,i,n=>({...n,description:r.payload.description}));case"SET_STEP_NAME":return fe(e,i,n=>({...n,name:r.payload.name}));case"SET_STEP_DESCRIPTION":return fe(e,i,n=>({...n,description:r.payload.description}));case"SET_PREVIEW_KIND":return Le(e,i,n=>({...n,kind:r.payload.kind}));case"SET_PREVIEW_VIEWPORT":return Le(e,i,n=>({...n,viewport:r.payload.viewport}));case"SET_PREVIEW_LABEL":return Le(e,i,n=>({...n,label:r.payload.label}));case"REORDER_ACTIVITY":{const{after:n}=r.payload,o=ne(e.activities,i,n);return o===null?null:{...e,activities:o}}case"REORDER_STORY":{const{after:n}=r.payload,o=$(e,i);if(!o)return null;const s=n===null?null:$(e,n);if(n!==null&&(!s||s.activity!==o.activity))return null;const a=ne(o.activity.stories,o.story.id,s?.story.id??null);return a===null?null:B(e,o.activity.id,p=>({...p,stories:a}))}case"REORDER_STEP":{const{after:n}=r.payload,o=k(e,i);if(!o)return null;const s=n===null?null:k(e,n);if(n!==null&&(!s||s.story!==o.story))return null;const a=ne(o.story.steps,o.step.id,s?.step.id??null);return a===null?null:H(e,M(o.activity.id,o.story.id),p=>({...p,steps:a}))}case"MOVE_STORY":{const{toActivity:n,after:o}=r.payload,s=$(e,i);if(!s)return null;const a=e.activities.find(h=>h.id===n);if(!a)return null;const p=o===null?null:$(e,o);if(o!==null&&(!p||p.activity!==a))return null;const l=p?.story.id??null;if(s.activity.id===n){const h=ne(s.activity.stories,s.story.id,l);return h===null?null:B(e,n,v=>({...v,stories:h}))}if(a.stories.some(h=>h.id===s.story.id))return null;const b=Me(a.stories,s.story,l);return Ce(e,h=>h.id===s.activity.id?{...h,stories:h.stories.filter(v=>v.id!==vt(i))}:h.id===n?{...h,stories:b}:h)}case"MOVE_STEP":{const{toStory:n,after:o}=r.payload,s=k(e,i);if(!s)return null;const a=$(e,n);if(!a)return null;const p=o===null?null:k(e,o);if(o!==null&&(!p||p.story!==a.story))return null;const l=p?.step.id??null;if(s.story===a.story){const h=ne(s.story.steps,s.step.id,l);return h===null?null:H(e,n,v=>({...v,steps:h}))}if(a.story.steps.some(h=>h.id===s.step.id))return null;const b=Me(a.story.steps,s.step,l);return Ce(e,h=>({...h,stories:h.stories.map(v=>v===s.story?{...v,steps:v.steps.filter(I=>I.id!==vt(i))}:v===a.story?{...v,steps:b}:v)}))}case"ADD_ACTIVITY":{const n=r.payload;if(e.activities.some(s=>s.id===n.id))return e;const o={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},stories:[]};return{...e,activities:[...e.activities,o]}}case"ADD_STORY":{const n=r.payload,o=e.activities.find(a=>a.id===i);if(!o)return null;if(o.stories.some(a=>a.id===n.id))return e;const s={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},steps:[]};return B(e,i,a=>({...a,stories:[...a.stories,s]}))}case"ADD_STEP":{const n=r.payload,o=$(e,i)?.story;if(!o)return null;if(o.steps.some(p=>p.id===n.id))return e;const s=n.panes??[],a={id:n.id,name:n.name,...n.description===void 0?{}:{description:n.description},panes:s};return hi(e,a)?H(e,i,p=>({...p,steps:[...p.steps,a]})):null}case"ADD_PREVIEW":{const n=r.payload,o=k(e,i)?.step;return o?X(o).some(s=>s.id===n.id)?e:A(e,n.id)?null:fe(e,i,s=>({...s,panes:[...s.panes,{material:n}]})):null}case"DELETE_ACTIVITY":{const n=i;return e.activities.some(o=>o.id===n)?{...e,activities:e.activities.filter(o=>o.id!==n)}:null}case"DELETE_STORY":{const n=$(e,i);return n?B(e,n.activity.id,o=>({...o,stories:o.stories.filter(s=>s.id!==n.story.id)})):null}case"DELETE_STEP":{const n=k(e,i);return n?H(e,M(n.activity.id,n.story.id),o=>({...o,steps:o.steps.filter(s=>s.id!==n.step.id)})):null}case"DELETE_PREVIEW":{const n=A(e,i);return n?bt(e,n.owner,o=>o.filter(s=>s.id!==n.preview.id)):null}default:return Pr(r)}},Ce=(e,t)=>({...e,activities:e.activities.map(t)}),B=(e,t,r)=>{const i=t;return e.activities.some(n=>n.id===i)?Ce(e,n=>n.id===i?r(n):n):null},H=(e,t,r)=>{const i=$(e,t);if(!i)return null;const n=i.story.id;return B(e,i.activity.id,o=>({...o,stories:o.stories.map(s=>s.id===n?r(s):s)}))},fe=(e,t,r)=>{const i=k(e,t);if(!i)return null;const n=i.step.id;return H(e,M(i.activity.id,i.story.id),o=>({...o,steps:o.steps.map(s=>s.id===n?r(s):s)}))},Le=(e,t,r)=>{const i=A(e,t);if(!i)return null;const n=i.preview.id;return bt(e,i.owner,o=>o.map(s=>s.id===n?r(s):s))},hi=(e,t)=>{const r=X(t).map(i=>i.id);return ci(e,t)===null&&new Set(r).size===r.length&&!r.some(i=>A(e,i))},bt=(e,t,r)=>{if(t.kind==="step")return fe(e,ve(t),n=>{const o=new Map(r([...X(n)]).map(s=>[s.id,s]));return{...n,panes:n.panes.flatMap(s=>{if(K(s))return[s];const a=o.get(s.material.id);return a?[{material:a}]:[]})}});const i=t.screen.id;return{...e,apps:e.apps.map(n=>n.id===t.app.id?{...n,screens:n.screens.map(o=>o.id===i?{...o,previews:r(o.previews)}:o)}:n)}},ne=(e,t,r)=>{const i=e.findIndex(s=>s.id===t);if(i<0||r!==null&&!e.some(s=>s.id===r))return null;if(t===r)return[...e];const n=e[i];if(n===void 0)return null;const o=e.filter(s=>s.id!==t);return Me(o,n,r)},Me=(e,t,r)=>{const i=[...e],n=r===null?-1:i.findIndex(o=>o.id===r);return i.splice(n+1,0,t),i},wt={"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"'},vi={"laptop-13":'13" laptop',"laptop-15":'15" laptop',"full-hd":"Full HD","monitor-27":'27" monitor',ultrawide:"Ultrawide"},gi={"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"},be=_r({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}`,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=>wt[e]??vi[e]??e,deviceZoom:e=>`Shown at ${e}% to fit`},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}`,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=>wt[e]??gi[e]??e,deviceZoom:e=>`\u53CE\u307E\u308B\u3088\u3046 ${e}% \u3067\u8868\u793A`}}),fi=["scenario","app"],G="view",oe=e=>e[G]==="app"?"app":"scenario",mt=e=>({[G]:e==="app"?"app":null}),se=(e,t)=>e===void 0?`\u2192 "${t}"`:`"${e}" \u2192 "${t}"`,bi=e=>({SET_ACTIVITY_NAME:(t,r)=>({title:e.renameActivity,tone:"update",body:se(L(r,t.target.id)?.name,y(f.SET_ACTIVITY_NAME,t).name)}),SET_ACTIVITY_DESCRIPTION:(t,r)=>({title:e.updateActivityDescription,tone:"update",body:Ne(L(r,t.target.id)?.description,y(f.SET_ACTIVITY_DESCRIPTION,t).description)}),SET_STORY_NAME:(t,r)=>({title:e.renameStory,tone:"update",body:se($(r,t.target.id)?.story.name,y(f.SET_STORY_NAME,t).name)}),SET_STORY_DESCRIPTION:(t,r)=>({title:e.updateStoryDescription,tone:"update",body:Ne($(r,t.target.id)?.story.description,y(f.SET_STORY_DESCRIPTION,t).description)}),SET_STEP_NAME:(t,r)=>({title:e.renameStep,tone:"update",body:se(k(r,t.target.id)?.step.name,y(f.SET_STEP_NAME,t).name)}),SET_STEP_DESCRIPTION:(t,r)=>({title:e.updateStepDescription,tone:"update",body:Ne(k(r,t.target.id)?.step.description,y(f.SET_STEP_DESCRIPTION,t).description)}),SET_PREVIEW_KIND:(t,r)=>({title:e.changePreviewKind,tone:"update",body:se(A(r,t.target.id)?.preview.kind,y(f.SET_PREVIEW_KIND,t).kind)}),SET_PREVIEW_VIEWPORT:(t,r)=>({title:e.changePreviewViewport,tone:"update",body:se(A(r,t.target.id)?.preview.viewport,y(f.SET_PREVIEW_VIEWPORT,t).viewport)}),SET_PREVIEW_LABEL:t=>({title:e.changePreviewLabel,tone:"update",body:`\u2192 "${y(f.SET_PREVIEW_LABEL,t).label}"`}),REORDER_ACTIVITY:t=>ze(e,e.activityGroup,y(f.REORDER_ACTIVITY,t).after),REORDER_STORY:t=>ze(e,e.storyGroup,y(f.REORDER_STORY,t).after),REORDER_STEP:t=>ze(e,e.stepGroup,y(f.REORDER_STEP,t).after),MOVE_STORY:(t,r)=>({title:e.moveStory,tone:"move",body:`\u2192 ${L(r,y(f.MOVE_STORY,t).toActivity)?.name??y(f.MOVE_STORY,t).toActivity}`}),MOVE_STEP:(t,r)=>({title:e.moveStep,tone:"move",body:`\u2192 ${$(r,y(f.MOVE_STEP,t).toStory)?.story.name??y(f.MOVE_STEP,t).toStory}`}),ADD_ACTIVITY:t=>we(e,e.activityGroup,y(f.ADD_ACTIVITY,t).name),ADD_STORY:t=>we(e,e.storyGroup,y(f.ADD_STORY,t).name),ADD_STEP:t=>we(e,e.stepGroup,y(f.ADD_STEP,t).name),ADD_PREVIEW:t=>we(e,e.previewGroup,y(f.ADD_PREVIEW,t).label??y(f.ADD_PREVIEW,t).id),DELETE_ACTIVITY:(t,r)=>me(e,L(r,t.target.id)?.name),DELETE_STORY:(t,r)=>me(e,$(r,t.target.id)?.story.name),DELETE_STEP:(t,r)=>me(e,k(r,t.target.id)?.step.name),DELETE_PREVIEW:(t,r)=>me(e,A(r,t.target.id)?.preview.label)}),Ne=(e,t)=>{const r=t.length>90?`${t.slice(0,90)}\u2026`:t;return e===void 0||e===""?`\u2192 "${r}"`:`"${wi(e)}" \u2192 "${r}"`},wi=e=>e.length>60?`${e.slice(0,60)}\u2026`:e,ze=(e,t,r)=>({title:e.reorderTitle(t),tone:"move",body:r===null?e.toFront:e.afterName(r)}),we=(e,t,r)=>({title:e.addTitle(t),tone:"create",body:`+ "${r}"`}),me=(e,t)=>({title:e.deleteTitle,tone:"delete",body:t===void 0?e.unknownTarget:`\u2212 "${t}"`}),yt=(e,t,r,i)=>{const n=bi(e),o=Object.hasOwn(n,t.type)?n[t.type]:void 0,s=o?o(t,i??r):{title:t.type,tone:"meta"};return{title:s.title,targetLabel:xt(e,r,t.target),tone:s.tone,...s.body===void 0?{}:{summary:s.body}}},kt=e=>`${e.type} ${Y(e.target)} ${JSON.stringify(e.payload)}`,xt=(e,t,r)=>{switch(r.type){case"activity":{const i=L(t,r.id);return i?e.targetLabel(e.activityGroup,i.name):e.targetMissing(e.activityGroup,r.id)}case"story":{const i=$(t,r.id)?.story;return i?e.targetLabel(e.storyGroup,i.name):e.targetMissing(e.storyGroup,r.id)}case"step":{const i=k(t,r.id)?.step;return i?e.targetLabel(e.stepGroup,i.name):e.targetMissing(e.stepGroup,r.id)}case"screen":{const i=C(t,r.id)?.screen;return i?e.targetLabel(e.screenGroup,i.title):e.targetMissing(e.screenGroup,r.id)}case"preview":{const i=A(t,r.id)?.preview;return i?e.targetLabel(e.previewGroup,i.label??i.id):e.targetMissing(e.previewGroup,r.id)}case"page":return e.targetLabel(e.pageGroup,Ue(t));case re:{const i=Oe(r.id),n=i?A(t,i.previewId)?.preview:void 0;return i&&n?e.targetLabel(e.uiGroup,$t(n,i)):e.targetMissing(e.uiGroup,r.id)}default:return e.targetLabel(r.type,r.id)}},$t=(e,t)=>{const r=t.text===void 0?t.selector:`"${t.text}"`;return`${e.label??e.id} \u203A ${r}`},Et=(e,t)=>{const r=[];for(const i of e){if(i.target.type!==re)continue;const n=Oe(i.target.id);!n||!t.includes(n.previewId)||r.push({id:i.id,previewId:n.previewId,selector:n.selector,number:r.length+1,body:Qe(i)})}return r},St=(e,t)=>Et(e,t).length,mi=/^[a-z][a-z0-9+.-]*:/i,yi=e=>{const t=e.baseUrl?.trim(),r=Rr(e.title??"");return`${(t?t.startsWith("http")?t:`https://${t}`:`https://${r==="item"?"page":r}.example.com`).replace(/\/+$/,"")}/`},ye=(e,t)=>{const r=yi(e);if(!t.url)return`${r}${t.id}`;if(mi.test(t.url))return t.url;try{return decodeURI(new URL(t.url,r).href)}catch{return t.url}},Ve=",",Tt=e=>e.preview?.split(Ve)??[],ki=(e,t)=>e.kind===t.kind&&e.viewport===t.viewport,At=(e,t,r)=>{const i=t.find(o=>r.includes(o.id));if(i)return i;const n=r.flatMap(o=>A(e,o)?.preview??[]);return t.find(o=>n.some(s=>ki(o,s)))??t[0]},It=(e,t,r,i)=>{const n=t.screen.previews,o=r===void 0?At(e,n,Tt(i)):n.find(a=>a.id===r);if(!o)return;const s=r===void 0&&n.length>1;return{kind:"screen",screen:t,preview:o,pinned:r!==void 0,tabs:s?n:[]}},Pt=e=>({layout:e.length>1?"side-by-side":"single",panes:e,shown:e.map(t=>t.preview)}),_t=(e,t,r)=>t.panes.flatMap(i=>{if(!K(i))return[{kind:"material",preview:i.material}];const n=C(e,i.screen),o=n&&It(e,n,i.preview,r);return o?[o]:[]}),Ye=(e,t,r)=>{if(t.kind==="screen"){const i=It(e,t,void 0,r);return Pt(i?[i]:[])}return Pt(_t(e,t.step,r))},xi=(e,t)=>e.panes.flatMap(r=>r.kind!=="screen"||r.tabs.length===0?[]:[r.tabs.some(i=>i.id===t)?t:r.preview.id]).join(Ve),$i=(e,t)=>[...X(t),...he(e,t).flatMap(r=>r.screen.previews)],Ei=["activity","story","step","screen","preview"],Si=(e,t,r)=>{switch(t){case"activity":return L(e,r)!==void 0;case"story":return $(e,r)!==void 0||e.activities.some(i=>i.stories.some(n=>n.id===r));case"step":return k(e,r)!==void 0||W(e).some(i=>i.step.id===r);case"screen":return C(e,r)!==void 0;case"preview":return A(e,r)!==void 0;default:return!1}},Ti=(e,t)=>{let r;if(t.navigate!==null)r=t.navigate.includes("=")?t.navigate:`step=${t.navigate}`;else{const o=t.href?.trim()??"";if(o===""||o==="#"||o.toLowerCase().startsWith("javascript:"))return"no-destination";if(!o.startsWith("#"))return null;r=o}const i=Ie(r),n=Ei.filter(o=>i[o]!==void 0);return n.length===0?t.navigate===null?null:"unknown-target":n.every(o=>Si(e,o,i[o]??""))?null:"unknown-target"},Ai=(e,t)=>{const r=t.mail??{},i=[{label:e.mailFrom,value:r.from},{label:e.mailTo,value:r.to},{label:e.mailCc,value:r.cc},{label:e.mailDate,value:r.date}].flatMap(s=>s.value===void 0||s.value.trim()===""?[]:[{label:s.label,value:s.value}]),n=r.from?.replace(/<[^>]*>/g,"").replace(/["']/g,"").trim()||r.from?.trim(),o=n?Array.from(n)[0]?.toUpperCase():void 0;return{...r.subject===void 0||r.subject.trim()===""?{}:{subject:r.subject},...n?{sender:n}:{},...o===void 0?{}:{initial:o},rows:i}},Rt=(e,t)=>{const r=[];for(const i of t.activities){r.push({value:Y({type:"activity",id:i.id}),label:i.name,group:e.activityGroup});for(const n of i.stories){r.push({value:Y({type:"story",id:M(i.id,n.id)}),label:`${i.name} \u203A ${n.name}`,group:e.storyGroup});for(const o of n.steps)r.push({value:Y({type:"step",id:ge(i,n,o)}),label:`${n.name} \u203A ${o.name}`,group:e.stepGroup})}}for(const{app:i,screen:n}of U(t))r.push({value:Y({type:"screen",id:n.id}),label:`${i.name} \u203A ${n.title}`,group:e.screenGroup});return r},Ii=(e,t,r)=>{const i=J(t,r);if(i?.kind==="screen"){const{screen:n}=i;return{value:Y({type:"screen",id:n.id}),label:n.title,group:e.screenGroup}}return i?.kind!=="step"?null:{value:Y({type:"step",id:ve(i)}),label:i.step.name,group:e.stepGroup}},J=(e,t)=>{if(oe(t)==="app"){const o=C(e,t.screen);return o?{kind:"screen",...o}:void 0}const r=k(e,t.step);if(r)return{kind:"step",...r};const i=L(e,t.activity),n=i?.stories.find(o=>o.id===t.story||M(i.id,o.id)===t.story);return i&&n?{kind:"story",activity:i,story:n}:void 0},Dt=(e,t)=>{const r=(p,l)=>l===void 0?{title:p}:{actor:l,title:p};if(t.kind==="screen")return r(t.screen.title,t.app.actor);const{activity:i,story:n,step:o}=t,s=he(e,o),a=s.length===1?s[0]:void 0;return r(a?.screen.title??o.name,o.actor??n.actor??i.actor??a?.app.actor)},Pi=(e,t)=>{const r=t.actor??e.actor;return r===void 0?{title:t.name}:{actor:r,title:t.name}},Ue=e=>e.title??"UX Prototype",Ot=(e,t)=>(t?e.preview=t:delete e.preview,e),_i=(e,t,r)=>{if(!t)return;const i=_t(e,t,r).flatMap(n=>n.kind==="screen"&&!n.pinned?[n.preview.id]:[]);return i.length===0?void 0:i.join(Ve)},Ct=(e,t)=>{const r=()=>{if(t.step===void 0&&t.story===void 0)return;const o=Lt(e,{...t,[G]:""}),s=k(e,o.step);return s&&he(e,s.step)[0]},i=C(e,t.screen)??r()??U(e)[0],n={...t,[G]:"app"};for(const o of["activity","story","step"])delete n[o];return i?n.screen=i.screen.id:delete n.screen,Ot(n,i&&At(e,i.screen.previews,Tt(t))?.id)},Ri=(e,t,r)=>{const i=s=>ui(s.step,t);if(r&&i(r))return r;const n=r?.story.steps??[],o=s=>{const a=n[s];return r&&a?{...r,step:a,stepIndex:s}:void 0};for(let s=(r?.stepIndex??0)+1;s<n.length;s+=1){const a=o(s);if(a&&i(a))return a}for(let s=(r?.stepIndex??0)-1;s>=0;s-=1){const a=o(s);if(a&&i(a))return a}return W(e).find(i)},Lt=(e,t)=>{const r=L(e,t.activity),i=t.story,n=r?.stories.find(z=>z.id===i||M(r.id,z.id)===i),o=n&&r?{activity:r,story:n}:$(e,i),s=t.step,p=(o&&s?k(e,`${M(o.activity.id,o.story.id)}.${s}`):void 0)??k(e,s),l=t.screen,b=l===void 0?void 0:Ri(e,l,p);if(l!==void 0&&!b&&C(e,l))return Ct(e,{...t,[G]:"app"});const h=b??p,v=h?.activity??o?.activity??r??e.activities[0],I=h?.story??(o&&o.activity===v?o.story:void 0)??v?.stories[0],R=h?.step??I?.steps[0],S={...t};return delete S.screen,v?S.activity=v.id:delete S.activity,I&&v?S.story=$(e,I.id)?I.id:M(v.id,I.id):delete S.story,R&&I&&v?S.step=k(e,R.id)?R.id:ge(v,I,R):delete S.step,delete S[G],Ot(S,_i(e,R,t))},Di=["activity","story","step","screen"],ke=(e,t)=>oe(t)==="app"?Ct(e,t):Lt(e,t),Oi=(e,t)=>{const r=t.screen.previews.find(o=>o.kind==="browser");if(!r)return;let i;try{i=new URL(ye(e,r),"https://page.example.com")}catch{return}const n=i.pathname.split("/").filter(o=>o!=="").map(o=>{try{return decodeURIComponent(o)}catch{return o}});return{origin:i.origin,segments:n}},Mt=()=>({screens:[],children:new Map}),We=(e,t,r)=>{const[i,...n]=e.children.entries();if(e.screens.length===0&&i&&n.length===0&&r!=="/"){const[o,s]=i;return We(s,`${t}/${o}`,`${r}/${o}`)}return{segment:t,path:r,screens:e.screens,children:[...e.children.entries()].map(([o,s])=>We(s,`/${o}`,`${r==="/"?"":r}/${o}`))}},Ci=e=>{const t=new Map;for(const[r,i]of e){const n=t.get(i.origin)??Mt();t.set(i.origin,n);let o=n;for(const s of i.segments){const a=o.children.get(s)??Mt();o.children.set(s,a),o=a}o.screens.push(r)}return[...t.entries()].map(([r,i])=>({origin:r,root:We(i,"/","/")}))},Li=(e,t)=>{const r=t.screens.map(o=>({app:t,screen:o})),i=[],n=[];for(const o of r){const s=Oi(e,o);s?i.push([o,s]):n.push(o)}return{app:t,screens:r,trees:Ci(i),others:n}},Nt=e=>e.apps.map(t=>Li(e,t)).filter(t=>t.screens.length>0),zt=(e,t)=>t?.kind!=="screen"?e[0]:e.find(r=>r.app.id===t.app.id)??e[0],Mi=(e,t)=>{switch(t.type){case"activity":return L(e,t.id)!==void 0;case"story":return $(e,t.id)!==void 0;case"step":return k(e,t.id)!==void 0;case"screen":return C(e,t.id)!==void 0;case"preview":return A(e,t.id)!==void 0;case"page":return!0;case re:{const r=Oe(t.id);return r!==void 0&&A(e,r.previewId)!==void 0}default:return!1}},Vt=e=>{const t=be(e);return{name:"prototype",label:"UX Prototype",parseBase:ut,emptyBase:ht,actions:f,apply:ft,hasTarget:Mi,canonicalTarget:(r,i)=>{if(i.type==="step"){const n=k(r,i.id);return n?{...i,id:ve(n)}:i}if(i.type==="story"){const n=$(r,i.id);return n?{...i,id:M(n.activity.id,n.story.id)}:i}if(i.type==="preview"){const n=A(r,i.id);return n?{...i,id:n.preview.id}:i}return i},describe:(r,i,n)=>yt(t,r,i,n),serialize:kt,resolveNavigation:ke,navigationHierarchy:Di,commentTargets:(r,i)=>Rt(t,r),currentTarget:(r,i)=>Ii(t,r,i),title:Ue}},xe="data-dpk-modal",Ni=e=>{try{return e.matches(":modal")}catch{return!1}},Yt=e=>{e.setAttribute(xe,""),e.open||e.show()},Ut=e=>{Object.hasOwn(e,"showModal")||Object.defineProperty(e,"showModal",{configurable:!0,value:()=>Yt(e)})},Wt=(e,t)=>{if(!Ni(t))return;const r=i=>{i.target===t&&(i.stopImmediatePropagation(),e.removeEventListener("close",r,!0))};e.addEventListener("close",r,!0),t.close(),Yt(t)},zi='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"]',Bt=/^-?[A-Za-z_][\w-]*$/,Ht=40,Vi=(e,t)=>{const r=e.closest(zi);return r!==null&&r!==t&&t.contains(r)?r:e},$e=e=>{const t=e.replace(/\s+/g," ").trim();if(t==="")return;const r=Array.from(t);return r.length>Ht?`${r.slice(0,Ht).join("")}\u2026`:t},Yi=e=>{const t=e.getAttribute("aria-label")??e.getAttribute("title");if(t)return $e(t);const r=e.tagName.toLowerCase();return $e(r==="input"||r==="textarea"||r==="select"?e.getAttribute("placeholder")??e.getAttribute("name")??"":r==="img"?e.getAttribute("alt")??"":e.textContent??"")},Ui=e=>{const t=e.getAttribute("id");if(t&&Bt.test(t))return`#${t}`;const r=e.tagName.toLowerCase(),i=Array.from(e.classList).filter(a=>Bt.test(a)).slice(0,2).map(a=>`.${a}`).join(""),n=e.parentElement,o=n?Array.from(n.children).filter(a=>a.tagName===e.tagName):[],s=o.length>1?`:nth-of-type(${o.indexOf(e)+1})`:"";return`${r}${i}${s}`},Wi=(e,t,r)=>{try{const i=e.querySelectorAll(t);return i.length===1&&i[0]===r}catch{return!1}},Bi=(e,t)=>{const r=[];let i=e;for(;i!==null&&i!==t;){const o=Ui(i);if(r.unshift(o),o.startsWith("#")||Wi(t,r.join(" > "),e))break;i=i.parentElement}const n=Yi(e);return{selector:r.length===0?":scope":r.join(" > "),tag:e.tagName.toLowerCase(),...n===void 0?{}:{text:n}}},Hi=(e,t)=>{if(t===":scope")return e;try{return e.querySelector(t)}catch{return null}},Gi=["screen","preview"],ae=e=>JSON.stringify(Gi.map(t=>e[t]??null)),Gt=(e,t)=>e?.kind==="page"&&ae(e.page)===t,Ee=e=>`tab-${e}`,Fi=e=>({tabs:[{id:Ee(1),history:[{kind:"page",page:e}],index:0}],activeId:Ee(1),seen:ae(e),nextId:2}),ji={id:"",history:[],index:0},Z=e=>e.tabs.find(t=>t.id===e.activeId)??e.tabs[0]??ji,de=e=>{const t=Z(e);return t.history[t.index]},qi=e=>Z(e).index>0,Ki=e=>{const t=Z(e);return t.index<t.history.length-1},Ft=(e,t)=>({...e,tabs:e.tabs.map(r=>r.id===e.activeId?t(r):r)}),Be=(e,t)=>Ft(e,r=>({...r,history:[...r.history.slice(0,r.index+1),t],index:r.index+1})),Se=e=>{const t=de(e);return t?.kind==="page"?{...e,seen:ae(t.page)}:e},jt=(e,t)=>{const r=Z(e),i=r.index+t;return i<0||i>=r.history.length?e:Se(Ft(e,n=>({...n,index:i})))},qt=(e,t,r)=>{const i=Ee(e.nextId),n=e.tabs.findIndex(o=>o.id===e.activeId)+1;return Se({...e,tabs:[...e.tabs.slice(0,n),{id:i,history:[t],index:0},...e.tabs.slice(n)],activeId:r?e.activeId:i,nextId:e.nextId+1})},Xi=(e,t)=>{const r=e.tabs.findIndex(o=>o.id===t);if(r<0)return e;if(e.tabs.length===1){const o=Ee(e.nextId);return{...e,tabs:[{id:o,history:[{kind:"new-tab"}],index:0}],activeId:o,nextId:e.nextId+1}}const i=e.tabs.filter(o=>o.id!==t);if(t!==e.activeId)return{...e,tabs:i};const n=i[r]??i[r-1];return Se({...e,tabs:i,activeId:n?.id??e.activeId})},Ji=(e,t)=>{const r=t===null?null:ae(t);if(r===e.seen)return e;const i={...e,seen:r};return t===null||r===null||Gt(de(e),r)?i:Be(i,{kind:"page",page:t})},Zi=(e,t)=>{const r=ae(t);return Gt(de(e),r)?e.seen===r?e:{...e,seen:r}:Be({...e,seen:r},{kind:"page",page:t})},Kt=(e,t)=>{switch(t.kind){case"observe":return Ji(e,t.page);case"visit":return Zi(e,t.page);case"back":return jt(e,-1);case"forward":return jt(e,1);case"open-tab":return qt(e,t.entry,t.background);case"new-tab":return qt(e,{kind:"new-tab"},!1);case"unreachable":return Be(e,{kind:"unreachable",url:t.url});case"activate":return e.tabs.some(r=>r.id===t.id)&&t.id!==e.activeId?Se({...e,activeId:t.id}):e;case"close-tab":return Xi(e,t.id);default:return e}},Xt=(e,t)=>{const r=ke(e,t),i=J(e,r);if(i?.kind!=="screen")return null;const[n]=Ye(e,i,r).shown;return n?.kind!=="browser"?null:{screen:i.screen.id,preview:n.id}},Te=(e,t)=>{const r=J(e,ke(e,{[G]:"app",...t}));return r?.kind==="screen"?r:void 0},Jt=(e,t)=>{const r=e.trim();if(r==="")return null;try{return r.startsWith("/")?new URL(r,t):new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(r)?r:`https://${r}`)}catch{return null}},Zt=e=>`${e.origin}${e.pathname.replace(/\/+$/,"")}`,Qi=(e,t,r)=>{const i=Jt(t,r);if(i===null)return null;const n=Zt(i);for(const{screen:o}of U(e))for(const s of o.previews){if(s.kind!=="browser")continue;const a=Jt(ye(e,s),r);if(a!==null&&Zt(a)===n)return{screen:o.id,preview:s.id}}return null},Qt=e=>{try{return new URL(e).host||e}catch{return e}},en=(e,t,r)=>t===void 0||t.kind==="new-tab"?r.newTab:t.kind==="unreachable"?Qt(t.url):Te(e,t.page)?.screen.title??r.newTab,er=(e,t)=>{if(t===void 0||t.kind==="new-tab")return"";if(t.kind==="unreachable")return t.url;const r=Te(e,t.page)?.screen.previews.find(i=>i.id===t.page.preview);return r===void 0?"":ye(e,r)},tr=e=>{const t=Z(e);for(let r=t.index;r>=0;r-=1){const i=t.history[r];if(i?.kind==="page")return i.page}for(const r of e.tabs){const i=r.history[r.index];if(i?.kind==="page")return i.page}},tn=(e,t)=>t===void 0?void 0:Te(e,t)?.app.actor,rr=(e,t,r,i=null)=>{const n=Z(t),o=n.history[n.index],s=tn(e,tr(t)??i??void 0);return{tabs:t.tabs.map(a=>({id:a.id,title:en(e,a.history[a.index],r),url:er(e,a.history[a.index]),active:a.id===n.id})),entry:o,url:er(e,o),canBack:qi(t),canForward:Ki(t),...s===void 0?{}:{profile:s}}},rn=e=>tr(e)??null,nn=(e,t)=>{const r=t===null?void 0:Te(e,t),i=zt(Nt(e),r),n=[],o=(s,a)=>{for(const{screen:p}of a.screens){const l=p.previews.find(b=>b.kind==="browser");l!==void 0&&n.push({title:p.title,url:`${s}${a.path==="/"?"":a.path}`,page:{screen:p.id,preview:l.id}})}for(const p of a.children)o(s,p)};for(const s of i?.trees??[])o(Qt(s.origin),s.root);return n},T=(e,t,r,i)=>({id:t,deviceClass:e,width:r,height:i}),ir=[T("phone","iphone-se",375,667),T("phone","iphone-16",393,852),T("phone","iphone-16-pro-max",440,956),T("phone","pixel-7",412,915),T("phone","galaxy-s24",360,780),T("tablet","ipad-mini",744,1133),T("tablet","ipad-air-11",820,1180),T("tablet","ipad-pro-11",834,1194),T("tablet","ipad-pro-13",1024,1366),T("desktop","laptop-13",1280,800),T("desktop","laptop-15",1440,900),T("desktop","full-hd",1920,1080),T("desktop","monitor-27",2560,1440),T("desktop","ultrawide",3440,1440)],on={phone:T("phone","iphone-16",393,852),tablet:T("tablet","ipad-pro-11",834,1194),desktop:T("desktop","laptop-13",1280,800)},nr=e=>e==="mobile"?"phone":e==="tablet"?"tablet":"desktop",sn=e=>e!=="plain",or=e=>ir.filter(t=>t.deviceClass===e),an=(e,t)=>{const r=nr(e),i=t[r];return or(r).find(n=>n.id===i)??on[r]},dn=(e,t)=>{const r=ir.find(i=>i.id===t);return r===void 0||e[r.deviceClass]===t?e:{...e,[r.deviceClass]:t}},pn=(e,t)=>`${e.deviceName(t.id)} \xB7 ${t.width}\xD7${t.height}`,ln=(e,t)=>{const r=[1,t.width/e.width];t.height!==void 0&&r.push(t.height/e.height);const i=Math.min(...r);return!Number.isFinite(i)||i<=0?1:Math.max(.1,Math.floor(i*100)/100)},sr=(e,t)=>{const{state:r,navigation:i}=e,n=J(r,i),o=oe(i);return d`
2
2
  <div class="nav">
3
3
  ${hn(e,t,o)}
4
4
  ${o==="app"?vn(e,t,n):n!==void 0&&n.kind!=="screen"?bn(e,t,n):d`<p class="nav-empty">${t.noActivityBefore}<code>activities</code>${t.noActivityAfter}</p>`}
5
5
  </div>
6
6
  `},cn={scenario:"viewScenario",app:"viewApp"},un={scenario:"viewScenarioHint",app:"viewAppHint"},hn=(e,t,r)=>d`<nav class="view-switch" aria-label=${t.viewLabel}>
7
- ${gi.map(i=>d`<a
7
+ ${fi.map(i=>d`<a
8
8
  class="view-option"
9
9
  href=${e.hashFor(mt(i))}
10
10
  title=${t[un[i]]}
@@ -13,7 +13,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
13
13
  >${t[cn[i]]}</a
14
14
  >`)}
15
15
  </nav>`,vn=(e,t,r)=>{const i=r?.kind==="screen"?r:void 0,n=Nt(e.state),o=zt(n,r),s={context:e,currentId:i?.screen.id},a=o?.others??[];return d`
16
- ${n.length>1&&o?fn(e,t,n,o):c}
16
+ ${n.length>1&&o?gn(e,t,n,o):c}
17
17
  ${n.length===1&&o?.app.description?d`<p class="app-description">${o.app.description}</p>`:c}
18
18
  <div class="steps-head">
19
19
  <span class="dpk-label">${t.appScreens}</span>
@@ -21,7 +21,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
21
21
  </div>
22
22
  <p class="app-hint">${t.appScreensHint}</p>
23
23
  ${o?.trees.map(p=>d`<section class="app-tree">
24
- <h3 class="app-origin">${gn(p.origin)}</h3>
24
+ <h3 class="app-origin">${fn(p.origin)}</h3>
25
25
  <ul class="tree">
26
26
  ${ar(s,p.root,0)}
27
27
  </ul>
@@ -40,7 +40,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
40
40
  ${i?.screen.description?d`<div class="detail">
41
41
  <div class="screen-description dpk-prose">${Pe(_e(i.screen.description))}</div>
42
42
  </div>`:c}
43
- `},fn=(e,t,r,i)=>d`<div class="field">
43
+ `},gn=(e,t,r,i)=>d`<div class="field">
44
44
  <span class="dpk-label">${t.appSelectLabel}</span>
45
45
  <select
46
46
  class="dpk-select"
@@ -70,7 +70,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
70
70
  ${t.children.length>0?d`<ul class="tree">
71
71
  ${t.children.map(i=>ar(e,i,r+1))}
72
72
  </ul>`:c}
73
- </li>`,dr=(e,t)=>t.screen.id===e.currentId,pr=e=>({screen:e.screen.id,preview:null}),lr=(e,t)=>e.hashFor(pr(t)),cr=(e,t)=>{const r=e.commentCount({type:"screen",id:t.screen.id})+St(e.comments,t.screen.previews.map(i=>i.id));return r>0?d`<span class="step-note">${r}</span>`:c},gn=e=>e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""),bn=(e,t,r)=>{const{state:i}=e,{activity:n,story:o}=r,s=o.steps,a=r.kind==="step"?r.step:void 0,p=r.kind==="step"?ve(r):void 0;return d`
73
+ </li>`,dr=(e,t)=>t.screen.id===e.currentId,pr=e=>({screen:e.screen.id,preview:null}),lr=(e,t)=>e.hashFor(pr(t)),cr=(e,t)=>{const r=e.commentCount({type:"screen",id:t.screen.id})+St(e.comments,t.screen.previews.map(i=>i.id));return r>0?d`<span class="step-note">${r}</span>`:c},fn=e=>e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""),bn=(e,t,r)=>{const{state:i}=e,{activity:n,story:o}=r,s=o.steps,a=r.kind==="step"?r.step:void 0,p=r.kind==="step"?ve(r):void 0;return d`
74
74
  <div class="field">
75
75
  <span class="dpk-label">Activity</span>
76
76
  <select
@@ -96,7 +96,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
96
96
  <span class="dpk-label">${s.length}</span>
97
97
  </div>
98
98
  <ol class="steps">
99
- ${Dr(s,l=>fe(n,o,l),(l,b)=>{const h=fe(n,o,l),v=e.commentCount({type:"step",id:h})+St(e.comments,$i(i,l).map(A=>A.id));return d`
99
+ ${Dr(s,l=>ge(n,o,l),(l,b)=>{const h=ge(n,o,l),v=e.commentCount({type:"step",id:h})+St(e.comments,$i(i,l).map(I=>I.id));return d`
100
100
  <li class="step-row" data-current=${String(l.id===a?.id)}>
101
101
  <a class="step-link" href=${e.hashFor({activity:n.id,story:o.id,step:l.id})}>
102
102
  <span class="step-index">${String(b+1).padStart(2,"0")}</span>
@@ -160,7 +160,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
160
160
  </div>`:c}
161
161
  </div>`)}
162
162
  </span>
163
- </div>`},mn=(e,t,r)=>{const i=Or("new-step",ft(e.state));e.dispatch(ie.addStep(r,i,t.newStepName)).ok&&e.navigate({story:r,step:i})},ur={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},hr={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},yn={browser:0,native:22,mail:0,plain:0},vr=(e,t,r)=>{const i=`--frame-width:${ur[t]};--frame-min-height:${hr[t]}`;if(r?.kind!=="device")return i;const n=yn[e];return`${i};--device-width:${r.width+n}px;--device-height:${r.height+n}px;zoom:${r.zoom}`},kn=O(Cr),xn=O(Lr),$n=O(Zr),En=O(Kr),He=O(jr),Sn=(e,t,r)=>{const i=t.length-1;if(e==="ArrowRight")return t[r===i?0:r+1];if(e==="ArrowLeft")return t[r===0?i:r-1];if(e==="Home")return t[0];if(e==="End")return t[i]},Tn=(e,t)=>{const{view:r,send:i}=t,n=o=>s=>{const a=r.tabs[o],p=s.key==="Enter"||s.key===" "?a:Sn(s.key,r.tabs,o);p!==void 0&&(s.preventDefault(),i({kind:"activate",id:p.id,focus:!0}))};return d`<div class="browser-tabs">
163
+ </div>`},mn=(e,t,r)=>{const i=Or("new-step",gt(e.state));e.dispatch(ie.addStep(r,i,t.newStepName)).ok&&e.navigate({story:r,step:i})},ur={mobile:"390px",tablet:"834px",desktop:"1180px",fluid:"100%"},hr={mobile:"620px",tablet:"640px",desktop:"520px",fluid:"420px"},yn={browser:0,native:22,mail:0,plain:0},vr=(e,t,r)=>{const i=`--frame-width:${ur[t]};--frame-min-height:${hr[t]}`;if(r?.kind!=="device")return i;const n=yn[e];return`${i};--device-width:${r.width+n}px;--device-height:${r.height+n}px;zoom:${r.zoom}`},kn=O(Cr),xn=O(Lr),$n=O(Zr),En=O(Kr),He=O(qr),Sn=(e,t,r)=>{const i=t.length-1;if(e==="ArrowRight")return t[r===i?0:r+1];if(e==="ArrowLeft")return t[r===0?i:r-1];if(e==="Home")return t[0];if(e==="End")return t[i]},Tn=(e,t)=>{const{view:r,send:i}=t,n=o=>s=>{const a=r.tabs[o],p=s.key==="Enter"||s.key===" "?a:Sn(s.key,r.tabs,o);p!==void 0&&(s.preventDefault(),i({kind:"activate",id:p.id,focus:!0}))};return d`<div class="browser-tabs">
164
164
  <div class="browser-tab-list" role="tablist" aria-label=${e.browserTabs}>
165
165
  ${r.tabs.map((o,s)=>d`<div
166
166
  class="browser-tab"
@@ -173,7 +173,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
173
173
  >
174
174
  <span class="browser-favicon">${He()}</span>
175
175
  <span class="browser-tab-title">${o.title}</span>
176
- ${fr(e,t,o.id)}
176
+ ${gr(e,t,o.id)}
177
177
  </div>`)}
178
178
  </div>
179
179
  <button
@@ -188,7 +188,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
188
188
  ${t.onExitDemo===void 0?c:d`<button class="demo-exit" type="button" title=${e.exitDemo} @click=${t.onExitDemo}>
189
189
  ${ue()} ${e.exitDemo} <kbd>Esc</kbd>
190
190
  </button>`}
191
- </div>`},fr=(e,t,r)=>d`<button
191
+ </div>`},gr=(e,t,r)=>d`<button
192
192
  class="browser-tab-close"
193
193
  type="button"
194
194
  aria-label=${e.closeTab}
@@ -196,7 +196,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
196
196
  @click=${i=>{i.stopPropagation(),t.send({kind:"close-tab",id:r})}}
197
197
  >
198
198
  ${ue()}
199
- </button>`,In={back:kn,forward:xn,reload:$n},Q=(e,t,r)=>{const{view:i,send:n}=t,o={back:e.browserBack,forward:e.browserForward,reload:e.browserReload}[r],s={back:!i.canBack,forward:!i.canForward,reload:i.entry?.kind!=="page"}[r];return d`<button
199
+ </button>`,An={back:kn,forward:xn,reload:$n},Q=(e,t,r)=>{const{view:i,send:n}=t,o={back:e.browserBack,forward:e.browserForward,reload:e.browserReload}[r],s={back:!i.canBack,forward:!i.canForward,reload:i.entry?.kind!=="page"}[r];return d`<button
200
200
  class=${`browser-nav browser-${r}`}
201
201
  type="button"
202
202
  aria-label=${o}
@@ -204,8 +204,8 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
204
204
  ?disabled=${s}
205
205
  @click=${()=>n({kind:r})}
206
206
  >
207
- ${In[r]()}
208
- </button>`},An=(e,t,r)=>{const{view:i,send:n}=t,o=i.profile??e.browserGuest;return d`<div class="browser-toolbar">
207
+ ${An[r]()}
208
+ </button>`},In=(e,t,r)=>{const{view:i,send:n}=t,o=i.profile??e.browserGuest;return d`<div class="browser-toolbar">
209
209
  ${r?c:d`${Q(e,t,"back")} ${Q(e,t,"forward")} ${Q(e,t,"reload")}`}
210
210
  <form
211
211
  class="browser-address-form"
@@ -256,7 +256,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
256
256
  <span class="browser-card-title">${n.title}</span>
257
257
  <span class="browser-card-url">${n.url}</span>
258
258
  </button>
259
- ${fr(e,t,n.id)}
259
+ ${gr(e,t,n.id)}
260
260
  </div>`)}
261
261
  </div>`},Rn=(e,t,r)=>d`<div class="browser-newtab">
262
262
  <p class="browser-newtab-label">${t.newTabShortcuts}</p>
@@ -284,7 +284,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
284
284
  data-window=${r.window.kind}
285
285
  style=${vr("browser",o,r.window)}
286
286
  >
287
- ${a?c:Tn(t,r)} ${An(t,r,a)}
287
+ ${a?c:Tn(t,r)} ${In(t,r,a)}
288
288
  <div class="browser-progress" aria-hidden="true"></div>
289
289
  <div class="viewport">
290
290
  ${a&&r.switcher?_n(t,r):c}
@@ -314,11 +314,11 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
314
314
  title=${e.uiCommentPin(r.number,r.body)}
315
315
  >${r.number}</span
316
316
  >`)}
317
- </div>`,Nn=e=>{const t=e.mode;if(t.kind!=="composing")return c;const r=Br(t.body,e.notes,{key:`ui:${t.target.previewId}/${t.target.selector}`,...e.targetLabel===void 0?{}:{label:e.targetLabel}});return d`${nt(`${t.target.previewId}/${t.target.selector}`,Hr(e.composer,r,i=>{i.kind==="input"?e.send({kind:"input",body:i.body}):i.kind==="comment"?e.submit(i.body):e.send({kind:"dismiss"})}))}`},gr=(e,t,r)=>{const{state:i,navigation:n}=e,o=J(i,n),s=o===void 0||o.kind==="story"?void 0:o,a=oe(n)==="app",p=mr(i,[]);if(o?.kind==="story"){const{activity:P,story:Ie}=o;return d`
317
+ </div>`,Nn=e=>{const t=e.mode;if(t.kind!=="composing")return c;const r=Br(t.body,e.notes,{key:`ui:${t.target.previewId}/${t.target.selector}`,...e.targetLabel===void 0?{}:{label:e.targetLabel}});return d`${nt(`${t.target.previewId}/${t.target.selector}`,Hr(e.composer,r,i=>{i.kind==="input"?e.send({kind:"input",body:i.body}):i.kind==="comment"?e.submit(i.body):e.send({kind:"dismiss"})}))}`},fr=(e,t,r)=>{const{state:i,navigation:n}=e,o=J(i,n),s=o===void 0||o.kind==="story"?void 0:o,a=oe(n)==="app",p=mr(i,[]);if(o?.kind==="story"){const{activity:P,story:Ae}=o;return d`
318
318
  <div class="stage">
319
319
  <section class="stage-story">
320
- ${br(t,Pi(P,Ie))}
321
- ${Ie.description?d`<div class="story-description dpk-prose">${Pe(_e(Ie.description))}</div>`:c}
320
+ ${br(t,Pi(P,Ae))}
321
+ ${Ae.description?d`<div class="story-description dpk-prose">${Pe(_e(Ae.description))}</div>`:c}
322
322
  <p class="stage-empty">${t.storyWithoutSteps}</p>
323
323
  </section>
324
324
  ${p}
@@ -330,7 +330,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
330
330
  </p>`}
331
331
  ${p}
332
332
  </div>
333
- `;const l=Ye(i,s,n),{layout:b,panes:h,shown:v}=l,[A]=b==="single"?h:[],R=r.uiComment,S=r.lift,z=S?.mode==="demo",F=r.browser,qe=F!==null&&F.view.entry?.kind!=="page"?[]:v,[q]=qe,pe=(q??v[0])?.viewport??"desktop",je=z&&F!==null&&pe!=="mobile",$r=q??v[0],Ke=F!==null?"browser":$r?.kind??"browser",Xe=z&&Ke==="browser"&&nr(pe)==="desktop",j=r.devices,ee=j===null||Xe||!sn(Ke)?null:an(pe,j.choice),Je=ee!==null&&j!==null?{kind:"device",width:ee.width,height:ee.height,zoom:j.zoom}:Xe?{kind:"fill"}:null;return d`
333
+ `;const l=Ye(i,s,n),{layout:b,panes:h,shown:v}=l,[I]=b==="single"?h:[],R=r.uiComment,S=r.lift,z=S?.mode==="demo",F=r.browser,je=F!==null&&F.view.entry?.kind!=="page"?[]:v,[j]=je,pe=(j??v[0])?.viewport??"desktop",qe=z&&F!==null&&pe!=="mobile",$r=j??v[0],Ke=F!==null?"browser":$r?.kind??"browser",Xe=z&&Ke==="browser"&&nr(pe)==="desktop",q=r.devices,ee=q===null||Xe||!sn(Ke)?null:an(pe,q.choice),Je=ee!==null&&q!==null?{kind:"device",width:ee.width,height:ee.height,zoom:q.zoom}:Xe?{kind:"fill"}:null;return d`
334
334
  ${S===null?c:d`<div class="stage-placeholder" style=${`height:${S.height}px`}></div>`}
335
335
  <div
336
336
  class=${S===null?"stage":z?"stage is-demo":"stage is-maximized"}
@@ -338,13 +338,13 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
338
338
  popover=${S===null?c:"manual"}
339
339
  @wheel=${S===null?c:{handleEvent:r.onLiftedWheel,passive:!1}}
340
340
  >
341
- ${z?je?c:d`<button class="demo-exit" type="button" title=${t.exitDemo} @click=${r.onToggleDemo}>
341
+ ${z?qe?c:d`<button class="demo-exit" type="button" title=${t.exitDemo} @click=${r.onToggleDemo}>
342
342
  ${ue()} ${t.exitDemo} <kbd>Esc</kbd>
343
343
  </button>`:d`<div class="stage-bar">
344
344
  ${br(t,Dt(i,s))}
345
345
  <div class="stage-tools">
346
- ${A?.kind==="screen"&&A.tabs.length>0?wr(e,l,A):c}
347
- ${ee!==null&&j!==null?Bn(t,ee,j):c}
346
+ ${I?.kind==="screen"&&I.tabs.length>0?wr(e,l,I):c}
347
+ ${ee!==null&&q!==null?Bn(t,ee,q):c}
348
348
  ${v.length>0?Cn(t,R):c}
349
349
  ${v.length===0?c:a?Hn(t,r.onToggleDemo):Gn(t,S!==null,r.onToggleMaximize)}
350
350
  </div>
@@ -360,7 +360,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
360
360
  @wheel=${{handleEvent:r.canvasEvents.wheel,passive:!1}}
361
361
  @scroll=${{handleEvent:r.canvasEvents.scroll,capture:!0}}
362
362
  >
363
- ${F!==null?On(e,t,{...F,...q===void 0?{}:{preview:q},...je?{onExitDemo:r.onToggleDemo}:{},hasContent:q===void 0||r.hasPreviewContent(q.id),viewport:pe,window:Je??{kind:"fill"}}):b==="side-by-side"?d`<div class="panes">
363
+ ${F!==null?On(e,t,{...F,...j===void 0?{}:{preview:j},...qe?{onExitDemo:r.onToggleDemo}:{},hasContent:j===void 0||r.hasPreviewContent(j.id),viewport:pe,window:Je??{kind:"fill"}}):b==="side-by-side"?d`<div class="panes">
364
364
  ${h.map(P=>d`<div class="pane" data-viewport=${P.preview.viewport} data-pane=${P.kind}>
365
365
  ${Wn(e,l,P)}
366
366
  ${Ge(e,t,P.preview,r.hasPreviewContent(P.preview.id))}
@@ -370,11 +370,11 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
370
370
  ${Mn(t,R)}
371
371
  </div>
372
372
  ${Nn(R)}
373
- ${mr(i,qe.map(P=>P.id))}
373
+ ${mr(i,je.map(P=>P.id))}
374
374
  </div>
375
375
  `},zn=O(ti),Vn=O(Jr),Yn={phone:O(Qr),tablet:O(ei),desktop:O(Xr)},br=(e,t)=>d`<div class="page-head">
376
- ${t.actor===void 0?c:d`<span class="page-actor" role="note" aria-label=${e.pageActor(t.actor)}>
377
- ${zn()} ${t.actor}
376
+ ${t.actor===void 0?c:d`<span class="page-actor" role="note" aria-label=${e.pageActor(t.actor)} title=${t.actor}>
377
+ ${zn()} <span class="page-actor-name">${t.actor}</span>
378
378
  </span>`}
379
379
  <h2 class="page-title">${t.title}</h2>
380
380
  </div>`,Un=(e,t)=>d`<aside class="situation">
@@ -389,8 +389,8 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
389
389
  href=${e.hashFor({preview:xi(t,i.id)})}
390
390
  >${i.label??i.viewport}</a
391
391
  >`})}
392
- </div>`,Wn=(e,t,r)=>r.kind==="material"?r.preview.label===void 0?c:d`<span class="pane-label">${r.preview.label}</span>`:d`<div class="pane-head">
393
- <span class="pane-label">${r.screen.screen.title}</span>
392
+ </div>`,Wn=(e,t,r)=>r.kind==="material"?r.preview.label===void 0?c:d`<span class="pane-label" title=${r.preview.label}>${r.preview.label}</span>`:d`<div class="pane-head">
393
+ <span class="pane-label" title=${r.screen.screen.title}>${r.screen.screen.title}</span>
394
394
  ${r.tabs.length>0?wr(e,t,r):c}
395
395
  </div>`,Bn=(e,t,r)=>{const i=Math.round(r.zoom*100);return d`<span class="device-pick" title=${e.deviceHint}>
396
396
  ${Yn[t.deviceClass]()}
@@ -426,9 +426,9 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
426
426
  ${r.kind==="browser"?d`<div class="chrome">
427
427
  <span class="dots"><i></i><i></i><i></i></span>
428
428
  <span class="url">${ye(e.state,r)}</span>
429
- </div>`:r.kind==="mail"?Fn(Ii(t,r)):c}
429
+ </div>`:r.kind==="mail"?Fn(Ai(t,r)):c}
430
430
  <div class="viewport">
431
- ${r.kind==="native"?qn():c}
431
+ ${r.kind==="native"?jn():c}
432
432
  <slot name=${`preview:${r.id}`}></slot>
433
433
  ${i?c:d`<div class="frame-placeholder">
434
434
  <span class="dpk-label">light dom preview</span>
@@ -447,7 +447,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
447
447
  </div>`)}
448
448
  </dl>
449
449
  </div>
450
- </header>`,qn=()=>d`<div class="status-bar">
450
+ </header>`,jn=()=>d`<div class="status-bar">
451
451
  <span class="status-time">9:41</span>
452
452
  <span class="punch-hole" aria-hidden="true"></span>
453
453
  <svg class="status-wifi" viewBox="0 0 16 12" aria-hidden="true">
@@ -469,11 +469,23 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
469
469
  </svg>
470
470
  </div>`,mr=(e,t)=>{const i=[...U(e).flatMap(n=>n.screen.previews),...W(e).flatMap(n=>X(n.step))].filter(n=>!t.includes(n.id));return i.length===0?d`${c}`:d`<div class="parked" aria-hidden="true">
471
471
  ${i.map(n=>d`<slot name=${`preview:${n.id}`}></slot>`)}
472
- </div>`},jn=Vr`
472
+ </div>`},qn=Vr`
473
473
  :host {
474
474
  --dpk-prototype-accent: var(--dpk-blue);
475
475
  }
476
476
 
477
+ /*
478
+ * The sidebar and the main column scroll on their own, with the memo pinned
479
+ * to the bottom of the main column, only inside a bounded shell. A page that
480
+ * gives the host no height would grow the shell to its longest column and
481
+ * scroll the whole document, carrying the memo off screen; the viewport
482
+ * height is the fallback. A host with a height still wins: the shell's own
483
+ * min/max-height pin it to that.
484
+ */
485
+ .dpk-shell {
486
+ height: 100dvh;
487
+ }
488
+
477
489
  /* ---------------------------------------------------------------- sidebar */
478
490
 
479
491
  .nav {
@@ -686,6 +698,8 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
686
698
  margin: 0;
687
699
  padding: 0;
688
700
  display: grid;
701
+ /* A row is no wider than the list: a long step name ends in an ellipsis. */
702
+ grid-template-columns: minmax(0, 1fr);
689
703
  gap: 2px;
690
704
  max-height: 38vh;
691
705
  overflow: auto;
@@ -804,6 +818,8 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
804
818
 
805
819
  .detail {
806
820
  display: grid;
821
+ /* As wide as the panel, not as a description's widest table or code line: those scroll. */
822
+ grid-template-columns: minmax(0, 1fr);
807
823
  gap: 12px;
808
824
  padding: 12px 12px 14px;
809
825
  border: 1px solid var(--dpk-rule);
@@ -814,6 +830,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
814
830
 
815
831
  .detail-row {
816
832
  display: grid;
833
+ grid-template-columns: minmax(0, 1fr);
817
834
  gap: 4px;
818
835
  }
819
836
 
@@ -839,6 +856,11 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
839
856
  min-width: 0;
840
857
  }
841
858
 
859
+ /* A tighter top than the shell's leaves the preview more of the main column. */
860
+ .dpk-main-body {
861
+ padding-top: 12px;
862
+ }
863
+
842
864
  .stage-bar {
843
865
  display: flex;
844
866
  align-items: center;
@@ -848,6 +870,24 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
848
870
  flex-wrap: wrap;
849
871
  }
850
872
 
873
+ /*
874
+ * The page head and its tools stick to the top of the main column, so they
875
+ * stay in reach while a tall preview scrolls under them; the situation and
876
+ * the canvas scroll on. The bar spans the column edge to edge (cancelling
877
+ * the body's padding) on a frosted ground the content passes beneath. Above
878
+ * the UI-comment layer, below the memo, which opens over everything.
879
+ */
880
+ .stage:not(.is-maximized) > .stage-bar {
881
+ position: sticky;
882
+ top: 0;
883
+ z-index: 5;
884
+ margin: -12px -24px 0;
885
+ padding: 10px 24px;
886
+ border-bottom: 1px solid var(--dpk-rule);
887
+ background: color-mix(in srgb, var(--dpk-paper-raised) 92%, transparent);
888
+ backdrop-filter: saturate(1.6) blur(14px);
889
+ }
890
+
851
891
  /* ------------------------------------------------------------- page head */
852
892
 
853
893
  .page-head {
@@ -867,7 +907,9 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
867
907
 
868
908
  .page-actor {
869
909
  display: inline-flex;
870
- flex: none;
910
+ /* A long role name gives way to the title first, down to a recognizable stub. */
911
+ flex: 0 1000 auto;
912
+ min-width: 72px;
871
913
  align-items: center;
872
914
  gap: 6px;
873
915
  height: 26px;
@@ -887,9 +929,17 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
887
929
  font-weight: 650;
888
930
  letter-spacing: 0.01em;
889
931
  white-space: nowrap;
932
+ max-width: 280px;
933
+ }
934
+
935
+ .page-actor-name {
936
+ min-width: 0;
937
+ overflow: hidden;
938
+ text-overflow: ellipsis;
890
939
  }
891
940
 
892
941
  .page-actor svg {
942
+ flex: none;
893
943
  width: 13px;
894
944
  height: 13px;
895
945
  opacity: 0.9;
@@ -908,10 +958,14 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
908
958
  white-space: nowrap;
909
959
  }
910
960
 
961
+ /* Wraps on a phone rather than pushing the last tools off the screen. */
911
962
  .stage-tools {
912
963
  display: flex;
964
+ flex-wrap: wrap;
965
+ justify-content: flex-end;
913
966
  align-items: center;
914
967
  gap: 8px;
968
+ min-width: 0;
915
969
  margin-left: auto;
916
970
  }
917
971
 
@@ -1078,6 +1132,7 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
1078
1132
  line-height: 1.65;
1079
1133
  color: var(--dpk-ink);
1080
1134
  white-space: pre-line;
1135
+ overflow-wrap: anywhere;
1081
1136
  }
1082
1137
 
1083
1138
  /* ----------------------------------------------------------------- canvas */
@@ -1209,9 +1264,36 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
1209
1264
  padding-bottom: 4px;
1210
1265
  }
1211
1266
 
1267
+ /*
1268
+ * A row wider than the stage fades out at the edge it scrolls toward, so the
1269
+ * panes past it read as a scroll away rather than cut off. The scroll timeline
1270
+ * is inactive while the row fits, which leaves it unmasked.
1271
+ */
1272
+ @supports (animation-timeline: scroll()) {
1273
+ .panes {
1274
+ animation: panes-edge linear both;
1275
+ animation-timeline: scroll(self inline);
1276
+ }
1277
+
1278
+ @keyframes panes-edge {
1279
+ 0% {
1280
+ mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
1281
+ }
1282
+ 2%,
1283
+ 98% {
1284
+ mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
1285
+ }
1286
+ 100% {
1287
+ mask-image: linear-gradient(90deg, transparent, #000 40px);
1288
+ }
1289
+ }
1290
+ }
1291
+
1212
1292
  /* A device shrinks at most to a width its layout still reads at, then the row scrolls. */
1213
1293
  .pane {
1214
1294
  display: grid;
1295
+ /* The pane's width is the device's: a long label never widens it. */
1296
+ grid-template-columns: minmax(0, 1fr);
1215
1297
  gap: 8px;
1216
1298
  flex: 0 1 var(--pane-width);
1217
1299
  min-width: min(var(--pane-width), 720px);
@@ -1255,8 +1337,14 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
1255
1337
  font-size: 11.5px;
1256
1338
  }
1257
1339
 
1340
+ /* One line over the pane; hovering names the whole label. */
1258
1341
  .pane-label {
1259
1342
  justify-self: start;
1343
+ min-width: 0;
1344
+ max-width: 100%;
1345
+ overflow: hidden;
1346
+ text-overflow: ellipsis;
1347
+ white-space: nowrap;
1260
1348
  padding: 2px 9px;
1261
1349
  border-radius: 999px;
1262
1350
  background: var(--dpk-paper-raised);
@@ -1691,6 +1779,8 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
1691
1779
  /* A preview is the product's screen, not the kit's chrome: it stays light in a dark theme. */
1692
1780
  color-scheme: light;
1693
1781
  background: #fff;
1782
+ /* …and so does its ink: the kit's dark-theme text color would be invisible on it. */
1783
+ color: #1f2430;
1694
1784
  }
1695
1785
 
1696
1786
  /*
@@ -2298,6 +2388,21 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
2298
2388
  display: none;
2299
2389
  }
2300
2390
  `,Kn=`
2391
+ /*
2392
+ * The wrapper is a stretch grid (see \`.viewport ::slotted(*)\`): one child
2393
+ * fills the frame, but several would share the extra height as gaps between
2394
+ * them, so they stack from the top instead (a \`<style>\` or \`<script>\` beside
2395
+ * the one child draws nothing and does not count). A shadow tree cannot see a
2396
+ * slotted element's children, hence the document rule; \`:where\` lets the
2397
+ * author's own \`align-content\` win.
2398
+ */
2399
+ :where(
2400
+ dpk-template-prototype
2401
+ > [data-preview-id]:has(> :not(style, script, template, link) ~ :not(style, script, template, link))
2402
+ ) {
2403
+ align-content: start;
2404
+ }
2405
+
2301
2406
  dpk-template-prototype > [data-preview-id]:has(dialog[${xe}][open]) {
2302
2407
  position: relative;
2303
2408
  }
@@ -2318,6 +2423,6 @@ import{ai as x,aK as Er,ad as D,az as _,aA as f,ag as u,ae as N,ah as le,ac as S
2318
2423
  max-height: calc(100% - 32px);
2319
2424
  margin: auto;
2320
2425
  }
2321
- `,Fe={kind:"off"},Xn=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking"}:Fe;case"exit":return Fe;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:""};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking"};default:return e}},Jn={width:300,height:300},Zn=360,yr="dpk-template-prototype-document-styles",Qn=24,eo=()=>{if(document.getElementById(yr)!==null)return;const e=Object.assign(document.createElement("style"),{id:yr,textContent:Kn});document.head.append(e)},to=(e,t,r)=>{const i=getComputedStyle(e),n=/auto|scroll/.test(i.overflowX)&&e.scrollWidth>e.clientWidth,o=/auto|scroll/.test(i.overflowY)&&e.scrollHeight>e.clientHeight,s=t<0?e.scrollLeft>0:t>0&&e.scrollLeft+e.clientWidth<e.scrollWidth-1,a=r<0?e.scrollTop>0:r>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1;return n&&s||o&&a},ro=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 kr extends it{static{this.styles=[it.styles,Yr,Ur,jn]}#e=Fe;#u=!1;#a=null;#o=[];#O=new Fr(this);#y=!1;#t=null;#r=null;#k=!1;#p=!1;#h=!1;#i=null;#v=null;#f={};#g=1;#l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.#P());#d=null;definitionFor(t){return Vt(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#T),window.addEventListener("resize",this.#b),this.addEventListener("toggle",this.#_,!0),this.addEventListener("click",this.#c,!0),this.addEventListener("auxclick",this.#c,!0),eo()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#T),window.removeEventListener("resize",this.#b),this.removeEventListener("toggle",this.#_,!0),this.removeEventListener("click",this.#c,!0),this.removeEventListener("auxclick",this.#c,!0),this.#l?.disconnect(),this.#d=null,this.#D()}renderRegions(t){const r=be(this.locale),i=J(t.state,t.navigation),n=oe(t.navigation)==="app";this.#t!==null&&this.#t.mode==="demo"!==n&&this.#R();const o=n?this.#q(t,r):null;return this.#k=o!==null,this.#o=i!==void 0&&i.kind!=="story"&&(o===null||o.view.entry?.kind==="page")?Ye(t.state,i,t.navigation).shown.map(s=>s.id):[],this.#i!==null&&this.#i.page!==this.#o.join(" ")&&this.#D(),{sidebar:sr(t,r),main:gr(t,r,{hasPreviewContent:s=>this.#Q(s),lift:this.#t,onToggleMaximize:()=>this.#m(this.#t===null?"maximized":null),onToggleDemo:()=>this.#m(this.#t===null?"demo":null),onLiftedWheel:this.#F,browser:o===null?null:{...o,loading:this.#i!==null},devices:n?{choice:this.#f,zoom:this.#g,onPick:s=>{this.#f=dn(this.#f,s),this.requestUpdate()}}:null,uiComment:this.#C(t),canvasEvents:{click:this.#N,pointermove:this.#z,pointerleave:this.#V,wheel:this.#Y,scroll:this.#b}})}}updated(){super.updated(),this.#H(),this.#W(),this.#U(),this.#P();const t=this.#e;if(t.kind==="composing"&&!this.#o.includes(t.target.previewId)){this.#s({kind:"dismiss"});return}this.#G(),this.#h&&(this.#h=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#I();const r=t.kind==="composing"&&!this.#u;if(this.#u=t.kind==="composing",t.kind!=="composing"||this.#a===null)return;const i=this.renderRoot.querySelector(".comment-pop");i&&(this.#O.open(i,this.#a,Jn,{placement:"right-start"}),r&&i.querySelector("textarea")?.focus({preventScroll:!0}))}#C(t){const r=this.#e,i=r.kind==="composing"?r.target:void 0,n=i?I(t.state,i.previewId)?.preview:void 0,o=i?ct(i):void 0;return{mode:r,pins:r.kind==="off"?[]:Et(t.comments,this.#o),...i&&n?{targetLabel:$t(n,i)}:{},notes:t.comments.filter(s=>s.target.type===re&&s.target.id===o).map(s=>Qe(s)),composer:Gr(this.locale),send:s=>this.#s(s),submit:s=>this.#L(s)}}#s(t){const r=Xn(this.#e,t);r!==this.#e&&(this.#e=r,r.kind!=="composing"&&(this.#a=null),this.requestUpdate())}#L(t){const r=this.#e;if(r.kind!=="composing")return;this.dispatch({type:Wr,target:{type:re,id:ct(r.target)},payload:{body:t}}).ok&&this.#s({kind:"submitted"})}#x(t){const r=t.composedPath(),i=r[0];if(i instanceof Element&&i.classList.contains("ui-catcher"))return this.#M(t.clientX,t.clientY);const n=r.find(o=>o instanceof Element&&o.parentElement===this&&o.hasAttribute("data-preview-id"));return!n||!(i instanceof Element)||!n.contains(i)?null:this.#E(i,n)}#M(t,r){const i=this.#$(t,r);return i===null?null:this.#E(i.element,i.wrapper)}#$(t,r){if(typeof document.elementsFromPoint!="function")return null;const i=this.#S();for(const n of document.elementsFromPoint(t,r)){const o=i.find(s=>s.contains(n));if(o!==void 0)return{element:n,wrapper:o}}return null}#E(t,r){const i=r.getAttribute("data-preview-id");if(!i)return null;const n=Vi(t,r),o=Bi(n,r);return{element:n,target:{previewId:i,selector:o.selector,...o.text===void 0?{}:{text:o.text}}}}#S(){return Array.from(this.children).filter(t=>{const r=t.getAttribute("data-preview-id");return r!==null&&this.#o.includes(r)})}#N=t=>{if(this.#e.kind==="off")return;const r=this.#x(t);r&&(t.preventDefault(),t.stopPropagation(),this.#a=r.element,this.#s({kind:"pick",target:r.target}))};#z=t=>{if(this.#e.kind==="off")return;const r=this.#x(t);this.#w(".ui-hover",r?.element??null)};#V=()=>{this.#w(".ui-hover",null)};#Y=t=>{const r=t.composedPath()[0];if(!(r instanceof Element)||!r.classList.contains("ui-catcher"))return;const i=this.renderRoot.querySelector(".canvas");let n=this.#$(t.clientX,t.clientY)?.element??null;for(;n!==null&&n!==i;){if(to(n,t.deltaX,t.deltaY)){t.preventDefault(),n.scrollBy({left:t.deltaX,top:t.deltaY});return}n=ro(n)}};#T=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#s({kind:"exit"}):this.#m(null))};#b=()=>{this.#e.kind!=="off"&&this.#I()};#I(){if(this.#e.kind==="off")return;this.#w(".ui-picked",this.#a);const t=this.renderRoot.querySelector(".canvas");if(!t)return;const r=this.renderRoot.querySelector(".ui-catcher");r&&(r.style.width=`${t.scrollWidth}px`,r.style.height=`${t.scrollHeight}px`);for(const i of this.renderRoot.querySelectorAll(".ui-pin")){const n=this.#B(i.dataset.preview??""),s=(n?Hi(n,i.dataset.selector??""):null)?.getBoundingClientRect();if(!s||s.width===0&&s.height===0){i.hidden=!0;continue}const a=this.#A(t);i.hidden=!1,i.style.left=`${s.right-a.left}px`,i.style.top=`${s.top-a.top}px`}}#w(t,r){const i=this.renderRoot.querySelector(t),n=this.renderRoot.querySelector(".canvas");if(!i||!n)return;const o=r?.getBoundingClientRect();if(!o){i.hidden=!0;return}const s=this.#A(n);i.hidden=!1,i.style.left=`${o.left-s.left}px`,i.style.top=`${o.top-s.top}px`,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`}#A(t){const r=t.getBoundingClientRect();return{left:r.left+t.clientLeft-t.scrollLeft,top:r.top+t.clientTop-t.scrollTop}}#U(){const t=this.renderRoot.querySelector(".canvas");t===this.#d||this.#l===null||(this.#d!==null&&this.#l.unobserve(this.#d),this.#d=t,t!==null&&this.#l.observe(t))}#P(){const t=this.renderRoot.querySelector('.frame[data-window="device"]'),r=t?.closest(".canvas");if(!t||!(r instanceof HTMLElement))return;const i=getComputedStyle(t),n={width:parseFloat(i.getPropertyValue("--device-width")),height:parseFloat(i.getPropertyValue("--device-height"))},o=getComputedStyle(r),s=r.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),a=this.#t?.mode==="demo",p=a?Qn*2:0,l=ln(n,{width:s-p,...a?{height:r.clientHeight-p}:{}});l!==this.#g&&(this.#g=l,this.requestUpdate())}#W(){for(const t of this.querySelectorAll(":scope > [data-preview-id]"))for(const r of t.querySelectorAll("dialog"))Ut(r),Wt(this,r)}#_=t=>{const r=t.target;!(r instanceof HTMLDialogElement)||!r.open||Array.from(this.children).some(i=>i.hasAttribute("data-preview-id")&&i.contains(r))&&(Ut(r),Wt(this,r))};#B(t){return Array.from(this.children).find(r=>r.getAttribute("data-preview-id")===t)}#H(){if(this.#y||this.renderRoot.querySelector(".stage")===null)return;this.#y=!0;const t=this.derivation.state,r=[];for(const i of Array.from(this.children)){const n=i.getAttribute("data-preview-id");if(n!==null)for(const o of i.querySelectorAll("a, [data-dpk-navigate]")){const s=Ti(t,{href:o.getAttribute("href"),navigate:o.getAttribute("data-dpk-navigate")});if(s===null)continue;const a=(o.textContent??"").replace(/\s+/g," ").trim().slice(0,40),p=o.getAttribute("data-dpk-navigate")??o.getAttribute("href")??"(no href)";r.push(` ${n}: <${o.tagName.toLowerCase()}> "${a}" \u2192 ${p} (${s})`)}}r.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: ${r.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"):
2426
+ `,Fe={kind:"off"},Xn=(e,t)=>{switch(t.kind){case"toggle":return e.kind==="off"?{kind:"picking"}:Fe;case"exit":return Fe;case"pick":return e.kind==="off"?e:{kind:"composing",target:t.target,body:e.kind==="composing"?e.body:""};case"input":return e.kind==="composing"?{...e,body:t.body}:e;case"dismiss":case"submitted":return e.kind==="off"?e:{kind:"picking"};default:return e}},Jn={width:300,height:300},Zn=360,yr="dpk-template-prototype-document-styles",Qn=24,eo=()=>{if(document.getElementById(yr)!==null)return;const e=Object.assign(document.createElement("style"),{id:yr,textContent:Kn});document.head.append(e)},to=(e,t,r)=>{const i=getComputedStyle(e),n=/auto|scroll/.test(i.overflowX)&&e.scrollWidth>e.clientWidth,o=/auto|scroll/.test(i.overflowY)&&e.scrollHeight>e.clientHeight,s=t<0?e.scrollLeft>0:t>0&&e.scrollLeft+e.clientWidth<e.scrollWidth-1,a=r<0?e.scrollTop>0:r>0&&e.scrollTop+e.clientHeight<e.scrollHeight-1;return n&&s||o&&a},ro=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 kr extends it{static{this.styles=[it.styles,Yr,Ur,qn]}#e=Fe;#u=!1;#a=null;#o=[];#O=new Fr(this);#y=!1;#t=null;#r=null;#k=!1;#p=!1;#h=!1;#i=null;#v=null;#g={};#f=1;#l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.#P());#d=null;definitionFor(t){return Vt(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.#T),window.addEventListener("resize",this.#b),this.addEventListener("toggle",this.#_,!0),this.addEventListener("click",this.#c,!0),this.addEventListener("auxclick",this.#c,!0),eo()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.#T),window.removeEventListener("resize",this.#b),this.removeEventListener("toggle",this.#_,!0),this.removeEventListener("click",this.#c,!0),this.removeEventListener("auxclick",this.#c,!0),this.#l?.disconnect(),this.#d=null,this.#D()}renderRegions(t){const r=be(this.locale),i=J(t.state,t.navigation),n=oe(t.navigation)==="app";this.#t!==null&&this.#t.mode==="demo"!==n&&this.#R();const o=n?this.#j(t,r):null;return this.#k=o!==null,this.#o=i!==void 0&&i.kind!=="story"&&(o===null||o.view.entry?.kind==="page")?Ye(t.state,i,t.navigation).shown.map(s=>s.id):[],this.#i!==null&&this.#i.page!==this.#o.join(" ")&&this.#D(),{sidebar:sr(t,r),main:fr(t,r,{hasPreviewContent:s=>this.#Q(s),lift:this.#t,onToggleMaximize:()=>this.#m(this.#t===null?"maximized":null),onToggleDemo:()=>this.#m(this.#t===null?"demo":null),onLiftedWheel:this.#F,browser:o===null?null:{...o,loading:this.#i!==null},devices:n?{choice:this.#g,zoom:this.#f,onPick:s=>{this.#g=dn(this.#g,s),this.requestUpdate()}}:null,uiComment:this.#C(t),canvasEvents:{click:this.#N,pointermove:this.#z,pointerleave:this.#V,wheel:this.#Y,scroll:this.#b}})}}updated(){super.updated(),this.#H(),this.#W(),this.#U(),this.#P();const t=this.#e;if(t.kind==="composing"&&!this.#o.includes(t.target.previewId)){this.#s({kind:"dismiss"});return}this.#G(),this.#h&&(this.#h=!1,this.renderRoot.querySelector('.browser-tab[aria-selected="true"]')?.focus()),this.#A();const r=t.kind==="composing"&&!this.#u;if(this.#u=t.kind==="composing",t.kind!=="composing"||this.#a===null)return;const i=this.renderRoot.querySelector(".comment-pop");i&&(this.#O.open(i,this.#a,Jn,{placement:"right-start"}),r&&i.querySelector("textarea")?.focus({preventScroll:!0}))}#C(t){const r=this.#e,i=r.kind==="composing"?r.target:void 0,n=i?A(t.state,i.previewId)?.preview:void 0,o=i?ct(i):void 0;return{mode:r,pins:r.kind==="off"?[]:Et(t.comments,this.#o),...i&&n?{targetLabel:$t(n,i)}:{},notes:t.comments.filter(s=>s.target.type===re&&s.target.id===o).map(s=>Qe(s)),composer:Gr(this.locale),send:s=>this.#s(s),submit:s=>this.#L(s)}}#s(t){const r=Xn(this.#e,t);r!==this.#e&&(this.#e=r,r.kind!=="composing"&&(this.#a=null),this.requestUpdate())}#L(t){const r=this.#e;if(r.kind!=="composing")return;this.dispatch({type:Wr,target:{type:re,id:ct(r.target)},payload:{body:t}}).ok&&this.#s({kind:"submitted"})}#x(t){const r=t.composedPath(),i=r[0];if(i instanceof Element&&i.classList.contains("ui-catcher"))return this.#M(t.clientX,t.clientY);const n=r.find(o=>o instanceof Element&&o.parentElement===this&&o.hasAttribute("data-preview-id"));return!n||!(i instanceof Element)||!n.contains(i)?null:this.#E(i,n)}#M(t,r){const i=this.#$(t,r);return i===null?null:this.#E(i.element,i.wrapper)}#$(t,r){if(typeof document.elementsFromPoint!="function")return null;const i=this.#S();for(const n of document.elementsFromPoint(t,r)){const o=i.find(s=>s.contains(n));if(o!==void 0)return{element:n,wrapper:o}}return null}#E(t,r){const i=r.getAttribute("data-preview-id");if(!i)return null;const n=Vi(t,r),o=Bi(n,r);return{element:n,target:{previewId:i,selector:o.selector,...o.text===void 0?{}:{text:o.text}}}}#S(){return Array.from(this.children).filter(t=>{const r=t.getAttribute("data-preview-id");return r!==null&&this.#o.includes(r)})}#N=t=>{if(this.#e.kind==="off")return;const r=this.#x(t);r&&(t.preventDefault(),t.stopPropagation(),this.#a=r.element,this.#s({kind:"pick",target:r.target}))};#z=t=>{if(this.#e.kind==="off")return;const r=this.#x(t);this.#w(".ui-hover",r?.element??null)};#V=()=>{this.#w(".ui-hover",null)};#Y=t=>{const r=t.composedPath()[0];if(!(r instanceof Element)||!r.classList.contains("ui-catcher"))return;const i=this.renderRoot.querySelector(".canvas");let n=this.#$(t.clientX,t.clientY)?.element??null;for(;n!==null&&n!==i;){if(to(n,t.deltaX,t.deltaY)){t.preventDefault(),n.scrollBy({left:t.deltaX,top:t.deltaY});return}n=ro(n)}};#T=t=>{t.key!=="Escape"||t.defaultPrevented||(this.#e.kind!=="off"?this.#s({kind:"exit"}):this.#m(null))};#b=()=>{this.#e.kind!=="off"&&this.#A()};#A(){if(this.#e.kind==="off")return;this.#w(".ui-picked",this.#a);const t=this.renderRoot.querySelector(".canvas");if(!t)return;const r=this.renderRoot.querySelector(".ui-catcher");r&&(r.style.width=`${t.scrollWidth}px`,r.style.height=`${t.scrollHeight}px`);for(const i of this.renderRoot.querySelectorAll(".ui-pin")){const n=this.#B(i.dataset.preview??""),s=(n?Hi(n,i.dataset.selector??""):null)?.getBoundingClientRect();if(!s||s.width===0&&s.height===0){i.hidden=!0;continue}const a=this.#I(t);i.hidden=!1,i.style.left=`${s.right-a.left}px`,i.style.top=`${s.top-a.top}px`}}#w(t,r){const i=this.renderRoot.querySelector(t),n=this.renderRoot.querySelector(".canvas");if(!i||!n)return;const o=r?.getBoundingClientRect();if(!o){i.hidden=!0;return}const s=this.#I(n);i.hidden=!1,i.style.left=`${o.left-s.left}px`,i.style.top=`${o.top-s.top}px`,i.style.width=`${o.width}px`,i.style.height=`${o.height}px`}#I(t){const r=t.getBoundingClientRect();return{left:r.left+t.clientLeft-t.scrollLeft,top:r.top+t.clientTop-t.scrollTop}}#U(){const t=this.renderRoot.querySelector(".canvas");t===this.#d||this.#l===null||(this.#d!==null&&this.#l.unobserve(this.#d),this.#d=t,t!==null&&this.#l.observe(t))}#P(){const t=this.renderRoot.querySelector('.frame[data-window="device"]'),r=t?.closest(".canvas");if(!t||!(r instanceof HTMLElement))return;const i=getComputedStyle(t),n={width:parseFloat(i.getPropertyValue("--device-width")),height:parseFloat(i.getPropertyValue("--device-height"))},o=getComputedStyle(r),s=r.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),a=this.#t?.mode==="demo",p=a?Qn*2:0,l=ln(n,{width:s-p,...a?{height:r.clientHeight-p}:{}});l!==this.#f&&(this.#f=l,this.requestUpdate())}#W(){for(const t of this.querySelectorAll(":scope > [data-preview-id]"))for(const r of t.querySelectorAll("dialog"))Ut(r),Wt(this,r)}#_=t=>{const r=t.target;!(r instanceof HTMLDialogElement)||!r.open||Array.from(this.children).some(i=>i.hasAttribute("data-preview-id")&&i.contains(r))&&(Ut(r),Wt(this,r))};#B(t){return Array.from(this.children).find(r=>r.getAttribute("data-preview-id")===t)}#H(){if(this.#y||this.renderRoot.querySelector(".stage")===null)return;this.#y=!0;const t=this.derivation.state,r=[];for(const i of Array.from(this.children)){const n=i.getAttribute("data-preview-id");if(n!==null)for(const o of i.querySelectorAll("a, [data-dpk-navigate]")){const s=Ti(t,{href:o.getAttribute("href"),navigate:o.getAttribute("data-dpk-navigate")});if(s===null)continue;const a=(o.textContent??"").replace(/\s+/g," ").trim().slice(0,40),p=o.getAttribute("data-dpk-navigate")??o.getAttribute("href")??"(no href)";r.push(` ${n}: <${o.tagName.toLowerCase()}> "${a}" \u2192 ${p} (${s})`)}}r.length!==0&&console.warn(`[dev-process-kit] <dpk-template-prototype>: ${r.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"):
2322
2427
  `+r.join(`
2323
- `))}#m(t){if(t===(this.#t?.mode??null))return;const r=this.renderRoot.querySelector(".stage"),i=this.#t?.height??r?.offsetHeight??0;this.#R(),t==="demo"&&this.#e.kind!=="off"&&this.#s({kind:"exit"}),t!==null&&(this.#t={mode:t,height:i}),t!==null&&this.#e.kind==="composing"&&(qr(this.renderRoot.querySelector(".comment-pop")),this.#u=!1),this.requestUpdate()}#R(){this.#t=null,this.#v=null}#G(){const t=this.renderRoot.querySelector(".stage");if(!(this.#t===null||!t||typeof t.showPopover!="function")&&t!==this.#v){this.#v=t;try{t.showPopover()}catch{}}}#F=t=>{const r=this.renderRoot.querySelector(".canvas");(r===null||!t.composedPath().includes(r))&&t.preventDefault()};#q(t,r){const i=Xt(t.state,t.navigation);this.#r=this.#r===null?i===null?null:Fi(i):Kt(this.#r,{kind:"observe",page:i});const n=this.#r;if(n===null)return null;const o=de(n),s=o?.kind!=="page"&&n.seen!==null;if(i===null&&!s)return null;const a=rn(n)??i;return{view:rr(t.state,n,r,a),shortcuts:o?.kind==="new-tab"?nn(t.state,a):[],switcher:this.#p,send:p=>this.#K(p)}}#n(t){if(this.#r===null)return;const r=Kt(this.#r,t);if(r===this.#r)return;this.#r=r;const i=de(r);i?.kind==="page"&&this.#j(i.page),this.requestUpdate()}#j(t){this.navigate({screen:t.screen??null,preview:t.preview??null})}#K(t){switch(t.kind){case"reload":this.#J();return;case"address":this.#X(t.input);return;case"back":case"forward":case"new-tab":this.#p=!1,this.#n({kind:t.kind});return;case"switcher":this.#p=t.open,this.requestUpdate();return;case"activate":this.#p=!1,this.#h=t.focus===!0,this.#n({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#n({kind:t.kind,id:t.id});return;case"visit":this.#n({kind:"visit",page:t.page});return;default:return}}#X(t){const r=this.#r;if(r===null)return;const i=this.derivation.state,n=rr(i,r,be(this.locale)).url||"https://page.example.com/",o=Qi(i,t,n);if(o!==null){this.#n({kind:"visit",page:o});return}const s=t.trim(),a=s.startsWith("/")?new URL(s,n).href:/^[a-z][a-z0-9+.-]*:\/\//i.test(s)?s:`https://${s}`;this.#n({kind:"unreachable",url:a})}#J(){if(this.#i!==null)return;const t=setTimeout(()=>{this.#i=null;for(const r of this.#S()){for(const i of r.querySelectorAll("form"))i.reset();for(const i of r.querySelectorAll("dialog"))i.close();r.scrollTop=0,r.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser .viewport")?.scrollTo?.({top:0}),this.requestUpdate()},Zn);this.#i={page:this.#o.join(" "),timer:t},this.requestUpdate()}#D(){this.#i!==null&&(clearTimeout(this.#i.timer),this.#i=null)}#c=t=>{if(!this.#k||this.#e.kind!=="off"||this.#r===null||t.type==="auxclick"&&t.button!==1)return;const r=this.#Z(t);if(r===null)return;const i=t.metaKey||t.ctrlKey||t.button===1;if(!r.blank&&!i)return;t.preventDefault(),t.stopPropagation();const n=Xt(this.derivation.state,Ae(this.hashFor(r.patch)));if(n===null){i||this.navigate(r.patch);return}this.#n({kind:"open-tab",entry:{kind:"page",page:n},background:i})};#Z(t){const r=t.composedPath();if(!r.some(n=>n instanceof Element&&n.parentElement===this&&n.hasAttribute("data-preview-id")))return null;for(const n of r){if(!(n instanceof Element)||n===this)break;const o=n.getAttribute("data-dpk-navigate"),s=n instanceof HTMLAnchorElement?n.getAttribute("href"):null,a=o??(s?.startsWith("#")?s:null);if(a===null)continue;const p=o!==null&&!o.includes("=")?`step=${o}`:a;return{patch:{...Ae(p)},blank:n.getAttribute("target")==="_blank"}}return null}#Q(t){return Array.from(this.querySelectorAll("[data-preview-id]")).some(r=>r.getAttribute("data-preview-id")===t)}}const xr=()=>{customElements.get("dpk-template-prototype")||customElements.define("dpk-template-prototype",kr)},io=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePrototype:kr,VIEWPORT_MIN_HEIGHT:hr,VIEWPORT_WIDTH:ur,allScreens:U,allStepIds:ft,applyPrototypeAction:gt,definePrototypeElement:xr,describePrototypeAction:yt,emptyPrototypeBase:ht,findActivity:L,findPreview:I,findScreen:C,findStep:k,findStory:$,flattenSteps:W,parsePrototypeBase:ut,prototypeAction:ie,prototypeActions:g,prototypeBaseSchema:dt,prototypeCommentTargets:Rt,prototypeDefinitionFor:Vt,prototypeMessages:be,prototypePageHeading:Dt,prototypeTargetLabel:xt,prototypeTitle:Ue,renderFrame:Ge,renderNav:sr,renderStage:gr,resolvePrototypeNavigation:ke,serializePrototypeAction:kt},Symbol.toStringTag,{value:"Module"}));export{xr as d,io as i};
2428
+ `))}#m(t){if(t===(this.#t?.mode??null))return;const r=this.renderRoot.querySelector(".stage"),i=this.#t?.height??r?.offsetHeight??0;this.#R(),t==="demo"&&this.#e.kind!=="off"&&this.#s({kind:"exit"}),t!==null&&(this.#t={mode:t,height:i}),t!==null&&this.#e.kind==="composing"&&(jr(this.renderRoot.querySelector(".comment-pop")),this.#u=!1),this.requestUpdate()}#R(){this.#t=null,this.#v=null}#G(){const t=this.renderRoot.querySelector(".stage");if(!(this.#t===null||!t||typeof t.showPopover!="function")&&t!==this.#v){this.#v=t;try{t.showPopover()}catch{}}}#F=t=>{const r=this.renderRoot.querySelector(".canvas");(r===null||!t.composedPath().includes(r))&&t.preventDefault()};#j(t,r){const i=Xt(t.state,t.navigation);this.#r=this.#r===null?i===null?null:Fi(i):Kt(this.#r,{kind:"observe",page:i});const n=this.#r;if(n===null)return null;const o=de(n),s=o?.kind!=="page"&&n.seen!==null;if(i===null&&!s)return null;const a=rn(n)??i;return{view:rr(t.state,n,r,a),shortcuts:o?.kind==="new-tab"?nn(t.state,a):[],switcher:this.#p,send:p=>this.#K(p)}}#n(t){if(this.#r===null)return;const r=Kt(this.#r,t);if(r===this.#r)return;this.#r=r;const i=de(r);i?.kind==="page"&&this.#q(i.page),this.requestUpdate()}#q(t){this.navigate({screen:t.screen??null,preview:t.preview??null})}#K(t){switch(t.kind){case"reload":this.#J();return;case"address":this.#X(t.input);return;case"back":case"forward":case"new-tab":this.#p=!1,this.#n({kind:t.kind});return;case"switcher":this.#p=t.open,this.requestUpdate();return;case"activate":this.#p=!1,this.#h=t.focus===!0,this.#n({kind:"activate",id:t.id}),this.requestUpdate();return;case"close-tab":this.#n({kind:t.kind,id:t.id});return;case"visit":this.#n({kind:"visit",page:t.page});return;default:return}}#X(t){const r=this.#r;if(r===null)return;const i=this.derivation.state,n=rr(i,r,be(this.locale)).url||"https://page.example.com/",o=Qi(i,t,n);if(o!==null){this.#n({kind:"visit",page:o});return}const s=t.trim(),a=s.startsWith("/")?new URL(s,n).href:/^[a-z][a-z0-9+.-]*:\/\//i.test(s)?s:`https://${s}`;this.#n({kind:"unreachable",url:a})}#J(){if(this.#i!==null)return;const t=setTimeout(()=>{this.#i=null;for(const r of this.#S()){for(const i of r.querySelectorAll("form"))i.reset();for(const i of r.querySelectorAll("dialog"))i.close();r.scrollTop=0,r.dispatchEvent(new CustomEvent("dpk-reload",{bubbles:!0}))}this.renderRoot.querySelector(".browser .viewport")?.scrollTo?.({top:0}),this.requestUpdate()},Zn);this.#i={page:this.#o.join(" "),timer:t},this.requestUpdate()}#D(){this.#i!==null&&(clearTimeout(this.#i.timer),this.#i=null)}#c=t=>{if(!this.#k||this.#e.kind!=="off"||this.#r===null||t.type==="auxclick"&&t.button!==1)return;const r=this.#Z(t);if(r===null)return;const i=t.metaKey||t.ctrlKey||t.button===1;if(!r.blank&&!i)return;t.preventDefault(),t.stopPropagation();const n=Xt(this.derivation.state,Ie(this.hashFor(r.patch)));if(n===null){i||this.navigate(r.patch);return}this.#n({kind:"open-tab",entry:{kind:"page",page:n},background:i})};#Z(t){const r=t.composedPath();if(!r.some(n=>n instanceof Element&&n.parentElement===this&&n.hasAttribute("data-preview-id")))return null;for(const n of r){if(!(n instanceof Element)||n===this)break;const o=n.getAttribute("data-dpk-navigate"),s=n instanceof HTMLAnchorElement?n.getAttribute("href"):null,a=o??(s?.startsWith("#")?s:null);if(a===null)continue;const p=o!==null&&!o.includes("=")?`step=${o}`:a;return{patch:{...Ie(p)},blank:n.getAttribute("target")==="_blank"}}return null}#Q(t){return Array.from(this.querySelectorAll("[data-preview-id]")).some(r=>r.getAttribute("data-preview-id")===t)}}const xr=()=>{customElements.get("dpk-template-prototype")||customElements.define("dpk-template-prototype",kr)},io=Object.freeze(Object.defineProperty({__proto__:null,DpkTemplatePrototype:kr,VIEWPORT_MIN_HEIGHT:hr,VIEWPORT_WIDTH:ur,allScreens:U,allStepIds:gt,applyPrototypeAction:ft,definePrototypeElement:xr,describePrototypeAction:yt,emptyPrototypeBase:ht,findActivity:L,findPreview:A,findScreen:C,findStep:k,findStory:$,flattenSteps:W,parsePrototypeBase:ut,prototypeAction:ie,prototypeActions:f,prototypeBaseSchema:dt,prototypeCommentTargets:Rt,prototypeDefinitionFor:Vt,prototypeMessages:be,prototypePageHeading:Dt,prototypeTargetLabel:xt,prototypeTitle:Ue,renderFrame:Ge,renderNav:sr,renderStage:fr,resolvePrototypeNavigation:ke,serializePrototypeAction:kt},Symbol.toStringTag,{value:"Module"}));export{xr as d,io as i};