@xopcai/xopc 0.0.217 → 0.0.218
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/{activity-store-D6trMTyZ.js → activity-store-DF2dYXG1.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C6q_vDzP.js → agents-Dj86bHkl.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-_H0Bam-t.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DRsTwFbF.js → app-management-settings-panel-D-M6GN-8.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B99NaPTf.js → appearance-settings-XDhmzdIc.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Dx66anqa.js → apps-page-sfO835uz.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DZCOhXch.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-Bjb0FH2B.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-D4N3ZDhu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CHbA8d-P.js → automations-workspace-PptuZgoo.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-uXPt0s47.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-gukkIEro.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CpRc-9Jy.js → browser-settings-page-BoCmzMFV.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-LKjYzXS_.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-C89FGECN.js → capabilities-settings-panel-DhkJsU8Z.js} +2 -2
- package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-BBUkH833.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XT6WEz9E.js → capability-presets-settings-panel-Dm7T61fE.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-E5mo8M3a.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DhKk1oNT.js → channels-settings-dG6UFVqt.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CTbkTsc2.js → chat-terminal-dock-CT5yoSMD.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BDn3HTzX.js → connectors-page-BC6Ft9SU.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-BGNuaqvI.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-ndtb88_T.js → dependency-picker-DZVSgLXH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-p9EZyGzV.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C7BLs783.js → desktop-pet-settings-Bw4cCFzI.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BWiap88p.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cd4BMKm_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-CzEGCkOa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BhbcGuiJ.js → extension-settings-page-C1PAKSy2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CUt9bIpL.js → gateway-config-api-Bch9vO6t.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-DNrttVr2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-RafSECLG.js → gateway-settings-DkDxZFGG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CwVPlPLB.js → heartbeat-settings-DXNMxy5b.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CbdBcCwC.js → home-page-CYcpVFNT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-BTR0Wk_k.js} +1 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
- package/dist/gateway/static/root/assets/{index-CMLkr37Y.js → index-DlOYwVFK.js} +49 -49
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-CYlS4RGA.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DdaPtQ5M.js → local-app-workbench-page-BFrgPwGE.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-CNppYVew.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-gf9Bg2gb.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CjxMHTQO.js → logs-page-CPweLw3k.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-IYk9xLgt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-D8e6pRMH.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D0fiJjBQ.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-CCq6TtEf.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-BBtWnlUU.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-BKe1xa3U.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-e99j9S9K.js → page-tabs-Bsluqyfb.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DW9MDOva.js → preview-open-alternatives-BrpTWv44.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-DXe5iWI6.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DHmAUggu.js → project-detail-page-Cww6V7HJ.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D0EiN69Y.js → projects-page-D0LKhCCw.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-xj5gOva_.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BuAVFk2O.js → remote-access-hub-Sf4Pde6Z.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-BJTvmBCA.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-DvGBa_7R.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-hzlTfgOl.js → sessions-page-S5gvgfu5.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-z0JH53Fu.js → settings-form-section-CiGFtdD8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-BNGxxXZe.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-fZQfoJAk.js → setup-status-panel-CGU_Mxjr.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-C1523ij3.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B5dPMq3Y.js → shares-settings-k0UQ8WxO.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BSN2VaqR.js → skills-page-OuHd9GcN.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Ditgz7Vo.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CSibO8vj.js → system-settings-panel-CERqCsz2.js} +1 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
- package/dist/gateway/static/root/assets/{task-detail-page-HCKZ11E8.js → task-detail-page-BnRNL2sn.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-DgSjes3O.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-zrYg51t3.js → typed-models-lib-abEJNkCO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-Bp_qFZkl.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-hbzDfErG.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-DZVib-04.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-C2RKay1p.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +21 -4
- package/dist/src/connectors/connected-source-normalizers.js +51 -4
- package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
- package/dist/src/connectors/connected-source-understanding.js +132 -0
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +11 -7
- package/dist/src/connectors/learning-coordinator.js +55 -4
- package/dist/src/connectors/learning-recipes.js +2 -2
- package/dist/src/document-understanding/extract.d.ts +1 -1
- package/dist/src/document-understanding/extract.js +54 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +9 -9
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/sources/catalog.js +9 -2
- package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
- package/dist/src/user-context/sources/local-source-contract.js +1 -0
- package/dist/src/user-context/understanding-writing.d.ts +1 -0
- package/dist/src/user-context/understanding-writing.js +4 -0
- package/dist/src/work-discovery/analyzer.d.ts +6 -0
- package/dist/src/work-discovery/analyzer.js +181 -57
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/probe.js +20 -0
- package/dist/src/work-discovery/service.d.ts +9 -0
- package/dist/src/work-discovery/service.js +18 -6
- package/dist/src/work-discovery/types.d.ts +5 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
- package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
- package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
|
@@ -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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-
|
|
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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-D0fiJjBQ.js";import{t as o}from"./cn-JdwAhgNB.js";import{l as s,o as c,r as l,s as u}from"./locale-store-gf9Bg2gb.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=s.getState().token??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await c(l(_(e,t)));if(n.status===401&&s.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,s.getState().token??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function k(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function A(e,t){let n=s.getState().token,r=new Headers;n&&r.set(`Authorization`,`Bearer ${n}`);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&s.getState().onUnauthorized(),!i.ok)throw Error(await k(i));return i.json()}var j=r();function M(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,j.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,j.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,j.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,j.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function N(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function P(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function F(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return P(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=N(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,j.jsx)(`div`,{ref:o,children:(0,j.jsx)(a,{content:l,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function I(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return u(l(`/api/notes${n?`?${n}`:``}`))}async function L(e,t=`web`){return(await u(l(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function R(e){return(await u(l(`/api/notes`),{method:`POST`,body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function z(e){let t=await c(l(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function B(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function V(e){await u(l(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function H(e){return u(l(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function U(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function W(e,t={}){return u(l(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t.forceNew?{forceNew:!0}:{})})}async function G(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function K(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function q(e){return u(l(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function J(e,t,n){return(await u(l(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function Y(e,t={}){return(await u(l(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceSessionKey:t.sourceSessionKey||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function X(e,t){let n=new FormData;return n.append(`file`,t),(await A(l(`/api/notes/${encodeURIComponent(e)}/media`),n)).attachment}async function Z(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await A(l(`/api/notes`),n)).note}async function Q(e,t=`web`){let n=await Z(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await B(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Z(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await B(r.id,{markdown:a,kind:`voice`})),r}async function ee(e){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function te(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function ne(e,t){return(await u(l(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as C,g as D,h as E,d as O,M as S,E as T,U as _,V as a,X as b,te as c,I as d,W as f,q as g,$ as h,Y as i,ee as l,Q as m,H as n,z as o,L as p,R as r,K as s,J as t,G as u,ne as v,T as w,F as x,B as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-wieRAd1y.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
|
package/dist/gateway/static/root/assets/{notes-workbench-V9C-8vSn.js → notes-workbench-wieRAd1y.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-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./circle-check-C23XjkUj.js";import{E as l,O as u,S as d,T as f,_ as p,a as m,c as h,d as g,f as _,g as v,h as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,u as D,v as O,w as k,x as A,y as j}from"./notes-api-D9CCwyWK.js";import{t as M}from"./loader-circle-CifKLtgG.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./cn-JdwAhgNB.js";import{t as I}from"./button-CSEbl4zT.js";import{t as L}from"./messages-VI9m1xJl.js";import{l as ee,n as R}from"./locale-store-De8wYkd7.js";import{i as te}from"./theme-store-STx6jo38.js";import{a as z,i as ne,n as B,o as re,r as ie,s as V,t as H}from"./dist-BPoKqzeH.js";import{i as U}from"./vendor-swr-BIWyz7Rc.js";import{Ac as W,Ai as ae,Bc as oe,Br as G,Fr as se,Gr as ce,Hr as le,Hs as ue,Ir as de,Ka as fe,Lr as pe,Ms as me,Os as he,Rr as K,Ts as q,Ua as J,Uc as ge,Ur as _e,Us as ve,Wl as Y,Wn as ye,Wr as be,Xl as xe,_s as Se,ac as Ce,al as we,bc as Te,bs as X,c as Ee,dl as De,eu as Oe,gc as ke,ic as Ae,js as je,l as Me,lc as Ne,ll as Pe,nu as Fe,o as Ie,ou as Le,qs as Re,rc as ze,ro as Be,ru as Ve,s as He,sc as Ue,tc as We,u as Ge,vl as Ke,vs as qe,ys as Je,zr as Ye}from"./index-CMLkr37Y.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(z,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=F(`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]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(V,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(P,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(B,{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:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=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]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(re,{children:[p,(0,$.jsxs)(ie,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(H,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(Xe.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=l(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=F(`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)(u,{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 f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>o(!0),t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=F(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=p);let m;return t[11]!==n||t[12]!==c||t[13]!==p?(m=(0,$.jsx)(d,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:f,className:p}),t[11]=n,t[12]=c,t[13]=p,t[14]=m):m=t[14],m}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ce(),f=ce(dt),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=F(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=F(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(M,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Ue,{className:`size-3.5`}):(0,$.jsx)(We,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=ct(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let N;t[29]===j?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=N);let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let I;return t[34]!==P||t[35]!==C||t[36]!==O?(I=(0,$.jsxs)(`div`,{className:C,onClick:ut,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=I):I=t[37],I}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=ft(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(_t),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=at(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=F(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=F(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(De,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(ze,{className:`size-4`}):(0,$.jsx)(Ae,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(de,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(Ve,{className:`size-4`}),t[47]=L):L=t[47];let ee;t[48]!==c.archive||t[49]!==I?(ee=(0,$.jsxs)(de,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=ee):ee=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Ye,{className:`my-1 h-px bg-edge-subtle`}),t[51]=R):R=t[51];let te;t[52]!==n.id||t[53]!==s?(te=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=te):te=t[54];let z;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(qe,{className:`size-4`}),t[55]=z):z=t[55];let ne;t[56]!==c.delete||t[57]!==te?(ne=(0,$.jsxs)(de,{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:te,children:[z,c.delete]}),t[56]=c.delete,t[57]=te,t[58]=ne):ne=t[58];let B;t[59]!==P||t[60]!==ee||t[61]!==ne?(B=(0,$.jsx)(pe,{children:(0,$.jsxs)(se,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[P,ee,R,ne]})}),t[59]=P,t[60]=ee,t[61]=ne,t[62]=B):B=t[62];let re;t[63]!==A||t[64]!==B?(re=(0,$.jsxs)(K,{children:[A,B]}),t[63]=A,t[64]=B,t[65]=re):re=t[65];let ie;t[66]!==C||t[67]!==O||t[68]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,re]}),t[66]=C,t[67]=O,t[68]=re,t[69]=ie):ie=t[69];let V;t[70]===n.pinned?V=t[71]:(V=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)(Ae,{className:`size-3`})}),t[70]=n.pinned,t[71]=V);let H;t[72]===n.tags?H=t[73]:(H=n.tags?.slice(0,2).map(mt),t[72]=n.tags,t[73]=H);let U;t[74]===g?U=t[75]:(U=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=U);let W;t[76]!==V||t[77]!==H||t[78]!==U?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[V,H,U]}),t[76]=V,t[77]=H,t[78]=U,t[79]=W):W=t[79];let ae;return t[80]!==ie||t[81]!==W||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,ie,W]}),t[80]=ie,t[81]=W,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:l}=e,u=l===void 0?`card`:l,d=R(xt),f=L(d).automations.suggestions,p=L(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=U(o?`automation-suggestion-coverage`:null,bt,h),_=o?g?.automations.find(e=>Me(e,o)):void 0,v=_?He(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=F(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(I,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=F(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(W,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let l;t[12]!==m||t[13]!==i?(l=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=l):l=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(I,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:l,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=F(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(I,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ee(f.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(yt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=F(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return Ge.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),k(n,r).then(i=>{if(e=!0,t){f(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&f(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(J,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let p;return t[7]!==i||t[8]!==o?(p=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=p):p=t[9],p}function Tt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=L(R(Ot)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>ye(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:l}=U(i,a,o),u,d;if(t[4]===l?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&l(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Dt);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void l();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[l],t[4]=l,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==m?(v=m?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(St,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(St,{values:m.actionItems.map(Et)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(St,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(St,{values:m.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(ke,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(wt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ke,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(Se,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(c,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Et(e){return e.title}function Dt(e,t){return e.sequence-t.sequence}function Ot(e){return e.language}var kt={edit:Ce,ai_edit:me,sync:Re,restore:Fe};function At(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function jt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=L(R(e=>e.language)).notes,o=a,{data:s}=U(e?[`note-history`,e]:null,()=>b(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await O(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=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)(ge,{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)(P,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=kt[e.trigger]??Ce,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:F(`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:At(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,h,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(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(),d(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 Mt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=L(R(zt)).notes,m=a(),h=r?.aiDeep?.catalysis,g=h?.report??null,_;t[0]===n?_=t[1]:(_=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=_);let y;t[2]===n?y=t[3]:(y=()=>E(n),t[2]=n,t[3]=y);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},t[4]=b):b=t[4];let{data:x,mutate:S,isLoading:C}=U(_,y,b),w;t[5]===n?w=t[6]:(w=async e=>{try{await p(n,e)}catch{}},t[5]=n,t[6]=w);let T=w,D;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Oe,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Te,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=k):k=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:[D,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:O})]}),(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:f.catalysisSectionDescription}),x?(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:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(()=>v(n),{revalidate:!1}),disabled:C,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:f.contextRebuild}),(0,$.jsx)(`span`,{className:F(`rounded-full px-2 py-0.5 text-[11px] font-medium`,x.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:x.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:x.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(x.attachments.length)).replace(`{{tokens}}`,String(x.tokenEstimate??0))}),x.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:x.attachments.slice(0,5).map(Rt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:g?f.recatalyze:f.catalyzeAction}),g?(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:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:g.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:g.targetUsers.slice(0,5).map(Lt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.keyQuestions.slice(0,3).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.mvpPath.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.risks.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.nextActions.slice(0,4).map(Nt)})]}),(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:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(g.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(Je,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(X,{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:f.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:[k,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,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:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,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:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>m(`/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||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.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:f.noThreads})]})]})]})}function Nt(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 Pt(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 Ft(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 It(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 Lt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Rt(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 zt(e){return e.language}var Bt=()=>i(()=>import(`./block-editor-Dqg9kvb9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),Vt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([47,1,3,44,5,48])),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.BlockEditor}))),Ut=(0,Q.lazy)(()=>Vt().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 Gt(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:we},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Ke},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Pe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.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`&&Vt()},onFocus:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},className:F(`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]=l,t[12]=r,t[13]=u):u=t[13],u}function Kt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=R(qt),h;t[0]===m?h=t[1]:(h=L(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(Jt,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)($e,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function qt(e){return e.language}function Jt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=R(e=>e.language),d=L(u).notes,f=L(u).automations.suggestions,p=a(),m=te(e=>e.resolved)===`dark`,{openImage:g}=Ze(),[v,y]=(0,Q.useState)(`wysiwyg`),[b,x]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,O]=(0,Q.useState)(!1),[k,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(360),[I,ee]=(0,Q.useState)(!1),[z,ne]=(0,Q.useState)(!1),[B,re]=(0,Q.useState)(!1),[ie,V]=(0,Q.useState)(null),H=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),G=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),he=Be(e=>e.setPageHeader),K=Be(e=>e.clearPageHeader),{data:q,mutate:J}=U(e?[`note-detail`,e]:null,()=>C(e)),{data:Y=[],mutate:ye}=U(e?[`note-threads`,e]:null,()=>D(e),{revalidateOnFocus:!1}),xe=w!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{H.current=!1,M(``),T(null),x(null),W.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!q||H.current||(M(q.title??``),H.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||xe||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),l?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[c,xe,q,e,l]);let Se=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ce=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Le,i),children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),we=(0,Q.useCallback)(t=>{M(t),e&&(se.current=t,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{let t=se.current;if(se.current=null,t!==null){O(!0);try{await j(e,{title:t}),await J(),n?.()}catch{}finally{O(!1)}}},600))},[e,J,n]),X=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:F(`flex min-w-0 items-center gap-2`,Le),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:k||Se||void 0,children:k||Se}),E?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,E,Se,k]),Ee=(0,Q.useCallback)(async(t=!1)=>{re(!0),V(null);try{let n=await _(e,{forceNew:t});await J(),await ye(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{re(!1)}},[J,ye,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),De=(0,Q.useCallback)(async()=>{ne(!0),V(null);try{await S(e),await J()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[J,e]),ke=(0,Q.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!z&&De()},[b,z,De,q?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=w?.markdown??G.current??q?.markdown??``,n=w?.title??k,r=_e([n,t].filter(Boolean).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-gukkIEro.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DlOYwVFK.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/markdown-view-D0fiJjBQ.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-gf9Bg2gb.js","assets/messages-B9WQcZ1V.js","assets/cn-JdwAhgNB.js","assets/product-delivery-tRr-7IxY.js","assets/schemas-zIBW3wiV.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DD_PgVue.css","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/notes-api-BBtWnlUU.js","assets/loader-circle-CifKLtgG.js","assets/middleware-Pd0e8Igk.js","assets/tool-activity-R8V9l6nk.js","assets/button-CSEbl4zT.js","assets/registry-api-xj5gOva_.js","assets/gateway-startup-retry-B1vD3vRb.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-DNrttVr2.js","assets/electron-env-DH5wF8X8.js","assets/activity-store-DF2dYXG1.js","assets/theme-store-DgSjes3O.js","assets/index-Dgb1R07E.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./circle-check-C23XjkUj.js";import{E as l,O as u,S as d,T as f,_ as p,a as m,c as h,d as g,f as _,g as v,h as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,u as D,v as O,w as k,x as A,y as j}from"./notes-api-BBtWnlUU.js";import{t as M}from"./loader-circle-CifKLtgG.js";import{t as N}from"./plus-Q2yW6OE7.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./cn-JdwAhgNB.js";import{t as I}from"./button-CSEbl4zT.js";import{t as L}from"./messages-B9WQcZ1V.js";import{l as ee,n as R}from"./locale-store-gf9Bg2gb.js";import{i as te}from"./theme-store-DgSjes3O.js";import{a as z,i as ne,n as B,o as re,r as ie,s as V,t as H}from"./dist-BPoKqzeH.js";import{i as U}from"./vendor-swr-BIWyz7Rc.js";import{Ac as W,Ai as ae,Bc as oe,Br as G,Fr as se,Gr as ce,Hr as le,Hs as ue,Ir as de,Ka as fe,Lr as pe,Ms as me,Os as he,Rr as K,Ts as q,Ua as J,Uc as ge,Ur as _e,Us as ve,Wl as Y,Wn as ye,Wr as be,Xl as xe,_s as Se,ac as Ce,al as we,bc as Te,bs as X,c as Ee,dl as De,eu as Oe,gc as ke,ic as Ae,js as je,l as Me,lc as Ne,ll as Pe,nu as Fe,o as Ie,ou as Le,qs as Re,rc as ze,ro as Be,ru as Ve,s as He,sc as Ue,tc as We,u as Ge,vl as Ke,vs as qe,ys as Je,zr as Ye}from"./index-DlOYwVFK.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(z,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=F(`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]=m):m=t[4];let h=a?.alt||`Image preview`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(V,{className:`sr-only`,children:h}),t[5]=h,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(P,{className:`size-5`,"aria-hidden":!0}),t[7]=_):_=t[7];let v;t[8]===i?v=t[9]:(v=(0,$.jsx)(B,{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:_})}),t[8]=i,t[9]=v);let y;t[10]===a?y=t[11]:(y=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]=y);let b;t[12]!==v||t[13]!==y||t[14]!==g?(b=(0,$.jsxs)(re,{children:[p,(0,$.jsxs)(ie,{className:m,"aria-describedby":void 0,children:[g,v,y]})]}),t[12]=v,t[13]=y,t[14]=g,t[15]=b):b=t[15];let x;t[16]!==b||t[17]!==d?(x=(0,$.jsx)(H,{open:d,onOpenChange:f,children:b}),t[16]=b,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==n||t[20]!==x?(S=(0,$.jsxs)(Xe.Provider,{value:u,children:[n,x]}),t[19]=n,t[20]=x,t[21]=S):S=t[21],S}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=l(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=F(`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)(u,{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 f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>o(!0),t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=F(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=p);let m;return t[11]!==n||t[12]!==c||t[13]!==p?(m=(0,$.jsx)(d,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:f,className:p}),t[11]=n,t[12]=c,t[13]=p,t[14]=m):m=t[14],m}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ce(),f=ce(dt),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=F(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=F(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(M,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Ue,{className:`size-3.5`}):(0,$.jsx)(We,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let j;t[25]!==_||t[26]!==p||t[27]!==g?(j=ct(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=j):j=t[28];let N;t[29]===j?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:j}),t[29]=j,t[30]=N);let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let I;return t[34]!==P||t[35]!==C||t[36]!==O?(I=(0,$.jsxs)(`div`,{className:C,onClick:ut,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=I):I=t[37],I}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=ft(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(_t),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=at(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=F(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=F(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(De,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>a(n.id,!n.pinned),t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(ze,{className:`size-4`}):(0,$.jsx)(Ae,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(de,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>o(n.id),t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(Ve,{className:`size-4`}),t[47]=L):L=t[47];let ee;t[48]!==c.archive||t[49]!==I?(ee=(0,$.jsxs)(de,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=ee):ee=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Ye,{className:`my-1 h-px bg-edge-subtle`}),t[51]=R):R=t[51];let te;t[52]!==n.id||t[53]!==s?(te=()=>s(n.id),t[52]=n.id,t[53]=s,t[54]=te):te=t[54];let z;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(qe,{className:`size-4`}),t[55]=z):z=t[55];let ne;t[56]!==c.delete||t[57]!==te?(ne=(0,$.jsxs)(de,{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:te,children:[z,c.delete]}),t[56]=c.delete,t[57]=te,t[58]=ne):ne=t[58];let B;t[59]!==P||t[60]!==ee||t[61]!==ne?(B=(0,$.jsx)(pe,{children:(0,$.jsxs)(se,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[P,ee,R,ne]})}),t[59]=P,t[60]=ee,t[61]=ne,t[62]=B):B=t[62];let re;t[63]!==A||t[64]!==B?(re=(0,$.jsxs)(K,{children:[A,B]}),t[63]=A,t[64]=B,t[65]=re):re=t[65];let ie;t[66]!==C||t[67]!==O||t[68]!==re?(ie=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,re]}),t[66]=C,t[67]=O,t[68]=re,t[69]=ie):ie=t[69];let V;t[70]===n.pinned?V=t[71]:(V=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)(Ae,{className:`size-3`})}),t[70]=n.pinned,t[71]=V);let H;t[72]===n.tags?H=t[73]:(H=n.tags?.slice(0,2).map(mt),t[72]=n.tags,t[73]=H);let U;t[74]===g?U=t[75]:(U=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=U);let W;t[76]!==V||t[77]!==H||t[78]!==U?(W=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[V,H,U]}),t[76]=V,t[77]=H,t[78]=U,t[79]=W):W=t[79];let ae;return t[80]!==ie||t[81]!==W||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ae=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,ie,W]}),t[80]=ie,t[81]=W,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ae):ae=t[87],ae}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:l}=e,u=l===void 0?`card`:l,d=R(xt),f=L(d).automations.suggestions,p=L(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=U(o?`automation-suggestion-coverage`:null,bt,h),_=o?g?.automations.find(e=>Me(e,o)):void 0,v=_?He(_,p):[];if(u===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=F(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,$.jsx)(I,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=F(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(W,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let l;t[12]!==m||t[13]!==i?(l=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=l):l=t[14];let u;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[15]=u):u=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(I,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:l,children:[u,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=F(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(I,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ee(f.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(yt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=F(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(I,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,$.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return Ge.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),k(n,r).then(i=>{if(e=!0,t){f(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&f(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(J,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let p;return t[7]!==i||t[8]!==o?(p=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=p):p=t[9],p}function Tt(e){let t=(0,Z.c)(39),{noteId:n}=e,r=L(R(Ot)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>ye(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:l}=U(i,a,o),u,d;if(t[4]===l?(u=t[5],d=t[6]):(u=()=>{let e=e=>{let t=e.detail;t&&l(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Dt);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void l();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},d=[l],t[4]=l,t[5]=u,t[6]=d),(0,Q.useEffect)(u,d),!s)return null;let{discussion:f,transcript:p}=s,m=s.organization?.organization,h=[`stopping`,`sealing`,`organizing`].includes(f.status),g=p.stats.uploaded+p.stats.transcribing,_=p.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(p.stats.failed)):g>0?r.processingSegments.replace(`{{count}}`,String(g)):h?r.finalizing:f.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==m?(v=m?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(me,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:m.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[m.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(St,{values:m.decisions})]}):null,m.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(St,{values:m.actionItems.map(Et)})]}):null,m.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(St,{values:m.risks})]}):null,m.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(St,{values:m.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=m,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==f.audioAttachmentId||t[17]!==n?(y=f.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(ke,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(wt,{noteId:n,attachmentId:f.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=f.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ke,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=f.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===f.status?C=t[23]:(C=f.status===`needs_attention`?(0,$.jsx)(Se,{className:`size-3.5 text-danger`}):f.status===`completed`?(0,$.jsx)(c,{className:`size-3.5 text-success`}):null,t[22]=f.status,t[23]=C);let w=f.status===`needs_attention`?f.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=E):E=t[29];let D=p.text||r.waitingTranscript,O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:D}),t[30]=D,t[31]=O);let k;t[32]!==E||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;return t[35]!==k||t[36]!==v||t[37]!==y?(A=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,k]}),t[35]=k,t[36]=v,t[37]=y,t[38]=A):A=t[38],A}function Et(e){return e.title}function Dt(e,t){return e.sequence-t.sequence}function Ot(e){return e.language}var kt={edit:Ce,ai_edit:me,sync:Re,restore:Fe};function At(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function jt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=L(R(e=>e.language)).notes,o=a,{data:s}=U(e?[`note-history`,e]:null,()=>b(e)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useCallback)(async t=>{l(!0),p(null);try{await O(e,t),d(null),i()}catch{p(a.restoreFailed)}finally{l(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),h=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)(ge,{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)(P,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[f?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:f}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=kt[e.trigger]??Ce,i=t===e.timestamp,s=u===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:F(`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:At(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,h,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),d(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(),d(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 Mt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:l,onOpenChat:u,onOpenNewChat:d}=e,f=L(R(zt)).notes,m=a(),h=r?.aiDeep?.catalysis,g=h?.report??null,_;t[0]===n?_=t[1]:(_=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=_);let y;t[2]===n?y=t[3]:(y=()=>E(n),t[2]=n,t[3]=y);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},t[4]=b):b=t[4];let{data:x,mutate:S,isLoading:C}=U(_,y,b),w;t[5]===n?w=t[6]:(w=async e=>{try{await p(n,e)}catch{}},t[5]=n,t[6]=w);let T=w,D;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(me,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Oe,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=O):O=t[8];let k;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Te,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=k):k=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:[D,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:f.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":f.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:O})]}),(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:f.catalysisSectionDescription}),x?(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:f.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(()=>v(n),{revalidate:!1}),disabled:C,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:f.contextRebuild}),(0,$.jsx)(`span`,{className:F(`rounded-full px-2 py-0.5 text-[11px] font-medium`,x.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:x.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:x.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:f.contextStatusDetail.replace(`{{attachments}}`,String(x.attachments.length)).replace(`{{tokens}}`,String(x.tokenEstimate??0))}),x.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:x.attachments.slice(0,5).map(Rt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?f.processing:g?f.recatalyze:f.catalyzeAction}),g?(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:f.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:g.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:g.targetUsers.slice(0,5).map(Lt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.keyQuestions.slice(0,3).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.mvpPath.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.risks.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:f.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:g.nextActions.slice(0,4).map(Nt)})]}),(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:f.confidenceLabel.replace(`{{percent}}`,String(Math.round(g.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`helpful`),className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackHelpfulAria,children:(0,$.jsx)(Je,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(`not_helpful`),className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,h?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":f.feedbackNotHelpfulAria,children:(0,$.jsx)(X,{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:f.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:[k,f.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:u,disabled:l,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:l?f.openingChat:f.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:d,disabled:l,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:f.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>m(`/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||f.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.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:f.noThreads})]})]})]})}function Nt(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 Pt(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 Ft(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 It(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 Lt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Rt(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 zt(e){return e.language}var Bt=()=>i(()=>import(`./block-editor-gukkIEro.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),Vt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([47,1,3,44,5,48])),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.BlockEditor}))),Ut=(0,Q.lazy)(()=>Vt().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 Gt(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:we},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Ke},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:Pe},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.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`&&Vt()},onFocus:()=>{t===`wysiwyg`&&Bt(),t===`source`&&Vt()},className:F(`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]=l,t[12]=r,t[13]=u):u=t[13],u}function Kt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=R(qt),h;t[0]===m?h=t[1]:(h=L(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(Jt,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)($e,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function qt(e){return e.language}function Jt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=R(e=>e.language),d=L(u).notes,f=L(u).automations.suggestions,p=a(),m=te(e=>e.resolved)===`dark`,{openImage:g}=Ze(),[v,y]=(0,Q.useState)(`wysiwyg`),[b,x]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,O]=(0,Q.useState)(!1),[k,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(360),[I,ee]=(0,Q.useState)(!1),[z,ne]=(0,Q.useState)(!1),[B,re]=(0,Q.useState)(!1),[ie,V]=(0,Q.useState)(null),H=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),G=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),he=Be(e=>e.setPageHeader),K=Be(e=>e.clearPageHeader),{data:q,mutate:J}=U(e?[`note-detail`,e]:null,()=>C(e)),{data:Y=[],mutate:ye}=U(e?[`note-threads`,e]:null,()=>D(e),{revalidateOnFocus:!1}),xe=w!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{H.current=!1,M(``),T(null),x(null),W.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!q||H.current||(M(q.title??``),H.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||xe||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),l?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[c,xe,q,e,l]);let Se=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ce=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:F(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Le,i),children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),we=(0,Q.useCallback)(t=>{M(t),e&&(se.current=t,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{let t=se.current;if(se.current=null,t!==null){O(!0);try{await j(e,{title:t}),await J(),n?.()}catch{}finally{O(!1)}}},600))},[e,J,n]),X=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:F(`flex min-w-0 items-center gap-2`,Le),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:k||Se||void 0,children:k||Se}),E?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,E,Se,k]),Ee=(0,Q.useCallback)(async(t=!1)=>{re(!0),V(null);try{let n=await _(e,{forceNew:t});await J(),await ye(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{re(!1)}},[J,ye,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),De=(0,Q.useCallback)(async()=>{ne(!0),V(null);try{await S(e),await J()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{ne(!1)}},[J,e]),ke=(0,Q.useCallback)(()=>{x(b===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!z&&De()},[b,z,De,q?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=w?.markdown??G.current??q?.markdown??``,n=w?.title??k,r=_e([n,t].filter(Boolean).join(`
|
|
3
3
|
|
|
4
4
|
`));return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:be(r,u)}},[u,d.titlePlaceholder,q?.markdown,e,w,k]),je=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:F(`flex items-center gap-2`,Le),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.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)(ve,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(le,{input:Ae,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:z,"aria-label":d.catalysisSectionTitle,className:F(`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`,b===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),z?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ee(!1),disabled:B,className:F(`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)(Te,{className:`size-3.5`,"aria-hidden":!0}),B?d.openingChat:d.openChatButton]}),(0,$.jsx)(Gt,{mode:v,onModeChange:y,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(b===`history`?null:`history`),"aria-label":d.history,className:F(`rounded-lg p-1.5 transition-colors`,b===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]}),[z,ke,Ee,v,d.history,d.modeEdit,d.modePreview,d.modeSource,B,b,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,Ae]);(0,Q.useLayoutEffect)(()=>(he({startExtra:Ce,main:q?X:null,end:q?je:null}),()=>{o&&K()}),[o,K,je,X,Ce,q,he]);let Me=(0,Q.useCallback)(t=>{e&&(G.current=t,ae.current&&clearTimeout(ae.current),ae.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){O(!0),V(null);try{await j(e,{markdown:t}),await J(),n?.()}catch(e){V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{O(!1)}}},600))},[e,J,d.saveFailed,d.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{h(e,t.timestamp).then(e=>{e&&T(e)})},[e]),Pe=(0,Q.useCallback)(()=>{x(null),T(null)},[]),Fe=(0,Q.useCallback)(()=>{x(null),T(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{ae.current&&clearTimeout(ae.current),oe.current&&clearTimeout(oe.current);let t=G.current,n=se.current;G.current=null,se.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&j(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.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:d.back})]});let Re=xe?w.title??``:k,ze=xe?w.markdown??``:q.markdown??``,Ve=new Date(q.createdAt).getTime(),He=Number.isFinite(Ve)&&Date.now()-Ve<3600*1e3?(0,$.jsx)(vt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ie?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ie}):null,(0,$.jsx)(Ie,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ie,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:ce,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(Tt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:xe?(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)(A,{noteId:e,content:ze,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[v===`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:fe,type:`text`,value:k,onChange:e=>we(e.target.value),onCompositionStart:()=>{W.current=!0},onCompositionEnd:()=>{W.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!W.current&&!t.isComposing&&(e.preventDefault(),(ce.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.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`}),He]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ht,{initialContent:q.markdown??``,onChange:Me,noteId:e},`wysiwyg-${e}`)})})]}),v===`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:fe,type:`text`,value:k,onChange:e=>we(e.target.value),placeholder:d.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`}),He]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wt,{}),children:(0,$.jsx)(Ut,{initialContent:q.markdown??``,onChange:Me,isDark:m},`source-${e}`)})})]}),v===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&g(t.currentSrc||t.src,t.alt)},children:[k&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:k}),q.markdown?(0,$.jsx)(A,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:ue,className:F(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!I&&`transition-[width] duration-300 ease-in-out`),style:{width:b?N:0},children:(0,$.jsxs)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col`,style:{width:N},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ee(!0);let n=e.clientX,r=N,i=e.pointerId,a=0,o=N,s=N,c=()=>{a=0,s=o,b&&ue.current?.style.setProperty(`width`,`${s}px`),de.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{}ee(!1),P(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:F(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,I&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:b===`history`?(0,$.jsx)(jt,{noteId:e,activeTimestamp:w?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Fe}):b===`breakdown`?(0,$.jsx)(Mt,{noteId:e,note:q??null,catalyzing:z,onCatalyze:De,onClose:()=>x(null),noteThreads:Y,openingChat:B,onOpenChat:()=>Ee(!1),onOpenNewChat:()=>Ee(!0)}):null})]})})]})}var Yt=3e4;function Xt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Zt({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)([]),k=(0,Q.useRef)(0),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Q.useEffect)(()=>()=>M(),[M]);let P=(0,Q.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||Xt()||`audio/webm`,r=new Blob(O.current,{type:n});if(M(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[M,c]),I=(0,Q.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Xt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{P()},Yt)}catch{M(),l?.()}}},[M,c,l,y,P,C]),L=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),ee=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),R=_||C,te=!!(s||c||p);return(0,$.jsxs)(`div`,{className:F(`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`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":R,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(he,{className:`size-4 fill-current`,"aria-hidden":!0})}):te?(0,$.jsxs)(K,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:R,className:`shrink-0 rounded-lg p-2 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":n,title:n,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(pe,{children:(0,$.jsxs)(se,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(de,{disabled:d,onSelect:s,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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(de,{disabled:f,onSelect:()=>void I(),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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(de,{onSelect:p,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`,children:[(0,$.jsx)(xe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:ee,placeholder:e,"aria-label":e,rows:1,disabled:R,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto 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:!h.trim()||R||y,onClick:()=>void L(),"aria-label":t,title:t,className:F(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!R&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})]})}var Qt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},$t=240,en=320,tn=520,nn=560;function rn(e){if(globalThis.localStorage===void 0)return en;try{let t=globalThis.localStorage.getItem(e);if(!t)return en;let n=Number(t);return Number.isFinite(n)?n:en}catch{return en}}function an(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var on={thought:q,todo:je,voice:ke,media:oe,bookmark:Y,mixed:q,task:je};function sn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function cn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ln(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function un({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:c,listTitle:l,listDescription:u,emptyText:d,emptyDescription:f,listWidthStorageKey:p=`xopc.notes.listWidth`}){let h=L(R(e=>e.language)).notes,_=!!ee(e=>e.token),[v,b]=(0,Q.useReducer)(ae,Qt),[S,C]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(0),[A,M]=(0,Q.useState)(()=>rn(p)),[I,te]=(0,Q.useState)(!1),[W,oe]=(0,Q.useState)(!1),[G,se]=(0,Q.useState)(!1),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[he]=(0,Q.useState)(()=>Date.now()),K=a(),J=(0,Q.useCallback)(e=>{let t=pe.current?.clientWidth??window.innerWidth,n=Math.max($t,t-nn);return Math.max($t,Math.min(Math.min(tn,n),e))},[]),ge=(0,Q.useCallback)(e=>{let t=J(e);M(t),an(p,t)},[J,p]);(0,Q.useLayoutEffect)(()=>{M(e=>J(e))},[J]);let{data:_e,mutate:Y,isLoading:ye}=U((0,Q.useMemo)(()=>_?[`notes-list`,c,v.statusFilter,v.kindFilter,v.pinnedOnly]:null,[_,c,v.statusFilter,v.kindFilter,v.pinnedOnly]),()=>g({status:v.statusFilter===`all`?void 0:v.statusFilter,kind:v.kindFilter===`all`?void 0:v.kindFilter,projectId:c,pinned:v.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),be=ye&&!_e,xe=_e?.items??[],Se=_e?.total??0,Ce=E.trim(),{data:we,isLoading:Te}=U(_&&S&&Ce?[`notes-search`,c,Ce]:null,()=>g({search:Ce,projectId:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=we?.items??[],Ee=e?xe.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{k(0)},[Ce]),(0,Q.useEffect)(()=>{O>=X.length&&k(Math.max(0,X.length-1))},[O,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let De=Be(e=>e.setPageHeader),Oe=Be(e=>e.clearPageHeader),ke=h.noteCount.replace(`{{count}}`,String(Se)),Ae=!r&&Se===0&&u?u:ke,je=h.searchDialogTitle,Me=h.searchClose,Pe=h.searchClear,Fe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:F(`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`,Le),"aria-label":je,children:[(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:je})]}),[je]);(0,Q.useLayoutEffect)(()=>{if(n)return _?(De({startExtra:null,main:(0,$.jsxs)(`div`,{className:F(`flex min-w-0 items-center gap-2`,Le),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:l??h.title}),ke?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:ke}):null]}),end:Fe}),()=>Oe()):(Oe(),()=>Oe())},[Oe,_,Fe,l,n,h.title,ke,e,De]);let Ie=(0,Q.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo}),[h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Re=(0,Q.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),ze=Re.find(e=>cn(v,e))??Re[0],Ve=l??ze.label,He=(0,Q.useCallback)(async e=>{le(null);try{let n=c?await T({markdown:e,kind:`thought`,projectId:c,channel:`web`}):await w(e,`web`);await Y(),K(ln(t,n.id))}catch(e){throw le(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,K,c]),Ue=(0,Q.useCallback)(async()=>{if(!G){se(!0),le(null);try{let e=await T({markdown:``,kind:`thought`,projectId:c,channel:`web`});b({type:`patch`,patch:Qt}),await Y(),de(e.id),K(ln(t,e.id))}catch(e){le(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{se(!1)}}},[t,G,Y,h.createBlankFailed,h.createBlankFailedHint,K,c]),We=(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{le(null),await x(t,`web`),await Y()}catch(e){le(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),Ge=(0,Q.useCallback)(async(e,t)=>{try{le(null),await y(e,t,`web`),await Y()}catch(e){le(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Ke=(0,Q.useCallback)(()=>{le(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),qe=(0,Q.useCallback)(async(e,t)=>{await j(e,{pinned:t}),await Y()},[Y]),Je=(0,Q.useCallback)(async e=>{await j(e,{status:`archived`}),await Y()},[Y]),Ye=(0,Q.useCallback)(async e=>{await m(e),await Y()},[Y]),Z=(0,Q.useCallback)(e=>{K(ln(t,e))},[t,K]),Xe=(0,Q.useCallback)(e=>{K(ln(t,e)),C(!1)},[t,K]),Ze=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),k(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),k(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[O]??X[0];t&&Xe(t.id)}}},[O,Xe,X]),Qe=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=me.current;t.setPointerCapture(e.pointerId),te(!0);let r=pe.current?.clientWidth??window.innerWidth,i=Math.max($t,r-nn),a=Math.min(tn,i),o=e=>Math.max($t,Math.min(a,e)),s=e.clientX,c=o(A),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},h=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}te(!1),pe.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),M(f),an(p,f),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[p,A]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ue())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ue]);let $e=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ge(A-16)):e.key===`ArrowRight`?(e.preventDefault(),ge(A+16)):e.key===`Home`?(e.preventDefault(),ge($t)):e.key===`End`&&(e.preventDefault(),ge(tn))},[ge,A]);return _?(0,$.jsxs)(`div`,{ref:pe,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${A}px`},children:[(0,$.jsxs)(`section`,{ref:me,className:F(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!I&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`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":W?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ce?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:ce}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(o,{value:ze.id,onChange:e=>{let t=Re.find(t=>t.id===e.target.value);t&&b({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 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":h.libraryTitle,children:Re.map(e=>(0,$.jsx)(s,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ve}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ae})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>oe(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.collapseNotesList,title:h.collapseNotesList,children:(0,$.jsx)(Ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ue,disabled:G,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":h.createBlankNote,title:h.createBlankShortcut,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(!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":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:be?(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))}):xe.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(q,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Ee?h.noteOutsideCurrentView:d??h.noNotes}),e&&!Ee?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:f??h.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ee?(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:h.noteOutsideCurrentView}):null,xe.map((t,n)=>{let r=n>0?st(xe[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:F(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,he,Ie)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:Z,onPin:qe,onArchive:Je,onDelete:Ye,timeLabels:Ie,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Zt,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:He,onImagePick:i?We:void 0,onVoiceCapture:i?Ge:void 0,onVoiceError:Ke,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>fe(c)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":$t,"aria-valuemax":tn,"aria-valuenow":Math.round(A),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>ge(en),onKeyDown:$e,title:h.resizeNotesList,className:F(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,W?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:F(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,I&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:F(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[W?(0,$.jsx)(`button`,{type:`button`,onClick:()=>oe(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":h.expandNotesList,title:h.expandNotesList,children:(0,$.jsx)(Ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Kt,{noteId:e,onBack:()=>K(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>C(!0),autoFocus:e===ue,onAutoFocusConsumed:()=>de(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)(q,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ue,disabled:G,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)(N,{className:`size-4`,"aria-hidden":!0}),G?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,$.jsx)(H,{open:S,onOpenChange:C,children:(0,$.jsxs)(re,{children:[(0,$.jsx)(z,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(ie,{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)(V,{className:`text-sm font-semibold text-fg`,children:je}),(0,$.jsx)(ne,{className:`sr-only`,children:h.searchPlaceholder}),(0,$.jsx)(B,{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":Me,children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ve,{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:E,onChange:e=>D(e.target.value),onKeyDown:Ze,placeholder:h.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`}),E?(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(``),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":Pe,children:(0,$.jsx)(P,{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)(q,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.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:h.searchResultsCount.replace(`{{count}}`,String(we?.total??X.length))}),X.map((e,t)=>{let n=on[e.kind]||q,r=sn(e,{imageNote:h.imageNote,noText:h.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>k(t),className:F(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===O?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:at(e.updatedAt,he,Ie)})]}),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)(ve,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(q,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}export{Ze as n,un 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-JdwAhgNB.js";import{Xo 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-JdwAhgNB.js";import{Xo as a}from"./index-DlOYwVFK.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"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./electron-env-DH5wF8X8.js";import{Xo as o}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./electron-env-DH5wF8X8.js";import{Xo as o}from"./index-DlOYwVFK.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=i(`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:i(`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)(r,{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:i(`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)(r,{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=i(`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)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a}from"./locale-store-gf9Bg2gb.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{a as s,r as c}from"./product-delivery-tRr-7IxY.js";import{Ua as l}from"./index-DlOYwVFK.js";import{n as u}from"./api-_H0Bam-t.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=a(h)===`zh`,m=c(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=o(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=s({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
|