@saywright/studio 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +0 -6
  2. package/dist/bridge.js +1109 -179
  3. package/dist/cli.mjs +1966 -375
  4. package/dist/client/assets/CommandPalette-VEQNxJ4K.js +1 -0
  5. package/dist/client/assets/CommandPalette-VEQNxJ4K.js.br +0 -0
  6. package/dist/client/assets/CommandPalette-VEQNxJ4K.js.gz +0 -0
  7. package/dist/client/assets/HelpDialog-CnCVSSNP.js +1 -0
  8. package/dist/client/assets/HelpDialog-CnCVSSNP.js.br +0 -0
  9. package/dist/client/assets/HelpDialog-CnCVSSNP.js.gz +0 -0
  10. package/dist/client/assets/ReportView-BwBy4JIG.js +4 -0
  11. package/dist/client/assets/ReportView-BwBy4JIG.js.br +0 -0
  12. package/dist/client/assets/ReportView-BwBy4JIG.js.gz +0 -0
  13. package/dist/client/assets/SettingsDialog-CS5w9CxJ.js +1 -0
  14. package/dist/client/assets/SettingsDialog-CS5w9CxJ.js.br +0 -0
  15. package/dist/client/assets/SettingsDialog-CS5w9CxJ.js.gz +0 -0
  16. package/dist/client/assets/arrow-left-BpsxETMA.js +1 -0
  17. package/dist/client/assets/brand-BSL9G2NW.js +57 -0
  18. package/dist/client/assets/brand-BSL9G2NW.js.br +0 -0
  19. package/dist/client/assets/brand-BSL9G2NW.js.gz +0 -0
  20. package/dist/client/assets/footprints-Bc2dzReV.js +1 -0
  21. package/dist/client/assets/index-BrM0s_jp.css +2 -0
  22. package/dist/client/assets/index-BrM0s_jp.css.br +0 -0
  23. package/dist/client/assets/index-BrM0s_jp.css.gz +0 -0
  24. package/dist/client/assets/index-C3xqQUPf.js +19 -0
  25. package/dist/client/assets/index-C3xqQUPf.js.br +0 -0
  26. package/dist/client/assets/index-C3xqQUPf.js.gz +0 -0
  27. package/dist/client/assets/refresh-cw-DocKnJID.js +1 -0
  28. package/dist/client/index.html +3 -5
  29. package/dist/client/index.html.br +0 -0
  30. package/dist/client/index.html.gz +0 -0
  31. package/dist/sample/package.json +1 -1
  32. package/dist/sample/src/App.tsx +3 -2
  33. package/dist/sample/src/lib/route.ts +3 -2
  34. package/dist/sample/src/pages/Account.tsx +88 -0
  35. package/dist/sample/src/styles.css +5 -0
  36. package/package.json +1 -2
  37. package/dist/client/assets/Calibration-xY4YDLzU.js +0 -1
  38. package/dist/client/assets/Calibration-xY4YDLzU.js.br +0 -0
  39. package/dist/client/assets/Calibration-xY4YDLzU.js.gz +0 -0
  40. package/dist/client/assets/CommandPalette-BA3akF-p.js +0 -1
  41. package/dist/client/assets/CommandPalette-BA3akF-p.js.br +0 -0
  42. package/dist/client/assets/CommandPalette-BA3akF-p.js.gz +0 -0
  43. package/dist/client/assets/HelpDialog-C6qmdEwi.js +0 -1
  44. package/dist/client/assets/HelpDialog-C6qmdEwi.js.br +0 -0
  45. package/dist/client/assets/HelpDialog-C6qmdEwi.js.gz +0 -0
  46. package/dist/client/assets/ReportView-Bj9xxLCi.js +0 -4
  47. package/dist/client/assets/ReportView-Bj9xxLCi.js.br +0 -0
  48. package/dist/client/assets/ReportView-Bj9xxLCi.js.gz +0 -0
  49. package/dist/client/assets/SettingsDialog-VrACcdUX.js +0 -1
  50. package/dist/client/assets/SettingsDialog-VrACcdUX.js.br +0 -0
  51. package/dist/client/assets/SettingsDialog-VrACcdUX.js.gz +0 -0
  52. package/dist/client/assets/button-B2NFEpCs.js +0 -18
  53. package/dist/client/assets/button-B2NFEpCs.js.br +0 -0
  54. package/dist/client/assets/button-B2NFEpCs.js.gz +0 -0
  55. package/dist/client/assets/camera-BD9K1f5I.js +0 -1
  56. package/dist/client/assets/confirm-D1U-bFIL.js +0 -41
  57. package/dist/client/assets/confirm-D1U-bFIL.js.br +0 -0
  58. package/dist/client/assets/confirm-D1U-bFIL.js.gz +0 -0
  59. package/dist/client/assets/footprints-DiYtIryA.js +0 -1
  60. package/dist/client/assets/index-BakNwOFF.css +0 -2
  61. package/dist/client/assets/index-BakNwOFF.css.br +0 -0
  62. package/dist/client/assets/index-BakNwOFF.css.gz +0 -0
  63. package/dist/client/assets/index-DUAtV_Av.js +0 -18
  64. package/dist/client/assets/index-DUAtV_Av.js.br +0 -0
  65. package/dist/client/assets/index-DUAtV_Av.js.gz +0 -0
  66. package/dist/client/assets/preload-helper-BLdHbfdN.js +0 -1
  67. package/dist/client/assets/preload-helper-BLdHbfdN.js.br +0 -0
  68. package/dist/client/assets/preload-helper-BLdHbfdN.js.gz +0 -0
  69. package/dist/client/assets/refresh-cw-Dobx2YmO.js +0 -1
  70. package/dist/client/assets/tracker.worker-DWwj76VA.js +0 -41
  71. package/dist/client/assets/tracker.worker-DWwj76VA.js.br +0 -0
  72. package/dist/client/assets/tracker.worker-DWwj76VA.js.gz +0 -0
  73. package/dist/client/assets/vision_bundle-ByYCzljp.js +0 -41
  74. package/dist/client/assets/vision_bundle-ByYCzljp.js.br +0 -0
  75. package/dist/client/assets/vision_bundle-ByYCzljp.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-BSL9G2NW.js";import{t as w}from"./arrow-left-BpsxETMA.js";import{t as T}from"./footprints-Bc2dzReV.js";import{A as te,C as E,D,F as O,G as k,I as A,K as j,O as M,P as N,Q as ne,S as re,T as ie,U as ae,X as oe,Y as se,Z as ce,_ as le,b as ue,g as de,j as fe,k as pe,m as me,n as he,p as ge,r as _e,t as ve,x as ye}from"./index-C3xqQUPf.js";var P={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`}]]};P.node;var be=C(P),F={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`}]]};F.node;var xe=C(F),I={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`]};I.node;var Se=C(I),L={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`]};L.node;var Ce=C(L),R={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`}]]};R.node;var we=C(R),Te=1,Ee=.9,De=.8,Oe=.17,z=.1,B=.999,ke=.9999,Ae=.99,je=/[\\\/_+.#"@\[\(\{&]/,Me=/[\\\/_+.#"@\[\(\{&]/g,Ne=/[\s-]/,Pe=/[\s-]/g;function V(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Te: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=V(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Te:je.test(e.charAt(l-1))?(d*=De,p=e.slice(i,l-1).match(Me),p&&i>0&&(d*=B**+p.length)):Ne.test(e.charAt(l-1))?(d*=Ee,m=e.slice(i,l-1).match(Pe),m&&i>0&&(d*=B**+m.length)):(d*=Oe,i>0&&(d*=B**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ke)),(d<z&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=V(e,t,n,r,l+1,a+2,o),f*z>d&&(d=f*z)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Fe(e){return e.toLowerCase().replace(Pe,` `)}function Ie(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,V(e,t,Fe(e),Fe(t),0,0,{})}var H=t(e(),1),U=`[cmdk-group=""]`,Le=`[cmdk-group-items=""]`,Re=`[cmdk-group-heading=""]`,ze=`[cmdk-item=""]`,Be=`${ze}:not([aria-disabled="true"])`,Ve=`cmdk-item-select`,W=`data-value`,He=(e,t,n)=>Ie(e,t,n),Ue=H.createContext(void 0),G=()=>H.useContext(Ue),We=H.createContext(void 0),Ge=()=>H.useContext(We),Ke=H.createContext(void 0),qe=H.forwardRef((e,t)=>{let n=J(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=J(()=>new Set),i=J(()=>new Map),a=J(()=>new Map),o=J(()=>new Set),l=it(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=H.useRef(null),C=ot();q(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,w.emit()}},[f]),q(()=>{C(6,k)},[]);let w=H.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=A()?.id,w.emit()}),r||C(5,k),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=H.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=A();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??He;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;j().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(Le);t?t.appendChild(e.parentElement===t?e:e.closest(`${Le} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Le} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${U}[${W}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(W);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 k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(U)?.querySelector(Re))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return S.current?.querySelector(`${ze}[aria-selected="true"]`)}function j(){return Array.from(S.current?.querySelectorAll(Be)||[])}function M(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(W))}function N(e){var t;let n=A(),r=j(),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(W))}function ne(e){let t=A()?.closest(U),n;for(;t&&!n;)t=e>0?nt(t,U):rt(t,U),n=t?.querySelector(Be);n?w.setState(`value`,n.getAttribute(W)):N(e)}let re=()=>M(j().length-1),ie=e=>{e.preventDefault(),e.metaKey?re():e.altKey?ne(1):N(1)},ae=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ne(-1):N(-1)};return H.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&&ie(e);break;case`ArrowDown`:ie(e);break;case`p`:case`k`:v&&e.ctrlKey&&ae(e);break;case`ArrowUp`:ae(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),re();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Ve);t.dispatchEvent(e)}}}}},H.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:ct},u),X(e,e=>H.createElement(We.Provider,{value:w},H.createElement(Ue.Provider,{value:T},e))))}),Je=H.forwardRef((e,t)=>{let n=s(),r=H.useRef(null),i=H.useContext(Ke),a=G(),o=it(e),l=o.current?.forceMount??i?.forceMount;q(()=>{if(!l)return a.item(n,i?.id)},[l]);let u=at(n,r,[e.value,e.children,r],e.keywords),f=Ge(),p=Y(e=>e.value&&e.value===u.current),m=Y(e=>l||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);H.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Ve,h),()=>t.removeEventListener(Ve,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 H.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)}),Ye=H.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=s(),l=H.useRef(null),u=H.useRef(null),f=s(),p=G(),m=Y(e=>i||p.filter()===!1?!0:!e.search||e.filtered.groups.has(o));q(()=>p.group(o),[]),at(o,l,[e.value,e.heading,u]);let h=H.useMemo(()=>({id:o,forceMount:i}),[i]);return H.createElement(c.div,{ref:d(l,t),...a,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&H.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),X(e,e=>H.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},H.createElement(Ke.Provider,{value:h},e))))}),Xe=H.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=H.useRef(null),a=Y(e=>!e.search);return!n&&!a?null:H.createElement(c.div,{ref:d(i,t),...r,"cmdk-separator":``,role:`separator`})}),Ze=H.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Ge(),o=Y(e=>e.search),s=Y(e=>e.selectedItemId),l=G();return H.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),H.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)}})}),Qe=H.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=H.useRef(null),o=H.useRef(null),s=Y(e=>e.selectedItemId),l=G();return H.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)}}},[]),H.createElement(c.div,{ref:d(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:l.listId},X(e,e=>H.createElement(`div`,{ref:d(o,l.listInnerRef),"cmdk-list-sizer":``},e)))}),$e=H.forwardRef((e,t)=>{let{open:n,onOpenChange:i,overlayClassName:o,contentClassName:s,container:c,...l}=e;return H.createElement(a,{open:n,onOpenChange:i},H.createElement(_,{container:c},H.createElement(r,{"cmdk-overlay":``,className:o}),H.createElement(y,{"aria-label":e.label,"cmdk-dialog":``,className:s},H.createElement(qe,{ref:t,...l}))))}),et=H.forwardRef((e,t)=>Y(e=>e.filtered.count===0)?H.createElement(c.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),tt=H.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return H.createElement(c.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},X(e,e=>H.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(qe,{List:Qe,Item:Je,Input:Ze,Group:Ye,Separator:Xe,Dialog:$e,Empty:et,Loading:tt});function nt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function rt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function it(e){let t=H.useRef(e);return q(()=>{t.current=e}),t}var q=typeof window>`u`?H.useEffect:H.useLayoutEffect;function J(e){let t=H.useRef();return t.current===void 0&&(t.current=e()),t}function Y(e){let t=Ge(),n=()=>e(t.snapshot());return H.useSyncExternalStore(t.subscribe,n,n)}function at(e,t,n,r=[]){let i=H.useRef(),a=G();return q(()=>{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(W,s),i.current=s}),i}var ot=()=>{let[e,t]=H.useState(),n=J(()=>new Map);return q(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function st(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function X({asChild:e,children:t},n){return e&&H.isValidElement(t)?H.cloneElement(st(t),{ref:t.ref},n(t.props.children)):n(t)}var ct={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Z=n();function Q({icon:e,children:t,onSelect:n,kbd:r,value:i,keywords:a}){return(0,Z.jsxs)(K.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,Z.jsx)(`span`,{className:`flex-1 truncate`,children:t}),r&&(0,Z.jsx)(ge,{children:r})]})}function $({heading:e,children:t}){return(0,Z.jsx)(K.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 lt=e=>f.getState().setUi({panelOpen:!0,panelTab:e}),ut=(e,t,n)=>{let r=He(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=l(),[C,P]=(0,H.useState)(``),F=()=>{x({overlay:null}),P(``)},I=e=>()=>{F(),setTimeout(e,0)},L=C.trim(),R=I(()=>void g.handleUtterance(L,null,`typed`));return(0,Z.jsx)(h,{open:e,onOpenChange:e=>e?x({overlay:`palette`}):F(),title:`Command palette`,position:`top`,focusFirst:!0,className:`w-[min(600px,calc(100vw-32px))]`,children:(0,Z.jsxs)(K,{loop:!0,filter:ut,className:`flex min-h-0 flex-col`,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),L&&R())},children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-3.5`,children:[(0,Z.jsx)(E,{className:`size-4 text-fg-3`}),(0,Z.jsx)(K.Input,{value:C,onValueChange:P,autoFocus:!0,placeholder:`Search commands…`,className:`h-12 flex-1 bg-transparent text-[14px] text-fg outline-none placeholder:text-fg-3`}),(0,Z.jsx)(ge,{children:`Esc`})]}),(0,Z.jsxs)(K.List,{className:`max-h-[380px] overflow-y-auto py-1`,children:[(0,Z.jsxs)(K.Empty,{className:`px-4 py-6 text-center text-[12.5px] text-fg-3`,children:[`No command matches “`,L,`”.`]}),t&&(0,Z.jsxs)($,{heading:`Preview`,children:[(0,Z.jsx)(Q,{icon:(0,Z.jsx)(S,{}),kbd:`↵`,onSelect:I(()=>void g.keep(`palette`)),keywords:[`keep`,`accept`],children:`Keep the preview`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(le,{}),kbd:v(`mod+z`),onSelect:I(()=>void g.undo(`palette`)),keywords:[`undo`,`revert`],children:`Undo the preview`})]}),r&&(0,Z.jsxs)($,{heading:`Modes`,children:[(0,Z.jsxs)(Q,{icon:(0,Z.jsx)(ye,{}),kbd:`E`,onSelect:I(()=>g.setMode(`edit`)),children:[_e.edit,`: point and change`]}),(0,Z.jsxs)(Q,{icon:(0,Z.jsx)(pe,{}),kbd:`U`,onSelect:I(()=>g.setMode(`use`)),children:[_e.use,`: click through the app`]}),(0,Z.jsxs)(Q,{icon:(0,Z.jsx)(A,{}),kbd:`R`,onSelect:I(()=>g.setMode(`record`)),keywords:[`record a bug`,`playwright`,`check`],children:[_e.record,`: narrate a bug, get a Playwright test`]})]}),r&&(0,Z.jsxs)($,{heading:`Test and review`,children:[c?(0,Z.jsx)(Q,{icon:(0,Z.jsx)(ue,{}),onSelect:I(()=>void ee.stop()),keywords:[`record session`,`test session`],children:`Stop recording and write the report`}):(0,Z.jsx)(Q,{icon:(0,Z.jsx)(j,{}),onSelect:I(()=>b.setState({setup:!0})),keywords:[`test session`,`report`,`recording`],children:`Record session: use the app, get a report`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(m,{}),onSelect:I(()=>(lt(`experts`),void me.run())),keywords:[`experts`,`audit`,`accessibility`,`seo`,`ux`,`content`],children:`Review this page with the Experts`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(de,{}),onSelect:I(()=>(lt(`sessions`),setTimeout(()=>document.querySelector(`[data-autopilot-goal]`)?.focus(),250))),keywords:[`autopilot`,`explore`,`ai tester`],children:`Autopilot: let the AI test your app…`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(Se,{}),onSelect:I(()=>lt(`sessions`)),keywords:[`reports`,`recordings`],children:`Sessions and their reports`}),(s.expectations.length>0||s.spec)&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{icon:(0,Z.jsx)(de,{}),onSelect:I(()=>void g.generateTest()),children:`Generate test`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(D,{}),onSelect:I(()=>void g.runTest()),children:`Run test`}),s.run?.status===`failed`&&(0,Z.jsxs)(Q,{icon:(0,Z.jsx)(m,{}),onSelect:I(()=>void g.fix()),children:[`Fix with `,y]})]})]}),n&&(0,Z.jsxs)($,{heading:`Selection`,children:[(0,Z.jsx)(Q,{icon:(0,Z.jsx)(se,{}),kbd:`↑`,onSelect:I(()=>void g.step(`parent`)),children:`Select what contains it`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(ce,{}),kbd:`↓`,onSelect:I(()=>void g.step(`child`)),children:`Select inside it`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(oe,{}),kbd:`→`,onSelect:I(()=>void g.step(`next`)),children:`Select the next one`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(w,{}),kbd:`←`,onSelect:I(()=>void g.step(`prev`)),children:`Select the previous one`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(ae,{}),kbd:`O`,onSelect:I(()=>void g.openInEditor()),children:`Open in editor`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(be,{}),kbd:`Esc`,onSelect:I(()=>g.clearTargets()),children:`Clear the selection`})]}),(0,Z.jsx)($,{heading:`Voice`,children:(0,Z.jsx)(Q,{icon:(0,Z.jsx)(fe,{}),kbd:`Space`,onSelect:I(()=>g.startTalk(`toggle`)),children:`Start talking (hands-free)`})}),(0,Z.jsxs)($,{heading:`Apps`,children:[r&&(0,Z.jsx)(Q,{icon:(0,Z.jsx)(ie,{}),onSelect:I(()=>g.reloadApp()),children:`Reload the app`}),d.filter(e=>e.id!==a).map(e=>(0,Z.jsxs)(Q,{value:`switch ${e.id} ${e.name}`,icon:(0,Z.jsx)(ne,{}),onSelect:I(()=>void i.open(e.id)),keywords:[`switch`,`open`,e.name],children:[`Switch to `,e.name]},e.id)),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(p,{}),onSelect:I(()=>i.show(`folder`)),keywords:[`add`,`folder`,`address`,`github`],children:`Link an app…`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(N,{}),onSelect:I(()=>i.show()),children:`All apps`}),r&&Object.keys(he).map(e=>(0,Z.jsxs)(Q,{icon:(0,Z.jsx)(te,{}),onSelect:I(()=>f.getState().setUi({device:e})),children:[`Viewport: `,he[e].label]},e))]}),(0,Z.jsxs)($,{heading:`Studio`,children:[(0,Z.jsx)(Q,{icon:(0,Z.jsx)(M,{}),kbd:`\\`,onSelect:I(()=>f.getState().setUi({panelOpen:!f.getState().ui.panelOpen})),children:`Toggle panel`}),(0,Z.jsx)(Q,{icon:_===`light`?(0,Z.jsx)(xe,{}):(0,Z.jsx)(we,{}),onSelect:I(()=>f.getState().set({theme:_===`light`?`dark`:`light`})),children:_===`light`?`Dark theme`:`Light theme`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(re,{}),onSelect:I(()=>x({overlay:`settings`,settingsTab:`general`})),keywords:[`preferences`,`options`],children:`Settings`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(m,{}),onSelect:I(()=>x({overlay:`settings`,settingsTab:`ai`})),keywords:[`connect`,`api key`,`model`,`claude`,`chatgpt`,`gemini`],children:`Settings: connect an AI`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(O,{}),onSelect:I(()=>x({overlay:`settings`,settingsTab:`usage`})),keywords:[`cost`,`budget`,`spend`,`money`],children:`Settings: usage and budget`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(k,{}),kbd:`?`,onSelect:I(()=>x({overlay:`help`})),keywords:[`help`,`keys`],children:`Phrases and shortcuts`}),(0,Z.jsx)(Q,{icon:(0,Z.jsx)(T,{}),onSelect:I(()=>ve.start()),keywords:[`tour`,`intro`,`getting started`,`onboarding`,`learn`],children:`Take the quick-start tour`})]})]}),L&&(0,Z.jsxs)(`button`,{onClick:R,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,Z.jsx)(Ce,{className:`shrink-0 text-ai-fg`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Send as a request: “`,L,`” `,(0,Z.jsxs)(`span`,{className:`text-fg-3`,children:[`· a quick edit, or `,y===`AI`?`the AI`:y]})]}),(0,Z.jsx)(ge,{children:v(`mod+enter`)})]})]})})}export{dt as CommandPalette};
@@ -0,0 +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};
@@ -0,0 +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(`
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
+ `)})]})}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
+ `)}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};
@@ -0,0 +1 @@
1
+ import{i as e,o as t,r as n,t as r}from"./cn-Wq33h1G4.js";import{B as i,C as a,D as o,Dt as s,E as c,F as l,Ft as u,G as d,H as f,I as p,It as m,J as h,K as g,Lt as _,M as v,Mt as y,N as b,Nt as x,Ot as S,P as ee,Pt as C,Q as w,T,U as E,V as D,W as te,X as O,Y as k,_ as ne,d as A,dt as j,f as M,ft as N,g as re,h as ie,i as ae,it as P,m as F,mt as oe,o as I,ot as se,p as ce,pt as le,q as ue,r as de,s as L,tt as R,u as z,ut as fe,v as pe,w as me,wt as he,y as ge,yt as _e}from"./brand-BSL9G2NW.js";import{n as ve,r as ye,t as be}from"./refresh-cw-DocKnJID.js";import{E as xe,F as Se,H as Ce,R as we,V as Te,d as Ee,f as De,ft as Oe,i as ke,j as Ae,p as je,t as Me,u as Ne}from"./index-C3xqQUPf.js";var Pe=Object.defineProperty,Fe=(e,t)=>Pe(e,`name`,{value:t,configurable:!0});function Ie(e,[t,n]){return Math.min(n,Math.max(t,e))}Fe(Ie,`clamp`);var B=t(e(),1),Le=t(_(),1),V=n(),Re=Object.defineProperty,H=(e,t)=>Re(e,`name`,{value:t,configurable:!0}),ze={ItemAligned:`item-aligned`,Popper:`popper`},Be={LTR:`ltr`,RTL:`rtl`},Ve=[` `,`Enter`,`ArrowUp`,`ArrowDown`],He=[` `,`Enter`],Ue=`Select`,[We,Ge,Ke]=ue(Ue),[U,qe]=k(Ue,[Ke,c]),Je=c(),[Ye,W]=U(Ue),[Xe,Ze]=U(Ue);function Qe(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:p,autoComplete:m,disabled:h,required:g,form:_,internal_do_not_use_render:v}=e,y=Je(t),[b,x]=B.useState(null),[S,ee]=B.useState(null),[C,w]=B.useState(!1),T=f(u),[D,te]=d({prop:r,defaultProp:i??!1,onChange:o,caller:Ue}),[O,k]=d({prop:s,defaultProp:c,onChange:l,caller:Ue}),ne=B.useRef(null),A=B.useRef(!1),[j,M]=B.useState(null),N=H(e=>{M({value:e,hasConsumerStoppedPropagation:A.current}),k(e)},`handleUserSelect`),re=B.useRef(O);B.useEffect(()=>{let e=_?b?.ownerDocument.getElementById(_):b?.form;if(e instanceof HTMLFormElement){let t=H(()=>k(re.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[_,b,k]);let ie=!b||!!_||!!b.closest(`form`),[ae,P]=B.useState(new Set),F=E(),oe=Array.from(ae).map(e=>e.props.value).join(`;`),I=B.useCallback(e=>{P(t=>new Set(t).add(e))},[]),se=B.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),ce={required:g,trigger:b,onTriggerChange:x,valueNode:S,onValueNodeChange:ee,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:F,value:O,onValueChange:k,hasConsumerStoppedPropagationRef:A,userSelection:j,onUserSelect:N,open:D,onOpenChange:te,dir:T,triggerPointerDownPosRef:ne,disabled:h,name:p,autoComplete:m,form:_,nativeOptions:ae,nativeSelectKey:oe,isFormControl:ie};return(0,V.jsx)(a,{...y,children:(0,V.jsx)(Ye,{scope:t,...ce,children:(0,V.jsx)(We.Provider,{scope:t,children:(0,V.jsx)(Xe,{scope:t,onNativeOptionAdd:I,onNativeOptionRemove:se,children:Nt(v)?v(ce):n})})})})}H(Qe,`SelectProvider`);var $e=H(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,V.jsx)(Qe,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[n,e?(0,V.jsx)(Mt,{__scopeSelect:t}):null]})})},`Select`),et=`SelectTrigger`,tt=B.forwardRef(H(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Je(n),o=W(et,n),s=o.disabled||r,c=R(t,o.onTriggerChange),l=Ge(n),u=B.useRef(`touch`),[d,f,p]=Ft(e=>{let t=l().filter(e=>!e.disabled),n=It(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onUserSelect(n.value)}),m=H(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,V.jsx)(me,{asChild:!0,...a,children:(0,V.jsx)(O.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Pt(o.value)?``:void 0,...i,ref:c,onClick:g(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:g(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:g(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&(o.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),f(e.key)),!(t&&e.key===` `)&&Ve.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),nt=`SelectValue`,rt=B.forwardRef(H(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=W(nt,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=R(t,c.onValueNodeChange);h(()=>{l(u)},[l,u]);let f=Pt(c.value);return(0,V.jsx)(O.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,V.jsx)(B.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),it=B.forwardRef(H(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(O.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[at,ot]=U(`SelectPortal`,{forceMount:void 0}),st=H(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,V.jsx)(at,{scope:e.__scopeSelect,forceMount:n,children:(0,V.jsx)(l,{asChild:!0,...r})})},`SelectPortal`),ct=`SelectContent`,lt=B.forwardRef(H(function(e,t){let n=ot(ct,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=W(ct,e.__scopeSelect),[o,s]=B.useState();return h(()=>{s(new DocumentFragment)},[]),(0,V.jsx)(te,{present:r||a.open,children:({present:e})=>e?(0,V.jsx)(mt,{...i,ref:t}):(0,V.jsx)(ut,{...i,fragment:o})})},`SelectContent`)),ut=B.forwardRef(H(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?Le.createPortal((0,V.jsx)(dt,{scope:n,children:(0,V.jsx)(We.Slot,{scope:n,children:(0,V.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),G=10,[dt,ft]=U(ct),pt=w(`SelectContent.RemoveScroll`),mt=B.forwardRef(H(function(e,t){let{__scopeSelect:n}=e,{position:r=ze.ItemAligned,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:y,avoidCollisions:x,...S}=e,C=W(ct,n),[w,T]=B.useState(null),[E,D]=B.useState(null),te=R(t,T),[O,k]=B.useState(null),[ne,A]=B.useState(null),j=Ge(n),[M,N]=B.useState(!1),re=B.useRef(!1),ie=B.useRef(!1),ae=B.useRef(!1);B.useEffect(()=>{if(w)return v(w)},[w]),ee();let P=B.useCallback(e=>{let[t,...n]=j().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[j,E]),F=B.useCallback(()=>P([O,w]),[P,O,w]);B.useEffect(()=>{M&&F()},[M,F]);let{onOpenChange:oe,triggerPointerDownPosRef:I}=C;B.useEffect(()=>{if(w){let e={x:0,y:0},t=H(t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},`handlePointerMove`),n=H(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(w)||oe(!1),document.removeEventListener(`pointermove`,t),I.current=null},`handlePointerUp`);return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[w,oe,I]),B.useEffect(()=>{let e=H(()=>oe(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[oe]);let[se,ce]=Ft(e=>{let t=j().filter(e=>!e.disabled),n=It(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),le=B.useCallback((e,t,n)=>{let r=!ie.current;r&&(ie.current=!0);let i=!re.current&&!n;C.value!==void 0&&C.value===t||i?(k(e),i&&(re.current=!0)):r&&k(e)},[C.value]),ue=B.useCallback(()=>w?.focus(),[w]),de=B.useCallback((e,t,n)=>{if(!e)return;let r=!ae.current;r&&(ae.current=!0);let i=!re.current&&!n;(C.value!==void 0&&C.value===t||i||r)&&A(e)},[C.value]),L=r===ze.Popper?gt:ht,z=L===gt?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:_,hideWhenDetached:y,avoidCollisions:x}:{};return(0,V.jsx)(dt,{scope:n,content:w,viewport:E,onViewportChange:D,itemRefCallback:le,selectedItem:O,onItemLeave:ue,itemTextRefCallback:de,focusSelectedItem:F,selectedItemText:ne,position:r,isPositioned:M,searchRef:se,children:(0,V.jsx)(b,{as:pt,allowPinchZoom:!0,children:(0,V.jsx)(p,{asChild:!0,trapped:C.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:g(a,e=>{C.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(i,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:(0,V.jsx)(L,{role:`listbox`,id:C.contentId,"data-state":C.open?`open`:`closed`,dir:C.dir,onContextMenu:e=>e.preventDefault(),...S,...z,onPlaced:()=>N(!0),ref:te,style:{display:`flex`,flexDirection:`column`,outline:`none`,...S.style},onKeyDown:g(S.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ce(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=j().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>P(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ht=B.forwardRef(H(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=W(ct,n),o=ft(ct,n),[s,c]=B.useState(null),[l,u]=B.useState(null),d=R(t,u),f=Ge(n),p=B.useRef(!1),m=B.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=o,b=B.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&g&&_&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==Be.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-G,d=Ie(a,[G,Math.max(G,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-G,d=Ie(a,[G,Math.max(G,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-G*2,u=g.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+h+u+b+y,S=Math.min(_.offsetHeight*5,x),ee=window.getComputedStyle(g),C=parseInt(ee.paddingTop,10),w=parseInt(ee.paddingBottom,10),T=e.top+e.height/2-G,E=c-T,D=_.offsetHeight/2,te=_.offsetTop+D,O=m+h+te,k=x-O;if(O<=T){let e=o.length>0&&_===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-g.offsetTop-g.offsetHeight,n=O+Math.max(E,D+(e?w:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&_===o[0].ref.current;s.style.top=`0px`;let t=Math.max(T,m+g.offsetTop+(e?C:0)+D)+k;s.style.height=t+`px`,g.scrollTop=O-T+g.offsetTop}s.style.margin=`${G}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,g,_,v,a.dir,r]);h(()=>b(),[b]);let[x,S]=B.useState();h(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);let ee=B.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]);return(0,V.jsx)(_t,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:ee,children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(O.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),gt=B.forwardRef(H(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=G,...a}=e,o=Je(n);return(0,V.jsx)(T,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[_t,vt]=U(ct,{}),yt=`SelectViewport`,bt=B.forwardRef(H(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=ft(yt,n),o=vt(yt,n),s=R(t,a.onViewportChange),c=B.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(We.Slot,{scope:n,children:(0,V.jsx)(O.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:g(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-G*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[xt,St]=U(`SelectGroup`),Ct=`SelectItem`,[wt,Tt]=U(Ct),Et=B.forwardRef(H(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=W(Ct,n),c=ft(Ct,n),l=s.value===r,[u,d]=B.useState(a??``),[f,p]=B.useState(!1),m=D(e=>c.itemRefCallback?.(e,r,i)),h=R(t,m),_=E(),v=B.useRef(`touch`);function y(e){s.hasConsumerStoppedPropagationRef.current=e.isPropagationStopped(),s.onUserSelect(r),s.onOpenChange(!1)}return H(y,`handleSelect`),(0,V.jsx)(wt,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:B.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(We.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(O.div,{role:`option`,"aria-labelledby":_,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:g(o.onFocus,()=>p(!0)),onBlur:g(o.onBlur,()=>p(!1)),onClick:g(o.onClick,e=>{i||v.current!==`mouse`&&y(e)}),onPointerUp:g(o.onPointerUp,e=>{i||v.current===`mouse`&&y(e)}),onPointerDown:g(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:g(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:g(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:g(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(He.includes(e.key)&&y(e),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Dt=`SelectItemText`,Ot=B.forwardRef(H(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=W(Dt,n),s=ft(Dt,n),c=Tt(Dt,n),l=Ze(Dt,n),[u,d]=B.useState(null),f=D(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=R(t,d,c.onItemTextChange,f),m=u?.textContent,g=B.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:_,onNativeOptionRemove:v}=l;return h(()=>(_(g),()=>v(g)),[_,v,g]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(O.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Pt(o.value)?Le.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),kt=`SelectItemIndicator`,At=B.forwardRef(H(function(e,t){let{__scopeSelect:n,...r}=e;return Tt(kt,n).isSelected?(0,V.jsx)(O.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),jt=`SelectBubbleInput`,Mt=B.forwardRef(H(function({__scopeSelect:e,...t},n){let r=W(jt,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u,userSelection:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=B.useRef(null),h=R(n,m),g=i??``,_=B.useRef(g),v=B.useRef(d),y=B.useRef(!1),b=Array.from(f).some(e=>(e.props.value??``)===``);return B.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=d!==null&&d!==v.current;v.current=d;let i=_.current!==g;_.current=g;let a=r&&i;if(r&&!i&&d.value!==g&&!d.hasConsumerStoppedPropagation&&n){y.current=!0;try{n.call(e,d.value),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{y.current=!1,n.call(e,g)}return}let o=a&&!d.hasConsumerStoppedPropagation;if(i&&n){let t=new Event(`change`,{bubbles:o});n.call(e,g),e.dispatchEvent(t)}},[g,d]),(0,V.jsxs)(O.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>{y.current||a(e.target.value)},...t,style:{...Oe,...t.style},ref:h,defaultValue:g,children:[Pt(i)&&!b?(0,V.jsx)(`option`,{value:``}):null,Array.from(f)]},p)},`SelectBubbleInput`));function Nt(e){return typeof e==`function`}H(Nt,`isFunction`);function Pt(e){return e===``||e===void 0}H(Pt,`shouldShowPlaceholder`);function Ft(e){let t=D(e),n=B.useRef(``),r=B.useRef(0),i=B.useCallback(e=>{let i=n.current+e;t(i);function a(e){n.current=e,window.clearTimeout(r.current),e!==``&&(r.current=window.setTimeout(()=>a(``),1e3))}H(a,`updateSearch`),a(i)},[t]),a=B.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}H(Ft,`useTypeaheadSearch`);function It(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Lt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}H(It,`findNextItem`);function Lt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}H(Lt,`wrapArray`);var Rt=Object.defineProperty,K=(e,t)=>Rt(e,`name`,{value:t,configurable:!0}),zt={Vertical:`vertical`,Horizontal:`horizontal`},Bt={LTR:`ltr`,RTL:`rtl`},Vt=[`PageUp`,`PageDown`],Ht=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ut={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},Wt=`Slider`,[Gt,Kt,qt]=ue(Wt),[Jt,Yt]=k(Wt,[qt]),[Xt,Zt]=Jt(Wt),Qt=B.forwardRef(K(function(e,t){let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=zt.Horizontal,disabled:s=!1,minStepsBetweenThumbs:c=0,preserveThumbOrder:l=!1,defaultValue:u=[r],value:f,onValueChange:p=K(()=>{},`onValueChange`),onValueCommit:m=K(()=>{},`onValueCommit`),inverted:h=!1,form:_,...v}=e,y=B.useRef(new Set),b=B.useRef(0),x=B.useRef(!1),[S,ee]=B.useState(null),C=o===zt.Horizontal?tn:nn,[w,T]=B.useState(null),E=R(t,T),[D=[],te]=d({prop:f,defaultProp:u,onChange:K(e=>{[...y.current][b.current]?.focus({preventScroll:!0,focusVisible:x.current}),x.current=!1,p(e)},`onChange`)}),O=B.useRef(D),k=B.useRef(D);B.useEffect(()=>{let e=_?w?.ownerDocument.getElementById(_):w?.closest(`form`);if(e instanceof HTMLFormElement){let t=K(()=>te(k.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[w,_,te]);function ne(e){M(e,xn(D,e))}K(ne,`handleSlideStart`);function A(e){M(e,b.current)}K(A,`handleSlideMove`);function j(){String(D)!==String(O.current)&&m(D)}K(j,`handleSlideEnd`);function M(e,t,{commit:n}={commit:!1}){let o=En(a),s=Ie(Dn(Math.round((e-r)/a)*a+r,o),[r,i]),u=c*a;function d(e){let n=l?Ie(s,[e[t-1]===void 0?r:e[t-1]+u,e[t+1]===void 0?i:e[t+1]-u]):s,a=vn(e,n,t);return wn(a,u)?{nextValues:a,changedIndex:l?t:a.indexOf(n),hasChanged:String(a)!==String(e)}:null}K(d,`getNextValues`);let f=d(D);f?.hasChanged&&ee(f.nextValues),te((e=[])=>{let t=d(e);return t?(b.current=t.changedIndex,t.hasChanged&&n&&m(t.nextValues),t.hasChanged?t.nextValues:e):e})}return K(M,`updateValues`),(0,V.jsx)(Xt,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:D,orientation:o,form:_,userRequestedValues:S,children:(0,V.jsx)(Gt.Provider,{scope:e.__scopeSlider,children:(0,V.jsx)(Gt.Slot,{scope:e.__scopeSlider,children:(0,V.jsx)(C,{"aria-disabled":s,"data-disabled":s?``:void 0,...v,ref:E,onPointerDown:g(v.onPointerDown,()=>{s||(O.current=D,x.current=!1)}),min:r,max:i,inverted:h,onSlideStart:s?void 0:ne,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:j,onHomeKeyDown:()=>{s||(x.current=!0,M(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(x.current=!0,M(i,D.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){x.current=!0;let n=Vt.includes(e.key)||e.shiftKey&&Ht.includes(e.key)?10:1,i=b.current,o=D[i];M(On(o,{min:r,step:a,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[$t,en]=Jt(Wt,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),tn=B.forwardRef(K(function(e,t){let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,[d,p]=B.useState(null),m=R(t,p),h=B.useRef(void 0),g=f(i),_=g===Bt.LTR,v=_&&!a||!_&&a;function y(e){let t=h.current||d.getBoundingClientRect(),i=Tn([0,t.width],v?[n,r]:[r,n]);return h.current=t,i(e-t.left)}return K(y,`getValueFromPointer`),(0,V.jsx)($t,{scope:e.__scopeSlider,startEdge:v?`left`:`right`,endEdge:v?`right`:`left`,direction:v?1:-1,size:`width`,children:(0,V.jsx)(rn,{dir:g,"data-orientation":`horizontal`,...u,ref:m,style:{...u.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{h.current=void 0,c?.()},onStepKeyDown:e=>{let t=Ut[v?`from-left`:`from-right`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),nn=B.forwardRef(K(function(e,t){let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:c,...l}=e,u=B.useRef(null),d=R(t,u),f=B.useRef(void 0),p=!i;function m(e){let t=f.current||u.current.getBoundingClientRect(),i=Tn([0,t.height],p?[r,n]:[n,r]);return f.current=t,i(e-t.top)}return K(m,`getValueFromPointer`),(0,V.jsx)($t,{scope:e.__scopeSlider,startEdge:p?`bottom`:`top`,endEdge:p?`top`:`bottom`,size:`height`,direction:p?1:-1,children:(0,V.jsx)(rn,{"data-orientation":`vertical`,...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=m(e.clientY);a?.(t)},onSlideMove:e=>{let t=m(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:e=>{let t=Ut[p?`from-bottom`:`from-top`].includes(e.key);c?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),rn=B.forwardRef(K(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=Zt(Wt,n);return(0,V.jsx)(O.span,{...l,ref:t,onKeyDown:g(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):Vt.concat(Ht).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:g(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:g(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:g(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})},`SliderImpl`)),an=`SliderTrack`,on=B.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Zt(an,n);return(0,V.jsx)(O.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),sn=`SliderRange`,cn=B.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Zt(sn,n),a=en(sn,n),o=B.useRef(null),s=R(t,o),c=i.values.length,l=i.values.map(e=>yn(e,i.min,i.max)),u=c>1?Math.min(...l):0,d=100-Math.max(...l);return(0,V.jsx)(O.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:s,style:{...e.style,[a.startEdge]:u+`%`,[a.endEdge]:d+`%`}})},`SliderRange`)),[ln,un]=Jt(`SliderThumb`),dn=`SliderThumbProvider`;function fn(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=Zt(dn,t),s=Kt(t),[c,l]=B.useState(null),u=B.useMemo(()=>c?s().findIndex(e=>e.ref.current===c):-1,[s,c]),d=o(c),f=!c||!!a.form||!!c.closest(`form`),p=a.values[u],m=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),h=p===void 0?0:yn(p,a.min,a.max);B.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]);let g={value:p,name:m,form:a.form,isFormControl:f,index:u,thumb:c,onThumbChange:l,percent:h,size:d};return(0,V.jsx)(ln,{scope:t,...g,children:kn(i)?i(g):r})}K(fn,`SliderThumbProvider`);var pn=`SliderThumbTrigger`,mn=B.forwardRef(K(function(e,t){let{__scopeSlider:n,...r}=e,i=Zt(pn,n),a=en(pn,n),{index:o,value:s,percent:c,size:l,onThumbChange:u}=un(pn,n),d=R(t,u),f=bn(o,i.values.length),p=l?.[a.size],m=p?Sn(p,c,a.direction):0;return(0,V.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${c}% + ${m}px)`},children:(0,V.jsx)(Gt.ItemSlot,{scope:n,children:(0,V.jsx)(O.span,{role:`slider`,"aria-label":e[`aria-label`]||f,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:d,style:s===void 0?{display:`none`}:e.style,onFocus:g(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})},`SliderThumbTrigger`)),hn=B.forwardRef(K(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,V.jsx)(fn,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(mn,{...i,ref:t,__scopeSlider:n}),r?(0,V.jsx)(_n,{__scopeSlider:n},e):null]})})},`SliderThumb`)),gn=`SliderBubbleInput`,_n=B.forwardRef(K(function({__scopeSlider:e,onInput:t,...n},r){let{index:i,value:a,name:o,form:s}=un(gn,e),{userRequestedValues:c}=Zt(gn,e),l=B.useRef(null),u=R(l,r),d=B.useRef(!1),f=B.useRef(a),p=B.useRef(c),m=B.useRef(c);return B.useEffect(()=>{let e=l.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set,r=f.current,o=r!==a;f.current=a;let s=c!==m.current;if(m.current=c,o&&n){let t=c!==p.current;p.current=c;let o=c?.[i];d.current=!(t&&(s&&o!==r||o===a));let l=new Event(`input`,{bubbles:!0});n.call(e,a),e.dispatchEvent(l),d.current=!1}},[i,a,c]),(0,V.jsx)(O.input,{style:{display:`none`},name:o,form:s,...n,ref:u,defaultValue:a,onInput:g(t,e=>{d.current&&e.stopPropagation()})})},`SliderBubbleInput`));function vn(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}K(vn,`getNextSortedValues`);function yn(e,t,n){return Ie(100/(n-t)*(e-t),[0,100])}K(yn,`convertValueToPercentage`);function bn(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}K(bn,`getLabel`);function xn(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}K(xn,`getClosestValueIndex`);function Sn(e,t,n){let r=e/2;return(r-Tn([0,50],[0,r])(t)*n)*n}K(Sn,`getThumbInBoundsOffset`);function Cn(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}K(Cn,`getStepsBetweenValues`);function wn(e,t){if(t>0){let n=Cn(e);return Math.min(...n)>=t}return!0}K(wn,`hasMinStepsBetweenValues`);function Tn(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}K(Tn,`linearScale`);function En(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}K(En,`getDecimalCount`);function Dn(e,t){let n=10**t;return Math.round(e*n)/n}K(Dn,`roundValue`);function On(e,{min:t,step:n,direction:r,multiplier:i}){let a=En(n),o=(e-t)/n,s=Math.round(o),c=Dn(s*n+t,a)===Dn(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),Dn(l*n+t,a)}K(On,`getNextStepValue`);function kn(e){return typeof e==`function`}K(kn,`isFunction`);var An={name:`chart-line`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]],aliases:[`line-chart`]};An.node;var jn=ge(An),Mn={name:`file-braces`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]],aliases:[`file-json`]};Mn.node;var Nn=ge(Mn),Pn={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};Pn.node;var Fn=ge(Pn),In={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};In.node;var Ln=ge(In),Rn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Rn.node;var zn=ge(Rn);function Bn({value:e,onChange:t,options:n,className:i,placeholder:a}){return(0,V.jsxs)($e,{value:e,onValueChange:e=>t(e),children:[(0,V.jsxs)(tt,{className:r(`inline-flex h-8 min-w-[160px] items-center justify-between gap-2 rounded-[8px] bg-raised px-2.5 text-[12.5px] text-fg ring-1 ring-inset ring-line-strong hover:bg-hover`,i),children:[(0,V.jsx)(rt,{placeholder:a}),(0,V.jsx)(it,{children:(0,V.jsx)(ne,{className:`size-3.5 text-fg-3`})})]}),(0,V.jsx)(st,{children:(0,V.jsx)(lt,{position:`popper`,sideOffset:4,className:`z-[80] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-[10px] bg-raised p-1 shadow-pop`,children:(0,V.jsx)(bt,{children:n.map(e=>(0,V.jsxs)(Et,{value:e.value,className:`relative flex cursor-default select-none items-center gap-2 rounded-[6px] py-1.5 pl-7 pr-3 text-[12.5px] text-fg outline-none data-[highlighted]:bg-hover`,children:[(0,V.jsx)(At,{className:`absolute left-2`,children:(0,V.jsx)(pe,{className:`size-3.5 text-human`})}),(0,V.jsx)(Ot,{children:e.label}),e.note&&(0,V.jsx)(`span`,{className:`ml-auto pl-4 text-[11.5px] text-fg-3`,children:e.note})]},e.value))})})})]})}function Vn({value:e,onChange:t,min:n=0,max:r=1,step:i=.01,label:a}){return(0,V.jsxs)(Qt,{className:`relative flex h-5 w-full touch-none select-none items-center`,value:[e],min:n,max:r,step:i,onValueChange:e=>t(e[0]),"aria-label":a,children:[(0,V.jsx)(on,{className:`relative h-[4px] grow overflow-hidden rounded-full bg-active`,children:(0,V.jsx)(cn,{className:`absolute h-full rounded-full bg-human`})}),(0,V.jsx)(hn,{className:`block size-[14px] rounded-full bg-white shadow-[0_0_0_1px_rgba(0,0,0,.15),0_1px_3px_rgba(0,0,0,.35)] outline-none transition-shadow focus-visible:shadow-[0_0_0_4px_var(--human-soft)]`})]})}var q=u(()=>({state:null,loading:!1,error:null,busy:{},results:{}})),J=q.setState,Hn=q.getState;async function Y(e){try{return J({state:await e,error:null}),P.refreshStatus(),!0}catch(e){return J({error:e instanceof Error?e.message:String(e)}),!1}}function Un(e,t,n){J({busy:{...Hn().busy,[e]:t},...n===void 0?{}:{results:{...Hn().results,[e]:n}}})}var X={async load(e=!1){J({loading:!0}),await Y(m.get(`/ai${e?`?refresh=1`:``}`)),J({loading:!1})},async saveKey(e,t){Un(e,!0);let n=await Y(m.put(`/ai/key`,{connection:e,key:t}));if(n&&t){let t=await X.test(e,!1);return Un(e,!1,t),t.ok}return Un(e,!1,n?void 0:{ok:!1,message:Hn().error??`Couldn’t save the key.`}),n},async test(e,t=!0){t&&Un(e,!0);let n;try{n=await m.post(`/ai/test`,{connection:e})}catch(e){n={ok:!1,message:e instanceof Error?e.message:String(e)}}return t&&Un(e,!1,n),X.load(),n},add(e){return Y(m.post(`/ai/connections`,e))},remove(e){return Y(m.delete(`/ai/connections/${encodeURIComponent(e)}`))},setOff(e,t){return Y(m.put(`/ai/connections/${encodeURIComponent(e)}`,{off:t}))},addModel(e,t){return Y(m.put(`/ai/connections/${encodeURIComponent(e)}`,{model:t}))},setRoute(e,t){return Y(m.put(`/ai/routes`,{task:e,connection:t?.connection??null,model:t?.model??null}))},setEffort(e){return Y(m.put(`/ai/effort`,{effort:e}))},async setBudget(e){try{let t=await m.put(`/ai/budget`,e),n=Hn().state;n&&J({state:{...n,usage:t}})}catch(e){J({error:e instanceof Error?e.message:String(e)})}},async reset(e){try{let t=await m.post(`/ai/usage/reset`,{scope:e}),n=Hn().state;n&&J({state:{...n,usage:t}}),P.refreshStatus()}catch(e){J({error:e instanceof Error?e.message:String(e)})}}},Wn=[{id:`code`,label:`Changes and questions`,hint:`Edits code and answers questions about it. The most capable model pays off here.`},{id:`report`,label:`Reports and reviews`,hint:`Writes session reports and expert reviews from screenshots and evidence.`},{id:`light`,label:`Small jobs`,hint:`Translations and short texts. A fast, inexpensive model is plenty.`}];function Gn({children:e,sub:t}){return(0,V.jsxs)(`div`,{className:`mb-4`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e}),t&&(0,V.jsx)(`p`,{className:`mt-1 max-w-[500px] text-[12.5px] leading-relaxed text-fg-3`,children:t})]})}function Z({title:e,sub:t,children:n,id:r}){return(0,V.jsxs)(`section`,{id:r,className:`mt-6 scroll-mt-4 first:mt-0`,children:[(0,V.jsx)(`h3`,{className:`text-[12px] font-semibold uppercase tracking-[0.04em] text-fg-3`,children:e}),t&&(0,V.jsx)(`p`,{className:`mt-1 max-w-[500px] text-[12px] leading-relaxed text-fg-3`,children:t}),(0,V.jsx)(`div`,{className:`mt-2 divide-y divide-line rounded-[10px] ring-1 ring-inset ring-line`,children:n})]})}var Q=`h-8 min-w-0 rounded-[8px] bg-sunken px-2.5 text-[12.5px] text-fg ring-1 ring-inset ring-line-strong outline-none placeholder:text-fg-3 focus:ring-human-line`;function Kn(){let e=q(e=>e.state);return(0,B.useEffect)(()=>{X.load(!0)},[]),e}function qn({c:e}){if(e.disabled)return(0,V.jsx)(I,{children:`Off`});switch(e.status){case`ready`:return(0,V.jsxs)(I,{tone:`ok`,children:[(0,V.jsx)(L,{tone:`ok`,className:`mr-0.5`}),` Ready`]});case`needs-key`:return(0,V.jsx)(I,{children:`No key`});case`needs-login`:return(0,V.jsx)(I,{tone:`warn`,children:`Sign in needed`});case`missing`:return(0,V.jsx)(I,{children:`Not installed`});case`offline`:return(0,V.jsx)(I,{children:`Not running`});default:return(0,V.jsx)(I,{tone:`warn`,children:`Problem`})}}function Jn(e,t){return e.auth===`subscription`?`Included in your plan`:e.auth===`local`&&e.preset!==`custom`?`Free, on this computer`:t.price?`$${t.price.input} in · $${t.price.output} out per 1M tokens`:t.note??``}var Yn={"claude-code":`Claude plan`,codex:`ChatGPT plan`,"gemini-cli":`Gemini (Google account)`,anthropic:`Anthropic API`,openai:`OpenAI API`,gemini:`Gemini API`};function Xn({state:e}){let t=e.connections.filter(e=>e.status===`ready`&&!e.disabled&&e.models.length);return(0,V.jsxs)(Z,{title:`Who does what`,sub:`Automatic picks your plan first (no extra cost), then an API key, then a model on this computer. Choose a model per job to balance quality and cost.`,children:[Wn.map(n=>{let r=e.routes[n.id],i=e.chosen[n.id],a=r?`${Yn[r.connection]??e.connections.find(e=>e.id===r.connection)?.label??r.connection} · ${e.connections.find(e=>e.id===r.connection)?.models.find(e=>e.id===r.model)?.label??r.model}`:`Nothing connected yet`,o=[{value:`auto`,label:`Automatic`,note:a},...t.flatMap(e=>e.models.map(t=>({value:`${e.id}::${t.id}`,label:`${Yn[e.id]??e.label} · ${t.label}`,note:Jn(e,t)})))];return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-3`,"data-route":n.id,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:n.label}),(0,V.jsx)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:n.hint}),!i&&(0,V.jsxs)(`div`,{className:`mt-1 text-[11.5px] text-fg-3`,"data-route-now":!0,children:[`Now: `,a]})]}),(0,V.jsx)(Bn,{value:i&&r?.connection===i.connection&&r.model===i.model?`${i.connection}::${i.model}`:`auto`,onChange:e=>{if(e===`auto`)return void X.setRoute(n.id,null);let[t,...r]=e.split(`::`);X.setRoute(n.id,{connection:t,model:r.join(`::`)})},options:o,className:`w-[250px] shrink-0`})]},n.id)}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:`Effort`}),(0,V.jsx)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:`Higher effort thinks longer on hard requests, and uses more tokens.`})]}),(0,V.jsx)(De,{value:e.effort,onChange:e=>void X.setEffort(e),options:[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}]})]})]})}var Zn={"claude-code":{install:`npm install -g @anthropic-ai/claude-code`,signIn:`claude`,site:`https://claude.com/claude-code`},codex:{install:`npm install -g @openai/codex`,signIn:`codex login`,site:`https://developers.openai.com/codex`},"gemini-cli":{install:`npm install -g @google/gemini-cli`,signIn:`gemini`,site:`https://github.com/google-gemini/gemini-cli`}},Qn={anthropic:`https://console.anthropic.com/settings/keys`,openai:`https://platform.openai.com/api-keys`,gemini:`https://aistudio.google.com/apikey`};function $n({text:e,label:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsx)(A,{size:`sm`,variant:`ghost`,"aria-label":t??`Copy`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1200)})},children:n?(0,V.jsx)(pe,{}):(0,V.jsx)(Ce,{})})}function er({text:e,label:t,shown:n}){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 truncate rounded-[6px] bg-sunken px-2 py-1 font-mono text-[11.5px] text-fg-2`,children:n??e}),(0,V.jsx)($n,{text:e,label:t})]})}function tr({c:e}){let t=Zn[e.id],n=q(e=>e.loading);return(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-connection":e.id,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[e.label,` `,(0,V.jsx)(qn,{c:e})]}),e.detail&&(0,V.jsx)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:e.detail})]}),e.status===`ready`?(0,V.jsx)(Ne,{checked:!e.disabled,onCheckedChange:t=>void X.setOff(e.id,!t),"aria-label":`Use ${e.label}`}):(0,V.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>void X.load(!0),disabled:n,icon:n?(0,V.jsx)(z,{}):(0,V.jsx)(be,{}),children:`Check again`})]}),t&&(e.status===`missing`||e.status===`needs-login`)&&(0,V.jsxs)(`div`,{className:`mt-2 space-y-1.5 text-[12px] text-fg-3`,children:[e.status===`missing`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{children:`1. Install it:`}),(0,V.jsx)(er,{text:t.install})]}),(0,V.jsxs)(`div`,{children:[e.status===`missing`?`2. `:``,`Sign in with your account (once, in a terminal):`]}),(0,V.jsx)(er,{text:t.signIn}),(0,V.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-human-fg hover:underline`,href:t.site,target:`_blank`,rel:`noreferrer`,children:[`About it `,(0,V.jsx)(we,{className:`size-3`})]})]})]})}function nr({c:e,file:t}){let[n,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),s=q(t=>!!t.busy[e.id]),c=q(t=>t.results[e.id]),l=e.status===`ready`||!!e.detail?.startsWith(`Key`);return(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-connection":e.id,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[e.label,` `,(0,V.jsx)(qn,{c:e})]}),(0,V.jsxs)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:[e.detail??`Billed per use by the provider.`,` `,Qn[e.id]&&(0,V.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-human-fg hover:underline`,href:Qn[e.id],target:`_blank`,rel:`noreferrer`,children:[`Get a key `,(0,V.jsx)(we,{className:`size-3`})]})]})]}),e.status===`ready`&&(0,V.jsx)(Ne,{checked:!e.disabled,onCheckedChange:t=>void X.setOff(e.id,!t),"aria-label":`Use ${e.label}`})]}),(0,V.jsxs)(`form`,{className:`mt-2 flex gap-2`,onSubmit:t=>{t.preventDefault(),n.trim()&&X.saveKey(e.id,n.trim()).then(e=>e&&i(``))},children:[(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(`input`,{type:a?`text`:`password`,value:n,onChange:e=>i(e.target.value),placeholder:l?`Replace the key`:`Paste an API key`,autoComplete:`off`,spellCheck:!1,"aria-label":`${e.label} key`,className:r(Q,`w-full pr-8 font-mono`)}),(0,V.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1.5 text-fg-3 hover:text-fg [&_svg]:size-[14px]`,onClick:()=>o(!a),"aria-label":a?`Hide key`:`Show key`,children:a?(0,V.jsx)(ye,{}):(0,V.jsx)(ve,{})})]}),(0,V.jsx)(A,{type:`submit`,size:`md`,variant:`primary`,disabled:!n.trim()||s,children:s?(0,V.jsx)(z,{}):`Save`}),l&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(A,{type:`button`,size:`md`,onClick:()=>void X.test(e.id),disabled:s,children:`Test`}),(0,V.jsx)(A,{type:`button`,size:`md`,variant:`ghost`,"aria-label":`Remove the ${e.label} key`,onClick:async()=>await de({title:`Remove the ${e.label} key?`,body:`It is deleted from this computer.`,action:`Remove`,danger:!0})&&void X.saveKey(e.id,null),children:(0,V.jsx)(F,{})})]})]}),c&&(0,V.jsx)(`p`,{className:r(`mt-1.5 text-[12px]`,c.ok?`text-ok`:`text-bad`),children:c.message}),(0,V.jsxs)(`p`,{className:`mt-1.5 text-[11.5px] text-fg-3`,children:[`Saved in `,(0,V.jsx)(`span`,{className:`font-mono`,children:t??`.env.local`}),`, readable only by you, never sent anywhere but `,e.label.replace(/ API$/,``),`.`]})]})}function rr({c:e}){let t=q(e=>e.loading),n=e.id===`ollama`?`https://ollama.com`:`https://lmstudio.ai`;return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-3`,"data-connection":e.id,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[e.label,` `,(0,V.jsx)(qn,{c:e})]}),(0,V.jsxs)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:[e.detail,` `,e.status!==`ready`&&(0,V.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-human-fg hover:underline`,href:n,target:`_blank`,rel:`noreferrer`,children:[`Get it `,(0,V.jsx)(we,{className:`size-3`})]})]})]}),e.status===`ready`?(0,V.jsx)(Ne,{checked:!e.disabled,onCheckedChange:t=>void X.setOff(e.id,!t),"aria-label":`Use ${e.label}`}):(0,V.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>void X.load(!0),disabled:t,icon:t?(0,V.jsx)(z,{}):(0,V.jsx)(be,{}),children:`Check again`})]})}function ir({c:e}){let t=q(t=>!!t.busy[e.id]),n=q(t=>t.results[e.id]),[i,a]=(0,B.useState)(``);return(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-connection":e.id,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[e.label,` `,(0,V.jsx)(qn,{c:e})]}),(0,V.jsxs)(`div`,{className:`mt-0.5 truncate text-[12px] text-fg-3`,children:[e.baseUrl,e.detail?` · ${e.detail}`:``]})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsx)(A,{size:`sm`,onClick:()=>void X.test(e.id),disabled:t||e.status!==`ready`,children:t?(0,V.jsx)(z,{}):`Test`}),(0,V.jsx)(A,{size:`sm`,variant:`ghost`,"aria-label":`Remove ${e.label}`,onClick:async()=>await de({title:`Remove ${e.label}?`,body:`Its key is deleted from this computer.`,action:`Remove`,danger:!0})&&void X.remove(e.id),children:(0,V.jsx)(F,{})})]})]}),(0,V.jsxs)(`form`,{className:`mt-2 flex gap-2`,onSubmit:t=>{t.preventDefault(),i.trim()&&X.addModel(e.id,i.trim()).then(()=>a(``))},children:[(0,V.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Add a model by its id (e.g. anthropic/claude-sonnet-5-5)`,className:r(Q,`flex-1 font-mono`),"aria-label":`Model for ${e.label}`}),(0,V.jsx)(A,{type:`submit`,size:`md`,disabled:!i.trim(),children:`Add model`})]}),n&&(0,V.jsx)(`p`,{className:r(`mt-1.5 text-[12px]`,n.ok?`text-ok`:`text-bad`),children:n.message})]})}function ar(){let[e,t]=(0,B.useState)(`openrouter`),[n,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),d=q(e=>e.error),f=se.find(t=>t.id===e),p=se.filter(e=>e.id!==`ollama`&&e.id!==`lmstudio`).map(e=>({value:e.id,label:e.label}));return(0,V.jsxs)(`form`,{className:`space-y-2 px-3 py-3`,"data-add-provider":!0,onSubmit:async t=>{t.preventDefault(),u(!0);let r=await X.add({preset:e,baseUrl:e===`custom`?n:void 0,key:a||void 0,models:s?[s]:void 0});u(!1),r&&(o(``),c(``),i(``))},children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[(0,V.jsx)(re,{className:`size-[14px] text-fg-3`}),` Add a provider`]}),(0,V.jsx)(`p`,{className:`text-[12px] leading-relaxed text-fg-3`,children:f.note??`Any provider with an OpenAI-compatible API.`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(Bn,{value:e,onChange:t,options:p,className:`w-[190px]`}),e===`custom`&&(0,V.jsx)(`input`,{value:n,onChange:e=>i(e.target.value),placeholder:`https://api.example.com/v1`,className:r(`h-8 min-w-0 rounded-[8px] bg-sunken px-2.5 text-[12.5px] text-fg ring-1 ring-inset ring-line-strong outline-none placeholder:text-fg-3 focus:ring-human-line`,`min-w-[220px] flex-1 font-mono`),"aria-label":`Provider address`})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(`input`,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:f.keyUrl?`API key`:`API key (if it needs one)`,autoComplete:`off`,className:r(Q,`min-w-[200px] flex-1 font-mono`),"aria-label":`Provider key`}),(0,V.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Model id (optional)`,className:r(Q,`w-[200px] font-mono`),"aria-label":`Provider model`}),(0,V.jsx)(A,{type:`submit`,size:`md`,variant:`primary`,disabled:l||f.keyUrl!==null&&!a.trim()||e===`custom`&&!n.trim(),children:l?(0,V.jsx)(z,{}):`Add`})]}),f.keyUrl&&(0,V.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-[12px] text-human-fg hover:underline`,href:f.keyUrl,target:`_blank`,rel:`noreferrer`,children:[`Get `,/^[aeiou]/i.test(f.label)||/^x[A-Z]/.test(f.label)?`an`:`a`,` `,f.label,` key `,(0,V.jsx)(we,{className:`size-3`})]}),d&&(0,V.jsx)(`p`,{className:`text-[12px] text-bad`,children:d})]})}function or(){let e=Kn();if(!e)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] text-fg-3`,children:[(0,V.jsx)(z,{}),` Looking for AI on this computer…`]});let t=(t,n)=>e.connections.filter(e=>e.auth===t&&(!n||n.includes(e.id))),n=e.connections.length&&e.ready&&!e.routes.code;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Gn,{sub:(0,V.jsx)(ke,{}),children:`AI`}),n?(0,V.jsx)(`p`,{className:`mb-3 text-[12px] text-fg-3`,children:`The automated tests’ stand-in answers requests in this studio.`}):null,!e.ready&&(0,V.jsx)(sr,{state:e}),(0,V.jsx)(Z,{id:`ai-plans`,title:`Your plans`,sub:`No API key needed: Saywright runs the official app on this computer, signed in with your own account. Requests count toward your plan’s limits, not a bill.`,children:t(`subscription`).map(e=>(0,V.jsx)(tr,{c:e},e.id))}),(0,V.jsx)(Z,{id:`ai-keys`,title:`API keys`,sub:`Pay per use, straight to the provider. Prompt caching keeps repeated context cheap.`,children:t(`key`,[`anthropic`,`openai`,`gemini`]).map(t=>(0,V.jsx)(nr,{c:t,file:e.keysFile},t.id))}),(0,V.jsx)(Z,{id:`ai-local`,title:`On this computer`,sub:`Free and private. Changes need a model that can call tools (most recent ones can).`,children:t(`local`,[`ollama`,`lmstudio`]).map(e=>(0,V.jsx)(rr,{c:e},e.id))}),(0,V.jsxs)(Z,{title:`Other providers`,sub:`OpenRouter, Groq, DeepSeek, Mistral, xAI, or any OpenAI-compatible address.`,children:[e.connections.filter(e=>e.kind===`compatible`&&e.id!==`ollama`&&e.id!==`lmstudio`).map(e=>(0,V.jsx)(ir,{c:e},e.id)),(0,V.jsx)(ar,{})]}),e.ready&&(0,V.jsxs)(`div`,{className:`mt-8`,"data-ai-advanced":!0,children:[(0,V.jsx)(`h3`,{className:`text-[14px] font-semibold text-fg`,children:`Advanced`}),(0,V.jsx)(`p`,{className:`mt-1 max-w-[500px] text-[12.5px] leading-relaxed text-fg-3`,children:`Which model does each kind of work, and how hard it thinks. Automatic is a good start.`}),(0,V.jsx)(Xn,{state:e})]})]})}function sr({state:e}){let t=t=>e.connections.filter(e=>e.auth===t),n=t(`subscription`),r=n.filter(e=>e.status===`needs-login`),i=t(`local`).filter(e=>e.id===`ollama`||e.id===`lmstudio`),a=[{id:`ai-plans`,title:`Use a plan you pay for`,body:`Claude, ChatGPT or Gemini, through their app on this computer, signed in as you. No extra bill.`,status:r.length?`${r.map(e=>Yn[e.id]??e.label).join(`, `)}: sign in needed`:n.every(e=>e.status===`missing`)?`None installed yet`:`Not ready yet`,action:`Set it up`},{id:`ai-keys`,title:`Paste an API key`,body:`Anthropic, OpenAI or Google, billed per use by the provider. You can set a budget.`,status:`No key yet`,action:`Add a key`},{id:`ai-local`,title:`Run a model on this computer`,body:`Free and private, with Ollama or LM Studio. Changes need a model that can use tools.`,status:i.every(e=>e.status===`missing`)?`Not installed yet`:`Not running`,action:`Set it up`}];return(0,V.jsxs)(`section`,{className:`mb-7`,"data-connect-ai":!0,children:[(0,V.jsx)(`h3`,{className:`text-[14px] font-semibold text-fg`,children:`Connect an AI`}),(0,V.jsx)(`p`,{className:`mt-1 max-w-[520px] text-[12.5px] leading-relaxed text-fg-3`,children:`Quick edits work without one. For everything else, pick one of these:`}),(0,V.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-3`,children:a.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col rounded-[12px] p-3 ring-1 ring-inset ring-line`,"data-way":e.id,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:e.title}),(0,V.jsx)(`p`,{className:`mt-1 flex-1 text-[12px] leading-relaxed text-fg-3`,children:e.body}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-[11.5px] text-fg-3`,children:[(0,V.jsx)(L,{tone:`warn`}),` `,e.status]}),(0,V.jsx)(A,{size:`sm`,variant:`primary`,className:`mt-2.5 self-start`,onClick:()=>document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:e.action})]},e.id))})]})}var cr=e=>e.input+e.output+e.cacheRead+e.cacheWrite;function lr({label:e,value:t,sub:n}){return(0,V.jsxs)(`div`,{className:`rounded-[10px] px-3 py-2.5 ring-1 ring-inset ring-line`,children:[(0,V.jsx)(`div`,{className:`text-[11.5px] text-fg-3`,children:e}),(0,V.jsx)(`div`,{className:`mt-0.5 text-[17px] font-semibold tabular-nums tracking-[-0.01em] text-fg`,children:t}),n&&(0,V.jsx)(`div`,{className:`mt-0.5 text-[11.5px] tabular-nums text-fg-3`,children:n})]})}function ur({rows:e}){return e.length?(0,V.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{className:`text-left text-fg-3`,children:[(0,V.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:` `}),(0,V.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Calls`}),(0,V.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:`Tokens`}),(0,V.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Cost`})]})}),(0,V.jsx)(`tbody`,{className:`tabular-nums`,children:e.slice(0,8).map(e=>(0,V.jsxs)(`tr`,{className:`border-t border-line`,children:[(0,V.jsx)(`td`,{className:`max-w-[260px] truncate px-3 py-1.5 text-fg`,children:e.label}),(0,V.jsx)(`td`,{className:`px-2 py-1.5 text-right text-fg-2`,children:e.calls}),(0,V.jsx)(`td`,{className:`px-2 py-1.5 text-right text-fg-2`,children:he(cr(e))}),(0,V.jsx)(`td`,{className:`px-3 py-1.5 text-right text-fg-2`,children:e.usd>=.005?y(e.usd):e.planUsd>=.005?`plan (${y(e.planUsd)})`:e.unpriced===e.calls?`—`:`$0`})]},e.key))})]}):(0,V.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-fg-3`,children:`No AI calls this month yet.`})}function dr({label:e,hint:t,value:n,onSave:i,unit:a}){let[o,s]=(0,B.useState)(n==null?``:String(n));(0,B.useEffect)(()=>s(n==null?``:String(n)),[n]);let c=()=>{let e=o.trim(),t=e===``?null:Number(e.replace(/[$,\s]/g,``));t===null||Number.isFinite(t)&&t>=0?i(t):s(n==null?``:String(n))};return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:e}),(0,V.jsx)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:t})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[a===`$`&&(0,V.jsx)(`span`,{className:`text-[12.5px] text-fg-3`,children:`$`}),(0,V.jsx)(`input`,{inputMode:`decimal`,value:o,onChange:e=>s(e.target.value),onBlur:c,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`No limit`,"aria-label":e,className:r(Q,`w-[110px] text-right tabular-nums`)}),a===`tokens`&&(0,V.jsx)(`span`,{className:`text-[12.5px] text-fg-3`,children:`tokens`})]})]})}function fr(){let e=Kn(),[t,n]=(0,B.useState)(`feature`),i=e?.usage,a=(0,B.useMemo)(()=>Math.max(1e-4,...(i?.days??[]).map(e=>e.usd>0?e.usd:0)),[i]),o=(0,B.useMemo)(()=>Math.max(1,...(i?.days??[]).map(e=>e.tokens)),[i]);if(!i)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] text-fg-3`,children:[(0,V.jsx)(z,{}),` Loading usage…`]});let s=i.days.some(e=>e.usd>0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Gn,{sub:`Every AI call the studio makes is counted here: tokens, cost at list price, and what prompt caching saved. Plans and local models are counted too; they bill no dollars.`,children:`Usage and budget`}),i.status.message&&(0,V.jsxs)(`div`,{className:r(`mb-3 rounded-[10px] px-3 py-2 text-[12.5px] ring-1 ring-inset`,i.status.level===`over`?`text-bad ring-bad/40`:`text-warn ring-warn/40`),"data-budget-status":i.status.level,children:[i.status.message,` `,i.status.level===`over`&&i.budget.mode===`stop`?`AI requests are paused until you raise the limit or reset the count.`:``]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,"data-usage":!0,children:[(0,V.jsx)(lr,{label:`Today`,value:y(i.today.usd),sub:`${he(cr(i.today))} tokens · ${i.today.calls} calls`}),(0,V.jsx)(lr,{label:`This month`,value:y(i.month.usd),sub:`${he(cr(i.month))} tokens · ${i.month.calls} calls`}),(0,V.jsx)(lr,{label:`Plan use this month`,value:y(i.month.planUsd),sub:`what it would cost through the API`}),(0,V.jsx)(lr,{label:`Saved by caching`,value:y(i.savedUsd),sub:`this month`})]}),(0,V.jsxs)(`div`,{className:`mt-3 rounded-[10px] px-3 pb-2 pt-3 ring-1 ring-inset ring-line`,children:[(0,V.jsx)(`div`,{className:`flex h-16 items-end gap-[3px]`,"aria-label":`Last 30 days`,children:i.days.map(e=>{let t=s?e.usd/a:e.tokens/o;return(0,V.jsx)(`div`,{title:`${e.date}: ${y(e.usd)}, ${he(e.tokens)} tokens`,className:r(`min-h-[2px] flex-1 rounded-t-[2px]`,e.tokens?`bg-ai/70`:`bg-line`),style:{height:`${Math.max(3,t*100)}%`}},e.date)})}),(0,V.jsxs)(`div`,{className:`mt-1.5 flex justify-between text-[11px] text-fg-3`,children:[(0,V.jsx)(`span`,{children:`30 days ago`}),(0,V.jsx)(`span`,{children:s?`Cost per day`:`Tokens per day`}),(0,V.jsx)(`span`,{children:`Today`})]})]}),(0,V.jsxs)(`div`,{className:`mt-3 rounded-[10px] ring-1 ring-inset ring-line`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between px-3 pt-2.5`,children:[(0,V.jsx)(`span`,{className:`text-[12px] font-semibold text-fg-2`,children:`This month by`}),(0,V.jsx)(De,{value:t,onChange:n,options:[{value:`feature`,label:`Feature`},{value:`model`,label:`Model`},{value:`app`,label:`App`}]})]}),(0,V.jsx)(ur,{rows:t===`feature`?i.byFeature:t===`model`?i.byModel:i.byApp})]}),(0,V.jsxs)(Z,{title:`Budget`,sub:`Limits on what API keys may spend. A daily token limit also covers plans and local models.`,children:[(0,V.jsx)(dr,{label:`Daily limit`,hint:`Dollars per day, across all API keys.`,value:i.budget.dailyUsd,unit:`$`,onSave:e=>void X.setBudget({dailyUsd:e})}),(0,V.jsx)(dr,{label:`Monthly limit`,hint:`Dollars per calendar month.`,value:i.budget.monthlyUsd,unit:`$`,onSave:e=>void X.setBudget({monthlyUsd:e})}),(0,V.jsx)(dr,{label:`Daily tokens`,hint:`All tokens per day, plans and local models included.`,value:i.budget.dailyTokens,unit:`tokens`,onSave:e=>void X.setBudget({dailyTokens:e})}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:`At a limit`}),(0,V.jsxs)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:[`Warn from `,Math.round(i.budget.warnAt*100),`% and carry on, or stop AI requests until you raise the limit or reset.`]})]}),(0,V.jsx)(De,{value:i.budget.mode,onChange:e=>void X.setBudget({mode:e}),options:[{value:`warn`,label:`Warn`},{value:`stop`,label:`Stop`}]})]})]}),(0,V.jsx)(Z,{title:`Reset`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3`,children:[(0,V.jsx)(A,{size:`sm`,onClick:()=>void X.reset(`today`),children:`Reset today’s count`}),(0,V.jsx)(A,{size:`sm`,onClick:()=>void X.reset(`month`),children:`Reset this month`}),(0,V.jsx)(A,{size:`sm`,variant:`ghost`,onClick:async()=>await de({title:`Forget every AI call the studio recorded?`,body:`The counts and history start again from zero.`,action:`Forget them`,danger:!0})&&void X.reset(`all`),children:`Clear history`}),(i.resetAt.today||i.resetAt.month)&&(0,V.jsxs)(`span`,{className:`text-[11.5px] text-fg-3`,children:[`Counting since `,new Date(Math.max(i.resetAt.today??0,i.resetAt.month??0)).toLocaleString()]})]})})]})}function pr(){let e=Kn(),[t,n]=(0,B.useState)(!1),r=e?.mcp;if(!r)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[12.5px] text-fg-3`,children:[(0,V.jsx)(z,{}),` Loading…`]});let i=`Bearer ${r.token}`,a=[{app:`Claude Code`,where:`Run in a terminal`,text:`claude mcp add --transport http saywright ${r.url} --header "Authorization: ${i}"`},{app:`Claude Desktop`,where:`Settings → Developer → Edit config (claude_desktop_config.json)`,text:JSON.stringify({mcpServers:{saywright:{command:r.stdio.command,args:r.stdio.args}}},null,2)},{app:`Cursor`,where:`~/.cursor/mcp.json`,text:JSON.stringify({mcpServers:{saywright:{url:r.url,headers:{Authorization:i}}}},null,2)},{app:`VS Code`,where:`.vscode/mcp.json in your project`,text:JSON.stringify({servers:{saywright:{type:`http`,url:r.url,headers:{Authorization:i}}}},null,2)},{app:`Codex`,where:`~/.codex/config.toml`,text:`[mcp_servers.saywright]\nurl = "${r.url}"\nhttp_headers = { Authorization = "${i}" }`}];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Gn,{sub:`Claude Desktop, Claude Code, Cursor, VS Code and Codex can see what you point at here and propose changes you keep or undo in the studio. They connect to Saywright over MCP, on this computer only.`,children:`Use Saywright from other AI apps`}),(0,V.jsx)(Z,{title:`Connection`,children:(0,V.jsxs)(`div`,{className:`space-y-2 px-3 py-3`,children:[(0,V.jsx)(`div`,{className:`text-[12px] text-fg-3`,children:`Address`}),(0,V.jsx)(er,{text:r.url,label:`Copy the address`}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between pt-1 text-[12px] text-fg-3`,children:[(0,V.jsx)(`span`,{children:`Token (keep it private: it lets apps on this computer use Saywright)`}),(0,V.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-human-fg hover:underline [&_svg]:size-3`,onClick:()=>n(!t),children:[t?(0,V.jsx)(ye,{}):(0,V.jsx)(ve,{}),` `,t?`Hide`:`Show`]})]}),(0,V.jsx)(er,{text:r.token,shown:t?r.token:`•`.repeat(24),label:`Copy the token`})]})}),(0,V.jsx)(Z,{title:`Set up an app`,sub:`Copy the settings for the app you use. They read what you selected or pinned (get_context), the code (read_file, search_code), your test sessions’ reports, and propose changes (propose_change).`,children:a.map(e=>(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-mcp-app":e.app,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:e.app}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1 text-[11.5px] text-fg-3`,children:[e.where,(0,V.jsx)($n,{text:e.text,label:`Copy the ${e.app} settings`})]})]}),(0,V.jsx)(`pre`,{tabIndex:0,role:`region`,"aria-label":`${e.app} settings`,className:`mt-1.5 max-h-[140px] overflow-auto whitespace-pre-wrap break-all rounded-[8px] bg-sunken p-2.5 font-mono text-[11.5px] leading-relaxed text-fg-2`,children:t?e.text:e.text.replaceAll(r.token,`•`.repeat(12))})]},e.app))})]})}var mr={key:`https://console.cloud.google.com/apis/credentials`,crux:`https://console.cloud.google.com/apis/library/chromeuxreport.googleapis.com`,serviceAccounts:`https://console.cloud.google.com/iam-admin/serviceaccounts`,searchApi:`https://console.cloud.google.com/apis/library/searchconsole.googleapis.com`,analyticsApi:`https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com`};function hr({href:e,children:t}){return(0,V.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-human-fg hover:underline`,href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,V.jsx)(we,{className:`size-3`})]})}function gr({r:e}){return e?(0,V.jsx)(`p`,{className:r(`mt-1.5 text-[12px] leading-relaxed`,e.ok?`text-ok`:`text-bad`),children:e.message}):null}function _r(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(null),i=C(e=>e.apps.find(t=>t.id===e.active)?.name??null);(0,B.useEffect)(()=>{m.get(`/connectors/google`).then(t,e=>r(e.message))},[]);let a=async e=>{try{return t(await m.put(`/connectors/google`,e)),{ok:!0,message:`Saved.`}}catch(e){return{ok:!1,message:e.message}}};return e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Gn,{sub:`Real-user data next to the expert reviews: how fast your pages are for real visitors, what people search to find them, and how they use them. Read-only, from your own Google accounts, for your production address.`,children:`Google data`}),(0,V.jsx)(vr,{state:e,save:a}),(0,V.jsx)(yr,{state:e,save:a}),(0,V.jsx)(br,{state:e,save:a,appName:i},i??``)]}):(0,V.jsx)(`div`,{className:`flex items-center gap-2 text-[12.5px] text-fg-3`,children:n??(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(z,{}),` Loading…`]})})}function vr({state:e,save:t}){let[n,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null);return(0,V.jsx)(Z,{title:`Speed for real users`,sub:`Chrome UX Report: Core Web Vitals of real Chrome users on phones over the last 28 days. Free; needs a Google Cloud API key with the Chrome UX Report API turned on.`,children:(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-service":`crux`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[`Google API key`,` `,e.apiKey?(0,V.jsxs)(I,{tone:`ok`,children:[(0,V.jsx)(L,{tone:`ok`,className:`mr-0.5`}),` `,e.apiKey]}):(0,V.jsx)(I,{children:`No key`})]}),(0,V.jsxs)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:[(0,V.jsx)(hr,{href:mr.key,children:`Create a key`}),` · `,(0,V.jsx)(hr,{href:mr.crux,children:`Turn on the Chrome UX Report API`})]}),(0,V.jsxs)(`form`,{className:`mt-2 flex gap-2`,onSubmit:async e=>{if(e.preventDefault(),!n.trim())return;c(!0);let r=await t({apiKey:n.trim()});c(!1),u(r),r?.ok&&i(``)},children:[(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(`input`,{type:a?`text`:`password`,value:n,onChange:e=>i(e.target.value),placeholder:e.apiKey?`Replace the key`:`Paste a Google API key`,autoComplete:`off`,spellCheck:!1,"aria-label":`Google API key`,className:r(Q,`w-full pr-8 font-mono`)}),(0,V.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1.5 text-fg-3 hover:text-fg [&_svg]:size-[14px]`,onClick:()=>o(!a),"aria-label":a?`Hide key`:`Show key`,children:a?(0,V.jsx)(ye,{}):(0,V.jsx)(ve,{})})]}),(0,V.jsx)(A,{type:`submit`,size:`md`,variant:`primary`,disabled:!n.trim()||s,children:s?(0,V.jsx)(z,{}):`Save`}),e.apiKey&&(0,V.jsx)(A,{type:`button`,size:`md`,variant:`ghost`,"aria-label":`Remove the Google API key`,onClick:async()=>await de({title:`Remove the Google API key?`,body:`It is deleted from this computer. Real-user speed data (Chrome UX Report) stops until you add a key again.`,action:`Remove`,danger:!0})&&u(await t({apiKey:null})),children:(0,V.jsx)(F,{})})]}),(0,V.jsx)(gr,{r:l}),(0,V.jsx)(`p`,{className:`mt-1.5 text-[11.5px] text-fg-3`,children:`Saved in .env.local in the Saywright folder, readable only by you. Restrict it to the Chrome UX Report API in Google Cloud.`})]})})}function yr({state:e,save:t}){let[n,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),l=(0,B.useRef)(null),u=async e=>{o(!0);let n=await t({account:e});o(!1),c(n),n?.ok&&i(``)};return(0,V.jsx)(Z,{title:`Search Console and Analytics`,sub:`A Google Cloud service account that you add, read-only, to your Search Console property and your Google Analytics 4 property. Saywright signs in as it; your own Google password is never asked for.`,children:(0,V.jsxs)(`div`,{className:`px-3 py-3`,"data-service":`account`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-medium text-fg`,children:[`Service account`,` `,e.account?(0,V.jsxs)(I,{tone:`ok`,children:[(0,V.jsx)(L,{tone:`ok`,className:`mr-0.5`}),` Added`]}):(0,V.jsx)(I,{children:`Not added`})]}),e.account&&(0,V.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11.5px] text-fg-2`,children:e.account.email})]}),e.account&&(0,V.jsx)(A,{size:`sm`,variant:`ghost`,icon:(0,V.jsx)(F,{}),onClick:async()=>await de({title:`Remove the service account key?`,body:`It is deleted from this computer. Search Console and Analytics data stop until you add it again.`,action:`Remove`,danger:!0})&&c(await t({account:null})),children:`Remove`})]}),!e.account&&(0,V.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-4 text-[12px] leading-relaxed text-fg-3`,children:[(0,V.jsxs)(`li`,{children:[(0,V.jsx)(hr,{href:mr.serviceAccounts,children:`Create a service account`}),` and add a JSON key to it.`]}),(0,V.jsxs)(`li`,{children:[`Turn on the `,(0,V.jsx)(hr,{href:mr.searchApi,children:`Search Console API`}),` and the `,(0,V.jsx)(hr,{href:mr.analyticsApi,children:`Google Analytics Data API`}),`.`]}),(0,V.jsx)(`li`,{children:`Add its email address as a user: in Search Console (Settings → Users, Restricted) and in Analytics (Admin → Property access, Viewer).`}),(0,V.jsx)(`li`,{children:`Choose the key file, or paste what it says, below.`})]}),(0,V.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,V.jsx)(`textarea`,{value:n,onChange:e=>i(e.target.value),placeholder:e.account?`Paste another key to replace it`:`{ "type": "service_account", "client_email": "…", "private_key": "…" }`,spellCheck:!1,autoComplete:`off`,rows:3,"aria-label":`Service account key (JSON)`,className:r(Q,`block h-auto w-full resize-none py-2 font-mono text-[11.5px]`)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(A,{size:`md`,variant:`primary`,disabled:!n.trim()||a,onClick:()=>void u(n),children:a?(0,V.jsx)(z,{}):`Save`}),(0,V.jsx)(A,{size:`md`,icon:(0,V.jsx)(Nn,{}),onClick:()=>l.current?.click(),disabled:a,children:`Choose the key file`}),(0,V.jsx)(`input`,{ref:l,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){if(t.size>2e4)return c({ok:!1,message:`That file is too big to be a service account key.`});await u(await t.text())}}})]})]}),(0,V.jsx)(gr,{r:s}),(0,V.jsx)(`p`,{className:`mt-1.5 text-[11.5px] text-fg-3`,children:`Kept in Saywright’s data folder, readable only by you. Only its email and private key are kept; it is sent nowhere but Google.`})]})})}function br({state:e,save:t,appName:n}){let[i,a]=(0,B.useState)(e.settings.searchConsoleSite??``),[o,s]=(0,B.useState)(e.settings.ga4Property??``),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null),f=i.trim()!==(e.settings.searchConsoleSite??``)||o.trim()!==(e.settings.ga4Property??``),p=o.trim()!==``&&!/^\d{4,15}$/.test(o.trim()),h=!e.apiKey&&!e.account;return n?(0,V.jsx)(Z,{title:`For ${n}`,sub:`Each linked app has its own properties. Data is looked up for the same page on the app’s production address.`,children:(0,V.jsxs)(`div`,{className:`space-y-3 px-3 py-3`,"data-service":`app`,children:[(0,V.jsxs)(`div`,{className:`text-[12px] leading-relaxed`,children:[(0,V.jsx)(`span`,{className:`text-fg-3`,children:`Production address: `}),e.publicUrl?(0,V.jsx)(`span`,{className:`font-mono text-[11.5px] text-fg-2`,children:e.publicUrl}):(0,V.jsxs)(`span`,{className:`text-warn`,children:[`none yet.`,` `,(0,V.jsx)(`button`,{className:`text-human-fg hover:underline`,onClick:()=>{fe({overlay:null}),x.show()},children:`Add one to the app`}),` `,`(Google only has data for public pages).`]})]}),(0,V.jsxs)(`label`,{className:`block space-y-1`,children:[(0,V.jsx)(`span`,{className:`text-[12px] font-medium text-fg`,children:`Search Console property`}),(0,V.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`sc-domain:example.com or https://www.example.com/`,spellCheck:!1,className:r(Q,`w-full font-mono`)})]}),(0,V.jsxs)(`label`,{className:`block space-y-1`,children:[(0,V.jsx)(`span`,{className:`text-[12px] font-medium text-fg`,children:`Google Analytics 4 property ID`}),(0,V.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`123456789 (Admin → Property details)`,inputMode:`numeric`,spellCheck:!1,className:r(Q,`w-full font-mono`),"aria-invalid":p}),p&&(0,V.jsx)(`span`,{className:`block text-[11.5px] text-bad`,children:`A property ID is only numbers (not the G-… measurement ID).`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(A,{size:`md`,variant:`primary`,disabled:!f||p||!!c,onClick:async()=>{l(`save`),d(await t({settings:{searchConsoleSite:i.trim(),ga4Property:o.trim()}})),l(null)},children:c===`save`?(0,V.jsx)(z,{}):`Save`}),(0,V.jsx)(A,{size:`md`,disabled:!!c||f||h,title:h?`Add an API key or a service account first`:f?`Save first`:void 0,onClick:async()=>{l(`test`);try{d(await m.post(`/connectors/google/test`))}catch(e){d({ok:!1,message:e.message})}l(null)},"data-test-google":!0,children:c===`test`?(0,V.jsx)(z,{}):`Test`})]}),(0,V.jsx)(gr,{r:u})]})}):(0,V.jsx)(Z,{title:`This app`,children:(0,V.jsx)(`p`,{className:`px-3 py-3 text-[12px] text-fg-3`,children:`Open an app to choose its Search Console and Analytics properties.`})})}function xr(){let e=oe(e=>e.speech);if((0,B.useEffect)(()=>void le.refreshSpeech(),[]),!e)return(0,V.jsx)(z,{className:`size-3.5 text-fg-3`});if(e.runtime===`missing`)return(0,V.jsx)(`p`,{className:`text-[12px] text-warn`,children:`The speech engine isn’t installed for this platform. Run npm install again; voice still works through the browser.`});let t=e.models.filter(e=>e.wordErrors.ar!=null).sort((e,t)=>e.wordErrors.ar-t.wordErrors.ar)[0],n=e.models.find(t=>t.id===e.active.ar),r=t&&!t.installed&&n?.wordErrors.ar!=null&&n.id!==t.id?{now:n.wordErrors.ar,best:t}:null;return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[r&&(0,V.jsxs)(`p`,{className:`rounded-[10px] bg-ai-soft px-3 py-2 text-[12px] text-ai-fg ring-1 ring-inset ring-ai-line/30`,"data-arabic-upgrade":!0,children:[`For Arabic, `,r.best.label.split(` (`)[0],` gets `,r.best.wordErrors.ar,`% of words wrong, against `,r.now,`% with the model you have (measured on real speech). It is a`,` `,(r.best.sizeMb/1e3).toFixed(1),` GB download, once.`]}),(0,V.jsxs)(`div`,{className:`divide-y divide-line rounded-[10px] ring-1 ring-inset ring-line`,children:[e.runtime===`failed`&&(0,V.jsxs)(`p`,{className:`px-3 py-2 text-[12px] text-bad`,children:[`The speech engine crashed: `,e.runtimeError]}),e.models.map(t=>{let n=[`ar`,`en`].filter(n=>e.active[n]===t.id),r=[`ar`,`en`].filter(e=>t.wordErrors[e]!=null).map(e=>`${e===`ar`?`Arabic`:`English`} ${t.wordErrors[e]}%`);return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12.5px] font-medium text-fg`,children:[t.installed&&(0,V.jsx)(L,{tone:`ok`}),t.label]}),(0,V.jsxs)(`div`,{className:`text-[11.5px] text-fg-3`,children:[t.sizeMb>=1e3?`${(t.sizeMb/1e3).toFixed(1)} GB`:`${t.sizeMb} MB`,r.length>0&&(0,V.jsxs)(`span`,{title:`Words it gets wrong per hundred, on real read speech (FLEURS)`,children:[` · word errors: `,r.join(`, `)]}),n.length>0&&` · used for ${n.map(e=>e===`ar`?`Arabic`:`English`).join(` and `)}`,t.error&&(0,V.jsxs)(`span`,{className:`text-bad`,children:[` · `,t.error]})]}),t.installing!=null&&(0,V.jsx)(`div`,{className:`mt-1.5 h-1 overflow-hidden rounded-full bg-active`,children:(0,V.jsx)(`div`,{className:`h-full bg-ai transition-[width] duration-300`,style:{width:`${t.installing}%`}})})]}),t.installed?(0,V.jsx)(pe,{className:`size-4 text-ok`}):t.installing==null?(0,V.jsx)(A,{size:`xs`,icon:(0,V.jsx)(Te,{}),onClick:()=>void le.installSpeech(t.id),children:`Install`}):(0,V.jsxs)(`span`,{className:`tabular text-[11.5px] text-fg-3`,children:[t.installing,`%`]})]},t.id)})]})]})}var Sr={ar:[`كبّر هذا`,`الإجمالي غلط، المفروض يكون ثمانين دولار وثمانين سنت`,`زرار الدفع مش بيشتغل لما أضغط عليه`,`غيّر لون الزرار ده للأخضر`,`الصفحة بطيئة جدًا في التحميل`,`تراجع`],en:[`Make this bigger`,`The total is wrong, it should be eighty dollars eighty`,`The pay button does nothing when I click it`,`Change this button to green`,`The page takes too long to load`,`Undo`]};function Cr(e){return`${Math.round(e*100)}%`}function wr(){let e=N(e=>e.voice.lang),t=/^ar\b/i.test(e)?`ar`:`en`,n=j(e=>e.voice),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(0),[c,l]=(0,B.useState)([]),u=(0,B.useRef)(0);u.current=o;let d=Sr[t];if((0,B.useEffect)(()=>{if(!i)return;let e=P.dryRun;return P.dryRun=()=>{let e=j.getState().voice.last;if(!e)return;let t=d[u.current];l(n=>[...n,{said:t,browser:e.browser[0]??``,device:e.device}]),s(e=>Math.min(d.length,e+1))},()=>{P.dryRun=e}},[i,d]),!i)return(0,V.jsxs)(A,{size:`sm`,icon:(0,V.jsx)(Ae,{}),onClick:()=>(a(!0),s(0),l([])),children:[`Start the check (`,t===`ar`?`Arabic`:`English`,`)`]});let f=n.state===`starting`||n.state===`listening`,p=o>=d.length,m=e=>{let t=c.filter(t=>t[e]);return t.length?1-t.reduce((t,n)=>t+Math.min(1,_e(n.said,n[e])),0)/t.length:null},h=m(`browser`),g=m(`device`);return(0,V.jsxs)(`div`,{className:`space-y-3 rounded-[12px] bg-sunken p-3 ring-1 ring-inset ring-line`,"data-accuracy-check":!0,children:[p?(0,V.jsx)(`div`,{className:`text-[13px] font-medium text-fg`,children:`Done. Words heard correctly:`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`text-[11.5px] text-fg-3`,children:[`Sentence `,o+1,` of `,d.length,`: hold the button, read it naturally, let go.`]}),(0,V.jsx)(`div`,{dir:`auto`,className:`text-[16px] font-medium leading-relaxed text-fg`,children:d[o]}),(0,V.jsxs)(`button`,{type:`button`,onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),P.pressTalk()},onPointerUp:()=>P.releaseTalk(),onPointerCancel:()=>P.releaseTalk(),className:r(`inline-flex h-8 select-none items-center gap-2 rounded-[9px] px-3 text-[12.5px] font-medium`,f?`bg-human text-[#1b1203]`:`bg-raised text-fg ring-1 ring-inset ring-line hover:bg-hover`),children:[(0,V.jsx)(Ae,{className:`size-[14px]`}),n.state===`finishing`?`Checking…`:f?`Listening`:`Hold to read`]})]}),c.length>0&&(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,V.jsxs)(`div`,{className:`rounded-[9px] bg-raised p-2.5 ring-1 ring-inset ring-line`,children:[(0,V.jsx)(`div`,{className:`text-[11.5px] text-fg-3`,children:`Browser recogniser`}),(0,V.jsx)(`div`,{className:`tabular text-[18px] font-semibold text-fg`,children:h==null?`—`:Cr(h)})]}),(0,V.jsxs)(`div`,{className:`rounded-[9px] bg-raised p-2.5 ring-1 ring-inset ring-line`,children:[(0,V.jsx)(`div`,{className:`text-[11.5px] text-fg-3`,children:`On this computer`}),(0,V.jsx)(`div`,{className:`tabular text-[18px] font-semibold text-fg`,children:g==null?`—`:Cr(g)})]})]}),c.length>0&&(0,V.jsx)(`div`,{className:`max-h-[160px] space-y-1.5 overflow-y-auto text-[12px]`,children:c.map((e,t)=>(0,V.jsxs)(`div`,{className:`rounded-[8px] bg-raised px-2.5 py-1.5 ring-1 ring-inset ring-line`,children:[(0,V.jsx)(`div`,{dir:`auto`,className:`font-medium text-fg`,children:e.said}),e.browser&&(0,V.jsxs)(`div`,{dir:`auto`,className:`text-fg-3`,children:[`Browser: `,e.browser,` `,(0,V.jsxs)(`span`,{className:`tabular`,children:[`(`,Cr(1-Math.min(1,_e(e.said,e.browser))),`)`]})]}),e.device&&(0,V.jsxs)(`div`,{dir:`auto`,className:`text-fg-3`,children:[`Computer: `,e.device,` `,(0,V.jsxs)(`span`,{className:`tabular`,children:[`(`,Cr(1-Math.min(1,_e(e.said,e.device))),`)`]})]})]},t))}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(A,{size:`xs`,icon:(0,V.jsx)(xe,{}),onClick:()=>(s(0),l([])),children:`Start over`}),(0,V.jsx)(A,{size:`xs`,variant:`ghost`,onClick:()=>a(!1),children:`Close`})]})]})}var Tr=[{id:`general`,label:`General`,icon:(0,V.jsx)(zn,{})},{id:`voice`,label:`Voice`,icon:(0,V.jsx)(Ae,{})},{id:`ai`,label:`AI`,icon:(0,V.jsx)(ie,{})},{id:`usage`,label:`Usage and budget`,icon:(0,V.jsx)(Se,{})},{id:`mcp`,label:`Other AI apps`,icon:(0,V.jsx)(Ln,{})},{id:`services`,label:`Google data`,icon:(0,V.jsx)(jn,{})},{id:`shortcuts`,label:`Shortcuts`,icon:(0,V.jsx)(Fn,{})}];function Er(){let e=j(e=>e.overlay===`settings`),t=j(e=>e.settingsTab);return(0,V.jsx)(ae,{open:e,onOpenChange:e=>fe({overlay:e?`settings`:null}),title:`Settings`,className:`h-[600px] w-[min(780px,calc(100vw-32px))]`,children:(0,V.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,V.jsxs)(`nav`,{className:`flex w-[188px] shrink-0 flex-col gap-0.5 border-r border-line bg-sunken/50 p-2`,children:[(0,V.jsx)(`div`,{className:`px-2 pb-2 pt-1.5 text-[13px] font-semibold text-fg`,children:`Settings`}),Tr.map(e=>(0,V.jsxs)(`button`,{onClick:()=>fe({settingsTab:e.id}),className:r(`flex h-8 items-center gap-2.5 rounded-[7px] px-2 text-[12.5px] font-medium transition-colors [&_svg]:size-[15px]`,t===e.id?`bg-active text-fg`:`text-fg-2 hover:bg-hover hover:text-fg`),children:[e.icon,e.label]},e.id))]}),(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-1 overflow-y-auto`,children:[(0,V.jsx)(M,{className:`absolute right-3 top-3`,onClick:()=>fe({overlay:null}),"aria-label":`Close`,children:(0,V.jsx)(ce,{})}),(0,V.jsxs)(`div`,{className:`px-6 pb-8 pt-5`,children:[t===`general`&&(0,V.jsx)(Or,{}),t===`voice`&&(0,V.jsx)(Mr,{}),t===`ai`&&(0,V.jsx)(or,{}),t===`usage`&&(0,V.jsx)(fr,{}),t===`mcp`&&(0,V.jsx)(pr,{}),t===`services`&&(0,V.jsx)(_r,{}),t===`shortcuts`&&(0,V.jsx)(Vr,{})]})]},t)]})})}function Dr({children:e,sub:t}){return(0,V.jsxs)(`div`,{className:`mb-4`,children:[(0,V.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e}),t&&(0,V.jsx)(`p`,{className:`mt-1 max-w-[460px] text-[12.5px] leading-relaxed text-fg-3`,children:t})]})}function $({label:e,hint:t,children:n,stack:i}){let a=(0,B.useId)();return(0,V.jsxs)(`div`,{className:r(`border-b border-line py-3.5 last:border-0`,i?`space-y-2.5`:`flex items-center justify-between gap-6`),children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{id:a,className:`text-[13px] font-medium text-fg`,children:e}),t&&(0,V.jsx)(`div`,{className:`mt-0.5 text-[12px] leading-relaxed text-fg-3`,children:t})]}),(0,V.jsx)(`div`,{className:r(i?``:`shrink-0`),children:(0,V.jsx)(Ee.Provider,{value:a,children:n})})]})}function Or(){let e=N(e=>e.theme),t=N(e=>e.voice.sounds),n=N(e=>e.ui.commitOnKeep),r=N(),i=j(e=>e.status?.target.git);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Dr,{children:`General`}),(0,V.jsx)($,{label:`Appearance`,children:(0,V.jsx)(De,{value:e,onChange:e=>r.set({theme:e}),options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}]})}),(0,V.jsx)($,{label:`Commit when you keep a change`,hint:i?`Kept changes become a git commit that includes what you said.`:`Your app’s folder isn’t a git repository.`,children:(0,V.jsx)(Ne,{checked:n&&!!i,disabled:!i,onCheckedChange:e=>r.setUi({commitOnKeep:e})})}),(0,V.jsx)($,{label:`Sounds`,hint:`Quiet cues when listening starts, a request is sent, and a change is kept or undone.`,children:(0,V.jsx)(Ne,{checked:t,onCheckedChange:e=>r.setVoice({sounds:e})})}),(0,V.jsx)($,{label:`Quick-start tour`,hint:`A minute on your own app: point at something, change it, keep or undo it, and where testing and reviews live.`,children:(0,V.jsx)(A,{size:`sm`,onClick:()=>{fe({overlay:null}),Me.start()},children:`Take the tour`})}),(0,V.jsx)($,{label:`Voice check`,hint:`Hold Space and talk, to check the studio hears you.`,children:(0,V.jsx)(A,{size:`sm`,onClick:()=>fe({overlay:`onboarding`,onboardingStep:1}),children:`Check`})}),(0,V.jsx)($,{label:`Reset all settings`,hint:`Theme, layout and voice settings go back to their defaults.`,children:(0,V.jsx)(A,{size:`sm`,variant:`danger`,onClick:()=>r.reset(),children:`Reset`})})]})}function kr({left:e,right:t,value:n,onChange:r}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`w-[72px] text-[11.5px] text-fg-3`,children:e}),(0,V.jsx)(Vn,{value:n,onChange:r}),(0,V.jsx)(`span`,{className:`w-[56px] text-right text-[11.5px] text-fg-3`,children:t})]})}var Ar=[[`en-US`,`English (US)`],[`en-GB`,`English (UK)`],[`en-AU`,`English (Australia)`],[`en-IN`,`English (India)`],[`de-DE`,`Deutsch`],[`fr-FR`,`Français`],[`es-ES`,`Español`],[`it-IT`,`Italiano`],[`pt-BR`,`Português (Brasil)`],[`nl-NL`,`Nederlands`],[`ar-EG`,`العربية (مصر)`],[`ar-SA`,`العربية (السعودية)`],[`ar-AE`,`العربية (الإمارات)`],[`ar-JO`,`العربية (الأردن)`],[`ar-MA`,`العربية (المغرب)`],[`ja-JP`,`日本語`]],jr=[{value:`auto`,label:`Auto`},{value:`browser`,label:`Browser`},{value:`device`,label:`On-device`}];function Mr(){let e=N(),t=j(e=>e.voice.supported),n=j(e=>e.voice.model===`unavailable`),r=/^en\b/i.test(e.voice.lang),i=/^ar\b/i.test(e.voice.lang),a={auto:r?n?`Your browser’s recogniser. Once the on-device model is there, it double-checks what was heard against the recording, keeps your first word and catches misheard short commands.`:`Your browser’s recogniser, double-checked against the recording by a speech model on this computer. It keeps your first word, and catches misheard short commands.`:i?`Your browser’s recogniser and an Arabic speech model on this computer, both hearing you; the studio picks what it understands. Commands work in Egyptian, Gulf, Levantine and standard Arabic.`:`Your browser’s recogniser. (The on-device check understands English and Arabic.)`,browser:`Your browser’s recogniser alone. In Chrome, audio goes to Google’s speech service.`,device:i?`The Arabic speech model on this computer alone: audio never leaves it.`:`A speech model on this computer alone: audio never leaves it. Live words appear a little later.`};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Dr,{sub:`Quick edits understand English and Arabic phrases; the AI understands any language.`,children:`Voice`}),!t&&(0,V.jsx)(`div`,{className:`mb-3 rounded-[10px] bg-warn-soft p-3 text-[12.5px] text-fg ring-1 ring-inset ring-warn/25`,children:e.voice.engine===`browser`?`This browser has no speech recognition. Choose Auto or On-device, or use Chrome.`:`No microphone is available here, so voice is off. You can still type requests.`}),(0,V.jsxs)($,{label:`Recognition`,hint:a[e.voice.engine],stack:!0,children:[(0,V.jsx)(De,{value:e.voice.engine,onChange:t=>e.setVoice({engine:t}),options:jr}),e.voice.engine===`device`&&!r&&!i&&(0,V.jsx)(`div`,{className:`text-[12px] text-warn`,children:`On-device recognition understands English and Arabic. Pick one of them, or use Auto.`}),e.voice.engine!==`browser`&&r&&(0,V.jsx)(Nr,{})]}),(0,V.jsx)($,{label:`Language`,children:(0,V.jsx)(Bn,{value:Ar.some(([t])=>t===e.voice.lang)?e.voice.lang:`en-US`,onChange:t=>e.setVoice({lang:t}),options:Ar.map(([e,t])=>({value:e,label:t})),className:`w-[200px]`})}),(0,V.jsx)($,{label:`Speech models on this computer`,hint:`Transcribe test-session narration, and Arabic voice commands. Measured on real recordings of people reading Arabic and English.`,stack:!0,children:(0,V.jsx)(xr,{})}),(0,V.jsx)($,{label:`Test your microphone`,hint:i?`Hold the button (or Space) and say something like “كبّر هذا”.`:`Hold the button (or Space) and say something like “make this bigger”.`,stack:!0,children:(0,V.jsx)(Ir,{})}),(0,V.jsx)($,{label:`Accuracy on your voice`,hint:`Read a few sentences; see how many words each recogniser gets right for your voice, accent and microphone.`,stack:!0,children:(0,V.jsx)(wr,{})}),(0,V.jsx)($,{label:`Check before sending`,hint:`What you said appears in the command bar first, with other ways it could have been heard. Press Enter to send it.`,children:(0,V.jsx)(Ne,{checked:e.voice.review,onCheckedChange:t=>e.setVoice({review:t})})}),(0,V.jsx)($,{label:`Push to talk`,hint:`Hold to talk, release to send.`,children:(0,V.jsx)(je,{children:`Space`})}),(0,V.jsx)($,{label:`Hands-free`,hint:`Tap Space, click the mic, or hold a peace sign. Sends when you pause.`,children:(0,V.jsx)(`span`,{className:`text-[12px] text-fg-3`,children:`Tap Space · ✌`})}),(0,V.jsx)($,{label:`Pause before sending`,hint:`In hands-free mode, send after ${(e.voice.autoStopMs/1e3).toFixed(1)} s of silence.`,stack:!0,children:(0,V.jsx)(kr,{left:`0.8 s`,right:`2.5 s`,value:(e.voice.autoStopMs-800)/1700,onChange:t=>e.setVoice({autoStopMs:Math.round(800+t*1700)})})}),(0,V.jsx)($,{label:`Microphone`,hint:`After you talk it stays on for two minutes, so the start of your next sentence isn’t cut off. The audio stays in this tab and is only used when you talk.`,children:(0,V.jsx)(A,{size:`sm`,onClick:()=>P.voice.capture.close(),children:`Turn off now`})})]})}function Nr(){let e=j(e=>e.voice.model),t=j(e=>e.voice.modelError);return e===`ready`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] text-fg-3`,"data-model":`ready`,children:[(0,V.jsx)(L,{tone:`ok`}),` On-device model ready`]}):e===`unavailable`&&t===`The on-device speech model isn’t downloaded.`?(0,V.jsx)(Pr,{}):e===`unavailable`?(0,V.jsxs)(`div`,{className:`text-[12px] text-warn`,"data-model":`unavailable`,children:[`The on-device model isn’t available`,t?`: ${t}`:`.`,` Voice uses the browser’s recogniser meanwhile.`]}):(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] text-fg-3`,"data-model":`loading`,children:[(0,V.jsx)(z,{className:`size-3`}),` Loading the on-device model…`]})}function Pr(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(``);(0,B.useEffect)(()=>{m.get(`/voice-model`).then(t,()=>void 0)},[]);let o=async()=>{r(!0),a(``);try{await m.post(`/voice-model`),P.voice.asr.retry()}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}};return(0,V.jsxs)(`div`,{className:`space-y-2 text-[12px]`,"data-model":`unavailable`,children:[(0,V.jsx)(`div`,{className:`text-warn`,children:`The on-device model isn’t downloaded yet. Voice uses the browser’s recogniser meanwhile.`}),e&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-fg-3`,children:[(0,V.jsx)(A,{size:`sm`,icon:n?(0,V.jsx)(z,{}):(0,V.jsx)(Te,{}),disabled:n,onClick:()=>void o(),"data-download-model":!0,children:n?`Downloading…`:`Download the voice model (${e.mb} MB)`}),(0,V.jsxs)(`span`,{children:[`or run `,(0,V.jsx)(`code`,{className:`rounded-[4px] bg-sunken px-1 py-px font-mono text-[11.5px] text-fg-2 ring-1 ring-inset ring-line`,children:e.setup})]})]}),i&&(0,V.jsx)(`div`,{className:`text-bad`,children:i})]})}var Fr={browser:`browser`,device:`on-device`,command:`command check`,variant:`sound-alike check`};function Ir(){let e=j(e=>e.voice),[t,n]=(0,B.useState)(null);(0,B.useEffect)(()=>(P.dryRun=()=>n(j.getState().voice.last),()=>{P.dryRun=null}),[]);let i=e.state===`starting`||e.state===`listening`;return(0,V.jsxs)(`div`,{className:`space-y-2.5 rounded-[12px] bg-sunken p-3 ring-1 ring-inset ring-line`,"data-voice-test":!0,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),P.pressTalk()},onPointerUp:()=>P.releaseTalk(),onPointerCancel:()=>P.releaseTalk(),className:r(`inline-flex h-8 shrink-0 select-none items-center gap-2 rounded-[9px] px-3 text-[12.5px] font-medium transition-colors [&_svg]:size-[14px]`,i?`bg-human text-[#1b1203]`:`bg-raised text-fg ring-1 ring-inset ring-line hover:bg-hover`),children:[(0,V.jsx)(Ae,{}),` `,e.state===`starting`?`Starting…`:i?`Listening`:`Hold to talk`]}),(0,V.jsx)(Rr,{active:i})]}),(0,V.jsx)(`div`,{className:`min-h-[40px] text-[13px] leading-relaxed text-fg`,children:i?(0,V.jsx)(`span`,{className:e.words.length?``:`text-fg-3`,children:e.words.join(` `)||`Say something…`}):e.state===`finishing`?(0,V.jsxs)(`span`,{className:`flex items-center gap-2 text-fg-3`,children:[(0,V.jsx)(z,{className:`size-3.5`}),` Working out what you said…`]}):e.error?(0,V.jsx)(`span`,{className:`text-bad`,children:e.error}):t?(0,V.jsx)(Lr,{r:t}):(0,V.jsx)(`span`,{className:`text-fg-3`,children:`Nothing yet.`})})]})}function Lr({r:e}){return(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,V.jsx)(`span`,{className:`text-[15px] font-medium text-fg`,children:e.text?`“${e.text}”`:`Didn’t catch anything.`}),e.text&&(0,V.jsxs)(`span`,{className:`text-[11.5px] text-fg-3`,children:[`via `,Fr[e.source],` · `,S(e.ms),` after you let go`]})]}),e.browser.length>0&&(0,V.jsxs)(`div`,{className:`text-[12px] text-fg-3`,children:[`Browser heard: `,(0,V.jsx)(`span`,{className:`text-fg-2`,children:e.browser.slice(0,3).map(e=>`“${e}”`).join(` or `)})]}),e.device&&(0,V.jsxs)(`div`,{className:`text-[12px] text-fg-3`,children:[`On-device heard: `,(0,V.jsxs)(`span`,{className:`text-fg-2`,children:[`“`,e.device,`”`]})]}),e.browserError&&(0,V.jsxs)(`div`,{className:`text-[12px] text-fg-3`,children:[`The browser’s recogniser couldn’t listen: `,e.browserError]}),e.loudness>0&&e.loudness<.03&&(0,V.jsx)(`div`,{className:`text-[12px] text-warn`,children:`Your microphone sounds quiet. Move closer, or raise the input volume (on a Mac: System Settings → Sound → Input).`})]})}function Rr({active:e}){let t=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=0,n=()=>{let r=P.voice.level();t.current&&(t.current.style.transform=`scaleX(${Math.min(1,r*1.4)})`),e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[]),(0,V.jsx)(`span`,{className:r(`relative h-1.5 flex-1 overflow-hidden rounded-full bg-line transition-opacity`,e?`opacity-100`:`opacity-40`),"aria-hidden":!0,children:(0,V.jsx)(`span`,{ref:t,className:`absolute inset-0 origin-left rounded-full bg-human transition-transform duration-75`,style:{transform:`scaleX(0)`}})})}var zr=[[`Talk (hold) / hands-free (tap)`,[`Space`]],[`Keep the preview`,[`↵`]],[`Undo the preview`,s(`mod+z`)],[`Close what is on top, stop, or clear the selection`,[`Esc`]],[`Type a request`,[`/`]],[`Run a suggestion`,[`1`,`–`,`4`]],[`Select what contains it · inside it`,[`↑`,`↓`]],[`Select the previous · next one`,[`←`,`→`]],[`Open in editor`,[`O`]],[`Add to the selection, or take out`,s(`shift+Click`)],[`Select inner element`,s(`alt+Click`)],[`Edit · Use · Write test`,[`E`,`U`,`R`]],[`Toggle panel`,[`\\`]],[`Command palette`,s(`mod+k`)],[`Help`,[`?`]]],Br=()=>zr;function Vr(){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Dr,{children:`Keyboard shortcuts`}),(0,V.jsx)(`div`,{className:`divide-y divide-line`,children:Br().map(([e,t])=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,V.jsx)(`span`,{className:`text-[12.5px] text-fg-2`,children:e}),(0,V.jsx)(`span`,{className:`flex gap-1`,children:t.map((e,t)=>e===`–`?(0,V.jsx)(`span`,{className:`text-fg-3`,children:`–`},t):(0,V.jsx)(je,{children:e},t))})]},e))})]})}export{Er as SettingsDialog,Br as shortcutsFor};
@@ -0,0 +1 @@
1
+ import{y as e}from"./brand-BSL9G2NW.js";var t={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};t.node;var n=e(t);export{n as t};