koboyo 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/editor/assets/IconNote-CSELvWzx.js +1 -0
- package/assets/editor/assets/code-panel-BfsykjSz.js +43 -0
- package/assets/editor/assets/flow-layer-BC35drcK.js +1 -0
- package/assets/editor/assets/flow-panel-D_K9wgZi.js +1 -0
- package/assets/editor/assets/{index-DGJESAlV.css → index-CC2h28V_.css} +1 -1
- package/assets/editor/assets/{index-By5YsjJ8.js → index-DfNbwHl_.js} +7 -7
- package/assets/editor/assets/tool-catalog-ChSwaLIq.js +1 -0
- package/assets/editor/assets/{tool-drawer-GdbF-XpT.js → tool-drawer-CG7-cnML.js} +1 -1
- package/assets/editor/assets/tree-rq4RTGgw.js +1 -0
- package/assets/editor/index.html +4 -4
- package/dist/koboyo.js +285 -229
- package/package.json +5 -5
- package/skills/koboyo/SKILL.md +33 -1
- package/skills/koboyo/references/architecture.md +4 -4
- package/skills/koboyo/references/bpmn.md +1 -1
- package/skills/koboyo/references/chart.md +1 -1
- package/skills/koboyo/references/cycle.md +1 -1
- package/skills/koboyo/references/erd.md +1 -1
- package/skills/koboyo/references/flowchart.md +1 -1
- package/skills/koboyo/references/funnel.md +1 -1
- package/skills/koboyo/references/gantt.md +1 -1
- package/skills/koboyo/references/gitgraph.md +1 -1
- package/skills/koboyo/references/journey.md +1 -1
- package/skills/koboyo/references/matrix.md +1 -1
- package/skills/koboyo/references/mindmap.md +2 -2
- package/skills/koboyo/references/orgchart.md +1 -1
- package/skills/koboyo/references/pyramid.md +1 -1
- package/skills/koboyo/references/sankey.md +1 -1
- package/skills/koboyo/references/sequence.md +1 -1
- package/skills/koboyo/references/statemachine.md +1 -1
- package/skills/koboyo/references/timeline.md +1 -1
- package/skills/koboyo/references/venn.md +1 -1
- package/skills/koboyo/references/wireframe.md +1 -1
- package/assets/editor/assets/IconNote-C0uYQWp-.js +0 -1
- package/assets/editor/assets/code-panel-CVIEtmj2.js +0 -43
- package/assets/editor/assets/flow-layer-CGYUYmni.js +0 -1
- package/assets/editor/assets/flow-panel-BNLlwdYm.js +0 -1
- package/assets/editor/assets/tool-catalog-DOYGpvRD.js +0 -1
- package/assets/editor/assets/tree-BSe8fgqT.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-2Zwg-L3c.js";import{a as r,o as i}from"./editor-B0tARd79.js";import{S as a,Yr as o,Zt as s,an as c,w as l,x as u}from"./slides-D9bnXqtf.js";import{r as d,t as f}from"./dom-PAoZruqo.js";import{t as p}from"./editable-target-BTLnvKNi.js";import{n as m,t as h}from"./IconArrowBackUp-Brd2WpCh.js";import{t as g}from"./createReactComponent-9UsI5fmM.js";import{_,a as v,c as y,d as b,f as x,h as S,n as C,r as w,u as T}from"./tree-BSe8fgqT.js";import{t as E}from"./IconChevronLeft-BR0iwdRI.js";import{t as D}from"./IconChevronRight-DBDnxPYT.js";import{t as O}from"./IconFocusCentered-C5PcDeR0.js";import{t as k}from"./IconPencil-C5Y-Y4dC.js";import{t as A}from"./IconPlus-BbmieIBT.js";import{t as j}from"./IconX-AlbPkO_g.js";import{t as M}from"./IconPlayerPlayFilled-D4OODBX7.js";import{n as N}from"./core-CBnmD9hT.js";import{r as P}from"./flow-start-ccYJ2KB9.js";import{r as F,t as I}from"./chrome-layout-B8YmHznO.js";import{c as L,l as R,n as z,o as ee,s as B,t as te}from"./flows-GGbkNqs8.js";import{a as V,i as H,n as U,o as W,r as G,t as ne}from"./flow-stage-fiF5Nggn.js";var K=g(`outline`,`rotate`,`Rotate`,[[`path`,{d:`M19.95 11a8 8 0 1 0 -.5 4m.5 5v-5h-5`,key:`svg-0`}]]),q=g(`filled`,`player-pause-filled`,`PlayerPauseFilled`,[[`path`,{d:`M9 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z`,key:`svg-0`}],[`path`,{d:`M17 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z`,key:`svg-1`}]]),J=e(t(),1),Y=n(),X=10,Z=28,Q=.5,re=4,ie=24;function ae(e){let{frame:t,flow:n,targets:a,viewport:o}=e,s=r(),d=i(e=>e.hoveredId),f=i(e=>e.flowEdit)??{},p=F()===`docked`,m=n.steps.length;(0,J.useEffect)(()=>{let{store:e,viewportAnimation:n}=s,r=e.getState(),i=document.querySelector(`[data-canvas-root]`),a={width:(i?.clientWidth??window.innerWidth)-(p?I(`flow`):0),height:i?.clientHeight??window.innerHeight},o=c(t),d=l({x:o.x,y:o.y-Z},r.viewport),f=l({x:o.x+o.width,y:o.y+o.height},r.viewport),m=d.x>=0&&d.y>=0&&f.x<=a.width&&f.y<=a.height,h=f.x-d.x>=a.width*Q||f.y-d.y>=a.height*Q;m&&h||n.animate(r.viewport,u(o,a,64),r.setViewport)},[t.id,s,p]);let h=(0,J.useRef)(m);h.current=m,(0,J.useEffect)(()=>{let e=e=>{if(e.button!==0)return;let r=e.target instanceof Element?e.target:null;if(!r?.closest(`[data-canvas-root]`)||r.closest(`[data-overlay]`))return;let i=r.closest(`[data-shape-id]`)?.getAttribute(`data-shape-id`)??r.closest(`[data-icon-label]`)?.getAttribute(`data-icon-label`),a=s.store.getState(),o=a.shapes.find(e=>e.id===t.id);if(!i||o?.type!==`figure`)return;let c=N(a.shapes,o).find(e=>e.id===i);if(!c)return;e.preventDefault(),e.stopPropagation(),oe();let l=b({selected:a.flowEdit?.picking},h.current);if(l!==null){y(s,t.id,n.id,l,c);return}if(a.flowEdit?.picking!=null&&a.patchFlowEdit({picking:null}),e.shiftKey){v(s,t.id,n.id,c);return}w(s,t.id,n.id,c)};return window.addEventListener(`pointerdown`,e,!0),()=>window.removeEventListener(`pointerdown`,e,!0)},[s,t.id,n.id]);let[g,_]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let e=e=>_(e.shiftKey);return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,e),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,e)}},[]);let S=new Map(a.map(e=>[e.id,e])),C=d?S.get(d):void 0,E=x(f,m),D=b(f,m),O=b({selected:f.picking},m),k=T(f,m),A=b({selected:f.hovered},m),j=z(t.flows??[],n.id),M=j?.flow.steps[j.index],P=n.steps[E-1]?.target;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ce,{frame:t,viewport:o}),M&&L(M).flatMap(e=>{let t=S.get(e);return t?[(0,Y.jsx)(me,{shape:t,viewport:o},e)]:[]}),A!==null&&L(n.steps[A]).flatMap(e=>{let t=S.get(e);return t?[(0,Y.jsx)(`div`,{"data-testid":`flow-step-ring`,className:`pointer-events-none absolute rounded-md border-2 border-[var(--flow-accent)]`,style:V(t,o)},e)]:[]}),C&&(O!==null||C.id!==P||g)&&(0,Y.jsx)(`div`,{"data-testid":`flow-add-hint`,className:`pointer-events-none absolute rounded-md border-2 border-dashed border-[var(--canvas-selection)]`,style:V(C,o),children:(0,Y.jsx)(`span`,{className:`absolute -top-6 left-0 whitespace-nowrap rounded-md bg-[var(--chrome-accent)] px-1.5 py-0.5 text-[11px] font-medium text-white shadow-sm`,children:se(O,g?k:null,E,m)})}),(0,Y.jsx)(de,{flow:n,byId:S,viewport:o,slot:E}),(0,Y.jsx)(pe,{flow:n,byId:S,viewport:o,selected:D,onSelect:e=>s.store.getState().patchFlowEdit({selected:e}),onDrop:(e,r)=>y(s,t.id,n.id,e,r)}),(0,Y.jsx)(le,{picking:O,slot:E,count:m})]})}function oe(){let e=document.activeElement;e instanceof HTMLElement&&p(e)&&e.blur()}function se(e,t,n,r){return e===null?t===null?n<r?`Add as step ${n+1}`:`Add as step ${r+1}`:`Add to step ${t+1}`:`Step ${e+1} lights this`}function ce(e){let{frame:t,viewport:n}=e,r=c(t),i=l({x:r.x-X,y:r.y-Z},n),a=l({x:r.x+r.width+X,y:r.y+r.height+X},n);return(0,Y.jsx)(`div`,{"data-testid":`flow-edit-focus`,className:`pointer-events-none absolute rounded-lg ring-2 ring-[color-mix(in_srgb,var(--flow-accent)_35%,transparent)]`,style:{left:i.x,top:i.y,width:Math.max(0,a.x-i.x),height:Math.max(0,a.y-i.y)}})}function le(e){let{picking:t,slot:n,count:r}=e,i=null;return t===null?n<r&&(i=`The next box goes in as step ${n+1} · Esc adds at the end`):i=`Click the box step ${t+1} should light · Esc to cancel`,i?(0,Y.jsx)(`p`,{"data-testid":`flow-board-hint`,className:`pointer-events-none absolute bottom-6 left-1/2 z-30 -translate-x-1/2 whitespace-nowrap rounded-lg bg-[var(--chrome-fg-900)] px-3 py-2 text-[12.5px] text-[var(--chrome-page)] shadow-lg`,children:i}):null}function ue(e,t,n){for(let r of n.values()){if(r.type!==`arrow`)continue;let n=r.startBinding?.shapeId,i=r.endBinding?.shapeId;if(n===e.target&&i===t.target||n===t.target&&i===e.target)return r}return null}function de(e){let{flow:t,byId:n,viewport:i,slot:a}=e,s=r(),c=t.steps.slice(1).flatMap((e,r)=>{let i=t.steps[r],a=ue(i,e,n);return a?[{arrow:a,slot:r+1}]:[]}),u=new Map;for(let{arrow:e}of c)u.set(e.id,(u.get(e.id)??0)+1);let d=new Map;return(0,Y.jsx)(Y.Fragment,{children:c.map(({arrow:e,slot:t})=>{let n=d.get(e.id)??0;d.set(e.id,n+1);let r=(n-((u.get(e.id)??1)-1)/2)*ie,c=l(o(e),i),f=typeof e.label==`string`&&e.label.trim().length>0,p=t===a;return(0,Y.jsx)(`button`,{type:`button`,"data-overlay":!0,"data-testid":`flow-arrow-insert`,"aria-label":`Add a step between step ${t} and step ${t+1}`,title:`Add a step between ${t} and ${t+1}`,className:`absolute z-20 flex h-[18px] w-[18px] -translate-x-1/2 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full ring-1 transition-[opacity,background-color] hover:opacity-100 ${p?`bg-[var(--flow-accent)] text-white opacity-100 ring-[var(--flow-accent)]`:`bg-[var(--chrome-popup)] text-[var(--flow-accent)] opacity-60 ring-[color-mix(in_srgb,var(--flow-accent)_45%,transparent)]`}`,style:{left:c.x+r,top:c.y+(f?16:0)},onPointerDown:e=>e.stopPropagation(),onClick:()=>s.store.getState().patchFlowEdit({slot:t,picking:null}),children:(0,Y.jsx)(A,{size:11,stroke:2.5})},`${e.id}-${t}`)})})}function fe(e,t,n){for(let r of document.elementsFromPoint(e,t)){let e=r.closest(`[data-shape-id]`)?.getAttribute(`data-shape-id`)??r.closest(`[data-icon-label]`)?.getAttribute(`data-icon-label`);if(e&&n.has(e))return e}return null}function pe(e){let{flow:t,byId:n,viewport:r,selected:i,onSelect:a,onDrop:o}=e,[s,c]=(0,J.useState)(null),l=W(t),u=H(t),d=new Set(n.keys()),f=(e,t)=>{if(e.button!==0)return;e.stopPropagation(),e.preventDefault(),oe();let n=e.currentTarget.closest(`[data-canvas-root]`)?.getBoundingClientRect(),r={left:n?.left??0,top:n?.top??0};e.currentTarget.setPointerCapture(e.pointerId),c({index:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX-r.left,y:e.clientY-r.top,origin:r,dragging:!1,over:null})},p=e=>{if(!s||s.pointerId!==e.pointerId)return;let t=Math.hypot(e.clientX-s.startX,e.clientY-s.startY),n=s.dragging||t>re;c({...s,x:e.clientX-s.origin.left,y:e.clientY-s.origin.top,dragging:n,over:n?fe(e.clientX,e.clientY,d):null})},m=e=>{if(!s||s.pointerId!==e.pointerId)return;if(c(null),!s.dragging){a(s.index);return}let r=s.over?n.get(s.over):void 0;r&&r.id!==t.steps[s.index]?.target&&o(s.index,r)},h=s?.over?n.get(s.over):void 0;return(0,Y.jsxs)(Y.Fragment,{children:[h&&s&&h.id!==t.steps[s.index]?.target&&(0,Y.jsx)(`div`,{"data-testid":`flow-badge-drop`,className:`pointer-events-none absolute rounded-md border-2 border-[var(--flow-accent)] bg-[color-mix(in_srgb,var(--flow-accent)_6%,transparent)]`,style:V(h,r)}),[...l].map(([e,o])=>{let l=n.get(e);if(!l)return null;let d=G(l,r);return(0,Y.jsx)(`span`,{"data-overlay":!0,className:`absolute z-20 flex items-center gap-1 ${l.type===`arrow`?`-translate-x-1/2 -translate-y-[calc(100%+14px)]`:`-translate-x-full -translate-y-full`}`,style:{left:d.x-2,top:d.y-2},children:o.map(e=>{let n=e-1,r=s?.dragging&&s.index===n,o=i===n;return(0,Y.jsx)(`button`,{type:`button`,"data-testid":`flow-step-badge`,"data-selected":o||void 0,"aria-label":`Step ${e}: ${t.steps[n]?.title??``}`,"aria-pressed":o,title:`Click to select · drag onto another box to change it`,className:`flex h-[22px] min-w-[22px] cursor-grab touch-none items-center justify-center rounded-full px-1.5 text-[11.5px] font-semibold tabular-nums text-white transition-shadow active:cursor-grabbing ${u.has(e)?`bg-[var(--flow-fail)]`:`bg-[var(--flow-accent)]`} ${o?`ring-[3px] ring-[color-mix(in_srgb,var(--flow-accent)_35%,transparent)]`:`hover:ring-[3px] hover:ring-[color-mix(in_srgb,var(--flow-accent)_20%,transparent)]`} ${r?`opacity-35`:``}`,onPointerDown:e=>f(e,n),onPointerMove:p,onPointerUp:m,onPointerCancel:()=>c(null),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a(n))},children:e},e)})},e)}),s?.dragging&&(0,Y.jsx)(`span`,{"aria-hidden":!0,"data-testid":`flow-badge-ghost`,className:`pointer-events-none absolute z-30 flex h-[26px] min-w-[26px] -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-[var(--flow-accent)] px-1.5 text-[12.5px] font-semibold tabular-nums text-white shadow-[0_6px_14px_rgba(0,0,0,0.25)]`,style:{left:s.x,top:s.y},children:s.index+1})]})}function me(e){let{shape:t,viewport:n}=e,r=V(t,n,4);return(0,Y.jsxs)(`span`,{"data-testid":`flow-fork-marker`,className:`pointer-events-none absolute flex -translate-x-1/2 items-center gap-1 whitespace-nowrap rounded-full bg-[var(--flow-accent)] py-1 pl-1.5 pr-2.5 text-[11.5px] font-medium text-white`,style:{left:r.left+r.width/2,top:r.top+r.height+6},children:[(0,Y.jsx)(_,{size:13,stroke:2}),`Path starts here`]})}var he=2600,ge=.55,_e=1.1;function ve(e,t){let n=document.querySelector(`[data-canvas-root]`),r=n?.clientWidth??window.innerWidth,i=n?.clientHeight??window.innerHeight;return{width:Math.max(1,r-(e?I(t):0)),height:Math.max(1,i-be)}}var ye={call:`Call`,async:`Fire and forget`,reply:`Reply`},be=150;function xe(e){let{frame:t,flow:n,targets:o,step:l,viewport:d}=e,f=r(),{store:p,viewportAnimation:h}=f,g=i(e=>e.rightPanel),_=F()===`docked`,v=n.steps.length,y=Math.min(Math.max(l,0),Math.max(v-1,0)),b=n.steps[y],x=(0,J.useMemo)(()=>new Map(o.map(e=>[e.id,e])),[o]),w=(0,J.useMemo)(()=>b?L(b).flatMap(e=>x.get(e)??[]):[],[b,x]),T=(0,J.useMemo)(()=>{let e=y>0?n.steps[y-1]:void 0;return e?L(e).flatMap(e=>x.get(e)??[]):[]},[n.steps,y,x]),E=i(e=>e.flowPlay?.trail),D=i(e=>e.viewMode),O=E?.[E.length-1],k=O?t.flows?.find(e=>e.id===O.flowId)?.name:void 0,[A,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(()=>u(c(t),ve(_,g),64).zoom<ge),I=e=>{let r=Math.min(Math.max(e,0),v-1);p.getState().setFlowPlay({frameId:t.id,flowId:n.id,step:r,trail:E})},R=()=>{!O||!E||(j(!1),p.getState().setFlowPlay({frameId:t.id,flowId:O.flowId,step:O.step,trail:E.slice(0,-1)}))},z=(0,J.useRef)(R);z.current=R;let B=()=>{p.getState().setFlowPlay(null)},V=t.flows??[],H={tabs:C(V).filter(e=>e.steps.length>0).map(e=>({id:e.id,name:e.name})),active:Se(V,n.id,E),onTab:e=>{j(!1),p.getState().setFlowPlay({frameId:t.id,flowId:e,step:0})},onEdit:D?null:()=>S(f,t.id,n.id),onNew:D?null:()=>{p.getState().setFlowPlay(null),P(f,t.id)}},U=(0,J.useRef)(I);U.current=I;let W=(0,J.useRef)(B);W.current=B;let G=(0,J.useRef)(y);G.current=y;let K=()=>ve(_,g),q=(0,J.useRef)(K);if(q.current=K,(0,J.useEffect)(()=>{let e=p.getState();e.setSelectedIds(new Set),h.animate(e.viewport,u(c(t),q.current(),64),e.setViewport)},[t.id,p,h]),(0,J.useEffect)(()=>{let e=s(M?[...w,...T]:w);if(!e)return;let t=p.getState();if(M){let n=u(e,q.current(),120),r=Math.min(n.zoom,_e),i=q.current();h.animate(t.viewport,{zoom:r,x:i.width/2-(e.x+e.width/2)*r,y:i.height/2-(e.y+e.height/2)*r},t.setViewport);return}let n=a(e,t.viewport,q.current(),96);n&&h.animate(t.viewport,n,t.setViewport)},[w,T,M,p,h]),(0,J.useEffect)(()=>{let e=e=>{if((e.target instanceof Element?e.target:null)?.closest(`input, textarea, select, [contenteditable=true], [role=menu]`)||(e.key===` `||e.key===`Enter`)&&m(e.target))return;let t=G.current;if(e.key===`ArrowRight`||e.key===` `||e.key===`Enter`)e.preventDefault(),U.current(t+1);else if(e.key===`ArrowLeft`||e.key===`Backspace`){if(e.preventDefault(),t===0&&z.current){z.current();return}U.current(t-1)}else e.key===`Home`?(e.preventDefault(),U.current(0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),W.current())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,J.useEffect)(()=>{if(!A)return;if(y>=v-1||(b?.branches?.length??0)>0){j(!1);return}let e=window.setTimeout(()=>U.current(G.current+1),he);return()=>window.clearTimeout(e)},[A,y,v,b]),!b)return(0,Y.jsx)(Ce,{flow:n,index:0,kind:`call`,autoplay:!1,onAutoplay:()=>{},onGo:()=>{},onStop:B,branches:[],onBranch:()=>{},returnName:k??null,onBack:R,follow:M,onFollow:N,switcher:H});let X=te(t.flows??[],n.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ne,{frameId:t.id,flow:n,targets:o,index:y,viewport:d,lead:X}),(0,Y.jsx)(Ce,{flow:n,index:y,kind:ee(o,[...X,...n.steps],X.length+y),autoplay:A,onAutoplay:j,onGo:I,onStop:B,branches:(b.branches??[]).flatMap(e=>{let r=t.flows?.find(t=>t.id===e&&t.id!==n.id);return r&&r.steps.length>0?[{id:r.id,name:r.name}]:[]}),onBranch:e=>{j(!1),p.getState().setFlowPlay({frameId:t.id,flowId:e,step:0,trail:[...E??[],{flowId:n.id,step:y}]})},returnName:k??null,onBack:R,follow:M,onFollow:N,switcher:H})]})}function Se(e,t,n){let r=n?.[0]?.flowId;if(r)return r;let i=t,a=new Set;for(;!a.has(i);){a.add(i);let t=z(e,i);if(!t)return i;i=t.flow.id}return i}function Ce(e){let{flow:t,index:n,kind:r,autoplay:i,onAutoplay:a,onGo:o,onStop:s,branches:c,onBranch:l}=e,{returnName:u,onBack:d,follow:f,onFollow:p,switcher:m}=e,g=t.steps.length,v=t.steps[n],y=n>=g-1,b=`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] disabled:pointer-events-none disabled:opacity-35`;return(0,Y.jsxs)(`div`,{"data-overlay":!0,"data-testid":`flow-player`,className:`absolute bottom-6 left-1/2 z-30 flex w-[min(600px,calc(100%-32px))] -translate-x-1/2 flex-col gap-2 rounded-2xl bg-[var(--chrome-popup)] p-3 shadow-[0_8px_32px_rgba(0,0,0,0.16)] ring-1 ring-[var(--chrome-ring)]`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(Te,{switcher:m}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full px-1.5 text-[12px] font-medium tabular-nums text-white ${v?.fails?`bg-[var(--flow-fail)]`:`bg-[var(--flow-accent)]`}`,children:g===0?`–`:n+1}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{"data-testid":`flow-step-title`,className:`text-[14px] font-medium leading-snug text-[var(--chrome-fg-900)]`,children:v?.title||(g===0?`This flow has no steps yet`:`Untitled step`)}),v?.text&&(0,Y.jsx)(`p`,{"data-testid":`flow-step-text`,className:`mt-0.5 text-[13px] leading-relaxed text-[var(--chrome-fg-600)]`,children:v.text}),v&&(r!==`call`||v.payload||v.fails)&&(0,Y.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--chrome-fg-500)]`,children:[v.fails&&(0,Y.jsx)(`span`,{"data-testid":`flow-step-fails`,className:`rounded-full bg-[color-mix(in_srgb,var(--flow-fail)_14%,transparent)] px-2 py-0.5 font-medium text-[var(--flow-fail)]`,children:`Fails here`}),r!==`call`&&(0,Y.jsx)(`span`,{"data-testid":`flow-step-kind`,className:`rounded-full bg-[var(--chrome-rest)] px-2 py-0.5`,children:ye[r]}),v.payload&&(0,Y.jsxs)(`span`,{className:`rounded-full bg-[var(--chrome-rest)] px-2 py-0.5`,children:[`Carries `,v.payload]})]}),c.length>0&&(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,"data-testid":`flow-branches`,children:[(0,Y.jsx)(`span`,{className:`text-[12px] text-[var(--chrome-fg-500)]`,children:`Or follow:`}),c.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-testid":`flow-branch`,className:`flex cursor-pointer items-center gap-1 rounded-full px-2.5 py-1 text-[12px] font-medium text-[var(--chrome-fg-900)] bg-[var(--chrome-rest)] transition-colors hover:bg-[var(--chrome-hover)]`,onClick:()=>l(e.id),children:[(0,Y.jsx)(_,{size:12,stroke:2}),e.name]},e.id))]})]}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Stop playing`,className:b,onClick:s,children:(0,Y.jsx)(j,{size:16,stroke:1.75})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 truncate text-[12px] text-[var(--chrome-fg-500)]`,children:[u&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,"data-testid":`flow-back`,title:`Back to where this path was taken (←)`,className:`flex cursor-pointer items-center gap-0.5 rounded px-1 font-medium text-[var(--chrome-fg-900)] hover:bg-[var(--chrome-hover)]`,onClick:d,children:[(0,Y.jsx)(h,{size:13,stroke:2}),u]}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`/`})]}),(u||!m.tabs.some(e=>e.id===t.id)||!we(m))&&(0,Y.jsx)(`span`,{className:`truncate`,children:t.name})]}),(0,Y.jsx)(`div`,{className:`flex items-center gap-1`,"data-testid":`flow-dots`,children:t.steps.map((e,t)=>(0,Y.jsx)(`button`,{type:`button`,"aria-label":e.branches?.length?`Step ${t+1}, where another path starts`:`Step ${t+1}`,"data-fork":e.branches?.length?!0:void 0,onClick:()=>o(t),className:`relative h-1.5 cursor-pointer rounded-full transition-all ${t===n?`w-4 bg-[var(--flow-accent)]`:`w-1.5 bg-[var(--chrome-fg-300)] hover:bg-[var(--chrome-fg-500)]`}`,children:e.branches?.length?(0,Y.jsx)(_,{size:9,stroke:2.5,"aria-hidden":!0,className:`absolute left-1/2 top-2 -translate-x-1/2 text-[var(--chrome-fg-400)]`}):null},`${e.target}-${t}`))}),(0,Y.jsx)(`span`,{"data-testid":`flow-position`,className:`w-10 text-right text-[12px] tabular-nums text-[var(--chrome-fg-500)]`,children:g===0?`0 / 0`:`${n+1} / ${g}`}),(0,Y.jsxs)(`div`,{className:`flex items-center`,children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Previous step`,"data-testid":`flow-prev`,className:b,disabled:n===0&&!u,onClick:()=>n===0?d():o(n-1),children:(0,Y.jsx)(E,{size:16,stroke:2})}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":f?`Show the whole diagram`:`Follow each step`,title:f?`Show the whole diagram`:`Follow each step`,"aria-pressed":f,"data-testid":`flow-follow`,className:`${b} ${f?`bg-[var(--chrome-active)] text-[var(--chrome-fg-900)]`:``}`,onClick:()=>p(!f),children:(0,Y.jsx)(O,{size:16,stroke:1.75})}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":i?`Pause`:`Play automatically`,"data-testid":`flow-autoplay`,className:b,disabled:g<2,onClick:()=>{!i&&y&&o(0),a(!i)},children:i?(0,Y.jsx)(q,{size:14}):(0,Y.jsx)(M,{size:14})}),y&&g>1?(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Play again`,"data-testid":`flow-replay`,className:b,onClick:()=>o(0),children:(0,Y.jsx)(K,{size:15,stroke:1.75})}):(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Next step`,"data-testid":`flow-next`,className:b,disabled:y,onClick:()=>o(n+1),children:(0,Y.jsx)(D,{size:16,stroke:2})})]})]})]})}function we(e){return e.tabs.length>1||e.onEdit!==null}function Te(e){let{tabs:t,active:n,onTab:r,onEdit:i,onNew:a}=e.switcher;if(!we(e.switcher))return null;let o=`shrink-0 cursor-pointer rounded-md px-2 py-1 text-[12.5px] transition-colors hover:bg-[var(--chrome-hover)]`;return(0,Y.jsxs)(`div`,{className:`-mx-1 -mt-1 flex items-center gap-1 border-b border-[var(--chrome-divider)] pb-1.5`,children:[(0,Y.jsxs)(`div`,{role:`group`,"aria-label":`Flows`,"data-testid":`flow-tabs`,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto`,children:[t.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":e.id===n,"data-testid":`flow-tab`,className:`${o} ${e.id===n?`bg-[var(--chrome-active)] font-medium text-[var(--chrome-fg-900)]`:`text-[var(--chrome-fg-500)]`}`,onClick:()=>r(e.id),children:e.name},e.id)),a&&(0,Y.jsx)(`button`,{type:`button`,"aria-label":`New flow`,title:`New flow`,"data-testid":`flow-tab-new`,className:`${o} flex items-center text-[var(--chrome-fg-400)]`,onClick:a,children:(0,Y.jsx)(A,{size:14,stroke:2})})]}),i&&(0,Y.jsxs)(`button`,{type:`button`,"data-testid":`flow-player-edit`,className:`flex shrink-0 cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[12.5px] font-medium text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-hover)]`,onClick:i,children:[(0,Y.jsx)(k,{size:13,stroke:1.75}),`Edit`]})]})}var $=10,Ee=28,De=.28;function Oe(e){let{viewport:t}=e,{store:n}=r(),a=i(e=>e.shapes),o=i(e=>e.flowEdit),s=i(e=>e.flowPlay),c=i(e=>e.flowPreview),l=s??o??c,u=(0,J.useMemo)(()=>{let e=l?a.find(e=>e.id===l.frameId):void 0;return e?.type===`figure`?e:null},[a,l]),d=(0,J.useMemo)(()=>u?N(a,u):[],[a,u]),f=u?.flows?.find(e=>e.id===l?.flowId),p=(0,J.useMemo)(()=>f?B(f,d):null,[f,d]);return(0,J.useEffect)(()=>{if(!l||u&&f)return;let e=n.getState();e.setFlowPlay(null),e.setFlowEdit(null),e.setFlowPreview(null)},[l,u,f,n]),!l||!u||!p?null:s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ke,{frame:u,viewport:t}),(0,Y.jsx)(xe,{frame:u,flow:p,targets:d,step:s.step,viewport:t})]}):o?(0,Y.jsx)(ae,{frame:u,flow:p,targets:d,viewport:t}):(0,Y.jsx)(Ae,{flow:p,targets:d,viewport:t})}function ke(e){let{frame:t,viewport:n}=e,r=c(t),i=l({x:r.x-$,y:r.y-Ee},n),a=l({x:r.x+r.width+$,y:r.y+r.height+$},n);return(0,Y.jsx)(`div`,{"data-testid":`flow-spotlight`,className:`pointer-events-none absolute rounded-lg`,style:{left:i.x,top:i.y,width:Math.max(0,a.x-i.x),height:Math.max(0,a.y-i.y),boxShadow:`0 0 0 9999px var(--canvas-scrim)`}})}function Ae(e){let{flow:t,targets:n,viewport:r}=e,i=(0,J.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`style`,{"data-testid":`flow-preview`,children:(0,J.useMemo)(()=>{let e=new Set(t.steps.flatMap(L));t.steps.forEach((r,i)=>{let a=t.steps[i-1];if(a)for(let t of L(r))for(let r of L(a)){let i=R(n,r,t);if(i?.kind===`arrows`){i.hops.forEach(t=>e.add(t.arrow.id)),i.through.forEach(t=>e.add(t));break}}});let r=n.filter(t=>!e.has(t.id)&&t.type!==`figure`).flatMap(e=>[d(e.id),f(`data-icon-label`,e.id)]);return[`[data-canvas-root] :is([data-shape-id],[data-icon-label]){transition:opacity 180ms ease}`,r.length>0?`${r.join(`,`)}{opacity:${De}!important}`:``].join(``)},[t.steps,n])}),(0,Y.jsx)(U,{numbers:W(t),byId:i,viewport:r,current:null,failing:H(t)})]})}export{Oe as FlowLayer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-2Zwg-L3c.js";import{t as r}from"./tooltip-DgEojto1.js";import{D as i,E as a,T as o,g as s,h as c,i as l,l as u,m as d,o as f,p,r as m,t as h}from"./menu-BPrc8Ara.js";import{i as g}from"./config-a_lz-57R.js";import{a as _,o as v}from"./editor-B0tARd79.js";import{k as y}from"./slides-D9bnXqtf.js";import{t as b}from"./editable-target-BTLnvKNi.js";import{t as x}from"./createReactComponent-9UsI5fmM.js";import{t as S}from"./IconAlertTriangle-CxPhYpe-.js";import{n as C,r as w,t as T}from"./IconTrash-DbN_RxB7.js";import{_ as E,d as D,f as O,g as k,h as A,i as j,l as ee,m as M,o as te,p as ne,s as re,t as N,u as ie}from"./tree-BSe8fgqT.js";import{n as P}from"./useValueChanged-p8z-93L4.js";import{t as ae}from"./IconChevronLeft-BR0iwdRI.js";import{t as F}from"./IconChevronRight-DBDnxPYT.js";import{i as I,n as oe,r as L,t as se}from"./use-drag-reorder-C3h4ZMoZ.js";import{t as ce}from"./IconNote-C0uYQWp-.js";import{t as R}from"./IconPencil-C5Y-Y4dC.js";import{t as z}from"./IconPlus-BbmieIBT.js";import{n as B,r as V,t as H}from"./MenuSubmenuTrigger-CpN67g09.js";import{t as le}from"./IconSparkles-WDcg8BA9.js";import{t as U}from"./IconX-AlbPkO_g.js";import{t as ue}from"./IconPlayerPlayFilled-D4OODBX7.js";import{n as de,r as fe,t as W}from"./core-CBnmD9hT.js";import{n as G,r as K}from"./flow-start-ccYJ2KB9.js";import{n as pe}from"./surface-Dke4SWpE.js";import{a as q}from"./chrome-C2RCq3SI.js";import"./chrome-layout-B8YmHznO.js";import{t as me}from"./panel-shell-CG2aq4Ia.js";import{i as he,n as ge,s as _e}from"./flows-GGbkNqs8.js";var ve=x(`outline`,`arrows-exchange`,`ArrowsExchange`,[[`path`,{d:`M7 10h14l-4 -4`,key:`svg-0`}],[`path`,{d:`M17 14h-14l4 4`,key:`svg-1`}]]),J=x(`outline`,`package`,`Package`,[[`path`,{d:`M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5`,key:`svg-0`}],[`path`,{d:`M12 12l8 -4.5`,key:`svg-1`}],[`path`,{d:`M12 12l0 9`,key:`svg-2`}],[`path`,{d:`M12 12l-8 -4.5`,key:`svg-3`}],[`path`,{d:`M16 5.25l-8 4.5`,key:`svg-4`}]]),Y=e(t(),1),X=`w-full min-w-0 rounded-md bg-transparent px-1.5 py-1 text-[12px] text-[var(--chrome-fg-800)] outline-none ring-1 ring-transparent transition-shadow placeholder:text-[var(--chrome-fg-300)] hover:ring-[var(--chrome-ring)] focus:bg-[var(--chrome-rest)] focus:ring-[var(--chrome-fg-300)]`,ye=`flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-[12px] text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] disabled:pointer-events-none disabled:text-[var(--chrome-fg-300)]`,be=`flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--chrome-fg-400)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-800)] disabled:pointer-events-none disabled:opacity-40`,xe=`flex h-9 w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--chrome-accent)] text-[13px] text-white transition-colors hover:bg-[var(--chrome-accent-hover)] disabled:pointer-events-none disabled:bg-[var(--chrome-hover)] disabled:text-[var(--chrome-fg-400)]`,Se=`flex cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-[13px] text-[var(--chrome-fg-700)] ring-1 ring-[var(--chrome-ring)] transition-colors hover:bg-[var(--chrome-rest)] hover:text-[var(--chrome-fg-900)] disabled:pointer-events-none disabled:opacity-50`,Z=n(),Ce=[{kind:`call`,label:`Call`,hint:`Waits for an answer`,pickable:!0},{kind:`async`,label:`Fire and forget`,hint:`Doesn't wait for an answer`,pickable:!0},{kind:`reply`,label:`Reply`,hint:`Answers an earlier step`,pickable:!1}],we=e=>Ce.find(t=>t.kind===e)?.label;function Te(e){let{step:t,index:n,count:r,current:a,selected:o,picking:s,names:c,otherFlows:l}=e,{actions:u,grip:d,rowRef:p,rowStyle:m}=e,{onPlay:h,onChange:g,onMove:_,onRemove:v,onNewPath:y}=u,[b,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),T=t.kind??`call`,D=t.also??[],O=t.branches??[],k=new Map(l.map(e=>[e.id,e.name])),A=b||!!t.text,j=C||!!t.payload,ee=D.length>0||T!==`call`||j||t.fails||O.length>0;return(0,Z.jsxs)(`li`,{ref:p,"data-testid":`flow-step-${n}`,"data-current":a||void 0,"data-selected":o||void 0,"aria-current":o?`step`:void 0,className:`group relative flex gap-2.5 rounded-lg py-2.5 pl-5 pr-2 transition-colors ${s?`bg-[color-mix(in_srgb,var(--flow-accent)_10%,transparent)] ring-1 ring-[color-mix(in_srgb,var(--flow-accent)_45%,transparent)]`:o?`bg-[color-mix(in_srgb,var(--flow-accent)_8%,transparent)] ring-1 ring-[color-mix(in_srgb,var(--flow-accent)_30%,transparent)]`:a?`bg-[var(--chrome-active)]`:`hover:bg-[var(--chrome-rest)]`}`,style:m,onPointerDown:e=>{e.target.closest(`[data-step-insert]`)||u.onSelect()},onFocusCapture:e=>{e.target.closest(`[data-step-insert]`)||u.onSelect()},onPointerEnter:()=>u.onHover(!0),onPointerLeave:()=>u.onHover(!1),children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Add a step before step ${n+1}`,title:`Add a step here`,"data-testid":`flow-step-insert-${n}`,"data-step-insert":!0,className:`absolute -top-2.5 left-1/2 z-10 flex h-5 w-5 -translate-x-1/2 cursor-pointer items-center justify-center rounded-full bg-[var(--chrome-popup)] text-[var(--flow-accent)] opacity-0 ring-1 ring-[color-mix(in_srgb,var(--flow-accent)_40%,transparent)] transition-opacity hover:bg-[color-mix(in_srgb,var(--flow-accent)_10%,var(--chrome-popup))] focus-visible:opacity-100 group-hover:opacity-100`,onPointerDown:e=>e.stopPropagation(),onClick:u.onInsertBefore,children:(0,Z.jsx)(z,{size:11,stroke:2.5})}),(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`flow-step-grip-${n}`,title:`Drag to reorder`,className:`absolute bottom-0 left-0 top-0 flex w-5 cursor-grab touch-none items-center justify-center text-[var(--chrome-fg-300)] opacity-0 transition-opacity active:cursor-grabbing group-hover:opacity-100`,...d,children:(0,Z.jsx)(I,{size:13,stroke:1.75})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Play from step ${n+1}`,title:`Play from this step`,onClick:h,className:`mt-px flex h-6 min-w-6 shrink-0 cursor-pointer items-center justify-center rounded-full px-1.5 text-[12px] font-semibold tabular-nums text-white transition-shadow hover:ring-4 hover:ring-[color-mix(in_srgb,var(--flow-accent)_20%,transparent)] ${t.fails?`bg-[var(--flow-fail)]`:`bg-[var(--flow-accent)]`}`,children:n+1}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-6`,children:[(0,Z.jsx)(`input`,{"aria-label":`Step title`,"data-testid":`flow-step-title-${n}`,className:`${X} -mx-1.5 h-6 px-1.5 text-[13px] font-semibold text-[var(--chrome-fg-900)]`,defaultValue:t.title,onBlur:e=>{e.target.value!==t.title&&g({title:e.target.value})},onKeyDown:Ne},`t-${t.title}`),A&&(0,Z.jsx)(`textarea`,{autoFocus:b&&!t.text,"aria-label":`What happens at this step`,"data-testid":`flow-step-text-${n}`,rows:1,className:`w-full min-w-0 rounded-md bg-transparent px-1.5 py-1 text-[12px] text-[var(--chrome-fg-800)] outline-none ring-1 ring-transparent transition-shadow placeholder:text-[var(--chrome-fg-300)] hover:ring-[var(--chrome-ring)] focus:bg-[var(--chrome-rest)] focus:ring-[var(--chrome-fg-300)] -mx-1.5 resize-none px-1.5 text-[12px] leading-relaxed text-[var(--chrome-fg-600)] [field-sizing:content]`,placeholder:`What happens here`,defaultValue:t.text??``,onBlur:e=>{let n=e.target.value.trim();n!==(t.text??``)&&g({text:n}),n||x(!1)},onKeyDown:Ne},`d-${t.text??``}`),ee&&(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,"data-testid":`flow-step-chips-${n}`,children:[T!==`call`&&(0,Z.jsx)(ke,{kind:T,onPick:e=>g({kind:e}),trigger:(0,Z.jsxs)(f,{"data-testid":`flow-step-kind-${n}`,className:`${Q} cursor-pointer hover:bg-[var(--chrome-hover)]`,children:[we(T),(0,Z.jsx)(i,{size:11,stroke:2,className:`text-[var(--chrome-fg-400)]`})]})}),j&&(0,Z.jsx)(Oe,{index:n,payload:t.payload,editing:C,onEdit:()=>w(!0),onDone:e=>{w(!1),e!==(t.payload??``)&&g({payload:e||void 0})}}),t.fails&&(0,Z.jsx)(De,{testId:`flow-step-fails-${n}`,tone:`fail`,icon:(0,Z.jsx)(S,{size:11,stroke:2}),label:`Fails here`,onRemove:()=>g({fails:void 0})}),D.map(e=>(0,Z.jsx)(De,{icon:(0,Z.jsx)(z,{size:11,stroke:2}),label:c.get(e)??`Shape`,title:`Part of this step`,onRemove:()=>g({also:D.filter(t=>t!==e)})},e)),O.map(e=>(0,Z.jsx)(De,{testId:`flow-step-path-${n}`,icon:(0,Z.jsx)(E,{size:11,stroke:2}),label:k.get(e)??`Missing flow`,title:`Another path from here`,onRemove:()=>g({branches:O.filter(t=>t!==e)})},e))]})]}),(0,Z.jsx)(Me,{index:n,count:r,step:t,hasNote:A,hasPayload:j,paths:l.filter(e=>!O.includes(e.id)),onNote:()=>x(!0),onPayload:()=>w(!0),onChange:g,onMove:_,onRemove:v,onNewPath:y,onInsertBefore:u.onInsertBefore,onInsertAfter:u.onInsertAfter,onChangeBox:u.onChangeBox})]})}var Q=`flex h-6 items-center gap-1 rounded-md bg-[var(--chrome-rest)] px-1.5 text-[11.5px] text-[var(--chrome-fg-700)] ring-1 ring-[var(--chrome-ring)]`,$=`flex cursor-default select-none items-center gap-2 rounded-lg px-2 py-1.5 text-[13px] text-[var(--chrome-fg-700)] outline-none data-[highlighted]:bg-[var(--chrome-hover)]`,Ee=`min-w-[200px] p-1 outline-none ${pe.popup}`;function De(e){let{label:t,icon:n,onRemove:r,testId:i,title:a,tone:o}=e;return(0,Z.jsxs)(`span`,{"data-testid":i,title:a,className:`${Q} pr-0.5 ${o===`fail`?`bg-[color-mix(in_srgb,var(--flow-fail)_10%,transparent)] text-[var(--flow-fail)] ring-[color-mix(in_srgb,var(--flow-fail)_25%,transparent)]`:``}`,children:[(0,Z.jsx)(`span`,{className:`opacity-70`,children:n}),(0,Z.jsx)(`span`,{className:`max-w-[140px] truncate`,children:t}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${t}`,className:`flex h-4 w-4 cursor-pointer items-center justify-center rounded opacity-60 hover:bg-[var(--chrome-hover)] hover:opacity-100`,onClick:r,children:(0,Z.jsx)(U,{size:10,stroke:2})})]})}function Oe(e){let{index:t,payload:n,editing:r,onEdit:i,onDone:a}=e;return r?(0,Z.jsxs)(`span`,{className:`${Q} pr-1`,children:[(0,Z.jsx)(J,{size:11,stroke:2,className:`opacity-70`}),(0,Z.jsx)(`input`,{autoFocus:!0,"data-testid":`flow-step-payload-${t}`,"aria-label":`What this step carries`,placeholder:`e.g. order #1042`,className:`w-28 bg-transparent text-[11.5px] outline-none placeholder:text-[var(--chrome-fg-400)]`,defaultValue:n??``,onBlur:e=>a(e.target.value.trim()),onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===`Escape`)&&e.currentTarget.blur()}})]}):(0,Z.jsxs)(`span`,{className:`${Q} pr-0.5`,"data-testid":`flow-step-payload-chip-${t}`,children:[(0,Z.jsx)(J,{size:11,stroke:2,className:`opacity-70`}),(0,Z.jsx)(`button`,{type:`button`,title:`What this step carries`,className:`max-w-[140px] cursor-text truncate`,onClick:i,children:n}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove what it carries`,className:`flex h-4 w-4 cursor-pointer items-center justify-center rounded opacity-60 hover:bg-[var(--chrome-hover)] hover:opacity-100`,onClick:()=>a(``),children:(0,Z.jsx)(U,{size:10,stroke:2})})]})}function ke(e){let{kind:t,onPick:n,trigger:r}=e;return(0,Z.jsxs)(u,{children:[r,(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{side:`bottom`,align:`start`,sideOffset:4,className:`z-50 outline-none`,children:(0,Z.jsx)(m,{"data-overlay":!0,className:`min-w-[220px] p-1`,children:(0,Z.jsx)(Ae,{kind:t,onPick:n})})})})]})}function Ae(e){let{kind:t,onPick:n}=e;return(0,Z.jsx)(Z.Fragment,{children:Ce.filter(e=>e.pickable).map(e=>(0,Z.jsxs)(s,{"data-testid":`flow-kind-${e.kind}`,className:$,onClick:()=>n(e.kind===`call`?void 0:e.kind),children:[(0,Z.jsx)(`span`,{className:`flex w-4 justify-center text-[var(--chrome-fg-900)]`,children:t===e.kind&&(0,Z.jsx)(P,{size:14,stroke:2})}),(0,Z.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--chrome-fg-900)]`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-400)]`,children:e.hint})]})]},e.kind))})}function je(e){let{label:t,icon:n,testId:r,children:i}=e;return(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(H,{className:`${$} justify-between`,"data-testid":r,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:n}),t]}),(0,Z.jsx)(F,{size:14,stroke:1.75,className:`text-[var(--chrome-fg-400)]`})]}),(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{className:`z-50 outline-none`,children:(0,Z.jsx)(c,{"data-overlay":!0,className:Ee,children:i})})})]})}function Me(e){let{index:t,count:n,step:r,hasNote:i,hasPayload:o,paths:c}=e,{onNote:g,onPayload:_,onChange:v,onMove:y,onRemove:b,onNewPath:x}=e,{onInsertBefore:D,onInsertAfter:O,onChangeBox:k}=e,A=r.branches??[];return(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{"aria-label":`Step options`,"data-testid":`flow-step-menu-${t}`,className:`${be} absolute right-1.5 top-2 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 data-[popup-open]:opacity-100`,children:(0,Z.jsx)(a,{size:14,stroke:1.75})}),(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{side:`bottom`,align:`end`,sideOffset:4,className:`z-50 outline-none`,children:(0,Z.jsxs)(m,{"data-overlay":!0,className:`min-w-[210px] p-1`,children:[(0,Z.jsx)(h,{testId:`flow-step-change-box`,icon:(0,Z.jsx)(ve,{size:15,stroke:1.75}),onClick:k,children:`Change box…`}),(0,Z.jsx)(h,{testId:`flow-step-insert-above`,icon:(0,Z.jsx)(oe,{size:15,stroke:1.75}),onClick:D,children:`Add a step above`}),(0,Z.jsx)(h,{testId:`flow-step-insert-below`,icon:(0,Z.jsx)(L,{size:15,stroke:1.75}),onClick:O,children:`Add a step below`}),(0,Z.jsx)(l,{}),!i&&(0,Z.jsx)(h,{testId:`flow-step-add-note`,icon:(0,Z.jsx)(ce,{size:15,stroke:1.75}),onClick:g,children:`Add a note`}),(0,Z.jsx)(je,{label:`How it travels`,icon:(0,Z.jsx)(V,{size:15,stroke:1.75}),testId:`flow-step-travels`,children:(0,Z.jsx)(Ae,{kind:r.kind??`call`,onPick:e=>v({kind:e})})}),!o&&(0,Z.jsx)(h,{testId:`flow-step-add-payload`,icon:(0,Z.jsx)(J,{size:15,stroke:1.75}),onClick:_,children:`Add what it carries`}),(0,Z.jsx)(h,{testId:`flow-step-toggle-fails`,icon:(0,Z.jsx)(S,{size:15,stroke:1.75}),onClick:()=>v({fails:!r.fails||void 0}),children:r.fails?`Doesn't fail here`:`Fails here`}),(0,Z.jsxs)(je,{label:`Another path from here`,icon:(0,Z.jsx)(E,{size:15,stroke:1.75}),testId:`flow-step-paths`,children:[c.map(e=>(0,Z.jsx)(s,{className:$,onClick:()=>v({branches:[...A,e.id]}),children:e.name},e.id)),c.length>0&&(0,Z.jsx)(l,{}),(0,Z.jsxs)(s,{className:$,"data-testid":`flow-step-new-path`,onClick:x,children:[(0,Z.jsx)(z,{size:14,stroke:1.75,className:`text-[var(--chrome-fg-400)]`}),`New path`]})]}),(0,Z.jsx)(l,{}),(0,Z.jsx)(h,{testId:`flow-step-up`,icon:(0,Z.jsx)(C,{size:15,stroke:1.75}),disabled:t===0,onClick:()=>y(-1),children:`Move up`}),(0,Z.jsx)(h,{testId:`flow-step-down`,icon:(0,Z.jsx)(w,{size:15,stroke:1.75}),disabled:t===n-1,onClick:()=>y(1),children:`Move down`}),(0,Z.jsx)(h,{testId:`flow-step-remove`,icon:(0,Z.jsx)(T,{size:15,stroke:1.75}),onClick:b,children:`Remove step`})]})})})]})}function Ne(e){e.stopPropagation(),(e.key===`Enter`&&!e.shiftKey||e.key===`Escape`)&&e.currentTarget.blur()}function Pe(){let e=_(),{store:t}=e,n=v(e=>e.shapes),i=v(e=>e.viewMode),a=(0,Y.useMemo)(()=>fe(n),[n]),o=(0,Y.useMemo)(()=>y(n).filter(e=>W(n,[e])?.id===e.id),[n]),s=()=>t.getState().setFlowsOpen(!1),c=(e,n)=>t.getState().setFlowPreview(n?{frameId:e,flowId:n}:null);return(0,Y.useEffect)(()=>()=>t.getState().setFlowPreview(null),[t]),(0,Z.jsxs)(me,{width:300,testId:`flow-list`,ariaLabel:`Flows`,onDismiss:s,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 py-2 pl-4 pr-2`,children:[(0,Z.jsx)(`span`,{className:`flex-1 text-[14px] font-medium text-[var(--chrome-fg-900)]`,children:`Flows`}),!i&&o.length>0&&(0,Z.jsx)(Le,{frames:o,onPick:t=>K(e,t.id)}),(0,Z.jsx)(r,{label:`Close`,side:`bottom`,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close flows`,"data-testid":`flow-list-close`,onClick:s,className:q,children:(0,Z.jsx)(U,{size:16,stroke:1.75})})})]}),(0,Z.jsx)(`div`,{className:`mx-3 h-px bg-[var(--chrome-divider)]`}),(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-4 overflow-y-auto p-3`,children:a.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-3 py-8 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-balance text-[13px] font-medium text-[var(--chrome-fg-900)]`,children:`No flows yet`}),(0,Z.jsx)(`p`,{className:`text-balance text-[12px] leading-relaxed text-[var(--chrome-fg-500)]`,children:o.length>0?`A flow walks people through a diagram, one step at a time.`:`Put a diagram in a frame, then add a flow to it.`})]}):a.map(n=>(0,Z.jsxs)(`section`,{className:`flex flex-col gap-0.5`,onPointerLeave:()=>c(n.id,null),children:[(0,Z.jsx)(`h3`,{className:`truncate px-2 pb-1 text-[11px] font-medium text-[var(--chrome-fg-400)]`,children:n.label||`Untitled frame`}),N(n.flows??[]).map(({flow:r,depth:a,origin:o})=>(0,Z.jsx)(Fe,{flow:r,depth:a,forkStep:o?o.index+1:null,viewMode:i,onPreview:e=>c(n.id,e?r.id:null),onPlay:()=>G(e,n.id,r.id),onOpen:()=>t.getState().setFlowEdit({frameId:n.id,flowId:r.id})},r.id))]},n.id))})]})}function Fe(e){let{flow:t,depth:n,forkStep:i,viewMode:a,onPreview:o,onPlay:s,onOpen:c}=e,l=t.steps.length,u=t.steps.some(e=>e.fails),d=`${l} ${l===1?`step`:`steps`}`;return(0,Z.jsxs)(`div`,{"data-testid":`flow-list-row`,className:`group flex items-center gap-2 rounded-lg py-1.5 pr-1.5 transition-colors hover:bg-[var(--chrome-rest)]`,style:{paddingLeft:8+n*18},onPointerEnter:()=>o(!0),children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-[var(--chrome-fg-400)]`,children:n>0?(0,Z.jsx)(E,{size:14,stroke:1.75}):(0,Z.jsx)(V,{size:14,stroke:1.75})}),(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`flow-list-open`,title:a?`Play ${t.name}`:`Edit ${t.name}`,className:`flex min-w-0 flex-1 cursor-pointer flex-col text-left`,onFocus:()=>o(!0),onBlur:()=>o(!1),onClick:a?s:c,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium text-[var(--chrome-fg-900)]`,children:t.name}),u&&(0,Z.jsx)(`span`,{title:`Shows something failing`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--flow-fail)]`})]}),(0,Z.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-400)]`,children:i===null?d:`From step ${i} · ${d}`})]}),l>0&&(0,Z.jsx)(r,{label:`Play`,side:`left`,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Play ${t.name}`,"data-testid":`flow-list-play`,className:`flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-[var(--flow-accent)] text-white opacity-90 transition-opacity hover:opacity-100`,onClick:s,children:(0,Z.jsx)(ue,{size:11})})})]})}var Ie=`flex h-7 cursor-pointer items-center gap-1 rounded-md px-2 text-[12.5px] font-medium text-[var(--flow-accent)] transition-colors hover:bg-[var(--chrome-hover)]`;function Le(e){let{frames:t,onPick:n}=e,r=t.length===1?t[0]:void 0;return r?(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`flow-list-new`,title:`New flow on ${r.label||`the frame`}`,className:Ie,onClick:()=>n(r),children:[(0,Z.jsx)(z,{size:14,stroke:2}),`New`]}):(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(f,{"data-testid":`flow-list-new`,className:Ie,children:[(0,Z.jsx)(z,{size:14,stroke:2}),`New`]}),(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{side:`bottom`,align:`end`,sideOffset:6,className:`z-50 outline-none`,children:(0,Z.jsxs)(m,{"data-overlay":!0,className:`min-w-[240px] p-1`,children:[(0,Z.jsx)(`span`,{className:`block px-2 pb-1 pt-1.5 text-[11px] font-medium text-[var(--chrome-fg-400)]`,children:`On which diagram?`}),t.map(e=>(0,Z.jsx)(s,{"data-testid":`flow-list-new-frame`,className:`flex cursor-default select-none items-center gap-2 rounded-lg px-2 py-1.5 text-[13px] text-[var(--chrome-fg-700)] outline-none data-[highlighted]:bg-[var(--chrome-hover)]`,onClick:()=>n(e),children:e.label||`Untitled frame`},e.id))]})})})]})}function Re(e){let{frameId:t,readOnly:n}=e,r=_();return(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{side:`bottom`,align:`end`,sideOffset:6,className:`z-50 outline-none`,children:(0,Z.jsx)(m,{"data-overlay":!0,"data-testid":`figure-flow-list`,className:`w-[300px] p-1`,finalFocus:()=>r.store.getState().flowEdit===null,children:(0,Z.jsx)(ze,{frameId:t,readOnly:n})})})})}function ze(e){let{frameId:t,readOnly:n}=e,r=_(),i=v(e=>{let n=e.shapes.find(e=>e.id===t);return n?.type===`figure`?n:null}),a=v(e=>e.lastFlow[t]),o=e=>r.store.getState().setFlowPreview(e?{frameId:t,flowId:e}:null);return(0,Y.useEffect)(()=>()=>r.store.getState().setFlowPreview(null),[r]),i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`px-2 pb-1 pt-1.5 text-[11px] font-medium text-[var(--chrome-fg-400)]`,children:[`Flows on `,i.label||`this diagram`]}),(0,Z.jsx)(`div`,{onPointerLeave:()=>o(null),children:N(i.flows??[]).map(({flow:e,depth:t,origin:r})=>(0,Z.jsx)(Ve,{frame:i,flow:e,depth:t,forkStep:r?r.index+1:null,last:e.id===a,readOnly:n,onPreview:o},e.id))}),!n&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{}),(0,Z.jsx)(h,{testId:`figure-flow-new`,icon:(0,Z.jsx)(z,{size:15,stroke:1.75}),onClick:()=>K(r,t),children:`New flow`})]})]}):null}var Be=`flex h-7 w-7 shrink-0 cursor-default items-center justify-center rounded-lg text-[var(--chrome-fg-400)] outline-none data-[highlighted]:bg-[var(--chrome-hover)] data-[highlighted]:text-[var(--chrome-fg-800)]`;function Ve(e){let{frame:t,flow:n,depth:r,forkStep:i,last:c,readOnly:l,onPreview:u}=e,f=_(),g=n.steps.length,v=n.steps.some(e=>e.fails);return(0,Z.jsxs)(`div`,{"data-testid":`figure-flow-row`,className:`flex items-center gap-0.5`,style:{paddingLeft:r*16},onPointerEnter:()=>u(n.id),children:[(0,Z.jsxs)(s,{"data-testid":`figure-flow-row-play`,disabled:g===0,className:`${pe.menuItem} min-w-0 flex-1`,onFocus:()=>u(n.id),onClick:()=>G(f,t.id,n.id),children:[(0,Z.jsx)(`span`,{className:c?`text-[var(--flow-accent)]`:`text-[var(--chrome-fg-400)]`,children:r>0?(0,Z.jsx)(E,{size:15,stroke:1.75}):c?(0,Z.jsx)(ue,{size:13}):(0,Z.jsx)(o,{size:15,stroke:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[var(--chrome-fg-900)]`,children:n.name}),i!==null&&(0,Z.jsxs)(`span`,{className:`text-[11px] text-[var(--chrome-fg-400)]`,children:[`From step `,i]})]}),v&&(0,Z.jsx)(`span`,{title:`Shows something failing`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--flow-fail)]`}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-[var(--chrome-fg-400)]`,children:[g,` `,g===1?`step`:`steps`]})]}),!l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{"aria-label":`Edit ${n.name}`,"data-testid":`figure-flow-row-edit`,className:Be,onFocus:()=>u(n.id),onClick:()=>A(f,t.id,n.id),children:(0,Z.jsx)(R,{size:14,stroke:1.75})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(H,{"aria-label":`More for ${n.name}`,"data-testid":`figure-flow-row-more`,className:Be,children:(0,Z.jsx)(a,{size:14,stroke:1.75})}),(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{className:`z-50 outline-none`,sideOffset:4,children:(0,Z.jsxs)(m,{"data-overlay":!0,className:`min-w-[160px] p-1`,children:[(0,Z.jsx)(h,{testId:`figure-flow-rename`,icon:(0,Z.jsx)(R,{size:15,stroke:1.75}),onClick:()=>f.store.getState().setFlowEdit({frameId:t.id,flowId:n.id,rename:!0}),children:`Rename`}),(0,Z.jsx)(h,{testId:`figure-flow-delete`,icon:(0,Z.jsx)(T,{size:15,stroke:1.75}),onClick:()=>M(f,t.id,n.id),children:`Delete`})]})})})]})]})]})}var He=/^Flow \d+$/;function Ue(){let e=v(e=>e.flowEdit);return v(e=>e.rightPanel===`flow`)?e?(0,Z.jsx)(We,{frameId:e.frameId,flowId:e.flowId},e.flowId):(0,Z.jsx)(Pe,{}):null}function We(e){let{frameId:t,flowId:n}=e,{ai:i}=g(),a=_(),{store:o}=a,s=v(e=>e.shapes),c=v(e=>e.flowPlay),l=v(e=>e.flowEdit)??{},u=c!==null,d=c?.flowId===n?c.step:null,f=(0,Y.useMemo)(()=>{let e=s.find(e=>e.id===t);return e?.type===`figure`?e:null},[s,t]),p=(0,Y.useMemo)(()=>f?de(s,f):[],[s,f]),m=f?.flows?.find(e=>e.id===n),h=m?_e(m,p):null,y=h?.steps.length??0,[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),T=o.getState().patchFlowEdit;(0,Y.useEffect)(()=>{l.rename&&(w(!0),o.getState().patchFlowEdit({rename:!1}))},[l.rename,o]);let A=se({count:y,gap:1,onReorder:(e,r)=>te(a,t,n,e,r),onPress:e=>T({selected:e})}),N=()=>{h&&h.steps.length===0&&M(a,t,n),o.getState().setFlowEdit(null)},P=()=>{h&&h.steps.length===0&&M(a,t,n),o.getState().setFlowsOpen(!0)},F=()=>{if(h&&h.steps.length>0&&He.test(h.name)){S(!0);return}N()},I=(0,Y.useRef)(F);I.current=F;let oe=(0,Y.useRef)(y);if(oe.current=y,(0,Y.useEffect)(()=>{let e=e=>{let r=o.getState();if(r.flowPlay||b(e.target)||(e.target instanceof Element?e.target:null)?.closest(`[role=menu], [role=dialog]`))return;let i=r.flowEdit??{},s=oe.current,c=D(i,s);if(e.key===`Escape`){if(e.preventDefault(),e.stopPropagation(),i.picking!==null&&i.picking!==void 0){r.patchFlowEdit({picking:null});return}if(ee(i,s)){r.patchFlowEdit({slot:null});return}I.current();return}if(c!==null){if(e.key===`Delete`||e.key===`Backspace`){e.preventDefault(),e.stopPropagation(),re(a,t,n,c);return}if(e.altKey&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){e.preventDefault(),e.stopPropagation();let r=c+(e.key===`ArrowUp`?-1:1);r>=0&&r<s&&te(a,t,n,c,r)}}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,a,t,n]),!f||!h)return null;let L=f.flows??[],ce=new Map(p.map(e=>[e.id,he(p,e)])),R=ge(L,n),z=R?.flow.steps[R.index]?.title??``,B=O(l,y),V=D(l,y),H=D({selected:l.picking},y),le=ie(l,y),fe=L.filter(e=>e.id!==n).map(e=>({id:e.id,name:e.name}));function W(e){let r=e.trim();r&&r!==h?.name&&k(a,t,n,e=>({...e,name:r}))}return(0,Z.jsxs)(me,{width:300,testId:`flow-panel`,ariaLabel:`Flow`,onDismiss:N,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5 py-2 pl-1.5 pr-2`,children:[(0,Z.jsx)(r,{label:`All flows`,side:`bottom`,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`All flows`,"data-testid":`flow-panel-back`,onClick:P,className:q,children:(0,Z.jsx)(ae,{size:16,stroke:1.75})})}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:C?(0,Z.jsx)(`input`,{autoFocus:!0,"aria-label":`Flow name`,"data-testid":`flow-name`,className:`${X} text-[14px] font-medium`,defaultValue:h.name,onFocus:e=>e.target.select(),onBlur:e=>{W(e.target.value),w(!1)},onKeyDown:Ne}):(0,Z.jsx)(Ye,{current:h,flows:L,onPick:e=>o.getState().setFlowEdit({frameId:t,flowId:e}),onRename:()=>w(!0),onNew:()=>K(a,t),onDelete:()=>M(a,t,n)})}),(0,Z.jsx)(r,{label:`Close`,side:`bottom`,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close the flow panel`,"data-testid":`flow-panel-done`,onClick:N,className:q,children:(0,Z.jsx)(U,{size:16,stroke:1.75})})})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-4 pb-2.5`,children:[(0,Z.jsxs)(`span`,{className:`truncate text-[11px] text-[var(--chrome-fg-400)]`,children:[f.label||`Untitled frame`,` · `,y,` `,y===1?`step`:`steps`,y>1&&` · drag to reorder`]}),R&&(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`flow-origin`,title:`Open ${R.flow.name}`,className:`-ml-1 flex min-w-0 cursor-pointer items-center gap-1 self-start rounded-md bg-[color-mix(in_srgb,var(--flow-accent)_10%,transparent)] px-1.5 py-1 text-[11.5px] text-[var(--flow-accent)] transition-colors hover:bg-[color-mix(in_srgb,var(--flow-accent)_16%,transparent)]`,onClick:()=>o.getState().setFlowEdit({frameId:t,flowId:R.flow.id}),children:[(0,Z.jsx)(E,{size:12,stroke:2,className:`shrink-0`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`From `,R.flow.name,`, step `,R.index+1]})]})]}),(0,Z.jsx)(`div`,{className:`mx-3 h-px bg-[var(--chrome-divider)]`}),(0,Z.jsx)(`div`,{ref:A.listRef,className:`flex flex-1 flex-col gap-1 overflow-y-auto p-3`,children:y===0?(0,Z.jsx)(qe,{fork:R?{title:z,step:R.index+1}:null,onAi:i?()=>{M(a,t,n),o.getState().askAi(`Write a flow for the frame "${f.label||`Untitled`}" (${f.id}) showing `)}:null}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ol`,{className:`flex flex-col gap-px pt-1`,"data-testid":`flow-steps`,children:h.steps.map((e,r)=>(0,Z.jsx)(Ge,{before:B===r&&B<y,hidden:A.dragging,number:r+1,onCancel:()=>T({slot:null}),children:(0,Z.jsx)(Te,{step:e,index:r,count:y,current:d===r,selected:V===r,picking:H===r,names:ce,otherFlows:fe,rowRef:A.setItemRef(r),rowStyle:A.rowStyle(r),grip:A.rowHandlers(r),actions:{onPlay:()=>G(a,t,n,r),onChange:e=>j(a,t,n,r,e),onMove:e=>te(a,t,n,r,r+e),onRemove:()=>re(a,t,n,r),onNewPath:()=>ne(a,t,n,r),onSelect:()=>{o.getState().flowEdit?.selected!==r&&T({selected:r})},onHover:e=>T({hovered:e?r:null}),onInsertBefore:()=>T({slot:r,picking:null}),onInsertAfter:()=>T({slot:r+1<y?r+1:null,picking:null}),onChangeBox:()=>T({picking:r,selected:r})}})},`${e.target}-${r}`))}),(0,Z.jsx)(Ke,{picking:H,inserting:B<y,next:y+1,joined:le,onCancelPick:()=>T({picking:null}),onToEnd:()=>T({slot:null})})]})}),(0,Z.jsx)(`div`,{className:`border-t border-[var(--chrome-ring)] p-3`,children:x?(0,Z.jsx)(Je,{suggestion:Xe(h),onSave:e=>{W(e),N()},onSkip:N}):(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`${Se} h-9 flex-1`,"data-testid":`flow-play`,disabled:y===0||u,onClick:()=>G(a,t,n),children:[(0,Z.jsx)(ue,{size:12}),`Preview`]}),(0,Z.jsx)(`button`,{type:`button`,className:`${xe} flex-1`,"data-testid":`flow-done`,onClick:F,children:`Done`})]})})]})}function Ge(e){let{before:t,hidden:n,number:i,onCancel:a,children:o}=e;return(0,Z.jsxs)(Z.Fragment,{children:[t&&(0,Z.jsxs)(`li`,{"data-testid":`flow-slot`,className:`my-1 flex items-center gap-2.5 rounded-lg border border-dashed border-[color-mix(in_srgb,var(--flow-accent)_55%,transparent)] bg-[color-mix(in_srgb,var(--flow-accent)_6%,transparent)] py-2 pl-5 pr-1.5 text-[12px] text-[var(--flow-accent)] ${n?`invisible`:``}`,children:[(0,Z.jsx)(`span`,{className:`flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full border border-dashed border-[var(--flow-accent)]`,children:(0,Z.jsx)(z,{size:12,stroke:2.5})}),(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Click the box for a new step `,i]}),(0,Z.jsx)(r,{label:`Add at the end instead`,side:`left`,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Add at the end instead`,"data-testid":`flow-slot-cancel`,className:`flex h-6 w-6 cursor-pointer items-center justify-center rounded-md hover:bg-[color-mix(in_srgb,var(--flow-accent)_12%,transparent)]`,onClick:a,children:(0,Z.jsx)(U,{size:13,stroke:2})})})]}),o]})}function Ke(e){let{picking:t,inserting:n,next:r,joined:i,onCancelPick:a,onToEnd:o}=e,s=`flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--flow-accent)_12%,transparent)] px-1.5 text-[12px] font-semibold tabular-nums text-[var(--flow-accent)]`;return t===null?n?(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`flow-hint`,className:`mt-1 flex cursor-pointer items-center gap-2.5 rounded-lg border border-dashed border-[var(--chrome-divider)] px-2 py-2.5 text-left text-[12px] text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-rest)]`,onClick:o,children:[(0,Z.jsx)(`span`,{className:s,children:(0,Z.jsx)(z,{size:12,stroke:2.5})}),`Add at the end instead`]}):(0,Z.jsxs)(`div`,{"data-testid":`flow-hint`,className:`mt-1 flex items-center gap-2.5 rounded-lg border border-dashed border-[var(--chrome-divider)] px-2 py-2.5 text-[12px] text-[var(--chrome-fg-500)]`,children:[(0,Z.jsx)(`span`,{className:s,children:r}),(0,Z.jsxs)(`span`,{children:[`Click the next box or arrow`,i!==null&&(0,Z.jsxs)(`span`,{className:`block text-[11px] text-[var(--chrome-fg-400)]`,children:[`Shift-click to add it to step `,i+1]})]})]}):(0,Z.jsxs)(`div`,{"data-testid":`flow-hint`,className:`mt-1 flex items-center gap-2.5 rounded-lg border border-dashed border-[var(--flow-accent)] px-2 py-2.5 text-[12px] text-[var(--chrome-fg-700)]`,children:[(0,Z.jsx)(`span`,{className:s,children:t+1}),(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Click the box step `,t+1,` should light`,(0,Z.jsx)(`span`,{className:`block text-[11px] text-[var(--chrome-fg-400)]`,children:`Its title and notes stay`})]}),(0,Z.jsx)(`button`,{type:`button`,className:ye,onClick:a,children:`Cancel`})]})}function qe(e){let{onAi:t,fork:n}=e;return n?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-3 py-8 text-center`,"data-testid":`flow-empty`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-[var(--chrome-rest)] px-5 py-4`,"aria-hidden":!0,children:[(0,Z.jsxs)(`span`,{className:`flex h-7 items-center gap-1 rounded-full bg-[var(--chrome-popup)] px-2.5 text-[12px] font-medium text-[var(--chrome-fg-700)] ring-1 ring-[var(--chrome-ring)]`,children:[(0,Z.jsx)(E,{size:13,stroke:2,className:`text-[var(--flow-accent)]`}),n.title||`Step ${n.step}`]}),(0,Z.jsx)(`span`,{className:`h-0.5 w-5 rounded-full bg-[color-mix(in_srgb,var(--flow-accent)_35%,transparent)]`}),(0,Z.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full bg-[var(--flow-accent)] text-[12px] font-semibold text-white`,children:`1`})]}),(0,Z.jsxs)(`p`,{className:`text-balance text-[13px] font-medium text-[var(--chrome-fg-900)]`,children:[`What happens after `,n.title||`step ${n.step}`,`?`]}),(0,Z.jsxs)(`p`,{className:`text-balance text-[12px] leading-relaxed text-[var(--chrome-fg-500)]`,children:[`Click where it goes next. Viewers can pick this path at step `,n.step,`.`]})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-3 py-8 text-center`,"data-testid":`flow-empty`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 rounded-xl bg-[var(--chrome-rest)] px-5 py-4`,"aria-hidden":!0,children:[1,2,3].map(e=>(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e>1&&(0,Z.jsx)(`span`,{className:`h-0.5 w-5 rounded-full bg-[color-mix(in_srgb,var(--flow-accent)_35%,transparent)]`}),(0,Z.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full text-[12px] font-semibold ${e===1?`bg-[var(--flow-accent)] text-white`:`bg-[var(--chrome-popup)] text-[var(--flow-accent)] ring-1 ring-[color-mix(in_srgb,var(--flow-accent)_30%,transparent)]`}`,children:e})]},e))}),(0,Z.jsx)(`p`,{className:`text-balance text-[13px] font-medium text-[var(--chrome-fg-900)]`,children:`Click the boxes in order`}),(0,Z.jsx)(`p`,{className:`text-balance text-[12px] leading-relaxed text-[var(--chrome-fg-500)]`,children:`Start with whoever kicks things off.`}),t&&(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`flow-ai`,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-[12px] text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] disabled:pointer-events-none disabled:text-[var(--chrome-fg-300)]`,onClick:t,children:[(0,Z.jsx)(le,{size:13,stroke:1.75}),`Or write the steps with AI`]})]})}function Je(e){let{suggestion:t,onSave:n,onSkip:r}=e,[i,a]=(0,Y.useState)(t);return(0,Z.jsxs)(`form`,{className:`flex flex-col gap-2`,"data-testid":`flow-name-prompt`,onSubmit:e=>{e.preventDefault(),n(i)},children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--chrome-fg-800)]`,children:`Name this flow`}),(0,Z.jsx)(`input`,{autoFocus:!0,"data-testid":`flow-name-input`,className:`${X} h-8 ring-[var(--chrome-ring)]`,value:i,onFocus:e=>e.target.select(),onChange:e=>a(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&r()}})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`${Se} h-9 flex-1`,"data-testid":`flow-name-skip`,onClick:r,children:`Skip`}),(0,Z.jsx)(`button`,{type:`submit`,className:`${xe} flex-1`,"data-testid":`flow-name-save`,disabled:!i.trim(),children:`Save`})]})]})}function Ye(e){let{current:t,flows:n,onPick:r,onRename:a,onNew:o,onDelete:c}=e,g=(0,Y.useRef)(!1);return(0,Z.jsxs)(u,{onOpenChange:e=>{e&&(g.current=!1)},children:[(0,Z.jsxs)(f,{"data-testid":`flow-switcher`,className:`flex max-w-full cursor-pointer items-center gap-1 rounded-md px-1.5 py-1 text-left transition-colors hover:bg-[var(--chrome-hover)] data-[popup-open]:bg-[var(--chrome-hover)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[14px] font-medium text-[var(--chrome-fg-900)]`,children:t.name}),(0,Z.jsx)(i,{size:14,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-400)]`})]}),(0,Z.jsx)(d,{children:(0,Z.jsx)(p,{side:`bottom`,align:`start`,sideOffset:4,className:`z-50 outline-none`,children:(0,Z.jsxs)(m,{"data-overlay":!0,className:`min-w-[240px] p-1`,finalFocus:()=>!g.current,children:[N(n).map(({flow:e,depth:n})=>(0,Z.jsxs)(s,{"data-testid":`flow-switcher-item`,className:`flex cursor-default select-none items-center gap-2 rounded-lg py-1.5 pr-2 text-[13px] text-[var(--chrome-fg-700)] outline-none data-[highlighted]:bg-[var(--chrome-hover)]`,style:{paddingLeft:8+n*16},onClick:()=>r(e.id),children:[(0,Z.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:n>0?(0,Z.jsx)(E,{size:14,stroke:1.75}):(0,Z.jsx)(V,{size:14,stroke:1.75})}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[var(--chrome-fg-900)]`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-[11px] tabular-nums text-[var(--chrome-fg-400)]`,children:e.steps.length}),(0,Z.jsx)(`span`,{className:`flex w-4 justify-center text-[var(--chrome-fg-900)]`,children:e.id===t.id&&(0,Z.jsx)(P,{size:14,stroke:2})})]},e.id)),(0,Z.jsx)(l,{}),(0,Z.jsx)(h,{testId:`flow-name-edit`,icon:(0,Z.jsx)(R,{size:15,stroke:1.75}),onClick:()=>{g.current=!0,a()},children:`Rename`}),(0,Z.jsx)(h,{testId:`flow-new`,icon:(0,Z.jsx)(z,{size:15,stroke:1.75}),onClick:o,children:`New flow on this frame`}),(0,Z.jsx)(h,{testId:`flow-delete`,icon:(0,Z.jsx)(T,{size:15,stroke:1.75}),onClick:c,children:`Delete this flow`})]})})})]})}function Xe(e){let t=e.steps[0]?.title.trim(),n=e.steps[e.steps.length-1]?.title.trim();return t?n&&n!==t?`${t} to ${n}`:t:e.name}export{Re as FlowMenuPopup,Ue as FlowPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-2Zwg-L3c.js";import{Sr as t}from"./slides-D9bnXqtf.js";import{r as n}from"./frames-CRP8oPP8.js";import{t as r}from"./createReactComponent-9UsI5fmM.js";import{t as i}from"./IconAlertTriangle-CxPhYpe-.js";import{t as a}from"./IconEraser-DlZQe3-r.js";import{t as ee}from"./IconMinus-y4ejub-s.js";import{t as o}from"./IconMoodSmile-Bic_fw54.js";import{t as te}from"./IconNote-C0uYQWp-.js";import{t as ne}from"./IconPencil-C5Y-Y4dC.js";import{t as s}from"./IconPhoto-CR36IK-b.js";import{t as re}from"./IconSearch-C1K0_Pq_.js";import{t as c}from"./IconSparkles-WDcg8BA9.js";import{C as l,b as u,c as d,f,g as p,h as ie,p as ae,s as oe,v as se,x as ce,y as le}from"./PopoverPopup-BqGWd_uB.js";import{t as ue}from"./keys-DrjiT9FL.js";var m=r(`outline`,`adjustments-horizontal`,`AdjustmentsHorizontal`,[[`path`,{d:`M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M4 6l8 0`,key:`svg-1`}],[`path`,{d:`M16 6l4 0`,key:`svg-2`}],[`path`,{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M4 12l2 0`,key:`svg-4`}],[`path`,{d:`M10 12l10 0`,key:`svg-5`}],[`path`,{d:`M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-6`}],[`path`,{d:`M4 18l11 0`,key:`svg-7`}],[`path`,{d:`M19 18l1 0`,key:`svg-8`}]]),de=r(`outline`,`align-justified`,`AlignJustified`,[[`path`,{d:`M4 6l16 0`,key:`svg-0`}],[`path`,{d:`M4 12l16 0`,key:`svg-1`}],[`path`,{d:`M4 18l12 0`,key:`svg-2`}]]),fe=r(`outline`,`antenna-bars-5`,`AntennaBars5`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 -9`,key:`svg-2`}],[`path`,{d:`M18 18l0 -12`,key:`svg-3`}]]),pe=r(`outline`,`app-window`,`AppWindow`,[[`path`,{d:`M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10`,key:`svg-0`}],[`path`,{d:`M6 8h.01`,key:`svg-1`}],[`path`,{d:`M9 8h.01`,key:`svg-2`}]]),me=r(`outline`,`box-margin`,`BoxMargin`,[[`path`,{d:`M8 8h8v8h-8l0 -8`,key:`svg-0`}],[`path`,{d:`M4 4v.01`,key:`svg-1`}],[`path`,{d:`M8 4v.01`,key:`svg-2`}],[`path`,{d:`M12 4v.01`,key:`svg-3`}],[`path`,{d:`M16 4v.01`,key:`svg-4`}],[`path`,{d:`M20 4v.01`,key:`svg-5`}],[`path`,{d:`M4 20v.01`,key:`svg-6`}],[`path`,{d:`M8 20v.01`,key:`svg-7`}],[`path`,{d:`M12 20v.01`,key:`svg-8`}],[`path`,{d:`M16 20v.01`,key:`svg-9`}],[`path`,{d:`M20 20v.01`,key:`svg-10`}],[`path`,{d:`M20 16v.01`,key:`svg-11`}],[`path`,{d:`M20 12v.01`,key:`svg-12`}],[`path`,{d:`M20 8v.01`,key:`svg-13`}],[`path`,{d:`M4 16v.01`,key:`svg-14`}],[`path`,{d:`M4 12v.01`,key:`svg-15`}],[`path`,{d:`M4 8v.01`,key:`svg-16`}]]),h=r(`outline`,`brackets-contain`,`BracketsContain`,[[`path`,{d:`M7 4h-4v16h4`,key:`svg-0`}],[`path`,{d:`M17 4h4v16h-4`,key:`svg-1`}],[`path`,{d:`M8 16h.01`,key:`svg-2`}],[`path`,{d:`M12 16h.01`,key:`svg-3`}],[`path`,{d:`M16 16h.01`,key:`svg-4`}]]),he=r(`outline`,`browser`,`Browser`,[[`path`,{d:`M4 8h16`,key:`svg-0`}],[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-1`}],[`path`,{d:`M8 4v4`,key:`svg-2`}]]),ge=r(`outline`,`calendar`,`Calendar`,[[`path`,{d:`M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M11 15h1`,key:`svg-4`}],[`path`,{d:`M12 15v3`,key:`svg-5`}]]),_e=r(`outline`,`cards`,`Cards`,[[`path`,{d:`M3.604 7.197l7.138 -3.109a.96 .96 0 0 1 1.27 .527l4.924 11.902a1 1 0 0 1 -.514 1.304l-7.137 3.109a.96 .96 0 0 1 -1.271 -.527l-4.924 -11.903a1 1 0 0 1 .514 -1.304l0 .001`,key:`svg-0`}],[`path`,{d:`M15 4h1a1 1 0 0 1 1 1v3.5`,key:`svg-1`}],[`path`,{d:`M20 6c.264 .112 .52 .217 .768 .315a1 1 0 0 1 .53 1.311l-2.298 5.374`,key:`svg-2`}]]),g=r(`outline`,`chart-area-line`,`ChartAreaLine`,[[`path`,{d:`M4 19l4 -6l4 2l4 -5l4 4l0 5l-16 0`,key:`svg-0`}],[`path`,{d:`M4 12l3 -4l4 2l5 -6l4 4`,key:`svg-1`}]]),_=r(`outline`,`chart-bar`,`ChartBar`,[[`path`,{d:`M3 13a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -6`,key:`svg-0`}],[`path`,{d:`M15 9a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -10`,key:`svg-1`}],[`path`,{d:`M9 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -14`,key:`svg-2`}],[`path`,{d:`M4 20h14`,key:`svg-3`}]]),v=r(`outline`,`chart-dots`,`ChartDots`,[[`path`,{d:`M3 3v18h18`,key:`svg-0`}],[`path`,{d:`M7 9a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M17 7a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-2`}],[`path`,{d:`M12 15a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M10.16 10.62l2.34 2.88`,key:`svg-4`}],[`path`,{d:`M15.088 13.328l2.837 -4.586`,key:`svg-5`}]]),y=r(`outline`,`chart-grid-dots`,`ChartGridDots`,[[`path`,{d:`M16 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M4 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M4 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-2`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M8 18h8`,key:`svg-4`}],[`path`,{d:`M18 20v1`,key:`svg-5`}],[`path`,{d:`M18 3v1`,key:`svg-6`}],[`path`,{d:`M6 20v1`,key:`svg-7`}],[`path`,{d:`M6 10v-7`,key:`svg-8`}],[`path`,{d:`M12 3v18`,key:`svg-9`}],[`path`,{d:`M18 8v8`,key:`svg-10`}],[`path`,{d:`M8 12h13`,key:`svg-11`}],[`path`,{d:`M21 6h-1`,key:`svg-12`}],[`path`,{d:`M16 6h-13`,key:`svg-13`}],[`path`,{d:`M3 12h1`,key:`svg-14`}],[`path`,{d:`M20 18h1`,key:`svg-15`}],[`path`,{d:`M3 18h1`,key:`svg-16`}],[`path`,{d:`M6 14v2`,key:`svg-17`}]]),b=r(`outline`,`chart-line`,`ChartLine`,[[`path`,{d:`M4 19l16 0`,key:`svg-0`}],[`path`,{d:`M4 15l4 -6l4 2l4 -5l4 4`,key:`svg-1`}]]),x=r(`outline`,`chart-pie`,`ChartPie`,[[`path`,{d:`M10 3.2a9 9 0 1 0 10.8 10.8a1 1 0 0 0 -1 -1h-6.8a2 2 0 0 1 -2 -2v-7a.9 .9 0 0 0 -1 -.8`,key:`svg-0`}],[`path`,{d:`M15 3.5a9 9 0 0 1 5.5 5.5h-4.5a1 1 0 0 1 -1 -1v-4.5`,key:`svg-1`}]]),S=r(`outline`,`checkbox`,`Checkbox`,[[`path`,{d:`M9 11l3 3l8 -8`,key:`svg-0`}],[`path`,{d:`M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9`,key:`svg-1`}]]),C=r(`outline`,`chevrons-right`,`ChevronsRight`,[[`path`,{d:`M7 7l5 5l-5 5`,key:`svg-0`}],[`path`,{d:`M13 7l5 5l-5 5`,key:`svg-1`}]]),w=r(`outline`,`circle-dashed`,`CircleDashed`,[[`path`,{d:`M8.56 3.69a9 9 0 0 0 -2.92 1.95`,key:`svg-0`}],[`path`,{d:`M3.69 8.56a9 9 0 0 0 -.69 3.44`,key:`svg-1`}],[`path`,{d:`M3.69 15.44a9 9 0 0 0 1.95 2.92`,key:`svg-2`}],[`path`,{d:`M8.56 20.31a9 9 0 0 0 3.44 .69`,key:`svg-3`}],[`path`,{d:`M15.44 20.31a9 9 0 0 0 2.92 -1.95`,key:`svg-4`}],[`path`,{d:`M20.31 15.44a9 9 0 0 0 .69 -3.44`,key:`svg-5`}],[`path`,{d:`M20.31 8.56a9 9 0 0 0 -1.95 -2.92`,key:`svg-6`}],[`path`,{d:`M15.44 3.69a9 9 0 0 0 -3.44 -.69`,key:`svg-7`}]]),T=r(`outline`,`circle-dot`,`CircleDot`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-1`}]]),E=r(`outline`,`circle-number-1`,`CircleNumber1`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M10 10l2 -2v8`,key:`svg-1`}]]),D=r(`outline`,`circle-plus`,`CirclePlus`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12h6`,key:`svg-1`}],[`path`,{d:`M12 9v6`,key:`svg-2`}]]),O=r(`outline`,`circle`,`Circle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}]]),k=r(`outline`,`device-mobile`,`DeviceMobile`,[[`path`,{d:`M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M11 4h2`,key:`svg-1`}],[`path`,{d:`M12 17v.01`,key:`svg-2`}]]),A=r(`outline`,`device-tablet`,`DeviceTablet`,[[`path`,{d:`M5 4a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1v-16`,key:`svg-0`}],[`path`,{d:`M11 17a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}]]),j=r(`outline`,`forms`,`Forms`,[[`path`,{d:`M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3`,key:`svg-0`}],[`path`,{d:`M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3`,key:`svg-1`}],[`path`,{d:`M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7`,key:`svg-2`}],[`path`,{d:`M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1`,key:`svg-3`}],[`path`,{d:`M17 12h.01`,key:`svg-4`}],[`path`,{d:`M13 12h.01`,key:`svg-5`}]]),M=r(`outline`,`hand-stop`,`HandStop`,[[`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-0`}],[`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`,key:`svg-1`}],[`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-2`}],[`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`,key:`svg-3`}]]),N=r(`outline`,`heading`,`Heading`,[[`path`,{d:`M7 12h10`,key:`svg-0`}],[`path`,{d:`M7 5v14`,key:`svg-1`}],[`path`,{d:`M17 5v14`,key:`svg-2`}],[`path`,{d:`M15 19h4`,key:`svg-3`}],[`path`,{d:`M15 5h4`,key:`svg-4`}],[`path`,{d:`M5 19h4`,key:`svg-5`}],[`path`,{d:`M5 5h4`,key:`svg-6`}]]),P=r(`outline`,`highlight`,`Highlight`,[[`path`,{d:`M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`,key:`svg-0`}],[`path`,{d:`M12.5 5.5l4 4`,key:`svg-1`}],[`path`,{d:`M4.5 13.5l4 4`,key:`svg-2`}],[`path`,{d:`M21 15v4h-8l4 -4l4 0`,key:`svg-3`}]]),F=r(`outline`,`lasso`,`Lasso`,[[`path`,{d:`M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255`,key:`svg-0`}],[`path`,{d:`M3 15a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`,key:`svg-2`}]]),I=r(`outline`,`layout-bottombar`,`LayoutBottombar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 15l16 0`,key:`svg-1`}]]),L=r(`outline`,`layout-columns`,`LayoutColumns`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M12 4l0 16`,key:`svg-1`}]]),ve=r(`outline`,`layout-kanban`,`LayoutKanban`,[[`path`,{d:`M4 4l6 0`,key:`svg-0`}],[`path`,{d:`M14 4l6 0`,key:`svg-1`}],[`path`,{d:`M4 10a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-2`}],[`path`,{d:`M14 10a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-3`}]]),ye=r(`outline`,`layout-navbar`,`LayoutNavbar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 9l16 0`,key:`svg-1`}]]),be=r(`outline`,`layout-rows`,`LayoutRows`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 12l16 0`,key:`svg-1`}]]),xe=r(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),R=r(`outline`,`link`,`Link`,[[`path`,{d:`M9 15l6 -6`,key:`svg-0`}],[`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`,key:`svg-1`}],[`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`,key:`svg-2`}]]),z=r(`outline`,`list`,`List`,[[`path`,{d:`M9 6l11 0`,key:`svg-0`}],[`path`,{d:`M9 12l11 0`,key:`svg-1`}],[`path`,{d:`M9 18l11 0`,key:`svg-2`}],[`path`,{d:`M5 6l0 .01`,key:`svg-3`}],[`path`,{d:`M5 12l0 .01`,key:`svg-4`}],[`path`,{d:`M5 18l0 .01`,key:`svg-5`}]]),B=r(`outline`,`menu-2`,`Menu2`,[[`path`,{d:`M4 6l16 0`,key:`svg-0`}],[`path`,{d:`M4 12l16 0`,key:`svg-1`}],[`path`,{d:`M4 18l16 0`,key:`svg-2`}]]),V=r(`outline`,`message`,`Message`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12`,key:`svg-2`}]]),Se=r(`outline`,`north-star`,`NorthStar`,[[`path`,{d:`M3 12h18`,key:`svg-0`}],[`path`,{d:`M12 21v-18`,key:`svg-1`}],[`path`,{d:`M7.5 7.5l9 9`,key:`svg-2`}],[`path`,{d:`M7.5 16.5l9 -9`,key:`svg-3`}]]),Ce=r(`outline`,`numbers`,`Numbers`,[[`path`,{d:`M8 10v-7l-2 2`,key:`svg-0`}],[`path`,{d:`M6 16a2 2 0 1 1 4 0c0 .591 -.601 1.46 -1 2l-3 3h4`,key:`svg-1`}],[`path`,{d:`M15 14a2 2 0 1 0 2 -2a2 2 0 1 0 -2 -2`,key:`svg-2`}],[`path`,{d:`M6.5 10h3`,key:`svg-3`}]]),we=r(`outline`,`pointer`,`Pointer`,[[`path`,{d:`M7.904 17.563a1.2 1.2 0 0 0 2.228 .308l2.09 -3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047 -1.047a1.067 1.067 0 0 0 0 -1.509l-4.907 -4.907l3.113 -2.09a1.2 1.2 0 0 0 -.309 -2.228l-13.582 -3.904l3.904 13.563`,key:`svg-0`}]]),Te=r(`outline`,`polygon`,`Polygon`,[[`path`,{d:`M10 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M17 8a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M3 11a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-2`}],[`path`,{d:`M13 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M6.5 9.5l3.5 -3`,key:`svg-4`}],[`path`,{d:`M14 5.5l3 1.5`,key:`svg-5`}],[`path`,{d:`M18.5 10l-2.5 7`,key:`svg-6`}],[`path`,{d:`M13.5 17.5l-7 -5`,key:`svg-7`}]]),Ee=r(`outline`,`select`,`Select`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M9 11l3 3l3 -3`,key:`svg-1`}]]),De=r(`outline`,`separator-horizontal`,`SeparatorHorizontal`,[[`path`,{d:`M4 12l16 0`,key:`svg-0`}],[`path`,{d:`M8 8l4 -4l4 4`,key:`svg-1`}],[`path`,{d:`M16 16l-4 4l-4 -4`,key:`svg-2`}]]),H=r(`outline`,`square`,`Square`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}]]),Oe=r(`outline`,`star`,`Star`,[[`path`,{d:`M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873l-6.158 -3.245`,key:`svg-0`}]]),U=r(`outline`,`table`,`Table`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M3 10h18`,key:`svg-1`}],[`path`,{d:`M10 3v18`,key:`svg-2`}]]),ke=r(`outline`,`tag`,`Tag`,[[`path`,{d:`M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3`,key:`svg-1`}]]),Ae=r(`outline`,`toggle-right`,`ToggleRight`,[[`path`,{d:`M14 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M2 12a6 6 0 0 1 6 -6h8a6 6 0 0 1 6 6a6 6 0 0 1 -6 6h-8a6 6 0 0 1 -6 -6`,key:`svg-1`}]]),je=r(`outline`,`typography`,`Typography`,[[`path`,{d:`M4 20l3 0`,key:`svg-0`}],[`path`,{d:`M14 20l7 0`,key:`svg-1`}],[`path`,{d:`M6.9 15l6.9 0`,key:`svg-2`}],[`path`,{d:`M10.2 6.3l5.8 13.7`,key:`svg-3`}],[`path`,{d:`M5 20l6 -16l2 0l7 16`,key:`svg-4`}]]),Me=r(`outline`,`user-circle`,`UserCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855`,key:`svg-2`}]]),Ne=r(`outline`,`vector-spline`,`VectorSpline`,[[`path`,{d:`M17 4a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-0`}],[`path`,{d:`M3 18a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}],[`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`,key:`svg-2`}]]),Pe=r(`outline`,`window-maximize`,`WindowMaximize`,[[`path`,{d:`M3 17a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1l0 -3`,key:`svg-0`}],[`path`,{d:`M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-6`,key:`svg-1`}],[`path`,{d:`M12 8h4v4`,key:`svg-2`}],[`path`,{d:`M16 8l-5 5`,key:`svg-3`}]]),W={select:{label:`Select`,chord:`v`,icon:we,tool:`select`,viewSafe:!0},lasso:{label:`Lasso select`,chord:`q`,icon:F,tool:`lasso`},hand:{label:`Hand`,help:`Hand (pan)`,chord:`h`,icon:M,tool:`hand`,viewSafe:!0},rectangle:{label:`Rectangle`,chord:`r`,icon:H,tool:`rectangle`},ellipse:{label:`Ellipse`,chord:`o`,icon:O},arrow:{label:`Arrow`,chord:`a`,icon:d,tool:`arrow`},line:{label:`Line`,chord:`l`,icon:ee,tool:`line`},polyline:{label:`Multi-point line`,chord:`Shift+KeyC`,icon:Ne,tool:`polyline`},polygon:{label:`Polygon`,chord:`y`,icon:Te,tool:`polygon`},draw:{label:`Draw`,chord:`p`,icon:ne,tool:`draw`},highlight:{label:`Highlighter`,chord:`Shift+KeyP`,icon:P,tool:`highlight`},laser:{label:`Laser pointer`,chord:`k`,icon:Se,tool:`laser`,viewSafe:!0},text:{label:`Text`,chord:`t`,icon:je,tool:`text`},sticky:{label:`Sticky note`,chord:`n`,icon:te,tool:`sticky`},figure:{label:`Frame`,chord:`f`,tool:`figure`},image:{label:`Image`,chord:`i`,icon:s,tool:`image`},icon:{label:`Icons`,chord:`s`,icon:o,tool:`icon`},imageLibrary:{label:`Image library`,chord:`Shift+KeyS`},chart:{label:`Chart`,chord:`g`,tool:`chart`},stepbadge:{label:`Step badge`,chord:`b`,icon:E},eraser:{label:`Eraser`,chord:`e`,icon:a,tool:`eraser`},comment:{label:`Comment`,chord:`c`,icon:V,viewSafe:!0}};function G(e){return ue(W[e].chord)}var Fe=Object.fromEntries(Object.values(W).flatMap(e=>e.tool?[[e.chord,e.tool]]:[])),K=[{kind:`simple`,icon:ae},{kind:`phone`,icon:k},{kind:`tablet`,icon:A},{kind:`browser`,icon:he},{kind:`window`,icon:pe},{kind:`lanes`,icon:be},{kind:`vlanes`,icon:L},{kind:`boundary`,icon:me}],q=[{value:`table`,label:`Table`,icon:U},{value:`bar`,label:`Bar chart`,icon:_},{value:`line`,label:`Line chart`,icon:b},{value:`area`,label:`Area chart`,icon:g},{value:`scatter`,label:`Scatter chart`,icon:v},{value:`pie`,label:`Pie chart`,icon:x},{value:`donut`,label:`Donut chart`,icon:w},{value:`radar`,label:`Radar chart`,icon:u},{value:`quadrant`,label:`Quadrant chart`,icon:y}],J=[{kind:`button`,label:`Button`,icon:H},{kind:`input`,label:`Input`,icon:j},{kind:`search`,label:`Search field`,icon:re},{kind:`checkbox`,label:`Checkbox`,icon:S},{kind:`radio`,label:`Radio`,icon:T},{kind:`toggle`,label:`Toggle`,icon:Ae},{kind:`dropdown`,label:`Dropdown`,icon:Ee},{kind:`slider`,label:`Slider`,icon:m},{kind:`navbar`,label:`Navbar`,icon:ye},{kind:`tabs`,label:`Tabs`,icon:ve},{kind:`image`,label:`Image placeholder`,icon:s},{kind:`avatar`,label:`Avatar`,icon:Me},{kind:`heading`,label:`Heading`,icon:N},{kind:`paragraph`,label:`Paragraph`,icon:de},{kind:`divider`,label:`Divider`,icon:De},{kind:`link`,label:`Link`,icon:R},{kind:`textarea`,label:`Text area`,icon:l},{kind:`stepper`,label:`Number stepper`,icon:Ce},{kind:`badge`,label:`Badge`,icon:ke},{kind:`progress`,label:`Progress bar`,icon:le},{kind:`breadcrumbs`,label:`Breadcrumbs`,icon:C},{kind:`pagination`,label:`Pagination`,icon:se},{kind:`rating`,label:`Rating`,icon:Oe},{kind:`card`,label:`Card`,icon:_e},{kind:`list`,label:`List`,icon:z},{kind:`alert`,label:`Alert`,icon:i},{kind:`modal`,label:`Modal dialog`,icon:Pe},{kind:`menu`,label:`Menu`,icon:B},{kind:`tooltip`,label:`Tooltip`,icon:V},{kind:`accordion`,label:`Accordion`,icon:oe},{kind:`datepicker`,label:`Date picker`,icon:ge},{kind:`sidebar`,label:`Sidebar`,icon:xe},{kind:`scrollbar`,label:`Scrollbar`,icon:ce},{kind:`segmented`,label:`Segmented control`,icon:L},{kind:`tabbar`,label:`Bottom tab bar`,icon:I},{kind:`statusbar`,label:`Status bar`,icon:fe},{kind:`fab`,label:`Floating button`,icon:D}],Y={rectangle:`Rectangle`,ellipse:`Ellipse`,diamond:`Diamond`,triangle:`Triangle`,oval:`Oval`,parallelogram:`Parallelogram`,trapezoid:`Trapezoid`,cylinder:`Cylinder`,note:`Note`,hexagon:`Hexagon`,star:`Star`,checkbox:`Checkbox`,crossbox:`Crossed box`,heart:`Heart`,cloud:`Cloud`,"arrow-up":`Arrow up`,"arrow-down":`Arrow down`,"arrow-left":`Arrow left`,"arrow-right":`Arrow right`,plus:`Plus`,"speech-bubble":`Speech bubble`,bolt:`Lightning bolt`,queue:`Queue`,callout:`Callout`,document:`Document`,"predefined-process":`Predefined process`,"manual-input":`Manual input`,pentagon:`Pentagon`,chevron:`Chevron`,octagon:`Octagon`,cube:`Cube`,actor:`Actor`,"double-circle":`Double circle`,card:`Card`,delay:`Delay`,"fork-join":`Fork / join`,"multi-document":`Multi-document`,"multi-process":`Multi-process`,package:`Package`,component:`Component`,brace:`Brace`},X=t.filter(e=>e!==`rectangle`&&e!==`ellipse`&&e!==`actor`),Ie=e();function Le(e){return t=>(0,Ie.jsx)(ie,{kind:e,size:t.size})}function Z(e,t,n,r){let i=W[e];return{id:e,label:i.label,group:t,shortcut:G(e),keywords:n,icon:i.icon??H,action:r??{kind:`tool`,tool:i.tool??`select`}}}var Re=[Z(`select`,`Basic`),Z(`hand`,`Basic`,`pan`),Z(`lasso`,`Basic`,`freehand select`),Z(`eraser`,`Basic`),Z(`laser`,`Basic`,`present`),Z(`comment`,`Basic`,`review note feedback pin annotate`,{kind:`tool`,tool:`comment`})],Q=[{id:`ask-ai`,label:`Ask AI`,group:`AI`,keywords:`assistant chat sparkles help`,icon:c,action:{kind:`ai`}},{id:`ai-diagram`,label:`Generate diagram with AI`,group:`AI`,keywords:`assistant architecture flowchart create`,icon:c,action:{kind:`ai`,prompt:`Draw a diagram of `,send:!1}},{id:`ai-deck`,label:`Generate slides with AI`,group:`AI`,keywords:`assistant deck presentation create`,icon:c,action:{kind:`ai`,prompt:`Create a short deck about `,send:!1}},{id:`ai-image`,label:`Generate image with AI`,group:`AI`,keywords:`assistant picture photo create`,icon:c,action:{kind:`ai`,prompt:`Generate an image of `,send:!1}}],ze=[Z(`rectangle`,`Shapes`,`box square`,{kind:`shape`,shape:`rectangle`}),Z(`ellipse`,`Shapes`,`circle oval`,{kind:`shape`,shape:`ellipse`}),...X.map(e=>({id:`shape-${e}`,label:Y[e],group:`Shapes`,keywords:`shape`,icon:Le(e),action:{kind:`shape`,shape:e}})),Z(`stepbadge`,`Shapes`,`number step`,{kind:`control`,control:`stepbadge`}),{id:`entity`,label:`Class / entity`,group:`Shapes`,keywords:`erd uml class table attributes fields`,icon:f,action:{kind:`control`,control:`entity`}},{id:`lifeline`,label:`Lifeline`,group:`Shapes`,keywords:`sequence uml participant`,icon:p,action:{kind:`control`,control:`lifeline`}},{id:`fragment`,label:`Fragment`,group:`Shapes`,keywords:`sequence uml combined opt alt loop par frame container`,icon:h,action:{kind:`control`,control:`fragment`}}],Be=[Z(`arrow`,`Connectors`,`connector`),Z(`line`,`Connectors`,`connector`),Z(`polyline`,`Connectors`,`connector elbow path`),Z(`polygon`,`Connectors`,`shape filled closed outline area band`)],Ve=[Z(`text`,`Text & media`),Z(`sticky`,`Text & media`,`note`),Z(`draw`,`Text & media`,`pen pencil freehand`),Z(`highlight`,`Text & media`,`marker highlight pen freehand`),Z(`image`,`Text & media`,`photo picture`),Z(`icon`,`Text & media`,`emoji sticker symbol`)],He=q.map(e=>({id:`data-${e.value}`,label:e.label,group:`Charts & data`,keywords:e.value===`table`?`grid data`:`chart graph data`,icon:e.icon,action:e.value===`table`?{kind:`table`}:{kind:`chart`,chart:e.value}})),Ue=K.map(e=>({id:`frame-${e.kind}`,label:n[e.kind],group:`Frames`,shortcut:e.kind===`simple`?G(`figure`):void 0,keywords:`frame container device mockup`,icon:e.icon,action:{kind:`frame`,frame:e.kind}})),We=J.map(e=>({id:`control-${e.kind}`,label:e.label,group:`UI controls`,keywords:`wireframe mockup ui widget`,icon:e.icon,action:{kind:`control`,control:e.kind}})),$=[...Re,...Q,...ze,...Be,...Ve,...He,...Ue,...We],Ge=new Map($.map(e=>[e.id,e]));function Ke(e,t){let n=$.filter(e=>e.group===`AI`?t.ai:e.id!==`comment`||t.comments),r=new Set(n.map(e=>e.id)),i=e.map(e=>Ge.get(e)).filter(e=>e!==void 0&&r.has(e.id)),a=new Set(i.map(e=>e.id));return{recent:i,rest:n.filter(e=>!a.has(e.id))}}function qe(e,t){if(e.kind===`ai`){t.askAi(e.prompt??``,e.send??!1);return}if(e.kind===`tool`){t.selectTool(e.tool);return}if(e.kind===`shape`){t.selectTool(`rectangle`),t.setShapeKind(e.shape);return}if(e.kind===`chart`){t.selectTool(`chart`),t.setChartKind(e.chart);return}if(e.kind===`table`){t.selectTool(`table`);return}if(e.kind===`frame`){t.selectTool(`figure`),t.setFrameKind(e.frame);return}t.insertControl(e.control)}export{_ as C,m as E,v as S,h as T,O as _,X as a,b,Fe as c,U as d,H as f,R as g,z as h,q as i,W as l,B as m,Ke as n,K as o,V as p,J as r,Y as s,qe as t,G as u,w as v,g as w,y as x,x as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createReactComponent-9UsI5fmM.js";import{i as t,n}from"./core-CBnmD9hT.js";import{i as r,t as i}from"./flow-start-ccYJ2KB9.js";import{i as a,n as o,s}from"./flows-GGbkNqs8.js";var c=e(`outline`,`arrow-fork`,`ArrowFork`,[[`path`,{d:`M16 3h5v5`,key:`svg-0`}],[`path`,{d:`M8 3h-5v5`,key:`svg-1`}],[`path`,{d:`M21 3l-7.536 7.536a5 5 0 0 0 -1.464 3.534v6.93`,key:`svg-2`}],[`path`,{d:`M3 3l7.536 7.536a5 5 0 0 1 1.464 3.534v.93`,key:`svg-3`}]]);function l(e,t,n){let r=m(t,e.length);return e[r-1]?.target===n.target?e:[...e.slice(0,r),n,...e.slice(r)]}function u(e,t,n){let r=Math.min(Math.max(n,0),e.length-1);if(t===r||!e[t])return e;let i=[...e],[a]=i.splice(t,1);return i.splice(r,0,a),i}function d(e,t){return e[t]?e.filter((e,n)=>n!==t):e}function f(e,t,n,r){let i=e[t];if(!i||i.target===n)return e;let a={...i,target:n};r!==void 0&&(a.title=r);let o=(i.also??[]).filter(e=>e!==n);return o.length>0?a.also=o:delete a.also,e.map((e,n)=>n===t?a:e)}function p(e,t,n){let r=e[t];if(!r||r.target===n)return e;let i=r.also??[],a={...r,also:i.includes(n)?i.filter(e=>e!==n):[...i,n]};return a.also?.length===0&&delete a.also,e.map((e,n)=>n===t?a:e)}function m(e,t){return Math.min(Math.max(e,0),t)}function h(e,t,n,a){let o=i(e,t);o&&r(e,o,(o.flows??[]).flatMap(e=>{if(e.id!==n)return[e];let t=a(e);return t?[t]:[]}))}function g(e,n,a,o){let s=i(e,n);if(!s)return;let c=s.flows??[],l=t(c);e.history.withTransaction(()=>{r(e,s,[...c.map(e=>e.id===a?{...e,steps:e.steps.map((e,t)=>t===o?{...e,branches:[...e.branches??[],l.id]}:e)}:e),l])}),e.store.getState().setFlowEdit({frameId:n,flowId:l.id})}function _(e,t,n){let{flowEdit:r,flowPlay:a,flowPreview:o,setFlowEdit:s,setFlowPlay:c,setFlowPreview:l}=e.store.getState();if(h(e,t,n,()=>null),a?.flowId===n&&c(null),o?.flowId===n&&l(null),r?.flowId!==n)return;let u=i(e,t)?.flows?.[0];s(u?{frameId:t,flowId:u.id}:null)}function v(e,t,n){let r=e.store.getState();r.setFlowPlay(null),r.setFlowEdit({frameId:t,flowId:n})}function y(e,t){let n=e.slot;return n==null||n>=t?t:Math.max(n,0)}function b(e,t){return y(e,t)<t}function x(e,t){let n=e.selected;return n==null||n<0||n>=t?null:n}function S(e,t){let n=x(e,t);if(n!==null)return n;let r=y(e,t)-1;return r>=0?r:null}function C(e,t,n){return{selected:t,slot:b(e,n)?t+1:null,picking:null}}function w(e,t){let n=e=>e==null?null:e>t?e-1:e;return{selected:e.selected===t?null:n(e.selected),slot:n(e.slot),hovered:null,picking:null}}function T(e,t,n){let r=e=>e==null?e:e===t?n:t<e&&e<=n?e-1:n<=e&&e<t?e+1:e,i={};return e.selected!==null&&e.selected!==void 0&&(i.selected=r(e.selected)),e.picking!==null&&e.picking!==void 0&&(i.picking=r(e.picking)),i}function E(e,t,r){let a=i(e,t),o=a?.flows?.find(e=>e.id===r);if(!a||!o)return null;let c=e.store.getState().shapes;return s(o,n(c,a)).steps}function D(e,t,n,r){let i=E(e,t,n);if(!i)return!1;let a=r(i);return a===i?!1:(h(e,t,n,e=>({...e,steps:a})),!0)}function O(e,t,n){let r=e.store.getState().flowEdit;return r&&r.frameId===t&&r.flowId===n?r:null}function k(e,t,n,r){O(e,t,n)&&e.store.getState().patchFlowEdit(r)}function A(e,t,n,r){let i=E(e,t,n);if(!i)return;let o=O(e,t,n)??{},s=y(o,i.length),c=e.store.getState().shapes,u={target:r.id,title:a(c,r)};D(e,t,n,e=>l(e,s,u))&&k(e,t,n,C(o,s,i.length))}function j(e,t,n,r){let i=E(e,t,n);if(!i)return;let a=S(O(e,t,n)??{},i.length);a!==null&&(D(e,t,n,e=>p(e,a,r.id)),k(e,t,n,{selected:a}))}function M(e,t,n,r,i){let o=E(e,t,n),s=o?.[r];if(!o||!s){k(e,t,n,{picking:null});return}let c=e.store.getState().shapes,l=c.find(e=>e.id===s.target),u=l&&s.title===a(c,l)?a(c,i):void 0;D(e,t,n,e=>f(e,r,i.id,u)),k(e,t,n,{picking:null,selected:r})}function N(e,t,n,r){let i=O(e,t,n);D(e,t,n,e=>d(e,r))&&i&&k(e,t,n,w(i,r))}function P(e,t,n,r,i){let a=O(e,t,n);D(e,t,n,e=>u(e,r,i))&&a&&k(e,t,n,T(a,r,i))}function F(e,t,n,r,i){D(e,t,n,e=>e.map((e,t)=>t===r?I({...e,...i}):e))}function I(e){let t={...e};return t.text||delete t.text,(!t.kind||t.kind===`call`)&&delete t.kind,t.payload||delete t.payload,t.also?.length||delete t.also,t.branches?.length||delete t.branches,t.fails||delete t.fails,t}function L(e){let t=new Map,n=new Map,r=[];for(let i of e){let a=o(e,i.id);a?(t.set(a.flow.id,[...t.get(a.flow.id)??[],i]),n.set(i.id,{flowId:a.flow.id,index:a.index})):r.push(i)}let i=[],a=new Set,s=(e,r)=>{if(!a.has(e.id)){a.add(e.id),i.push({flow:e,depth:r,origin:r>0?n.get(e.id)??null:null});for(let n of t.get(e.id)??[])s(n,r+1)}};return r.forEach(e=>s(e,0)),e.forEach(e=>s(e,0)),i}function R(e){return L(e).filter(e=>e.depth===0).map(e=>e.flow)}export{c as _,j as a,M as c,x as d,y as f,h as g,v as h,F as i,b as l,_ as m,R as n,P as o,g as p,A as r,N as s,L as t,S as u};
|