@saywright/studio 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/bridge.js +80 -32
  2. package/dist/cli.mjs +5193 -4848
  3. package/dist/client/assets/CommandPalette-BM1BSUxc.js +1 -0
  4. package/dist/client/assets/CommandPalette-BM1BSUxc.js.br +0 -0
  5. package/dist/client/assets/CommandPalette-BM1BSUxc.js.gz +0 -0
  6. package/dist/client/assets/{HelpDialog-CnCVSSNP.js → HelpDialog-Bc6yjiVi.js} +1 -1
  7. package/dist/client/assets/HelpDialog-Bc6yjiVi.js.br +0 -0
  8. package/dist/client/assets/HelpDialog-Bc6yjiVi.js.gz +0 -0
  9. package/dist/client/assets/{ReportView-BwBy4JIG.js → ReportView-DKcggbSt.js} +1 -1
  10. package/dist/client/assets/{ReportView-BwBy4JIG.js.br → ReportView-DKcggbSt.js.br} +0 -0
  11. package/dist/client/assets/ReportView-DKcggbSt.js.gz +0 -0
  12. package/dist/client/assets/{SettingsDialog-CS5w9CxJ.js → SettingsDialog-CIpvauuY.js} +1 -1
  13. package/dist/client/assets/SettingsDialog-CIpvauuY.js.br +0 -0
  14. package/dist/client/assets/SettingsDialog-CIpvauuY.js.gz +0 -0
  15. package/dist/client/assets/{arrow-left-BpsxETMA.js → arrow-left-5LUh_bW3.js} +1 -1
  16. package/dist/client/assets/brand-BcIB43Uo.js +57 -0
  17. package/dist/client/assets/brand-BcIB43Uo.js.br +0 -0
  18. package/dist/client/assets/brand-BcIB43Uo.js.gz +0 -0
  19. package/dist/client/assets/{footprints-Bc2dzReV.js → footprints-CfMi7MiN.js} +1 -1
  20. package/dist/client/assets/index-D1ooswLS.js +19 -0
  21. package/dist/client/assets/index-D1ooswLS.js.br +0 -0
  22. package/dist/client/assets/index-D1ooswLS.js.gz +0 -0
  23. package/dist/client/assets/{refresh-cw-DocKnJID.js → refresh-cw-BM1RSPTL.js} +1 -1
  24. package/dist/client/index.html +2 -2
  25. package/dist/client/index.html.br +0 -0
  26. package/dist/client/index.html.gz +0 -0
  27. package/dist/sample/package.json +1 -1
  28. package/package.json +1 -1
  29. package/dist/client/assets/CommandPalette-VEQNxJ4K.js +0 -1
  30. package/dist/client/assets/CommandPalette-VEQNxJ4K.js.br +0 -0
  31. package/dist/client/assets/CommandPalette-VEQNxJ4K.js.gz +0 -0
  32. package/dist/client/assets/HelpDialog-CnCVSSNP.js.br +0 -0
  33. package/dist/client/assets/HelpDialog-CnCVSSNP.js.gz +0 -0
  34. package/dist/client/assets/ReportView-BwBy4JIG.js.gz +0 -0
  35. package/dist/client/assets/SettingsDialog-CS5w9CxJ.js.br +0 -0
  36. package/dist/client/assets/SettingsDialog-CS5w9CxJ.js.gz +0 -0
  37. package/dist/client/assets/brand-BSL9G2NW.js +0 -57
  38. package/dist/client/assets/brand-BSL9G2NW.js.br +0 -0
  39. package/dist/client/assets/brand-BSL9G2NW.js.gz +0 -0
  40. package/dist/client/assets/index-C3xqQUPf.js +0 -19
  41. package/dist/client/assets/index-C3xqQUPf.js.br +0 -0
  42. package/dist/client/assets/index-C3xqQUPf.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{i as e,o as t,r as n}from"./cn-Wq33h1G4.js";import{A as r,Nt as i,O as a,Pt as o,U as s,X as c,at as l,dt as u,et as d,ft as f,g as p,h as m,i as h,it as g,j as _,jt as v,k as y,mt as b,pt as ee,ut as x,v as S,y as C}from"./brand-BcIB43Uo.js";import{t as w}from"./arrow-left-5LUh_bW3.js";import{t as T}from"./footprints-CfMi7MiN.js";import{A as te,C as E,D,F as O,G as ne,I as k,K as A,O as j,P as M,Q as re,S as ie,T as ae,U as oe,X as se,Y as ce,Z as le,_ as ue,b as de,g as fe,j as pe,k as me,m as he,n as ge,p as N,r as P,t as _e,x as ve}from"./index-D1ooswLS.js";var F={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};F.node;var ye=C(F),I={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};I.node;var be=C(I),L={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};L.node;var xe=C(L),R={name:`send-horizontal`,size:24,node:[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]],aliases:[`send-horizonal`]};R.node;var Se=C(R),z={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};z.node;var Ce=C(z),B=1,we=.9,Te=.8,Ee=.17,De=.1,Oe=.999,ke=.9999,Ae=.99,je=/[\\\/_+.#"@\[\(\{&]/,Me=/[\\\/_+.#"@\[\(\{&]/g,Ne=/[\s-]/,Pe=/[\s-]/g;function Fe(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?B:Ae;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Fe(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=B:je.test(e.charAt(l-1))?(d*=Te,p=e.slice(i,l-1).match(Me),p&&i>0&&(d*=Oe**+p.length)):Ne.test(e.charAt(l-1))?(d*=we,m=e.slice(i,l-1).match(Pe),m&&i>0&&(d*=Oe**+m.length)):(d*=Ee,i>0&&(d*=Oe**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ke)),(d<De&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Fe(e,t,n,r,l+1,a+2,o),f*De>d&&(d=f*De)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ie(e){return e.toLowerCase().replace(Pe,` `)}function Le(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Fe(e,t,Ie(e),Ie(t),0,0,{})}var V=t(e(),1),H=`[cmdk-group=""]`,Re=`[cmdk-group-items=""]`,ze=`[cmdk-group-heading=""]`,Be=`[cmdk-item=""]`,Ve=`${Be}:not([aria-disabled="true"])`,He=`cmdk-item-select`,U=`data-value`,Ue=(e,t,n)=>Le(e,t,n),We=V.createContext(void 0),W=()=>V.useContext(We),Ge=V.createContext(void 0),Ke=()=>V.useContext(Ge),qe=V.createContext(void 0),Je=V.forwardRef((e,t)=>{let n=q(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=q(()=>new Set),i=q(()=>new Map),a=q(()=>new Map),o=q(()=>new Set),l=at(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=s(),ee=s(),x=s(),S=V.useRef(null),C=st();K(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,w.emit()}},[f]),K(()=>{C(6,ne)},[]);let w=V.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),C(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=k()?.id,w.emit()}),r||C(5,ne),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=V.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,te(t,r)),C(2,()=>{E(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{O(),E(),n.current.value||D(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();C(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:x,labelId:ee,listInnerRef:S}),[]);function te(e,t){let r=l.current?.filter??Ue;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;A().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Re);t?t.appendChild(e.parentElement===t?e:e.closest(`${Re} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Re} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${H}[${U}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=A().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(U);w.setState(`value`,e||void 0)}function O(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=te(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ne(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(H)?.querySelector(ze))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return S.current?.querySelector(`${Be}[aria-selected="true"]`)}function A(){return Array.from(S.current?.querySelectorAll(Ve)||[])}function j(e){let t=A()[e];t&&w.setState(`value`,t.getAttribute(U))}function M(e){var t;let n=k(),r=A(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(U))}function re(e){let t=k()?.closest(H),n;for(;t&&!n;)t=e>0?rt(t,H):it(t,H),n=t?.querySelector(Ve);n?w.setState(`value`,n.getAttribute(U)):M(e)}let ie=()=>j(A().length-1),ae=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?re(1):M(1)},oe=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?re(-1):M(-1)};return V.createElement(c.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&ae(e);break;case`ArrowDown`:ae(e);break;case`p`:case`k`:v&&e.ctrlKey&&oe(e);break;case`ArrowUp`:oe(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),ie();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(He);t.dispatchEvent(e)}}}}},V.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:lt},u),Y(e,e=>V.createElement(Ge.Provider,{value:w},V.createElement(We.Provider,{value:T},e))))}),Ye=V.forwardRef((e,t)=>{let n=s(),r=V.useRef(null),i=V.useContext(qe),a=W(),o=at(e),l=o.current?.forceMount??i?.forceMount;K(()=>{if(!l)return a.item(n,i?.id)},[l]);let u=ot(n,r,[e.value,e.children,r],e.keywords),f=Ke(),p=J(e=>e.value&&e.value===u.current),m=J(e=>l||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);V.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(He,h),()=>t.removeEventListener(He,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=o.current).onSelect)==null||t.call(e,u.current)}function g(){f.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:ee,...x}=e;return V.createElement(c.div,{ref:d(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||a.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),Xe=V.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=s(),l=V.useRef(null),u=V.useRef(null),f=s(),p=W(),m=J(e=>i||p.filter()===!1?!0:!e.search||e.filtered.groups.has(o));K(()=>p.group(o),[]),ot(o,l,[e.value,e.heading,u]);let h=V.useMemo(()=>({id:o,forceMount:i}),[i]);return V.createElement(c.div,{ref:d(l,t),...a,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&V.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),Y(e,e=>V.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},V.createElement(qe.Provider,{value:h},e))))}),Ze=V.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=V.useRef(null),a=J(e=>!e.search);return!n&&!a?null:V.createElement(c.div,{ref:d(i,t),...r,"cmdk-separator":``,role:`separator`})}),Qe=V.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Ke(),o=J(e=>e.search),s=J(e=>e.selectedItemId),l=W();return V.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),V.createElement(c.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":s,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),$e=V.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=V.useRef(null),o=V.useRef(null),s=J(e=>e.selectedItemId),l=W();return V.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),V.createElement(c.div,{ref:d(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:l.listId},Y(e,e=>V.createElement(`div`,{ref:d(o,l.listInnerRef),"cmdk-list-sizer":``},e)))}),et=V.forwardRef((e,t)=>{let{open:n,onOpenChange:i,overlayClassName:o,contentClassName:s,container:c,...l}=e;return V.createElement(a,{open:n,onOpenChange:i},V.createElement(_,{container:c},V.createElement(r,{"cmdk-overlay":``,className:o}),V.createElement(y,{"aria-label":e.label,"cmdk-dialog":``,className:s},V.createElement(Je,{ref:t,...l}))))}),tt=V.forwardRef((e,t)=>J(e=>e.filtered.count===0)?V.createElement(c.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),nt=V.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return V.createElement(c.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Y(e,e=>V.createElement(`div`,{"aria-hidden":!0},e)))}),G=Object.assign(Je,{List:$e,Item:Ye,Input:Qe,Group:Xe,Separator:Ze,Dialog:et,Empty:tt,Loading:nt});function rt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function it(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function at(e){let t=V.useRef(e);return K(()=>{t.current=e}),t}var K=typeof window>`u`?V.useEffect:V.useLayoutEffect;function q(e){let t=V.useRef();return t.current===void 0&&(t.current=e()),t}function J(e){let t=Ke(),n=()=>e(t.snapshot());return V.useSyncExternalStore(t.subscribe,n,n)}function ot(e,t,n,r=[]){let i=V.useRef(),a=W();return K(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(U,s),i.current=s}),i}var st=()=>{let[e,t]=V.useState(),n=q(()=>new Map);return K(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function ct(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Y({asChild:e,children:t},n){return e&&V.isValidElement(t)?V.cloneElement(ct(t),{ref:t.ref},n(t.props.children)):n(t)}var lt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},X=n();function Z({icon:e,children:t,onSelect:n,kbd:r,value:i,keywords:a}){return(0,X.jsxs)(G.Item,{value:i,keywords:a,onSelect:n,className:`flex h-9 cursor-default items-center gap-3 rounded-[8px] px-2.5 text-[13px] text-fg-2 data-[selected=true]:bg-hover data-[selected=true]:text-fg [&_svg]:size-[15px] [&_svg]:text-fg-3`,children:[e,(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r&&(0,X.jsx)(N,{children:r})]})}function Q({heading:e,children:t}){return(0,X.jsx)(G.Group,{heading:e,className:`px-1.5 pb-1 [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:pt-2.5 [&_[cmdk-group-heading]]:text-[11.5px] [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-fg-3`,children:t})}var $=e=>f.getState().setUi({panelOpen:!0,panelTab:e}),ut=(e,t,n)=>{let r=Ue(e,t,n);return r<.2?0:r};function dt(){let e=u(e=>e.overlay===`palette`),t=u(e=>e.changes.some(e=>e.status===`preview`)),n=u(e=>!!e.selection),r=u(e=>!!e.status?.app),a=u(e=>e.status?.app?.id??null),s=u(e=>e.recorder),c=b(e=>e.live.status===`recording`),d=o(e=>e.apps),_=f(e=>e.theme),y=_===`dark`||_===`system`&&matchMedia(`(prefers-color-scheme: dark)`).matches,C=l(),[F,I]=(0,V.useState)(``),L=()=>{x({overlay:null}),I(``)},R=e=>()=>{L(),setTimeout(e,0)},z=F.trim(),B=R(()=>void g.handleUtterance(z,null,`typed`));return(0,X.jsx)(h,{open:e,onOpenChange:e=>e?x({overlay:`palette`}):L(),title:`Command palette`,position:`top`,focusFirst:!0,className:`w-[min(600px,calc(100vw-32px))]`,children:(0,X.jsxs)(G,{loop:!0,vimBindings:!1,filter:ut,className:`flex min-h-0 flex-col`,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),z&&B())},children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-3.5`,children:[(0,X.jsx)(E,{className:`size-4 text-fg-3`}),(0,X.jsx)(G.Input,{value:F,onValueChange:I,autoFocus:!0,placeholder:`Search commands…`,className:`h-12 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-fg-3`}),(0,X.jsx)(N,{children:`Esc`})]}),(0,X.jsxs)(G.List,{className:`max-h-[380px] overflow-y-auto py-1`,children:[(0,X.jsxs)(G.Empty,{className:`px-4 py-6 text-center text-[12.5px] text-fg-3`,children:[`No command matches “`,z,`”.`]}),t&&(0,X.jsxs)(Q,{heading:`Preview`,children:[(0,X.jsx)(Z,{icon:(0,X.jsx)(S,{}),kbd:`↵`,onSelect:R(()=>void g.keep(`palette`)),keywords:[`keep`,`accept`],children:`Keep the preview`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ue,{}),kbd:v(`mod+z`),onSelect:R(()=>void g.undo(`palette`)),keywords:[`undo`,`revert`],children:`Undo the preview`})]}),r&&(0,X.jsxs)(Q,{heading:`Modes`,children:[(0,X.jsxs)(Z,{icon:(0,X.jsx)(ve,{}),kbd:`E`,onSelect:R(()=>g.setMode(`edit`)),children:[P.edit,`: point and change`]}),(0,X.jsxs)(Z,{icon:(0,X.jsx)(me,{}),kbd:`U`,onSelect:R(()=>g.setMode(`use`)),children:[P.use,`: click through the app`]}),(0,X.jsxs)(Z,{icon:(0,X.jsx)(k,{}),kbd:`R`,onSelect:R(()=>g.setMode(`record`)),keywords:[`record a bug`,`playwright`,`check`],children:[P.record,`: narrate a bug, get a Playwright test`]})]}),r&&(0,X.jsxs)(Q,{heading:`Test and review`,children:[c?(0,X.jsx)(Z,{icon:(0,X.jsx)(de,{}),onSelect:R(()=>void ee.stop()),keywords:[`record session`,`test session`],children:`Stop recording and write the report`}):(0,X.jsx)(Z,{icon:(0,X.jsx)(A,{}),onSelect:R(()=>b.setState({setup:!0})),keywords:[`test session`,`report`,`recording`],children:`Record session: use the app, get a report`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(m,{}),onSelect:R(()=>($(`experts`),void he.run())),keywords:[`experts`,`audit`,`accessibility`,`seo`,`ux`,`content`],children:`Review this page with the Experts`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(fe,{}),onSelect:R(()=>($(`sessions`),setTimeout(()=>document.querySelector(`[data-autopilot-goal]`)?.focus(),250))),keywords:[`autopilot`,`explore`,`ai tester`],children:`Autopilot: let the AI test your app…`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(xe,{}),onSelect:R(()=>$(`sessions`)),keywords:[`reports`,`recordings`],children:`Sessions and their reports`}),(s.expectations.length>0||s.spec)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z,{icon:(0,X.jsx)(fe,{}),onSelect:R(()=>void g.generateTest()),children:`Generate test`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(D,{}),onSelect:R(()=>void g.runTest()),children:`Run test`}),s.run?.status===`failed`&&(0,X.jsxs)(Z,{icon:(0,X.jsx)(m,{}),onSelect:R(()=>void g.fix()),children:[`Fix with `,C]})]})]}),n&&(0,X.jsxs)(Q,{heading:`Selection`,children:[(0,X.jsx)(Z,{icon:(0,X.jsx)(ce,{}),kbd:`↑`,onSelect:R(()=>void g.step(`parent`)),children:`Select what contains it`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(le,{}),kbd:`↓`,onSelect:R(()=>void g.step(`child`)),children:`Select inside it`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(se,{}),kbd:`→`,onSelect:R(()=>void g.step(`next`)),children:`Select the next one`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(w,{}),kbd:`←`,onSelect:R(()=>void g.step(`prev`)),children:`Select the previous one`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(oe,{}),kbd:`O`,onSelect:R(()=>void g.openInEditor()),children:`Open in editor`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ye,{}),kbd:`Esc`,onSelect:R(()=>g.clearTargets()),children:`Clear the selection`})]}),(0,X.jsx)(Q,{heading:`Voice`,children:(0,X.jsx)(Z,{icon:(0,X.jsx)(pe,{}),kbd:`Space`,onSelect:R(()=>g.startTalk(`toggle`)),children:`Start talking (hands-free)`})}),(0,X.jsxs)(Q,{heading:`Apps`,children:[r&&(0,X.jsx)(Z,{icon:(0,X.jsx)(ae,{}),onSelect:R(()=>g.reloadApp()),children:`Reload the app`}),d.filter(e=>e.id!==a).map(e=>(0,X.jsxs)(Z,{value:`switch ${e.id} ${e.name}`,icon:(0,X.jsx)(re,{}),onSelect:R(()=>void i.open(e.id)),keywords:[`switch`,`open`,e.name],children:[`Switch to `,e.name]},e.id)),(0,X.jsx)(Z,{icon:(0,X.jsx)(p,{}),onSelect:R(()=>i.show(`folder`)),keywords:[`add`,`folder`,`address`,`github`],children:`Link an app…`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(M,{}),onSelect:R(()=>i.show()),children:`All apps`}),r&&Object.keys(ge).map(e=>(0,X.jsxs)(Z,{icon:(0,X.jsx)(te,{}),onSelect:R(()=>f.getState().setUi({device:e})),children:[`Viewport: `,ge[e].label]},e))]}),(0,X.jsxs)(Q,{heading:`Studio`,children:[(0,X.jsx)(Z,{icon:(0,X.jsx)(j,{}),kbd:`\\`,onSelect:R(()=>f.getState().setUi({panelOpen:!f.getState().ui.panelOpen})),children:`Toggle panel`}),(0,X.jsx)(Z,{icon:y?(0,X.jsx)(Ce,{}):(0,X.jsx)(be,{}),onSelect:R(()=>f.getState().set({theme:y?`light`:`dark`})),keywords:[`theme`,`dark`,`light`,`mode`,`appearance`,`colors`],children:y?`Switch to light theme`:`Switch to dark theme`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ie,{}),onSelect:R(()=>x({overlay:`settings`,settingsTab:`general`})),keywords:[`preferences`,`options`],children:`Settings`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(m,{}),onSelect:R(()=>x({overlay:`settings`,settingsTab:`ai`})),keywords:[`connect`,`api key`,`model`,`claude`,`chatgpt`,`gemini`],children:`Settings: connect an AI`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(O,{}),onSelect:R(()=>x({overlay:`settings`,settingsTab:`usage`})),keywords:[`cost`,`budget`,`spend`,`money`],children:`Settings: usage and budget`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ne,{}),kbd:`?`,onSelect:R(()=>x({overlay:`help`})),keywords:[`help`,`keys`],children:`Phrases and shortcuts`}),(0,X.jsx)(Z,{icon:(0,X.jsx)(T,{}),onSelect:R(()=>_e.start()),keywords:[`tour`,`intro`,`getting started`,`onboarding`,`learn`],children:`Take the quick-start tour`})]})]}),z&&(0,X.jsxs)(`button`,{onClick:B,className:`flex h-11 shrink-0 items-center gap-3 border-t border-line px-4 text-start text-[13px] text-fg-2 hover:bg-hover hover:text-fg [&_svg]:size-[15px]`,"data-send-request":!0,children:[(0,X.jsx)(Se,{className:`shrink-0 text-ai-fg`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Send as a request: “`,z,`” `,(0,X.jsxs)(`span`,{className:`text-fg-3`,children:[`· a quick edit, or `,C===`AI`?`the AI`:C]})]}),(0,X.jsx)(N,{children:v(`mod+enter`)})]})]})})}export{dt as CommandPalette};
@@ -1 +1 @@
1
- import{r as e}from"./cn-Wq33h1G4.js";import{d as t,dt as n,f as r,i,p as a,ut as o}from"./brand-BSL9G2NW.js";import{t as s}from"./footprints-Bc2dzReV.js";import{p as c,t as l}from"./index-C3xqQUPf.js";import{shortcutsFor as u}from"./SettingsDialog-CS5w9CxJ.js";var d=e(),f=[[`make this bigger`,`Steps the size or padding prop up.`],[`make this look like that`,`Copies the look of a second element. Point at each as you say it.`],[`rename this to Pay now`,`Changes the text.`],[`move this above that`,`Reorders elements.`],[`remove this`,`Deletes the element (it is a preview, so you can undo).`],[`why is the total wrong?`,`The AI answers with file and line references.`],[`the card · the button inside`,`Selects the nearest one around or inside what is selected.`],[`go up · go inside · next · previous`,`Moves the selection. Also ↑ ↓ ← →.`],[`add this · deselect`,`Adds what you point at to the selection; clears it.`],[`keep it · undo · cancel`,`Decide on the preview.`],[`this should show $80.80`,`In Write test mode: adds a check to the test.`],[`generate test · run test · fix it`,`Turn the narration into a Playwright test, then fix the bug.`],[`mark this`,`While recording a session: marks the moment for the report.`]];function p(){let e=n(e=>e.overlay===`help`),p=n(e=>!!e.status?.app),m=u();return(0,d.jsxs)(i,{open:e,onOpenChange:e=>o({overlay:e?`help`:null}),title:`Phrases and shortcuts`,className:`w-[min(720px,calc(100vw-32px))]`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-3.5`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Point, speak, build`}),(0,d.jsx)(`p`,{className:`text-[12.5px] text-fg-3`,children:`“This” and “that” mean whatever you point at while you say them.`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!p&&(0,d.jsx)(`span`,{className:`text-[12px] text-fg-3`,children:`Starts once an app is open`}),(0,d.jsx)(t,{icon:(0,d.jsx)(s,{}),onClick:()=>{o({overlay:null}),l.start()},"data-take-tour":!0,children:`Take the tour`}),(0,d.jsx)(r,{onClick:()=>o({overlay:null}),"aria-label":`Close`,children:(0,d.jsx)(a,{})})]})]}),(0,d.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-6 overflow-y-auto p-5 md:grid-cols-2`,children:[(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`h3`,{className:`mb-2.5 text-[12px] font-medium text-fg-3`,children:`Say`}),(0,d.jsx)(`ul`,{className:`space-y-2.5`,children:f.map(([e,t])=>(0,d.jsxs)(`li`,{children:[(0,d.jsxs)(`span`,{className:`block text-[12.5px] font-medium text-human-fg`,children:[`“`,e,`”`]}),(0,d.jsx)(`span`,{className:`block text-[12px] leading-snug text-fg-3`,children:t})]},e))})]}),(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`h3`,{className:`mb-2.5 text-[12px] font-medium text-fg-3`,children:`Keyboard`}),(0,d.jsx)(`ul`,{className:`space-y-1.5`,children:m.map(([e,t])=>(0,d.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-fg-2`,children:e}),(0,d.jsx)(`span`,{className:`flex shrink-0 gap-1`,children:t.map((e,t)=>e===`–`?(0,d.jsx)(`span`,{className:`text-fg-3`,children:`–`},t):(0,d.jsx)(c,{children:e},t))})]},e))})]})]})]})}export{p as HelpDialog};
1
+ import{r as e}from"./cn-Wq33h1G4.js";import{d as t,dt as n,f as r,i,p as a,ut as o}from"./brand-BcIB43Uo.js";import{t as s}from"./footprints-CfMi7MiN.js";import{p as c,t as l}from"./index-D1ooswLS.js";import{shortcutsFor as u}from"./SettingsDialog-CIpvauuY.js";var d=e(),f=[[`make this bigger`,`Steps the size or padding prop up.`],[`make this look like that`,`Copies the look of a second element. Point at each as you say it.`],[`rename this to Pay now`,`Changes the text.`],[`move this above that`,`Reorders elements.`],[`remove this`,`Deletes the element (it is a preview, so you can undo).`],[`why is the total wrong?`,`The AI answers with file and line references.`],[`the card · the button inside`,`Selects the nearest one around or inside what is selected.`],[`go up · go inside · next · previous`,`Moves the selection. Also ↑ ↓ ← →.`],[`add this · deselect`,`Adds what you point at to the selection; clears it.`],[`keep it · undo · cancel`,`Decide on the preview.`],[`this should show $80.80`,`In Write test mode: adds a check to the test.`],[`generate test · run test · fix it`,`Turn the narration into a Playwright test, then fix the bug.`],[`mark this`,`While recording a session: marks the moment for the report.`]];function p(){let e=n(e=>e.overlay===`help`),p=n(e=>!!e.status?.app),m=u();return(0,d.jsxs)(i,{open:e,onOpenChange:e=>o({overlay:e?`help`:null}),title:`Phrases and shortcuts`,className:`w-[min(720px,calc(100vw-32px))]`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-3.5`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Point, speak, build`}),(0,d.jsx)(`p`,{className:`text-[12.5px] text-fg-3`,children:`“This” and “that” mean whatever you point at while you say them.`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!p&&(0,d.jsx)(`span`,{className:`text-[12px] text-fg-3`,children:`Starts once an app is open`}),(0,d.jsx)(t,{icon:(0,d.jsx)(s,{}),onClick:()=>{o({overlay:null}),l.start()},"data-take-tour":!0,children:`Take the tour`}),(0,d.jsx)(r,{onClick:()=>o({overlay:null}),"aria-label":`Close`,children:(0,d.jsx)(a,{})})]})]}),(0,d.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-6 overflow-y-auto p-5 md:grid-cols-2`,children:[(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`h3`,{className:`mb-2.5 text-[12px] font-medium text-fg-3`,children:`Say`}),(0,d.jsx)(`ul`,{className:`space-y-2.5`,children:f.map(([e,t])=>(0,d.jsxs)(`li`,{children:[(0,d.jsxs)(`span`,{className:`block text-[12.5px] font-medium text-human-fg`,children:[`“`,e,`”`]}),(0,d.jsx)(`span`,{className:`block text-[12px] leading-snug text-fg-3`,children:t})]},e))})]}),(0,d.jsxs)(`section`,{children:[(0,d.jsx)(`h3`,{className:`mb-2.5 text-[12px] font-medium text-fg-3`,children:`Keyboard`}),(0,d.jsx)(`ul`,{className:`space-y-1.5`,children:m.map(([e,t])=>(0,d.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-fg-2`,children:e}),(0,d.jsx)(`span`,{className:`flex shrink-0 gap-1`,children:t.map((e,t)=>e===`–`?(0,d.jsx)(`span`,{className:`text-fg-3`,children:`–`},t):(0,d.jsx)(c,{children:e},t))})]},e))})]})]})]})}export{p as HelpDialog};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,r as n,t as r}from"./cn-Wq33h1G4.js";import{At as i,Ot as a,_ as o,a as s,at as c,d as l,dt as u,f as d,ft as f,g as p,h as m,it as h,m as g,mt as _,nt as v,p as y,pt as b,r as x,rt as S,st as C,t as w,u as T,v as E,vt as D,y as O}from"./brand-BSL9G2NW.js";import{t as k}from"./arrow-left-BpsxETMA.js";import{n as A,r as j,t as M}from"./refresh-cw-DocKnJID.js";import{$ as ee,B as te,D as ne,E as re,G as ie,I as ae,J as oe,L as se,M as ce,N as le,U as ue,V as de,W as fe,a as pe,at as me,c as he,ct as ge,dt as _e,et as N,g as ve,h as ye,it as be,k as xe,l as Se,lt as Ce,nt as we,o as Te,ot as Ee,q as De,rt as Oe,s as ke,st as Ae,tt as je,ut as Me,v as P,w as Ne,y as Pe,z as Fe}from"./index-C3xqQUPf.js";var F={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};F.node;var Ie=O(F),I={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};I.node;var Le=O(I),L={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};L.node;var Re=O(L),R={name:`clipboard-copy`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]};R.node;var ze=O(R),z={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};z.node;var Be=O(z),B={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};B.node;var Ve=O(B),V={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};V.node;var H=O(V),U={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};U.node;var He=O(U),Ue={name:`list-restart`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]};Ue.node;var W=O(Ue),We={name:`navigation`,size:24,node:[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]};We.node;var Ge=O(We),Ke={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Ke.node;var qe=O(Ke),Je={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};Je.node;var Ye=O(Je),Xe={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Xe.node;var Ze=O(Xe),Qe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Qe.node;var $e=O(Qe),et={name:`thumbs-up`,size:24,node:[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]};et.node;var tt=O(et),G=t(e(),1),K=n(),q={critical:{bar:`bg-bad`,chip:`bg-bad text-inverse`},high:{bar:`bg-[#f76b15]`,chip:`bg-[#f76b15]/15 text-[#a94405] dark:text-[#ff8a3d]`},medium:{bar:`bg-warn/70`,chip:`bg-warn-soft text-warn`},low:{bar:`bg-fg-3/50`,chip:`bg-active text-fg-2`}},J={fixed:{chip:`bg-ok-soft text-ok`,bar:`bg-ok`,icon:De},still:{chip:`bg-bad-soft text-bad`,bar:`bg-bad`,icon:fe},unknown:{chip:`bg-active text-fg-2`,bar:`bg-fg-3/40`,icon:ie}};function nt({r:e,t,lang:n}){let i=J[e.verdict],a=i.icon;return(0,K.jsxs)(`span`,{className:r(`inline-flex items-center gap-1 rounded-[5px] px-1.5 py-px text-[10.5px] font-semibold`,i.chip),title:n===`ar`?e.whyAr:e.why,"data-verdict":e.verdict,children:[(0,K.jsx)(a,{className:`size-3`}),t.verdicts[e.verdict]]})}function rt(e,t,n){let r=n.find(e=>e.shot)?.shot;if(r)return r;let i=t.issues.find(t=>e.evidence.includes(t.id)||t.evidence.some(t=>e.evidence.includes(t)));if(i?.shot)return i.shot;let a=n[0]?.t;if(a==null||!t.shots.length)return null;let o=t.shots[0];for(let e of t.shots)Math.abs(e.t-a-500)<Math.abs(o.t-a-500)&&(o=e);return Math.abs(o.t-a)<1e4?o.name:null}function it(e,t,n){let r=n.find(e=>e.kind===`speech`),i=e=>e.replace(/[^\p{L}\p{N}]+/gu,` `).trim().toLowerCase();if(e.quote){let n=i(e.quote).slice(0,40),r=t.transcript.find(e=>i(e.text).includes(n)||n.includes(i(e.text).slice(0,30)));if(r)return r}return r?t.transcript.find(e=>e.start===r.t)??null:null}function at(e){let t=e.split(`
1
+ import{i as e,o as t,r as n,t as r}from"./cn-Wq33h1G4.js";import{At as i,Ot as a,_ as o,a as s,at as c,d as l,dt as u,f as d,ft as f,g as p,h as m,it as h,m as g,mt as _,nt as v,p as y,pt as b,r as x,rt as S,st as C,t as w,u as T,v as E,vt as D,y as O}from"./brand-BcIB43Uo.js";import{t as k}from"./arrow-left-5LUh_bW3.js";import{n as A,r as j,t as M}from"./refresh-cw-BM1RSPTL.js";import{$ as ee,B as te,D as ne,E as re,G as ie,I as ae,J as oe,L as se,M as ce,N as le,U as ue,V as de,W as fe,a as pe,at as me,c as he,ct as ge,dt as _e,et as N,g as ve,h as ye,it as be,k as xe,l as Se,lt as Ce,nt as we,o as Te,ot as Ee,q as De,rt as Oe,s as ke,st as Ae,tt as je,ut as Me,v as P,w as Ne,y as Pe,z as Fe}from"./index-D1ooswLS.js";var F={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};F.node;var Ie=O(F),I={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};I.node;var Le=O(I),L={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};L.node;var Re=O(L),R={name:`clipboard-copy`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]};R.node;var ze=O(R),z={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};z.node;var Be=O(z),B={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};B.node;var Ve=O(B),V={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};V.node;var H=O(V),U={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};U.node;var He=O(U),Ue={name:`list-restart`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]};Ue.node;var W=O(Ue),We={name:`navigation`,size:24,node:[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]};We.node;var Ge=O(We),Ke={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Ke.node;var qe=O(Ke),Je={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};Je.node;var Ye=O(Je),Xe={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Xe.node;var Ze=O(Xe),Qe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Qe.node;var $e=O(Qe),et={name:`thumbs-up`,size:24,node:[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]};et.node;var tt=O(et),G=t(e(),1),K=n(),q={critical:{bar:`bg-bad`,chip:`bg-bad text-inverse`},high:{bar:`bg-[#f76b15]`,chip:`bg-[#f76b15]/15 text-[#a94405] dark:text-[#ff8a3d]`},medium:{bar:`bg-warn/70`,chip:`bg-warn-soft text-warn`},low:{bar:`bg-fg-3/50`,chip:`bg-active text-fg-2`}},J={fixed:{chip:`bg-ok-soft text-ok`,bar:`bg-ok`,icon:De},still:{chip:`bg-bad-soft text-bad`,bar:`bg-bad`,icon:fe},unknown:{chip:`bg-active text-fg-2`,bar:`bg-fg-3/40`,icon:ie}};function nt({r:e,t,lang:n}){let i=J[e.verdict],a=i.icon;return(0,K.jsxs)(`span`,{className:r(`inline-flex items-center gap-1 rounded-[5px] px-1.5 py-px text-[10.5px] font-semibold`,i.chip),title:n===`ar`?e.whyAr:e.why,"data-verdict":e.verdict,children:[(0,K.jsx)(a,{className:`size-3`}),t.verdicts[e.verdict]]})}function rt(e,t,n){let r=n.find(e=>e.shot)?.shot;if(r)return r;let i=t.issues.find(t=>e.evidence.includes(t.id)||t.evidence.some(t=>e.evidence.includes(t)));if(i?.shot)return i.shot;let a=n[0]?.t;if(a==null||!t.shots.length)return null;let o=t.shots[0];for(let e of t.shots)Math.abs(e.t-a-500)<Math.abs(o.t-a-500)&&(o=e);return Math.abs(o.t-a)<1e4?o.name:null}function it(e,t,n){let r=n.find(e=>e.kind===`speech`),i=e=>e.replace(/[^\p{L}\p{N}]+/gu,` `).trim().toLowerCase();if(e.quote){let n=i(e.quote).slice(0,40),r=t.transcript.find(e=>i(e.text).includes(n)||n.includes(i(e.text).slice(0,30)));if(r)return r}return r?t.transcript.find(e=>e.start===r.t)??null:null}function at(e){let t=e.split(`
2
2
  `),n=e=>/^\s*at\s/.test(e);return{prose:t.filter(e=>!n(e)).join(` `).trim(),frames:t.filter(n).map(e=>e.trim())}}function ot({text:e}){let{prose:t,frames:n}=at(e);return(0,K.jsxs)(K.Fragment,{children:[t&&(0,K.jsx)(`p`,{className:`text-fg`,children:t}),n.length>0&&(0,K.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`Stack trace`,className:`overflow-x-auto rounded-[8px] bg-sunken px-3 py-2 font-mono text-[11.5px] leading-relaxed text-fg-2 ring-1 ring-inset ring-line`,dir:`ltr`,children:n.join(`
3
3
  `)})]})}function st({f:e,a:t,t:n,act:i,index:a,start:s,verdict:u,lang:d}){let[f,p]=(0,G.useState)(a<3),h=c(),g=D(e,t),_=rt(e,t,g),v=it(e,t,g),y=g[0]?.t,b=q[e.severity];return(0,K.jsxs)(`article`,{className:`group relative overflow-hidden rounded-[14px] bg-raised ring-1 ring-inset ring-line transition-shadow hover:ring-line-strong`,"data-finding":e.id,"data-verdict":u?.verdict,children:[(0,K.jsx)(`span`,{className:r(`absolute inset-y-0 start-0 w-[3px]`,b.bar)}),(0,K.jsxs)(`button`,{onClick:()=>p(!f),className:`flex w-full items-start gap-3 px-4 pb-3 pt-3.5 text-start`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[u&&(0,K.jsx)(nt,{r:u,t:n,lang:d}),(0,K.jsx)(`span`,{className:r(`rounded-[5px] px-1.5 py-px text-[10.5px] font-semibold uppercase tracking-[0.04em]`,b.chip),children:n.severity[e.severity]}),(0,K.jsx)(`span`,{className:`rounded-[5px] px-1.5 py-px text-[10.5px] font-medium text-fg-3 ring-1 ring-inset ring-line`,children:n.category[e.category]}),y!=null&&(0,K.jsx)(`span`,{className:`tabular text-[11px] text-fg-3`,children:Y(y-s)}),e.confidence!==`high`&&(0,K.jsxs)(`span`,{className:`text-[11px] text-fg-3`,children:[`· `,n.confidence(e.confidence)]})]}),(0,K.jsx)(`h3`,{className:`mt-1.5 text-[14.5px] font-semibold leading-snug tracking-[-0.01em] text-fg`,children:e.title}),!f&&(0,K.jsx)(`p`,{className:`mt-1 line-clamp-1 text-[12.5px] text-fg-3`,children:at(e.what).prose})]}),_&&!f&&(0,K.jsx)(`img`,{src:i.shotUrl(_),alt:``,className:`h-12 w-20 shrink-0 rounded-[6px] object-cover object-top ring-1 ring-line`,loading:`lazy`}),(0,K.jsx)(o,{className:r(`mt-1 size-4 shrink-0 text-fg-3 transition-transform`,f&&`rotate-180`)})]}),f&&(0,K.jsxs)(`div`,{className:`grid gap-4 px-4 pb-4 md:grid-cols-[1fr_auto]`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 space-y-3 text-[13px] leading-relaxed text-fg-2`,children:[u&&(0,K.jsxs)(`p`,{className:r(`rounded-[8px] px-2.5 py-1.5 text-[12.5px]`,J[u.verdict].chip),"data-verdict-why":!0,children:[(0,K.jsxs)(`span`,{className:`font-semibold`,children:[n.verdicts[u.verdict],`: `]}),d===`ar`?u.whyAr:u.why]}),(0,K.jsx)(ot,{text:e.what}),e.quote&&(0,K.jsxs)(`figure`,{className:`flex items-start gap-2 rounded-[10px] bg-human-soft px-3 py-2`,children:[(0,K.jsx)(Ye,{className:`mt-0.5 size-3.5 shrink-0 text-human-fg`}),(0,K.jsx)(`blockquote`,{dir:`auto`,className:`min-w-0 flex-1 text-[13px] font-medium text-fg`,children:e.quote}),v&&(0,K.jsx)(`button`,{title:n.play,onClick:()=>i.play(v),className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-human text-[#1b1203] hover:brightness-105`,children:(0,K.jsx)(ne,{className:`size-3 fill-current`})})]}),e.expected&&(0,K.jsxs)(`p`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.expected,`: `]}),e.expected]}),(0,K.jsxs)(`div`,{className:`rounded-[10px] bg-ai-soft/60 px-3 py-2 ring-1 ring-inset ring-ai-line/25`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11.5px] font-semibold text-ai-fg`,children:[(0,K.jsx)(ve,{className:`size-3.5`}),n.howToFix]}),(0,K.jsx)(`p`,{className:`text-fg`,children:e.fix}),e.location&&(0,K.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-[6px] bg-raised px-2 py-0.5 font-mono text-[11.5px] text-fg-2 ring-1 ring-inset ring-line`,dir:`ltr`,title:n.where,children:[(0,K.jsx)(ue,{className:`size-3`}),e.location]}),e.shown&&e.shown!==e.location&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[11.5px] text-fg-3`,"data-shown":!0,children:[n.shownAt,`:`,` `,(0,K.jsx)(`span`,{className:`font-mono`,dir:`ltr`,children:e.shown})]})]}),e.steps.length>0&&(0,K.jsxs)(`details`,{className:`group/steps`,children:[(0,K.jsxs)(`summary`,{className:`cursor-default list-none text-[12px] font-medium text-fg-3 hover:text-fg-2`,children:[(0,K.jsx)(o,{className:`me-1 inline size-3 transition-transform group-open/steps:rotate-180`}),n.steps,` (`,e.steps.length,`)`]}),(0,K.jsx)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 ps-6 text-[12.5px]`,children:e.steps.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:[(0,K.jsx)(l,{size:`sm`,variant:`ai`,icon:(0,K.jsx)(m,{}),onClick:()=>i.fix(e),children:n.fixWith(h)}),(0,K.jsx)(l,{size:`sm`,icon:(0,K.jsx)(ae,{}),onClick:()=>i.test(e),children:n.createTest}),y!=null&&(0,K.jsx)(l,{size:`sm`,variant:`ghost`,icon:(0,K.jsx)(A,{}),onClick:()=>i.show(y),children:n.showMoment}),(0,K.jsx)(l,{size:`sm`,variant:`ghost`,icon:(0,K.jsx)(j,{}),onClick:()=>i.skip(e),"data-skip":!0,children:n.skip}),e.evidence.length>0&&(0,K.jsxs)(`span`,{className:`ms-auto text-[11px] text-fg-3`,dir:`ltr`,children:[n.evidence,`: `,e.evidence.slice(0,6).join(` `)]})]})]}),_&&(0,K.jsx)(`button`,{onClick:()=>i.zoom(_),className:`block self-start overflow-hidden rounded-[10px] ring-1 ring-line transition hover:ring-line-strong md:w-[260px]`,children:(0,K.jsx)(`img`,{src:i.shotUrl(_),alt:`Screenshot at this moment`,className:`w-full object-cover object-top`,loading:`lazy`})})]})]})}function Y(e){let t=Math.max(0,Math.round(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function ct({findings:e,skipped:t,analysis:n,t:i,act:a,start:s,verdicts:u,lang:d}){let[f,p]=(0,G.useState)(`all`),[h,g]=(0,G.useState)(!1),_=c(),v=e.filter(e=>!t.has(e.id)),y=e.filter(e=>t.has(e.id)),b=v.reduce((e,t)=>(e[t.severity]=(e[t.severity]??0)+1,e),{}),x=f===`all`?v:v.filter(e=>e.severity===f),S=u?v.filter(e=>u[e.id]?.verdict!==`fixed`):v;return(0,K.jsxs)(`section`,{className:`space-y-3`,"data-findings":!0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-[15px] font-semibold text-fg`,children:[(0,K.jsx)(Ie,{className:`size-4 text-fg-3`}),i.findings,(0,K.jsx)(`span`,{className:`tabular text-fg-3`,children:v.length})]}),S.length>1&&(0,K.jsx)(l,{size:`sm`,variant:`ai`,icon:(0,K.jsx)(m,{}),onClick:()=>a.fixAll(S),title:i.fixAllHint,"data-fix-all":!0,children:i.fixAll(S.length,_)}),(0,K.jsx)(`div`,{className:`ms-auto flex flex-wrap gap-1`,children:[`all`,`critical`,`high`,`medium`,`low`].map(e=>e===`all`||b[e]?(0,K.jsxs)(`button`,{onClick:()=>p(e),className:r(`h-6 rounded-full px-2.5 text-[11.5px] font-medium ring-1 ring-inset ring-line`,f===e?`bg-fg text-inverse ring-fg`:`text-fg-2 hover:bg-hover`),children:[e===`all`?i.all:i.severity[e],` `,e!==`all`&&(0,K.jsx)(`span`,{className:`tabular opacity-70`,children:b[e]})]},e):null)})]}),!v.length&&(0,K.jsx)(`p`,{className:`rounded-[14px] bg-ok-soft px-4 py-3 text-[13px] text-ok`,children:i.noFindings}),(0,K.jsx)(`div`,{className:`space-y-2.5`,children:x.map((e,t)=>(0,K.jsx)(st,{f:e,a:n,t:i,act:a,index:t,start:s,verdict:u?.[e.id],lang:d},e.id))}),y.length>0&&(0,K.jsxs)(`div`,{className:`rounded-[14px] ring-1 ring-inset ring-line`,"data-skipped":!0,children:[(0,K.jsxs)(`button`,{onClick:()=>g(!h),className:`flex w-full items-center gap-2 px-4 py-2.5 text-start text-[12.5px] font-medium text-fg-3 hover:text-fg-2`,children:[(0,K.jsx)(j,{className:`size-3.5`}),i.skippedTitle(y.length),(0,K.jsx)(o,{className:r(`ms-auto size-3.5 transition-transform`,h&&`rotate-180`)})]}),h&&(0,K.jsxs)(`div`,{className:`space-y-1 border-t border-line px-2 py-2`,children:[(0,K.jsx)(`p`,{className:`px-2 pb-1 text-[11.5px] text-fg-3`,children:i.skippedHint}),y.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-[8px] px-2 py-1.5 hover:bg-hover`,children:[(0,K.jsx)(`span`,{className:r(`rounded-[5px] px-1.5 py-px text-[10px] font-semibold uppercase`,q[e.severity].chip),children:i.severity[e.severity]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] text-fg-3 line-through decoration-fg-3/40`,children:e.title}),(0,K.jsx)(l,{size:`xs`,variant:`ghost`,icon:(0,K.jsx)(re,{}),onClick:()=>a.restore(e),children:i.restore})]},e.id))]})]})]})}function X({value:e,children:t}){return(0,K.jsx)(we,{value:e,className:`relative h-8 px-1 text-[12.5px] font-medium text-fg-3 transition-colors hover:text-fg-2 data-[state=active]:text-fg data-[state=active]:after:absolute data-[state=active]:after:inset-x-0 data-[state=active]:after:-bottom-px data-[state=active]:after:h-0.5 data-[state=active]:after:bg-fg`,children:t})}var Z=50;function lt(e,t){let[n,r]=(0,G.useState)(Z),i=e.length-n,a=i>0?(0,K.jsx)(`button`,{onClick:()=>r(n+Z),className:`block w-full rounded-[8px] px-2.5 py-2 text-center text-[12px] font-medium text-fg-2 hover:bg-hover`,"data-show-more":!0,children:t.showMore(Math.min(Z,i))}):null;return{shown:e.slice(0,n),more:a}}function ut({analysis:e,start:t,onPick:n,lang:i,t:o}){let s=e.issues.filter(e=>e.kind===`error`||e.kind===`console`),c=lt(s,o),l=lt(e.pages,o),u=(e.more?.issues.error??0)+(e.more?.issues.console??0);return(0,K.jsxs)(`section`,{className:`rounded-[14px] bg-raised ring-1 ring-inset ring-line`,children:[(0,K.jsxs)(ee,{defaultValue:`errors`,children:[(0,K.jsxs)(je,{className:`flex gap-5 border-b border-line px-4`,children:[(0,K.jsxs)(X,{value:`errors`,children:[o.tabs.errors,` (`,s.length,`)`]}),(0,K.jsxs)(X,{value:`network`,children:[o.tabs.network,` (`,e.network.total,`)`]}),(0,K.jsx)(X,{value:`perf`,children:o.tabs.speed}),(0,K.jsxs)(X,{value:`pages`,children:[o.tabs.pages,` (`,e.pages.length,`)`]})]}),(0,K.jsxs)(N,{value:`errors`,className:`max-h-[420px] space-y-2 overflow-y-auto p-3 outline-none`,children:[!s.length&&(0,K.jsx)(`p`,{className:`p-4 text-center text-[12.5px] text-fg-3`,children:o.noErrors}),c.shown.map(e=>(0,K.jsxs)(`button`,{onClick:()=>n(e.t),className:`block w-full rounded-[10px] bg-sunken p-3 text-start ring-1 ring-inset ring-line hover:ring-line-strong`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] font-medium text-bad`,children:[i===`ar`?e.titleAr??e.title:e.title,e.count>1&&(0,K.jsxs)(`span`,{className:`rounded-[4px] bg-bad-soft px-1 text-[10.5px]`,children:[`×`,e.count]})]}),e.src&&(0,K.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-fg-2`,children:e.src}),e.detail&&(0,K.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-hidden whitespace-pre-wrap text-[11px] leading-relaxed text-fg-3`,dir:`ltr`,children:e.detail})]},e.id)),c.more,u>0&&(0,K.jsx)(`p`,{className:`px-2 py-1 text-center text-[11.5px] text-fg-3`,children:o.notListed(u)})]}),(0,K.jsxs)(N,{value:`network`,className:`max-h-[420px] overflow-y-auto p-2 outline-none`,children:[(0,K.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{className:`text-start text-[11px] text-fg-3`,children:[(0,K.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:o.cols.request}),(0,K.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:o.cols.calls}),(0,K.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:o.cols.avg}),(0,K.jsx)(`th`,{className:`px-2 py-1.5 text-start font-medium`,children:o.cols.status})]})}),(0,K.jsx)(`tbody`,{children:e.network.endpoints.map(e=>(0,K.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,K.jsxs)(`td`,{className:`max-w-[340px] truncate px-2 py-1.5 font-mono text-[11.5px] text-fg`,dir:`ltr`,children:[(0,K.jsx)(`span`,{className:`text-fg-3`,children:e.method}),` `,e.url]}),(0,K.jsx)(`td`,{className:`tabular px-2 py-1.5 text-fg-2`,children:e.count}),(0,K.jsx)(`td`,{className:r(`tabular px-2 py-1.5`,e.avgMs>1500?`text-warn`:`text-fg-2`),children:a(e.avgMs)}),(0,K.jsx)(`td`,{className:`px-2 py-1.5`,children:e.statuses.map(e=>(0,K.jsx)(`span`,{className:r(`me-1 rounded-[4px] px-1 font-mono text-[10.5px]`,e===0||e>=400?`bg-bad-soft text-bad`:`bg-ok-soft text-ok`),children:e||`ERR`},e))})]},`${e.method} ${e.url}`))})]}),!e.network.endpoints.length&&(0,K.jsx)(`p`,{className:`p-4 text-center text-[12.5px] text-fg-3`,children:o.noRequests})]}),(0,K.jsx)(N,{value:`perf`,className:`grid grid-cols-2 gap-2 p-3 outline-none md:grid-cols-3`,children:[[i===`ar`?`أول رسم`:`First paint`,a(e.perf.fcp),e.perf.fcp!=null&&e.perf.fcp>1800],[i===`ar`?`المحتوى الرئيسي`:`Main content`,a(e.perf.lcp),e.perf.lcp!=null&&e.perf.lcp>2500],[i===`ar`?`إزاحة التخطيط`:`Layout shift`,e.perf.cls.toFixed(3),e.perf.cls>.1],[i===`ar`?`أبطأ تفاعل`:`Slowest interaction`,a(e.perf.slowestInteraction),(e.perf.slowestInteraction??0)>200],[i===`ar`?`عمل التطبيق الطويل`:`App busy (long tasks)`,`${e.perf.longTasks} · ${a(e.perf.longTaskMs)}`,e.perf.longTaskMs>2e3],[i===`ar`?`طلبات بطيئة`:`Slow requests`,String(e.network.slow),e.network.slow>0]].map(([e,t,n])=>(0,K.jsxs)(`div`,{className:`rounded-[10px] bg-sunken p-3 ring-1 ring-inset ring-line`,children:[(0,K.jsx)(`div`,{className:`text-[11.5px] text-fg-3`,children:e}),(0,K.jsx)(`div`,{className:r(`tabular mt-1 text-[17px] font-semibold`,n?`text-warn`:`text-fg`),children:t})]},String(e)))}),(0,K.jsxs)(N,{value:`pages`,className:`max-h-[420px] overflow-y-auto p-2 outline-none`,children:[l.shown.map((e,r)=>(0,K.jsxs)(`button`,{onClick:()=>n(e.t),className:`flex w-full items-center gap-3 rounded-[8px] px-2.5 py-2 text-start hover:bg-hover`,children:[(0,K.jsx)(`span`,{className:`tabular w-10 text-[11.5px] text-fg-3`,children:Y(e.t-t)}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] text-fg`,children:e.title||e.url}),(0,K.jsx)(`span`,{className:`truncate font-mono text-[11px] text-fg-3`,dir:`ltr`,children:e.url}),(0,K.jsx)(`span`,{className:`tabular text-[11.5px] text-fg-2`,children:a(e.ms)})]},r)),l.more]})]}),(!!e.summarised||!!e.dropped)&&(0,K.jsx)(`p`,{className:`border-t border-line px-4 py-2 text-[11.5px] text-fg-3`,children:[e.summarised?o.summarised(e.summarised):``,e.dropped?o.dropped(e.dropped):``].filter(Boolean).join(` `)})]})}var Q={en:{back:`Back to the studio`,overall:`Overall`,stability:`Stability`,usability:`Ease of use`,performance:`Speed`,accessibility:`Accessibility`,vsPrevious:`vs previous`,findings:`Findings`,noFindings:`No errors, failed requests or friction were recorded.`,suggestions:`Suggestions`,fix:`Fix`,improve:`Improve`,add:`Add`,journey:`What the tester did`,positives:`What worked`,nextSteps:`Next steps`,expected:`Expected`,where:`Where to fix`,shownAt:`Where it showed`,howToFix:`How to fix`,steps:`Steps to reproduce`,evidence:`Evidence`,confidence:e=>`${e} confidence`,fixWith:e=>`Fix with ${e}`,createTest:`Create test`,showMoment:`Show moment`,play:`Play what was said`,verdict:{ship:`No serious problems found`,"fix-first":`Fix first`,blocked:`Blocked`},clean:`No technical problems found`,scope:`Saywright looks for errors, failed requests, slow responses and signs of frustration. It can’t tell whether the values on screen are right.`,addCheck:`Add a check`,addCheckHint:`Point at a value that must be right, like a total, and say what it should show: it becomes a test.`,tryAutopilot:`Let Autopilot try the main flows`,severity:{critical:`Critical`,high:`High`,medium:`Medium`,low:`Low`},category:{bug:`Bug`,usability:`Usability`,performance:`Performance`,accessibility:`Accessibility`,content:`Content`,reliability:`Reliability`},effort:{small:`small`,medium:`medium`,large:`large`},effortIs:e=>`Effort: ${e}`,writtenBy:(e,t)=>`Written by ${e}${t?` in ${t} s`:``}, from the evidence below.`,writtenLocally:`Written on this computer from what was recorded. Connect an AI in Settings → AI for root causes and fixes.`,all:`All`,tone:{good:`good`,fair:`fair`,poor:`poor`},skip:`Skip`,restore:`Restore`,skippedTitle:e=>`Skipped (${e})`,skippedHint:`Set aside: not counted and not fixed. Rewriting the report won’t raise them again.`,fixAll:(e,t)=>`Fix all with ${t} (${e})`,fixAllHint:`Every finding you didn’t skip, in one request, with its evidence.`,implementSelected:e=>`Implement selected (${e})`,selectAll:`Select all`,selectNone:`Clear`,pickHint:e=>`Tick the ones to implement, then send them to ${e} together.`,timeline:`Timeline`,transcript:`Transcript`,correct:`Correct`,save:`Save`,cancel:`Cancel`,corrected:`corrected`,heard:e=>`Heard: “${e}”`,correctHint:`Click a sentence to correct a word or spelling. The recording stays as it was.`,notInReport:e=>`${e} corrected sentence${e===1?` isn’t`:`s aren’t`} in this report yet.`,rewrite:`Rewrite the report`,noNarration:`No narration in this session.`,pointingAt:e=>`pointing at ${e}`,translating:`Translating…`,translate:`Translate`,translatedFrom:(e,t)=>`Translated by ${t??`AI`} from the ${e===`ar`?`Arabic`:`English`} report.`,notTranslated:`Not translated yet.`,tabs:{errors:`Errors`,network:`Network`,speed:`Speed`,pages:`Pages`},chips:{all:`All`,speech:`Said`,issues:`Issues`,actions:`Actions`,network:`Network`},noErrors:`No JavaScript errors or console errors.`,noRequests:`The app made no requests.`,summarised:e=>`${e.toLocaleString(`en`)} similar event${e===1?` was`:`s were`} summarised: each one is in the counts.`,dropped:e=>`${e.toLocaleString(`en`)} event${e===1?` wasn’t`:`s weren’t`} recorded: the app’s page couldn’t keep them while the studio wasn’t answering.`,nothingHere:`Nothing here.`,cols:{request:`Request`,calls:`Calls`,avg:`Avg`,status:`Status`},verify:`Verify fixes`,verifyHint:`Play this session’s steps again in your app, now, and check whether each finding still happens.`,verifying:`Comparing the replay with the session…`,verdicts:{fixed:`Fixed`,still:`Still happens`,unknown:`Couldn’t check`},replayed:(e,t)=>`Replayed ${e} of ${t} step${t===1?``:`s`}`,verifySummary:(e,t,n)=>[e&&`${e} fixed`,t&&`${t} still happen${t===1?`s`:``}`,n&&`${n} couldn’t be checked`].filter(Boolean).join(` · `),stoppedAt:(e,t)=>`Stopped at “${e}” (${t}).`,fresh:`New in the replay`,verifiedAgo:e=>`Checked ${e}`,againBtn:`Replay again`,verifyTitle:`Checked by a replay`,noSteps:`This session has no clicks or typing to replay.`,showMore:e=>`Show ${e} more`,notListed:e=>`${e.toLocaleString(`en-US`)} more like these aren’t listed.`,momentsNotListed:e=>`${e.toLocaleString(`en-US`)} repeated or routine moments aren’t listed.`},ar:{back:`العودة إلى الاستوديو`,overall:`التقييم العام`,stability:`الاستقرار`,usability:`سهولة الاستخدام`,performance:`السرعة`,accessibility:`إمكانية الوصول`,vsPrevious:`مقارنة بالسابقة`,findings:`الملاحظات`,noFindings:`لم تُسجَّل أخطاء ولا طلبات فاشلة ولا صعوبات.`,suggestions:`الاقتراحات`,fix:`إصلاح`,improve:`تحسين`,add:`إضافة`,journey:`ما قام به المختبِر`,positives:`ما نجح`,nextSteps:`الخطوات التالية`,expected:`المتوقع`,where:`مكان الإصلاح`,shownAt:`مكان ظهورها`,howToFix:`طريقة الإصلاح`,steps:`خطوات إعادة المشكلة`,evidence:`الأدلة`,confidence:e=>`ثقة ${{low:`منخفضة`,medium:`متوسطة`,high:`عالية`}[e]}`,fixWith:e=>`أصلحها مع ${e===`AI`?`الذكاء الاصطناعي`:e}`,createTest:`أنشئ اختبارًا`,showMoment:`اعرض اللحظة`,play:`شغّل ما قيل`,verdict:{ship:`لا مشكلات خطيرة`,"fix-first":`يحتاج إصلاحًا أولًا`,blocked:`متوقف`},clean:`لم تُرصد مشكلات تقنية`,scope:`يبحث Saywright عن الأخطاء والطلبات الفاشلة والاستجابات البطيئة وعلامات التعثّر، لكنه لا يستطيع أن يعرف إن كانت القيم المعروضة صحيحة.`,addCheck:`أضف فحصًا`,addCheckHint:`أشر إلى قيمة يجب أن تكون صحيحة، كالإجمالي، وقل ما يجب أن تعرضه: تصبح اختبارًا.`,tryAutopilot:`دع Autopilot يجرّب المسارات الرئيسية`,severity:{critical:`حرج`,high:`مرتفع`,medium:`متوسط`,low:`منخفض`},category:{bug:`خلل`,usability:`سهولة الاستخدام`,performance:`الأداء`,accessibility:`إمكانية الوصول`,content:`المحتوى`,reliability:`الاعتمادية`},effort:{small:`صغير`,medium:`متوسط`,large:`كبير`},effortIs:e=>`الجهد: ${e}`,writtenBy:(e,t)=>`كتبه ${e}${t?` في ${t} ثانية`:``} اعتمادًا على الأدلة أدناه.`,writtenLocally:`كُتب على هذا الجهاز مما سُجّل. اربط ذكاءً اصطناعيًا في الإعدادات ← الذكاء الاصطناعي للحصول على الأسباب الجذرية وطرق الإصلاح.`,all:`الكل`,tone:{good:`جيد`,fair:`مقبول`,poor:`ضعيف`},skip:`تجاهل`,restore:`استعادة`,skippedTitle:e=>`المتجاهَلة (${e})`,skippedHint:`جُنّبت: لا تُحسب ولا تُصلَح، ولن يطرحها التقرير مجددًا عند إعادة كتابته.`,fixAll:(e,t)=>`أصلح الكل مع ${t===`AI`?`الذكاء الاصطناعي`:t} (${e})`,fixAllHint:`كل ملاحظة لم تتجاهلها، في طلب واحد، مع أدلتها.`,implementSelected:e=>`نفّذ المحدَّد (${e})`,selectAll:`تحديد الكل`,selectNone:`إلغاء التحديد`,pickHint:e=>`حدّد ما تريد تنفيذه، ثم أرسله إلى ${e===`AI`?`الذكاء الاصطناعي`:e} دفعة واحدة.`,timeline:`الخط الزمني`,transcript:`نص الكلام`,correct:`صحّح`,save:`حفظ`,cancel:`إلغاء`,corrected:`مُصحَّحة`,heard:e=>`سُمِع: «${e}»`,correctHint:`انقر جملة لتصحيح كلمة أو إملاء. يبقى التسجيل كما هو.`,notInReport:e=>e===1?`جملة مصحَّحة لم تدخل هذا التقرير بعد.`:e===2?`جملتان مصحَّحتان لم تدخلا هذا التقرير بعد.`:`${e} ${e<=10?`جمل مصحَّحة`:`جملة مصحَّحة`} لم تدخل هذا التقرير بعد.`,rewrite:`أعد كتابة التقرير`,noNarration:`لا كلام مسجَّل في هذه الجلسة.`,pointingAt:e=>`أثناء الإشارة إلى ${e}`,translating:`جارٍ الترجمة…`,translate:`ترجم`,translatedFrom:(e,t)=>`ترجمه ${t??`الذكاء الاصطناعي`} من التقرير ${e===`ar`?`العربي`:`الإنجليزي`}.`,notTranslated:`لم يُترجم بعد.`,tabs:{errors:`الأخطاء`,network:`الشبكة`,speed:`السرعة`,pages:`الصفحات`},chips:{all:`الكل`,speech:`ما قيل`,issues:`المشكلات`,actions:`الإجراءات`,network:`الشبكة`},noErrors:`لا أخطاء JavaScript ولا أخطاء في وحدة التحكم.`,noRequests:`لم يرسل التطبيق أي طلبات.`,summarised:e=>`لُخّصت أحداث متشابهة (${e}): كلٌّ منها محسوب في الأعداد.`,dropped:e=>`لم تُسجَّل بعض الأحداث (${e}): لم تستطع صفحة التطبيق الاحتفاظ بها بينما لم يكن الاستوديو يستجيب.`,nothingHere:`لا شيء هنا.`,cols:{request:`الطلب`,calls:`المرات`,avg:`المتوسط`,status:`الحالة`},verify:`تحقّق من الإصلاحات`,verifyHint:`أعد خطوات هذه الجلسة في تطبيقك الآن، وتحقّق هل ما زالت كل ملاحظة تحدث.`,verifying:`تجري مقارنة الإعادة بالجلسة…`,verdicts:{fixed:`أُصلحت`,still:`ما زالت تحدث`,unknown:`تعذّر التحقّق`},replayed:(e,t)=>`أُعيدت ${e} من ${t} خطوة`,verifySummary:(e,t,n)=>[e&&`${e} أُصلحت`,t&&`${t} ما زالت تحدث`,n&&`${n} تعذّر التحقّق منها`].filter(Boolean).join(` · `),stoppedAt:(e,t)=>`توقّفت عند «${e}» (${t}).`,fresh:`جديد في الإعادة`,verifiedAgo:e=>`آخر تحقّق ${e}`,againBtn:`أعد مرة أخرى`,verifyTitle:`التحقّق بإعادة الخطوات`,noSteps:`لا نقرات ولا كتابة في هذه الجلسة لإعادتها.`,showMore:e=>`اعرض ${e} أخرى`,notListed:e=>`${Te(e,pe.issue)} أخرى مشابهة غير مدرجة.`,momentsNotListed:e=>`${Te(e,[`لحظة واحدة`,`لحظتان`,`لحظات`,`لحظة`])} متكررة أو روتينية غير مدرجة.`}};function dt(e){return e?e.parts?.length?e.parts:[{startedAt:e.startedAt,bytes:e.bytes,file:`video.webm`}]:[]}var ft=(0,G.forwardRef)(function({id:e,video:t,shots:n,start:r,current:i,onTime:a,onZoom:o,lang:s=`en`},c){let l=(0,G.useRef)(null),u=(0,G.useRef)(!1),f=dt(t),[p,m]=(0,G.useState)(0),h=(0,G.useRef)(null),g=f[Math.min(p,f.length-1)];if((0,G.useImperativeHandle)(c,()=>({seek:e=>{if(!f.length)return;let t=0;for(let n=0;n<f.length;n++)f[n].startedAt<=e&&(t=n);let n=Math.max(0,(e-f[t].startedAt)/1e3-.5),r=l.current;t!==p||!r?(h.current={at:n,play:!1},m(t)):u.current?r.currentTime=n:h.current={at:n,play:!1}}})),(0,G.useEffect)(()=>{let e=l.current;if(!e)return;u.current=!1;let t=()=>{u.current=!0;let t=h.current;h.current=null,t&&(e.currentTime=t.at,t.play&&e.play().catch(()=>void 0))},n=()=>{e.duration===1/0||Number.isNaN(e.duration)?(e.currentTime=1e7,e.addEventListener(`timeupdate`,()=>{e.currentTime=0,t()},{once:!0})):t()};return e.addEventListener(`loadedmetadata`,n),()=>e.removeEventListener(`loadedmetadata`,n)},[t,p]),g){let t=f.indexOf(g);return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`div`,{className:`overflow-hidden rounded-[12px] bg-black ring-1 ring-line`,children:(0,K.jsx)(`video`,{ref:l,src:t===0?`/api/sessions/${e}/video.webm`:`/api/sessions/${e}/video/${t+1}`,controls:!0,preload:`auto`,className:`aspect-video w-full bg-black object-contain`,onTimeUpdate:e=>u.current&&a(g.startedAt+e.currentTarget.currentTime*1e3),onEnded:()=>{t+1>=f.length||(h.current={at:0,play:!0},m(t+1))}},t)}),f.length>1&&(0,K.jsx)(`div`,{role:`tablist`,"aria-label":`Screen recordings`,className:`flex flex-wrap gap-1`,children:f.map((e,n)=>(0,K.jsxs)(`button`,{role:`tab`,"aria-selected":n===t,onClick:()=>{h.current={at:0,play:!1},m(n)},className:`tabular rounded-[6px] px-2 py-1 text-[11px] ring-1 ring-inset ${n===t?`bg-ai-soft text-ai-fg ring-ai-line/40`:`text-fg-3 ring-line hover:text-fg`}`,children:[`Recording `,n+1,` · `,Y(e.startedAt-r),e.ms?`–${Y(e.startedAt-r+e.ms)}`:``]},e.file))})]})}if(!n.length)return(0,K.jsxs)(`div`,{className:`flex aspect-video flex-col items-center justify-center gap-2 rounded-[12px] bg-sunken text-[12px] text-fg-3 ring-1 ring-inset ring-line`,children:[(0,K.jsx)(Ve,{className:`size-5`}),s===`ar`?`لا تسجيل للشاشة في هذه الجلسة`:`No screen recording for this session`]});let _=i??n[0].t,v=0;for(let e=0;e<n.length;e++)n[e].t<=_+1500&&(v=e);let y=n[v],b=e=>a(n[Math.max(0,Math.min(n.length-1,e))].t);return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`button`,{onClick:()=>o(y.name),className:`relative block w-full overflow-hidden rounded-[12px] bg-sunken ring-1 ring-line`,children:[(0,K.jsx)(`img`,{src:`/api/sessions/${e}/shots/${y.name}`,alt:`Screen at ${Y(y.t-r)}`,className:`aspect-video w-full object-contain`}),(0,K.jsxs)(`span`,{className:`tabular absolute bottom-2 start-2 rounded-[6px] bg-black/60 px-1.5 py-0.5 text-[11px] text-white`,children:[Y(y.t-r),` · `,y.reason]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(d,{size:`sm`,onClick:()=>b(v-1),disabled:v===0,"aria-label":`Previous screenshot`,children:(0,K.jsx)(Re,{})}),(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 gap-1 overflow-x-auto py-0.5`,children:n.map((t,n)=>(0,K.jsx)(`button`,{onClick:()=>a(t.t),className:`h-9 w-14 shrink-0 overflow-hidden rounded-[5px] ring-1 ${n===v?`ring-2 ring-ai`:`ring-line opacity-70 hover:opacity-100`}`,children:(0,K.jsx)(`img`,{src:`/api/sessions/${e}/shots/${t.name}`,alt:``,loading:`lazy`,className:`h-full w-full object-cover object-top`})},t.name))}),(0,K.jsx)(d,{size:`sm`,onClick:()=>b(v+1),disabled:v===n.length-1,"aria-label":`Next screenshot`,children:(0,K.jsx)(oe,{})})]})]})});function pt(e,t){let n=0,r=e.length-2;for(;n<r;){let i=n+r>>1;e[i+1]<=t?n=i+1:r=i}return Math.max(0,n)}function mt({items:e,keyOf:t,estimate:n,render:r,className:i,reveal:a,overscan:o=500,empty:s}){let c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(new Map),[d,f]=(0,G.useState)(0),[p,m]=(0,G.useState)({top:0,height:900}),h=(0,G.useRef)(0),g=(0,G.useMemo)(()=>{let r=Array(e.length+1);r[0]=0;for(let i=0;i<e.length;i++)r[i+1]=r[i]+(u.current.get(t(e[i]))??n(e[i]));return r},[e,d]),_=e.length?pt(g,p.top-o):0,v=_;for(;v<e.length-1&&g[v+1]<p.top+p.height+o;)v++;let y=e.slice(_,v+1);return(0,G.useLayoutEffect)(()=>{let e=l.current?.children;if(!e)return;let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.dataset.vkey==null)continue;let a=y[r];if(!a)continue;let o=i.offsetHeight,s=t(a);o&&u.current.get(s)!==o&&(u.current.set(s,o),n=!0)}n&&f(e=>e+1)}),(0,G.useLayoutEffect)(()=>{let e=c.current;if(!e)return;let t=()=>m({top:e.scrollTop,height:e.clientHeight||900});t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect(),cancelAnimationFrame(h.current)}},[]),(0,G.useLayoutEffect)(()=>{if(a==null)return;let n=c.current,r=e.findIndex(e=>t(e)===a);if(!n||r<0)return;let i=g[r],o=g[r+1];i<n.scrollTop?n.scrollTop=Math.max(0,i-8):o>n.scrollTop+n.clientHeight&&(n.scrollTop=o-n.clientHeight+8)},[a]),(0,K.jsx)(`div`,{ref:c,className:i,onScroll:()=>{cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{let e=c.current;e&&m({top:e.scrollTop,height:e.clientHeight||900})})},children:e.length?(0,K.jsx)(`div`,{style:{position:`relative`,height:g[e.length]},children:(0,K.jsx)(`div`,{ref:l,style:{position:`absolute`,top:g[_],left:0,right:0},children:y.map(e=>{let n=t(e);return(0,K.jsx)(`div`,{"data-vkey":n,children:r(e)},n)})})}):s})}var ht={action:(0,K.jsx)(xe,{}),navigation:(0,K.jsx)(Ge,{}),speech:(0,K.jsx)(ce,{}),error:(0,K.jsx)(P,{}),network:(0,K.jsx)(te,{}),frustration:(0,K.jsx)(ye,{}),performance:(0,K.jsx)(Pe,{}),mark:(0,K.jsx)(se,{}),shot:(0,K.jsx)(Le,{}),command:(0,K.jsx)(ve,{}),console:(0,K.jsx)($e,{})},gt={speech:`text-human-fg`,error:`text-bad`,frustration:`text-bad`,network:`text-warn`,performance:`text-warn`,mark:`text-ai-fg`,console:`text-warn`};function _t({items:e,omitted:t=0,start:n,current:i,onPick:a,lang:o,t:s}){let c=e=>o===`ar`?e.textAr??e.text:e.text,l=e=>o===`ar`?e.detailAr??e.detail:e.detail,[u,d]=(0,G.useState)(`all`),f=(0,G.useMemo)(()=>e.filter(e=>e.kind===`shot`?!1:u===`all`?!0:u===`speech`?e.kind===`speech`||e.kind===`mark`:u===`issues`?!!e.issue||e.kind===`error`||e.kind===`frustration`:u===`network`?e.kind===`network`:e.kind===`action`||e.kind===`navigation`||e.kind===`command`),[e,u]),p=i==null?null:f.reduce((e,t)=>t.t<=i+300?t:e,null),m={speech:e.filter(e=>e.kind===`speech`).length,issues:e.filter(e=>e.issue).length},h=[{id:`all`,label:s.chips.all},{id:`speech`,label:`${s.chips.speech} ${m.speech}`},{id:`issues`,label:`${s.chips.issues} ${m.issues}`},{id:`actions`,label:s.chips.actions},{id:`network`,label:s.chips.network}];return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 px-3 pb-2`,children:h.map(e=>(0,K.jsx)(`button`,{onClick:()=>d(e.id),className:r(`h-6 rounded-full px-2.5 text-[11.5px] font-medium ring-1 ring-inset ring-line`,u===e.id?`bg-fg text-inverse ring-fg`:`text-fg-2 hover:bg-hover`),children:e.label},e.id))}),t>0&&(0,K.jsx)(`p`,{className:`px-3.5 pb-2 text-[11px] text-fg-3`,children:s.momentsNotListed(t)}),(0,K.jsx)(mt,{className:`min-h-0 flex-1 overflow-y-auto px-1.5 pb-3`,items:f,keyOf:e=>e.id,estimate:e=>e.kind===`speech`?56:e.src?48:32,reveal:p?.id??null,render:e=>(0,K.jsx)(vt,{x:e,start:n,active:p?.id===e.id,text:e.kind===`speech`?`“${e.text}”`:c(e),detail:e.kind===`speech`&&e.detail?l(e):void 0,onPick:a}),empty:(0,K.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-fg-3`,children:s.nothingHere})})]})}var vt=(0,G.memo)(function({x:e,start:t,active:n,text:i,detail:a,onPick:o}){return(0,K.jsxs)(`button`,{"data-tl":e.id,onClick:()=>o(e),className:r(`flex w-full items-start gap-2 rounded-[8px] px-2 py-1.5 text-start transition-colors hover:bg-hover`,n&&`bg-active`,e.kind===`speech`&&`py-2`),children:[(0,K.jsx)(`span`,{className:`tabular w-9 shrink-0 pt-px text-[11px] text-fg-3`,children:Y(e.t-t)}),(0,K.jsx)(`span`,{className:r(`pt-[3px] text-fg-3 [&_svg]:size-[13px]`,gt[e.kind]),children:ht[e.kind]}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{dir:e.kind===`speech`?`auto`:void 0,className:r(`block text-[12.5px] leading-snug`,e.kind===`speech`?`font-medium text-fg`:`text-fg-2`,(e.kind===`error`||e.kind===`frustration`)&&`text-bad`),children:i}),a||e.src?(0,K.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-3`,children:[a&&(0,K.jsx)(`span`,{children:a}),e.src&&(0,K.jsx)(`span`,{className:`truncate font-mono`,dir:`ltr`,children:e.src})]}):null]}),e.issue&&(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded-[4px] bg-bad-soft px-1 text-[10px] font-semibold text-bad`,children:e.issue})]})});function yt(e){if(e.description)return e.description;let t=e.label||e.text;return t?`the “${t.slice(0,40)}” ${e.role??e.name}`:e.name}function bt(e){let{meta:t,analysis:n,report:r}=e;if(!n||!r)return``;let i=Q[r.lang],a=new Set(e.decisions?.skipped??[]),o=new Set((e.report??r).findings.filter(e=>a.has(e.title)).map(e=>e.id)),s=r.findings.filter(e=>!o.has(e.id)),c=[],l=n.scores;c.push(`## ${r.title}`,``),c.push(`**${t.name}** · ${new Date(t.startedAt).toLocaleString()} · ${Y(n.durationMs)} · ${t.appUrl}${t.git?` · \`${t.git.branch}@${t.git.commit}\``:``}`,``),c.push(r.summary,``),c.push(`| ${i.overall} | ${i.stability} | ${i.usability} | ${i.performance} | ${i.accessibility} |`,`|---|---|---|---|---|`,`| **${l.overall}** | ${l.stability.score} | ${l.usability.score} | ${l.performance.score} | ${l.accessibility.score} |`,``);let u=e.verification,d=u?s.map(e=>u.findings[e.id]).filter(Boolean):[];if(u&&d.length){let e=e=>d.filter(t=>t.verdict===e).length,t=u.steps.failed;c.push(`**${i.verifyTitle}:** ${i.verifySummary(e(`fixed`),e(`still`),e(`unknown`))}. ${i.replayed(u.steps.done,u.steps.total)}.${t?` ${i.stoppedAt(r.lang===`ar`?t.descriptionAr??t.description:t.description,he(t.reason,r.lang))}`:``}`,``)}if(s.length&&(c.push(`### ${i.findings}`,``),s.forEach((e,t)=>{let n=u?.findings[e.id];c.push(`${t+1}. **[${i.severity[e.severity]}] ${e.title}**${n?` · ${n.verdict===`fixed`?`✅`:n.verdict===`still`?`❌`:`❔`} ${i.verdicts[n.verdict]}: ${r.lang===`ar`?n.whyAr:n.why}`:``}`),c.push(` ${e.what}`),e.quote&&c.push(` > “${e.quote}”`),e.expected&&c.push(` ${i.expected}: ${e.expected}`),e.location&&c.push(` ${i.where}: \`${e.location}\``),c.push(` ${i.howToFix}: ${e.fix}`),e.steps.length&&c.push(` ${i.steps}: ${e.steps.join(` → `)}`),c.push(``)})),r.suggestions.length){c.push(`### ${i.suggestions}`,``);for(let e of r.suggestions)c.push(`- **${i[e.kind]}** (${i.effort[e.effort]}): ${e.title}. ${e.why}`);c.push(``)}return r.nextSteps.length&&(c.push(`### ${i.nextSteps}`,``),r.nextSteps.forEach((e,t)=>c.push(`${t+1}. ${e}`)),c.push(``)),c.push(`_Recorded with ${w.name}${r.source===`local`?``:`; report by ${C(r.model)}`}._`),c.join(`
4
4
  `)}function xt({segments:e,start:t,current:n,t:r,reportAt:i,onPlay:a,onCorrect:o,onRewrite:s}){let[c,u]=(0,G.useState)(null),d=i==null?0:e.filter(e=>e.editedAt&&e.editedAt>i).length,f=(0,G.useRef)(null),p=n==null?null:e.reduce((e,t)=>t.start<=n+300?t:e,null);return(0,G.useEffect)(()=>{p&&c==null&&f.current?.querySelector(`[data-seg="${p.id}"]`)?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[p?.id]),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[d>0&&(0,K.jsxs)(`div`,{className:`mx-3 mb-2 flex items-center gap-2 rounded-[10px] bg-ai-soft px-3 py-2 ring-1 ring-inset ring-ai-line/30`,"data-rewrite":!0,children:[(0,K.jsx)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-snug text-ai-fg`,children:r.notInReport(d)}),(0,K.jsx)(l,{size:`xs`,variant:`ai`,icon:(0,K.jsx)(M,{}),onClick:s,children:r.rewrite})]}),e.length>0&&(0,K.jsx)(`p`,{className:`px-3.5 pb-2 text-[11.5px] leading-snug text-fg-3`,children:r.correctHint}),(0,K.jsxs)(`div`,{ref:f,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,"data-transcript":!0,children:[!e.length&&(0,K.jsx)(`p`,{className:`px-3 py-6 text-center text-[12px] text-fg-3`,children:r.noNarration}),e.map(e=>(0,K.jsx)(St,{s:e,start:t,t:r,active:p?.id===e.id,editing:c===e.id,onEdit:t=>u(t?e.id:null),onPlay:()=>a(e),onCorrect:t=>o(e,t)},e.id))]})]})}function St({s:e,start:t,t:n,active:i,editing:a,onEdit:o,onPlay:s,onCorrect:c}){let[u,d]=(0,G.useState)(e.text),[f,p]=(0,G.useState)(!1);(0,G.useEffect)(()=>d(e.text),[e.text,a]);let m=async()=>{let t=u.replace(/\s+/g,` `).trim();if(!t||t===e.text)return o(!1);p(!0);try{await c(t),o(!1)}finally{p(!1)}};return(0,K.jsxs)(`div`,{"data-seg":e.id,className:r(`group flex gap-2.5 rounded-[9px] px-2 py-2`,i&&!a?`bg-human-soft`:`hover:bg-hover`),children:[(0,K.jsxs)(`button`,{onClick:s,title:`Play`,className:`mt-px flex shrink-0 flex-col items-center gap-1 text-fg-3 hover:text-fg`,children:[(0,K.jsx)(`span`,{className:`tabular text-[11px]`,children:Y(e.start-t)}),(0,K.jsx)(ne,{className:`size-3 fill-current opacity-60 group-hover:opacity-100`})]}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`textarea`,{autoFocus:!0,dir:`auto`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),m()):e.key===`Escape`&&(e.stopPropagation(),o(!1))},rows:Math.min(5,Math.max(2,Math.ceil(u.length/48))),className:`w-full resize-none rounded-[8px] bg-sunken px-2 py-1.5 text-[13px] leading-relaxed text-fg outline-none ring-1 ring-ai-line`,"aria-label":n.correct}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(l,{size:`xs`,variant:`ai`,icon:(0,K.jsx)(E,{}),onClick:()=>void m(),disabled:f,children:n.save}),(0,K.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>o(!1),children:n.cancel}),e.original&&(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-fg-3`,dir:`auto`,children:n.heard(e.original)})]})]}):(0,K.jsx)(`button`,{onClick:()=>o(!0),className:`block w-full text-start`,title:n.correct,children:(0,K.jsxs)(`span`,{dir:`auto`,className:`block text-[13px] leading-relaxed text-fg`,children:[e.text,(0,K.jsx)(qe,{className:`ms-1.5 inline size-3 text-fg-3 opacity-0 group-hover:opacity-100`})]})}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-fg-3`,children:[(0,K.jsx)(`span`,{className:`rounded-[4px] bg-active px-1 text-[10px] uppercase`,children:e.lang}),e.original&&!a&&(0,K.jsx)(`span`,{className:`rounded-[4px] bg-ai-soft px-1 text-[10px] text-ai-fg`,title:n.heard(e.original),"data-corrected":!0,children:n.corrected}),e.el&&(0,K.jsx)(`span`,{className:`truncate`,children:n.pointingAt(yt(e.el))})]})]})]})}function Ct(e,t){let n=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),r=Math.round((e-Date.now())/1e3);if(Math.abs(r)<45)return t===`ar`?`الآن`:`just now`;let i=Math.round(r/60);if(Math.abs(i)<60)return n.format(i,`minute`);let a=Math.round(i/60);return Math.abs(a)<24?n.format(a,`hour`):n.format(Math.round(a/24),`day`)}function wt({verification:e,verifying:t,findings:n,t:i,lang:a,canReplay:o,onReplay:s}){if(t)return(0,K.jsxs)(`section`,{className:`flex items-center gap-3 rounded-[14px] bg-raised px-4 py-3.5 ring-1 ring-inset ring-ai-line/40`,"data-verification":`pending`,children:[(0,K.jsx)(T,{className:`size-4 text-ai`}),(0,K.jsx)(`span`,{className:`shimmer-text text-[13px] font-medium`,children:i.verifying})]});if(!e)return null;let c=n.map(t=>e.findings[t.id]).filter(Boolean),u={fixed:0,still:0,unknown:0};for(let e of c)u[e.verdict]++;let d=e.steps.failed;return(0,K.jsxs)(`section`,{className:`rounded-[14px] bg-raised p-4 ring-1 ring-inset ring-line`,"data-verification":`done`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-[15px] font-semibold text-fg`,children:[(0,K.jsx)(Ze,{className:`size-4 text-ai`}),i.verifyTitle]}),(0,K.jsx)(`span`,{className:`text-[11.5px] text-fg-3`,children:i.verifiedAgo(Ct(e.at,a))}),(0,K.jsx)(l,{size:`sm`,variant:`ghost`,className:`ms-auto`,icon:(0,K.jsx)(W,{}),onClick:s,disabled:!o,"data-verify-again":!0,children:i.againBtn})]}),c.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mt-3 flex h-1.5 gap-0.5 overflow-hidden rounded-full bg-sunken`,"aria-hidden":!0,children:[`fixed`,`still`,`unknown`].map(e=>u[e]?(0,K.jsx)(`span`,{className:r(`h-full`,J[e].bar),style:{width:`${u[e]/c.length*100}%`}},e):null)}),(0,K.jsx)(`p`,{className:`mt-2 text-[13px] font-medium text-fg`,"data-verify-summary":!0,children:i.verifySummary(u.fixed,u.still,u.unknown)})]}),(0,K.jsxs)(`p`,{className:`mt-1 text-[12px] text-fg-3`,"data-verify-steps":!0,children:[i.replayed(e.steps.done,e.steps.total),d&&(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(`span`,{className:`text-warn`,children:i.stoppedAt(a===`ar`?d.descriptionAr??d.description:d.description,he(d.reason,a))})]})]}),e.fresh.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 rounded-[10px] bg-warn-soft px-3 py-2`,"data-verify-fresh":!0,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[12px] font-semibold text-warn`,children:[(0,K.jsx)(P,{className:`size-3.5`}),i.fresh,` (`,e.fresh.length,`)`]}),(0,K.jsx)(`ul`,{className:`space-y-1 text-[12.5px] text-fg-2`,children:e.fresh.slice(0,8).map((e,t)=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:r(`shrink-0 rounded-[4px] px-1 text-[10px] font-semibold uppercase`,q[e.severity].chip),children:i.severity[e.severity]}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,dir:`auto`,children:a===`ar`?e.titleAr??e.title:e.title})]},t))})]})]})}function Tt(){let e=_(e=>e.open),t=_(e=>e.detail),n=_(e=>e.detailError),r=s(!!e,{onEscape:()=>!document.querySelector(`[data-lightbox]`)&&b.closeReport()});return(0,K.jsx)(S,{children:e&&(0,K.jsx)(v.div,{ref:r,tabIndex:-1,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.18},className:`fixed inset-0 z-40 flex flex-col bg-bg outline-none`,role:`dialog`,"aria-modal":`true`,"aria-label":`Session report`,children:t&&t.meta.id===e?(0,K.jsx)(Ot,{detail:t}):(0,K.jsx)(Et,{error:n})},`report`)})}function Et({error:e}){return(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-[13px] text-fg-3`,children:[e?(0,K.jsx)(`span`,{className:`text-bad`,children:e}):(0,K.jsx)(T,{}),(0,K.jsx)(l,{size:`sm`,onClick:()=>b.closeReport(),children:`Back to the studio`})]})}function Dt(e,t){let n=e.report;return n?(t??n.lang)===n.lang?n:e.translation??n:null}function Ot({detail:e}){let{meta:t,analysis:n,decisions:r}=e,i=Dt(e,_(e=>e.reportLang)),a=i?.lang??`en`,o=Q[a],[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),[f,p]=(0,G.useState)(`timeline`),m=(0,G.useRef)(null),g=(0,G.useRef)(null),x=t.startedAt,C=t.status===`processing`||t.status===`recording`,w=kt(e),T=e=>{c(e),m.current?.seek(e)},E=e=>{T(e.start);let t=g.current;if(!t||e.audioAt==null)return;t.currentTime=Math.max(0,e.audioAt-.2),t.play();let n=e.audioAt+(e.end-e.start)/1e3+.4,r=()=>{t.currentTime>=n?t.pause():t.paused||requestAnimationFrame(r)};requestAnimationFrame(r)},O=e=>{if(e.kind===`speech`){let t=n?.transcript.find(t=>t.start===e.t);if(t)return E(t)}T(e.t)},k=t=>e.report?.findings.find(e=>e.id===t)?.title,A=new Set((e.report?.findings??[]).filter(e=>r.skipped.includes(e.title)).map(e=>e.id)),j={show:T,play:E,shotUrl:e=>`/api/sessions/${t.id}/shots/${e}`,zoom:u,fix:e=>{n&&(b.closeReport(),h.fixFromReport(e,D(e,n),n))},fixAll:e=>{n&&(b.closeReport(),h.fixFindings(e.map(e=>({f:e,items:D(e,n)})),n))},test:e=>{n&&(b.closeReport(),h.testFromReport(e,D(e,n),n,t.appUrl))},skip:e=>{let n=k(e.id);n&&b.setSkipped(t.id,[...r.skipped,n])},restore:e=>{let n=k(e.id);b.setSkipped(t.id,r.skipped.filter(e=>e!==n))}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{detail:e,report:i,t:o,replay:w}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto grid max-w-[1480px] gap-6 px-5 py-6 xl:grid-cols-[minmax(0,1fr)_440px]`,dir:a===`ar`?`rtl`:`ltr`,children:[(0,K.jsxs)(`main`,{className:`min-w-0 space-y-6`,children:[(0,K.jsx)(Nt,{detail:e,report:i,t:o,busy:C,open:i?i.findings.filter(e=>!A.has(e.id)).length:0}),i&&(0,K.jsx)(wt,{verification:e.verification,verifying:e.verifying,findings:i.findings.filter(e=>!A.has(e.id)),t:o,lang:a,canReplay:w.can,onReplay:w.run}),n&&(0,K.jsx)(Se,{scores:n.scores,previous:e.previous?.scores??null,report:i,t:o}),i&&n&&(0,K.jsx)(ct,{findings:i.findings,skipped:A,analysis:n,t:o,act:j,start:x,verdicts:e.verification?.findings??null,lang:a}),i&&(0,K.jsx)(Ft,{report:i,t:o}),i&&(0,K.jsx)(It,{report:i,t:o}),n&&(0,K.jsx)(ut,{analysis:n,start:x,onPick:T,lang:a,t:o})]}),(0,K.jsx)(`aside`,{className:`min-w-0`,children:(0,K.jsxs)(`div`,{className:`space-y-3 xl:sticky xl:top-0 xl:flex xl:max-h-[calc(100vh-120px)] xl:flex-col`,children:[(0,K.jsx)(ft,{ref:m,id:t.id,video:t.video,shots:n?.shots??[],start:x,current:s,onTime:c,onZoom:u,lang:a}),t.audioSeconds>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-[10px] bg-raised px-2.5 py-1.5 ring-1 ring-inset ring-line`,children:[(0,K.jsx)(Be,{className:`size-4 shrink-0 text-fg-3`}),(0,K.jsx)(`audio`,{ref:g,src:`/api/sessions/${t.id}/audio.wav`,controls:!0,preload:`metadata`,className:`h-8 w-full`})]}),n&&(0,K.jsxs)(`div`,{className:`flex min-h-[320px] flex-col rounded-[14px] bg-raised pt-2.5 ring-1 ring-inset ring-line xl:min-h-0 xl:flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4 px-3.5 pb-2`,role:`tablist`,children:[(0,K.jsx)(At,{on:f===`timeline`,onClick:()=>p(`timeline`),children:o.timeline}),(0,K.jsxs)(At,{on:f===`transcript`,onClick:()=>p(`transcript`),children:[o.transcript,` `,(0,K.jsx)(`span`,{className:`tabular text-fg-3`,children:n.transcript.length})]}),(0,K.jsx)(`span`,{className:`tabular ms-auto text-[11.5px] text-fg-3`,children:Y(n.durationMs)})]}),f===`timeline`?(0,K.jsx)(_t,{items:n.timeline,omitted:n.more?.timeline,start:x,current:s,onPick:O,lang:a,t:o}):(0,K.jsx)(xt,{segments:n.transcript,start:x,current:s,t:o,reportAt:e.report?.at??null,onPlay:E,onCorrect:(e,n)=>b.correctSentence(t.id,e.id,n),onRewrite:()=>void b.regenerate(t.id,!0)})]})]})})]})}),(0,K.jsx)(S,{children:l&&(0,K.jsxs)(v.div,{"data-lightbox":!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-6`,onClick:()=>u(null),children:[(0,K.jsx)(`img`,{src:j.shotUrl(l),alt:``,className:`max-h-full max-w-full rounded-[10px] shadow-pop`}),(0,K.jsx)(d,{className:`absolute end-4 top-4 text-white hover:bg-white/10`,onClick:()=>u(null),"aria-label":`Close`,children:(0,K.jsx)(y,{})})]})})]})}function kt(e){let t=u(e=>!!e.replay),n=e.analysis?.steps.filter(e=>e.kind!==`navigate`&&e.locator).length??0;return{can:n>0&&e.meta.status===`ready`&&e.meta.source!==`replay`&&!e.verifying&&!t,steps:n,run:()=>void h.verifySession(e)}}function At({on:e,onClick:t,children:n}){return(0,K.jsx)(`button`,{role:`tab`,"aria-selected":e,onClick:t,className:r(`relative h-7 text-[13px] font-semibold transition-colors`,e?`text-fg after:absolute after:inset-x-0 after:-bottom-[1px] after:h-0.5 after:bg-fg`:`text-fg-3 hover:text-fg-2`),children:n})}function jt({detail:e,report:t}){let n=e.report;if(!n)return null;let i=n.lang===`ar`?`en`:`ar`,a=!e.translation&&e.translating;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-report-lang":t?.lang,children:[(0,K.jsx)(`div`,{className:`flex rounded-[8px] bg-sunken p-0.5 ring-1 ring-inset ring-line`,role:`radiogroup`,"aria-label":`Report language`,children:[`en`,`ar`].map(e=>(0,K.jsx)(`button`,{role:`radio`,"aria-checked":t?.lang===e,onClick:()=>b.setReportLang(e),className:r(`h-6 rounded-[6px] px-2 text-[12px] font-medium transition-colors`,t?.lang===e?`bg-raised text-fg shadow-sm`:`text-fg-3 hover:text-fg-2`),children:e===`en`?`English`:`العربية`},e))}),a&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-[11.5px] text-fg-3`,children:[(0,K.jsx)(T,{className:`size-3`}),(0,K.jsx)(`bdi`,{lang:i,children:Q[i].translating})]}),!e.translation&&!e.translating&&n.source!==`local`&&(0,K.jsx)(l,{size:`xs`,variant:`ghost`,icon:(0,K.jsx)(H,{}),onClick:()=>void b.retranslate(e.meta.id),children:(0,K.jsx)(`bdi`,{lang:i,children:Q[i].translate})})]})}function Mt({detail:e,report:t,t:n,replay:a}){let{meta:o}=e,[s,c]=(0,G.useState)(!1),[u,f]=(0,G.useState)(o.name),[p,h]=(0,G.useState)(!1);(0,G.useEffect)(()=>f(o.name),[o.name]);let _=o.endedAt?ke(o.endedAt-o.startedAt):null,v=o.audioSeconds>0||!!e.analysis?.transcript.length,y=async()=>{e.analysis&&t&&(await navigator.clipboard.writeText(bt({...e,report:t})),c(!0),setTimeout(()=>c(!1),1600))};return(0,K.jsxs)(`header`,{className:`flex h-[54px] shrink-0 items-center gap-3 border-b border-line bg-panel px-3`,children:[(0,K.jsx)(d,{onClick:()=>b.closeReport(),"aria-label":n.back,children:(0,K.jsx)(k,{})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[p?(0,K.jsx)(`input`,{autoFocus:!0,value:u,onChange:e=>f(e.target.value),onBlur:()=>{h(!1),u.trim()&&u!==o.name&&b.rename(o.id,u.trim())},onKeyDown:e=>e.key===`Enter`&&e.target.blur(),className:`h-6 w-full max-w-[420px] rounded-[6px] bg-sunken px-1.5 text-[13.5px] font-semibold text-fg outline-none ring-1 ring-ai-line`}):(0,K.jsx)(`button`,{onClick:()=>h(!0),className:`max-w-full truncate text-start text-[13.5px] font-semibold text-fg hover:underline hover:decoration-line-strong`,children:o.name}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate text-[11.5px] text-fg-3`,children:[(0,K.jsx)(`span`,{children:new Date(o.startedAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}),_&&(0,K.jsxs)(`span`,{children:[`· `,_]}),(0,K.jsxs)(`span`,{className:`truncate font-mono`,children:[`· `,i(o.appUrl)]}),o.git&&(0,K.jsxs)(`span`,{className:`font-mono`,children:[`· `,o.git.branch,`@`,o.git.commit,o.git.dirty?`*`:``]}),v&&(0,K.jsxs)(`span`,{children:[`· `,o.lang===`ar`?`العربية`:o.lang===`en`?`English`:`Arabic + English`]})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[o.source!==`replay`&&(0,K.jsx)(l,{size:`sm`,variant:`ai`,icon:(0,K.jsx)(W,{}),disabled:!a.can,title:a.steps?n.verifyHint:n.noSteps,onClick:a.run,"data-verify":!0,children:n.verify}),(0,K.jsx)(`span`,{className:`mx-1 h-5 w-px bg-line`}),(0,K.jsx)(jt,{detail:e,report:t}),(0,K.jsx)(`span`,{className:`mx-1 h-5 w-px bg-line`}),(0,K.jsx)(l,{size:`sm`,icon:s?(0,K.jsx)(E,{}):(0,K.jsx)(ze,{}),onClick:()=>void y(),disabled:!t,children:s?`Copied`:`Copy as Markdown`}),(0,K.jsxs)(`a`,{href:`/api/sessions/${o.id}/export.html?download=1&lang=${t?.lang??``}`,download:!0,"aria-disabled":!t||void 0,className:r(`inline-flex h-7 shrink-0 select-none items-center gap-1.5 whitespace-nowrap rounded-[7px] bg-raised px-2.5 text-[12.5px] font-medium text-fg ring-1 ring-inset ring-line-strong transition-colors hover:bg-hover [&_svg]:size-[14px]`,!t&&`pointer-events-none opacity-45`),children:[(0,K.jsx)(de,{}),`Export HTML`]}),(0,K.jsxs)(Oe,{children:[(0,K.jsx)(_e,{asChild:!0,children:(0,K.jsx)(d,{"aria-label":`More`,children:(0,K.jsx)(Fe,{})})}),(0,K.jsx)(Ee,{children:(0,K.jsxs)(be,{align:`end`,sideOffset:6,className:`z-[60] min-w-[230px] rounded-[10px] bg-raised p-1 shadow-pop`,children:[(0,K.jsx)($,{icon:(0,K.jsx)(m,{}),onSelect:()=>void b.regenerate(o.id,!0),children:`Rewrite the report`}),o.audioSeconds>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)($,{icon:(0,K.jsx)(M,{}),onSelect:()=>void b.retranscribe(o.id),children:`Transcribe the narration again`}),(0,K.jsxs)(ge,{children:[(0,K.jsxs)(Me,{className:`flex h-8 cursor-default items-center gap-2 rounded-[7px] px-2 text-[12.5px] text-fg outline-none data-[highlighted]:bg-hover [&_svg]:size-[14px] [&_svg]:text-fg-3`,children:[(0,K.jsx)(H,{}),`Transcribe as…`]}),(0,K.jsx)(Ee,{children:(0,K.jsxs)(Ce,{className:`z-[61] min-w-[160px] rounded-[10px] bg-raised p-1 shadow-pop`,children:[(0,K.jsx)($,{onSelect:()=>void b.retranscribe(o.id,`en`),children:`English`}),(0,K.jsx)($,{onSelect:()=>void b.retranscribe(o.id,`ar`),children:`العربية`}),(0,K.jsx)($,{onSelect:()=>void b.retranscribe(o.id,`auto`),children:`Arabic + English`})]})})]})]}),(0,K.jsx)(`a`,{href:`/api/sessions/${o.id}/export.html?lang=${t?.lang??``}`,target:`_blank`,rel:`noreferrer`,children:(0,K.jsx)($,{icon:(0,K.jsx)(le,{}),children:`Open the printable report`})}),(0,K.jsx)(Ae,{className:`my-1 h-px bg-line`}),(0,K.jsx)($,{icon:(0,K.jsx)(g,{}),danger:!0,onSelect:async()=>{await x({title:`Delete this session?`,body:`Its recordings, screenshots and report are deleted from this computer.`,action:`Delete session`,danger:!0})&&b.remove(o.id)},children:`Delete session`})]})})]})]})]})}function $({icon:e,children:t,onSelect:n,danger:i}){return(0,K.jsxs)(me,{onSelect:n,className:r(`flex h-8 cursor-default items-center gap-2 rounded-[7px] px-2 text-[12.5px] text-fg outline-none data-[highlighted]:bg-hover [&_svg]:size-[14px] [&_svg]:text-fg-3`,i&&`text-bad [&_svg]:text-bad`),children:[e,t]})}function Nt({detail:e,report:t,t:n,busy:i,open:a}){let{meta:o}=e;if(o.source===`replay`&&o.replayOf&&!i){let e=o.replayOf;return(0,K.jsxs)(`section`,{className:`flex items-center gap-3 rounded-[16px] bg-raised p-6 ring-1 ring-inset ring-line`,children:[(0,K.jsx)(W,{className:`size-5 text-ai`}),(0,K.jsx)(`div`,{className:`text-[13.5px] text-fg-2`,children:`A replay of another session’s steps, to check its fixes. Its results are in that session’s report.`}),(0,K.jsx)(l,{size:`sm`,className:`ms-auto`,onClick:()=>b.openReport(e),children:`Open that report`})]})}if(i||!t)return(0,K.jsx)(`section`,{className:`rounded-[16px] bg-raised p-6 ring-1 ring-inset ring-line`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[o.status===`failed`?(0,K.jsx)(y,{className:`size-5 text-bad`}):(0,K.jsx)(T,{className:`size-5 text-ai`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:o.status===`failed`?`The report couldn’t be finished`:o.status===`recording`?`Still recording…`:`Preparing the report`}),(0,K.jsx)(`div`,{className:r(`mt-0.5 text-[12.5px]`,o.status===`failed`?`text-bad`:`shimmer-text`),children:o.status===`failed`?o.error:o.stage||`Working`})]}),o.status===`failed`&&(0,K.jsx)(l,{size:`sm`,className:`ms-auto`,icon:(0,K.jsx)(M,{}),onClick:()=>void b.regenerate(o.id,!0),children:`Try again`})]})});let s={ship:`bg-ok-soft text-ok`,"fix-first":`bg-warn-soft text-warn`,blocked:`bg-bad-soft text-bad`}[t.verdict],c=t.ms?Math.round(t.ms/1e3):null;return(0,K.jsxs)(`section`,{className:`relative overflow-hidden rounded-[16px] bg-raised p-6 ring-1 ring-inset ring-line`,children:[(0,K.jsx)(`div`,{className:`pointer-events-none absolute -end-24 -top-24 size-72 rounded-full bg-ai-soft blur-3xl`}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`span`,{className:r(`inline-flex h-6 items-center rounded-full px-2.5 text-[12px] font-semibold`,s),"data-verdict-badge":!0,children:t.verdict===`ship`&&!a?n.clean:n.verdict[t.verdict]}),(0,K.jsx)(`h1`,{className:`mt-3 text-[24px] font-semibold leading-tight tracking-[-0.02em] text-fg`,children:t.title}),(0,K.jsx)(`p`,{className:`mt-2 max-w-[78ch] text-[14px] leading-relaxed text-fg-2`,children:t.summary}),t.verdict===`ship`&&(0,K.jsx)(Pt,{detail:e,t:n}),(0,K.jsxs)(`p`,{className:`mt-3 flex items-center gap-1.5 text-[11.5px] text-fg-3`,children:[t.source===`local`?(0,K.jsx)(He,{className:`size-3.5`}):(0,K.jsx)(m,{className:`size-3.5 text-ai`}),t.source===`local`?n.writtenLocally:n.writtenBy(C(t.model),c),t.translatedFrom&&(0,K.jsxs)(`span`,{children:[`· `,n.translatedFrom(t.translatedFrom,t.translatedBy&&C(t.translatedBy))]})]})]})]})}function Pt({detail:e,t}){let n=e.analysis;return(0,K.jsxs)(`div`,{className:`mt-4 max-w-[78ch] rounded-[12px] bg-sunken px-3.5 py-3 ring-1 ring-inset ring-line`,"data-scope":!0,children:[(0,K.jsx)(`p`,{className:`text-[12.5px] leading-relaxed text-fg-2`,children:t.scope}),(0,K.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-1.5`,children:[n&&(0,K.jsx)(l,{size:`sm`,icon:(0,K.jsx)(p,{}),title:t.addCheckHint,onClick:()=>(b.closeReport(),h.checkSession(n,e.meta.appUrl)),"data-add-check":!0,children:t.addCheck}),e.meta.source!==`autopilot`&&(0,K.jsx)(l,{size:`sm`,variant:`ghost`,icon:(0,K.jsx)(Ne,{}),onClick:()=>{b.closeReport(),f.getState().setUi({panelOpen:!0,panelTab:`sessions`}),setTimeout(()=>document.querySelector(`[data-autopilot-goal]`)?.focus(),250)},"data-try-autopilot":!0,children:t.tryAutopilot})]})]})}function Ft({report:e,t}){let[n,i]=(0,G.useState)(new Set),a=c();if(!e.suggestions.length)return null;let o=[`fix`,`improve`,`add`].map(t=>({k:t,items:e.suggestions.map((e,t)=>({s:e,i:t})).filter(({s:e})=>e.kind===t)})).filter(e=>e.items.length),s=e=>{let t=new Set(n);t.has(e)?t.delete(e):t.add(e),i(t)},u=()=>{let t=e.suggestions.filter((e,t)=>n.has(t));b.closeReport(),h.implementSuggestions(t,e)},d=n.size===e.suggestions.length;return(0,K.jsxs)(`section`,{className:`space-y-3`,"data-suggestions":!0,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-[15px] font-semibold text-fg`,children:[(0,K.jsx)(He,{className:`size-4 text-fg-3`}),t.suggestions]}),(0,K.jsx)(`span`,{className:`text-[11.5px] text-fg-3`,children:t.pickHint(a)}),(0,K.jsxs)(`div`,{className:`ms-auto flex items-center gap-1.5`,children:[(0,K.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>i(d?new Set:new Set(e.suggestions.map((e,t)=>t))),children:d?t.selectNone:t.selectAll}),(0,K.jsx)(l,{size:`sm`,variant:`ai`,icon:(0,K.jsx)(m,{}),disabled:!n.size,onClick:u,"data-implement":!0,children:t.implementSelected(n.size)})]})]}),(0,K.jsx)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:o.map(e=>(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`div`,{className:`text-[11.5px] font-semibold uppercase tracking-[0.06em] text-fg-3`,children:t[e.k]}),e.items.map(({s:e,i})=>(0,K.jsxs)(`label`,{className:r(`flex cursor-default gap-2.5 rounded-[12px] bg-raised p-3 ring-1 ring-inset transition-shadow`,n.has(i)?`ring-ai-line`:`ring-line hover:ring-line-strong`),children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:n.has(i),onChange:()=>s(i),className:`mt-0.5 size-3.5 shrink-0 accent-[var(--ai)]`}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`block text-[13px] font-medium leading-snug text-fg`,children:e.title}),(0,K.jsx)(`span`,{className:`mt-1 block text-[12px] leading-relaxed text-fg-3`,children:e.why}),(0,K.jsx)(`span`,{className:`mt-2 inline-block rounded-[5px] bg-active px-1.5 text-[10.5px] text-fg-2`,children:t.effortIs(t.effort[e.effort])})]})]},i))]},e.k))})]})}function It({report:e,t}){let n=[{title:t.journey,items:e.journey,icon:(0,K.jsx)(le,{className:`size-4 text-fg-3`}),ordered:!0},{title:t.positives,items:e.positives,icon:(0,K.jsx)(tt,{className:`size-4 text-ok`}),ordered:!1},{title:t.nextSteps,items:e.nextSteps,icon:(0,K.jsx)(E,{className:`size-4 text-ai`}),ordered:!0}].filter(e=>e.items.length);return n.length?(0,K.jsx)(`section`,{className:`grid gap-3 md:grid-cols-3`,children:n.map(e=>(0,K.jsxs)(`div`,{className:`rounded-[14px] bg-raised p-4 ring-1 ring-inset ring-line`,children:[(0,K.jsxs)(`h3`,{className:`mb-2 flex items-center gap-2 text-[13px] font-semibold text-fg`,children:[e.icon,e.title]}),(0,K.jsx)(`ol`,{className:r(`space-y-1.5 text-[12.5px] leading-relaxed text-fg-2`,e.ordered?`list-decimal ps-4`:`list-disc ps-4`),children:e.items.map((e,t)=>(0,K.jsx)(`li`,{children:e},t))})]},e.title))}):null}export{Tt as ReportView};