@xopcai/xopc 0.0.151 → 0.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BuO-OVfD.js → agent-avatar-dicebear-CXe2KDZj.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Bpv3h31T.js → agents-BjLxhsVX.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B6OU3Eol.js → app-management-settings-panel-DekP2_hC.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BaP4GFvN.js → appearance-settings-Cfd5YavF.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DZKNIMRg.js → apps-page-PS-uUoSk.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CJX3zIh_.js → archive-plugin-DWglUgbp.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CI1ejk_l.js → attachment-load-BJdxo2Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CjmhICbv.js → automation-suggestion-card-B-TfxjJF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtZl3B8m.js → automations-page-CtNevo3y.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-CZ8nOXqK.js → binary-plugins-DwrYsL8l.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BoSfyS_j.js → block-editor-CIxjL5Kp.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CL1UiPcb.js → browser-settings-page-QncZ-2vS.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-XzDKxPZ8.js → capability-presets-api-ChR2rMfo.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dc_uHYgl.js → capability-presets-settings-panel-_JBmJl5A.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-mALvXpJj.js → channels-settings-Bz3tyWpH.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-logo-BSjlInHT.js → connector-logo-KsRvub5G.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Cm_E3mmI.js → connectors-page-_pT0aE0S.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DcJc91-C.js → desktop-pet-CRCERvWy.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CdeqTa3Q.js → desktop-pet-settings-vGrxshsU.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Cp3fpm0k.js → directory-picker-path-field-BGPYrtx6.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-Bwj1O3zr.js → dreaming-settings-B5pzvNgs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_1xpKbZ.js → extension-debug-page-BaCko1XU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CqZNCj96.js → extension-page-TTXKCMtb.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-5MWbtQaQ.js → extension-settings-page-CEMb3uXY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Co_IaS34.js → gateway-config-api-Bf37OGhQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-kmeWm2Pt.js → gateway-settings-cu-vyeNk.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-FoO-R4_U.js → goal-create-dialog-C-bL8rj8.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-CkJq7N5g.js → goal-detail-page-p5zPrlTq.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-DrtsYjXz.js → goals-config-api-D2pEoiiO.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-DRAN-R64.js → goals-page-D-H2u2-J.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-wq9TKhIZ.js → goals-settings-BVZaBqPa.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-B5zDoHbo.js → heartbeat-settings-B-AC_uwa.js} +1 -1
- package/dist/gateway/static/root/assets/{index-apLU0Hun.js → index-DSydVlxZ.js} +6 -6
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-3tC9iD21.js → keyboard-shortcuts-settings-w0yIP0UB.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CT-vDTLK.js → local-app-workbench-page-CTq0TIH4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-B9ruF9GV.js → local-apps-page-srIyxJuy.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Ca1X8X2P.js → logs-page-MQB6-NKt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CzuhSQAB.js → markdown-split-Du5yPuDb.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-a3R4y-EL.js → media-plugins-Cd1Rmw15.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-panel-CbTlz9Of.js → models-hub-panel-BMg_Xqd9.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BCxDy2dV.js → notes-page-DhfrFd89.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-z6sBX9B2.js → notes-workbench-CwJk-D7Y.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CJfk6M78.js → page-tabs-HACawonJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-MFopTSgF.js → preview-open-alternatives-CjEZt_F5.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DU29deIr.js → project-detail-page-Dut_micj.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Ck3DLTlZ.js → projects-page-sTRlCEZ5.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-gLsLyAyi.js → remote-access-hub-Fx81YH7S.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-D0uhU3Z8.js → save-bar-controls-CbktHUqt.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-NGOH-7wV.js → schedule-field-BGx_Nb45.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BJz5LoqG.js → schema-form-Cg-LJVvG.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-TmNoWpa_.js → sessions-page-DFnmyBpj.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlWxQ6Ea.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-oDnUHnX_.js → settings-collapsible-section-yYK4O-5E.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DND90dDt.js → settings-form-section-DPSA8tG8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CEJtaoQp.js → settings-loading-skeleton-ClHNJwRL.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B1LJlRi9.js → settings-page-lPM7md10.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CsrLuDsW.js → settings-page-layout-B_-VepeK.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BPCJPHHY.js → setup-status-panel-hORJvGAQ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-C1PwLh-p.js → share-preview-page-DyzplAEL.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DCuqr7js.js → shares-settings-DO3IIgcC.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-kn1Vypcy.js → skill-reload-api-C9BqzDjZ.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-k6VIqTkK.js → skills-page-CvOIrcCJ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BEsrEkSx.js → system-settings-panel-eIyklo0K.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-dOypdlMf.js → typed-models-lib-BgOpEx3h.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-B9Y_Ciav.js → user-context-page-BG_1IrIJ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-DGC38Lx7.js → user-profile-fields-editor-CfLUK6MT.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DFkZ-tan.js → user-profile-settings-panel-BmzPREhJ.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CEIYZihF.js → utils-DbFnvDPi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DK6gaQsA.js → voice-api-key-field-1xyza74n.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DSJb9Kq7.js → work-discovery-page-Dhyk4LHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-DVavwV3D.js → work-item-detail-page-CxBRnWeQ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-page-foJDp0nz.js → work-page-Btq3YeCH.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BYqZpFCC.js → workflow-run-setup-panel-8HLqUALq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DgO0WAzs.js → workflows-page-D48bPgLI.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/product-delivery.js +63 -0
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +5 -0
- package/dist/src/agent/code-intelligence/tool-gating.js +6 -0
- package/dist/src/agent/tools/automation-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/goal-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/status.d.ts +8 -0
- package/dist/src/gateway/hono/routes/status.js +71 -1
- package/package.json +9 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CtPhh2m9.js +0 -1
package/dist/gateway/static/root/assets/{notes-workbench-z6sBX9B2.js → notes-workbench-CwJk-D7Y.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-
|
|
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-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./messages-B0B40tpO.js";import{l as c,n as l}from"./locale-store-GfSwnwIZ.js";import{i as u}from"./theme-store-Bi6hMBDb.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ai as f,Bc as p,Bo as m,Cc as h,Cr as g,Cs as _,Cu as v,Dc as y,Di as b,Dr as x,Ei as S,El as C,Er as w,Fo as T,Fs as E,Ho as D,Ic as O,Io as k,Is as A,Js as j,Ks as M,Lo as N,Ls as P,No as F,Nt as I,Oi as ee,Pl as te,Po as L,Ro as ne,Sr as R,Su as z,T as re,Tc as B,Uc as V,Us as H,Vl as U,Wl as W,Yo as G,Ys as K,Zo as ie,_ as ae,_r as oe,ac as se,br as ce,bu as le,cl as ue,cr as de,dl as fe,dr as pe,fc as q,fr as me,gr as he,hr as ge,ic as _e,ir as J,ji as Y,jl as ve,kc as ye,ki as be,kr as xe,lr as Se,mr as Ce,nr as we,pr as Te,pu as Ee,rl as De,rr as X,sl as Oe,ul as ke,ur as Ae,vr as je,wc as Me,wr as Ne,xc as Pe,xr as Fe,xs as Ie,yc as Le,yr as Re,zo as ze}from"./index-apLU0Hun.js";import{t as Be}from"./automation-suggestion-card-CjmhICbv.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(N,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`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]=h):h=t[4];let g=a?.alt||`Image preview`,v;t[5]===g?v=t[6]:(v=(0,$.jsx)(ze,{className:`sr-only`,children:g}),t[5]=g,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(_,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,$.jsx)(L,{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:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=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]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,$.jsxs)(ne,{children:[m,(0,$.jsxs)(T,{className:h,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let C;t[16]!==S||t[17]!==f?(C=(0,$.jsx)(F,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let w;return t[19]!==n||t[20]!==C?(w=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=w):w=t[21],w}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=xe(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`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)(ke,{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=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`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]!==l||t[13]!==d?(f=(0,$.jsx)(x,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)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 Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(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 et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=J(),p=J(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,v=m&&u>0?u:i??0,b=v>0?Math.min(_/v*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=h?`Pause`:`Play`,k;t[14]!==g||t[15]!==h?(k=g?(0,$.jsx)(V,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(y,{className:`size-3.5`}):(0,$.jsx)(Pe,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(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]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(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:j}})}),t[23]=j,t[24]=M);let N;t[25]!==v||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:tt,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,p;t[0]!==l||t[1]!==n?(p=rt(n,l),t[0]=l,t[1]=n,t[2]=p):p=t[2];let m=p,g=!n.snippet?.trim(),[_]=(0,Q.useState)(ct),y;t[3]!==n.createdAt||t[4]!==_||t[5]!==u?(y=Xe(n.createdAt,_,u),t[3]=n.createdAt,t[4]=_,t[5]=u,t[6]=y):y=t[6];let x=y,C,w;t[7]!==n.id||t[8]!==i?(C=()=>i(n.id),w=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=C,t[10]=w):(C=t[9],w=t[10]);let T=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,D;t[11]===T?D=t[12]:(D=o(`group relative flex cursor-pointer flex-col gap-2 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-panel`,T),t[11]=T,t[12]=D);let O=d?`true`:void 0,k;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(k=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=k):k=t[18];let A;t[19]===n.title?A=t[20]:(A=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=A);let j=n.title?`text-fg-muted`:g?`italic text-fg-muted`:`text-fg`,M;t[21]===j?M=t[22]:(M=o(`truncate text-sm leading-5`,j),t[21]=j,t[22]=M);let N;t[23]!==m||t[24]!==M?(N=(0,$.jsx)(`p`,{className:M,children:m}),t[23]=m,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==A||t[27]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,N]}),t[26]=A,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(Y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,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)(te,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let L;t[34]===n.pinned?L=t[35]:(L=n.pinned?(0,$.jsx)(h,{className:`size-4`}):(0,$.jsx)(Me,{className:`size-4`}),t[34]=n.pinned,t[35]=L);let ne=n.pinned?l.unpin:l.pin,R;t[36]!==I||t[37]!==L||t[38]!==ne?(R=(0,$.jsxs)(b,{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,ne]}),t[36]=I,t[37]=L,t[38]=ne,t[39]=R):R=t[39];let z;t[40]!==n.id||t[41]!==s?(z=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=z):z=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(v,{className:`size-4`}),t[43]=re):re=t[43];let B;t[44]!==l.archive||t[45]!==z?(B=(0,$.jsxs)(b,{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:z,children:[re,l.archive]}),t[44]=l.archive,t[45]=z,t[46]=B):B=t[46];let V;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(f,{className:`my-1 h-px bg-edge-subtle`}),t[47]=V):V=t[47];let H;t[48]!==n.id||t[49]!==c?(H=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=H):H=t[50];let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(E,{className:`size-4`}),t[51]=U):U=t[51];let W;t[52]!==l.delete||t[53]!==H?(W=(0,$.jsxs)(b,{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:H,children:[U,l.delete]}),t[52]=l.delete,t[53]=H,t[54]=W):W=t[54];let G;t[55]!==R||t[56]!==B||t[57]!==W?(G=(0,$.jsxs)(be,{children:[F,(0,$.jsx)(ee,{children:(0,$.jsxs)(S,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[R,B,V,W]})})]}),t[55]=R,t[56]=B,t[57]=W,t[58]=G):G=t[58];let K;t[59]!==P||t[60]!==G||t[61]!==k?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[k,P,G]}),t[59]=P,t[60]=G,t[61]=k,t[62]=K):K=t[62];let ie;t[63]===n.pinned?ie=t[64]:(ie=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)(Me,{className:`size-3`})}),t[63]=n.pinned,t[64]=ie);let ae;t[65]===n.tags?ae=t[66]:(ae=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=ae);let oe;t[67]===x?oe=t[68]:(oe=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:x}),t[67]=x,t[68]=oe);let se;t[69]!==ie||t[70]!==ae||t[71]!==oe?(se=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ie,ae,oe]}),t[69]=ie,t[70]=ae,t[71]=oe,t[72]=se):se=t[72];let ce;return t[73]!==K||t[74]!==se||t[75]!==C||t[76]!==w||t[77]!==D||t[78]!==O?(ce=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:C,onKeyDown:w,className:D,"aria-current":O,children:[K,se]}),t[73]=K,t[74]=se,t[75]=C,t[76]=w,t[77]=D,t[78]=O,t[79]=ce):ce=t[79],ce}function at(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 ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:B,ai_edit:K,sync:q,restore:z};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>Ce(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{p(!0);try{await g(e,t),h(null),i()}catch{D({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),y=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)(fe,{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)(_,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??B,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`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:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,y,c)})]}),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(),v(e.timestamp)},disabled:f,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:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(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(),h(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 ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:m,onOpenChat:h,onOpenNewChat:g}=e,_=s(l(yt)).notes,v=a(),y=r?.aiDeep?.catalysis,b=y?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>me(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await R(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=k):k=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(le,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=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:[k,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:_.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":_.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(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:_.catalysisSectionDescription}),w?(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:_.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>Fe(n),{revalidate:!1}),disabled:E,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:_.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.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:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:_.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,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?_.processing:b?_.recatalyze:_.catalyzeAction}),b?(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:_.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(pt)})]}),(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:_.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackHelpfulAria,children:(0,$.jsx)(A,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackNotHelpfulAria,children:(0,$.jsx)(P,{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:_.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:[M,_.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:m,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:m?_.openingChat:_.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:g,disabled:m,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:_.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(`/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||_.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.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:_.noThreads})]})]})]})}function pt(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 mt(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 ht(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 gt(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 _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(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 yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-BoSfyS_j.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])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([26,1,3,23,5,27])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){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 Tt(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:C},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:U},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:ve},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,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`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`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 Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(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]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:f,autoFocus:h=!1,onAutoFocusConsumed:g}){let _=l(e=>e.language),v=s(_).notes,y=s(_).automations.suggestions,b=a(),x=u(e=>e.resolved)===`dark`,{openImage:S}=He(),[C,T]=(0,Q.useState)(`wysiwyg`),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(360),[ee,te]=(0,Q.useState)(!1),[L,ne]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),q=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=m(e=>e.setPageHeader),_e=m(e=>e.clearPageHeader),{data:J,mutate:Y}=d(e?[`note-detail`,e]:null,()=>pe(e)),{data:ve=[],mutate:ye}=d(e?[`note-threads`,e]:null,()=>ge(e),{revalidateOnFocus:!1}),be=k!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e]),(0,Q.useEffect)(()=>{B.current=!1,P(``),A(null),O(null),V.current=!1,me.current=null},[e]),(0,Q.useEffect)(()=>{!J||B.current||(P(J.title??``),B.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!h||!J||be||me.current===e)return;let t=window.requestAnimationFrame(()=>{q.current?.focus(),g?.()});return me.current=e,()=>window.cancelAnimationFrame(t)},[h,be,J,e,g]);let xe=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":v.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ie,i),children:(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0})}):null,[i,v.back,t,r]),Ce=(0,Q.useCallback)(t=>{P(t),e&&(G.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){M(!0);try{await Ne(e,{title:t}),await Y(),n?.()}catch{}finally{M(!1)}}},600))},[e,Y,n]),Ee=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,Ie),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||xe||void 0,children:N||xe}),j?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:v.saving}):null]}),[v.saving,j,xe,N]),De=(0,Q.useCallback)(async(t=!1)=>{z(!0);try{let n=await oe(e,{forceNew:t});await Y(),await ye(),b(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){D({type:`error`,title:v.chatOpenFailedTitle,message:e instanceof Error?e.message:v.chatOpenFailedMessage})}finally{z(!1)}},[Y,ye,b,e,v.chatOpenFailedMessage,v.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{ne(!0);try{await de(e),await Y()}catch(e){D({type:`error`,title:v.catalysisFailed,message:e instanceof Error?e.message:v.chatOpenFailedMessage})}finally{ne(!1)}},[Y,e]),ke=(0,Q.useCallback)(()=>{O(E===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!L&&Oe()},[E,L,Oe,J?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=k?.markdown??W.current??J?.markdown??``,n=k?.title??N,r=we([n,t].filter(Boolean).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CIxjL5Kp.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DSydVlxZ.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/chunk-QUQL4437-DXsxWP7r.js","assets/vendor-swr-BIWyz7Rc.js","assets/cn-BQ_8x0bT.js","assets/check-BODqo66o.js","assets/circle-alert-RzVebuX2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-GfSwnwIZ.js","assets/messages-B0B40tpO.js","assets/schemas-DgQq6Z5S.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-BM_xvzl0.js","assets/activity-store-uu1xu9Pl.js","assets/theme-store-Bi6hMBDb.js","assets/index-DIlxvrlG.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.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-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./messages-B0B40tpO.js";import{l as c,n as l}from"./locale-store-GfSwnwIZ.js";import{i as u}from"./theme-store-Bi6hMBDb.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{Ai as f,Bc as p,Bo as m,Cc as h,Cr as g,Cs as _,Cu as v,Dc as y,Di as b,Dr as x,Ei as S,El as C,Er as w,Fo as T,Fs as E,Ho as D,Ic as O,Io as k,Is as A,Js as j,Ks as M,Lo as N,Ls as P,No as F,Nt as I,Oi as ee,Pl as te,Po as L,Ro as ne,Sr as R,Su as z,T as re,Tc as B,Uc as V,Us as H,Vl as U,Wl as W,Yo as G,Ys as K,Zo as ie,_ as ae,_r as oe,ac as se,br as ce,bu as le,cl as ue,cr as de,dl as fe,dr as pe,fc as q,fr as me,gr as he,hr as ge,ic as _e,ir as J,ji as Y,jl as ve,kc as ye,ki as be,kr as xe,lr as Se,mr as Ce,nr as we,pr as Te,pu as Ee,rl as De,rr as X,sl as Oe,ul as ke,ur as Ae,vr as je,wc as Me,wr as Ne,xc as Pe,xr as Fe,xs as Ie,yc as Le,yr as Re,zo as ze}from"./index-DSydVlxZ.js";import{t as Be}from"./automation-suggestion-card-B-TfxjJF.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(N,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`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]=h):h=t[4];let g=a?.alt||`Image preview`,v;t[5]===g?v=t[6]:(v=(0,$.jsx)(ze,{className:`sr-only`,children:g}),t[5]=g,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(_,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,$.jsx)(L,{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:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=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]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,$.jsxs)(ne,{children:[m,(0,$.jsxs)(T,{className:h,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let C;t[16]!==S||t[17]!==f?(C=(0,$.jsx)(F,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let w;return t[19]!==n||t[20]!==C?(w=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=w):w=t[21],w}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=xe(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`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)(ke,{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=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`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]!==l||t[13]!==d?(f=(0,$.jsx)(x,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)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 Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(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 et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=J(),p=J(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,v=m&&u>0?u:i??0,b=v>0?Math.min(_/v*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=h?`Pause`:`Play`,k;t[14]!==g||t[15]!==h?(k=g?(0,$.jsx)(V,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(y,{className:`size-3.5`}):(0,$.jsx)(Pe,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(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]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(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:j}})}),t[23]=j,t[24]=M);let N;t[25]!==v||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:tt,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,p;t[0]!==l||t[1]!==n?(p=rt(n,l),t[0]=l,t[1]=n,t[2]=p):p=t[2];let m=p,g=!n.snippet?.trim(),[_]=(0,Q.useState)(ct),y;t[3]!==n.createdAt||t[4]!==_||t[5]!==u?(y=Xe(n.createdAt,_,u),t[3]=n.createdAt,t[4]=_,t[5]=u,t[6]=y):y=t[6];let x=y,C,w;t[7]!==n.id||t[8]!==i?(C=()=>i(n.id),w=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=C,t[10]=w):(C=t[9],w=t[10]);let T=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,D;t[11]===T?D=t[12]:(D=o(`group relative flex cursor-pointer flex-col gap-2 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-panel`,T),t[11]=T,t[12]=D);let O=d?`true`:void 0,k;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(k=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=k):k=t[18];let A;t[19]===n.title?A=t[20]:(A=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=A);let j=n.title?`text-fg-muted`:g?`italic text-fg-muted`:`text-fg`,M;t[21]===j?M=t[22]:(M=o(`truncate text-sm leading-5`,j),t[21]=j,t[22]=M);let N;t[23]!==m||t[24]!==M?(N=(0,$.jsx)(`p`,{className:M,children:m}),t[23]=m,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==A||t[27]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,N]}),t[26]=A,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(Y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,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)(te,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let L;t[34]===n.pinned?L=t[35]:(L=n.pinned?(0,$.jsx)(h,{className:`size-4`}):(0,$.jsx)(Me,{className:`size-4`}),t[34]=n.pinned,t[35]=L);let ne=n.pinned?l.unpin:l.pin,R;t[36]!==I||t[37]!==L||t[38]!==ne?(R=(0,$.jsxs)(b,{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,ne]}),t[36]=I,t[37]=L,t[38]=ne,t[39]=R):R=t[39];let z;t[40]!==n.id||t[41]!==s?(z=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=z):z=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(v,{className:`size-4`}),t[43]=re):re=t[43];let B;t[44]!==l.archive||t[45]!==z?(B=(0,$.jsxs)(b,{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:z,children:[re,l.archive]}),t[44]=l.archive,t[45]=z,t[46]=B):B=t[46];let V;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(f,{className:`my-1 h-px bg-edge-subtle`}),t[47]=V):V=t[47];let H;t[48]!==n.id||t[49]!==c?(H=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=H):H=t[50];let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(E,{className:`size-4`}),t[51]=U):U=t[51];let W;t[52]!==l.delete||t[53]!==H?(W=(0,$.jsxs)(b,{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:H,children:[U,l.delete]}),t[52]=l.delete,t[53]=H,t[54]=W):W=t[54];let G;t[55]!==R||t[56]!==B||t[57]!==W?(G=(0,$.jsxs)(be,{children:[F,(0,$.jsx)(ee,{children:(0,$.jsxs)(S,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[R,B,V,W]})})]}),t[55]=R,t[56]=B,t[57]=W,t[58]=G):G=t[58];let K;t[59]!==P||t[60]!==G||t[61]!==k?(K=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[k,P,G]}),t[59]=P,t[60]=G,t[61]=k,t[62]=K):K=t[62];let ie;t[63]===n.pinned?ie=t[64]:(ie=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)(Me,{className:`size-3`})}),t[63]=n.pinned,t[64]=ie);let ae;t[65]===n.tags?ae=t[66]:(ae=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=ae);let oe;t[67]===x?oe=t[68]:(oe=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:x}),t[67]=x,t[68]=oe);let se;t[69]!==ie||t[70]!==ae||t[71]!==oe?(se=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ie,ae,oe]}),t[69]=ie,t[70]=ae,t[71]=oe,t[72]=se):se=t[72];let ce;return t[73]!==K||t[74]!==se||t[75]!==C||t[76]!==w||t[77]!==D||t[78]!==O?(ce=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:C,onKeyDown:w,className:D,"aria-current":O,children:[K,se]}),t[73]=K,t[74]=se,t[75]=C,t[76]=w,t[77]=D,t[78]=O,t[79]=ce):ce=t[79],ce}function at(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 ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:B,ai_edit:K,sync:q,restore:z};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>Ce(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{p(!0);try{await g(e,t),h(null),i()}catch{D({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),y=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)(fe,{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)(_,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??B,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`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:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,y,c)})]}),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(),v(e.timestamp)},disabled:f,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:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(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(),h(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 ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:m,onOpenChat:h,onOpenNewChat:g}=e,_=s(l(yt)).notes,v=a(),y=r?.aiDeep?.catalysis,b=y?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>me(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await R(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=k):k=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(le,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=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:[k,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:_.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":_.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(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:_.catalysisSectionDescription}),w?(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:_.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>Fe(n),{revalidate:!1}),disabled:E,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:_.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.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:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:_.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,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?_.processing:b?_.recatalyze:_.catalyzeAction}),b?(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:_.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(pt)})]}),(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:_.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackHelpfulAria,children:(0,$.jsx)(A,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackNotHelpfulAria,children:(0,$.jsx)(P,{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:_.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:[M,_.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:m,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:m?_.openingChat:_.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:g,disabled:m,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:_.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(`/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||_.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.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:_.noThreads})]})]})]})}function pt(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 mt(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 ht(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 gt(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 _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(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 yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-CIxjL5Kp.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])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([26,1,3,23,5,27])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){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 Tt(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:C},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:U},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:ve},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,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`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`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 Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(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]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:f,autoFocus:h=!1,onAutoFocusConsumed:g}){let _=l(e=>e.language),v=s(_).notes,y=s(_).automations.suggestions,b=a(),x=u(e=>e.resolved)===`dark`,{openImage:S}=He(),[C,T]=(0,Q.useState)(`wysiwyg`),[E,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(360),[ee,te]=(0,Q.useState)(!1),[L,ne]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),q=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=m(e=>e.setPageHeader),_e=m(e=>e.clearPageHeader),{data:J,mutate:Y}=d(e?[`note-detail`,e]:null,()=>pe(e)),{data:ve=[],mutate:ye}=d(e?[`note-threads`,e]:null,()=>ge(e),{revalidateOnFocus:!1}),be=k!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&Y()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[Y,e]),(0,Q.useEffect)(()=>{B.current=!1,P(``),A(null),O(null),V.current=!1,me.current=null},[e]),(0,Q.useEffect)(()=>{!J||B.current||(P(J.title??``),B.current=!0)},[J]),(0,Q.useEffect)(()=>{if(!h||!J||be||me.current===e)return;let t=window.requestAnimationFrame(()=>{q.current?.focus(),g?.()});return me.current=e,()=>window.cancelAnimationFrame(t)},[h,be,J,e,g]);let xe=J?new Date(J.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":v.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Ie,i),children:(0,$.jsx)(le,{className:`size-4`,"aria-hidden":!0})}):null,[i,v.back,t,r]),Ce=(0,Q.useCallback)(t=>{P(t),e&&(G.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){M(!0);try{await Ne(e,{title:t}),await Y(),n?.()}catch{}finally{M(!1)}}},600))},[e,Y,n]),Ee=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,Ie),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:N||xe||void 0,children:N||xe}),j?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:v.saving}):null]}),[v.saving,j,xe,N]),De=(0,Q.useCallback)(async(t=!1)=>{z(!0);try{let n=await oe(e,{forceNew:t});await Y(),await ye(),b(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){D({type:`error`,title:v.chatOpenFailedTitle,message:e instanceof Error?e.message:v.chatOpenFailedMessage})}finally{z(!1)}},[Y,ye,b,e,v.chatOpenFailedMessage,v.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{ne(!0);try{await de(e),await Y()}catch(e){D({type:`error`,title:v.catalysisFailed,message:e instanceof Error?e.message:v.chatOpenFailedMessage})}finally{ne(!1)}},[Y,e]),ke=(0,Q.useCallback)(()=>{O(E===`breakdown`?null:`breakdown`),!J?.aiDeep?.catalysis?.report&&!L&&Oe()},[E,L,Oe,J?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=k?.markdown??W.current??J?.markdown??``,n=k?.title??N,r=we([n,t].filter(Boolean).join(`
|
|
3
3
|
|
|
4
4
|
`));return{source:{type:`note`,id:e,title:n||v.titlePlaceholder},text:r,language:X(r,_)}},[_,v.titlePlaceholder,J?.markdown,e,k,N]),je=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,Ie),children:[f?(0,$.jsx)(`button`,{type:`button`,onClick:f,"aria-label":v.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)(se,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(re,{input:Ae,labels:{read:v.readAloud,preparing:v.readAloudPreparing,pause:v.readAloudPause,resume:v.readAloudResume,retry:v.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:L,"aria-label":v.catalysisSectionTitle,className:o(`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`,E===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),L?v.catalyzing:v.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(!1),disabled:R,className:o(`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)(p,{className:`size-3.5`,"aria-hidden":!0}),R?v.openingChat:v.openChatButton]}),(0,$.jsx)(Tt,{mode:C,onModeChange:T,labels:{edit:v.modeEdit,source:v.modeSource,preview:v.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>O(E===`history`?null:`history`),"aria-label":v.history,className:o(`rounded-lg p-1.5 transition-colors`,E===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})]}),[L,ke,De,C,v.history,v.modeEdit,v.modePreview,v.modeSource,R,E,f,v.searchDialogTitle,v.readAloud,v.readAloudPause,v.readAloudPreparing,v.readAloudResume,v.readAloudRetry,Ae]);(0,Q.useLayoutEffect)(()=>(he({startExtra:Se,main:J?Ee:null,end:J?je:null}),()=>{c&&_e()}),[c,_e,je,Ee,Se,J,he]);let Me=(0,Q.useCallback)(t=>{e&&(W.current=t,H.current&&clearTimeout(H.current),H.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){M(!0);try{await Ne(e,{markdown:t}),await Y(),n?.()}catch(e){D({type:`error`,title:v.saveFailed,message:e instanceof Error?e.message:v.saveFailedHint})}finally{M(!1)}}},600))},[e,Y,v.saveFailed,v.saveFailedHint,n]),Pe=(0,Q.useCallback)(t=>{Te(e,t.timestamp).then(e=>{e&&A(e)})},[e]),Fe=(0,Q.useCallback)(()=>{O(null),A(null)},[]),Le=(0,Q.useCallback)(()=>{O(null),A(null),Y(),n?.()},[Y,n]);if((0,Q.useEffect)(()=>()=>{H.current&&clearTimeout(H.current),U.current&&clearTimeout(U.current);let t=W.current,n=G.current;W.current=null,G.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Ne(e,r)},[e]),J===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(J===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:v.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v.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:v.back})]});let Re=be?k.title??``:N,ze=be?k.markdown??``:J.markdown??``,Z=new Date(J.createdAt).getTime(),Ve=Number.isFinite(Z)&&Date.now()-Z<3600*1e3?(0,$.jsx)(Be,{title:y.noteCreatedTitle,description:y.noteCreatedDescription,prompt:y.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:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(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,$.jsx)(`div`,{ref:ie,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:be?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Re&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Re}),ze?(0,$.jsx)(w,{noteId:e,content:ze,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:v.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[C===`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:q,type:`text`,value:N,onChange:e=>Ce(e.target.value),onCompositionStart:()=>{V.current=!0},onCompositionEnd:()=>{V.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!V.current&&!t.isComposing&&(e.preventDefault(),(ie.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:v.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(St,{initialContent:J.markdown??``,onChange:Me,noteId:e},`wysiwyg-${e}`)})})]}),C===`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:q,type:`text`,value:N,onChange:e=>Ce(e.target.value),placeholder:v.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`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(Ct,{initialContent:J.markdown??``,onChange:Me,isDark:x},`source-${e}`)})})]}),C===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&S(t.currentSrc||t.src,t.alt)},children:[N&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:N}),J.markdown?(0,$.jsx)(w,{noteId:e,content:J.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:v.emptyPreview})]})]})})]}),(0,$.jsx)(`div`,{ref:ce,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ee&&`transition-[width] duration-300 ease-in-out`),style:{width:E?F:0},children:(0,$.jsxs)(`div`,{ref:ue,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),te(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,E&&ce.current?.style.setProperty(`width`,`${s}px`),ue.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{}te(!1),I(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:o(`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`,ee&&`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:E===`history`?(0,$.jsx)(dt,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:Pe,onClose:Fe,onRestored:Le}):E===`breakdown`?(0,$.jsx)(ft,{noteId:e,note:J??null,catalyzing:L,onCatalyze:Oe,onClose:()=>O(null),noteThreads:ve,openingChat:R,onOpenChat:()=>De(!1),onOpenNewChat:()=>De(!0)}):null})]})})]})}var kt=3e4;function At(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function jt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(0),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)([]),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useCallback)(()=>{w.current&&=(clearInterval(w.current),null),T.current&&=(clearTimeout(T.current),null),x.current?.getTracks().forEach(e=>e.stop()),x.current=null,b.current=null,S.current=[],m(!1),g(0)},[]);(0,Q.useEffect)(()=>()=>E(),[E]);let D=(0,Q.useCallback)(async()=>{let e=b.current;if(!e||e.state!==`recording`)return;v(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-C.current)/1e3)),n=e.mimeType||At()||`audio/webm`,r=new Blob(S.current,{type:n});if(E(),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{v(!1)}return}v(!1)},[E,i]),k=(0,Q.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=At(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);x.current=e,b.current=n,S.current=[],C.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&S.current.push(e.data)},n.start(),m(!0),g(0),w.current=setInterval(()=>{g(Math.round((Date.now()-C.current)/1e3))},250),T.current=setTimeout(()=>{D()},kt)}catch{E()}},[E,i,p,D,_]),A=(0,Q.useCallback)(()=>{if(p){D();return}k()},[p,k,D]),j=(0,Q.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),y.current?.focus()}}},[l,d,n]),N=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),j({navigate:!1}))},[j]),P=d||_;return(0,$.jsxs)(`div`,{className:o(`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`,p&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:P||s||p,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)(ue,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:A,disabled:P||c||d,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,p?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":p?`Stop recording`:`Voice`,"aria-pressed":p,children:p?(0,$.jsx)(M,{className:`size-4 fill-current`}):(0,$.jsx)(O,{className:`size-4`})}),p?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(h))}):(0,$.jsx)(`textarea`,{ref:y,value:l,onChange:e=>u(e.target.value),onKeyDown:N,placeholder:e,rows:1,disabled:P,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:!l.trim()||P||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,l.trim()&&!P&&!p?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(_e,{className:`size-4`})})]})}var Mt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Nt=240,Pt=320,Ft=520,It=560;function Lt(e){if(globalThis.localStorage===void 0)return Pt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Pt;let n=Number(t);return Number.isFinite(n)?n:Pt}catch{return Pt}}function Rt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var zt={thought:H,todo:j,voice:O,media:ue,bookmark:Ee,mixed:H,task:j};function Bt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Vt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Ht(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Ut({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:u,captureTags:f=[],listTitle:p,listDescription:h,emptyText:g,emptyDescription:y,listWidthStorageKey:b=`xopc.notes.listWidth`}){let x=s(l(e=>e.language)).notes,S=!!c(e=>e.token),[C,w]=(0,Q.useReducer)(I,Mt),[E,A]=(0,Q.useState)(!1),[M,P]=(0,Q.useState)(``),[ee,te]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>Lt(b)),[re,B]=(0,Q.useState)(!1),[V,U]=(0,Q.useState)(!1),[K,ae]=(0,Q.useState)(!1),[oe,le]=(0,Q.useState)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),[pe]=(0,Q.useState)(()=>Date.now()),q=a(),me=(0,Q.useCallback)(e=>{let t=de.current?.clientWidth??window.innerWidth,n=Math.max(Nt,t-It);return Math.max(Nt,Math.min(Math.min(Ft,n),e))},[]),ge=(0,Q.useCallback)(e=>{let t=me(e);z(t),Rt(b,t)},[me,b]);(0,Q.useLayoutEffect)(()=>{z(e=>me(e))},[me]);let{data:_e,mutate:J,isLoading:Y}=d((0,Q.useMemo)(()=>S?[`notes-list`,u,C.statusFilter,C.kindFilter,C.pinnedOnly]:null,[S,u,C.statusFilter,C.kindFilter,C.pinnedOnly]),()=>he({status:C.statusFilter===`all`?void 0:C.statusFilter,kind:C.kindFilter===`all`?void 0:C.kindFilter,tag:u,pinned:C.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ve=Y&&!_e,be=_e?.items??[],xe=_e?.total??0,Ce=M.trim(),{data:we,isLoading:Te}=d(S&&E&&Ce?[`notes-search`,u,Ce]:null,()=>he({search:Ce,tag:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=we?.items??[],ke=e?be.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{te(0)},[Ce]),(0,Q.useEffect)(()=>{ee>=X.length&&te(Math.max(0,X.length-1))},[ee,X.length]),(0,Q.useEffect)(()=>{let e=()=>{J()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[J]);let Pe=m(e=>e.setPageHeader),Fe=m(e=>e.clearPageHeader),Be=xe>0?x.noteCount.replace(`{{count}}`,String(xe)):null,Z=x.searchDialogTitle,Ve=x.searchClose,He=x.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:o(`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`,Ie),"aria-label":Z,children:[(0,$.jsx)(se,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Z})]}),[Z]);(0,Q.useLayoutEffect)(()=>{if(n)return S?(Pe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,Ie),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:p??x.title}),Be?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Be}):null]}),end:Ue}),()=>Fe()):(Fe(),()=>Fe())},[Fe,S,Ue,p,n,x.title,Be,e,Pe]);let We=(0,Q.useMemo)(()=>({justNow:x.justNow,minutesAgo:x.minutesAgo,today:x.today,yesterday:x.yesterday,daysAgo:x.daysAgo}),[x.justNow,x.minutesAgo,x.today,x.yesterday,x.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:x.viewRecent,description:x.viewRecentDescription,icon:W,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:x.filterInbox,description:x.viewInboxDescription,icon:Oe,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:x.pinned,description:x.viewPinnedDescription,icon:Me,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:x.viewTasks,description:x.viewTasksDescription,icon:j,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:x.kindVoice,description:x.viewVoiceDescription,icon:O,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:x.kindMedia,description:x.viewMediaDescription,icon:ue,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:x.kindBookmark,description:x.viewBookmarksDescription,icon:Ee,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:x.filterProcessed,description:x.viewProcessedDescription,icon:De,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:x.filterArchived,description:x.viewArchiveDescription,icon:v,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[x.filterArchived,x.filterInbox,x.filterProcessed,x.kindBookmark,x.kindMedia,x.kindVoice,x.pinned,x.viewArchiveDescription,x.viewBookmarksDescription,x.viewInboxDescription,x.viewMediaDescription,x.viewPinnedDescription,x.viewProcessedDescription,x.viewRecent,x.viewRecentDescription,x.viewTasks,x.viewTasksDescription,x.viewVoiceDescription]),Ke=Ge.find(e=>Vt(C,e))??Ge[0],qe=p??Ke.label,Je=h??Ke.description,Ye=(0,Q.useCallback)(async(e,n)=>{let r=f.length?await Se({markdown:e,kind:`thought`,tags:f,channel:`web`}):await je(e,`web`);await J(),n?.navigate!==!1&&q(Ht(t,r.id))},[t,f,J,q]),$e=(0,Q.useCallback)(async()=>{if(!K){ae(!0);try{let e=await Se({markdown:``,kind:`thought`,tags:f,channel:`web`});w({type:`patch`,patch:Mt}),await J(),le(e.id),q(Ht(t,e.id))}catch(e){D({type:`error`,title:x.createBlankFailed,message:e instanceof Error?e.message:x.createBlankFailedHint})}finally{ae(!1)}}},[t,f,K,J,x.createBlankFailed,x.createBlankFailedHint,q]),et=(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{await Re(t,`web`),await J()}catch(e){D({type:`error`,title:x.imageUploadFailed,message:e instanceof Error?e.message:x.imageUploadFailedHint})}},e.click()},[J,x.imageUploadFailed,x.imageUploadFailedHint]),tt=(0,Q.useCallback)(async(e,t)=>{try{await ce(e,t,`web`),await J()}catch(e){D({type:`error`,title:x.voiceUploadFailed,message:e instanceof Error?e.message:x.voiceUploadFailedHint})}},[J,x.voiceUploadFailed,x.voiceUploadFailedHint]),nt=(0,Q.useCallback)(async(e,t)=>{await Ne(e,{pinned:t}),await J()},[J]),rt=(0,Q.useCallback)(async e=>{await Ne(e,{status:`archived`}),await J()},[J]),at=(0,Q.useCallback)(async e=>{await Ae(e),await J()},[J]),ot=(0,Q.useCallback)(e=>{q(Ht(t,e))},[t,q]),st=(0,Q.useCallback)(e=>{q(Ht(t,e)),A(!1)},[t,q]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),te(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),te(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[ee]??X[0];t&&st(t.id)}}},[ee,st,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=fe.current;t.setPointerCapture(e.pointerId),B(!0);let r=de.current?.clientWidth??window.innerWidth,i=Math.max(Nt,r-It),a=Math.min(Ft,i),o=e=>Math.max(Nt,Math.min(a,e)),s=e.clientX,c=o(R),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{}B(!1),de.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(f),Rt(b,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)},[b,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),$e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$e]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ge(R-16)):e.key===`ArrowRight`?(e.preventDefault(),ge(R+16)):e.key===`Home`?(e.preventDefault(),ge(Nt)):e.key===`End`&&(e.preventDefault(),ge(Ft))},[ge,R]);return S?(0,$.jsxs)(`div`,{ref:de,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:fe,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!re&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,V?`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":V?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 border-b border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(G,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&w({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":x.libraryTitle,children:Ge.map(e=>(0,$.jsx)(ie,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Be??Je})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!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":x.collapseNotesList,title:x.collapseNotesList,children:(0,$.jsx)(ye,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:$e,disabled:K,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":x.createBlankNote,title:x.createBlankShortcut,children:(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(!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":x.searchDialogTitle,children:(0,$.jsx)(se,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,$.jsx)(jt,{placeholder:x.quickCapturePlaceholder,sendLabel:x.send,onCapture:Ye,onImagePick:i?et:void 0,onVoiceCapture:i?tt:void 0,recordingLabel:x.recording})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:ve?(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))}):be.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)(H,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!ke?x.noteOutsideCurrentView:g??x.noNotes}),e&&!ke?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y??x.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!ke?(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:x.noteOutsideCurrentView}):null,be.map((t,n)=>{let r=n>0?Qe(be[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[Qe(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Ze(t.createdAt,pe,We)}),(0,$.jsx)(it,{note:t,selected:t.id===e,onPress:ot,onPin:nt,onArchive:rt,onDelete:at,timeLabels:We,labels:{pin:x.pin,unpin:x.unpin,archive:x.archive,delete:x.delete,imageNote:x.imageNote,noText:x.noText}})]},t.id)})]})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.resizeNotesList,"aria-valuemin":Nt,"aria-valuemax":Ft,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>ge(Pt),onKeyDown:ut,title:x.resizeNotesList,className:o(`group relative hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,V?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-3 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:o(`h-8 w-1 rounded-pill opacity-0 transition-[background-color,opacity,transform] duration-150`,`bg-edge-strong/55 group-hover:opacity-100 group-focus-visible:opacity-100`,`group-hover:scale-y-110 group-focus-visible:scale-y-110`,re&&`bg-accent opacity-100 scale-y-125`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[V?(0,$.jsx)(`button`,{type:`button`,onClick:()=>U(!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":x.expandNotesList,title:x.expandNotesList,children:(0,$.jsx)(ye,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Et,{noteId:e,onBack:()=>q(t),onSaved:()=>void J(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>A(!0),autoFocus:e===oe,onAutoFocusConsumed:()=>le(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)(H,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:x.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:x.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:$e,disabled:K,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)(Le,{className:`size-4`,"aria-hidden":!0}),K?x.creatingBlankNote:x.createBlankNote]})]})})]}),(0,$.jsx)(F,{open:E,onOpenChange:A,children:(0,$.jsxs)(ne,{children:[(0,$.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(T,{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)(ze,{className:`text-sm font-semibold text-fg`,children:Z}),(0,$.jsx)(k,{className:`sr-only`,children:x.searchPlaceholder}),(0,$.jsx)(L,{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":Ve,children:(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(se,{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:M,onChange:e=>P(e.target.value),onKeyDown:ct,placeholder:x.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`}),M?(0,$.jsx)(`button`,{type:`button`,onClick:()=>P(``),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":He,children:(0,$.jsx)(_,{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:Ce?Te&&!we?(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)(H,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.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:x.searchResultsCount.replace(`{{count}}`,String(we?.total??X.length))}),X.map((e,t)=>{let n=zt[e.kind]||H,r=Bt(e,{imageNote:x.imageNote,noText:x.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>st(e.id),onMouseEnter:()=>te(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===ee?`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:Xe(e.updatedAt,pe,We)})]}),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)(se,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(H,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x.needToken})]})}export{He as n,Ut as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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"./cn-BQ_8x0bT.js";import{ps as a}from"./index-
|
|
1
|
+
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"./cn-BQ_8x0bT.js";import{ps as a}from"./index-DSydVlxZ.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{Fl as r,Ml as i,Vo as a,ps as o}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{Fl as r,Ml as i,Vo as a,ps as o}from"./index-DSydVlxZ.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=n(`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:n(`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`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(i,{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:n(`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`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(i,{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=n(`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`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(r,{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};
|