@xopcai/xopc 0.0.201 → 0.0.202

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 (82) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D8Cw0Mve.js → agent-avatar-dicebear-CAjfa48Q.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-ANavi648.js → agents-Cke8EF5Z.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-BubrReXg.js → app-management-settings-panel-GNT3iv0V.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-BY5Az2p4.js → appearance-settings-BFond2ll.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CFh9MBxc.js → apps-page-B9D-6sJt.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-C6qpchzp.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-B4CcSDdV.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-751CeNI3.js → automations-page-BFS3dH43.js} +1 -1
  11. package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-xYL_41XP.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-C1Qktr1g.js → block-editor-nYiJQItv.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-settings-page-CGAWs-TT.js → browser-settings-page-ELV-Y8rz.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-DyIRvPaq.js → browser-workflows-page-pT7Hvwwh.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CghUK68J.js → capabilities-settings-panel-Dbx_nPAI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XsTfkvUn.js → capability-presets-settings-panel-DHg_JMUz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-DkoAZZMe.js → channels-settings-DjHOlPq-.js} +1 -1
  18. package/dist/gateway/static/root/assets/{connectors-api-FBOe9SWC.js → connectors-api-X5ukNasZ.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-e4vekkAu.js → connectors-page-RY-W6CQt.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-Q4QaYjpI.js → cron-expression-DHY0LrLq.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-Dtn7e6TW.js → date-picker-CGm8EH8G.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-Br6nPaM6.js → dependency-picker-DDECr6Hj.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-DzTM6aH8.js → desktop-pet-BoEIRgm2.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-FDmaty3P.js → desktop-pet-settings-s4kmnf-W.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-X2e8xn8j.js → directory-picker-path-field-DmfFg4Gq.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-debug-page-Dx4MBfga.js → extension-debug-page-DrLEK8GU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-page-Bf_FEDhM.js → extension-page-DtyFPtMR.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-CrOgZxkf.js → extension-settings-page-Xok6T2KD.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-CZ4r-7qT.js → gateway-config-api-DwSpEYiw.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-DpWmVi0w.js → gateway-settings-B5Zh2rx9.js} +1 -1
  31. package/dist/gateway/static/root/assets/{heartbeat-settings-DSQZhSvT.js → heartbeat-settings-C2RxqeK0.js} +1 -1
  32. package/dist/gateway/static/root/assets/{home-page-L0uHiu0T.js → home-page-DPhkqxEb.js} +1 -1
  33. package/dist/gateway/static/root/assets/{index-DRrjYYzZ.js → index-CKSplmFw.js} +12 -12
  34. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bc3Quw42.js → keyboard-shortcuts-settings-BN3p-1wI.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-app-workbench-page-Copi3sdP.js → local-app-workbench-page-D7FmunJF.js} +1 -1
  36. package/dist/gateway/static/root/assets/{local-apps-page-CP9X_vtz.js → local-apps-page-C7H807zd.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-DMKq6e29.js → logs-page-vrjf-JTk.js} +1 -1
  38. package/dist/gateway/static/root/assets/{management-settings-CJmcaVje.js → management-settings-CTIaHfgU.js} +1 -1
  39. package/dist/gateway/static/root/assets/{markdown-split-AcuFp0TH.js → markdown-split-C0iKadAm.js} +1 -1
  40. package/dist/gateway/static/root/assets/{media-plugins-BvFgsiJL.js → media-plugins-DcM72GSJ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-IW7IQ9nJ.js → notes-page-By_EzRhP.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-Zb8U0anO.js → notes-workbench-Cp1ierS_.js} +2 -2
  43. package/dist/gateway/static/root/assets/{preview-open-alternatives-C-b34dgQ.js → preview-open-alternatives-CpblfmWk.js} +1 -1
  44. package/dist/gateway/static/root/assets/{product-open-page-CWEzLykF.js → product-open-page-dQ2_5PLu.js} +1 -1
  45. package/dist/gateway/static/root/assets/{project-detail-page-BuIbLnan.js → project-detail-page-Cp_jfZJj.js} +1 -1
  46. package/dist/gateway/static/root/assets/{projects-page-BwUfRqNV.js → projects-page-DYbmweGw.js} +1 -1
  47. package/dist/gateway/static/root/assets/{remote-access-hub-BTaXxcEi.js → remote-access-hub-U2qXVyLH.js} +1 -1
  48. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DAohEZrX.js → runtime-tools-settings-panel-DiPj9FLN.js} +1 -1
  49. package/dist/gateway/static/root/assets/{schema-form-C_OBW8A5.js → schema-form-BDLYItBP.js} +1 -1
  50. package/dist/gateway/static/root/assets/{sessions-page-BnHoTCD3.js → sessions-page-CtNKNhCi.js} +1 -1
  51. package/dist/gateway/static/root/assets/settings-advanced-gate-B6IMzhWo.js +1 -0
  52. package/dist/gateway/static/root/assets/{settings-form-section-C7w2WS-A.js → settings-form-section-Dr4Uf_CY.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-loading-skeleton-zwibve4m.js → settings-loading-skeleton-Bqi7tsXj.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-page-B9W03dSW.js → settings-page-BbookgxJ.js} +1 -1
  55. package/dist/gateway/static/root/assets/{setup-status-panel-C8Hec2Af.js → setup-status-panel-mUu0iDlD.js} +1 -1
  56. package/dist/gateway/static/root/assets/{share-preview-page-6e3ks2be.js → share-preview-page-1M79esSO.js} +1 -1
  57. package/dist/gateway/static/root/assets/{shares-settings-Bwc5HfLI.js → shares-settings-DadcMA8y.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skill-reload-api-D7kunhqy.js → skill-reload-api-C3ZzYCz0.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page-WgkaNzpc.js → skills-page-B3kqZ-ke.js} +1 -1
  60. package/dist/gateway/static/root/assets/{skills-page.utils-D9QT5cxj.js → skills-page.utils-b9byH-KL.js} +1 -1
  61. package/dist/gateway/static/root/assets/{system-settings-panel-c1HVtv1Y.js → system-settings-panel-CL_AXjw1.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-detail-page-CjP-6WVU.js → task-detail-page-Bnjpkl4v.js} +1 -1
  63. package/dist/gateway/static/root/assets/{use-autosave-D6UkH_Ga.js → use-autosave-CUI3q_I-.js} +1 -1
  64. package/dist/gateway/static/root/assets/{user-context-page-D8ZhPDNF.js → user-context-page-CBgAAZiB.js} +1 -1
  65. package/dist/gateway/static/root/assets/{voice-api-key-field-BOxkKbGh.js → voice-api-key-field-DLXOB1jw.js} +1 -1
  66. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dd19yK9t.js → work-discovery-overlay-BvlvyVJX.js} +1 -1
  67. package/dist/gateway/static/root/assets/{work-discovery-page-DUkdJl1e.js → work-discovery-page-BBpnnnrs.js} +1 -1
  68. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ZA3bP65I.js → workflow-run-setup-panel-DKpUxB-i.js} +1 -1
  69. package/dist/gateway/static/root/assets/{workflows-page-C2b5W5bw.js → workflows-page-Dd_9p9ji.js} +1 -1
  70. package/dist/gateway/static/root/index.html +1 -1
  71. package/dist/package.js +1 -1
  72. package/dist/src/agent/agent-manager.js +1 -1
  73. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  74. package/dist/src/agent-runtime/index.js +1 -1
  75. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  76. package/dist/src/gateway/heartbeat/service.js +1 -1
  77. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  78. package/dist/src/gateway/hono/oauth-async.js +14 -2
  79. package/dist/src/gateway/service.js +5 -5
  80. package/dist/src/heartbeat/index.js +1 -1
  81. package/package.json +3 -3
  82. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-C1Qktr1g.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DRrjYYzZ.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/working-directory-picker-modal-BcyiDXU3.js","assets/loader-circle-CifKLtgG.js","assets/locale-store-CnamlR07.js","assets/messages-D7kOD_o_.js","assets/cn-JdwAhgNB.js","assets/button-CSEbl4zT.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/middleware-Pd0e8Igk.js","assets/schemas-zIBW3wiV.js","assets/product-delivery-tRr-7IxY.js","assets/tool-activity-R8V9l6nk.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-Cv2ywpdb.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-undf-k5g.js","assets/activity-store-DOhnAQOQ.js","assets/theme-store-BDyUTObE.js","assets/index-Bp8I_eX4.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-D7kOD_o_.js";import{l as f,n as p}from"./locale-store-CnamlR07.js";import{i as m}from"./theme-store-BDyUTObE.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{r as C}from"./settings-form-draft-Dy10ldo8.js";import{$l as w,$t as T,Dc as E,Ia as D,Ic as O,Js as k,Ks as A,Ls as j,Mc as M,Ms as N,Ns as P,Pc as F,Qs as I,Rl as L,Sc as R,Ss as z,Tl as B,Ul as V,Wa as ee,Ws as te,Xl as ne,Xs as H,Yl as U,Yo as W,Ys as re,Zc as G,_r as ie,an as ae,br as K,c as oe,cc as se,cn as ce,cs as le,dl as ue,dn as de,dr as fe,ds as pe,ec as q,en as me,fc as he,fn as J,fr as ge,gn as _e,gr as ve,gs as ye,hn as be,hr as xe,in as Se,jc as Ce,l as we,ln as Te,ls as Y,ml as Ee,mn as De,mr as Oe,nn as ke,o as Ae,on as je,pn as Me,pr as Ne,ql as Pe,rl as X,rn as Fe,s as Ie,sn as Le,tl as Re,tn as ze,u as Be,un as Ve,us as He,vn as Ue,vr as We,xr as Ge,xs as Ke,yn as qe,yr as Je,ys as Ye}from"./index-DRrjYYzZ.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:c},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||o(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(h,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=l(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=g):g=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,$.jsx)(b,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(W,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:w})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=E);let D;t[12]!==T||t[13]!==E||t[14]!==C?(D=(0,$.jsxs)(v,{children:[m,(0,$.jsxs)(y,{className:g,"aria-describedby":void 0,children:[C,T,E]})]}),t[12]=T,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==f?(O=(0,$.jsx)(x,{open:f,onOpenChange:p,children:D}),t[16]=D,t[17]=f,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(Xe.Provider,{value:d,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ge(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=l(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(F,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>o(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=l(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==c||t[13]!==d?(f=(0,$.jsx)(qe,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=c,t[13]=d,t[14]=f):f=t[14],f}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:u,duration:d,noteId:f,attachmentId:p}=K(),m=K(dt),h=f===n&&p===r,g=h&&o,_=h&&s,v=h?u:0,y=h&&d>0?d:i??0,b=y>0?Math.min(v/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==m?(x=e=>{e.stopPropagation(),m(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=m,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==m?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),m(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=m,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=l(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=l(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=g?`Pause`:`Play`,k;t[14]!==_||t[15]!==g?(k=_?(0,$.jsx)(c,{className:`size-3.5 animate-spin`}):g?(0,$.jsx)(I,{className:`size-3.5`}):(0,$.jsx)(A,{className:`size-3.5 ml-0.5`}),t[14]=_,t[15]=g,t[16]=k):k=t[16];let j;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(j=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=j):j=t[22];let M=`${b}%`,N;t[23]===M?N=t[24]:(N=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:M}})}),t[23]=M,t[24]=N);let P;t[25]!==y||t[26]!==h||t[27]!==v?(P=ct(h&&v>0?v:y),t[25]=y,t[26]=h,t[27]=v,t[28]=P):P=t[28];let F;t[29]===P?F=t[30]:(F=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:P}),t[29]=P,t[30]=F);let L;t[31]!==N||t[32]!==F?(L=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[N,F]}),t[31]=N,t[32]=F,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==T||t[36]!==j?(R=(0,$.jsxs)(`div`,{className:T,onClick:ut,children:[j,L]}),t[34]=L,t[35]=T,t[36]=j,t[37]=R):R=t[37],R}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(83),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==c||t[1]!==n?(f=ft(n,c),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(_t),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=at(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-panel hover:bg-surface-panel`:`bg-transparent hover:bg-surface-panel/70`,x;t[11]===b?x=t[12]:(x=l(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]===d?C=t[14]:(C=d?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=C);let w;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(w=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=w):w=t[20];let T;t[21]===n.title?T=t[22]:(T=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=l(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==p||t[26]!==D?(O=(0,$.jsx)(`p`,{className:D,children:p}),t[25]=p,t[26]=D,t[27]=O):O=t[27];let A;t[28]!==T||t[29]!==O?(A=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,O]}),t[28]=T,t[29]=O,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(ve,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(X,{className:`size-4`})})}),t[31]=j):j=t[31];let M;t[32]!==n.id||t[33]!==n.pinned||t[34]!==a?(M=()=>a(n.id,!n.pinned),t[32]=n.id,t[33]=n.pinned,t[34]=a,t[35]=M):M=t[35];let N;t[36]===n.pinned?N=t[37]:(N=n.pinned?(0,$.jsx)(k,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),t[36]=n.pinned,t[37]=N);let P=n.pinned?c.unpin:c.pin,F;t[38]!==M||t[39]!==N||t[40]!==P?(F=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==n.id||t[43]!==o?(I=()=>o(n.id),t[42]=n.id,t[43]=o,t[44]=I):I=t[44];let L;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ne,{className:`size-4`}),t[45]=L):L=t[45];let R;t[46]!==c.archive||t[47]!==I?(R=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[46]=c.archive,t[47]=I,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),t[49]=z):z=t[49];let B;t[50]!==n.id||t[51]!==s?(B=()=>s(n.id),t[50]=n.id,t[51]=s,t[52]=B):B=t[52];let V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Y,{className:`size-4`}),t[53]=V):V=t[53];let ee;t[54]!==c.delete||t[55]!==B?(ee=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[V,c.delete]}),t[54]=c.delete,t[55]=B,t[56]=ee):ee=t[56];let te;t[57]!==F||t[58]!==R||t[59]!==ee?(te=(0,$.jsxs)(Oe,{children:[j,(0,$.jsx)(Ne,{children:(0,$.jsxs)(fe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[F,R,z,ee]})})]}),t[57]=F,t[58]=R,t[59]=ee,t[60]=te):te=t[60];let H;t[61]!==w||t[62]!==A||t[63]!==te?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[w,A,te]}),t[61]=w,t[62]=A,t[63]=te,t[64]=H):H=t[64];let U;t[65]===n.pinned?U=t[66]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(re,{className:`size-3`})}),t[65]=n.pinned,t[66]=U);let W;t[67]===n.tags?W=t[68]:(W=n.tags?.slice(0,2).map(mt),t[67]=n.tags,t[68]=W);let G;t[69]===_?G=t[70]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[69]=_,t[70]=G);let ie;t[71]!==U||t[72]!==W||t[73]!==G?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,W,G]}),t[71]=U,t[72]=W,t[73]=G,t[74]=ie):ie=t[74];let ae;return t[75]!==H||t[76]!==ie||t[77]!==v||t[78]!==y||t[79]!==x||t[80]!==S||t[81]!==C?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[C,H,ie]}),t[75]=H,t[76]=ie,t[77]=v,t[78]=y,t[79]=x,t[80]=S,t[81]=C,t[82]=ae):ae=t[82],ae}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,f=c===void 0?`card`:c,m=p(xt),h=d(m).automations.suggestions,g=d(m).automations,_=a(),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=v):v=t[0];let{data:y}=S(o?`automation-suggestion-coverage`:null,bt,v),b=o?y?.automations.find(e=>we(e,o)):void 0,x=b?Ie(b,g):[];if(f===`titleAction`){if(b){let e;t[1]===s?e=t[2]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(B,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===_?r=t[5]:(r=()=>_(`/automations`),t[4]=_,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:h.coveredTitle}),(0,$.jsx)(u,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:h.manage})]})}let e;t[6]===s?e=t[7]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(R,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==_||t[13]!==i?(c=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=_,t[13]=i,t[14]=c):c=t[14];let d;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[15]=d):d=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(u,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[d,h.create]})]})}if(b){let e;t[16]===s?e=t[17]:(e=l(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===_?r=t[20]:(r=()=>_(`/automations`),t[19]=_,t[20]=r);let i;return t[21]!==h||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(u,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:h.manage})}),t[21]=h,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:h.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:oe(h.coveredDescription,{name:b.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:g.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:x.map(yt)})]}),i]})}let C;t[24]===s?C=t[25]:(C=l(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=w):w=t[26];let T;t[27]===n?T=t[28]:(T=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=T);let E;t[29]===r?E=t[30]:(E=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=E);let D;t[31]!==T||t[32]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[w,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,E]})]}),t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==_||t[35]!==i?(O=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=_,t[35]=i,t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[37]=k):k=t[37];let A;t[38]!==h.create||t[39]!==O?(A=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(u,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:O,children:[k,h.create]})}),t[38]=h.create,t[39]=O,t[40]=A):A=t[40];let j;return t[41]!==A||t[42]!==C||t[43]!==D?(j=(0,$.jsxs)(`section`,{className:C,children:[D,A]}),t[41]=A,t[42]=C,t[43]=D,t[44]=j):j=t[44],j}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return Be.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(35),{noteId:n}=e,r=p(Dt),i;t[0]===r?i=t[1]:(i=d(r),t[0]=r,t[1]=i);let a=i.notes.discussionCapture,o,s;t[2]===n?(o=t[3],s=t[4]):(o=[`note-discussion-document`,n],s=()=>T(n),t[2]=n,t[3]=o,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={revalidateOnFocus:!1},t[5]=c):c=t[5];let{data:l,mutate:u}=S(o,s,c),f,m;if(t[6]===u?(f=t[7],m=t[8]):(f=()=>{let e=e=>{let t=e.detail;t&&u(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Et);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void u();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},m=[u],t[6]=u,t[7]=f,t[8]=m),(0,Q.useEffect)(f,m),!l)return null;let{discussion:h,transcript:g}=l,_=l.organization?.organization,v=[`stopping`,`sealing`,`organizing`].includes(h.status),y;t[9]!==a.actionItems||t[10]!==a.decisions||t[11]!==a.openQuestions||t[12]!==a.organization||t[13]!==a.risks||t[14]!==_?(y=_?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),a.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:_.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2`,children:[_.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.decisions}),(0,$.jsx)(St,{values:_.decisions})]}):null,_.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.actionItems}),(0,$.jsx)(St,{values:_.actionItems.map(Tt)})]}):null,_.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.risks}),(0,$.jsx)(St,{values:_.risks})]}):null,_.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.openQuestions}),(0,$.jsx)(St,{values:_.openQuestions})]}):null]})]}):null,t[9]=a.actionItems,t[10]=a.decisions,t[11]=a.openQuestions,t[12]=a.organization,t[13]=a.risks,t[14]=_,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[16]=b):b=t[16];let x=h.status===`recording`?a.draftTranscript:a.fullTranscript,C;t[17]===x?C=t[18]:(C=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[17]=x,t[18]=C);let w;t[19]===h.status?w=t[20]:(w=h.status===`needs_attention`?(0,$.jsx)(le,{className:`size-3.5 text-danger`}):h.status===`completed`?(0,$.jsx)(B,{className:`size-3.5 text-success`}):null,t[19]=h.status,t[20]=w);let E=v?a.finalizing:h.status===`needs_attention`?h.failureMessage:null,D;t[21]!==w||t[22]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==C||t[25]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,D]}),t[24]=C,t[25]=D,t[26]=O):O=t[26];let k=g.text||a.waitingTranscript,A;t[27]===k?A=t[28]:(A=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:k}),t[27]=k,t[28]=A);let j;t[29]!==O||t[30]!==A?(j=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[O,A]}),t[29]=O,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==j||t[33]!==y?(M=(0,$.jsxs)(`div`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle`,children:[y,j]}),t[32]=j,t[33]=y,t[34]=M):M=t[34],M}function Tt(e){return e.title}function Et(e,t){return e.sequence-t.sequence}function Dt(e){return e.language}var Ot={edit:H,ai_edit:z,sync:j,restore:U};function kt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function At({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(p(e=>e.language)).notes,o=a,{data:s}=S(e?[`note-history`,e]:null,()=>je(e)),[c,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),_=(0,Q.useCallback)(async t=>{u(!0),g(null);try{await be(e,t),m(null),i()}catch{g(a.restoreFailed)}finally{u(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),v=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(W,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[h?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:h}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Ot[e.trigger]??H,i=t===e.timestamp,s=f===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:l(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:kt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,v,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function jt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:u,onOpenChat:f,onOpenNewChat:m}=e,h=d(p(Rt)).notes,g=a(),_=r?.aiDeep?.catalysis,v=_?.report??null,y;t[0]===n?y=t[1]:(y=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=y);let b;t[2]===n?b=t[3]:(b=()=>Se(n),t[2]=n,t[3]=b);let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[4]=x):x=t[4];let{data:C,mutate:w,isLoading:T}=S(y,b,x),E;t[5]===n?E=t[6]:(E=async e=>{try{await De(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Pe,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=k):k=t[8];let A;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(he,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=A):A=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:h.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":h.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:k})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:h.catalysisSectionDescription}),C?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Me(n),{revalidate:!1}),disabled:T,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:h.contextRebuild}),(0,$.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:h.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(Lt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?h.processing:v?h.recatalyze:h.catalyzeAction}),v?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:v.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.targetUsers.slice(0,5).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.keyQuestions.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.mvpPath.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.risks.slice(0,3).map(Nt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.nextActions.slice(0,4).map(Mt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h.confidenceLabel.replace(`{{percent}}`,String(Math.round(v.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackHelpfulAria,children:(0,$.jsx)(He,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackNotHelpfulAria,children:(0,$.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:h.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[A,h.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:f,disabled:u,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:u?h.openingChat:h.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:u,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:h.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>g(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||h.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:h.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:h.noThreads})]})]})]})}function Mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Pt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Lt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Rt(e){return e.language}var zt=()=>i(()=>import(`./block-editor-C1Qktr1g.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),Bt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([42,1,3,39,5,43])),Vt=(0,Q.lazy)(()=>zt().then(e=>({default:e.BlockEditor}))),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.MarkdownEditor})));function Ut(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Wt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:G},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ue},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Re},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let u=c,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},onFocus:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},className:l(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Gt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,f=a===void 0?!0:a,m=s===void 0?!0:s,h=l===void 0?!1:l,g=p(Kt),_;t[0]===g?_=t[1]:(_=d(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==f?(y=(0,$.jsx)(qt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:h,onAutoFocusConsumed:u}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=f,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)($e,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Kt(e){return e.language}function qt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:u}){let f=p(e=>e.language),h=d(f).notes,g=d(f).automations.suggestions,_=a(),v=m(e=>e.resolved)===`dark`,{openImage:y}=Ze(),[b,x]=(0,Q.useState)(`wysiwyg`),[C,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(360),[I,L]=(0,Q.useState)(!1),[R,B]=(0,Q.useState)(!1),[V,te]=(0,Q.useState)(!1),[ne,H]=(0,Q.useState)(null),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),re=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=ee(e=>e.setPageHeader),pe=ee(e=>e.clearPageHeader),{data:q,mutate:J}=S(e?[`note-detail`,e]:null,()=>Fe(e)),{data:ge=[],mutate:ve}=S(e?[`note-threads`,e]:null,()=>Le(e),{revalidateOnFocus:!1}),ye=E!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{U.current=!1,M(``),D(null),T(null),W.current=!1,de.current=null},[e]),(0,Q.useEffect)(()=>{!q||U.current||(M(q.title??``),U.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||ye||de.current===e)return;let t=window.requestAnimationFrame(()=>{ue.current?.focus(),u?.()});return de.current=e,()=>window.cancelAnimationFrame(t)},[c,ye,q,e,u]);let be=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,xe=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,w,i),children:(0,$.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Se=(0,Q.useCallback)(t=>{M(t),e&&(oe.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=oe.current;if(oe.current=null,t!==null){A(!0);try{await _e(e,{title:t}),await J(),n?.()}catch{}finally{A(!1)}}},600))},[e,J,n]),Ce=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:l(`flex min-w-0 items-center gap-2`,w),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:j||be||void 0,children:j||be}),k?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,k,be,j]),we=(0,Q.useCallback)(async(t=!1)=>{te(!0),H(null);try{let n=await Te(e,{forceNew:t});await J(),await ve(),_(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{te(!1)}},[J,ve,_,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),Y=(0,Q.useCallback)(async()=>{B(!0),H(null);try{await me(e),await J()}catch(e){H(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{B(!1)}},[J,e]),Ee=(0,Q.useCallback)(()=>{T(C===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!R&&Y()},[C,R,Y,q?.aiDeep?.catalysis?.report]),De=(0,Q.useCallback)(()=>{let t=E?.markdown??K.current??q?.markdown??``,n=E?.title??j,r=We([n,t].filter(Boolean).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-nYiJQItv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CKSplmFw.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/working-directory-picker-modal-BcyiDXU3.js","assets/loader-circle-CifKLtgG.js","assets/locale-store-CnamlR07.js","assets/messages-D7kOD_o_.js","assets/cn-JdwAhgNB.js","assets/button-CSEbl4zT.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/middleware-Pd0e8Igk.js","assets/schemas-zIBW3wiV.js","assets/product-delivery-tRr-7IxY.js","assets/tool-activity-R8V9l6nk.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-Cv2ywpdb.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-undf-k5g.js","assets/activity-store-DOhnAQOQ.js","assets/theme-store-BDyUTObE.js","assets/index-Bp8I_eX4.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-D7kOD_o_.js";import{l as f,n as p}from"./locale-store-CnamlR07.js";import{i as m}from"./theme-store-BDyUTObE.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{r as C}from"./settings-form-draft-Dy10ldo8.js";import{$l as w,$t as T,Dc as E,Ia as D,Ic as O,Js as k,Ks as A,Ls as j,Mc as M,Ms as N,Ns as P,Pc as F,Qs as I,Rl as L,Sc as R,Ss as z,Tl as B,Ul as V,Wa as ee,Ws as te,Xl as ne,Xs as H,Yl as U,Yo as W,Ys as re,Zc as G,_r as ie,an as ae,br as K,c as oe,cc as se,cn as ce,cs as le,dl as ue,dn as de,dr as fe,ds as pe,ec as q,en as me,fc as he,fn as J,fr as ge,gn as _e,gr as ve,gs as ye,hn as be,hr as xe,in as Se,jc as Ce,l as we,ln as Te,ls as Y,ml as Ee,mn as De,mr as Oe,nn as ke,o as Ae,on as je,pn as Me,pr as Ne,ql as Pe,rl as X,rn as Fe,s as Ie,sn as Le,tl as Re,tn as ze,u as Be,un as Ve,us as He,vn as Ue,vr as We,xr as Ge,xs as Ke,yn as qe,yr as Je,ys as Ye}from"./index-CKSplmFw.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:c},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||o(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(h,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=l(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=g):g=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,$.jsx)(b,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(W,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:w})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=E);let D;t[12]!==T||t[13]!==E||t[14]!==C?(D=(0,$.jsxs)(v,{children:[m,(0,$.jsxs)(y,{className:g,"aria-describedby":void 0,children:[C,T,E]})]}),t[12]=T,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==f?(O=(0,$.jsx)(x,{open:f,onOpenChange:p,children:D}),t[16]=D,t[17]=f,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(Xe.Provider,{value:d,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ge(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=l(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(F,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>o(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=l(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==c||t[13]!==d?(f=(0,$.jsx)(qe,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=c,t[13]=d,t[14]=f):f=t[14],f}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:u,duration:d,noteId:f,attachmentId:p}=K(),m=K(dt),h=f===n&&p===r,g=h&&o,_=h&&s,v=h?u:0,y=h&&d>0?d:i??0,b=y>0?Math.min(v/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==m?(x=e=>{e.stopPropagation(),m(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=m,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==m?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),m(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=m,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=l(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=l(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=g?`Pause`:`Play`,k;t[14]!==_||t[15]!==g?(k=_?(0,$.jsx)(c,{className:`size-3.5 animate-spin`}):g?(0,$.jsx)(I,{className:`size-3.5`}):(0,$.jsx)(A,{className:`size-3.5 ml-0.5`}),t[14]=_,t[15]=g,t[16]=k):k=t[16];let j;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(j=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=j):j=t[22];let M=`${b}%`,N;t[23]===M?N=t[24]:(N=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:M}})}),t[23]=M,t[24]=N);let P;t[25]!==y||t[26]!==h||t[27]!==v?(P=ct(h&&v>0?v:y),t[25]=y,t[26]=h,t[27]=v,t[28]=P):P=t[28];let F;t[29]===P?F=t[30]:(F=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:P}),t[29]=P,t[30]=F);let L;t[31]!==N||t[32]!==F?(L=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[N,F]}),t[31]=N,t[32]=F,t[33]=L):L=t[33];let R;return t[34]!==L||t[35]!==T||t[36]!==j?(R=(0,$.jsxs)(`div`,{className:T,onClick:ut,children:[j,L]}),t[34]=L,t[35]=T,t[36]=j,t[37]=R):R=t[37],R}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(83),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==c||t[1]!==n?(f=ft(n,c),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(_t),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=at(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-panel hover:bg-surface-panel`:`bg-transparent hover:bg-surface-panel/70`,x;t[11]===b?x=t[12]:(x=l(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]===d?C=t[14]:(C=d?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=C);let w;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(w=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=w):w=t[20];let T;t[21]===n.title?T=t[22]:(T=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=l(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==p||t[26]!==D?(O=(0,$.jsx)(`p`,{className:D,children:p}),t[25]=p,t[26]=D,t[27]=O):O=t[27];let A;t[28]!==T||t[29]!==O?(A=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,O]}),t[28]=T,t[29]=O,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(ve,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(X,{className:`size-4`})})}),t[31]=j):j=t[31];let M;t[32]!==n.id||t[33]!==n.pinned||t[34]!==a?(M=()=>a(n.id,!n.pinned),t[32]=n.id,t[33]=n.pinned,t[34]=a,t[35]=M):M=t[35];let N;t[36]===n.pinned?N=t[37]:(N=n.pinned?(0,$.jsx)(k,{className:`size-4`}):(0,$.jsx)(re,{className:`size-4`}),t[36]=n.pinned,t[37]=N);let P=n.pinned?c.unpin:c.pin,F;t[38]!==M||t[39]!==N||t[40]!==P?(F=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==n.id||t[43]!==o?(I=()=>o(n.id),t[42]=n.id,t[43]=o,t[44]=I):I=t[44];let L;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ne,{className:`size-4`}),t[45]=L):L=t[45];let R;t[46]!==c.archive||t[47]!==I?(R=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[46]=c.archive,t[47]=I,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(xe,{className:`my-1 h-px bg-edge-subtle`}),t[49]=z):z=t[49];let B;t[50]!==n.id||t[51]!==s?(B=()=>s(n.id),t[50]=n.id,t[51]=s,t[52]=B):B=t[52];let V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Y,{className:`size-4`}),t[53]=V):V=t[53];let ee;t[54]!==c.delete||t[55]!==B?(ee=(0,$.jsxs)(ge,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[V,c.delete]}),t[54]=c.delete,t[55]=B,t[56]=ee):ee=t[56];let te;t[57]!==F||t[58]!==R||t[59]!==ee?(te=(0,$.jsxs)(Oe,{children:[j,(0,$.jsx)(Ne,{children:(0,$.jsxs)(fe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[F,R,z,ee]})})]}),t[57]=F,t[58]=R,t[59]=ee,t[60]=te):te=t[60];let H;t[61]!==w||t[62]!==A||t[63]!==te?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[w,A,te]}),t[61]=w,t[62]=A,t[63]=te,t[64]=H):H=t[64];let U;t[65]===n.pinned?U=t[66]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(re,{className:`size-3`})}),t[65]=n.pinned,t[66]=U);let W;t[67]===n.tags?W=t[68]:(W=n.tags?.slice(0,2).map(mt),t[67]=n.tags,t[68]=W);let G;t[69]===_?G=t[70]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[69]=_,t[70]=G);let ie;t[71]!==U||t[72]!==W||t[73]!==G?(ie=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,W,G]}),t[71]=U,t[72]=W,t[73]=G,t[74]=ie):ie=t[74];let ae;return t[75]!==H||t[76]!==ie||t[77]!==v||t[78]!==y||t[79]!==x||t[80]!==S||t[81]!==C?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[C,H,ie]}),t[75]=H,t[76]=ie,t[77]=v,t[78]=y,t[79]=x,t[80]=S,t[81]=C,t[82]=ae):ae=t[82],ae}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,f=c===void 0?`card`:c,m=p(xt),h=d(m).automations.suggestions,g=d(m).automations,_=a(),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=v):v=t[0];let{data:y}=S(o?`automation-suggestion-coverage`:null,bt,v),b=o?y?.automations.find(e=>we(e,o)):void 0,x=b?Ie(b,g):[];if(f===`titleAction`){if(b){let e;t[1]===s?e=t[2]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(B,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===_?r=t[5]:(r=()=>_(`/automations`),t[4]=_,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:h.coveredTitle}),(0,$.jsx)(u,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:h.manage})]})}let e;t[6]===s?e=t[7]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(R,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==_||t[13]!==i?(c=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=_,t[13]=i,t[14]=c):c=t[14];let d;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[15]=d):d=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(u,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[d,h.create]})]})}if(b){let e;t[16]===s?e=t[17]:(e=l(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===_?r=t[20]:(r=()=>_(`/automations`),t[19]=_,t[20]=r);let i;return t[21]!==h||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(u,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:h.manage})}),t[21]=h,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:h.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:oe(h.coveredDescription,{name:b.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:g.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:x.map(yt)})]}),i]})}let C;t[24]===s?C=t[25]:(C=l(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=w):w=t[26];let T;t[27]===n?T=t[28]:(T=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=T);let E;t[29]===r?E=t[30]:(E=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=E);let D;t[31]!==T||t[32]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[w,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,E]})]}),t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==_||t[35]!==i?(O=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=_,t[35]=i,t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t[37]=k):k=t[37];let A;t[38]!==h.create||t[39]!==O?(A=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(u,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:O,children:[k,h.create]})}),t[38]=h.create,t[39]=O,t[40]=A):A=t[40];let j;return t[41]!==A||t[42]!==C||t[43]!==D?(j=(0,$.jsxs)(`section`,{className:C,children:[D,A]}),t[41]=A,t[42]=C,t[43]=D,t[44]=j):j=t[44],j}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return Be.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(35),{noteId:n}=e,r=p(Dt),i;t[0]===r?i=t[1]:(i=d(r),t[0]=r,t[1]=i);let a=i.notes.discussionCapture,o,s;t[2]===n?(o=t[3],s=t[4]):(o=[`note-discussion-document`,n],s=()=>T(n),t[2]=n,t[3]=o,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={revalidateOnFocus:!1},t[5]=c):c=t[5];let{data:l,mutate:u}=S(o,s,c),f,m;if(t[6]===u?(f=t[7],m=t[8]):(f=()=>{let e=e=>{let t=e.detail;t&&u(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Et);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void u();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},m=[u],t[6]=u,t[7]=f,t[8]=m),(0,Q.useEffect)(f,m),!l)return null;let{discussion:h,transcript:g}=l,_=l.organization?.organization,v=[`stopping`,`sealing`,`organizing`].includes(h.status),y;t[9]!==a.actionItems||t[10]!==a.decisions||t[11]!==a.openQuestions||t[12]!==a.organization||t[13]!==a.risks||t[14]!==_?(y=_?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),a.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:_.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2`,children:[_.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.decisions}),(0,$.jsx)(St,{values:_.decisions})]}):null,_.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.actionItems}),(0,$.jsx)(St,{values:_.actionItems.map(Tt)})]}):null,_.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.risks}),(0,$.jsx)(St,{values:_.risks})]}):null,_.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.openQuestions}),(0,$.jsx)(St,{values:_.openQuestions})]}):null]})]}):null,t[9]=a.actionItems,t[10]=a.decisions,t[11]=a.openQuestions,t[12]=a.organization,t[13]=a.risks,t[14]=_,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[16]=b):b=t[16];let x=h.status===`recording`?a.draftTranscript:a.fullTranscript,C;t[17]===x?C=t[18]:(C=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[17]=x,t[18]=C);let w;t[19]===h.status?w=t[20]:(w=h.status===`needs_attention`?(0,$.jsx)(le,{className:`size-3.5 text-danger`}):h.status===`completed`?(0,$.jsx)(B,{className:`size-3.5 text-success`}):null,t[19]=h.status,t[20]=w);let E=v?a.finalizing:h.status===`needs_attention`?h.failureMessage:null,D;t[21]!==w||t[22]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let O;t[24]!==C||t[25]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,D]}),t[24]=C,t[25]=D,t[26]=O):O=t[26];let k=g.text||a.waitingTranscript,A;t[27]===k?A=t[28]:(A=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:k}),t[27]=k,t[28]=A);let j;t[29]!==O||t[30]!==A?(j=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[O,A]}),t[29]=O,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==j||t[33]!==y?(M=(0,$.jsxs)(`div`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle`,children:[y,j]}),t[32]=j,t[33]=y,t[34]=M):M=t[34],M}function Tt(e){return e.title}function Et(e,t){return e.sequence-t.sequence}function Dt(e){return e.language}var Ot={edit:H,ai_edit:z,sync:j,restore:U};function kt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function At({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(p(e=>e.language)).notes,o=a,{data:s}=S(e?[`note-history`,e]:null,()=>je(e)),[c,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),_=(0,Q.useCallback)(async t=>{u(!0),g(null);try{await be(e,t),m(null),i()}catch{g(a.restoreFailed)}finally{u(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),v=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(W,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[h?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:h}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Ot[e.trigger]??H,i=t===e.timestamp,s=f===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:l(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:kt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,v,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function jt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:u,onOpenChat:f,onOpenNewChat:m}=e,h=d(p(Rt)).notes,g=a(),_=r?.aiDeep?.catalysis,v=_?.report??null,y;t[0]===n?y=t[1]:(y=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=y);let b;t[2]===n?b=t[3]:(b=()=>Se(n),t[2]=n,t[3]=b);let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[4]=x):x=t[4];let{data:C,mutate:w,isLoading:T}=S(y,b,x),E;t[5]===n?E=t[6]:(E=async e=>{try{await De(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Pe,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=k):k=t[8];let A;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(he,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=A):A=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:h.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":h.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:k})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:h.catalysisSectionDescription}),C?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Me(n),{revalidate:!1}),disabled:T,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:h.contextRebuild}),(0,$.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:h.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(Lt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?h.processing:v?h.recatalyze:h.catalyzeAction}),v?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:v.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.targetUsers.slice(0,5).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.keyQuestions.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.mvpPath.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.risks.slice(0,3).map(Nt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.nextActions.slice(0,4).map(Mt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h.confidenceLabel.replace(`{{percent}}`,String(Math.round(v.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackHelpfulAria,children:(0,$.jsx)(He,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackNotHelpfulAria,children:(0,$.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:h.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[A,h.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:f,disabled:u,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:u?h.openingChat:h.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:u,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:h.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>g(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||h.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:h.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:h.noThreads})]})]})]})}function Mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Pt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Lt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Rt(e){return e.language}var zt=()=>i(()=>import(`./block-editor-nYiJQItv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),Bt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([42,1,3,39,5,43])),Vt=(0,Q.lazy)(()=>zt().then(e=>({default:e.BlockEditor}))),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.MarkdownEditor})));function Ut(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Wt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:G},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ue},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Re},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let u=c,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},onFocus:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},className:l(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Gt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,f=a===void 0?!0:a,m=s===void 0?!0:s,h=l===void 0?!1:l,g=p(Kt),_;t[0]===g?_=t[1]:(_=d(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==f?(y=(0,$.jsx)(qt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:h,onAutoFocusConsumed:u}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=f,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)($e,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Kt(e){return e.language}function qt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:u}){let f=p(e=>e.language),h=d(f).notes,g=d(f).automations.suggestions,_=a(),v=m(e=>e.resolved)===`dark`,{openImage:y}=Ze(),[b,x]=(0,Q.useState)(`wysiwyg`),[C,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(360),[I,L]=(0,Q.useState)(!1),[R,B]=(0,Q.useState)(!1),[V,te]=(0,Q.useState)(!1),[ne,H]=(0,Q.useState)(null),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),re=(0,Q.useRef)(null),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=ee(e=>e.setPageHeader),pe=ee(e=>e.clearPageHeader),{data:q,mutate:J}=S(e?[`note-detail`,e]:null,()=>Fe(e)),{data:ge=[],mutate:ve}=S(e?[`note-threads`,e]:null,()=>Le(e),{revalidateOnFocus:!1}),ye=E!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{U.current=!1,M(``),D(null),T(null),W.current=!1,de.current=null},[e]),(0,Q.useEffect)(()=>{!q||U.current||(M(q.title??``),U.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||ye||de.current===e)return;let t=window.requestAnimationFrame(()=>{ue.current?.focus(),u?.()});return de.current=e,()=>window.cancelAnimationFrame(t)},[c,ye,q,e,u]);let be=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,xe=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,w,i),children:(0,$.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Se=(0,Q.useCallback)(t=>{M(t),e&&(oe.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=oe.current;if(oe.current=null,t!==null){A(!0);try{await _e(e,{title:t}),await J(),n?.()}catch{}finally{A(!1)}}},600))},[e,J,n]),Ce=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:l(`flex min-w-0 items-center gap-2`,w),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:j||be||void 0,children:j||be}),k?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,k,be,j]),we=(0,Q.useCallback)(async(t=!1)=>{te(!0),H(null);try{let n=await Te(e,{forceNew:t});await J(),await ve(),_(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){H(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{te(!1)}},[J,ve,_,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),Y=(0,Q.useCallback)(async()=>{B(!0),H(null);try{await me(e),await J()}catch(e){H(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{B(!1)}},[J,e]),Ee=(0,Q.useCallback)(()=>{T(C===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!R&&Y()},[C,R,Y,q?.aiDeep?.catalysis?.report]),De=(0,Q.useCallback)(()=>{let t=E?.markdown??K.current??q?.markdown??``,n=E?.title??j,r=We([n,t].filter(Boolean).join(`
3
3
 
4
4
  `));return{source:{type:`note`,id:e,title:n||h.titlePlaceholder},text:r,language:Je(r,f)}},[f,h.titlePlaceholder,q?.markdown,e,E,j]),Oe=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:l(`flex items-center gap-2`,w),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":h.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(ie,{input:De,labels:{read:h.readAloud,preparing:h.readAloudPreparing,pause:h.readAloudPause,resume:h.readAloudResume,retry:h.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ee,disabled:R,"aria-label":h.catalysisSectionTitle,className:l(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,C===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),R?h.catalyzing:h.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>we(!1),disabled:V,className:l(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),V?h.openingChat:h.openChatButton]}),(0,$.jsx)(Wt,{mode:b,onModeChange:x,labels:{edit:h.modeEdit,source:h.modeSource,preview:h.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(C===`history`?null:`history`),"aria-label":h.history,className:l(`rounded-lg p-1.5 transition-colors`,C===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0})})]}),[R,Ee,we,b,h.history,h.modeEdit,h.modePreview,h.modeSource,V,C,s,h.searchDialogTitle,h.readAloud,h.readAloudPause,h.readAloudPreparing,h.readAloudResume,h.readAloudRetry,De]);(0,Q.useLayoutEffect)(()=>(fe({startExtra:xe,main:q?Ce:null,end:q?Oe:null}),()=>{o&&pe()}),[o,pe,Oe,Ce,xe,q,fe]);let ke=(0,Q.useCallback)(t=>{e&&(K.current=t,re.current&&clearTimeout(re.current),re.current=setTimeout(async()=>{let t=K.current;if(K.current=null,t!==null){A(!0),H(null);try{await _e(e,{markdown:t}),await J(),n?.()}catch(e){H(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`)}finally{A(!1)}}},600))},[e,J,h.saveFailed,h.saveFailedHint,n]),je=(0,Q.useCallback)(t=>{ae(e,t.timestamp).then(e=>{e&&D(e)})},[e]),Me=(0,Q.useCallback)(()=>{T(null),D(null)},[]),Ne=(0,Q.useCallback)(()=>{T(null),D(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{re.current&&clearTimeout(re.current),G.current&&clearTimeout(G.current);let t=K.current,n=oe.current;K.current=null,oe.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&_e(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:h.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:h.back})]});let X=ye?E.title??``:j,Ie=ye?E.markdown??``:q.markdown??``,Re=new Date(q.createdAt).getTime(),ze=Number.isFinite(Re)&&Date.now()-Re<3600*1e3?(0,$.jsx)(vt,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ne?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ne}):null,(0,$.jsx)(Ae,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ae,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:se,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[(0,$.jsx)(wt,{noteId:e}),ye?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[X&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:X}),Ie?(0,$.jsx)(Ue,{noteId:e,content:Ie,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[b===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:ue,type:`text`,value:j,onChange:e=>Se(e.target.value),onCompositionStart:()=>{W.current=!0},onCompositionEnd:()=>{W.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!W.current&&!t.isComposing&&(e.preventDefault(),(se.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),ze]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Vt,{initialContent:q.markdown??``,onChange:ke,noteId:e},`wysiwyg-${e}`)})})]}),b===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:ue,type:`text`,value:j,onChange:e=>Se(e.target.value),placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),ze]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Ht,{initialContent:q.markdown??``,onChange:ke,isDark:v},`source-${e}`)})})]}),b===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&y(t.currentSrc||t.src,t.alt)},children:[j&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:j}),q.markdown?(0,$.jsx)(Ue,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]})]})]})]}),(0,$.jsx)(`div`,{ref:ce,className:l(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:C?N:0},children:(0,$.jsxs)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col`,style:{width:N},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),L(!0);let n=e.clientX,r=N,i=e.pointerId,a=0,o=N,s=N,c=()=>{a=0,s=o,C&&ce.current?.style.setProperty(`width`,`${s}px`),le.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}L(!1),F(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:l(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,I&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:C===`history`?(0,$.jsx)(At,{noteId:e,activeTimestamp:E?.timestamp??null,onSelect:je,onClose:Me,onRestored:Ne}):C===`breakdown`?(0,$.jsx)(jt,{noteId:e,note:q??null,catalyzing:R,onCatalyze:Y,onClose:()=>T(null),noteThreads:ge,openingChat:V,onOpenChat:()=>we(!1),onOpenNewChat:()=>we(!0)}):null})]})})]})}var Jt=3e4;function Yt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Xt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1,onDiscussionCapture:c,discussionCaptureLabel:u=`Record discussion`}){let[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(0),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),w=(0,Q.useRef)([]),T=(0,Q.useRef)(0),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useCallback)(()=>{E.current&&=(clearInterval(E.current),null),D.current&&=(clearTimeout(D.current),null),C.current?.getTracks().forEach(e=>e.stop()),C.current=null,S.current=null,w.current=[],g(!1),v(0)},[]);(0,Q.useEffect)(()=>()=>O(),[O]);let k=(0,Q.useCallback)(async()=>{let e=S.current;if(!e||e.state!==`recording`)return;b(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-T.current)/1e3)),n=e.mimeType||Yt()||`audio/webm`,r=new Blob(w.current,{type:n});if(O(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{b(!1)}return}b(!1)},[O,i]),A=(0,Q.useCallback)(async()=>{if(!(!i||y||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Yt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);C.current=e,S.current=n,w.current=[],T.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&w.current.push(e.data)},n.start(),g(!0),v(0),E.current=setInterval(()=>{v(Math.round((Date.now()-T.current)/1e3))},250),D.current=setTimeout(()=>{k()},Jt)}catch{O()}},[O,i,h,k,y]),j=(0,Q.useCallback)(()=>{if(h){k();return}A()},[h,A,k]),P=(0,Q.useCallback)(async e=>{let t=d.trim();if(!(!t||p)){m(!0),f(``);try{await n(t,e)}catch{f(t)}finally{m(!1),x.current?.focus()}}},[d,p,n]),F=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),P({navigate:!1}))},[P]),I=p||y;return(0,$.jsxs)(`div`,{className:l(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:I||o||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(M,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:j,disabled:I||s||p,className:l(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,$.jsx)(Ye,{className:`size-4 fill-current`}):(0,$.jsx)(se,{className:`size-4`})}),c&&!h?(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:I,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":u,title:u,children:(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0})}):null,h?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,$.jsx)(`textarea`,{ref:x,value:d,onChange:e=>f(e.target.value),onKeyDown:F,placeholder:e,rows:1,disabled:I,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!d.trim()||I||h,onClick:e=>void P({navigate:!e.shiftKey}),"aria-label":t,className:l(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,d.trim()&&!I&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(N,{className:`size-4`})})]})}var Zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Qt=240,$t=320,en=520,tn=560;function nn(e){if(globalThis.localStorage===void 0)return $t;try{let t=globalThis.localStorage.getItem(e);if(!t)return $t;let n=Number(t);return Number.isFinite(n)?n:$t}catch{return $t}}function rn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var an={thought:ye,todo:Ke,voice:se,media:M,bookmark:L,mixed:ye,task:Ke};function on(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function sn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function cn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ln({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:c,listTitle:u,listDescription:m,emptyText:T,emptyDescription:O,listWidthStorageKey:k=`xopc.notes.listWidth`}){let A=d(p(e=>e.language)).notes,j=!!f(e=>e.token),[N,F]=(0,Q.useReducer)(C,Zt),[I,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(``),[V,H]=(0,Q.useState)(0),[U,G]=(0,Q.useState)(()=>nn(k)),[ie,ae]=(0,Q.useState)(!1),[K,oe]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),ge=(0,Q.useRef)(null),ve=(0,Q.useRef)(null),[be]=(0,Q.useState)(()=>Date.now()),xe=a(),Se=(0,Q.useCallback)(e=>{let t=ge.current?.clientWidth??window.innerWidth,n=Math.max(Qt,t-tn);return Math.max(Qt,Math.min(Math.min(en,n),e))},[]),we=(0,Q.useCallback)(e=>{let t=Se(e);G(t),rn(k,t)},[Se,k]);(0,Q.useLayoutEffect)(()=>{G(e=>Se(e))},[Se]);let{data:Te,mutate:Y,isLoading:De}=S((0,Q.useMemo)(()=>j?[`notes-list`,c,N.statusFilter,N.kindFilter,N.pinnedOnly]:null,[j,c,N.statusFilter,N.kindFilter,N.pinnedOnly]),()=>ce({status:N.statusFilter===`all`?void 0:N.statusFilter,kind:N.kindFilter===`all`?void 0:N.kindFilter,projectId:c,pinned:N.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Oe=De&&!Te,Ae=Te?.items??[],je=Te?.total??0,Me=z.trim(),{data:Ne,isLoading:Pe}=S(j&&I&&Me?[`notes-search`,c,Me]:null,()=>ce({search:Me,projectId:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Ne?.items??[],Fe=e?Ae.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{H(0)},[Me]),(0,Q.useEffect)(()=>{V>=X.length&&H(Math.max(0,X.length-1))},[V,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Ie=ee(e=>e.setPageHeader),Le=ee(e=>e.clearPageHeader),Re=je>0?A.noteCount.replace(`{{count}}`,String(je)):null,Be=A.searchDialogTitle,He=A.searchClose,Ue=A.searchClear,We=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>R(!0),className:l(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w),"aria-label":Be,children:[(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Be})]}),[Be]);(0,Q.useLayoutEffect)(()=>{if(n)return j?(Ie({startExtra:null,main:(0,$.jsxs)(`div`,{className:l(`flex min-w-0 items-center gap-2`,w),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:u??A.title}),Re?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Re}):null]}),end:We}),()=>Le()):(Le(),()=>Le())},[Le,j,We,u,n,A.title,Re,e,Ie]);let Ge=(0,Q.useMemo)(()=>({justNow:A.justNow,minutesAgo:A.minutesAgo,today:A.today,yesterday:A.yesterday,daysAgo:A.daysAgo}),[A.justNow,A.minutesAgo,A.today,A.yesterday,A.daysAgo]),qe=(0,Q.useMemo)(()=>[{id:`recent`,label:A.viewRecent,description:A.viewRecentDescription,icon:Ee,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:A.filterInbox,description:A.viewInboxDescription,icon:Ce,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:A.pinned,description:A.viewPinnedDescription,icon:re,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:A.viewTasks,description:A.viewTasksDescription,icon:Ke,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:A.kindVoice,description:A.viewVoiceDescription,icon:se,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:A.kindMedia,description:A.viewMediaDescription,icon:M,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:A.kindBookmark,description:A.viewBookmarksDescription,icon:L,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:A.filterProcessed,description:A.viewProcessedDescription,icon:E,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:A.filterArchived,description:A.viewArchiveDescription,icon:ne,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[A.filterArchived,A.filterInbox,A.filterProcessed,A.kindBookmark,A.kindMedia,A.kindVoice,A.pinned,A.viewArchiveDescription,A.viewBookmarksDescription,A.viewInboxDescription,A.viewMediaDescription,A.viewPinnedDescription,A.viewProcessedDescription,A.viewRecent,A.viewRecentDescription,A.viewTasks,A.viewTasksDescription,A.viewVoiceDescription]),Je=qe.find(e=>sn(N,e))??qe[0],Ye=u??Je.label,Z=m??Je.description,Xe=(0,Q.useCallback)(async(e,n)=>{let r=c?await ze({markdown:e,kind:`thought`,projectId:c,channel:`web`}):await Ve(e,`web`);await Y(),n?.navigate!==!1&&xe(cn(t,r.id))},[t,Y,xe,c]),Ze=(0,Q.useCallback)(async()=>{if(!le){ue(!0),pe(null);try{let e=await ze({markdown:``,kind:`thought`,projectId:c,channel:`web`});F({type:`patch`,patch:Zt}),await Y(),he(e.id),xe(cn(t,e.id))}catch(e){pe(`${A.createBlankFailed}: ${e instanceof Error?e.message:A.createBlankFailedHint}`)}finally{ue(!1)}}},[t,le,Y,A.createBlankFailed,A.createBlankFailedHint,xe,c]),Qe=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{pe(null),await de(t,`web`),await Y()}catch(e){pe(`${A.imageUploadFailed}: ${e instanceof Error?e.message:A.imageUploadFailedHint}`)}},e.click()},[Y,A.imageUploadFailed,A.imageUploadFailedHint]),$e=(0,Q.useCallback)(async(e,t)=>{try{pe(null),await J(e,t,`web`),await Y()}catch(e){pe(`${A.voiceUploadFailed}: ${e instanceof Error?e.message:A.voiceUploadFailedHint}`)}},[Y,A.voiceUploadFailed,A.voiceUploadFailedHint]),et=(0,Q.useCallback)(async(e,t)=>{await _e(e,{pinned:t}),await Y()},[Y]),tt=(0,Q.useCallback)(async e=>{await _e(e,{status:`archived`}),await Y()},[Y]),nt=(0,Q.useCallback)(async e=>{await ke(e),await Y()},[Y]),rt=(0,Q.useCallback)(e=>{xe(cn(t,e))},[t,xe]),it=(0,Q.useCallback)(e=>{xe(cn(t,e)),R(!1)},[t,xe]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),H(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),H(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[V]??X[0];t&&it(t.id)}}},[V,it,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ve.current;t.setPointerCapture(e.pointerId),ae(!0);let r=ge.current?.clientWidth??window.innerWidth,i=Math.max(Qt,r-tn),a=Math.min(en,i),o=e=>Math.max(Qt,Math.min(a,e)),s=e.clientX,c=o(U),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}ae(!1),ge.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),G(f),rn(k,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[k,U]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ze())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ze]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),we(U-16)):e.key===`ArrowRight`?(e.preventDefault(),we(U+16)):e.key===`Home`?(e.preventDefault(),we(Qt)):e.key===`End`&&(e.preventDefault(),we(en))},[we,U]);return j?(0,$.jsxs)(`div`,{ref:ge,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${U}px`},children:[(0,$.jsxs)(`section`,{ref:ve,className:l(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!ie&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,K?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":K?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[fe?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(o,{value:Je.id,onChange:e=>{let t=qe.find(t=>t.id===e.target.value);t&&F({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":A.libraryTitle,children:qe.map(e=>(0,$.jsx)(s,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ye}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Re??Z})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>oe(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":A.collapseNotesList,title:A.collapseNotesList,children:(0,$.jsx)(q,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ze,disabled:le,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":A.createBlankNote,title:A.createBlankShortcut,children:(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>R(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":A.searchDialogTitle,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:Oe?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Ae.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(ye,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Fe?A.noteOutsideCurrentView:T??A.noNotes}),e&&!Fe?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:O??A.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Fe?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:A.noteOutsideCurrentView}):null,Ae.map((t,n)=>{let r=n>0?st(Ae[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:l(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,be,Ge)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:rt,onPin:et,onArchive:tt,onDelete:nt,timeLabels:Ge,labels:{pin:A.pin,unpin:A.unpin,archive:A.archive,delete:A.delete,imageNote:A.imageNote,noText:A.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Xt,{placeholder:A.quickCapturePlaceholder,sendLabel:A.send,onCapture:Xe,onImagePick:i?Qe:void 0,onVoiceCapture:i?$e:void 0,recordingLabel:A.recording,discussionCaptureLabel:A.discussionCapture.title,onDiscussionCapture:()=>D(c)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":A.resizeNotesList,"aria-valuemin":Qt,"aria-valuemax":en,"aria-valuenow":Math.round(U),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>we($t),onKeyDown:ut,title:A.resizeNotesList,className:l(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,K?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:l(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,ie&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:l(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[K?(0,$.jsx)(`button`,{type:`button`,onClick:()=>oe(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":A.expandNotesList,title:A.expandNotesList,children:(0,$.jsx)(q,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Gt,{noteId:e,onBack:()=>xe(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>R(!0),autoFocus:e===me,onAutoFocusConsumed:()=>he(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(ye,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:A.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:A.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ze,disabled:le,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),le?A.creatingBlankNote:A.createBlankNote]})]})})]}),(0,$.jsx)(x,{open:I,onOpenChange:R,children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(b,{className:`text-sm font-semibold text-fg`,children:Be}),(0,$.jsx)(g,{className:`sr-only`,children:A.searchPlaceholder}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":He,children:(0,$.jsx)(W,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(P,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:z,onChange:e=>B(e.target.value),onKeyDown:ct,placeholder:A.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),z?(0,$.jsx)(`button`,{type:`button`,onClick:()=>B(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ue,children:(0,$.jsx)(W,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Me?Pe&&!Ne?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(ye,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:A.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:A.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:A.searchResultsCount.replace(`{{count}}`,String(Ne?.total??X.length))}),X.map((e,t)=>{let n=an[e.kind]||ye,r=on(e,{imageNote:A.imageNote,noText:A.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),onMouseEnter:()=>H(t),className:l(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===V?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:at(e.updatedAt,be,Ge)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(P,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:A.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:A.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(ye,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:A.needToken})]})}export{Ze as n,ln as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./external-link-DjqjBmc3.js";import{t as r}from"./cn-JdwAhgNB.js";import{n as i}from"./interaction-BmQogeqz.js";import{Po as a,al as o}from"./index-DRrjYYzZ.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=a()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=a()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=r(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,i.transition,i.press,i.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,i.transition,i.press,i.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=r(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,i.transition,i.press,i.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./external-link-DjqjBmc3.js";import{t as r}from"./cn-JdwAhgNB.js";import{n as i}from"./interaction-BmQogeqz.js";import{Po as a,al as o}from"./index-CKSplmFw.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=a()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=a()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=r(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,i.transition,i.press,i.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,i.transition,i.press,i.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=r(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,i.transition,i.press,i.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(o,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as a}from"./locale-store-CnamlR07.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Na as l}from"./index-DRrjYYzZ.js";import{n as u}from"./api-E9Bk-Idp.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as a}from"./locale-store-CnamlR07.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Na as l}from"./index-CKSplmFw.js";import{n as u}from"./api-E9Bk-Idp.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};